all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Possible bugs in (get last-command...) and (get this-command...)
@ 2006-09-05 16:36 Drew Adams
  2006-09-05 23:01 ` Kim F. Storm
  2006-09-06 19:05 ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Drew Adams @ 2006-09-05 16:36 UTC (permalink / raw)


I ran into this in my own code, and grepping shows that some of the vanilla
Emacs Lisp code makes the same assumption, so there might be potential bugs
there as well (I don't know).

The problem is that `last-command' and `this-command' need not necessarily
be named functions; they could be anonymous (lambdas). Some of the Emacs
Lisp code correctly tests for that like this:

(and (symbolp last-command) (get last-command...))

But some of the code does not. Perhaps someone knowledgeable might want to
take a look. I noticed, for instance that novice.el and ido.el both have
some unprotected occurrences of (get last-command...) or (get
this-command...). Again, I don't know if the `symbolp' test is necessary in
those particular contexts (perhaps it is known that a symbol is present),
but I think it might be.

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

* Re: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-05 16:36 Possible bugs in (get last-command...) and (get this-command...) Drew Adams
@ 2006-09-05 23:01 ` Kim F. Storm
  2006-09-06 19:05 ` Richard Stallman
  1 sibling, 0 replies; 9+ messages in thread
From: Kim F. Storm @ 2006-09-05 23:01 UTC (permalink / raw)
  Cc: Emacs-Devel

"Drew Adams" <drew.adams@oracle.com> writes:

> (and (symbolp last-command) (get last-command...))
>
> But some of the code does not. Perhaps someone knowledgeable might want to
> take a look. I noticed, for instance that novice.el and ido.el both have
> some unprotected occurrences of (get last-command...) or (get
> this-command...). Again, I don't know if the `symbolp' test is necessary in
> those particular contexts (perhaps it is known that a symbol is present),
> but I think it might be.

Thanks.

I checked ido -- it is safe.

I also checked cua; it had a condition-case to catch errors, but I've
updated the code to explicitly check this-command with symbolp.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-05 16:36 Possible bugs in (get last-command...) and (get this-command...) Drew Adams
  2006-09-05 23:01 ` Kim F. Storm
@ 2006-09-06 19:05 ` Richard Stallman
  2006-09-06 19:13   ` Drew Adams
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2006-09-06 19:05 UTC (permalink / raw)
  Cc: emacs-devel

    But some of the code does not. Perhaps someone knowledgeable might want to
    take a look. I noticed, for instance that novice.el and ido.el both have
    some unprotected occurrences of (get last-command...) or (get
    this-command...).

It is safe in novice.el, because that will only get called
when the command is a symbol and has the property.  I will add
a comment about that.

Drew, would you like to find and check all the places which look at
properties of last-command or this-command, and give us a list of the
places that might be bugs?

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

* RE: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-06 19:05 ` Richard Stallman
@ 2006-09-06 19:13   ` Drew Adams
  2006-09-06 22:16     ` Drew Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2006-09-06 19:13 UTC (permalink / raw)


        But some of the code does not. Perhaps someone
        knowledgeable might want to
        take a look. I noticed, for instance that novice.el and
        ido.el both have
        some unprotected occurrences of (get last-command...) or (get
        this-command...).

    It is safe in novice.el, because that will only get called
    when the command is a symbol and has the property.  I will add
    a comment about that.

    Drew, would you like to find and check all the places which look at
    properties of last-command or this-command, and give us a list of the
    places that might be bugs?

Sorry, I just don't have the time right now. If I get some time, I can try
to do that next weekend. If I get to it before then, I'll let you know.

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

* RE: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-06 19:13   ` Drew Adams
@ 2006-09-06 22:16     ` Drew Adams
  2006-09-07  9:17       ` Kim F. Storm
  2006-09-07 21:14       ` Richard Stallman
  0 siblings, 2 replies; 9+ messages in thread
From: Drew Adams @ 2006-09-06 22:16 UTC (permalink / raw)


            But some of the code does not. Perhaps someone
            knowledgeable might want to
            take a look. I noticed, for instance that novice.el and
            ido.el both have
            some unprotected occurrences of (get last-command...) or (get
            this-command...).

        It is safe in novice.el, because that will only get called
        when the command is a symbol and has the property.  I will add
        a comment about that.

        Drew, would you like to find and check all the places which look at
        properties of last-command or this-command, and give us a
        list of the places that might be bugs?

    Sorry, I just don't have the time right now. If I get some
    time, I can try to do that next weekend. If I get to it before then,
    I'll let you know.

