branch: externals/hyperbole commit 198a4788aed52291b565e607485a7ac594473a0b Author: Bob Weiner <r...@gnu.org> Commit: Bob Weiner <r...@gnu.org>
Add ibtype support for Emacs nativecomp file and function lines --- ChangeLog | 5 +++ HY-NEWS | 7 +++- hibtypes.el | 110 ++++++++++++++++++++++++++++++++++++------------------------ 3 files changed, 77 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4028b6122..3416fe44e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-05-12 Bob Weiner <r...@gnu.org> +* hibtypes.el (elisp-compiler-msg): Add "*ert*" output buffer and support for + Emacs native compiler "In <function>" lines. + (grep-msg): Add support for Emacs native compiler "Compiling <file>" + and "Loading <file>" lines (jumps to 1st line of the file). + * hypb.el (hypb:rgrep): Fix so --exclude directories are always included; sexp nesting was wrong. diff --git a/HY-NEWS b/HY-NEWS index b55ba8bb29..f3d1418b90 100644 --- a/HY-NEWS +++ b/HY-NEWS @@ -12,12 +12,17 @@ libraries to eliminate all Error-level messages). -** SMART KEYS +** SMART (ACTION AND ASSIST) KEYS (See "(hyperbole)Smart Keys"). *** Smart Dired: Action Key subdirectory selection at point now works on any dired header line, not just the first one. Use {i} to insert multiple subdirectories in Dired mode. +*** Compilation and Grep Error Lines: Error lines in the Emacs Regression + Test buffer, *ert*, are now supported, as well as the 'Compiling <file>', + 'Loading <file>' and 'In <function>' lines from Emacs Lisp native + compilation. + =========================================================================== * V8.0.0 =========================================================================== diff --git a/hibtypes.el b/hibtypes.el index 10a42e921c..a6f424ca36 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: 11-May-22 at 00:32:46 by Bob Weiner +;; Last-Mod: 12-May-22 at 02:05:28 by Bob Weiner ;; ;; Copyright (C) 1991-2021 Free Software Foundation, Inc. ;; See the "HY-COPY" file for license information. @@ -916,6 +916,9 @@ in grep and shell buffers." (save-excursion (beginning-of-line) (when (or + ;; Emacs native compiler file lines + (looking-at "Compiling \\(\\S-+\\)\\.\\.\\.$") + (looking-at "Loading \\(\\S-+\\) (\\S-+)\\.\\.\\.$") ;; Grep matches (allowing for Emacs Lisp vars with : in ;; name within the pathname), UNIX C compiler and Introl 68HC11 C compiler errors (looking-at "\\([^ \t\n\r\"'`]*[^ \t\n\r:\"'`]\\): ?\\([1-9][0-9]*\\)[ :]") @@ -948,7 +951,7 @@ in grep and shell buffers." (and (string-match "grep\\|shell" (buffer-name)) (looking-at "\\([^ \t\n\r:\"'`]+\\)-\\([1-9][0-9]*\\)-"))) (let* ((file (match-string-no-properties 1)) - (line-num (match-string-no-properties 2)) + (line-num (or (match-string-no-properties 2) "1")) (but-label (concat file ":" line-num)) ;; RSW 12-05-2021 - Added hpath:expand in next line to ;; resolve any variables in the path before checking if absolute. @@ -1063,13 +1066,15 @@ This works with JavaScript and Python tracebacks, gdb, dbx, and xdb. Such lines ;;; ======================================================================== (defib elisp-compiler-msg () - "Jump to source code for definition associated with an Emacs Lisp byte-compiler error message or ERT test output line. -Works when activated anywhere within such a line." + "Jump to source code for definition associated with an Emacs Lisp error message. +The error may from the Emacs byte compiler, the Emacs Lisp native +compiler or the Emacs regression test system (ERT). +This works when activated anywhere within the file line references." (when (or (member (buffer-name) '("*Compile-Log-Show*" "*Compile-Log*" - "*compilation*" "*Async-native-compile-log*")) + "*compilation*" "*Async-native-compile-log*" "*ert*")) (save-excursion (and (re-search-backward "^[^ \t\n\r]" nil t) - (looking-at "While compiling")))) + (looking-at "While compiling\\|In \\([^ \n]+\\):$")))) (let (src buffer-p label) (or ;; Emacs Regression Test (ERT) output lines @@ -1081,46 +1086,63 @@ Works when activated anywhere within such a line." ;; Remove prefix generated by actype and ibtype definitions. (setq label (hypb:replace-match-string "[^:]+::" label "" t)) (hact 'smart-tags-display label nil))) + ;; GNU Emacs Byte Compiler + (and (save-excursion + (re-search-backward + "^While compiling [^\t\n]+ in \\(file\\|buffer\\) \\([^ \n]+\\):$" + nil t)) + (setq buffer-p (equal (match-string-no-properties 1) "buffer") + src (match-string-no-properties 2)) + (save-excursion + (end-of-line) + (re-search-backward "^While compiling \\([^ \n]+\\)\\(:$\\| \\)" + nil t)) + (progn + (setq label (match-string-no-properties 1)) + (ibut:label-set label (match-beginning 1) (match-end 1)) + ;; Remove prefix generated by actype and ibtype definitions. + (setq label (hypb:replace-match-string "[^:]+::" label "" t)) + (hact 'link-to-regexp-match + (concat "^\(def[a-z \t]+" (regexp-quote label) + "[ \t\n\r\(]") + 1 src buffer-p))) + ;; GNU Emacs Native Compiler + (and (save-excursion + (re-search-backward "^Compiling \\([^ \n]+\\)\\.\\.\\.$" nil t)) + (setq buffer-p nil + src (match-string-no-properties 1)) + (save-excursion + (end-of-line) + (re-search-backward "^In \\([^ \n]+\\):$" nil t)) + (progn + (setq label (match-string-no-properties 1)) + (ibut:label-set label (match-beginning 1) (match-end 1)) + ;; Remove prefix generated by actype and ibtype definitions. + (setq label (hypb:replace-match-string "[^:]+::" label "" t)) + (hact 'link-to-regexp-match + (concat "^\(def[a-z \t]+" (regexp-quote label) + "[ \t\n\r\(]") + 1 src buffer-p))) ;; InfoDock and XEmacs (and (save-excursion - (re-search-backward - "^Compiling \\(file\\|buffer\\) \\([^ \n]+\\) at " - nil t)) - (setq buffer-p (equal (match-string-no-properties 1) "buffer") - src (match-string-no-properties 2)) - (save-excursion - (end-of-line) - (re-search-backward "^While compiling \\([^ \n]+\\)\\(:$\\| \\)" - nil t)) - (progn - (setq label (match-string-no-properties 1)) - (ibut:label-set label (match-beginning 1) (match-end 1)) - ;; Remove prefix generated by actype and ibtype definitions. - (setq label (hypb:replace-match-string "[^:]+::" label "" t)) - (hact 'link-to-regexp-match - (concat "^\(def[a-z \t]+" (regexp-quote label) - "[ \t\n\r\(]") - 1 src buffer-p))) - ;; GNU Emacs - (and (save-excursion - (re-search-backward - "^While compiling [^\t\n]+ in \\(file\\|buffer\\) \\([^ \n]+\\):$" - nil t)) - (setq buffer-p (equal (match-string-no-properties 1) "buffer") - src (match-string-no-properties 2)) - (save-excursion - (end-of-line) - (re-search-backward "^While compiling \\([^ \n]+\\)\\(:$\\| \\)" - nil t)) - (progn - (setq label (match-string-no-properties 1)) - (ibut:label-set label (match-beginning 1) (match-end 1)) - ;; Remove prefix generated by actype and ibtype definitions. - (setq label (hypb:replace-match-string "[^:]+::" label "" t)) - (hact 'link-to-regexp-match - (concat "^\(def[a-z \t]+" (regexp-quote label) - "[ \t\n\r\(]") - 1 src buffer-p))))))) + (re-search-backward + "^Compiling \\(file\\|buffer\\) \\([^ \n]+\\) at " + nil t)) + (setq buffer-p (equal (match-string-no-properties 1) "buffer") + src (match-string-no-properties 2)) + (save-excursion + (end-of-line) + (re-search-backward "^While compiling \\([^ \n]+\\)\\(:$\\| \\)" + nil t)) + (progn + (setq label (match-string-no-properties 1)) + (ibut:label-set label (match-beginning 1) (match-end 1)) + ;; Remove prefix generated by actype and ibtype definitions. + (setq label (hypb:replace-match-string "[^:]+::" label "" t)) + (hact 'link-to-regexp-match + (concat "^\(def[a-z \t]+" (regexp-quote label) + "[ \t\n\r\(]") + 1 src buffer-p))))))) ;;; ======================================================================== ;;; Jumps to source associated with a line of output from `patch'.