[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/marginalia d8d03f1f83 1/3: marginalia--symbol-class: Ad
From: |
ELPA Syncer |
Subject: |
[elpa] externals/marginalia d8d03f1f83 1/3: marginalia--symbol-class: Add help-echo for helpful mouse hover |
Date: |
Wed, 8 Feb 2023 16:57:48 -0500 (EST) |
branch: externals/marginalia
commit d8d03f1f83cbc40120bb984d713f7a760473d87a
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
marginalia--symbol-class: Add help-echo for helpful mouse hover
---
marginalia.el | 81 +++++++++++++++++++++++++++++++++--------------------------
1 file changed, 45 insertions(+), 36 deletions(-)
diff --git a/marginalia.el b/marginalia.el
index 466a054bda..529d97228d 100644
--- a/marginalia.el
+++ b/marginalia.el
@@ -470,42 +470,51 @@ l local (L modified compared to default value)
Other:
a face
t cl-type"
- (format
- "%-6s"
- (concat
- (when (fboundp s)
- (concat
- (cond
- ((get s 'pure) "p")
- ((get s 'side-effect-free) "s"))
- (cond
- ((commandp s) (if (get s 'interactive-only) "C" "c"))
- ((cl-generic-p s) "g")
- ((macrop (symbol-function s)) "m")
- ((special-form-p (symbol-function s)) "M")
- (t "f"))
- (and (autoloadp (symbol-function s)) "@")
- (and (marginalia--advised s) "!")
- (and (symbolp (symbol-function s)) "&")
- (and (get s 'byte-obsolete-info) "-")))
- (when (boundp s)
- (concat
- (when (local-variable-if-set-p s)
- (if (ignore-errors
- (not (equal (symbol-value s)
- (default-value s))))
- "L" "l"))
- (if (custom-variable-p s)
- (if (ignore-errors
- (not (equal
- (symbol-value s)
- (eval (car (get s 'standard-value))))))
- "U" "u")
- "v")
- (ignore-errors (and (not (eq (indirect-variable s) s)) "&"))
- (and (get s 'byte-obsolete-variable) "-")))
- (and (facep s) "a")
- (and (get s 'cl--class) "t")))) ;; cl-find-class, cl--find-class
+ (let ((class
+ (append
+ (when (fboundp s)
+ (list
+ (cond
+ ((get s 'pure) '("p" . "pure"))
+ ((get s 'side-effect-free) '("s" . "side-effect-free")))
+ (cond
+ ((commandp s)
+ (if (get s 'interactive-only)
+ '("C" . "interactive-only command")
+ '("c" . "command")))
+ ((cl-generic-p s) '("g" . "cl-generic"))
+ ((macrop (symbol-function s)) '("m" . "macro"))
+ ((special-form-p (symbol-function s)) '("M" . "special-form"))
+ (t '("f" . "function")))
+ (and (autoloadp (symbol-function s)) '("@" . "autoload"))
+ (and (marginalia--advised s) '("!" . "advised"))
+ (and (symbolp (symbol-function s)) '("&" . "alias"))
+ (and (get s 'byte-obsolete-info) '("-" . "obsolete"))))
+ (when (boundp s)
+ (list
+ (when (local-variable-if-set-p s)
+ (if (ignore-errors
+ (not (equal (symbol-value s)
+ (default-value s))))
+ '("L" . "local, modified from global")
+ '("l" . "local, unmodified")))
+ (if (custom-variable-p s)
+ (if (ignore-errors
+ (not (equal (symbol-value s)
+ (eval (car (get s 'standard-value))))))
+ '("U" . "custom, modified from standard")
+ '("u" . "custom, unmodified"))
+ '("v" . "variable"))
+ (ignore-errors (and (not (eq (indirect-variable s) s)) '("&" .
"alias")))
+ (and (get s 'byte-obsolete-variable) '("-" . "obsolete"))))
+ (list
+ (and (facep s) '("a" . "face"))
+ (and (get s 'cl--class) '("t" . "cl-type")))))) ;; cl-find-class,
cl--find-class
+ (setq class (delq nil class))
+ (propertize
+ (format "%-6s" (mapconcat #'car class ""))
+ 'help-echo
+ (mapconcat (pcase-lambda (`(,x . ,y)) (concat x " " y)) class "\n"))))
(defun marginalia--function-doc (sym)
"Documentation string of function SYM."