emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Info keybindings


From: Juri Linkov
Subject: Info keybindings
Date: Mon, 24 May 2004 12:55:35 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]