From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Shift selection using interactive spec Date: Wed, 26 Mar 2008 12:48:22 +0200 Organization: JURTA Message-ID: <87ve3993dt.fsf@jurta.org> References: <87k5k69p92.fsf@stupidchicken.com> <87abl11ilo.fsf@stupidchicken.com> <874pb9koyw.fsf@stupidchicken.com> <87od9gzqv9.fsf@stupidchicken.com> <87bq5gytbi.fsf@stupidchicken.com> <8763vndi0r.fsf@kfs-lx.rd.rdm> <87hcf6ratt.fsf@stupidchicken.com> <878x0if9ul.fsf@stupidchicken.com> <87od9e9gnx.fsf@stupidchicken.com> <87skyo5bvk.fsf@stupidchicken.com> <87skynrin5.fsf@stupidchicken.com> <87iqzju0lq.fsf@kfs-lx.rd.rdm> <851w5xx5ya.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1206529957 1794 80.91.229.12 (26 Mar 2008 11:12:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Mar 2008 11:12:37 +0000 (UTC) Cc: M Jared Finder , emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 26 12:13:08 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 1JeTYy-0008Bf-Lf for ged-emacs-devel@m.gmane.org; Wed, 26 Mar 2008 12:13:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeTYN-0005ee-7t for ged-emacs-devel@m.gmane.org; Wed, 26 Mar 2008 07:12:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JeTXa-0005Jc-HJ for emacs-devel@gnu.org; Wed, 26 Mar 2008 07:11:34 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JeTXY-0005IW-Hn for emacs-devel@gnu.org; Wed, 26 Mar 2008 07:11:33 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JeTXY-0005IQ-1x for emacs-devel@gnu.org; Wed, 26 Mar 2008 07:11:32 -0400 Original-Received: from relay01.kiev.sovam.com ([62.64.120.200]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JeTXS-0003G6-TM; Wed, 26 Mar 2008 07:11:27 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay01.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JeTXJ-0009K5-9O; Wed, 26 Mar 2008 13:11:20 +0200 In-Reply-To: <851w5xx5ya.fsf@lola.goethe.zz> (David Kastrup's message of "Wed, 26 Mar 2008 09:09:01 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: f2683d8df775da069012ccac6e6e6321 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2455 [Mar 21 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 11 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.8-5.1 (or MacOS X 10.2-10.3) 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:93521 Archived-At: >> As an honest-to-god USER of Emacs, I want to say I completely agree >> with Kim, here. Since I discovered cua-mode, I've had the following >> code in my .emacs: >> >>> (let ((move-fns '(c-forward-conditional c-backward-conditional >>> c-down-conditional c-up-conditional >>> c-down-conditional-with-else >>> c-up-conditional-with-else >>> c-beginning-of-statement c-end-of-statement))) >>> (require 'cua-base) >>> (dolist (symbol move-fns) >>> (unless (eq 'move (get symbol 'CUA)) >>> (display-warning 'emacs (format "Adding CUA property to `%s'." symbol)) >>> (setf (get symbol 'CUA) 'move)))) >> >> All I have to do to make an existing command support shift-select is >> add its name to the list. (The move-fns list used to be a lot longer >> when I was using Emacs 21.) > > Changing a command's behavior after the thought can be dealt with by > using advice. > > Attaching properties is a can of worms that does not work for anonymous > functions. But an interactive code does not work when a spec is a Lisp expression that is not a string. So just as an interactive Lisp expression should call a special function `shift-translation-handler' explicitly, anonymous functions can call the same function as well (though it is not recommended to use anonymous functions for commands). So both these approaches are on a par in this regard. But using properties seems to be more preferable since there is a need to implement more related features like delete-selection-mode and inventing more funny interactive codes doesn't seem like a wise thing to do. The only problem I see is that properties currently are hard to discover. I think that just as `C-h f' describe-function displays information when the function is advised, we should change `C-h v' describe-variable to display information about attached variable properties as well. Also as Kim already noted supporting external packages using the interactive specification code approach would be a nightmare. So it seems it would be the best to go the way Kim suggested and just reimplement in C cua-selection-mode with properties that was proven by time and experience to be the right solution. -- Juri Linkov http://www.jurta.org/emacs/