From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Elena Newsgroups: gmane.emacs.help Subject: Re: Is it possible to leverage ispell's interface for other purposes? Date: Sat, 11 Dec 2010 04:32:22 -0800 (PST) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1292071238 11129 80.91.229.12 (11 Dec 2010 12:40:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 11 Dec 2010 12:40:38 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 11 13:40:34 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PROkW-0004bY-9O for geh-help-gnu-emacs@m.gmane.org; Sat, 11 Dec 2010 13:40:28 +0100 Original-Received: from localhost ([127.0.0.1]:56731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PROkV-0006Q8-Qm for geh-help-gnu-emacs@m.gmane.org; Sat, 11 Dec 2010 07:40:27 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!p26g2000pra.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 39 Original-NNTP-Posting-Host: 94.36.101.78 Original-X-Trace: posting.google.com 1292070742 3600 127.0.0.1 (11 Dec 2010 12:32:22 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 11 Dec 2010 12:32:22 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p26g2000pra.googlegroups.com; posting-host=94.36.101.78; posting-account=AFCLjAoAAABJAOf_HjgEEEi3ty-lG5m2 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:183169 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77424 Archived-At: On Dec 11, 8:40=A0am, "Drew Adams" 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. =A0I 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. =A0Suppose I have a file of > > text that frequently mentions various traditional metasyntactical > > variables (foo, bar, baz, etc). =A0For 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. =A0I 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