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: Ted Zlatanov
Subject: Re: Add M-x occur to the menu-bar
Date: Mon, 23 Feb 2004 15:18:05 -0500
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (usg-unix-v)

On Sat, 14 Feb 2004, address@hidden wrote:

> In making a change of this kind,
> think the most important question is:
> 
>   what is the criterion for deciding which buffer to use?
> 
> What does the current proposed patch do?

Note I'm discussing the updated version of this patch, which I will
post to emacs-devel shortly (in both a unified and a context diff
version).

I follow the behavior of compile.el, which is:

- is the current buffer usable?  if yes, use it

- else, if we were given a usable buffer, use that

- else, look through all the buffer for a usable buffer

- else, throw an error

Now, the major difference is that I no longer use
compilation-buffer-p, which also tests if a buffer is a
compilation-mode buffer:

;;; test if a buffer is a compilation buffer
(defsubst compilation-buffer-p (buffer)
  "Test if BUFFER is a compilation buffer."
  (with-current-buffer buffer
    (or compilation-shell-minor-mode
        compilation-minor-mode
        (eq major-mode 'compilation-mode)
        compilation-next-error-function)))

I now use just next-error-buffer-p:

(defsubst next-error-buffer-p (buffer)
  "Test if BUFFER is a next-error capable buffer."
  (with-current-buffer buffer
    next-error-function))

Which will work properly with compile.el (because compile-internal
sets next-error-function), with grep.el (because it uses
compile-internal), and with any other modes that set and support
next-error-function (such as occur, as noted in the modified
replace.el).  So backwards compatibility is guaranteed.

I'll mention my other modifications in the post with the patch.

Ted





reply via email to

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