diff --git a/emacs/custom.el b/emacs/custom.el index 60e3ac5..7c01fd9 100644 --- a/emacs/custom.el +++ b/emacs/custom.el @@ -36,13 +36,14 @@ ;; If there is more than one, they won't work right. '(cursor-type 'bar) '(custom-safe-themes - '("2224b07a70ad0e4f11eef482f9551efa57d7cc27c943ffd43edd01ed85ed2ebf" "fbd3f3b9e2b5c2fefd006c70afb5c514dd37b0c0427cff007ca589eedfcfa2b9" default)) + '("2224b07a70ad0e4f11eef482f9551efa57d7cc27c943ffd43edd01ed85ed2ebf" "fbd3f3b9e2b5c2fefd006c70afb5c514dd37b0c0427cff007ca589eedfcfa2b9" default)) '(elfeed-feeds - '("https://www.thenation.com/feed/?post_type=article" "https://feeds2.feedburner.com/google/RzFQ" "https://api.substack.com/feed/podcast/365422.rss" "https://stallman.org/rss/rss.xml" "https://danielpocock.com/feed.atom")) + '("https://www.thenation.com/feed/?post_type=article" "https://feeds2.feedburner.com/google/RzFQ" "https://api.substack.com/feed/podcast/365422.rss" "https://stallman.org/rss/rss.xml" "https://danielpocock.com/feed.atom")) + '(indent-tabs-mode nil) '(mc/always-run-for-all t) '(menu-bar-mode nil) '(safe-local-variable-values - '((flycheck-disabled-checkers emacs-lisp-checkdoc emacs-lisp))) + '((flycheck-disabled-checkers emacs-lisp-checkdoc emacs-lisp))) '(tab-width 2) '(tool-bar-mode nil)) (custom-set-faces diff --git a/emacs/init.el b/emacs/init.el index 4b49c47..a9d804c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -22,16 +22,16 @@ ;; setup load paths (add-to-list 'load-path (expand-file-name - "cfg" user-emacs-directory)) + "cfg" user-emacs-directory)) (add-to-list 'load-path (expand-file-name - "lisp" user-emacs-directory)) + "lisp" user-emacs-directory)) (add-to-list 'load-path (expand-file-name - "module" user-emacs-directory)) + "module" user-emacs-directory)) (add-to-list 'load-path (expand-file-name - "feature" user-emacs-directory)) + "feature" user-emacs-directory)) (require 'feature-base) ; prep the beast (require 'feature-km) ; knowledge management diff --git a/emacs/module/module-base.el b/emacs/module/module-base.el index c6dc63a..44ffa56 100644 --- a/emacs/module/module-base.el +++ b/emacs/module/module-base.el @@ -54,7 +54,7 @@ kept-new-versions 20 kept-old-versions 2 minibuffer-prompt-properties '(read-only t cursor-intangible t - face minibuffer-prompt) + face minibuffer-prompt) mouse-autoselect-window t read-extended-command-predicate #'command-completion-default-include-p read-process-output-max (* 1024 1024) @@ -65,11 +65,11 @@ backup-directory-alist `((".*" . ,(concat user-emacs-directory "backup"))) read-extended-command-predicate #'command-completion-default-include-p gc-cons-threshold 100000000 - auth-sources '("~/.authinfo.gpg") + auth-sources '("~/.authinfo.gpg") warning-minimum-level :emergency - large-file-warning-threshold nil - tramp-persistency-file-name "~/.config/emacs/tramp" - tramp-inline-compress-start-size 1000) + large-file-warning-threshold nil + tramp-persistency-file-name "~/.config/emacs/tramp" + tramp-inline-compress-start-size 1000) ;; load custom file (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) diff --git a/emacs/module/module-golang.el b/emacs/module/module-golang.el index 24a3753..a5f4718 100644 --- a/emacs/module/module-golang.el +++ b/emacs/module/module-golang.el @@ -11,8 +11,41 @@ (pkg/require-defer 'go-mode) (with-eval-after-load 'go-mode - (add-to-list 'auto-mode-alist '("\\.go$" . go-mode)) - (add-hook 'before-save-hook #'gofmt-before-save)) + (add-to-list 'auto-mode-alist '("\\.go$" . go-mode)) + (add-hook 'before-save-hook #'gofmt-before-save)) + +(defun my/godoc-at-point () + "Run godoc on the selected region or symbol at point, including dot-separated parts." + (interactive) + (let (default start end) + (if (use-region-p) + (setq start (region-beginning) + end (region-end) + default (buffer-substring-no-properties start end)) + (let ((bounds (bounds-of-thing-at-point 'symbol))) + (setq start (if bounds (car bounds) (point)) + end (if bounds (cdr bounds) (point)) + default (if bounds + (buffer-substring-no-properties start end) + nil)))) + (unless (use-region-p) + (save-excursion + (goto-char start) + (while (and (> (point) (point-min)) + (eq (char-before) ?.)) + (backward-sexp) + (setq start (point))) + (goto-char end) + (while (and (< (point) (point-max)) + (eq (char-after) ?.)) + (forward-sexp) + (setq end (point))) + (setq default (buffer-substring-no-properties start end)))) + (godoc (read-string "Go documentation: " default)))) + +(add-hook 'go-mode-hook + (lambda () + (local-set-key (kbd "C-c C-d") 'godoc-at-point-with-default))) (provide 'module-golang)