all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org, karl@freefriends.org
Subject: Re: Documentation for "Clone Buffers" (corrected version)
Date: Sun, 25 Apr 2004 07:32:09 +0300	[thread overview]
Message-ID: <873c6sogur.fsf@mail.jurta.org> (raw)
In-Reply-To: <87vflafi4g.fsf@emptyhost.emptydomain.de> (Kai Grossjohann's message of "Fri, 12 Mar 2004 11:57:03 +0100")

Kai Grossjohann <kai@emptydomain.de> writes:
> Alex Schroeder <alex@emacswiki.org> writes:
>> Heh.  :)  Many have complained about similar functionality in M-x
>> shell, for example (and written code where M-x shell starts *another*
>> shell instead of switching to the existing shell buffer).
>
> On a tangent, I like fshell.el which has functionality not provided by
> M-x shell RET plus clone-buffer:
>
> C-u 42 M-x fshell RET goes to the *shell*<42> buffer, creating it if
> it doesn't exist, yet.
>
> For some reason or other, I like this much better than using some
> switch-to-buffer interface for selecting the right buffer.

This is a very good idea!  How about the following implementation?
It works by appending the numeric prefix argument to the *info*
buffer name:

C-u 15 C-h i goes to the *info*<15> buffer, creating it
             with the top-level Info directory if it doesn't exist.

I think that adding this feature will make the FORK argument obsolete
because with the FORK argument a forked Info buffer contains the name
of the target node which is too misleading when the user goes to
another Info node in the same Info buffer.  OTOH, the naming scheme
with the numeric suffix is more convenient: the user has three choices
to create a new Info buffer by adding a number to its name:

1. clone the Info buffer by M-n;
2. rename the Info buffer by rename-uniquely;
3. create a new Info buffer by giving the numeric prefix argument to C-h i

And in all cases jumping to the existing Info buffer is the same:
by giving the numeric prefix argument to C-h i with the number in
the existing buffer name.

Index: lisp/info.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/info.el,v
retrieving revision 1.390
diff -u -r1.390 info.el
--- lisp/info.el	22 Apr 2004 19:49:11 -0000	1.390
+++ lisp/info.el	25 Apr 2004 03:17:16 -0000
@@ -449,28 +450,38 @@
   "Like `info' but show the Info buffer in another window."
   (interactive (if current-prefix-arg
 		   (list (read-file-name "Info file name: " nil nil t))))
-  (let (same-window-buffer-names)
+  (let (same-window-buffer-names same-window-regexps)
     (info file)))
 
-;;;###autoload (add-hook 'same-window-buffer-names "*info*")
+;;;###autoload (add-hook 'same-window-regexps "\\*info\\*\\(\\|<[0-9]+>\\)")
 
 ;;;###autoload
