[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master d4ae640: * lisp/help-fns.el (help--symbol-class): New function.
From: |
Juri Linkov |
Subject: |
master d4ae640: * lisp/help-fns.el (help--symbol-class): New function. |
Date: |
Thu, 3 Jun 2021 16:41:59 -0400 (EDT) |
branch: master
commit d4ae640a3720e11fc8736a3530bba50520412023
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/help-fns.el (help--symbol-class): New function.
Refactored from help--symbol-completion-table-affixation.
https://lists.gnu.org/archive/html/emacs-devel/2021-06/msg00066.html
---
lisp/help-fns.el | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 5a805a2..133763a 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -126,29 +126,35 @@ with the current prefix. The files are chosen according
to
:group 'help
:version "26.3")
+(defun help--symbol-class (s)
+ "Return symbol class characters for symbol S."
+ (when (stringp s)
+ (setq s (intern-soft s)))
+ (cond ((commandp s)
+ "c") ; command
+ ((eq (car-safe (symbol-function s)) 'macro)
+ "m") ; macro
+ ((fboundp s)
+ "f") ; function
+ ((custom-variable-p s)
+ "u") ; user option
+ ((boundp s)
+ "v") ; variable
+ ((facep s)
+ "a") ; fAce
+ ((and (fboundp 'cl-find-class)
+ (cl-find-class s))
+ "t") ; CL type
+ (" ") ; something else
+ ))
+
(defun help--symbol-completion-table-affixation (completions)
(mapcar (lambda (c)
(let* ((s (intern c))
(doc (condition-case nil (documentation s) (error nil)))
(doc (and doc (substring doc 0 (string-match "\n" doc)))))
(list c (propertize
- (concat (cond ((commandp s)
- "c") ; command
- ((eq (car-safe (symbol-function s))
'macro)
- "m") ; macro
- ((fboundp s)
- "f") ; function
- ((custom-variable-p s)
- "u") ; user option
- ((boundp s)
- "v") ; variable
- ((facep s)
- "a") ; fAce
- ((and (fboundp 'cl-find-class)
- (cl-find-class s))
- "t") ; CL type
- (" ")) ; something else
- " ") ; prefix separator
+ (concat (help--symbol-class s) " ") ; prefix separator
'face 'completions-annotations)
(if doc (propertize (format " -- %s" doc)
'face 'completions-annotations)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master d4ae640: * lisp/help-fns.el (help--symbol-class): New function.,
Juri Linkov <=