summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/mm-documentation.el
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs/modules/mm-documentation.el')
-rw-r--r--.config/emacs/modules/mm-documentation.el46
1 files changed, 46 insertions, 0 deletions
diff --git a/.config/emacs/modules/mm-documentation.el b/.config/emacs/modules/mm-documentation.el
new file mode 100644
index 0000000..51a671f
--- /dev/null
+++ b/.config/emacs/modules/mm-documentation.el
@@ -0,0 +1,46 @@
+;;; mm-documentation.el --- Configuration related to documentation -*- lexical-binding: t; -*-
+
+;;; Enhance Describe Commands
+
+;; PKG-EXTERN
+(use-package helpful
+ :ensure t
+ :bind (([remap describe-command] . helpful-command)
+ ([remap describe-function] . helpful-callable)
+ ([remap describe-key] . helpful-key)
+ ([remap describe-symbol] . helpful-symbol)
+ ([remap describe-variable] . helpful-variable)
+ :map emacs-lisp-mode-map
+ ("C-h C-p" . helpful-at-point)))
+
+
+;;; Open Manpage for Symbol
+
+(defun mm-documentation-man-at-point ()
+ "Open a UNIX manual page for the symbol at point."
+ (interactive nil c-mode c++-mode c-ts-mode c++-ts-mode)
+ (if-let ((symbol
+ (pcase major-mode
+ ((or 'c-mode 'c++-mode)
+ (thing-at-point 'symbol :no-properties))
+ ((or 'c-ts-mode 'c++-ts-mode)
+ (when-let ((node (treesit-thing-at-point "identifier" 'nested)))
+ (treesit-node-text node :no-properties))))))
+ (man symbol)
+ (message "There is no symbol at point.")))
+
+
+;;; Browse RFC Pages
+
+;; PKG-EXTERN
+(use-package rfc-mode
+ :ensure t
+ :custom
+ (rfc-mode-directory (expand-file-name "rfc" (xdg-user-dir "DOCUMENTS")))
+ :config
+ (unless (featurep 'consult)
+ (keymap-set rfc-mode-map "g" #'imenu))
+ (with-eval-after-load 'consult
+ (keymap-set rfc-mode-map "g" #'consult-imenu)))
+
+(provide 'mm-documentation)