GNU bug report logs - #20971
24.4; occur-1 makes my buffer read-only

Previous Next

Package: emacs;

Reported by: Alex Schröder <kensanata <at> gmail.com>

Date: Fri, 3 Jul 2015 09:23:02 UTC

Severity: wishlist

Found in version 24.4

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 20971 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, Alex Schröder <kensanata <at> gmail.com>
Subject: bug#20971: 24.4; occur-1 makes my buffer read-only
Date: Fri, 25 Sep 2020 16:04:37 +0200
Stefan Kangas <stefan <at> marxist.se> writes:

> I think *Occur* should definitely be read-only, so your first patch is
> the wrong solution in my opinion.
>
> On the other hand, I see no drawbacks with wrapping the relevant calls
> in:
>
>   (with-current-buffer occur-buf
>        ...)
>
> At the very least, that would make the intention of that code a bit more
> clear.
>
> But that entire part of the code is already wrapped in
> (with-current-buffer occur-buf ...).  So why are we not in occur-buf
> already?

I am guessing the reporter had some misbehaving code running off of
`display-buffer' that changed the current buffer:

            (display-buffer occur-buf)
            (when occur--final-pos
              (set-window-point
               (get-buffer-window occur-buf 'all-frames)
               occur--final-pos))
            (setq next-error-last-buffer occur-buf)
            (setq buffer-read-only t)
            (set-buffer-modified-p nil)
            (run-hooks 'occur-hook)))))))

So everything after displaying the buffer runs somewhere else.  We could
defensively re-wrap the rest in a with-current-buffer, but...  I think
the bug is in the code that changed the current buffer, really.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 4 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.