I checked the Lisp sources for `get' used with `last-command' and
`this-command'. These are the only occurrences, in a build of 2006-07-19:

ido.el:4476:(eq (get this-command 'ido) 'dir)
ido.el:4482:((and (not (eq (get this-command 'ido) 'ignore))
ido.el:4487:(if (eq (get this-command 'ido) 'find-file) nil 'ignore))
novice.el:65:(if (stringp (get this-command 'disabled))
novice.el:66:(princ (get this-command 'disabled))
cua-base.el:1100:(let ((movement (eq (get this-command 'CUA) 'move)))
cua-base.el:1142:(let* ((ds (or (get this-command 'delete-selection)
cua-base.el:1143:(get this-command 'pending-delete)))
flyspell.el:716:(or (get this-command 'flyspell-delayed)
flyspell.el:717:(and (get this-command
'flyspell-deplacement)flyspell.el:789:     ((get this-command
'flyspell-deplacement)
flyspell.el:791:((get this-command 'flyspell-delayed)
flyspell.el:833:(get this-command 'flyspell-delayed))))
flyspell.el:854:(get this-command 'flyspell-delayed)))
flyspell.el:929:(if (and (symbolp this-command) (get this-command
'flyspell-delayed))

Kim mentioned that he checked ido.el.
RMS mentioned that he checked novice.el.

HTH

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

* Re: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-06 22:16     ` Drew Adams
@ 2006-09-07  9:17       ` Kim F. Storm
  2006-09-08 11:55         ` Richard Stallman
  2006-09-07 21:14       ` Richard Stallman
  1 sibling, 1 reply; 9+ messages in thread
From: Kim F. Storm @ 2006-09-07  9:17 UTC (permalink / raw)
  Cc: emacs-devel

"Drew Adams" <drew.adams@oracle.com> writes:

> Kim mentioned that he checked ido.el.
> RMS mentioned that he checked novice.el.

I also checked/fixed cua-base.el.

And I just checked flyspell.el, and it is safe too
(it already checks with symbolp).

Thanks for the heads up.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-06 22:16     ` Drew Adams
  2006-09-07  9:17       ` Kim F. Storm
@ 2006-09-07 21:14       ` Richard Stallman
  2006-09-07 21:26         ` Drew Adams
  1 sibling, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2006-09-07 21:14 UTC (permalink / raw)
  Cc: emacs-devel

    I checked the Lisp sources for `get' used with `last-command' and
    `this-command'. These are the only occurrences, in a build of 2006-07-19:

Thank you for doing this preparatory work.

I think the only one of those packages not yet attended to is flyspell.
Would someone please check (and if necessary fix) flyspell.el, then
ack this message?

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

* RE: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-07 21:14       ` Richard Stallman
@ 2006-09-07 21:26         ` Drew Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2006-09-07 21:26 UTC (permalink / raw)


        I checked the Lisp sources for `get' used with `last-command' and
        `this-command'. These are the only occurrences, in a build 
        of 2006-07-19:
    
    I think the only one of those packages not yet attended to is flyspell.
    Would someone please check (and if necessary fix) flyspell.el, then
    ack this message?

Kim mentioned that he checked flyspell:

    From: Kim F. Storm
    Sent: Thursday, September 07, 2006 2:17 AM   
    > Kim mentioned that he checked ido.el.
    > RMS mentioned that he checked novice.el.
    
    I also checked/fixed cua-base.el.
    And I just checked flyspell.el, and it is safe too
    (it already checks with symbolp).

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

* Re: Possible bugs in (get last-command...) and (get this-command...)
  2006-09-07  9:17       ` Kim F. Storm
@ 2006-09-08 11:55         ` Richard Stallman
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Stallman @ 2006-09-08 11:55 UTC (permalink / raw)
  Cc: drew.adams, emacs-devel

    I also checked/fixed cua-base.el.

    And I just checked flyspell.el, and it is safe too
    (it already checks with symbolp).

This means they have all been checked.  Thanks.

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

end of thread, other threads:[~2006-09-08 11:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-05 16:36 Possible bugs in (get last-command...) and (get this-command...) Drew Adams
2006-09-05 23:01 ` Kim F. Storm
2006-09-06 19:05 ` Richard Stallman
2006-09-06 19:13   ` Drew Adams
2006-09-06 22:16     ` Drew Adams
2006-09-07  9:17       ` Kim F. Storm
2006-09-08 11:55         ` Richard Stallman
2006-09-07 21:14       ` Richard Stallman
2006-09-07 21:26         ` Drew Adams

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.