unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Subject: Info keybindings
Date: Mon, 24 May 2004 12:55:35 +0300	[thread overview]
Message-ID: <87n03yi1yg.fsf@mail.jurta.org> (raw)

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))))
 
 \f
-(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)))
 
 \f
 ;; Info mode is suitable only for specially formatted data.

-- 
Juri Linkov
http://www.jurta.org/emacs/

             reply	other threads:[~2004-05-24  9:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-24  9:55 Juri Linkov [this message]
2004-05-24 17:35 ` Info keybindings Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87n03yi1yg.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).