all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
To: help-gnu-emacs@gnu.org
Subject: Re: can a command specify overwrite selection behavior?
Date: Sat, 25 Dec 2010 00:17:45 +0000 (UTC)	[thread overview]
Message-ID: <slrnihae1a.3sm.nospam-abuse@powdermilk.math.berkeley.edu> (raw)
In-Reply-To: mailman.0.1293037975.895.help-gnu-emacs@gnu.org

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


  parent reply	other threads:[~2010-12-25  0:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01  5:33 can a command specify overwrite selection behavior? Xah Lee
2010-09-01  8:11 ` Xah Lee
2010-12-10 23:37   ` Drew Adams
     [not found]   ` <mailman.4.1292024249.16140.help-gnu-emacs@gnu.org>
2010-12-12 15:16     ` Xah Lee
2010-12-13 17:16       ` Drew Adams
     [not found]       ` <mailman.1.1292262212.1009.help-gnu-emacs@gnu.org>
2010-12-22 14:49         ` Xah Lee
2010-12-22 17:12           ` Drew Adams
     [not found]           ` <mailman.0.1293037975.895.help-gnu-emacs@gnu.org>
2010-12-23  2:33             ` Xah Lee
2010-12-25  0:17             ` Ilya Zakharevich [this message]
2010-12-25 17:00               ` Drew Adams
     [not found]               ` <mailman.8.1293296501.5624.help-gnu-emacs@gnu.org>
2010-12-25 18:54                 ` Ilya Zakharevich
2010-12-26  0:32                   ` Drew Adams
2010-12-26  2:20                 ` Xah Lee
2010-12-26 16:19                   ` Drew Adams
2010-12-28  2:46                 ` Stefan Monnier
2010-12-28  5:34                   ` Drew Adams
2010-12-28 14:18                     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrnihae1a.3sm.nospam-abuse@powdermilk.math.berkeley.edu \
    --to=nospam-abuse@ilyaz.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.