unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: rms@gnu.org
Cc: emacs-devel@gnu.org
Subject: M-$ when the region is active (Re: M-q when the region is active)
Date: Sun, 07 Oct 2007 01:43:48 +0300	[thread overview]
Message-ID: <87k5pzn9sq.fsf_-_@jurta.org> (raw)
In-Reply-To: <E1IbyJz-0005DH-2X@fencepost.gnu.org> (Richard Stallman's message of "Sun\, 30 Sep 2007 08\:54\:55 -0400")

>     Is this a good enough reason to use `fill-region' on the active region,
>     and not other fill-related functions, for the sake of compatibility?
>
> I think it is the right decision, even aside from compatibility.
> Would someone please do this in the trunk?

Done.

I have the last proposal for another keybinding on the active region
(I see no other useful cases at the moment).

ispell-region is a useful command, but it is inconvenient to call.
Selecting a region in transient-mark-mode and typing M-$ (ispell-word)
will improve this by starting spell-checking on the active region.
In the patch below I managed to add a new condition without reindenting
the large body of the function `ispell-word'.  I also fixed messages
displayed at the start and end of the spell-checking to be the same.
They now differ only by the suffix "..." and "done".

PS: I know that flyspell makes ispell commands unnecessary, but this
proposal is intended for users who don't use flyspell.

Index: lisp/textmodes/ispell.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/textmodes/ispell.el,v
retrieving revision 1.213
diff -c -r1.213 ispell.el
*** lisp/textmodes/ispell.el	13 Aug 2007 13:40:47 -0000	1.213
--- lisp/textmodes/ispell.el	6 Oct 2007 22:38:01 -0000
***************
*** 1594,1601 ****
  quit          spell session exited."
  
    (interactive (list ispell-following-word ispell-quietly current-prefix-arg))
!   (if continue
!       (ispell-continue)
      (ispell-maybe-find-aspell-dictionaries)
      (ispell-accept-buffer-local-defs)	; use the correct dictionary
      (let ((cursor-location (point))	; retain cursor location
--- 1594,1605 ----
  quit          spell session exited."
  
    (interactive (list ispell-following-word ispell-quietly current-prefix-arg))
!   (cond
!    ((and transient-mark-mode mark-active
! 	 (not (eq (region-beginning) (region-end))))
!     (ispell-region (region-beginning) (region-end)))
!    (continue (ispell-continue))
!    (t
      (ispell-maybe-find-aspell-dictionaries)
      (ispell-accept-buffer-local-defs)	; use the correct dictionary
      (let ((cursor-location (point))	; retain cursor location
***************
*** 1690,1696 ****
        ;; NB: Cancels ispell-quit incorrectly if called from ispell-region
        (if ispell-quit (setq ispell-quit nil replace 'quit))
        (goto-char cursor-location)	; return to original location
!       replace)))
  
  
  (defun ispell-get-word (following &optional extra-otherchars)
--- 1694,1700 ----
        ;; NB: Cancels ispell-quit incorrectly if called from ispell-region
        (if ispell-quit (setq ispell-quit nil replace 'quit))
        (goto-char cursor-location)	; return to original location
!       replace))))
  
  
  (defun ispell-get-word (following &optional extra-otherchars)
***************
*** 2683,2689 ****
  	(rstart (make-marker)))
    (unwind-protect
        (save-excursion
! 	(message "Spell checking %s using %s with %s dictionary..."
  		 (if (and (= reg-start (point-min)) (= reg-end (point-max)))
  		     (buffer-name) "region")
  		 (file-name-nondirectory ispell-program-name)
--- 2687,2693 ----
  	(rstart (make-marker)))
    (unwind-protect
        (save-excursion
! 	(message "Spell-checking %s using %s with %s dictionary..."
  		 (if (and (= reg-start (point-min)) (= reg-end (point-max)))
  		     (buffer-name) "region")
  		 (file-name-nondirectory ispell-program-name)
***************
*** 2782,2788 ****
        (if (not recheckp) (set-marker ispell-region-end nil))
        ;; Only save if successful exit.
        (ispell-pdict-save ispell-silently-savep)
!       (message "Spell-checking using %s with %s dictionary done"
  	       (file-name-nondirectory ispell-program-name)
  	       (or ispell-current-dictionary "default"))))))
  
--- 2786,2794 ----
        (if (not recheckp) (set-marker ispell-region-end nil))
        ;; Only save if successful exit.
        (ispell-pdict-save ispell-silently-savep)
!       (message "Spell-checking %s using %s with %s dictionary done"
! 	       (if (and (= reg-start (point-min)) (= reg-end (point-max)))
! 		   (buffer-name) "region")
  	       (file-name-nondirectory ispell-program-name)
  	       (or ispell-current-dictionary "default"))))))

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2007-10-06 22:43 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 21:59 TAB when the region is active Dan Nicolaescu
2007-09-16  5:35 ` Richard Stallman
2007-09-17  4:09   ` Dan Nicolaescu
2007-09-17 22:24     ` Richard Stallman
2007-09-17 22:40       ` Lennart Borgman (gmail)
2007-09-17 22:47         ` Drew Adams
2007-09-17 23:28         ` Dan Nicolaescu
2007-09-19  3:42           ` Dan Nicolaescu
2007-09-19  5:11             ` Drew Adams
2007-09-19 13:45               ` Stefan Monnier
2007-09-19 14:34                 ` Drew Adams
2007-09-19 13:45             ` Stefan Monnier
2007-09-20  1:54               ` Dan Nicolaescu
2007-09-20 13:52                 ` Stefan Monnier
2007-09-22  1:00                   ` Dan Nicolaescu
2007-09-24  0:07                     ` Juri Linkov
2007-09-24  1:09                       ` Drew Adams
2007-09-24  1:15                         ` Juri Linkov
2007-09-24  3:50                           ` Stefan Monnier
2007-09-29 23:18                             ` M-q when the region is active (Re: TAB when the region is active) Juri Linkov
2007-09-30 12:54                               ` Richard Stallman
2007-10-06 22:43                                 ` Juri Linkov [this message]
2007-09-24 18:20                           ` TAB when the region is active Richard Stallman
2007-09-24  2:37                       ` Dan Nicolaescu
2007-09-24 18:20                       ` Richard Stallman
2007-09-17 23:13       ` Dan Nicolaescu
2007-09-16 18:48 ` Lennart Borgman
2007-09-16 19:17   ` Paul Pogonyshev
2007-09-16 20:32   ` Drew Adams
2007-09-17  3:59   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k5pzn9sq.fsf_-_@jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

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).