GNU bug report logs - #25522
26.0.50; (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Tue, 24 Jan 2017 23:27:02 UTC

Severity: normal

Found in version 26.0.50

Done: Stephen Berman <stephen.berman <at> gmx.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25522 in the body.
You can then email your comments to 25522 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Tue, 24 Jan 2017 23:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 24 Jan 2017 23:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Stephen Berman <stephen.berman <at> gmx.net>
Subject: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Wed, 25 Jan 2017 00:26:39 +0100
Hi,

this is on master.  When exiting Gnus, I always get

  Error in post-command-hook (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")

Seems that the new definition of `hl-line-maybe-unhighlight' in commit

  16be3e9054 hl-line.el: Fix flickering of highlighted line (bug#23510)

(by Stephen Berman whom I CC'd)

should test whether the `hl-line-overlay-buffer' is alive before trying
to switch to it?

Please tell me if you need a recipe.


Thanks,

Michael.





In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.6)
 of 2017-01-24 built on drachen
Repository revision: 201dfe311868932d10da146808fcdd681948ba53
Windowing system distributor 'The X.Org Foundation', version 11.0.11900000
System Description:	Debian GNU/Linux 9.0 (stretch)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Tue, 24 Jan 2017 23:40:02 GMT) Full text and rfc822 format available.

Message #8 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 25522 <at> debbugs.gnu.org
Cc: Stephen Berman <stephen.berman <at> gmx.net>
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Wed, 25 Jan 2017 00:39:45 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

>   Error in post-command-hook (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")

> Please tell me if you need a recipe.

FWIW this is my setup:

#+begin_src emacs-lisp
(add-hook 'gnus-summary-mode-hook #'hl-line-mode)
(add-hook 'gnus-group-mode-hook #'hl-line-mode)
(add-hook 'gnus-server-mode-hook #'hl-line-mode)
#+end_src


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Wed, 25 Jan 2017 12:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Wed, 25 Jan 2017 13:16:29 +0100
On Wed, 25 Jan 2017 00:39:45 +0100 Michael Heerdegen <michael_heerdegen <at> web.de> wrote:

> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>
>>   Error in post-command-hook (hl-line-maybe-unhighlight): (error "Selecting
>> deleted buffer")
>
>> Please tell me if you need a recipe.

I would appreciate one, as I can't reproduce the problem.

> FWIW this is my setup:
>
> #+begin_src emacs-lisp
> (add-hook 'gnus-summary-mode-hook #'hl-line-mode)
> (add-hook 'gnus-group-mode-hook #'hl-line-mode)
> (add-hook 'gnus-server-mode-hook #'hl-line-mode)
> #+end_src

I updated my build to current master, started emacs -Q, evaluated the
above sexps in *scratch*, started Gnus, saw that the current line in the
*Summary* buffer was highlighted, then exited Gnus without getting an
error.  Same thing by making ~/.emacs contain only the above sexps.

Steve Berman




Added indication that bug 25522 blocks24655 Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 16:39:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Thu, 26 Jan 2017 01:16:01 GMT) Full text and rfc822 format available.

Message #16 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Thu, 26 Jan 2017 02:14:51 +0100
Stephen Berman <stephen.berman <at> gmx.net> writes:

> >>   Error in post-command-hook (hl-line-maybe-unhighlight): (error
> >> "Selecting deleted buffer")

> > FWIW this is my setup:
> >
> > #+begin_src emacs-lisp
> > (add-hook 'gnus-summary-mode-hook #'hl-line-mode)
> > (add-hook 'gnus-group-mode-hook #'hl-line-mode)
> > (add-hook 'gnus-server-mode-hook #'hl-line-mode)
> > #+end_src
>
> I updated my build to current master, started emacs -Q, evaluated the
> above sexps in *scratch*, started Gnus, saw that the current line in the
> *Summary* buffer was highlighted, then exited Gnus without getting an
> error.  Same thing by making ~/.emacs contain only the above sexps.

Finding a recipe is not easy because I have to find the offending pieces
in my setup.  I tried M-x debug-on-entry hl-line-maybe-unhighlight,
also edebug, but the error magically disappeared.

But I found that I had concealed a related setting in my .emacs:

  (setq-default hl-line-sticky-flag nil)

If you still can't reproduce with that, I will probably have to create a
new user on my system to be able to bisect my setup without messing up
my Gnus.


Regards,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Thu, 26 Jan 2017 01:22:02 GMT) Full text and rfc822 format available.

