emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 783eca5: Make describe-face also output the version


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 783eca5: Make describe-face also output the version information
Date: Sun, 14 Jul 2019 12:50:35 -0400 (EDT)

branch: master
commit 783eca57159065ea575622b74e1446853f31621a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make describe-face also output the version information
    
    * lisp/help-fns.el (describe-variable-custom-version-info): Allow
    taking a type as an optional input, so this can be used for faces,
    too (bug#30527).
    
    * lisp/faces.el (describe-face): Use this to output the version
    information.
---
 lisp/faces.el    | 10 +++++++++-
 lisp/help-fns.el | 11 ++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index f9e8c6c..5193c21 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1416,6 +1416,8 @@ argument, prompt for a regular expression using 
`read-regexp'."
        (dolist (face (face-list))
          (copy-face face face frame disp-frame)))))
 
+(declare-function describe-variable-custom-version-info "help-fns"
+                  (variable &optional type))
 
 (defun describe-face (face &optional frame)
   "Display the properties of face FACE on FRAME.
@@ -1428,6 +1430,7 @@ If FRAME is omitted or nil, use the selected frame."
   (interactive (list (read-face-name "Describe face"
                                      (or (face-at-point t) 'default)
                                      t)))
+  (require 'help-fns)
   (let* ((attrs '((:family . "Family")
                  (:foundry . "Foundry")
                  (:width . "Width")
@@ -1524,7 +1527,12 @@ If FRAME is omitted or nil, use the selected frame."
                          (re-search-backward ": \\([^:]+\\)" nil t)
                          (help-xref-button 1 'help-face attr)))
                    (insert "\n")))))
-           (terpri)))))))
+           (terpri)
+            (let ((version-info (describe-variable-custom-version-info
+                                 f 'face)))
+              (when version-info
+                (insert version-info)
+                (terpri)))))))))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 39f701a..0b5c547 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -860,14 +860,15 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be 
bound."
                 (and (or any-symbol (boundp sym)) sym)))))
         0)))
 
-(defun describe-variable-custom-version-info (variable)
+(defun describe-variable-custom-version-info (variable &optional type)
   (let ((custom-version (get variable 'custom-version))
        (cpv (get variable 'custom-package-version))
+        (type (or type "variable"))
        (output nil))
     (if custom-version
        (setq output
-             (format "This variable was introduced, or its default value was 
changed, in\nversion %s of Emacs.\n"
-                     custom-version))
+             (format "This %s was introduced, or its default value was 
changed, in\nversion %s of Emacs.\n"
+                      type custom-version))
       (when cpv
        (let* ((package (car-safe cpv))
               (version (if (listp (cdr-safe cpv))
@@ -877,11 +878,11 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be 
bound."
               (emacsv (cdr (assoc version pkg-versions))))
          (if (and package version)
              (setq output
-                   (format (concat "This variable was introduced, or its 
default value was changed, in\nversion %s of the %s package"
+                   (format (concat "This %s was introduced, or its default 
value was changed, in\nversion %s of the %s package"
                                    (if emacsv
                                        (format " that is part of Emacs %s" 
emacsv))
                                    ".\n")
-                           version package))))))
+                           type version package))))))
     output))
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]