small code improvements

This commit is contained in:
Łukasz Pankowski 2019-12-15 20:15:28 +01:00
parent cc78bafa5b
commit dff227a67c
2 changed files with 11 additions and 24 deletions

13
init.el
View File

@ -350,7 +350,7 @@ of the key binding used to execute this command."
(let ((character ?a))
(while (<= character ?z)
(define-key my-switch-to-register-map
(format "%c" character) #'my-switch-to-register)
(char-to-string character) #'my-switch-to-register)
(setq character (1+ character))))
(global-set-key (kbd "s-s") my-switch-to-register-map)
@ -486,7 +486,7 @@ of the key binding used to execute this command."
slime-default-lisp 'sbcl
slime-contribs '(slime-fancy))
(let ((path (expand-file-name "/usr/local/share/doc/HyperSpec/")))
(let ((path "/usr/local/share/doc/HyperSpec/"))
(if (file-accessible-directory-p path)
(setq common-lisp-hyperspec-root (concat "file://" path))))
@ -575,9 +575,8 @@ If there is a space before the brace also adds new line with
properly indented closing brace and moves cursor to another line
inserted between the braces between the braces."
(interactive)
(if (not (looking-back " "))
(insert "{")
(insert "{")
(insert "{")
(when (looking-back " {")
(newline)
(indent-according-to-mode)
(save-excursion
@ -1030,9 +1029,7 @@ Argument FRAMES has the same meaning as for `set-frame-font'"
(interactive)
(let ((dark-p (custom-theme-enabled-p my-dark-theme)))
(mapc #'disable-theme custom-enabled-themes)
(if dark-p
(load-theme my-light-theme t)
(load-theme my-dark-theme t)))
(load-theme (if dark-p my-light-theme my-dark-theme) t))
(my-helm-themes-after))
(global-set-key (kbd "C-S-<f6>") #'my-toggle-theme)

View File

@ -32,9 +32,8 @@ If there is a space before the brace also adds new line with
properly indented closing brace and moves cursor to another line
inserted between the braces between the braces."
(interactive)
(if (not (looking-back " "))
(insert "{")
(insert "{")
(insert "{")
(when (looking-back " {")
(newline)
(indent-according-to-mode)
(save-excursion
@ -42,19 +41,11 @@ inserted between the braces between the braces."
(insert "}")
(indent-according-to-mode))))
(defun my-go-list-packages ()
"Return list of Go packages."
(split-string
(with-temp-buffer
(shell-command "go list ... 2>/dev/null" (current-buffer))
(buffer-substring-no-properties (point-min) (point-max)))
"\n"))
(defun my-godoc-package ()
"Display godoc for given package (with completion)."
(interactive)
(godoc (helm :sources (helm-build-sync-source "Go packages"
:candidates (my-go-list-packages))
:candidates (go-packages))
:buffer "*godoc packages*")))
(use-package flycheck
@ -67,16 +58,15 @@ inserted between the braces between the braces."
:defer)
(use-package go-guru
:defer)
:after go-mode)
(use-package go-mode
:init
(setq gofmt-command "goimports" ; use goimports instead of gofmt
go-fontify-function-calls nil ; fontifing names of called
; functions is too much for me
company-idle-delay nil)
:config
(require 'go-guru)
company-idle-delay nil) ; avoid auto completion popup, use TAB
; to show it
:bind
(:map go-mode-map
("M-." . go-guru-definition)