From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 24 13:35:59 2015 Received: (at submit) by debbugs.gnu.org; 24 Jul 2015 17:35:59 +0000 Received: from localhost ([127.0.0.1]:58158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZIgt4-0002Vq-He for submit@debbugs.gnu.org; Fri, 24 Jul 2015 13:35:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52883) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZIgt2-0002Ve-2m for submit@debbugs.gnu.org; Fri, 24 Jul 2015 13:35:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIgt0-0004KE-Rj for submit@debbugs.gnu.org; Fri, 24 Jul 2015 13:35:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIgt0-0004K9-OR for submit@debbugs.gnu.org; Fri, 24 Jul 2015 13:35:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIgsz-00033J-74 for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:35:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIgsw-0004IZ-02 for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:35:53 -0400 Received: from mail-ig0-x233.google.com ([2607:f8b0:4001:c05::233]:35543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIgsv-0004IU-Rv for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:35:49 -0400 Received: by igr7 with SMTP id 7so22221713igr.0 for ; Fri, 24 Jul 2015 10:35:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=bAEq8pVcxcxyN/O7yANOaso9GEp4LOmkVijUDSLG74M=; b=0mvfELBvR+6TBx4fkEbmUMnVUNDfEU3am19C1MARHWaYkRFv2/MZ5mSaQH9n/ZzaRm /FQx6UvhTAA6hIQnnS843CXw0BWI9xrzQJkc/4q473KBfJzqdOWn81UkIptHStvJTQDw qBhwnqo6YXZ4HSiOrxXJkHBYbJWLHJqQRL8EbJvp+JSjk6lezkGkwl8o0hrgku9q3o0U 8zUWrMwa1gHhrQyaqaZBac3VLYxMhzA6KecyKjD0zIIRU4kcg3cAuVmr2b697c30J5gT DmNixEm8cohZU0tM5S1EimKSQNN5LwBAraEdh4Ho2h289b2GU00Jnh8XJrc3t93jJ+k2 nscQ== X-Received: by 10.50.87.38 with SMTP id u6mr8529555igz.39.1437759349319; Fri, 24 Jul 2015 10:35:49 -0700 (PDT) Received: from moondust.localdomain.nodomain.none (66-46-90-198.dedicated.allstream.net. [66.46.90.198]) by smtp.gmail.com with ESMTPSA id d8sm1947280igl.19.2015.07.24.10.35.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 10:35:48 -0700 (PDT) From: nljlistbox2@gmail.com (N. Jackson) To: bug-gnu-emacs@gnu.org Subject: 24.5; Behaviour and docstring of flyspell-check-previous-highlighted-word Date: Fri, 24 Jul 2015 14:35:47 -0300 Message-ID: <87fv4d4fws.fsf@moondust.localdomain> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.8 (---) flyspell-check-previous-highlighted-word (f-c-p-h-w) seems to me to have (at least) two bugs (see below) and has typos in (and other problems with) its docstring. The function (in flyspell.el) appears thus: (defun flyspell-check-previous-highlighted-word (&optional arg) "Correct the closer misspelled word. This function scans a mis-spelled word before the cursor. If it finds one it proposes replacement for that word. With prefix arg, count that many misspelled words backwards." (interactive) (let ((pos1 (point)) (pos (point)) (arg (if (or (not (numberp arg)) (< arg 1)) 1 arg)) ov ovs) (if (catch 'exit (while (and (setq pos (previous-overlay-change pos)) (not (= pos pos1))) (setq pos1 pos) (if (> pos (point-min)) (progn (setq ovs (overlays-at (1- pos))) (while (consp ovs) (setq ov (car ovs)) (setq ovs (cdr ovs)) (if (and (flyspell-overlay-p ov) (= 0 (setq arg (1- arg)))) (throw 'exit t))))))) (save-excursion (goto-char pos) (ispell-word) (setq flyspell-word-cache-word nil) ;; Force flyspell-word re-check (flyspell-word)) (error "No word to correct before point")))) 1. The docstring fails to state that, to be found, the misspelled word must be highlighted by Flyspell. (It might not be if Flyspell has not yet run over the buffer or region in question.) 2. Some other problems/typos with the docstring are pointed out with carets below: Correct the closer misspelled word. ^^ This function scans a mis-spelled word before the cursor. If it ^ ^ ^^^^^^^^^^ finds one it proposes replacement for that word. With prefix arg, ^ ^ count that many misspelled words backwards. Perhaps a better docstring might be something like: Correct the closest previous word that is highlighted as misspelled. This function scans for a word before point that has been highlighted by Flyspell as misspelled. If it finds one it proposes a replacement for that word. With a prefix arg, it scans for the nth misspelled word before point, for n equal to ARG. 3. Strangely, f-c-p-h-w uses the Ispell user interface rather than the Flyspell user interface. This suits me fine as I like a non-graphical interface, but it seems to me to be a bug. This is Flyspell after all, and I think one would expect the same interface as with, say, `M-x flyspell-correct-word-before-point'. 4. Contrary to the docstring, if point is immediately after the last character of a misspelled (and Flyspell-highlighted) word, f-c-p-h-w skips to the previous misspelled (and Flyspell-highlighted) word, even though the closest previous misspelled word was the one directly before point. 5. Executing f-c-p-h-w with a prefix argument does not appear to work; the behaviour is as if there was no prefix argument. E.g. with several misspelled words in the buffer before point, `C-u 3 M-x flyspell-check-previous-highlighted-word' acts on the final one just as `M-x flyspell-check-previous-highlighted-word' does, rather than on the 3rd from last one. In GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.14.12) of 2015-05-07 on buildvm-08.phx2.fedoraproject.org Windowing system distributor `Fedora Project', version 11.0.11603000 System Description: Fedora release 21 (Twenty One) From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 25 05:40:19 2015 Received: (at 21129-done) by debbugs.gnu.org; 25 Jul 2015 09:40:19 +0000 Received: from localhost ([127.0.0.1]:58359 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZIvwI-0000RE-K4 for submit@debbugs.gnu.org; Sat, 25 Jul 2015 05:40:19 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:65330) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZIvwF-0000R5-DS for 21129-done@debbugs.gnu.org; Sat, 25 Jul 2015 05:40:16 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NS100K00EPZ0000@a-mtaout22.012.net.il> for 21129-done@debbugs.gnu.org; Sat, 25 Jul 2015 12:40:13 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NS100JRVEV1HZ80@a-mtaout22.012.net.il>; Sat, 25 Jul 2015 12:40:13 +0300 (IDT) Date: Sat, 25 Jul 2015 12:40:15 +0300 From: Eli Zaretskii Subject: Re: bug#21129: 24.5; Behaviour and docstring of flyspell-check-previous-highlighted-word In-reply-to: <87fv4d4fws.fsf@moondust.localdomain> X-012-Sender: halo1@inter.net.il To: nljlistbox2@gmail.com (N. Jackson) Message-id: <83oaj01sow.fsf@gnu.org> References: <87fv4d4fws.fsf@moondust.localdomain> X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 21129-done Cc: 21129-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Eli Zaretskii List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: nljlistbox2@gmail.com (N. Jackson) > Date: Fri, 24 Jul 2015 14:35:47 -0300 > > flyspell-check-previous-highlighted-word (f-c-p-h-w) seems to me to have > (at least) two bugs (see below) and has typos in (and other problems > with) its docstring. Indeed; thanks for pointing that out. > 1. The docstring fails to state that, to be found, the misspelled word > must be highlighted by Flyspell. (It might not be if Flyspell has not > yet run over the buffer or region in question.) > > 2. Some other problems/typos with the docstring are pointed out with > carets below: > > Correct the closer misspelled word. > ^^ > This function scans a mis-spelled word before the cursor. If it > ^ ^ ^^^^^^^^^^ > finds one it proposes replacement for that word. With prefix arg, > ^ ^ > count that many misspelled words backwards. > > Perhaps a better docstring might be something like: > > Correct the closest previous word that is highlighted as misspelled. > This function scans for a word before point that has been > highlighted by Flyspell as misspelled. If it finds one it proposes a > replacement for that word. With a prefix arg, it scans for the nth > misspelled word before point, for n equal to ARG. I used this text with minor stylistic corrections, to make it use the same style as in other doc strings. > 3. Strangely, f-c-p-h-w uses the Ispell user interface rather than > the Flyspell user interface. This suits me fine as I like a > non-graphical interface, but it seems to me to be a bug. This is > Flyspell after all, and I think one would expect the same interface as > with, say, `M-x flyspell-correct-word-before-point'. I did nothing about this one, as this appears a deliberate design decision of the original author. > 4. Contrary to the docstring, if point is immediately after the last > character of a misspelled (and Flyspell-highlighted) word, f-c-p-h-w > skips to the previous misspelled (and Flyspell-highlighted) word, even > though the closest previous misspelled word was the one directly before > point. Fixed. > 5. Executing f-c-p-h-w with a prefix argument does not appear to work; > the behaviour is as if there was no prefix argument. E.g. with several > misspelled words in the buffer before point, `C-u 3 M-x > flyspell-check-previous-highlighted-word' acts on the final one just as > `M-x flyspell-check-previous-highlighted-word' does, rather than on the > 3rd from last one. A simple oversight in how the function's 'interactive' form was used; fixed. The patch appears below, so you could try it in Emacs 24.5. Thanks. diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index a5dff07..2329f29 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -1827,11 +1827,12 @@ (make-variable-buffer-local 'flyspell-auto-correct-word) ;;* flyspell-check-previous-highlighted-word ... */ ;;*---------------------------------------------------------------------*/ (defun flyspell-check-previous-highlighted-word (&optional arg) - "Correct the closer misspelled word. -This function scans a mis-spelled word before the cursor. If it finds one -it proposes replacement for that word. With prefix arg, count that many -misspelled words backwards." - (interactive) + "Correct the closest previous word that is highlighted as misspelled. +This function scans for a word which starts before point that has been +highlighted by Flyspell as misspelled. If it finds one, it proposes +a replacement for that word. With prefix arg N, check the Nth word +before point that's highlighted as misspelled." + (interactive "P") (let ((pos1 (point)) (pos (point)) (arg (if (or (not (numberp arg)) (< arg 1)) 1 arg)) @@ -1842,7 +1843,7 @@ (defun flyspell-check-previous-highlighted-word (&optional arg) (setq pos1 pos) (if (> pos (point-min)) (progn - (setq ovs (overlays-at (1- pos))) + (setq ovs (overlays-at pos)) (while (consp ovs) (setq ov (car ovs)) (setq ovs (cdr ovs)) From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 25 16:59:53 2015 Received: (at 21129) by debbugs.gnu.org; 25 Jul 2015 20:59:53 +0000 Received: from localhost ([127.0.0.1]:58764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZJ6Xw-0003sG-RR for submit@debbugs.gnu.org; Sat, 25 Jul 2015 16:59:53 -0400 Received: from mail-ig0-f193.google.com ([209.85.213.193]:35584) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZJ6Xu-0003s2-7z for 21129@debbugs.gnu.org; Sat, 25 Jul 2015 16:59:50 -0400 Received: by iggf3 with SMTP id f3so3687806igg.2 for <21129@debbugs.gnu.org>; Sat, 25 Jul 2015 13:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=NFCE8uoHT4n3b+vHwivb9KUCgxfe67Fdvdf6tp7qJS0=; b=A8/SHxShffRzTW6zKT4W1FYPV1Yu63p/hTnr7wCmqsjtCf99hmlqZ0BcyuAv6acMw0 CqUOUJTqHOV02Ujj7HzlrTe5C8RC66r7VN5pXrCfxgWJaOE5vHR1Wk/i0/Or2gJjY8Ff GFJpaHZDk1kHmc6WiTRLSQVF2/ld1kWJeeDHq/uu+fXG4U3M29JtCZJlZTGA0pKIEjKQ P22MEuVupfxSGsUlLM87EbImgXFsv8Glfyk+YdSoTScEPxxahbLnXul9pNCni5aFVHjS auREHr+rVf2Jj+3AzdJhHBS+SR4P6GhDQwQJ9gEt8hHiXRVAyzGrdrmhg0ACCVBhrbuH /uaQ== X-Received: by 10.50.36.8 with SMTP id m8mr6805510igj.16.1437857989650; Sat, 25 Jul 2015 13:59:49 -0700 (PDT) Received: from moondust.localdomain.nodomain.none (216-13-52-94.dedicated.allstream.net. [216.13.52.94]) by smtp.gmail.com with ESMTPSA id rs4sm2173588igb.13.2015.07.25.13.59.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Jul 2015 13:59:49 -0700 (PDT) From: nljlistbox2@gmail.com (N. Jackson) To: 21129@debbugs.gnu.org Subject: Re: bug#21129: 24.5; Behaviour and docstring of flyspell-check-previous-highlighted-word References: <87fv4d4fws.fsf@moondust.localdomain> <83oaj01sow.fsf@gnu.org> Date: Sat, 25 Jul 2015 17:59:47 -0300 In-Reply-To: <83oaj01sow.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 25 Jul 2015 12:40:15 +0300") Message-ID: <87oaj0vtq4.fsf@moondust.localdomain> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 21129 Cc: eliz@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) At 06:40 -0300 on Saturday 2015-07-25, Eli Zaretskii wrote: >> 3. Strangely, f-c-p-h-w uses the Ispell user interface rather than >> the Flyspell user interface. This suits me fine as I like a >> non-graphical interface > > I did nothing about this one, as this appears a deliberate design > decision of the original author. That's good news for me. (Otherwise I would have been needing a flyspell-goto-previous-error function so that I could use the Ispell interface!) > The patch appears below, so you could try it in Emacs 24.5. The patch works for me as advertised, and I see you have already closed the bug. Thank you very much. From unknown Sun Jun 22 11:39:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 23 Aug 2015 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator