emacs-devel
[Top][All Lists]
Advanced

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

Re: Add M-x occur to the menu-bar


From: Kim F. Storm
Subject: Re: Add M-x occur to the menu-bar
Date: 13 Feb 2004 00:19:32 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Ted Zlatanov <address@hidden> writes:

> On 12 Feb 2004, address@hidden wrote:
> 
> > By the way: why (make-variable-buffer-local
> > 'compilation-next-error-function)?  It seems completely unnecessary.
> > People can make-local-variable when needed.  It's generally clearer
> > if they do it anyway.
> 
> I think Kim suggested that.  

Indeed.  I find this more logical, as it never makes sense to set the
global value of compilation-next-error-function to a non-nil value.

> > Also why not rename next-error to compilation-next-error, then
> > default compilation-next-error-function to compilation-next-error
> > and just write:
> > 
> > (defun next-error (argp)
> >   (interactive ...)
> >   (with-current-buffer compilation-last-buffer
> >     (funcall compilation-next-error-function argp))
> 
> compilation-last-buffer is not necessarily what we want.  

Indeed, but Stefan has a good point here.

You could define:

(defun compilation-next-error (arg)
  (interactive "P")
  (compilation-goto-locus (compilation-next-error-locus
                           ;; We want to pass a number here only if
                           ;; we got a numeric prefix arg, not just C-u.
                           (and (not (consp argp))
                                (prefix-numeric-value argp))
                           (consp argp))))

and

(defun next-error (arg)
  (interactive "P")
   (when (setq compilation-last-buffer (compilation-find-buffer))
     (with-current-buffer compilation-last-buffer
        (funcall compilation-next-error-function argp))))

And then

(defvar compilation-next-error-function 'compilation-next-error)

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

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