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

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

RE: categorized list of EMACS LISP functions


From: Drew Adams
Subject: RE: categorized list of EMACS LISP functions
Date: Sun, 18 Nov 2007 11:54:10 -0800

> Hi, I'm writing my first functions for GNU EMACS.  I would like to
> find a categorized list of functions so that I
> can program cookbook style.  M-x apropos isn't enough.
>
> The categories should be something like:
>
> string handling functions...
> buffer handling functions...
> output functions...
> functions to query the user...
> conversion functions...
> file handling functions...
> etc...
>
> Surely someone has made such a list.  Where might I find it?

I don't know of such a list, but the suggestions others made regarding the
manual (Info) should help. In addition to that, perhaps some of the
following will help:

It is very often the case that existing Emacs-Lisp functions include the
types of the objects they manipulate in the function name. Often, the name
starts with the type of the target object: `buffer-live-p', `buffer-size',
`file-attributes', `file-readable-p', and so on. This means that you can use
`C-h f <type> TAB' with such a type name as prefix to see all such
functions.

Sometimes, the object type is part of the name, but it is not a prefix. If
you use Icicles, you can see all function names that contain the object type
as a substring, using `C-h f <type> S-TAB'. And you can type a regexp to
match, instead of a substring. And you can use multiple regexps or
substrings to match parts irrespective of order ("progressive completion",
`M-*'). And you can see the doc of each matching function name in turn by
repeating `C-M-next'. You can of course convert buffer *Completions* to a
list of the matching functions.

See also Icicles command `a' (alias `what-which-how'), which lets you
examine Emacs objects of a particular type (e.g. a buffer) and apply a
function to them. It also lets you manipulate variables whose values are
objects of a particular type - in particular, if you choose type
`functionp', then you can manipulate variables whose values are functions.

Another thing that might help you are the Icicles commands for matching
input against not only function names but doc strings as well: `icicle-doc',
`icicle-vardoc', `icicle-fundoc'.

* main entry and TOC:
http://www.emacswiki.org/cgi-bin/wiki/Icicles

* `a' command:
http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Object-Action_Interaction

* doc-string matching:
http://www.emacswiki.org/cgi-bin/wiki/Icicles_-_Multi-Completions

Probably none of this will help you a great deal with some of what you
request, however - for example, lists of functions to query the user,
conversion functions, or output functions. However, it might still help a
little there, since some output functions have `print' or `write' or `put'
as part of their name, and some query functions have `query' or `ask' or
`confirm' in their name, and some conversion functions have `convert' or
`transform' in their name. You will have to reflect a bit, to come up with
synonyms that might be used in function names.

In general, I think you'll need to do a bit of fishing to get what you want.

If you are indeed trying to write your first Emacs-Lisp functions, then I'd
say your best bet is to start by studying the manual "Emacs Lisp
Introduction". That will give you better understanding and help you form
good Lisp coding habits.

After that, if you want models of function definitions, dive into the Emacs
code itself, starting with `C-h f' and clicking on the library that defines
the function. Not all of the code represents the best coding practices, of
course, but much of it does, since it has been reworked by many programmers
over the years. Although the quality is variable, you can usually find a
good model of whatever you want.

HTH.





reply via email to

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