GNU bug report logs - #52025
flyspell-emacs-popup pops up menu at random positions

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Sun, 21 Nov 2021 19:39:01 UTC

Severity: normal

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52025 in the body.
You can then email your comments to 52025 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52025; Package emacs. (Sun, 21 Nov 2021 19:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 21 Nov 2021 19:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: flyspell-emacs-popup pops up menu at random positions
Date: Sun, 21 Nov 2021 21:25:40 +0200
[Message part 1 (text/plain, inline)]
When typing 'C-c $' (flyspell-correct-word-before-point) near a misspelled word,
or opening the flyspell context menu from keyboard, the menu is displayed at random
place on the screen.

It seems the intention was to pop up the menu at the mouse position,
even when no mouse is used, but ad-hoc code in flyspell-emacs-popup
fails to do this correctly.

One variant is to use (popup-menu-normalize-position nil) that
correctly returns the mouse position.  But it has a usability problem:
often the mouse pointer is far away from the misspelled word.

So the best thing to do here is to popup the menu exactly
under the misspelled word:

[flyspell-emacs-popup.patch (text/x-diff, inline)]
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 258e5fde67..b9962422ea 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -2270,17 +2270,8 @@ flyspell-adjust-cursor-point
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-emacs-popup (event poss word)
   "The Emacs popup menu."
-  (if (and (not event)
-           (display-mouse-p))
-      (let* ((mouse-pos  (mouse-position))
-	     (mouse-pos  (if (nth 1 mouse-pos)
-			     mouse-pos
-			   (set-mouse-position (car mouse-pos)
-				 	       (/ (frame-width) 2) 2)
-			   (mouse-position))))
-	(setq event (list (list (car (cdr mouse-pos))
-				(1+ (cdr (cdr mouse-pos))))
-			  (car mouse-pos)))))
+  (if (not event)
+      (setq event (popup-menu-normalize-position (point))))
   (let* ((corrects   (flyspell-sort (car (cdr (cdr poss))) word))
 	 (cor-menu   (if (consp corrects)
 			 (mapcar (lambda (correct)

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52025; Package emacs. (Mon, 22 Nov 2021 19:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 52025 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: 52025 <at> debbugs.gnu.org
Subject: Re: bug#52025: flyspell-emacs-popup pops up menu at random positions
Date: Mon, 22 Nov 2021 21:07:49 +0200
close 52025 29.0.50
quit

> So the best thing to do here is to popup the menu exactly
> under the misspelled word:

Now pushed to master, and closed.




bug marked as fixed in version 29.0.50, send any further explanations to 52025 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Mon, 22 Nov 2021 19:09:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 21 Dec 2021 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 88 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.