all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David.Kastrup@t-online.de (David Kastrup)
Cc: emacs-devel@gnu.org
Subject: Re: Bug#142608: emacs21: please apply flyspell patch from preview-latex package
Date: 17 Apr 2002 23:36:03 +0200	[thread overview]
Message-ID: <x58z7m6m9o.fsf@tupik.goethe.zz> (raw)
In-Reply-To: <200204171604.g3HG4ru24873@aztec.santafe.edu>

[-- Attachment #1: Type: text/plain, Size: 2804 bytes --]

Richard Stallman <rms@gnu.org> writes:

>     fixed for perhaps half a year now (and still has), I would really be
>     surprised if the fixes (or their supersession by larger changes taking
>     them into account) would not already be present in RC.
> 
> Mere passage of time does not put anything into RC.
> (How could it?)  That happens only under human control.
> That is why I suggested you put these into RC.
> 
>       IIRC, 21.3 was
>     not supposed to be mere bug fixes as compared to 21.2, was it?
> 
> We have decided to base 21.3 on RC.  The release from HEAD
> will be 21.4.
> 
>     I would first have to get developer access to GNU Emacs, I am
>     registered as "dak" at Savannah and have signed all the necessary
>     papers.
> 
> Eli, can you do that?

I have now verified that indeed flyspell.el and mouse-drag.el do not
contain any fixes to the annoying behavior.  The problem in both of
those cases was that the implemented behavior of the packages stole
mouse-click events on overlays with a keymap property.

The change for flyspell.el is minimally invasive: it just removes the
keybinding causing the problem (the function called would check
whether the click was on the flyspell overlay and call the appropriate
handler if it was, and the local keymap if it wasn't, ignoring any
overlay maps that might actually have priority).  While this
superficially looks like this would stop flyspell's use of the mouse
button itself, this is not the case: flyspell itself uses a keymap on
its overlay, and that functions cleably.  I can only guess that there
must have been some point of time where this did not work reliably,
and thus the local keymap was employed as well, leading to the
problem that when flyspell.el decided it did not really need to treat
the click, it passed it to the wrong handler.

I believe that quite more was changed in HEAD as a result of my report
at the time.  The patch from me is rather small and has tested well.

The change in mouse-drag.el is more thorough: again we have a package
that takes control over an event and then decides whether it will use
the event itself, or pass it on.  Again, this decision is done wrong
as it does not take clicks on overlays into account.  In this case,
the solution was a bit more complicated, but still is shorter than
the original version: I push the event back into the event queue
(after doing the changes to it that mouse-drag does, too) and let
Emacs' event handler figure out what to do instead of trying to
second-guess it.

Both patches have been used for some time by me and appear safe.  I
include them here again and would be glad if they made it into RC:
both have been reported several times as a bug for preview-latex.

I would also be glad to apply them myself if you gave me developer
access.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Make flyspell.el not unnecessarily steal events --]
[-- Type: text/x-patch, Size: 801 bytes --]

Apply this patch only if middle-mouse clicks on preview-icons paste
instead of toggling when in fly-spell mode.  After version 21.2 of
Emacs, this should be fixed already.

--- /usr/local/emacs-21/share/emacs/21.1/lisp/textmodes/flyspell.el.old	Mon Jul 16 14:22:59 2001
+++ /usr/local/emacs-21/share/emacs/21.1/lisp/textmodes/flyspell.el	Wed Nov  7 16:18:54 2001
@@ -378,9 +378,7 @@
 	  (setq minor-mode-map-alist
 		(cons (cons 'flyspell-mode flyspell-mode-map)
 		      minor-mode-map-alist)))
-  (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word)
-  (define-key flyspell-mode-map [(mouse-2)]
-    (function flyspell-correct-word/local-keymap)))
+  (define-key flyspell-mode-map "\M-\t" 'flyspell-auto-correct-word))
 
 
 ;; the name of the overlay property that defines the keymap


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: Make mouse-drag pass events on correctly --]
[-- Type: text/x-patch, Size: 2807 bytes --]

Apply this patch only if middle-mouse clicks on preview-icons paste
instead of toggling when using mouse-drag mode.  After version 21.2 of
Emacs, this should be fixed already.

