GNU bug report logs -
#39842
[PATCH] Use help-fns-short-filename in other describe- commands
Previous Next
Reported by: Štěpán Němec <stepnem <at> gmail.com>
Date: Sat, 29 Feb 2020 19:01:01 UTC
Severity: wishlist
Tags: patch
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Tue, 03 Mar 2020 10:53:09 -0500
with message-id <jwv4kv5zb97.fsf-monnier+emacs <at> gnu.org>
and subject line Re: [PATCH] Use help-fns-short-filename in other describe- commands
has caused the debbugs.gnu.org bug report #39842,
regarding [PATCH] Use help-fns-short-filename in other describe- commands
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
39842: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=39842
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
The commit
2015-01-16T22:52:15-05:00!monnier <at> 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
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/x-markdown, inline)]
> Patch updated to that effect attached.
Thanks, installed into `master`.
Stefan
This bug report was last modified 5 years and 81 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.