GNU bug report logs - #39149
27.0.50; describe-buffer-bindings is calling :filter function in wrong buffer

Previous Next

Package: emacs;

Reported by: yyoncho <yyoncho <at> gmail.com>

Date: Thu, 16 Jan 2020 07:00:02 UTC

Severity: normal

Found in version 27.0.50

Fixed in version 29.1

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

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 39149 in the body.
You can then email your comments to 39149 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#39149; Package emacs. (Thu, 16 Jan 2020 07:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to yyoncho <yyoncho <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 16 Jan 2020 07:00:02 GMT) Full text and rfc822 format available.

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

From: yyoncho <yyoncho <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; describe-buffer-bindings is calling :filter function in
 wrong buffer
Date: Thu, 16 Jan 2020 08:59:12 +0200
[Message part 1 (text/plain, inline)]
To reproduce (eval in scratch buffer)

(define-key global-map (kbd "C-c C-l r")
  `(menu-item "2" switch-to-buffer
              :filter ,(lambda (cmd)
                         (print (format "Called in %s" (current-buffer)))
                         cmd)))
(with-temp-buffer
  (with-output-to-string
    (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))

This outputs:

\"Called in  *temp*\"

Expected: the filter function must be called in *scratch* since this is
the buffer you want to check the bindings.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 14:24:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: yyoncho <yyoncho <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 15:23:09 +0100
yyoncho <yyoncho <at> gmail.com> writes:

> To reproduce (eval in scratch buffer)
> (define-key global-map (kbd "C-c C-l r") 
>   `(menu-item "2" switch-to-buffer
>               :filter ,(lambda (cmd)
>                          (print (format "Called in %s" (current-buffer)))
>                          cmd)))
> (with-temp-buffer
>   (with-output-to-string
>     (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))
>
> This outputs:
>
> \"Called in  *temp*\"

I tried this recipe, but I'm not getting the :filter function called at
all.  Do you have a recipe, starting from "emacs -Q", that reproduces
this bug?

And your report didn't include the data about the version generated by
report-emacs-bug, so it's hard to guess whether bug is only on some
specific system.

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




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 30 Oct 2020 14:24:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 15:17:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: yyoncho <yyoncho <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 16:16:27 +0100
On Jan 16 2020, yyoncho wrote:

> To reproduce (eval in scratch buffer)
>
> (define-key global-map (kbd "C-c C-l r")
>   `(menu-item "2" switch-to-buffer
>               :filter ,(lambda (cmd)
>                          (print (format "Called in %s" (current-buffer)))
>                          cmd)))
> (with-temp-buffer
>   (with-output-to-string
>     (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))
>
> This outputs:
>
> \"Called in  *temp*\"
>
> Expected: the filter function must be called in *scratch* since this is
> the buffer you want to check the bindings.

The problem is that describe-buffer-bindings only changes the buffer to
look up the bindings, but everything that generates the description
(starting with describe-map-tree) doesn't know about that other buffer.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 16:09:02 GMT) Full text and rfc822 format available.

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

From: yyoncho <yyoncho <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 18:08:10 +0200
[Message part 1 (text/plain, inline)]
I tested with emacs27.1

emacs27.1 -q

Then pasted the code in scratch buffer, evaluated, and reproduced the
described behaviour.


Thanks,
Ivan


On Fri, Oct 30, 2020 at 4:23 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> yyoncho <yyoncho <at> gmail.com> writes:
>
> > To reproduce (eval in scratch buffer)
> > (define-key global-map (kbd "C-c C-l r")
> >   `(menu-item "2" switch-to-buffer
> >               :filter ,(lambda (cmd)
> >                          (print (format "Called in %s" (current-buffer)))
> >                          cmd)))
> > (with-temp-buffer
> >   (with-output-to-string
> >     (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))
> >
> > This outputs:
> >
> > \"Called in  *temp*\"
>
> I tried this recipe, but I'm not getting the :filter function called at
> all.  Do you have a recipe, starting from "emacs -Q", that reproduces
> this bug?
>
> And your report didn't include the data about the version generated by
> report-emacs-bug, so it's hard to guess whether bug is only on some
> specific system.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 16:17:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, yyoncho <yyoncho <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 16:16:35 +0000
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> yyoncho <yyoncho <at> gmail.com> writes:
>
>> To reproduce (eval in scratch buffer)
>> (define-key global-map (kbd "C-c C-l r")
>>   `(menu-item "2" switch-to-buffer
>>               :filter ,(lambda (cmd)
>>                          (print (format "Called in %s" (current-buffer)))
>>                          cmd)))
>> (with-temp-buffer
>>   (with-output-to-string
>>     (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))
>>
>> This outputs:
>>
>> \"Called in  *temp*\"
>
> I tried this recipe, but I'm not getting the :filter function called at
> all.  Do you have a recipe, starting from "emacs -Q", that reproduces
> this bug?
>
> And your report didn't include the data about the version generated by
> report-emacs-bug, so it's hard to guess whether bug is only on some
> specific system.

I can reproduce the above on Emacs 26.3, but not on master.

Note that there might have been changes here with the merge of
scratch/substitute-command-keys.  I tried hard to not introduce any
regressions or even changes in behavior with that branch, but I might
have failed to include the above bug...

What is the result output here?  Here, the last form evaluates to this
on master:

"
Global Bindings Starting With C-c C-l:
key             binding
---             -------


Function key map translations Starting With C-c C-l:
key             binding
---             -------

"

Is this correct?  Should it do anything else in addition that it
currently does not?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 16:24:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>, yyoncho <yyoncho <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 16:23:30 +0000
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> The problem is that describe-buffer-bindings only changes the buffer to
> look up the bindings, but everything that generates the description
> (starting with describe-map-tree) doesn't know about that other buffer.

BTW, does anyone know why describe-map and describe-map-tree currently
inserts its result into buffer instead of just returning a string?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 16:34:01 GMT) Full text and rfc822 format available.

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

From: yyoncho <yyoncho <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org, Andreas Schwab <schwab <at> linux-m68k.org>
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 18:32:46 +0200
[Message part 1 (text/plain, inline)]
Even better will be if there is some intermediate structured result which
can be used by packages like which-key instead of parsing the string.

On Fri, Oct 30, 2020 at 6:23 PM Stefan Kangas <stefankangas <at> gmail.com>
wrote:

> Andreas Schwab <schwab <at> linux-m68k.org> writes:
>
> > The problem is that describe-buffer-bindings only changes the buffer to
> > look up the bindings, but everything that generates the description
> > (starting with describe-map-tree) doesn't know about that other buffer.
>
> BTW, does anyone know why describe-map and describe-map-tree currently
> inserts its result into buffer instead of just returning a string?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 16:47:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 17:46:14 +0100
On Okt 30 2020, Stefan Kangas wrote:

> BTW, does anyone know why describe-map and describe-map-tree currently
> inserts its result into buffer instead of just returning a string?

That's what they always did.  It's also more efficient.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Fri, 30 Oct 2020 18:04:02 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 39149 <at> debbugs.gnu.org,
 yyoncho <yyoncho <at> gmail.com>
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Fri, 30 Oct 2020 18:03:32 +0000
Stefan Kangas <stefankangas <at> gmail.com> writes:

> Note that there might have been changes here with the merge of
> scratch/substitute-command-keys.  I tried hard to not introduce any
> regressions or even changes in behavior with that branch, but I might
> have failed to include the above bug...
>
> What is the result output here?  Here, the last form evaluates to this
> on master:
>
> "
> Global Bindings Starting With C-c C-l:
> key             binding
> ---             -------
>
> 
> Function key map translations Starting With C-c C-l:
> key             binding
> ---             -------
>
> "

FWIW, emacs-27 and master behave differently in this respect;
see e.g. https://github.com/abo-abo/swiper/issues/2709.

The headings used to be inserted in the current buffer along with the
bindings, but the headings alone are now printed to standard-output
instead.

Is that a problem?

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 01 Nov 2020 04:32:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, yyoncho <yyoncho <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sat, 31 Oct 2020 21:31:12 -0700
Stefan Kangas <stefankangas <at> gmail.com> writes:

>>> To reproduce (eval in scratch buffer)
>>> (define-key global-map (kbd "C-c C-l r")
>>>   `(menu-item "2" switch-to-buffer
>>>               :filter ,(lambda (cmd)
>>>                          (print (format "Called in %s" (current-buffer)))
>>>                          cmd)))
>>> (with-temp-buffer
>>>   (with-output-to-string
>>>     (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))
>>>
>>> This outputs:
>>>
>>> \"Called in  *temp*\"
>>
>> I tried this recipe, but I'm not getting the :filter function called at
>> all.  Do you have a recipe, starting from "emacs -Q", that reproduces
>> this bug?
>
> I can reproduce the above on Emacs 26.3, but not on master.

This change in behavior was caused by this commit:

commit 8a1441310aa151e739cfed3bd2eff3358edc8001
Author: Stefan Kangas <stefan <at> marxist.se>
Date:   Sun Oct 18 15:32:22 2020 +0200

    Prefer Lisp version of describe-map-tree

So as suspected, there is a difference in behavior between the new Lisp
version of describe-map-tree and the new C version.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 01 Nov 2020 14:57:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 39149 <at> debbugs.gnu.org,
 yyoncho <yyoncho <at> gmail.com>
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sun, 1 Nov 2020 06:56:17 -0800
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> FWIW, emacs-27 and master behave differently in this respect;
> see e.g. https://github.com/abo-abo/swiper/issues/2709.
>
> The headings used to be inserted in the current buffer along with the
> bindings, but the headings alone are now printed to standard-output
> instead.
>
> Is that a problem?

Yes, it is a bug.  I have pushed a fix to master.  Could you please test
that it works for you?

(The fix should mean that you don't have to bind `standard-output' in
swiper.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 01 Nov 2020 17:02:01 GMT) Full text and rfc822 format available.

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

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sun, 01 Nov 2020 17:01:49 +0000
Stefan Kangas <stefankangas <at> gmail.com> writes:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> FWIW, emacs-27 and master behave differently in this respect;
>> see e.g. https://github.com/abo-abo/swiper/issues/2709.
>>
>> The headings used to be inserted in the current buffer along with the
>> bindings, but the headings alone are now printed to standard-output
>> instead.
>>
>> Is that a problem?
>
> Yes, it is a bug.  I have pushed a fix to master.  Could you please test
> that it works for you?

Thanks, it does.

> (The fix should mean that you don't have to bind `standard-output' in
> swiper.)

Done.

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 15 Nov 2020 00:25:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, yyoncho <yyoncho <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sat, 14 Nov 2020 16:24:07 -0800
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> yyoncho <yyoncho <at> gmail.com> writes:
>
>> To reproduce (eval in scratch buffer)
>> (define-key global-map (kbd "C-c C-l r")
>>   `(menu-item "2" switch-to-buffer
>>               :filter ,(lambda (cmd)
>>                          (print (format "Called in %s" (current-buffer)))
>>                          cmd)))
>> (with-temp-buffer
>>   (with-output-to-string
>>     (describe-buffer-bindings (get-buffer "*scratch*") [3 12] t)))
>>
>> This outputs:
>>
>> \"Called in  *temp*\"
>
> I tried this recipe, but I'm not getting the :filter function called at
> all.  Do you have a recipe, starting from "emacs -Q", that reproduces
> this bug?

I have pushed a fix to master (f08e6538dc) ensuring that we correctly
run the :filter function.

The bug can now be reproduced (on master and 26.3) using:

(progn
  (require 'ert)
  (let (was-in-buffer)
    (unwind-protect
        (progn
          (define-key global-map (kbd "C-c C-l r")
            `(menu-item "2" identity
                        :filter ,(lambda (cmd)
                                   (setq was-in-buffer
                                         (current-buffer))
                                   cmd)))
          (with-temp-buffer
            (let ((buf (get-buffer "*scratch*")))
              (describe-buffer-bindings buf nil t)
              (should was-in-buffer)
              (should (eq was-in-buffer buf)))))
      (define-key global-map (kbd "C-c C-l r") nil)
      (define-key global-map (kbd "C-c C-l") nil))))

