From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Making the command loop mode-dependent [was: position on changing defaults?] Date: Sun, 9 Mar 2008 08:38:23 +0000 Message-ID: <20080309083823.GA1886@muc.de> References: <200803050637.m256bXL3008361@sallyv1.ics.uci.edu> <87hcfkdhqk.fsf@stupidchicken.com> <87pru8enjx.fsf@kfs-lx.rd.rdm> <87skz12avy.fsf@kfs-lx.rd.rdm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205052690 24752 80.91.229.12 (9 Mar 2008 08:51:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 9 Mar 2008 08:51:30 +0000 (UTC) Cc: Chong Yidong , Stefan Monnier , emacs-devel@gnu.org To: "Kim F. Storm" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 09 09:51:56 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JYHG6-0004Z6-98 for ged-emacs-devel@m.gmane.org; Sun, 09 Mar 2008 09:51:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYHFY-0006me-0v for ged-emacs-devel@m.gmane.org; Sun, 09 Mar 2008 04:51:20 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JYHFT-0006mF-VI for emacs-devel@gnu.org; Sun, 09 Mar 2008 04:51:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JYHFS-0006m3-HM for emacs-devel@gnu.org; Sun, 09 Mar 2008 04:51:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYHFS-0006m0-Ao for emacs-devel@gnu.org; Sun, 09 Mar 2008 04:51:14 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JYHFR-0007JC-VU for emacs-devel@gnu.org; Sun, 09 Mar 2008 04:51:14 -0400 Original-Received: (qmail 25981 invoked by uid 3782); 9 Mar 2008 08:24:27 -0000 Original-Received: from acm.muc.de (p57AF6EE8.dip.t-dialin.net [87.175.110.232]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Sun, 09 Mar 2008 09:24:24 +0100 Original-Received: (qmail 2468 invoked by uid 1000); 9 Mar 2008 08:38:23 -0000 Content-Disposition: inline In-Reply-To: <87skz12avy.fsf@kfs-lx.rd.rdm> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:91859 Archived-At: Morning, Kim! On Sat, Mar 08, 2008 at 09:56:01PM +0100, Kim F. Storm wrote: > Stefan Monnier writes: > >> BTW, why is using a pre- or post- command hook so bad? > > These tend to be brittle (e.g. when entering/exiting minibuffer > > prompts or recursive edits) and difficult to debug. I think the need > > for pre/post command-hook is often a sign of a missing functionality > > elsewhere. > It seems I could get by with the following hooks: > pre-command-shifted-key-hook > Called before executing command if transient-mark-mode > is enabled and current command is invoked by a shifted key. > pre-command-mark-active-hook > Called before executing command if transient-mark-mode > is enabled and mark is active. > post-command-mark-active-hook > Called after executing command if transient-mark-mode > is enabled and mark is active. Called before checking > value of deactivate-mark! Where are these hooks going to be called from? The command loop? I think this needs a _LOT_ of thinking about. Up to now, the command loop has been @dfn{vi-modeless} (i.e. doesn't have things like vi's "insert-mode" and "command-mode"). This is a fundamental assumption which (I think) has always been implicit up till now. If the command loop starts calling hooks IF certain user-level conditions hold, it will cease to be vi-modeless. Things will surely break. Somehow, sometime, this is going to cause a LOT of pain in the far future, since it will constrain our options. In the medium future, possibly, some modes might have to start testing the values of these hooks to behave properly. [Stefan:] > > These [pre- and post-command-hooks] tend to be brittle (e.g. when > > entering/exiting minibuffer prompts or recursive edits) and difficult > > to debug. I can't see that pre-command-shifted-key-hook and friends would be any less brittle. [ .... ] > -- > Kim F. Storm http://www.cua.dk -- Alan Mackenzie (Nuremberg, Germany).