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

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

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


From: Elena
Subject: Re: Is it possible to leverage ispell's interface for other purposes?
Date: Sat, 11 Dec 2010 04:32:22 -0800 (PST)
User-agent: G2/1.0

On Dec 11, 8:40 am, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > From: Sean McAfee Sent: Thursday, August 26, 2010 8:47 PM
>
> > 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?
>
> Sounds interesting to me, Sean.
> Did you ever get a reply or investigate this further yourself?

I think the AutoComplete package could be leveraged to achieve such
behavior.  You can customize the source of completion, then scan the
buffer and call auto-complete on each word which matches.

http://www.emacswiki.org/emacs/AutoComplete


reply via email to

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