From 9ae6dbe02f69e2558512ae316e02623768ef6f48 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Mon, 9 Dec 2024 13:41:32 +0100 Subject: [PATCH] Fix bug#74504 --- lisp/help-fns.el | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 35858dbca38..1f3527128b3 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1082,22 +1082,14 @@ TYPE indicates the namespace and is `fun' or `var'." rt))) (defun help-fns-short-filename (filename) - (let* ((short (help-fns--filename filename)) - (prefixes (radix-tree-prefixes (help-fns--radix-tree load-path) - (file-name-directory short)))) - (if (not prefixes) - ;; The file is not inside the `load-path'. - ;; FIXME: Here's the old code (too slow, bug#73766), - ;; which used to try and shorten it with "../" as well. - ;; (dolist (dir load-path) - ;; (let ((rel (file-relative-name filename dir))) - ;; (if (< (length rel) (length short)) - ;; (setq short rel))) - ;; (let ((rel (file-relative-name abbrev dir))) - ;; (if (< (length rel) (length short)) - ;; (setq short rel)))) - short - (file-relative-name short (caar prefixes))))) + (cond + ((eq filename 'C-source) "C source code") + ((equal (file-name-extension filename) "el") + (let* ((short (help-fns--filename filename)) + (prefixes (radix-tree-prefixes (help-fns--radix-tree load-path) + (file-name-directory short)))) + (if prefixes (file-relative-name short (caar prefixes)) short))) + (t filename))) (defun help-fns--analyze-function (function) ;; FIXME: Document/explain the differences between FUNCTION, -- 2.39.2