As Andreas Schwab has pointed out, the problem is that describe-map (and
describe_map before it) has no idea about the buffer argument to
describe-bindings.  So if the above is to be made to work, we have to
make sure that it does.

I see two ways of doing that:

a) Add a new argument to describe-map with the original buffer.  Ensure
   that the :filter function is run there.

b) Change describe-map to return its output as a string.

The problem with a) is that describe-map already has a pretty long
argument list.  It also seems to me that the resulting code would not be
very easy to follow.

My preference would therefore be looking into option b) first.
If we can make it work, we could then just change the buffer in
describe-buffer-bindings before calling describe-map.

(It is true that the old C function "describe_map" has always inserted
its output in the current buffer.  It also true that it has always been
an internal function, and never exposed to Lisp directly.  So we should
be free to change its behavior, and we should probably better do it
before Emacs 28.1.)

Thoughts?

---

Also, a tangent:

IMHO, using `menu-item' in this way works as it stands, but it is a bit
strange conceptually.  We are binding a key to a `menu-item' that is
never intended to be used for a menu.  Yet IIUC this is the recommended
way of using :filter.

It would perhaps be better to have a specific format that allows for
these extended features, without needing to provide a `menu-item'.

(See `(elisp) Format of Keymaps' for more.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 15 Nov 2020 15:17:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: larsi <at> gnus.org, 39149 <at> debbugs.gnu.org, yyoncho <at> gmail.com
Subject: Re: bug#39149: 27.0.50;
 describe-buffer-bindings is calling :filter function in wrong buffer
