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

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

Is it possible to leverage ispell's interface for other purposes?


From: Sean McAfee
Subject: Is it possible to leverage ispell's interface for other purposes?
Date: Wed, 08 Dec 2010 15:26:26 -0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (darwin)

I'd like to be able to scan through a buffer's content, looking for any
of several regular expressions, and as each one is found, be presented
with a list of replacements, in the same manner that ispell provides
possible spelling corrections.  The list of replacements will be
dynamically generated by a Lisp callback I specify.  I want to be able
to choose one of the replacements by number, or provide new replacement
text, which in either case will cause a second callback to be invoked so
that I can keep a record of what changes were made.

The real reason I'd like to be able to do this is rather complicated to
explain, so I'll offer a contrived example that keeps all of the
important features.  Suppose I have a file of text that frequently
mentions various traditional metasyntactical variables (foo, bar, baz,
etc).  For each such variable, I want to be presented with a menu of
replacements, one of which is the same variable name but in upper case,
and the rest of which are the other known metasyntactical variables.
So, if foo, bar, and baz were the only three variables I cared about,
I'd have a callback that returns the list '("FOO" "bar" "baz") when
given the argument "foo", the list '("BAR" "foo" "baz") when given the
argument "bar", etc.  I could pick from the list or type something
totally new, and in either case another callback like (lambda (old-text
new-text) ...) would be invoked.

Is it remotely possible to leverage the existing ispell interface as
I've described, or would I have to roll something up from scratch?


reply via email to

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