Message #19 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Thu, 26 Jan 2017 02:21:29 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

>   (setq-default hl-line-sticky-flag nil)

Removing that from my init file seems to fix the issue.  Maybe we are
lucky and this was already the missing piece.


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Thu, 26 Jan 2017 02:09:01 GMT) Full text and rfc822 format available.

Message #22 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Thu, 26 Jan 2017 03:07:51 +0100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>
> >   (setq-default hl-line-sticky-flag nil)
>
> Removing that from my init file seems to fix the issue.  Maybe we are
> lucky and this was already the missing piece.

I just got the same error message after hitting U x in M-x
list-packages.  Here is an excerpt from `interaction-log':


| x package-menu-execute *Packages*
| Upgrade these 3 packages (helm-20170123.2253, xah-find-20161221.1705, helm-core-20170122.250)? (y or n) y
| Package menu: Operation started [Upgrading 3]
| Contacting host: melpa.org:80
| [...]
| Wrote /home/micha/.emacs.d/elpa/helm-20170124.2354/helm-autoloads.el
| ../../.emacs.d/elpa/helm-20170124.2354/helm-elisp.el: `dont-compile' is an obsolete macro (as of 24.4).
| Loading async...done
| ../../.emacs.d/elpa/helm-20170124.2354/helm-elisp.el: `dont-compile' is an obsolete macro (as of 24.4).
| Package `helm-20170123.2253' deleted.
| Package `xah-find-20161221.1705' deleted.
| Package `helm-core-20170122.250' deleted.
| Package menu: Operation finished [Upgraded 3]
| Error in post-command-hook (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
| q quit-window *Packages*
| Error in post-command-hook (hl-line-maybe-unhighlight): (error "Selecting deleted buffer") [2 times]


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Thu, 26 Jan 2017 09:55:01 GMT) Full text and rfc822 format available.

Message #25 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Thu, 26 Jan 2017 10:54:47 +0100
On Thu, 26 Jan 2017 03:07:51 +0100 Michael Heerdegen <michael_heerdegen <at> web.de> wrote:

> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>
>> Michael Heerdegen <michael_heerdegen <at> web.de> writes:
>>
>> >   (setq-default hl-line-sticky-flag nil)
>>
>> Removing that from my init file seems to fix the issue.  Maybe we are
>> lucky and this was already the missing piece.
>
> I just got the same error message after hitting U x in M-x
> list-packages.  Here is an excerpt from `interaction-log':

Is this after removing the above sexp?  Did you have hl-line-mode
enabled in package-menu-mode, and if so, how?  I added this:

(add-hook 'package-menu-mode-hook #'hl-line-mode)

to ~/.emacs and did `I x' in package-menu-mode (I didn't have any
package to update so I just installed a new one), but didn't get the
error (even with the above setq-default).  Anyway, your suggestion to
check hl-line-overlay-buffer appears to eliminate the error when exiting
Gnus, so does the following patch also fix the other error you saw?

Steve Berman

diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index 4cf0573..38fe683 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -189,7 +189,8 @@ hl-line-maybe-unhighlight
 such overlays in all buffers except the current one."
   (let ((hlob hl-line-overlay-buffer)
         (curbuf (current-buffer)))
-    (when (and (not hl-line-sticky-flag)
+    (when (and (buffer-live-p hlob)
+               (not hl-line-sticky-flag)
                (not (eq curbuf hlob))
                (not (minibufferp)))
       (with-current-buffer hlob




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Thu, 26 Jan 2017 10:16:02 GMT) Full text and rfc822 format available.

Message #28 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Thu, 26 Jan 2017 11:15:24 +0100
Stephen Berman <stephen.berman <at> gmx.net> writes:

> > I just got the same error message after hitting U x in M-x
> > list-packages.
>
> Is this after removing the above sexp?

No, still with hl-line-sticky-flag -> nil.


> Did you have hl-line-mode enabled in package-menu-mode, and if so,
> how?  I added this:
>
> (add-hook 'package-menu-mode-hook #'hl-line-mode)

Yes, that's exactly what I use - sorry for my terseness.


> -    (when (and (not hl-line-sticky-flag)
> +    (when (and (buffer-live-p hlob)
> +               (not hl-line-sticky-flag)

Yeah, that seems to fix the problem (I had already tried that ;-)).  I
still wonder why you don't see it...but I'm not sure if it's worth to
investigate (because this will probably take hours).


Thanks,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Thu, 26 Jan 2017 19:46:02 GMT) Full text and rfc822 format available.

Message #31 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Thu, 26 Jan 2017 20:45:11 +0100
On Thu, 26 Jan 2017 11:15:24 +0100 Michael Heerdegen <michael_heerdegen <at> web.de> wrote:

> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> > I just got the same error message after hitting U x in M-x
>> > list-packages.
>>
>> Is this after removing the above sexp?
>
> No, still with hl-line-sticky-flag -> nil.
>
>
>> Did you have hl-line-mode enabled in package-menu-mode, and if so,
>> how?  I added this:
>>
>> (add-hook 'package-menu-mode-hook #'hl-line-mode)
>
> Yes, that's exactly what I use - sorry for my terseness.
>
>
>> -    (when (and (not hl-line-sticky-flag)
>> +    (when (and (buffer-live-p hlob)
>> +               (not hl-line-sticky-flag)
>
> Yeah, that seems to fix the problem (I had already tried that ;-)).  I
> still wonder why you don't see it...but I'm not sure if it's worth to
> investigate (because this will probably take hours).

I think I found out what triggers the error: when you kill a buffer in
whose mode hl-line-mode is enabled and the mode of the next (now
current) buffer does not have hl-line-mode enabled, and then you change
(or Emacs changes) to another buffer in whose mode hl-line-mode is
enabled -- that raises the error.  Can you confirm this?  Just out of
curiosity, because I think the above fix is good enough and it's simple,
so unless someone sees a problem with it, I'll commit it to master.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25522; Package emacs. (Fri, 27 Jan 2017 09:30:03 GMT) Full text and rfc822 format available.

Message #34 received at 25522 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 25522 <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Fri, 27 Jan 2017 10:29:07 +0100
Stephen Berman <stephen.berman <at> gmx.net> writes:

> I think I found out what triggers the error: when you kill a buffer in
> whose mode hl-line-mode is enabled and the mode of the next (now
> current) buffer does not have hl-line-mode enabled, and then you change
> (or Emacs changes) to another buffer in whose mode hl-line-mode is
> enabled -- that raises the error.  Can you confirm this?

Could be.  In my posted recipes, when I turn off hl-line-mode in the
buffer I end up in, there is indeed no error.  An experiment with three
buffers as you described and switching manually to the third also
confirms your assumption.

> Just out of curiosity, because I think the above fix is good enough
> and it's simple, so unless someone sees a problem with it, I'll commit
> it to master.

Yes, it's obvious that it isn't harmful.


Thanks,

Michael




Reply sent to Stephen Berman <stephen.berman <at> gmx.net>:
You have taken responsibility. (Sat, 28 Jan 2017 20:20:02 GMT) Full text and rfc822 format available.

Notification sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
bug acknowledged by developer. (Sat, 28 Jan 2017 20:20:02 GMT) Full text and rfc822 format available.

Message #39 received at 25522-done <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 25522-done <at> debbugs.gnu.org
Subject: Re: bug#25522: 26.0.50;
 (hl-line-maybe-unhighlight): (error "Selecting deleted buffer")
Date: Sat, 28 Jan 2017 20:52:56 +0100
On Fri, 27 Jan 2017 10:29:07 +0100 Michael Heerdegen <michael_heerdegen <at> web.de> wrote:

> Stephen Berman <stephen.berman <at> gmx.net> writes:
>
>> I think I found out what triggers the error: when you kill a buffer in
>> whose mode hl-line-mode is enabled and the mode of the next (now
>> current) buffer does not have hl-line-mode enabled, and then you change
>> (or Emacs changes) to another buffer in whose mode hl-line-mode is
>> enabled -- that raises the error.  Can you confirm this?
>
> Could be.  In my posted recipes, when I turn off hl-line-mode in the
> buffer I end up in, there is indeed no error.  An experiment with three
> buffers as you described and switching manually to the third also
> confirms your assumption.
>
>> Just out of curiosity, because I think the above fix is good enough
>> and it's simple, so unless someone sees a problem with it, I'll commit
>> it to master.
>
> Yes, it's obvious that it isn't harmful.
>
>
> Thanks,
>
> Michael

Pushed as commit d12e1dd and closing the bug.

Steve Berman




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 26 Feb 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 169 days ago.

Previous Next


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