all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Is it possible to leverage ispell's interface for other purposes?
@ 2010-08-27  3:46 Sean McAfee
  2010-12-11  7:40 ` Drew Adams
       [not found] ` <mailman.1.1292053308.20755.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Sean McAfee @ 2010-08-27  3:46 UTC (permalink / raw
  To: help-gnu-emacs

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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Is it possible to leverage ispell's interface for other purposes?
  2010-08-27  3:46 Is it possible to leverage ispell's interface for other purposes? Sean McAfee
@ 2010-12-11  7:40 ` Drew Adams
       [not found] ` <mailman.1.1292053308.20755.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2010-12-11  7:40 UTC (permalink / raw
  To: 'Sean McAfee', help-gnu-emacs

> 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?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to leverage ispell's interface for other purposes?
       [not found] ` <mailman.1.1292053308.20755.help-gnu-emacs@gnu.org>
@ 2010-12-11 12:32   ` Elena
  0 siblings, 0 replies; 3+ messages in thread
From: Elena @ 2010-12-11 12:32 UTC (permalink / raw
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-11 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-27  3:46 Is it possible to leverage ispell's interface for other purposes? Sean McAfee
2010-12-11  7:40 ` Drew Adams
     [not found] ` <mailman.1.1292053308.20755.help-gnu-emacs@gnu.org>
2010-12-11 12:32   ` Elena

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.