From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Opening an info page by command name, take 2 Date: Thu, 13 Dec 2007 10:09:29 +0100 Message-ID: <877ijj9d12.fsf@escher.local.home> References: <840625.36398.qm@web25412.mail.ukl.yahoo.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1197537042 12727 80.91.229.12 (13 Dec 2007 09:10:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Dec 2007 09:10:42 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 13 10:10:53 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J2k5c-0006vG-7O for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Dec 2007 10:10:44 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2k5J-0002lK-Tq for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Dec 2007 04:10:25 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J2k4y-0002fz-QP for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 04:10:04 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J2k4t-0002Zd-IC for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 04:10:04 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2k4t-0002ZM-6i for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 04:09:59 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J2k4s-0003JQ-OR for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 04:09:58 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1J2k4h-0005bX-Vy for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 09:09:48 +0000 Original-Received: from i5387d1a8.versanet.de ([83.135.209.168]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Dec 2007 09:09:47 +0000 Original-Received: from Stephen.Berman by i5387d1a8.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Dec 2007 09:09:47 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 55 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: i5387d1a8.versanet.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50058 Archived-At: On Tue, 11 Dec 2007 21:49:59 +0100 (CET) wrote: > Hi all: > > I recently posted in this list about opening an Info page in emacs by > command name, and I did get some replies, thanks a lot. > > Unfortunately, I'm still missing one piece of the equation: how do I > know the Info page name beforehand? > > Say I want to get help about grep and also about gzip. With man I would > just type "man grep" and "man gzip". From the command line I can type > "info grep" and "info gzip" and get similar pages. With emacs, if I > only now the words "grep" and "gzip", I cannot open those pages. > > For example, these are two suggestions I got on my last post: > > emacs -Q --eval '(info "(bash3ref)Arrays")' > > emacsclientw -e "(info \"(elisp) Lists\")" > > The question is, where did "(bash3ref)Arrays" and "(elisp) Lists" come > from? You would have to browse the Info pages beforehand, wouldn't you? > But that defeats the purpose. I would want to call some (info "bash") > routine and get the same page as with "info bash" from the command > line, but the info routine in emacs does not find the same page, it > doesn't find anything under "bash" or "grep" or "gzip" alone. Here's something that may help you. (defun srb-info () "Enter Info at the Info file the user chooses, tabbing for completion. If you type parentheses around the Info file name and then type a node name, e.g. `(emacs)Buffers', then Info enters the file at that node (completion for nodes below the file level is not provided)." (interactive) (require 'info) (let (files idx info-files info-file) (dolist (d Info-default-directory-list files) (when (file-readable-p d) (setq files (cons (directory-files d) files)))) (setq files (append (car files) (cadr files))) (dolist (f files) (setq idx (string-match "\\." f)) (setq info-files (cons (substring f 0 idx) info-files))) (dolist (f info-files) (when (string-match "-[1-9][0-9]?$" f) (setq info-files (delete f info-files)))) (setq info-file (completing-read "Info file name: " info-files)) (unless (string-match "^\([^ ]+\)" info-file) (setq info-file (concat "(" info-file ")"))) (Info-goto-node info-file))) Steve Berman