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: Re: Documentation for "Clone Buffers" (corrected version) Date: Sun, 25 Apr 2004 07:32:09 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <873c6sogur.fsf@mail.jurta.org> References: <877jxty4gg.fsf@emacswiki.org> <87vflafi4g.fsf@emptyhost.emptydomain.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1082868270 9948 80.91.224.253 (25 Apr 2004 04:44:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Apr 2004 04:44:30 +0000 (UTC) Cc: emacs-devel@gnu.org, karl@freefriends.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Apr 25 06:44:20 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 1BHbV6-0005qA-00 for ; Sun, 25 Apr 2004 06:44:20 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BHbV4-00012q-01 for ; Sun, 25 Apr 2004 06:44:18 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BHbOR-0000VN-LW for emacs-devel@quimby.gnus.org; Sun, 25 Apr 2004 00:37:27 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BHbNy-0000Un-J5 for emacs-devel@gnu.org; Sun, 25 Apr 2004 00:36:58 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BHbNS-0000Qq-J3 for emacs-devel@gnu.org; Sun, 25 Apr 2004 00:36:57 -0400 Original-Received: from [66.33.219.6] (helo=knife.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BHbNS-0000Pf-1T for emacs-devel@gnu.org; Sun, 25 Apr 2004 00:36:26 -0400 Original-Received: from mail.jurta.org (80-235-32-196-dsl.mus.estpak.ee [80.235.32.196]) by knife.dreamhost.com (Postfix) with ESMTP id AD6C9E4052; Sat, 24 Apr 2004 21:36:22 -0700 (PDT) Original-To: Kai Grossjohann In-Reply-To: <87vflafi4g.fsf@emptyhost.emptydomain.de> (Kai Grossjohann's message of "Fri, 12 Mar 2004 11:57:03 +0100") 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:22118 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22118 Kai Grossjohann writes: > Alex Schroeder 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/