From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: M-$ when the region is active (Re: M-q when the region is active) Date: Sun, 07 Oct 2007 01:43:48 +0300 Organization: JURTA Message-ID: <87k5pzn9sq.fsf_-_@jurta.org> References: <87sl54hnhw.fsf@jurta.org> <87tzpdysa9.fsf_-_@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1191710866 19271 80.91.229.12 (6 Oct 2007 22:47:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 6 Oct 2007 22:47:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 07 00:47:43 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IeIQu-0003pe-HE for ged-emacs-devel@m.gmane.org; Sun, 07 Oct 2007 00:47:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IeIQp-0007nV-FM for ged-emacs-devel@m.gmane.org; Sat, 06 Oct 2007 18:47:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IeIQm-0007ly-7G for emacs-devel@gnu.org; Sat, 06 Oct 2007 18:47:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IeIQj-0007jV-2P for emacs-devel@gnu.org; Sat, 06 Oct 2007 18:47:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IeIQi-0007jQ-UF for emacs-devel@gnu.org; Sat, 06 Oct 2007 18:47:28 -0400 Original-Received: from gnome.kiev.sovam.com ([212.109.32.24]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IeIQb-0003re-Tm; Sat, 06 Oct 2007 18:47:22 -0400 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]) by gnome.kiev.sovam.com with esmtp (Exim 4.67 (FreeBSD)) (envelope-from ) id 1IeIQZ-000BWN-Ua; Sun, 07 Oct 2007 01:47:19 +0300 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1IeIQW-0002rM-PO; Sun, 07 Oct 2007 01:47:18 +0300 In-Reply-To: (Richard Stallman's message of "Sun\, 30 Sep 2007 08\:54\:55 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-Scanner-Signature: 811d4bb63238b2e39a625e79cff8aaca X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1563 [Oct 05 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 25 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release X-Detected-Kernel: FreeBSD 6.x (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:80358 Archived-At: > 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/