From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ilya Zakharevich Newsgroups: gmane.emacs.help Subject: Re: can a command specify overwrite selection behavior? Date: Sat, 25 Dec 2010 00:17:45 +0000 (UTC) Organization: U.C. Berkeley Math. Department. Message-ID: References: <33ac6984-0a0c-4db8-8ea1-50ec5c271a25@x18g2000pro.googlegroups.com> <05a87fbb-31a7-40c3-a890-6c7aacaefac3@t5g2000prd.googlegroups.com> <92235e12-464c-41d9-9a49-33598c157113@i25g2000prd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1293287618 14235 80.91.229.12 (25 Dec 2010 14:33:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 25 Dec 2010 14:33:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 25 15:33:35 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PWVBe-0003b5-TF for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Dec 2010 15:33:35 +0100 Original-Received: from localhost ([127.0.0.1]:53789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PWVBe-0006oR-8G for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Dec 2010 09:33:34 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!news2.euro.net!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 33 Injection-Date: Sat, 25 Dec 2010 00:17:45 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="LlLjF8LevGdIZWbTvv+SXA"; logging-data="27636"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hXRQilbD8xpQp5aP0deFS" User-Agent: slrn/0.9.8.1pl1 (Linux) Cancel-Lock: sha1:uSBzBMrOzkstX3EWxV7ys9EEh7E= Original-Xref: usenet.stanford.edu gnu.emacs.help:183638 X-Mailman-Approved-At: Sat, 25 Dec 2010 09:31:56 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77880 Archived-At: On 2010-12-22, Drew Adams 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