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

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

Re: HOWTO: Ispell multiple regions?


From: Kevin Rodgers
Subject: Re: HOWTO: Ispell multiple regions?
Date: Tue, 18 Oct 2005 18:15:02 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to Kevin Rodgers
> <ihs_4664@yahoo.com>], who wrote in article
> <mailman.11780.1129660075.20277.help-gnu-emacs@gnu.org>:
>
>>What commands are invoked by `x' and `q' in ispell-region?
>>
>>You could advise those commands to throw to a tag that you establish
>>with catch.
>
> No such command.  See `ispell-command-loop'.  Of course, one could
> advise ispell-command-loop itself to propagate ispell-quit (which is
> going to be reset to nil later) to, e.g., ispell-quit-pos.
>
> Is it possible to do advising "locally" (like let()ting), so it is
> automatically undone when the calling function exits?

Ah, ispell-command-loop.  I should have remembered that, since I had to
rewrite the whole thing in order to implement a simple change I wanted
(to index the *Choices* buffer with numbers instead of characters).  To
keep it clean, I extracted those command characters into their own
keymap.

If you start with what I wrote (ispell-command-loop.el, which I'm
attaching), then you could get access to those anonymous commands like
this:

(defconst ispell-x-command (lookup-key ispell-command-loop-map "x"))
(defconst ispell-q-command (lookup-key ispell-command-loop-map "q"))

And then modify the bindings to do what you want:

(define-key ispell-command-loop-map "x"
  (lambda ()
    (interactive)
    (throw 'my-tag (funcall ispell-x-command))))

(define-key ispell-command-loop-map "q"
  (lambda ()
    (interactive)
    (throw 'my-tag (funcall ispell-q-command))))

--
Kevin Rodgers

Attachment: ispell-command-loop.el
Description: application/emacs-lisp


reply via email to

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