From c1beb39c5b81f97e49513ebf765ee505fec922fe Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 5 Mar 2019 01:54:39 -0500 Subject: [PATCH] Rename doom/describe-setters -> doom/describe-autodefs --- core/autoload/help.el | 28 +++++++++++++----------- modules/config/default/+evil-bindings.el | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/core/autoload/help.el b/core/autoload/help.el index 700e13e57..65832dc9c 100644 --- a/core/autoload/help.el +++ b/core/autoload/help.el @@ -80,11 +80,13 @@ ;; Commands ;;;###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 -(defun doom/describe-setters (setting) - "Open the documentation of Doom functions and configuration macros." +What is an autodef? It's a function or macro that is always defined, even if its +containing module is disabled (in which case it will safely no-op). This +syntactic sugar lets you use them without needing to check if they are +available." (interactive (let* ((settings (cl-loop with case-fold-search = nil @@ -95,7 +97,7 @@ (string-match-p "[a-z]!$" sym-name)) collect sym)) (sym (symbol-at-point)) - (setting + (autodef (completing-read "Describe setter: " ;; TODO Could be cleaner (refactor me!) @@ -117,15 +119,15 @@ (when (and (symbolp sym) (string-match-p "!$" (symbol-name sym))) (symbol-name sym))))) - (list (and setting (car (split-string setting " ")))))) - (or (stringp setting) - (functionp setting) - (signal 'wrong-type-argument (list '(stringp functionp) setting))) - (let ((fn (if (functionp setting) - setting - (intern-soft setting)))) + (list (and autodef (car (split-string autodef " ")))))) + (or (stringp autodef) + (functionp autodef) + (signal 'wrong-type-argument (list '(stringp functionp) autodef))) + (let ((fn (if (functionp autodef) + autodef + (intern-soft autodef)))) (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) (helpful-callable fn) (describe-function fn)))) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 46044eade..989aae419 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -665,6 +665,7 @@ :desc "What face" "'" #'doom/what-face :desc "Describe at point" "." #'helpful-at-point :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 vanilla sandbox" "E" #'doom/open-vanilla-sandbox :desc "Describe face" "F" #'describe-face @@ -687,7 +688,6 @@ :desc "Toggle profiler" "p" #'doom/toggle-profiler :desc "Describe Doom package" "P" #'describe-package :desc "Reload theme" "r" #'doom/reload-theme - :desc "Describe DOOM setting" "s" #'doom/describe-setters :desc "Describe variable" "v" #'describe-variable :desc "Man pages" "w" #'+default/man-or-woman)