[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#39842: [PATCH] Use help-fns-short-filename in other describe- comman
From: |
Štěpán Němec |
Subject: |
bug#39842: [PATCH] Use help-fns-short-filename in other describe- commands |
Date: |
Sat, 29 Feb 2020 20:00:08 +0100 |
The commit
2015-01-16T22:52:15-05:00!monnier@iro.umontreal.ca
24b7f77581
(Improve handling of doc-strings and describe-function for cl-generic)
added 'help-fns-short-filename', which provides file name shortening
smarter than a simple 'file-name-nondirectory' call, but besides the
generic/eieio functions ('cl--generic-describe', 'cl--describe-class',
'eieio-help-constructor'), it is currently only used by
'describe-function' (via 'help-fns-function-description-header').
Make the other help commands use it, too.
(Other than the obvious consistency/maintenance argument, my immediate
motivation for this change is the possibility to customize the file
name abbreviation by advising the function.)
* lisp/help-fns.el (help-fns-short-filename): Autoload.
(describe-variable) (describe-face) (describe-keymap):
Use 'help-fns-short-filename'.
* lisp/help.el (describe-mode): Declare and use 'help-fns-short-filename'.
---
lisp/help-fns.el | 7 ++++---
lisp/help.el | 3 ++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 36c2a8b186..e204be72ad 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -661,6 +661,7 @@ help-fns--mention-first-release
(insert (format " Probably introduced at or before Emacs version
%s.\n"
first))))))
+;;;###autoload
(defun help-fns-short-filename (filename)
(let* ((abbrev (abbreviate-file-name filename))
(short abbrev))
@@ -968,7 +969,7 @@ describe-variable
" is a variable defined in `%s'.\n"
(if (eq file-name 'C-source)
"C source code"
- (file-name-nondirectory file-name))))
+ (help-fns-short-filename file-name))))
(with-current-buffer standard-output
(save-excursion
(re-search-backward (substitute-command-keys
@@ -1350,7 +1351,7 @@ describe-face
(setq file-name (find-lisp-object-file-name f 'defface))
(when file-name
(princ (substitute-command-keys "Defined in `"))
- (princ (file-name-nondirectory file-name))
+ (princ (help-fns-short-filename file-name))
(princ (substitute-command-keys "'"))
;; Make a hyperlink to the library.
(save-excursion
@@ -1642,7 +1643,7 @@ describe-keymap
" defined in `%s'.\n\n"
(if (eq file-name 'C-source)
"C source code"
- (file-name-nondirectory file-name))))
+ (help-fns-short-filename file-name))))
(save-excursion
(re-search-backward (substitute-command-keys
"`\\([^`']+\\)'")
diff --git a/lisp/help.el b/lisp/help.el
index 45cbaad4e8..32204d04e3 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -879,6 +879,7 @@ describe-key
(princ ", which is ")
(describe-function-1 defn)))))))
+(declare-function help-fns-short-filename "help-fns" (filename))
(defun describe-mode (&optional buffer)
"Display documentation of current major mode and minor modes.
A brief summary of the minor modes comes first, followed by the
@@ -975,7 +976,7 @@ describe-mode
(file-name (find-lisp-object-file-name mode nil)))
(when file-name
(princ (format-message " defined in `%s'"
- (file-name-nondirectory file-name)))
+ (help-fns-short-filename file-name)))
;; Make a hyperlink to the library.
(with-current-buffer standard-output
(save-excursion
--
2.25.1
- bug#39842: [PATCH] Use help-fns-short-filename in other describe- commands,
Štěpán Němec <=