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

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

RE: Can I build a dictionary in my Emacs?


From: Drew Adams
Subject: RE: Can I build a dictionary in my Emacs?
Date: Thu, 3 Dec 2009 10:22:01 -0800

> > I want to build a dictionary in my Emacs. So I can put my specific
> > words, expressions and their meanings into it.
> 
> Why not just use a plain text file, with one definition per line.
> Set it up with (setq word-wrap t) and (setq wrap-prefix "    ").
> Then just search with C-s and add definitions in the obvious way.

1. I second that. If this is for your own personal use and you don't expect to
have a large number of definitions, then this is a great way to go. It has the
advantages of simplicity, easy update, and variety of access/navigation methods.


2. If you will have lots of definitions or you want to create a dictionary for
others to use, then you might also want to look at the Emacs tags feature. A tag
is essentially just a definition. A tag file is an index to definitions.

Tags do not have to be definitions, but they typically are. The definitions are
typically code definitions (of function, variables, etc.), but they don't have
to be.

The advantages of using Emacs tags for definitions are (a) distribution: the
definitions can be scattered over any number of files and directories, and (b)
performance. The disadvantage is that you will need to create (and
maintain/update) the TAGS file, either by hand or by writing some code to do
that.
http://www.emacswiki.org/emacs/EmacsTags
http://www.gnu.org/software/emacs/manual/html_node/emacs/Tags.html#Tags


3. You might also consider using Imenu. In a way, this is halfway between #1 and
#2. Imenu parses a buffer, collecting the positions of any definitions contained
in it, and then it presents those definitions to users in a menu (or via
completion etc.). Again, the definitions are typically code definitions (of
functions, variables, etc.), but they do not have to be.

To use Imenu, you will need to come up with a regexp that recognizes a
definition, which means that you need to decide on a definition format. E.g.
`DEFINITION foo = ...' with a regexp that looks for "DEFINITION" followed by the
defined term followed by " = ". Or some such. The regexp variable to set is
`imenu-generic-expression'.
http://www.emacswiki.org/emacs/ImenuMode
http://www.gnu.org/software/emacs/manual/html_node/emacs/Imenu.html#Imenu


4. I don't think this is what you want, but I mention it anyway: Library
`synonyms.el' provides a navigable thesaurus. It uses a (large) file that
defines classes of English synonyms. You can use it to navigate among synonyms
in various ways. Dunno if a similar approach would be feasible for a dictionary.
http://www.emacswiki.org/emacs/Synonyms





reply via email to

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