[Top][All Lists]

[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: 07 Feb 2004 00:57:52 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Ted Zlatanov <address@hidden> writes:

> I see, that is indeed a much better solution.  I've reworked the patch
> to do what you suggest; 

Yes, it is much cleaner now, and you are almost there.

>                         only the universal-prefix is not handled by
> occur-next-error.  It is much better from the perspective of
> occur-mode, but I had to modify compilation-find-buffer and
> compilation-buffer-p to avoid complicating next-error.  Anyhow, see
> what you think.

I haven't thought a lot about it, but I don't understand why you need
that extra allow-with-next-error-function arg to compilation-buffer-p
and compilation-find-buffer.

If you simply change compilation-buffer-p to

(defsubst compilation-buffer-p (buffer)
    (set-buffer buffer)
    (or compilation-shell-minor-mode compilation-minor-mode
        (eq major-mode 'compilation-mode)

it will always consider an occur buffer (and other buffers which have
a non-nil compilation-next-error-function) as a compilation buffer.

To me that would seem logical, but I'm probably overlooking something.

Can you mention the commands where is that behaviour NOT desireable,
and why?

In any case, here are some comments on your latest patch:

>    (save-excursion
>      (set-buffer buffer)
> -    (or compilation-shell-minor-mode compilation-minor-mode
> -     (eq major-mode 'compilation-mode))))
> +    (or compilation-shell-minor-mode 
> +     compilation-minor-mode
> +     (eq major-mode 'compilation-mode)
> +     (and allow-with-next-error-function
> +          (buffer-local-value
> +           'compilation-next-error-function
> +           buffer)))))

For the last four lines, you can just write

        (and allow-with-next-error-function

as you already did a (set-buffer buffer), so there's no reason to use
buffer-local-value here.

> +;; override compilation-last-buffer
> +(defvar occur-last-buffer nil
> +  "The most recent occur buffer.
> +An occur buffer becomes most recent when its process is started
> +or when it is used with \\[occur-next].
> +Notice that using \\[next-error] or \\[compile-goto-error] modifies
> +`complation-last-buffer' rather than `occur-last-buffer'.")
> +

You no longer need the occur-last-buffer variable.

> +           (setq occur-last-buffer occur-buf)


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

reply via email to

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