unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* HOWTO: Ispell multiple regions?
@ 2005-10-18  2:00 Ilya Zakharevich
  2005-10-18  4:18 ` Edward O'Connor
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Ilya Zakharevich @ 2005-10-18  2:00 UTC (permalink / raw)


I have some ELisp code to select several regions in my file (e.g.,
those having text property ispell).  How would I Ispell these regions?

AFAIC, ispell-region() does not provide a way to query "the status of
operation".  Thus my idea is that the following code:

  (my-map-regions
   (function
    (lambda (s e)
      (ispell-region s e)
      ;; Bulk out if user pressed 'x' or 'q' - but HOWTO?
      )))

would not be easily breakable out by 'x' or 'q'.

Now what?

Thanks,
Ilya

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

* Re: HOWTO: Ispell multiple regions?
  2005-10-18  2:00 HOWTO: Ispell multiple regions? Ilya Zakharevich
@ 2005-10-18  4:18 ` Edward O'Connor
       [not found] ` <mailman.11699.1129609328.20277.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Edward O'Connor @ 2005-10-18  4:18 UTC (permalink / raw)


Ilya Zakharevich wrote:

> How would I Ispell these regions?

Have you seen multi-region.el? I think it does exactly what you want.

               http://purl.org/NET/wence/multi-region.el

Ted

-- 
Edward O'Connor
hober0@gmail.com

Ense petit placidam sub libertate quietem.

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

* Re: HOWTO: Ispell multiple regions?
       [not found] ` <mailman.11699.1129609328.20277.help-gnu-emacs@gnu.org>
@ 2005-10-18  8:51   ` Ilya Zakharevich
  0 siblings, 0 replies; 6+ messages in thread
From: Ilya Zakharevich @ 2005-10-18  8:51 UTC (permalink / raw)


[A complimentary Cc of this posting was sent to
Edward O'Connor 
<hober0@gmail.com>], who wrote in article <mailman.11699.1129609328.20277.help-gnu-emacs@gnu.org>:
> > How would I Ispell these regions?

> Have you seen multi-region.el? I think it does exactly what you want.
> 
>                http://purl.org/NET/wence/multi-region.el

I do not have a slightest idea how this may relate to my problem
(ispell not returning the status).  I do not see any problem with
applying commands to multiple regions - unless they may want to stop
prematurely...

Thanks,
Ilya

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

* Re: HOWTO: Ispell multiple regions?
  2005-10-18  2:00 HOWTO: Ispell multiple regions? Ilya Zakharevich
  2005-10-18  4:18 ` Edward O'Connor
       [not found] ` <mailman.11699.1129609328.20277.help-gnu-emacs@gnu.org>
@ 2005-10-18 18:23 ` Kevin Rodgers
       [not found] ` <mailman.11780.1129660075.20277.help-gnu-emacs@gnu.org>
  3 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2005-10-18 18:23 UTC (permalink / raw)


Ilya Zakharevich wrote:
 > I have some ELisp code to select several regions in my file (e.g.,
 > those having text property ispell).  How would I Ispell these regions?
 >
 > AFAIC, ispell-region() does not provide a way to query "the status of
 > operation".  Thus my idea is that the following code:
 >
 >   (my-map-regions
 >    (function
 >     (lambda (s e)
 >       (ispell-region s e)
 >       ;; Bulk out if user pressed 'x' or 'q' - but HOWTO?
 >       )))
 >
 > would not be easily breakable out by 'x' or 'q'.

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.

-- 
Kevin Rodgers

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

* Re: HOWTO: Ispell multiple regions?
       [not found] ` <mailman.11780.1129660075.20277.help-gnu-emacs@gnu.org>
@ 2005-10-18 19:53   ` Ilya Zakharevich
  2005-10-19  0:15     ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: Ilya Zakharevich @ 2005-10-18 19:53 UTC (permalink / raw)


[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>:
>  > AFAIC, ispell-region() does not provide a way to query "the status of
>  > operation".  Thus my idea is that the following code:
>  >
>  >   (my-map-regions
>  >    (function
>  >     (lambda (s e)
>  >       (ispell-region s e)
>  >       ;; Bulk out if user pressed 'x' or 'q' - but HOWTO?
>  >       )))
>  >
>  > would not be easily breakable out by 'x' or 'q'.
> 
> 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?

Thanks,
Ilya

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

* Re: HOWTO: Ispell multiple regions?
  2005-10-18 19:53   ` Ilya Zakharevich
@ 2005-10-19  0:15     ` Kevin Rodgers
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2005-10-19  0:15 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1582 bytes --]

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 #2: ispell-command-loop.el --]
[-- Type: application/emacs-lisp, Size: 11680 bytes --]

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

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

end of thread, other threads:[~2005-10-19  0:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-18  2:00 HOWTO: Ispell multiple regions? Ilya Zakharevich
2005-10-18  4:18 ` Edward O'Connor
     [not found] ` <mailman.11699.1129609328.20277.help-gnu-emacs@gnu.org>
2005-10-18  8:51   ` Ilya Zakharevich
2005-10-18 18:23 ` Kevin Rodgers
     [not found] ` <mailman.11780.1129660075.20277.help-gnu-emacs@gnu.org>
2005-10-18 19:53   ` Ilya Zakharevich
2005-10-19  0:15     ` Kevin Rodgers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).