unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <help-gnu-emacs@gnu.org>
Subject: RE: Can I build a dictionary in my Emacs?
Date: Thu, 3 Dec 2009 10:22:01 -0800	[thread overview]
Message-ID: <7C74616E923245BE8B95D9035BF91966@us.oracle.com> (raw)
In-Reply-To: <jwvpr738i29.fsf-monnier+gnu.emacs.help@gnu.org>

> > 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	other threads:[~2009-12-03 18:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  3:12 Can I build a dictionary in my Emacs? Water Lin
2009-11-26 11:00 ` Pascal J. Bourguignon
2009-11-26 11:54   ` Lennart Borgman
2009-11-26 22:14 ` Tim X
2009-11-27  8:32   ` Water Lin
2009-11-27 11:37   ` Colin S. Miller
2009-11-27 22:50     ` Tim X
2009-11-28  3:07 ` Stefan Monnier
2009-12-03 18:22   ` Drew Adams [this message]
2009-11-29  9:43 ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7C74616E923245BE8B95D9035BF91966@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).