branch: externals/hyperbole
commit db58faa356d2a07dc8127da9e5f0b752bdd233a0
Merge: dd2405c503 6e8d31f998
Author: Robert Weiner <r...@gnu.org>
Commit: GitHub <nore...@github.com>

    Merge pull request #554 from rswgnu/rsw
    
    hibtypes.el - grep-msg - Use find-library-name on proper file types
---
 ChangeLog   |  6 ++++++
 hibtypes.el | 13 ++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4ddc4eb7b6..c3c9deb99a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,12 @@
 
 2024-06-30  Bob Weiner  <r...@gnu.org>
 
+* hibtypes.el (grep-msg): Fix bug where 'find-library-name' was called
+    on a non-Elisp library file and stripped its suffix and replaced it with
+    a different one; now uses only if file lacks a suffix or the suffix
+    matches one from 'get-load-suffixes'.  So "hyperbole.texi" will not lead
+    to a path ending in "hyperbole.el".
+
 * hbut.el (defib): Remove requirement for call to 'hact' since sometimes
     the action includes this instead.
 
diff --git a/hibtypes.el b/hibtypes.el
index d66efa347c..9217f6cf97 100644
--- a/hibtypes.el
+++ b/hibtypes.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Sep-91 at 20:45:31
-;; Last-Mod:     30-Jun-24 at 10:34:39 by Bob Weiner
+;; Last-Mod:     30-Jun-24 at 16:00:23 by Bob Weiner
 ;;
 ;; SPDX-License-Identifier: GPL-3.0-or-later
 ;;
@@ -1060,11 +1060,18 @@ in grep and shell buffers."
               ;; RSW 12-05-2021 - Added hpath:expand in next line to
               ;; resolve any variables in the path before checking if absolute.
                (source-loc (unless (file-name-absolute-p (hpath:expand file))
-                             (hbut:to-key-src t))))
+                             (hbut:to-key-src t)))
+              ext)
           (if (stringp source-loc)
               (setq file (expand-file-name file (file-name-directory 
source-loc)))
            (setq file (or (hpath:prepend-shell-directory file)
-                          (ignore-errors (find-library-name file))
+                          ;; find-library-name will strip file
+                          ;; suffixes, so use it only when the file
+                          ;; either doesn't have a suffix or has a
+                          ;; library suffix.
+                          (and (or (null (setq ext (file-name-extension file)))
+                                   (member (concat "." ext) 
(get-load-suffixes)))
+                               (ignore-errors (find-library-name file)))
                           (expand-file-name file))))
          (when (file-exists-p file)
             (setq line-num (string-to-number line-num))

Reply via email to