all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Opening an info page by command name, take 2
@ 2007-12-11 20:49 rdiezmail-emacs
  2007-12-11 21:30 ` Sebastian Tennant
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: rdiezmail-emacs @ 2007-12-11 20:49 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Thanks again,
  Ruben





        __________________________________  Ihr erstes Baby? Holen Sie sich Tipps von anderen Eltern.  www.yahoo.de/clever

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-11 20:49 Opening an info page by command name, take 2 rdiezmail-emacs
@ 2007-12-11 21:30 ` Sebastian Tennant
  2007-12-11 21:48   ` Lennart Borgman (gmail)
  2007-12-12  4:12 ` Eli Zaretskii
  2007-12-13  9:09 ` Stephen Berman
  2 siblings, 1 reply; 10+ messages in thread
From: Sebastian Tennant @ 2007-12-11 21:30 UTC (permalink / raw)
  To: help-gnu-emacs

Quoth <rdiezmail-emacs@yahoo.de>:
> 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.

You have to know the names of your info files.  On Debian systems they
live in /usr/shre/info:

 $ ls /usr/share/info/*.info.gz
 /usr/share/info/autosprintf.info.gz
 /usr/share/info/bash3ref.info.gz
 /usr/share/info/bbdb.info.gz
 /usr/share/info/bzip2.info.gz
 /usr/share/info/coreutils.info.gz
 /usr/share/info/cpio.info.gz
 /usr/share/info/cvs.info.gz
 /usr/share/info/cvsclient.info.gz
 /usr/share/info/dc.info.gz
 /usr/share/info/ed.info.gz
 /usr/share/info/emacs-w3m-ja.info.gz
 /usr/share/info/emacs-w3m.info.gz
 /usr/share/info/fastjar.info.gz
 /usr/share/info/find.info.gz
 /usr/share/info/gettext.info.gz
 /usr/share/info/gnutls.info.gz
 /usr/share/info/gzip.info.gz
 /usr/share/info/history.info.gz
 /usr/share/info/ipc.info.gz
 /usr/share/info/ispell.info.gz
 /usr/share/info/jabber.info.gz
 /usr/share/info/m4.info.gz
 /usr/share/info/menu.info.gz
 /usr/share/info/mikmod.info.gz
 /usr/share/info/mtools.info.gz
 /usr/share/info/nano.info.gz
 /usr/share/info/nxml-mode.info.gz
 /usr/share/info/readline.info.gz
 /usr/share/info/recode.info.gz
 /usr/share/info/rluserman.info.gz
 /usr/share/info/sed.info.gz
 /usr/share/info/sharutils.info.gz
 /usr/share/info/time.info.gz
 /usr/share/info/wget.info.gz

The format of the info function is:

 (info "(<filename>)<name-of-node>")

You don't need to know the name of a particular node but you do need
to know the name of the info file, i.e.,

  $ emacs -Q --eval '(info "(bash3ref)")'

is OK.

Sebastian.

P.S.  I've just noticed that the above command only works with the long
      option (--eval) and not with the short option '-e'.  Is this a
      feature I was unaware of, anyone?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-11 21:30 ` Sebastian Tennant
@ 2007-12-11 21:48   ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 10+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-11 21:48 UTC (permalink / raw)
  To: Sebastian Tennant; +Cc: help-gnu-emacs

Sebastian Tennant wrote:

> P.S.  I've just noticed that the above command only works with the long
>       option (--eval) and not with the short option '-e'.  Is this a
>       feature I was unaware of, anyone?


I think -e is only for emacsclient.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
       [not found] <mailman.4893.1197406212.18990.help-gnu-emacs@gnu.org>
@ 2007-12-11 23:09 ` David Kastrup
  2007-12-12 17:11   ` Harald Hanche-Olsen
  2007-12-13 11:16 ` 方旭亮
  1 sibling, 1 reply; 10+ messages in thread
From: David Kastrup @ 2007-12-11 23:09 UTC (permalink / raw)
  To: help-gnu-emacs

<rdiezmail-emacs@yahoo.de> writes:

> 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.

M-: (info "(bash)") RET

The parens around (bash) are necessary.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-11 20:49 Opening an info page by command name, take 2 rdiezmail-emacs
  2007-12-11 21:30 ` Sebastian Tennant
