33; ; Author: Bob Weiner
44; ;
55; ; Orig-Date: 19-Sep-91 at 20:45:31
6- ; ; Last-Mod: 22-Mar-26 at 14:08:04 by Bob Weiner
6+ ; ; Last-Mod: 22-Mar-26 at 18:18:45 by Bob Weiner
77; ;
88; ; SPDX-License-Identifier: GPL-3.0-or-later
99; ;
@@ -1074,6 +1074,22 @@ than a helm completion buffer)."
10741074 (ibut:label-set (concat file " :" line-num))
10751075 (hact 'hib-link-to-file-line file line-num)))))))
10761076
1077+ (defib grep-single-file ()
1078+ " Jump to the source line from a single file, line-numbered grep msg.
1079+ Such grep msgs start with the line number followed by a colon. The buffer
1080+ may contain the file searched prior to any such line or it may not,
1081+ e.g. {M-!} in which case `hpath:get-grep-filename' will extract a best
1082+ guess from the `command-history' .
1083+
1084+ Avoid this situation and force prefixing each line with the filename by
1085+ including the -H option."
1086+ (let ((file-and-line (hpath:get-grep-filename)))
1087+ (when file-and-line
1088+ (ibut:label-set (concat (file-name-nondirectory (nth 0 file-and-line))
1089+ " :" (nth 1 file-and-line))
1090+ (line-beginning-position ) (line-end-position ))
1091+ (apply #'hact 'hib-link-to-file-line file-and-line))))
1092+
10771093(defib ripgrep-msg ()
10781094 " Jump to the line associated with a ripgrep (rg) line numbered msg.
10791095Ripgrep outputs each pathname once followed by all matching lines
@@ -1125,11 +1141,12 @@ buffer)."
11251141 (but-label (concat buffer-name " :P" pos)))
11261142 (when (buffer-live-p (get-buffer buffer-name))
11271143 (setq pos (string-to-number pos))
1128- (ibut:label-set but-label)
1144+ (ibut:label-set but-label
1145+ (line-beginning-position ) (line-end-position ))
11291146 (hact 'link-to-buffer-tmp buffer-name pos)))))))
11301147
11311148(defib grep-msg ()
1132- " Jump to the line associated with line numbered grep or compilation error msgs .
1149+ " Jump to the source line from a line- numbered grep or compilation msg .
11331150Messages are recognized in any buffer (other than a helm completion
11341151buffer) except for grep -A<num> context lines which are matched only
11351152in grep and shell buffers."
@@ -1180,7 +1197,8 @@ in grep and shell buffers."
11801197 (looking-at " \\ ([^ \t\n\r :\" '`]+\\ )-\\ ([1-9][0-9]*\\ )-" )))
11811198 (let* ((file (match-string-no-properties 1 ))
11821199 (line-num (or (match-string-no-properties 2 ) " 1" )))
1183- (ibut:label-set (concat file " :" line-num))
1200+ (ibut:label-set (concat file " :" line-num)
1201+ (line-beginning-position ) (line-end-position ))
11841202 (hact 'hib-link-to-file-line file line-num))))))
11851203
11861204; ;; ========================================================================
@@ -1196,7 +1214,8 @@ in grep and shell buffers."
11961214 (line-num (match-string-no-properties 3 ))
11971215 (but-label (concat file " :" line-num)))
11981216 (setq line-num (string-to-number line-num))
1199- (ibut:label-set but-label (match-beginning 2 ) (match-end 2 ))
1217+ (ibut:label-set but-label
1218+ (line-beginning-position ) (line-end-position ))
12001219 (hact 'link-to-file-line file line-num))))
12011220
12021221(defib debugger-source ()
@@ -1227,7 +1246,8 @@ xdb. Such lines are recognized in any buffer."
12271246
12281247 (setq but-label (concat file " :" line-num)
12291248 line-num (string-to-number line-num))
1230- (ibut:label-set but-label)
1249+ (ibut:label-set but-label
1250+ (line-beginning-position ) (line-end-position ))
12311251 (hact 'link-to-file-line file line-num)))
12321252
12331253 ; ; GDB or WDB
@@ -1249,7 +1269,8 @@ xdb. Such lines are recognized in any buffer."
12491269 ; ; guess.
12501270 (when gdb-last-file
12511271 (setq file (expand-file-name file (file-name-directory gdb-last-file))))
1252- (ibut:label-set but-label)
1272+ (ibut:label-set but-label
1273+ (line-beginning-position ) (line-end-position ))
12531274 (hact 'link-to-file-line file line-num)))
12541275
12551276 ; ; XEmacs assertion failure
@@ -1258,7 +1279,8 @@ xdb. Such lines are recognized in any buffer."
12581279 (line-num (match-string-no-properties 2 ))
12591280 (but-label (concat file " :" line-num)))
12601281 (setq line-num (string-to-number line-num))
1261- (ibut:label-set but-label)
1282+ (ibut:label-set but-label
1283+ (line-beginning-position ) (line-end-position ))
12621284 (hact 'link-to-file-line file line-num)))
12631285
12641286 ; ; New DBX
@@ -1267,7 +1289,8 @@ xdb. Such lines are recognized in any buffer."
12671289 (line-num (match-string-no-properties 1 ))
12681290 (but-label (concat file " :" line-num)))
12691291 (setq line-num (string-to-number line-num))
1270- (ibut:label-set but-label)
1292+ (ibut:label-set but-label
1293+ (line-beginning-position ) (line-end-position ))
12711294 (hact 'link-to-file-line file line-num)))
12721295
12731296 ; ; Old DBX and HP-UX xdb
@@ -1277,7 +1300,8 @@ xdb. Such lines are recognized in any buffer."
12771300 (line-num (match-string-no-properties 2 ))
12781301 (but-label (concat file " :" line-num)))
12791302 (setq line-num (string-to-number line-num))
1280- (ibut:label-set but-label)
1303+ (ibut:label-set but-label
1304+ (line-beginning-position ) (line-end-position ))
12811305 (hact 'link-to-file-line file line-num))))))
12821306
12831307; ;; ========================================================================
@@ -1804,7 +1828,7 @@ not yet existing HyWikiWords."
18041828; ;; Follows Org mode links and radio targets and cycles Org heading views
18051829; ;; ========================================================================
18061830
1807- ; ; See `smart-org' in "hui-mouse.el"; this is higher priority than all ibtypes.
1831+ ; ;; See `smart-org' in "hui-mouse.el"; this is higher priority than all ibtypes.
18081832
18091833; ; If you want to to disable ALL Hyperbole support within Org major
18101834; ; and minor modes, set the custom option `hsys-org-enable-smart-keys' to nil.
0 commit comments