From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Suggestion: Simple way to make conditional key bindings. Date: Mon, 26 Aug 2002 12:21:18 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200208261621.g7QGLIE25159@rum.cs.yale.edu> References: <5x4rdlbx1i.fsf@kfs2.cua.dk> <200208260036.g7Q0aSR12388@wijiji.santafe.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1030379771 22425 127.0.0.1 (26 Aug 2002 16:36:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 26 Aug 2002 16:36:11 +0000 (UTC) Cc: storm@cua.dk, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17jMqY-0005pT-00 for ; Mon, 26 Aug 2002 18:36:10 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17jNLR-0008Ml-00 for ; Mon, 26 Aug 2002 19:08:06 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17jMrq-0007hl-00; Mon, 26 Aug 2002 12:37:30 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17jMcH-0005Fs-00 for emacs-devel@gnu.org; Mon, 26 Aug 2002 12:21:25 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17jMcC-0005FM-00 for emacs-devel@gnu.org; Mon, 26 Aug 2002 12:21:22 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17jMcB-0005FD-00; Mon, 26 Aug 2002 12:21:19 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g7QGLIE25159; Mon, 26 Aug 2002 12:21:18 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Richard Stallman Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:6922 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6922 > One advantage (IMO) is that C-h k C-y will report yank or > yank-with-properties depending on the actual function taken if > you hit C-y. > > If we use menu-item, what will C-h c say? Same thing (it runs the filter). > (define-key global-map "\C-y" 'yank-careful) > (defun yank-careful (...) > "Reinsert the last stretch of killed text, like `yank'. > Contrary to `yank' this function is careful to preserve some important > text properties when yanking tables." > ...) > > The advantage is that C-h k C-y doesn't just give you one of the two > bindings but a docstring that describes both. > > I think that sometimes this will be better, but sometimes it will be > better for C-h k to give the doc string for the specific command > that will be executed. Agreed. But in the example he gave I think that a docstring that describes the range of behavior rather than the specific command is better, because you can't expect the user to know that the current string is "special". I think that whether the docstring should cover all the possible behaviors or just the specific current one depends on how what the behavior depends on: if it's very implicit and/or changes often the first is preferable. This is the case for his example. OTOH if it's explicit and/or doesn't change often, then the latter is preferable. This is the case (and the current behavior) for minor modes. Stefan