* bug#52025: flyspell-emacs-popup pops up menu at random positions
@ 2021-11-21 19:25 Juri Linkov
2021-11-22 19:07 ` Juri Linkov
0 siblings, 1 reply; 2+ messages in thread
From: Juri Linkov @ 2021-11-21 19:25 UTC (permalink / raw)
To: 52025
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: flyspell-emacs-popup.patch --]
[-- Type: text/x-diff, Size: 960 bytes --]
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)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#52025: flyspell-emacs-popup pops up menu at random positions
2021-11-21 19:25 bug#52025: flyspell-emacs-popup pops up menu at random positions Juri Linkov
@ 2021-11-22 19:07 ` Juri Linkov
0 siblings, 0 replies; 2+ messages in thread
From: Juri Linkov @ 2021-11-22 19:07 UTC (permalink / raw)
To: 52025
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-22 19:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-21 19:25 bug#52025: flyspell-emacs-popup pops up menu at random positions Juri Linkov
2021-11-22 19:07 ` Juri Linkov
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.