unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 42889@debbugs.gnu.org
Subject: bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
Date: Mon, 17 Aug 2020 15:34:48 +0000	[thread overview]
Message-ID: <CADwFkmnuVcuXQV-ciRdpauhZsnseiQZaUUbEHh-tsS4EydOBPw@mail.gmail.com> (raw)
In-Reply-To: <838seeiqt8.fsf@gnu.org>

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

Eli Zaretskii <eliz@gnu.org> writes:

>> Please consider the following feature request:
>>
>> 0. emacs -Q
>> 1. (setq make-pointer-invisible t)
>> 2. M-x customize-group RET RET
>> 3. Move mouse pointer over e.g. "Editing" to highlight it
>> 4. C-n C-p C-f C-b
>>
>> Result: "Editing" is still highlighted.
>>
>> Desired result: "Editing" is _not_ highlighted.
>
> I think it should be very easy to add such a feature, and I'm willing
> to help by advice.  Want to give it a try?

Sure, why not?  Thanks for offering to help.

I had a first naive crack at it, and ended up with the attached.  It
covers the commands that often irks me, but it might need some more
adjusting.  I considered exposing this to Lisp, but it seemed better to
do this in the low-level primitives, maybe?

I did find one problem, which is that the mouse cursor disappears when I
scroll using the mouse wheel.  I tried fixing it using a simple
let-binding, but that didn't work for some reason I don't yet understand
(see patch).

Also, is this behaviour suitable as a default or should it be optional?

Best regards,
Stefan Kangas

[-- Attachment #2: make-invisible.diff --]
[-- Type: text/x-diff, Size: 2947 bytes --]

diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 8e2039ba9d..294835f16a 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -253,6 +253,7 @@ mwheel-scroll
          (mods
 	  (delq 'click (delq 'double (delq 'triple (event-modifiers event)))))
          (amt (assoc mods mouse-wheel-scroll-amount))
+         (make-pointer-invisible nil)
          saw-error)
     (unless (eq scroll-window selected-window)
       ;; Mark window to be scrolled for redisplay.
@@ -335,7 +336,8 @@ mouse-wheel-text-scale
   (interactive (list last-input-event))
   (let ((selected-window (selected-window))
         (scroll-window (mouse-wheel--get-scroll-window event))
-        (button (mwheel-event-button event)))
+        (button (mwheel-event-button event))
+        (make-pointer-invisible nil))
     (select-window scroll-window 'mark-for-redisplay)
     (unwind-protect
         (cond ((eq button mouse-wheel-down-event)
diff --git a/src/cmds.c b/src/cmds.c
index 90526612b7..c982187178 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -77,6 +77,7 @@ DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p",
 \\[right-char], which see.  */)
   (Lisp_Object n)
 {
+  frame_make_pointer_invisible (SELECTED_FRAME ());
   return move_point (n, 1);
 }
 
@@ -91,6 +92,7 @@ DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p",
 \\[left-char], which see.  */)
   (Lisp_Object n)
 {
+  frame_make_pointer_invisible (SELECTED_FRAME ());
   return move_point (n, 0);
 }
 
diff --git a/src/editfns.c b/src/editfns.c
index cb09ea8a31..ca64f11903 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -51,6 +51,7 @@ Copyright (C) 1985-1987, 1989, 1993-2020 Free Software Foundation, Inc.
 #include "buffer.h"
 #include "window.h"
 #include "blockinput.h"
+#include "frame.h"
 
 static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
 static Lisp_Object styled_format (ptrdiff_t, Lisp_Object *, bool);
@@ -195,6 +196,7 @@ DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
 The return value is POSITION.  */)
   (register Lisp_Object position)
 {
+  frame_make_pointer_invisible (SELECTED_FRAME ());
   if (MARKERP (position))
     set_point_from_marker (position);
   else if (FIXNUMP (position))
diff --git a/src/window.c b/src/window.c
index ef58f43a0b..67fe873403 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6612,6 +6612,8 @@ DEFUN ("recenter", Frecenter, Srecenter, 0, 2, "P\np",
       bytepos = pos.bytepos;
     }
 
+  frame_make_pointer_invisible (SELECTED_FRAME ());
+
   /* Set the new window start.  */
   set_marker_both (w->start, w->contents, charpos, bytepos);
   w->window_end_valid = false;
@@ -7896,6 +7898,8 @@ DEFUN ("set-window-vscroll", Fset_window_vscroll, Sset_window_vscroll,
     {
       int old_dy = w->vscroll;
 
+      frame_make_pointer_invisible (SELECTED_FRAME ());
+
       w->vscroll = - (NILP (pixels_p)
 		      ? FRAME_LINE_HEIGHT (f) * XFLOATINT (vscroll)
 		      : XFLOATINT (vscroll));

  reply	other threads:[~2020-08-17 15:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16 14:12 bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands Stefan Kangas
2020-08-16 14:54 ` Eli Zaretskii
2020-08-17 15:34   ` Stefan Kangas [this message]
2020-08-17 16:56     ` Eli Zaretskii
2020-08-18 15:21       ` Eli Zaretskii
2021-10-20 15:07         ` Stefan Kangas
2021-10-20 16:20           ` Eli Zaretskii
2021-10-20 16:40             ` Stefan Kangas
2021-08-27 17:51 ` Lars Ingebrigtsen
2021-10-20 14:52   ` Stefan Kangas

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CADwFkmnuVcuXQV-ciRdpauhZsnseiQZaUUbEHh-tsS4EydOBPw@mail.gmail.com \
    --to=stefan@marxist.se \
    --cc=42889@debbugs.gnu.org \
    --cc=eliz@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).