[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
M-$ when the region is active (Re: M-q when the region is active)
From: |
Juri Linkov |
Subject: |
M-$ when the region is active (Re: M-q when the region is active) |
Date: |
Sun, 07 Oct 2007 01:43:48 +0300 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) |
> 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/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- M-$ when the region is active (Re: M-q when the region is active),
Juri Linkov <=