diff options
| author | Lars Ingebrigtsen | 2019-07-14 17:01:58 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-14 17:02:05 +0200 |
| commit | a7aae1473c1aed7758b550a23cda61ee17668e23 (patch) | |
| tree | a105963a091ce12684a7eaa60d38261b855ae54a | |
| parent | 8ff09154a29a1151afb2902267ca35f89ebda73c (diff) | |
| download | emacs-a7aae1473c1aed7758b550a23cda61ee17668e23.tar.gz emacs-a7aae1473c1aed7758b550a23cda61ee17668e23.zip | |
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.
| -rw-r--r-- | lisp/faces.el | 11 | ||||
| -rw-r--r-- | lisp/help-fns.el | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index f9e8c6c58b8..c3ef7dcb0f7 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | 25 | ||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | 27 | ||
| 28 | (require 'subr-x) | ||
| 29 | |||
| 28 | (defcustom term-file-prefix (purecopy "term/") | 30 | (defcustom term-file-prefix (purecopy "term/") |
| 29 | "If non-nil, Emacs startup performs terminal-specific initialization. | 31 | "If non-nil, Emacs startup performs terminal-specific initialization. |
| 30 | It does this by: (load (concat term-file-prefix (getenv \"TERM\"))) | 32 | It does this by: (load (concat term-file-prefix (getenv \"TERM\"))) |
| @@ -1416,6 +1418,8 @@ argument, prompt for a regular expression using `read-regexp'." | |||
| 1416 | (dolist (face (face-list)) | 1418 | (dolist (face (face-list)) |
| 1417 | (copy-face face face frame disp-frame))))) | 1419 | (copy-face face face frame disp-frame))))) |
| 1418 | 1420 | ||
| 1421 | (declare-function describe-variable-custom-version-info "help-fns" | ||
| 1422 | (variable &optional type)) | ||
| 1419 | 1423 | ||
| 1420 | (defun describe-face (face &optional frame) | 1424 | (defun describe-face (face &optional frame) |
| 1421 | "Display the properties of face FACE on FRAME. | 1425 | "Display the properties of face FACE on FRAME. |
| @@ -1428,6 +1432,7 @@ If FRAME is omitted or nil, use the selected frame." | |||
| 1428 | (interactive (list (read-face-name "Describe face" | 1432 | (interactive (list (read-face-name "Describe face" |
| 1429 | (or (face-at-point t) 'default) | 1433 | (or (face-at-point t) 'default) |
| 1430 | t))) | 1434 | t))) |
| 1435 | (require 'help-fns) | ||
| 1431 | (let* ((attrs '((:family . "Family") | 1436 | (let* ((attrs '((:family . "Family") |
| 1432 | (:foundry . "Foundry") | 1437 | (:foundry . "Foundry") |
| 1433 | (:width . "Width") | 1438 | (:width . "Width") |
| @@ -1524,7 +1529,11 @@ If FRAME is omitted or nil, use the selected frame." | |||
| 1524 | (re-search-backward ": \\([^:]+\\)" nil t) | 1529 | (re-search-backward ": \\([^:]+\\)" nil t) |
| 1525 | (help-xref-button 1 'help-face attr))) | 1530 | (help-xref-button 1 'help-face attr))) |
| 1526 | (insert "\n"))))) | 1531 | (insert "\n"))))) |
| 1527 | (terpri))))))) | 1532 | (terpri) |
| 1533 | (when-let ((version-info (describe-variable-custom-version-info | ||
| 1534 | f 'face))) | ||
| 1535 | (insert version-info)) | ||
| 1536 | (terpri))))))) | ||
| 1528 | 1537 | ||
| 1529 | 1538 | ||
| 1530 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1539 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 39f701ae2a8..0b5c547d6b0 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." | |||
| 860 | (and (or any-symbol (boundp sym)) sym))))) | 860 | (and (or any-symbol (boundp sym)) sym))))) |
| 861 | 0))) | 861 | 0))) |
| 862 | 862 | ||
| 863 | (defun describe-variable-custom-version-info (variable) | 863 | (defun describe-variable-custom-version-info (variable &optional type) |
| 864 | (let ((custom-version (get variable 'custom-version)) | 864 | (let ((custom-version (get variable 'custom-version)) |
| 865 | (cpv (get variable 'custom-package-version)) | 865 | (cpv (get variable 'custom-package-version)) |
| 866 | (type (or type "variable")) | ||
| 866 | (output nil)) | 867 | (output nil)) |
| 867 | (if custom-version | 868 | (if custom-version |
| 868 | (setq output | 869 | (setq output |
| 869 | (format "This variable was introduced, or its default value was changed, in\nversion %s of Emacs.\n" | 870 | (format "This %s was introduced, or its default value was changed, in\nversion %s of Emacs.\n" |
| 870 | custom-version)) | 871 | type custom-version)) |
| 871 | (when cpv | 872 | (when cpv |
| 872 | (let* ((package (car-safe cpv)) | 873 | (let* ((package (car-safe cpv)) |
| 873 | (version (if (listp (cdr-safe cpv)) | 874 | (version (if (listp (cdr-safe cpv)) |
| @@ -877,11 +878,11 @@ If ANY-SYMBOL is non-nil, don't insist the symbol be bound." | |||
| 877 | (emacsv (cdr (assoc version pkg-versions)))) | 878 | (emacsv (cdr (assoc version pkg-versions)))) |
| 878 | (if (and package version) | 879 | (if (and package version) |
| 879 | (setq output | 880 | (setq output |
| 880 | (format (concat "This variable was introduced, or its default value was changed, in\nversion %s of the %s package" | 881 | (format (concat "This %s was introduced, or its default value was changed, in\nversion %s of the %s package" |
| 881 | (if emacsv | 882 | (if emacsv |
| 882 | (format " that is part of Emacs %s" emacsv)) | 883 | (format " that is part of Emacs %s" emacsv)) |
| 883 | ".\n") | 884 | ".\n") |
| 884 | version package)))))) | 885 | type version package)))))) |
| 885 | output)) | 886 | output)) |
| 886 | 887 | ||
| 887 | ;;;###autoload | 888 | ;;;###autoload |