emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

next-error-hook (was: with-current-buffer)


From: Juri Linkov
Subject: next-error-hook (was: with-current-buffer)
Date: Wed, 29 Jun 2005 02:52:19 +0300
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>     Or maybe `pop-to-buffer inside with-current-buffer' is not a suitable
>     programming construct (I mean mostly for the `next-error' command
>     where this problem occurred) 
>
> There is nothing wrong with it in principle, no reason why it should
> in general be avoided.  It might not be the right thing for the
> specific place you have in mind.

The place I have in mind is `next-error'.  Currently there is no
reliable way to perform some actions on the source file visited
by `next-error'.  Perhaps there is nothing wrong with constructs
used in `next-error', but what is missing only a hook which would
allow users to run hook functions on the visited source file.
So I propose the following patch:

Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.734
diff -c -r1.734 simple.el
*** lisp/simple.el      24 Jun 2005 21:11:58 -0000      1.734
--- lisp/simple.el      29 Jun 2005 01:49:27 -0000
***************
*** 110,115 ****
--- 110,120 ----
    :group 'next-error
    :version "22.1")
  
+ (defcustom next-error-hook nil
+   "*List of hook functions run by `next-error' after visiting source file."
+   :type 'hook
+   :group 'next-error)
+ 
  (defvar next-error-highlight-timer nil)
  
  (defvar next-error-overlay-arrow-position nil)
***************
*** 240,248 ****
  \\[next-error] in that buffer when it is the only one displayed
  in the current frame.
  
! Once \\[next-error] has chosen the buffer for error messages,
! it stays with that buffer until you use it in some other buffer which
! uses Compilation mode or Compilation Minor mode.
  
  See variables `compilation-parse-errors-function' and
  \`compilation-error-regexp-alist' for customization ideas."
--- 245,254 ----
  \\[next-error] in that buffer when it is the only one displayed
  in the current frame.
  
! Once \\[next-error] has chosen the buffer for error messages, it
! runs `next-error-hook' with `run-hooks', and stays with that buffer
! until you use it in some other buffer which uses Compilation mode
! or Compilation Minor mode.
  
  See variables `compilation-parse-errors-function' and
  \`compilation-error-regexp-alist' for customization ideas."
***************
*** 251,257 ****
    (when (setq next-error-last-buffer (next-error-find-buffer))
      ;; we know here that next-error-function is a valid symbol we can funcall
      (with-current-buffer next-error-last-buffer
!       (funcall next-error-function (prefix-numeric-value arg) reset))))
  
  (defalias 'goto-next-locus 'next-error)
  (defalias 'next-match 'next-error)
--- 257,264 ----
    (when (setq next-error-last-buffer (next-error-find-buffer))
      ;; we know here that next-error-function is a valid symbol we can funcall
      (with-current-buffer next-error-last-buffer
!       (funcall next-error-function (prefix-numeric-value arg) reset)
!       (run-hooks 'next-error-hook))))
  
  (defalias 'goto-next-locus 'next-error)
  (defalias 'next-match 'next-error)

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]