GNU bug report logs -
#49275
28.0.50; [PATCH] improve-switch-to-prev-buffer-skip
Previous Next
Reported by: Trust me I am a Doctor <pillule <at> riseup.net>
Date: Tue, 29 Jun 2021 16:21:01 UTC
Severity: normal
Tags: patch
Found in version 28.0.50
Done: Trust me I am a Doctor <pillule <at> riseup.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 49275 in the body.
You can then email your comments to 49275 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Tue, 29 Jun 2021 16:21:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Trust me I am a Doctor <pillule <at> riseup.net>:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org.
(Tue, 29 Jun 2021 16:21:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
$ emacs -Q
;; Considering the next commands :
(defun pils/cycle-buffer-of-major-mode (&optional arg)
"Switch to previous buffer of this major mode.
With ARG as \\[universal-argument], switch to the next instead."
(interactive "P")
(let ((switch-to-prev-buffer-skip
(lambda (window buffer _bury-or-kill)
(not (eq (buffer-local-value 'major-mode (window-buffer window))
(buffer-local-value 'major-mode buffer))))))
(if arg (switch-to-next-buffer) (switch-to-prev-buffer nil 'append)))
(when (eq (current-buffer) (window-old-buffer))
(user-error "No other %s buffer available." major-mode)))
(defun pils/next-buffer-of-major-mode ()
"Switch to the next buffer of this major mode."
(interactive)
(pils/cycle-buffer-of-major-mode t))
;; That we could temporary bind to :
(global-set-key (kbd "M-p") #'pils/cycle-buffer-of-major-mode)
(global-set-key (kbd "M-n") #'pils/next-buffer-of-major-mode)
Now gently but firmly, play theses emacs chords.
What happened ? The first command will put you in another mode.
That is unexpected ... Worse the second one will quickly jam.
The current implementation 'switch-to-prev-buffer-skip' fallback to the
first skipped buffer if no one have satisfied its anti-predicate. That's
why you could end up in another mode despite setting
'switch-to-prev-buffer-skip' to not select others modes.
Conservatively I fix that by checking if 'switch-to-prev-buffer-skip'
is a function.
The second issue is a bug in the implementation of
'switch-to-next-buffer'. This command should never return the same
buffer, it is wrote in its docstring, and it escaped me in commit
d0c7d8bc22.
So here a little patch to fix both.
[0001-Improve-switch-to-prev-buffer-skip.patch (text/x-diff, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Wed, 30 Jun 2021 07:38:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 49275 <at> debbugs.gnu.org (full text, mbox):
> Conservatively I fix that by checking if 'switch-to-prev-buffer-skip'
> is a function.
What is the intended meaning of
+ (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
Did you mean
+ (when (and skipped (not (functionp switch-to-prev-buffer-skip)))
here?
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Thu, 08 Jul 2021 12:47:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 49275 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
martin rudalics <rudalics <at> gmx.at> writes:
>> Conservatively I fix that by checking if 'switch-to-prev-buffer-skip'
>> is a function.
>
> What is the intended meaning of
>
> + (when (and skipped (not functionp switch-to-prev-buffer-skip-p))
>
> Did you mean
>
> + (when (and skipped (not (functionp switch-to-prev-buffer-skip)))
>
> here?
Duh. Indeed.
[0001-Improve-switch-to-prev-buffer-skip.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Sun, 18 Jul 2021 08:28:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 49275 <at> debbugs.gnu.org (full text, mbox):
Sorry but this is still not right. It now gets me
In switch-to-prev-buffer:
../../lisp/window.el:4724:27: Warning: ‘not’ called with 2 args, but requires
1
../../lisp/window.el:4724:27: Warning: reference to free variable ‘functionp’
../../lisp/window.el:4724:27: Warning: reference to free variable
‘switch-to-prev-buffer-skip-p’
In switch-to-next-buffer:
../../lisp/window.el:4846:27: Warning: ‘not’ called with 2 args, but requires
1
../../lisp/window.el:4846:27: Warning: reference to free variable ‘functionp’
../../lisp/window.el:4846:27: Warning: reference to free variable
‘switch-to-prev-buffer-skip-p’
martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Wed, 21 Jul 2021 10:02:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 49275 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
martin rudalics <rudalics <at> gmx.at> writes:
> Sorry but this is still not right. It now gets me
>
> In switch-to-prev-buffer:
> ../../lisp/window.el:4724:27: Warning: ‘not’ called with 2 args, but requires
> 1
> ../../lisp/window.el:4724:27: Warning: reference to free variable ‘functionp’
> ../../lisp/window.el:4724:27: Warning: reference to free variable
> ‘switch-to-prev-buffer-skip-p’
>
> In switch-to-next-buffer:
> ../../lisp/window.el:4846:27: Warning: ‘not’ called with 2 args, but requires
> 1
> ../../lisp/window.el:4846:27: Warning: reference to free variable ‘functionp’
> ../../lisp/window.el:4846:27: Warning: reference to free variable
> ‘switch-to-prev-buffer-skip-p’
>
> martin
Sorry that was the same buggy one.
[0001-Make-switch-to-prev-buffer-skip-more-reliable.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
--
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Wed, 18 Aug 2021 08:03:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 49275 <at> debbugs.gnu.org (full text, mbox):
> Sorry that was the same buggy one.
Installed, finally. Sorry for the delay.
Thanks, martin
Information forwarded
to
bug-gnu-emacs <at> gnu.org:
bug#49275; Package
emacs.
(Wed, 18 Aug 2021 18:29:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 49275 <at> debbugs.gnu.org (full text, mbox):
close 49275
thanks
--
bug closed, send any further explanations to
49275 <at> debbugs.gnu.org and Trust me I am a Doctor <pillule <at> riseup.net>
Request was from
Trust me I am a Doctor <pillule <at> riseup.net>
to
control <at> debbugs.gnu.org.
(Wed, 18 Aug 2021 18:29:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org.
(Thu, 16 Sep 2021 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 67 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.