From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Info keybindings Date: Mon, 24 May 2004 12:55:35 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87n03yi1yg.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1085394833 31191 80.91.224.253 (24 May 2004 10:33:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 24 May 2004 10:33:53 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon May 24 12:33:44 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BSCm8-0004w1-00 for ; Mon, 24 May 2004 12:33:44 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BSCm8-000510-00 for ; Mon, 24 May 2004 12:33:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BSCkg-00066v-5b for emacs-devel@quimby.gnus.org; Mon, 24 May 2004 06:32:14 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BSCdq-00058r-A0 for emacs-devel@gnu.org; Mon, 24 May 2004 06:25:10 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BSCFV-0001R3-Ly for emacs-devel@gnu.org; Mon, 24 May 2004 06:00:33 -0400 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BSCFV-0001Qt-0O for emacs-devel@gnu.org; Mon, 24 May 2004 06:00:01 -0400 Original-Received: from mail.jurta.org (80-235-39-186-dsl.mus.estpak.ee [80.235.39.186]) by knife.dreamhost.com (Postfix) with ESMTP id 25844E410A for ; Mon, 24 May 2004 02:59:59 -0700 (PDT) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:23888 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:23888 Isn't `w' a better keybinding for `Info-copy-current-node-name'? I often type `w' in Info mode, switch buffers and type `C-y' to insert a copied Info node name, but then I finally realize that no Info node name was actually copied. The habit to type `w' to copy a name was formed by typing `w' in Dired mode where it is bound to `dired-copy-filename-as-kill'. Having two similar commands bound to different keys is too inconsistent. Perhaps it's not too late to change keybindings because no Emacs release was made with `c' keybinding yet. And by analogy with Dired mode `M-0 w' could copy something more, for example, a whole command to find an Info node, e.g. (info "(emacs)Top") which serves as a link in all modes by typing `C-x C-e' on it. `Info-copy-current-node-name' could also confirm that something was actually copied into the kill ring by displaying a copied text in the echo area like Dired already does that. Index: lisp/info.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/info.el,v retrieving revision 1.395 diff -u -r1.395 info.el --- lisp/info.el 23 May 2004 20:53:42 -0000 1.395 +++ lisp/info.el 24 May 2004 06:43:34 -0000 @@ -2758,7 +2758,6 @@ (define-key Info-mode-map "<" 'Info-top-node) (define-key Info-mode-map ">" 'Info-final-node) (define-key Info-mode-map "b" 'beginning-of-buffer) - (define-key Info-mode-map "c" 'Info-copy-current-node-name) (define-key Info-mode-map "d" 'Info-directory) (define-key Info-mode-map "e" 'Info-edit) (define-key Info-mode-map "f" 'Info-follow-reference) @@ -2776,6 +2775,7 @@ (define-key Info-mode-map "\M-n" 'clone-buffer) (define-key Info-mode-map "t" 'Info-top-node) (define-key Info-mode-map "u" 'Info-up) + (define-key Info-mode-map "w" 'Info-copy-current-node-name) (define-key Info-mode-map "," 'Info-index-next) (define-key Info-mode-map "\177" 'Info-scroll-down) (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node) @@ -2920,20 +2920,23 @@ (error (ding)))) -(defun Info-copy-current-node-name () +(defun Info-copy-current-node-name (&optional arg) "Put the name of the current info node into the kill ring. -The name of the info file is prepended to the node name in parentheses." - (interactive) +The name of the info file is prepended to the node name in parentheses. +With a zero prefix arg, put the name inside a function call to `info'." + (interactive "P") (unless Info-current-node (error "No current info node")) - (kill-new - (concat "(" - (file-name-nondirectory - (if (stringp Info-current-file) - Info-current-file - (or buffer-file-name ""))) - ")" - Info-current-node))) + (let ((node (concat "(" (file-name-nondirectory + (or (and (stringp Info-current-file) + Info-current-file) + buffer-file-name + "")) + ")" Info-current-node))) + (if (zerop (prefix-numeric-value arg)) + (setq node (concat "(info \"" node "\")"))) + (kill-new node) + (message "%s" node))) ;; Info mode is suitable only for specially formatted data. -- Juri Linkov http://www.jurta.org/emacs/