unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32676: [PATCH] Add option to highlight the 'next-error' error message
@ 2018-09-10  5:08 Ernesto Alfonso
  2018-09-13  7:10 ` bug#32676: Feature request Ernesto Alfonso
  0 siblings, 1 reply; 37+ messages in thread
From: Ernesto Alfonso @ 2018-09-10  5:08 UTC (permalink / raw)
  To: 32676; +Cc: Ernesto Alfonso

In addition to a fringe arrow, ‘next-error’ error may optionally
highlight the current error message in the ‘next-error’ buffer.
---
 doc/emacs/building.texi |  2 ++
 etc/NEWS                |  5 +++++
 lisp/simple.el          | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 496c4275bc..e0d14c14d8 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -199,6 +199,8 @@ Compilation Mode
 @kindex M-g n
 @kindex C-x `
 @findex next-error
+@findex next-error-message
+@vindex next-error-message-highlight-p
 @vindex next-error-highlight
   To visit errors sequentially, type @w{@kbd{C-x `}}
 (@code{next-error}), or equivalently @kbd{M-g M-n} or @kbd{M-g n}.
diff --git a/etc/NEWS b/etc/NEWS
index ff65a5520d..a8d3400d8f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -607,6 +607,11 @@ error.
 It can be used to set any buffer as the next one to be used by
 'next-error' and 'previous-error'.
 
++++
+*** New customizable variable 'next-error-message-highlight-p'
+In addition to a fringe arrow, ‘next-error’ error may now optionally
+highlight the current error message in the ‘next-error’ buffer.
+
 ** nxml-mode
 
 ---
diff --git a/lisp/simple.el b/lisp/simple.el
index 0ccf2f1d22..c1298965cc 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -105,6 +105,23 @@ next-error-recenter
   :group 'next-error
   :version "23.1")
 
+(defcustom next-error-message-highlight-p nil
+  "If non-nil, highlight the current error message in the ‘next-error’ buffer"
+  :type 'boolean
+  :group 'next-error
+  :version "27.1")
+
+(defface next-error-message
+  '((t (:inherit highlight)))
+  "Face used to highlight the current error message in the ‘next-error’ buffer"
+  :group 'next-error
+  :version "27.1")
+
+(defvar next-error-message-highlight-overlay
+  nil
+  "Overlay highlighting the current error message in the ‘next-error’ buffer")
+(make-variable-buffer-local 'next-error-message-highlight-overlay)
+
 (defcustom next-error-hook nil
   "List of hook functions run by `next-error' after visiting source file."
   :type 'hook
@@ -421,6 +438,23 @@ next-error-follow-mode-post-command-hook
 	  (next-error-no-select 0))
       (error t))))
 
+(defun next-error-message-highlight ()
+  "Highlight the current error message in the ‘next-error’ buffer."
+  (when next-error-message-highlight-p
+    (with-current-buffer next-error-last-buffer
+      (when next-error-message-highlight-overlay
+        (delete-overlay next-error-message-highlight-overlay))
+      (save-excursion
+        (goto-char compilation-current-error)
+        (let ((ol (make-overlay (line-beginning-position) (line-end-position))))
+          ;; do not override region highlighting
+          (overlay-put ol 'priority -50)
+          (overlay-put ol 'face 'next-error-message)
+          (overlay-put ol 'window (get-buffer-window))
+          (setf next-error-message-highlight-overlay ol))))))
+
+(add-hook 'next-error-hook 'next-error-message-highlight)
+
 \f
 ;;;
 
-- 
2.11.0






^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2020-11-10 20:02 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-10  5:08 bug#32676: [PATCH] Add option to highlight the 'next-error' error message Ernesto Alfonso
2018-09-13  7:10 ` bug#32676: Feature request Ernesto Alfonso
2018-09-13 13:59   ` Eli Zaretskii
2018-09-13 14:14     ` Robert Pluim
2018-09-13 15:02       ` Ernesto Alfonso
2018-09-13 16:44         ` Eli Zaretskii
2018-09-13 18:18           ` Ernesto Alfonso
2018-09-14 16:40             ` Ernesto Alfonso
2018-09-15 23:05               ` Juri Linkov
2018-09-16  0:37                 ` Ernesto Alfonso
2018-09-16 23:27                   ` Juri Linkov
2018-09-18  8:51                     ` Ernesto Alfonso
2019-04-07 21:56                       ` Ernesto Alfonso
2019-04-08 19:36                         ` bug#32676: [PATCH] Add option to highlight the 'next-error' error message Juri Linkov
2019-04-09  5:48                           ` Eli Zaretskii
2020-02-29 15:40                             ` Stefan Kangas
2020-08-10 12:38                               ` Lars Ingebrigtsen
2020-08-10 14:00                                 ` Ernesto Alfonso
2020-09-03  5:00                                   ` Ernesto Alfonso
2020-09-03 10:40                                     ` Stefan Kangas
2020-10-14  5:47                           ` Lars Ingebrigtsen
2020-10-14 19:30                             ` Juri Linkov
2020-10-15  7:19                               ` Lars Ingebrigtsen
2020-10-16  8:13                                 ` Juri Linkov
2020-10-16 14:48                                   ` Lars Ingebrigtsen
2020-10-17 20:24                                     ` Juri Linkov
2020-10-18  8:34                                       ` Lars Ingebrigtsen
2020-11-05 20:20                                   ` Juri Linkov
2020-11-05 22:05                                     ` Kévin Le Gouguec
2020-11-06  8:43                                       ` Juri Linkov
2020-11-06 22:06                                         ` bug#32676: Updating Org for 27.2 (was: bug#32676: [PATCH] Add option to highlight the 'next-error' error message) Kévin Le Gouguec
2020-11-09  9:03                                           ` bug#32676: Updating Org for 27.2 Juri Linkov
2020-11-09 12:17                                             ` Kévin Le Gouguec
2020-11-10  4:10                                               ` Kyle Meyer
2020-11-10 19:30                                               ` Juri Linkov
2020-11-10 20:02                                                 ` Glenn Morris
     [not found]   ` <CAOckuXD4--GF0E=eMWf-T74rEjrjt4CWfx97OWWszRay3P-ujQ@mail.gmail.com>
2018-09-13 16:14     ` bug#32676: Feature request Ernesto Alfonso

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).