Rename doom/describe-setters -> doom/describe-autodefs

This commit is contained in:
Henrik Lissner 2019-03-05 01:54:39 -05:00
parent cfa97470fc
commit c1beb39c5b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 16 additions and 14 deletions

View file

@ -80,11 +80,13 @@
;; Commands ;; Commands
;;;###autoload ;;;###autoload
(define-obsolete-function-alias 'doom/describe-setting 'doom/describe-setters "2.1.0") (defun doom/describe-autodefs (autodef)
"Open the documentation of Doom autodefs.
;;;###autoload What is an autodef? It's a function or macro that is always defined, even if its
(defun doom/describe-setters (setting) containing module is disabled (in which case it will safely no-op). This
"Open the documentation of Doom functions and configuration macros." syntactic sugar lets you use them without needing to check if they are
available."
(interactive (interactive
(let* ((settings (let* ((settings
(cl-loop with case-fold-search = nil (cl-loop with case-fold-search = nil
@ -95,7 +97,7 @@
(string-match-p "[a-z]!$" sym-name)) (string-match-p "[a-z]!$" sym-name))
collect sym)) collect sym))
(sym (symbol-at-point)) (sym (symbol-at-point))
(setting (autodef
(completing-read (completing-read
"Describe setter: " "Describe setter: "
;; TODO Could be cleaner (refactor me!) ;; TODO Could be cleaner (refactor me!)
@ -117,15 +119,15 @@
(when (and (symbolp sym) (when (and (symbolp sym)
(string-match-p "!$" (symbol-name sym))) (string-match-p "!$" (symbol-name sym)))
(symbol-name sym))))) (symbol-name sym)))))
(list (and setting (car (split-string setting " ")))))) (list (and autodef (car (split-string autodef " "))))))
(or (stringp setting) (or (stringp autodef)
(functionp setting) (functionp autodef)
(signal 'wrong-type-argument (list '(stringp functionp) setting))) (signal 'wrong-type-argument (list '(stringp functionp) autodef)))
(let ((fn (if (functionp setting) (let ((fn (if (functionp autodef)
setting autodef
(intern-soft setting)))) (intern-soft autodef))))
(or (fboundp fn) (or (fboundp fn)
(error "'%s' is not a valid DOOM setting" setting)) (error "'%s' is not a valid DOOM autodef" autodef))
(if (fboundp 'helpful-callable) (if (fboundp 'helpful-callable)
(helpful-callable fn) (helpful-callable fn)
(describe-function fn)))) (describe-function fn))))

View file

@ -665,6 +665,7 @@
:desc "What face" "'" #'doom/what-face :desc "What face" "'" #'doom/what-face
:desc "Describe at point" "." #'helpful-at-point :desc "Describe at point" "." #'helpful-at-point
:desc "Describe active minor modes" ";" #'doom/describe-active-minor-mode :desc "Describe active minor modes" ";" #'doom/describe-active-minor-mode
:desc "Describe Doom autodef" "A" #'doom/describe-autodefs
:desc "Open Doom manual" "D" #'doom/open-manual :desc "Open Doom manual" "D" #'doom/open-manual
:desc "Open vanilla sandbox" "E" #'doom/open-vanilla-sandbox :desc "Open vanilla sandbox" "E" #'doom/open-vanilla-sandbox
:desc "Describe face" "F" #'describe-face :desc "Describe face" "F" #'describe-face
@ -687,7 +688,6 @@
:desc "Toggle profiler" "p" #'doom/toggle-profiler :desc "Toggle profiler" "p" #'doom/toggle-profiler
:desc "Describe Doom package" "P" #'describe-package :desc "Describe Doom package" "P" #'describe-package
:desc "Reload theme" "r" #'doom/reload-theme :desc "Reload theme" "r" #'doom/reload-theme
:desc "Describe DOOM setting" "s" #'doom/describe-setters
:desc "Describe variable" "v" #'describe-variable :desc "Describe variable" "v" #'describe-variable
:desc "Man pages" "w" #'+default/man-or-woman) :desc "Man pages" "w" #'+default/man-or-woman)