From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Tennant Newsgroups: gmane.emacs.help Subject: Re: Opening an info page by command name, take 2 Date: Thu, 13 Dec 2007 12:56:43 +0200 Message-ID: <87fxy6dfro.fsf@moley.moleskin.org> References: <840625.36398.qm@web25412.mail.ukl.yahoo.com> <877ijj9d12.fsf@escher.local.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1197544009 2073 80.91.229.12 (13 Dec 2007 11:06:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Dec 2007 11:06:49 +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 12:07:01 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 1J2lu8-0002QA-2s for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Dec 2007 12:07:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2ltp-00035j-92 for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Dec 2007 06:06:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J2lke-0000Kk-IM for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 05:57:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J2lkb-0000Jz-44 for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 05:57:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2lka-0000Jc-7b for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 05:57:08 -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 1J2lkZ-0008Gx-Is for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 05:57:07 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1J2lkL-0007RQ-GP for help-gnu-emacs@gnu.org; Thu, 13 Dec 2007 10:56:57 +0000 Original-Received: from 85.105.17.65 ([85.105.17.65]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Dec 2007 10:56:53 +0000 Original-Received: from sebyte by 85.105.17.65 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Dec 2007 10:56:53 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 85.105.17.65 User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:FsbDnc+EhYKudzLtWCAi85sIoms= 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:50062 Archived-At: Quoth Stephen Berman : > 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))) A handy function that provides completion on a sensible subset of the files actually found in the info directory, but the OP was interested in opening info (in emacs) directly from the command line. Sebastian