delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/25/04:25:11

Date: Mon, 25 Aug 1997 11:23:45 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Paul Derbyshire <ao950 AT FreeNet DOT Carleton DOT CA>
cc: djgpp AT delorie DOT com
Subject: Re: Syntax-help in emacs
In-Reply-To: <5tp1q6$rv9@freenet-news.carleton.ca>
Message-ID: <Pine.SUN.3.91.970825112239.2897E-100000@is>
MIME-Version: 1.0

On 24 Aug 1997, Paul Derbyshire wrote:

> Is there a way to twiddle the .emacs file to get, say, ctrl-f1 to look up
> the word under the point in the info files? i.e., so if the cursor is on
> printf, it finds there's a node printf, in the libc .inf files.

With Emacs, the question isn't whether there *is* a way--of course
there is--but *how* ;-).

The following is courtesy of John Aldrich.  Put it somewhere in your
_emacs:

;;; Automatic online help for library functions
(autoload 'find-tag-tag "etags")
(autoload 'Info-find-node "info")
(defun libc-help (arg)
  (interactive (list (find-tag-tag "C library topic: ")))
  (Info-find-node "libc" arg))
(define-key c-mode-map [C-f1] 'libc-help)

It prompts with the word at point as the default.  Press RET if that's
what you want, or type another function name and press RET.

A simple addition to this will show the help in another window; this
is left as an excercise to the interested readers ;-).

> I checked the emacs FAQ but couldn't find anything referring to
> contect-sensitive or syntax help. I also looked through the command lists
> under emacs and cc-mode, nothing there,

Unix people have man pages installed, so they just type "Alt-x man
RET" and get the man page for the function at point.  That's why they
didn't worry about this.

> there are some info-this-that
> commands for elisp functions, but none for c, c++ etc functions, nor any
> obvious way to feed it the word under the point...

If you want to program in ELisp, I suggest to get the Emacs Lisp
reference (elisp-manual-NN.MM.tar.gz from GNU ftp sites).  You don't
need to read it in its entirety (it's HUGE), but searching through it
always helps me find what I want.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019