-(defun info (&optional file)
+(defun info (&optional file buffer)
   "Enter Info, the documentation browser.
 Optional argument FILE specifies the file to examine;
 the default is the top-level directory of Info.
 Called from a program, FILE may specify an Info node of the form
 `(FILENAME)NODENAME'.
-
-In interactive use, a prefix argument directs this command
-to read a file name from the minibuffer.
+Optional argument BUFFER specifies the Info buffer name;
+the default buffer name is *info*.  If BUFFER exists,
+just switch to BUFFER.  Otherwise, create a new buffer
+with the top-level Info directory.
+
+In interactive use, a non-numeric prefix argument directs
+this command to read a file name from the minibuffer.
+A numeric prefix argument appends the number to the buffer name.
 
 The search path for Info files is in the variable `Info-directory-list'.
 The top-level Info directory is made by combining all the files named `dir'
 in all the directories in that path."
-  (interactive (if current-prefix-arg
-		   (list (read-file-name "Info file name: " nil nil t))))
-  (pop-to-buffer "*info*")
+  (interactive (list
+                (if (and current-prefix-arg (not (numberp current-prefix-arg)))
+                    (read-file-name "Info file name: " nil nil t))
+                (if (numberp current-prefix-arg)
+                    (format "*info*<%s>" current-prefix-arg))))
+  (pop-to-buffer (or buffer "*info*"))
+  (if (and buffer (not (eq major-mode 'Info-mode)))
+      (Info-mode))
   (if file
       ;; If argument already contains parentheses, don't add another set
       ;; since the argument will then be parsed improperly.  This also

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

  reply	other threads:[~2004-04-25  4:32 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1Ax1Br-0005C3-OL@fencepost.gnu.org>
2004-03-05 10:05 ` Documentation for "Clone Buffers" (corrected version) Alan Mackenzie
2004-03-09 15:40   ` David Kastrup
2004-03-10 11:29     ` Alan Mackenzie
2004-03-12  5:12       ` Luc Teirlinck
2004-03-12 16:34         ` Karl Berry
2004-03-14  2:32           ` Luc Teirlinck
2004-03-14  7:36             ` Eli Zaretskii
2004-03-14 18:17               ` Luc Teirlinck
2004-03-14 18:24                 ` Eli Zaretskii
2004-03-14 18:37                   ` Luc Teirlinck
2004-03-14 19:58                 ` Karl Berry
2004-03-15  3:14                   ` Luc Teirlinck
2004-03-15  6:46                     ` Eli Zaretskii
2004-03-15 23:35                       ` Luc Teirlinck
2004-03-16  5:37                         ` Eli Zaretskii
2004-03-15 23:41                       ` Luc Teirlinck
2004-03-16 12:09                   ` Richard Stallman
2004-03-14 13:39             ` Karl Berry
2004-03-14 16:57               ` Eli Zaretskii
2004-03-15  4:57             ` Richard Stallman
2004-03-12  5:22       ` Luc Teirlinck
2004-03-12  1:24     ` Luc Teirlinck
2004-03-15  5:05       ` Juri Linkov
2004-03-15 13:27         ` Stefan Monnier
2004-03-15 17:06           ` Miles Bader
2004-03-15 17:08           ` David Kastrup
2004-03-16  7:02           ` Juri Linkov
2004-03-12  2:45     ` Miles Bader
2004-03-09 23:40   ` Alex Schroeder
2004-03-12 10:57     ` Kai Grossjohann
2004-04-25  4:32       ` Juri Linkov [this message]
2004-04-25 13:37         ` Karl Berry
2004-06-17 16:33         ` C-h C-i Juri Linkov
2004-06-17 10:29           ` Karl Fogel
2004-06-18  7:16             ` Juri Linkov
2004-06-18  8:18               ` Karl Fogel
2004-06-18 14:55                 ` Juri Linkov
2004-06-18 12:33                   ` Karl Fogel
2004-06-18 19:00                     ` Juri Linkov
2004-06-19  3:19               ` Richard Stallman
2004-06-19  0:19                 ` Karl Fogel
2004-06-20  0:42                   ` Juanma Barranquero
2004-06-20  1:17                     ` Miles Bader
2004-06-20  1:29                       ` Juanma Barranquero
2004-06-20  1:51                         ` One possible bug-tracking system Karl Fogel
2004-06-20 13:23                           ` Alex Schroeder
2004-06-20 12:42                             ` Karl Fogel
2004-06-20 19:39                               ` Luc Teirlinck
2004-06-20 13:38                                 ` Karl Fogel
2004-06-21  9:31                                   ` Richard Stallman
2004-06-21  9:41                                     ` Juanma Barranquero
2004-06-22 23:17                                       ` Richard Stallman
2004-06-21 12:02                                     ` Arne Jørgensen
2004-06-22 23:16                                       ` Richard Stallman
2004-06-21 18:26                                     ` Karl Fogel
2004-06-21 22:28                                       ` Juri Linkov
2004-06-22  2:00                                       ` Marcelo Toledo
2004-06-22 23:17                                       ` Richard Stallman
2004-06-20 19:18                   ` C-h C-i Richard Stallman
2004-06-20 20:47                     ` Luc Teirlinck
2004-06-20 23:15                       ` Juri Linkov
2004-06-20 23:37                         ` Luc Teirlinck
2004-06-22  2:49                         ` Richard Stallman
2004-06-22  2:48                       ` Richard Stallman
2004-06-21  5:20                     ` Eli Zaretskii
2004-06-22  2:49                       ` Richard Stallman
2004-06-22  5:20                         ` Eli Zaretskii
2004-06-26 10:41                         ` Eli Zaretskii
2004-06-22  2:04                     ` Luc Teirlinck
2004-06-22 23:17                       ` Richard Stallman
2004-06-18 21:51           ` Richard Stallman
2004-03-14 21:55     ` Documentation for "Clone Buffers" (corrected version) Stefan Monnier
2004-03-16 12:09       ` Richard Stallman
2004-03-15  6:28     ` Juri Linkov
2004-03-16 19:03       ` Richard Stallman
2004-03-10  3:37   ` Miles Bader
2004-03-10 18:45   ` Richard Stallman
2004-03-10 18:45   ` Richard Stallman
2004-03-11 14:55     ` Alan Mackenzie
2004-03-14  5:53       ` Eli Zaretskii
2004-03-14  9:48         ` David Kastrup
2004-03-14 16:50           ` Eli Zaretskii
2004-03-16 12:09             ` Richard Stallman
2004-03-15 18:18           ` Matthew Mundell
2004-03-15  5:18         ` Juri Linkov
2004-03-15  6:52           ` Eli Zaretskii
2004-03-15 13:34             ` Stefan Monnier
2004-03-15 14:35               ` Luc Teirlinck
2004-03-15 20:03                 ` Eli Zaretskii
2004-03-15 20:40                   ` Luc Teirlinck
2004-03-15 19:55               ` Eli Zaretskii
2004-03-16 19:02               ` Richard Stallman
2004-03-16  7:05             ` Juri Linkov
2004-03-16 19:43               ` Eli Zaretskii
2004-03-18  7:21                 ` Juri Linkov
2004-03-19  5:01                 ` Richard Stallman
2004-03-18 18:37               ` Karl Berry
2004-03-18 18:53                 ` Stefan Monnier
2004-03-19 14:11                   ` Karl Berry
2004-03-19 17:13                     ` Stefan Monnier
2004-03-21  4:58                       ` Richard Stallman
2004-03-19 14:59                   ` Eli Zaretskii
2004-03-19 17:31                     ` Stefan Monnier
2004-03-19 17:47                       ` Karl Berry
2004-03-20 14:04                         ` Eli Zaretskii
2004-03-21  5:00                           ` Richard Stallman
2004-03-21  6:19                             ` Eli Zaretskii
2004-03-22  5:24                               ` Richard Stallman
2004-03-22  6:40                                 ` Eli Zaretskii
2004-03-22  5:24                               ` Richard Stallman
2004-03-22  6:33                                 ` Eli Zaretskii
2004-03-23  3:04                                   ` Richard Stallman
2004-03-21 17:18                             ` Karl Berry
2004-03-22  5:25                               ` Richard Stallman
2004-03-22  7:26                                 ` Eli Zaretskii
2004-03-23  3:04                                   ` Richard Stallman
2004-03-23  3:04                                   ` Richard Stallman
2004-03-23  6:10                                     ` Eli Zaretskii
2004-03-24  5:34                                       ` Richard Stallman
2004-03-22 16:13                           ` Stefan Monnier
2004-03-22 16:10                         ` Stefan Monnier
2004-03-23  0:20                           ` Kim F. Storm
2004-03-23  2:26                             ` Stefan Monnier
2004-03-23  6:19                               ` Eli Zaretskii
2004-03-20 14:37                       ` Eli Zaretskii
2004-03-20 18:01                   ` Richard Stallman
2004-03-19 15:01                 ` Eli Zaretskii
2004-03-19 15:15                   ` Karl Berry
2004-03-20 14:07                     ` Eli Zaretskii
2004-03-20 14:15                       ` Karl Berry
2004-03-20 15:15                         ` Eli Zaretskii
2004-03-20 19:27                           ` Miles Bader
2004-03-21  5:55                             ` Eli Zaretskii
2004-03-22  5:25                               ` Richard Stallman
2004-03-22  6:12                                 ` Eli Zaretskii
2004-03-21  5:00                           ` Richard Stallman
2004-03-21  6:28                             ` Eli Zaretskii
2004-03-20 18:01                 ` Richard Stallman
2004-03-21  5:51                   ` Eli Zaretskii
2004-03-22  5:25                     ` Richard Stallman
2004-03-22  6:29                       ` Eli Zaretskii
2004-03-15  4:56       ` Richard Stallman
2004-03-10 18:45   ` Richard Stallman
2004-02-25 10:15 Alan Mackenzie

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

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

  git send-email \
    --in-reply-to=873c6sogur.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=karl@freefriends.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.