unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9602: kbd macro does not evaluate its parameter
@ 2011-09-26  1:31 Le Wang
       [not found] ` <handler.9602.B.131700072132002.ack@debbugs.gnu.org>
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Le Wang @ 2011-09-26  1:31 UTC (permalink / raw)
  To: 9602

From stackoverflow:
http://stackoverflow.com/questions/7549628/whats-wrong-with-the-following-unbind-script/7549825#7549825

User tries:

 (dolist (abcc '("C-a" "C-b"))
   (global-unset-key (kbd abcc)))

Which fails.

(defmacro kbd (keys)
 "Convert KEYS to the internal Emacs key representation.
KEYS should be a string constant in the format used for
saving keyboard macros (see `edmacro-mode')."
 (read-kbd-macro keys))

kbd should evaluate its parameter before calling the read-kbd-macro
function.  Its parameter types should all be self evaluating.

--
Le





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: Acknowledgement (kbd macro does not evaluate its parameter)
       [not found] ` <handler.9602.B.131700072132002.ack@debbugs.gnu.org>
@ 2011-09-26  1:47   ` Le Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Le Wang @ 2011-09-26  1:47 UTC (permalink / raw)
  To: 9602

Really sorry for the noise.  Upon closer inspection, I realize that
`kbd' is meant to be used on constants, so that byte-compiled code is
more efficient.  Please close this bug.

On Mon, Sep 26, 2011 at 9:32 AM, GNU bug Tracking System
<help-debbugs@gnu.org> wrote:
> Thank you for filing a new bug report with debbugs.gnu.org.
>
> This is an automatically generated reply to let you know your message
> has been received.
>
> Your message is being forwarded to the package maintainers and other
> interested parties for their attention; they will reply in due course.
>
> Your message has been sent to the package maintainer(s):
>  bug-gnu-emacs@gnu.org
>
> If you wish to submit further information on this problem, please
> send it to 9602@debbugs.gnu.org.
>
> Please do not send mail to help-debbugs@gnu.org unless you wish
> to report a problem with the Bug-tracking system.
>
> --
> 9602: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9602
> GNU Bug Tracking System
> Contact help-debbugs@gnu.org with problems
>



-- 
Le





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26  1:31 bug#9602: kbd macro does not evaluate its parameter Le Wang
       [not found] ` <handler.9602.B.131700072132002.ack@debbugs.gnu.org>
@ 2011-09-26  1:49 ` Drew Adams
  2011-09-26  8:01   ` Le Wang
  2011-09-26  4:09 ` Stefan Monnier
  2 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2011-09-26  1:49 UTC (permalink / raw)
  To: 'Le Wang', 9602

> kbd should evaluate its parameter before calling the read-kbd-macro
> function.  Its parameter types should all be self evaluating.

No, it should not.  Read the replies to that stackoverflow question (use
`read-kbd-macro').






^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26  1:31 bug#9602: kbd macro does not evaluate its parameter Le Wang
       [not found] ` <handler.9602.B.131700072132002.ack@debbugs.gnu.org>
  2011-09-26  1:49 ` bug#9602: kbd macro does not evaluate its parameter Drew Adams
