help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening an info page by command name, take 2


From: Sebastian Tennant
Subject: Re: Opening an info page by command name, take 2
Date: Thu, 13 Dec 2007 12:56:43 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Quoth Stephen Berman <address@hidden>:
> 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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]