@ 2007-12-12  4:12 ` Eli Zaretskii
  2007-12-13  9:09 ` Stephen Berman
  2 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2007-12-12  4:12 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 11 Dec 2007 21:49:59 +0100 (CET)
> From: <rdiezmail-emacs@yahoo.de>
> 
> 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.

Yes, you can, as others have shown.

In addition, there's "M-x info-apropos", for those situations where
you don't even know the name of the program/package in whose manual
you will find the topic you want to read about.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-11 23:09 ` David Kastrup
@ 2007-12-12 17:11   ` Harald Hanche-Olsen
  0 siblings, 0 replies; 10+ messages in thread
From: Harald Hanche-Olsen @ 2007-12-12 17:11 UTC (permalink / raw)
  To: help-gnu-emacs

+ David Kastrup <dak@gnu.org>:

> M-: (info "(bash)") RET

or:  C-h i g (bash) RET


-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-11 20:49 Opening an info page by command name, take 2 rdiezmail-emacs
  2007-12-11 21:30 ` Sebastian Tennant
  2007-12-12  4:12 ` Eli Zaretskii
@ 2007-12-13  9:09 ` Stephen Berman
  2007-12-13 10:56   ` Sebastian Tennant
  2 siblings, 1 reply; 10+ messages in thread
From: Stephen Berman @ 2007-12-13  9:09 UTC (permalink / raw)
  To: help-gnu-emacs

On Tue, 11 Dec 2007 21:49:59 +0100 (CET) <rdiezmail-emacs@yahoo.de> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-13  9:09 ` Stephen Berman
@ 2007-12-13 10:56   ` Sebastian Tennant
  2007-12-13 12:34     ` Stephen Berman
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Tennant @ 2007-12-13 10:56 UTC (permalink / raw)
  To: help-gnu-emacs

Quoth Stephen Berman <Stephen.Berman@gmx.net>:
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
       [not found] <mailman.4893.1197406212.18990.help-gnu-emacs@gnu.org>
  2007-12-11 23:09 ` David Kastrup
@ 2007-12-13 11:16 ` 方旭亮
  1 sibling, 0 replies; 10+ messages in thread
From: 方旭亮 @ 2007-12-13 11:16 UTC (permalink / raw)
  To: help-gnu-emacs

  info page?

-- 

                                                            方旭亮
 
#  
#  浙江大学玉泉校区1455信箱教十一201工程与科学计算中心 
#  MSN:fxlzju@gmail.com
#  My Blog: http://fxl.blogbus.com
#  Tel: +86-571-87953165
#

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Opening an info page by command name, take 2
  2007-12-13 10:56   ` Sebastian Tennant
@ 2007-12-13 12:34     ` Stephen Berman
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Berman @ 2007-12-13 12:34 UTC (permalink / raw)
  To: help-gnu-emacs

On Thu, 13 Dec 2007 12:56:43 +0200 Sebastian Tennant <sebyte@smolny.plus.com> wrote:

> Quoth Stephen Berman <Stephen.Berman@gmx.net>:
>> Here's something that may help you.
>>
>> (defun srb-info ()
[...]
> 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.

Put the defun followed by its invocation (i.e., (srb-info) in a file
srb-info.el and make the following shell script (call it e.g. srb-info):

------------8<------------
#!/bin/sh

emacs -Q -l "/path/to/srb-info.el"
------------>8------------

Steve Berman

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-12-13 12:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-11 20:49 Opening an info page by command name, take 2 rdiezmail-emacs
2007-12-11 21:30 ` Sebastian Tennant
2007-12-11 21:48   ` Lennart Borgman (gmail)
2007-12-12  4:12 ` Eli Zaretskii
2007-12-13  9:09 ` Stephen Berman
2007-12-13 10:56   ` Sebastian Tennant
2007-12-13 12:34     ` Stephen Berman
     [not found] <mailman.4893.1197406212.18990.help-gnu-emacs@gnu.org>
2007-12-11 23:09 ` David Kastrup
2007-12-12 17:11   ` Harald Hanche-Olsen
2007-12-13 11:16 ` 方旭亮

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.