--- mouse-drag.el.old	Mon Jan  8 20:12:12 2001
+++ mouse-drag.el	Tue Nov 13 22:47:36 2001
@@ -208,7 +208,7 @@
 	 (start-col (car (posn-col-row start-posn)))
 	 (old-selected-window (selected-window))
 	 event end row mouse-delta scroll-delta
-	 have-scrolled point-event-p old-binding
+	 have-scrolled
 	 window-last-row
 	 col mouse-col-delta window-last-col
 	 (scroll-col-delta 0)
@@ -261,18 +261,13 @@
 	      (mouse-drag-safe-scroll scroll-delta scroll-col-delta)
 	      (mouse-drag-repeatedly-safe-scroll scroll-delta scroll-col-delta))))) ;xxx
     ;; If it was a click and not a drag, prepare to pass the event on.
-    ;; Note:  We must determine the pass-through event before restoring
-    ;; the window, but invoke it after.  Sigh.
+    ;; Is there a more correct way to reconstruct the event?
     (if (and (not have-scrolled)
 	     (mouse-drag-events-are-point-events-p start-posn end))
-	(setq point-event-p t
-	      old-binding (key-binding
-			   (vector (event-basic-type start-event)))))
+	(push (cons (event-basic-type start-event) (cdr start-event))
+	      unread-command-events))
     ;; Now restore the old window.
-    (select-window old-selected-window)
-    ;; For clicks, call the old function.
-    (if point-event-p
-	(call-interactively old-binding))))
+    (select-window old-selected-window)))
 
 (defun mouse-drag-drag (start-event)
   "\"Drag\" the page according to a mouse drag.
@@ -297,7 +292,7 @@
 	 (start-col (car (posn-col-row start-posn)))
 	 (old-selected-window (selected-window))
 	 event end row mouse-delta scroll-delta
-	 have-scrolled point-event-p old-binding
+	 have-scrolled
 	 window-last-row
 	 col mouse-col-delta window-last-col
 	 (scroll-col-delta 0)
@@ -335,18 +330,14 @@
 		(setq have-scrolled t)
 		(mouse-drag-safe-scroll scroll-delta scroll-col-delta)))))))
     ;; If it was a click and not a drag, prepare to pass the event on.
-    ;; Note:  We must determine the pass-through event before restoring
-    ;; the window, but invoke it after.  Sigh.
+    ;; Is there a more correct way to reconstruct the event?
     (if (and (not have-scrolled)
 	     (mouse-drag-events-are-point-events-p start-posn end))
-	(setq point-event-p t
-	      old-binding (key-binding
-			   (vector (event-basic-type start-event)))))
+	(push (cons (event-basic-type start-event) (cdr start-event))
+	      unread-command-events))
     ;; Now restore the old window.
-    (select-window old-selected-window)
-    ;; For clicks, call the old function.
-    (if point-event-p
-	(call-interactively old-binding))))
+    (select-window old-selected-window)))
+
 
 (provide 'mouse-drag)

[-- Attachment #4: Type: text/plain, Size: 85 bytes --]



-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
Email: David.Kastrup@t-online.de

  reply	other threads:[~2002-04-17 21:36 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E16wEb6-0005Op-00@volition>
2002-04-14  4:15 ` Bug#142608: emacs21: please apply flyspell patch from preview-latex package Rob Browning
2002-04-14 10:28   ` David Kastrup
2002-04-15 22:00     ` Richard Stallman
2002-04-15 22:20       ` David Kastrup
2002-04-16  6:25         ` Eli Zaretskii
2002-04-16 14:00           ` David Kastrup
2002-04-16 17:07             ` Juanma Barranquero
2002-04-16 18:12             ` Eli Zaretskii
2002-04-17 16:04         ` Richard Stallman
2002-04-17 21:36           ` David Kastrup [this message]
2002-04-18 10:20             ` Stefan Monnier
2002-04-19  5:24               ` Richard Stallman
2002-04-19 15:47                 ` Stefan Monnier
2002-04-18 19:22             ` Eli Zaretskii
2002-04-19 18:42               ` Richard Stallman
2002-04-19 19:51                 ` Eli Zaretskii
2002-04-20 19:58               ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x58z7m6m9o.fsf@tupik.goethe.zz \
    --to=david.kastrup@t-online.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.