@ 2011-09-26  4:09 ` Stefan Monnier
  2011-09-26  4:45   ` Leo
  2013-02-14  8:17   ` Glenn Morris
  2 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2011-09-26  4:09 UTC (permalink / raw)
  To: Le Wang; +Cc: 9602

>  (dolist (abcc '("C-a" "C-b"))
>    (global-unset-key (kbd abcc)))
> Which fails.

Yes, kbd should have been defined as an alias of read-kbd-macro
(i.e. a function) and mark it as pure so the byte-optimizer can
precompute it when applicable.

I know that changing a function into a macro introduces many
compatibility problems, but maybe changing this macro into a function
can be done without problems?


        Stefan





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26  4:09 ` Stefan Monnier
@ 2011-09-26  4:45   ` Leo
  2011-09-26 13:43     ` Stefan Monnier
  2013-02-14  8:17   ` Glenn Morris
  1 sibling, 1 reply; 10+ messages in thread
From: Leo @ 2011-09-26  4:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9602

On 2011-09-26 12:09 +0800, Stefan Monnier wrote:
> Yes, kbd should have been defined as an alias of read-kbd-macro
> (i.e. a function) and mark it as pure so the byte-optimizer can
> precompute it when applicable.

How do you mean by 'mark it as pure' and how to do it?

> I know that changing a function into a macro introduces many
> compatibility problems, but maybe changing this macro into a function
> can be done without problems?

Sounds good.

Leo





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26  1:49 ` bug#9602: kbd macro does not evaluate its parameter Drew Adams
@ 2011-09-26  8:01   ` Le Wang
  0 siblings, 0 replies; 10+ messages in thread
From: Le Wang @ 2011-09-26  8:01 UTC (permalink / raw)
  To: Drew Adams; +Cc: 9602

I think Stefan is proposing a way for kbd to both be a function and be
compiled efficiently.

On Mon, Sep 26, 2011 at 9:49 AM, Drew Adams <drew.adams@oracle.com> wrote:
>> kbd should evaluate its parameter before calling the read-kbd-macro
>> function.  Its parameter types should all be self evaluating.
>
> No, it should not.  Read the replies to that stackoverflow question (use
> `read-kbd-macro').

Yeah, that's me.  :)



-- 
Le





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26  4:45   ` Leo
@ 2011-09-26 13:43     ` Stefan Monnier
  2011-09-26 15:52       ` Leo
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2011-09-26 13:43 UTC (permalink / raw)
  To: Leo; +Cc: 9602

>> Yes, kbd should have been defined as an alias of read-kbd-macro
>> (i.e. a function) and mark it as pure so the byte-optimizer can
>> precompute it when applicable.
> How do you mean by 'mark it as pure' and how to do it?

(put 'kbd 'byte-optimizer 'byte-optimize-pure-func)


        Stefan





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26 13:43     ` Stefan Monnier
@ 2011-09-26 15:52       ` Leo
  2011-09-26 16:31         ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2011-09-26 15:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 9602

On 2011-09-26 21:43 +0800, Stefan Monnier wrote:
[snipped 3 lines]
>> How do you mean by 'mark it as pure' and how to do it?
>
> (put 'kbd 'byte-optimizer 'byte-optimize-pure-func)

byte-optimize-pure-func is no more.

Leo





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26 15:52       ` Leo
@ 2011-09-26 16:31         ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2011-09-26 16:31 UTC (permalink / raw)
  To: Leo; +Cc: 9602

>>> How do you mean by 'mark it as pure' and how to do it?
>> (put 'kbd 'byte-optimizer 'byte-optimize-pure-func)
> byte-optimize-pure-func is no more.

Oh, right, sorry: (put 'kbd 'pure t)


        Stefan





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#9602: kbd macro does not evaluate its parameter
  2011-09-26  4:09 ` Stefan Monnier
  2011-09-26  4:45   ` Leo
@ 2013-02-14  8:17   ` Glenn Morris
  1 sibling, 0 replies; 10+ messages in thread
From: Glenn Morris @ 2013-02-14  8:17 UTC (permalink / raw)
  To: 9602-done

Version: 24.3

Stefan Monnier wrote:

> Yes, kbd should have been defined as an alias of read-kbd-macro
> (i.e. a function) and mark it as pure so the byte-optimizer can
> precompute it when applicable.

That's been done.





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-02-14  8:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-26  1:31 bug#9602: kbd macro does not evaluate its parameter Le Wang
     [not found] ` <handler.9602.B.131700072132002.ack@debbugs.gnu.org>
2011-09-26  1:47   ` bug#9602: Acknowledgement (kbd macro does not evaluate its parameter) Le Wang
2011-09-26  1:49 ` bug#9602: kbd macro does not evaluate its parameter Drew Adams
2011-09-26  8:01   ` Le Wang
2011-09-26  4:09 ` Stefan Monnier
2011-09-26  4:45   ` Leo
2011-09-26 13:43     ` Stefan Monnier
2011-09-26 15:52       ` Leo
2011-09-26 16:31         ` Stefan Monnier
2013-02-14  8:17   ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).