From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nljlistbox2@gmail.com (N. Jackson) Newsgroups: gmane.emacs.bugs Subject: bug#21129: 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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1437759402 30994 80.91.229.3 (24 Jul 2015 17:36:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 24 Jul 2015 17:36:42 +0000 (UTC) To: 21129@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 24 19:36:32 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZIgtZ-0006Mm-3t for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jul 2015 19:36:29 +0200 Original-Received: from localhost ([::1]:46201 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIgtY-0003mt-Ie for geb-bug-gnu-emacs@m.gmane.org; Fri, 24 Jul 2015 13:36:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIgtB-0003Jw-Sy for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:36:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIgt8-0004NF-K2 for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:36:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIgt8-0004NA-HO for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZIgt7-0002WB-QY for bug-gnu-emacs@gnu.org; Fri, 24 Jul 2015 13:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: nljlistbox2@gmail.com (N. Jackson) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Jul 2015 17:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21129 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14377593599667 (code B ref -1); Fri, 24 Jul 2015 17:36:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Jul 2015 17:35:59 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105113 Archived-At: 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)