Date: Sun, 15 Nov 2020 17:15:57 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sat, 14 Nov 2020 16:24:07 -0800
> Cc: 39149 <at> debbugs.gnu.org
> 
> a) Add a new argument to describe-map with the original buffer.  Ensure
>    that the :filter function is run there.
> 
> b) Change describe-map to return its output as a string.

Unless I'm missing something, b) would be a backward-incompatible
change, so I don't think we should consider it.

If adding an argument is deemed not a good idea, how about binding a
special variable to convey that information to
describe-buffer-bindings?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 15 Nov 2020 16:09:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, 39149 <at> debbugs.gnu.org, yyoncho <at> gmail.com
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sun, 15 Nov 2020 08:08:18 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Stefan Kangas <stefankangas <at> gmail.com>
>> Date: Sat, 14 Nov 2020 16:24:07 -0800
>> Cc: 39149 <at> debbugs.gnu.org
>>
>> a) Add a new argument to describe-map with the original buffer.  Ensure
>>    that the :filter function is run there.
>>
>> b) Change describe-map to return its output as a string.
>
> Unless I'm missing something, b) would be a backward-incompatible
> change, so I don't think we should consider it.

No: `describe-map' was added on master a month ago as a Lisp translation
of the old C function "describe_map".  It has never been exposed to Lisp
directly, but was used internally on the C level by
`substitute-command-keys' and `describe-buffer-bindings'.

What is true is that:

- `substitute-command-keys' has always returned a string.
- `describe-buffer-bindings' has always inserted into the current
  buffer.

Whether we go with option a) or b) shouldn't need to change that.

So we should think carefully about what their interface should be rather
than nail it down to match the old C code.

BTW, while we're on it, I'm not at all sure it would make sense to use
these functions outside of help.el.  I think we might want to consider
renaming `describe-map' to `help--describe-map', and similarly for
`describe-map-tree'.

> If adding an argument is deemed not a good idea, how about binding a
> special variable to convey that information to
> describe-buffer-bindings?

Yes, that could be a third option c).  Personally, I like option b)
better.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 15 Nov 2020 16:29:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: larsi <at> gnus.org, 39149 <at> debbugs.gnu.org, yyoncho <at> gmail.com
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sun, 15 Nov 2020 18:28:38 +0200
> From: Stefan Kangas <stefankangas <at> gmail.com>
> Date: Sun, 15 Nov 2020 08:08:18 -0800
> Cc: larsi <at> gnus.org, yyoncho <at> gmail.com, 39149 <at> debbugs.gnu.org
> 
> > If adding an argument is deemed not a good idea, how about binding a
> > special variable to convey that information to
> > describe-buffer-bindings?
> 
> Yes, that could be a third option c).  Personally, I like option b)
> better.

If we need to insert stuff into a buffer, why make it a string and
then insert? why not insert directly?  The latter means less consing,
so less GC.




Removed tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 14 Dec 2020 17:15:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 17 Apr 2022 15:38:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 39149 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sun, 17 Apr 2022 17:37:17 +0200
Stefan Kangas <stefankangas <at> gmail.com> writes:

> I see two ways of doing that:
>
> a) Add a new argument to describe-map with the original buffer.  Ensure
>    that the :filter function is run there.

I've now done this in Emacs 29.

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




bug marked as fixed in version 29.1, send any further explanations to 39149 <at> debbugs.gnu.org and yyoncho <yyoncho <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 17 Apr 2022 15:38:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 17 Apr 2022 16:03:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 39149 <at> debbugs.gnu.org, stefankangas <at> gmail.com, yyoncho <at> gmail.com
Subject: Re: bug#39149: 27.0.50;
 describe-buffer-bindings is calling :filter function in wrong buffer
Date: Sun, 17 Apr 2022 19:02:10 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Sun, 17 Apr 2022 17:37:17 +0200
> Cc: 39149 <at> debbugs.gnu.org, yyoncho <yyoncho <at> gmail.com>
> 
> Stefan Kangas <stefankangas <at> gmail.com> writes:
> 
> > I see two ways of doing that:
> >
> > a) Add a new argument to describe-map with the original buffer.  Ensure
> >    that the :filter function is run there.
> 
> I've now done this in Emacs 29.

But you didn't push, did you?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39149; Package emacs. (Sun, 17 Apr 2022 16:08:01 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 39149 <at> debbugs.gnu.org, stefankangas <at> gmail.com, yyoncho <at> gmail.com
Subject: Re: bug#39149: 27.0.50; describe-buffer-bindings is calling :filter
 function in wrong buffer
Date: Sun, 17 Apr 2022 18:06:51 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> But you didn't push, did you?

'course not.  🫠

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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 May 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 338 days ago.

Previous Next


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