;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/help-incal.el (require 'apropos) (require 'close) (require 'debug) (require 'help-fns) (require 'help-mode) (require 'scroll) (require 'simple) (require 'super) (require 'view) (defun special-mode-hook-f () (set-close-key special-mode-map)) (add-hook 'special-mode-hook #'special-mode-hook-f) (defun view-mode-hook-f () (set-close-key view-mode-map)) (add-hook 'view-mode-hook #'view-mode-hook-f) (setq suggest-key-bindings 0) (setq extended-command-suggest-shorter nil) (remove-hook 'help-fns-describe-function-functions #'help-fns--mention-first-release) (setq help-fns-describe-variable-functions (cl-set-difference help-fns-describe-variable-functions '(help-fns--customize-variable help-fns--customize-variable-version help-fns--mention-first-release help-fns--var-file-local help-fns--var-ignored-local help-fns--var-risky help-fns--var-safe-local))) (defun switch-to-help-buffer () (interactive) (switch-to-buffer "*Help*") ) (defun help-back () (interactive) (help-xref-go-back (current-buffer)) ) (defun help-forward () (interactive) (help-xref-go-forward (current-buffer))) (defun describe-variable-short (var) (interactive (let*((v (variable-at-point)) (var-at-point (not (zerop v))) (v-name (when var-at-point (let ((name (symbol-name v))) (kill-new name) name ))) (v-final (completing-read (format " variable%s: " (if var-at-point (format " (default %s)" v) "")) obarray (lambda (vv) (or (get vv 'variable-documentation) (boundp vv) )) t ; require match nil ; no text insert nil ; no history v-name )) ) (list (intern v-final)) )) (message (format " %s: %s" (symbol-name var) (symbol-value var))) ) (let ((kmap completion-list-mode-map)) (set-scroll-keys kmap) (set-close-key kmap) ) (let ((kmap help-mode-map)) (set-scroll-keys kmap) (set-bury-keys kmap) (keymap-set kmap "b" #'help-back) (keymap-set kmap "f" #'help-forward) ) (defun apropos-mode-hook-f () (let ((kmap apropos-mode-map)) (set-scroll-keys kmap) (set-close-key kmap) )) (add-hook 'apropos-mode-hook #'apropos-mode-hook-f) (defun debugger-mode-hook-f () (let ((kmap debugger-mode-map)) (set-scroll-keys kmap) (set-close-key kmap) )) (add-hook 'debugger-mode-hook #'debugger-mode-hook-f) (provide 'help-incal)