help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can a command specify overwrite selection behavior?


From: Ilya Zakharevich
Subject: Re: can a command specify overwrite selection behavior?
Date: Sat, 25 Dec 2010 00:17:45 +0000 (UTC)
User-agent: slrn/0.9.8.1pl1 (Linux)

On 2010-12-22, Drew Adams <drew.adams@oracle.com> wrote:
>> Drew, what i didn't understand is why the insert-date property makes a
>> distinction on whether a command is called by name or by a keyboard
>> shortcut?

> (defun delete-selection-pre-hook ()
>   (when (and delete-selection-mode
>              transient-mark-mode mark-active
>              (not buffer-read-only))
>     (let ((type (and (symbolp this-command)
>                        (get this-command ; <=======
>                           'delete-selection))))
>
> If you debug this (use `message', not `debug-on-entry'!), you'll see that when
> you use `M-x' the value of `this-command' is `execute-extended-command', not
> `insert-date'.  And `execute-extended-command' does not have a non-nil
> `delete-selection' property.
>
> `execute-extended-command' is a bit special wrt `this-command' and
> `last-command'.  It DTRT in the end, essentially removing itself from the 
> party,
> but that's only at the end.  While `execute-extended-command' is executing, it
> is the value of `this-command'.
>
> People sometimes get thrown off by this kind of thing, and similar things wrt
> `M-:' (and `C-x C-e', `C-M-x'...).

Essentially, I read this as a detailed explanation of the way this bug
is triggered.  If one understands the mechanism of this bug so well,
why not fix it?  AFAICS, this subroutine is placed in a wrong hook; it
should be executed later...

Puzzled,
Ilya


reply via email to

[Prev in Thread] Current Thread [Next in Thread]