unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
@ 2020-08-16 14:12 Stefan Kangas
  2020-08-16 14:54 ` Eli Zaretskii
  2021-08-27 17:51 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 10+ messages in thread
From: Stefan Kangas @ 2020-08-16 14:12 UTC (permalink / raw)
  To: 42889

Severity: wishlist

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.

It would be good if this could be made to work also for C-v and M-v, and
maybe some others too.


In GNU Emacs 28.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0)
 of 2020-08-10 built on joffe
Repository revision: 52418648a47b48538c998b1b0a3be8110fff3fdf
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Debian GNU/Linux bullseye/sid





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  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
  2021-08-27 17:51 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2020-08-16 14:54 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 42889

> From: Stefan Kangas <stefan@marxist.se>
> Date: Sun, 16 Aug 2020 07:12:54 -0700
> 
> 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?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2020-08-16 14:54 ` Eli Zaretskii
@ 2020-08-17 15:34   ` Stefan Kangas
  2020-08-17 16:56     ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2020-08-17 15:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 42889

[-- 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));

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2020-08-17 15:34   ` Stefan Kangas
@ 2020-08-17 16:56     ` Eli Zaretskii
  2020-08-18 15:21       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2020-08-17 16:56 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 42889

> From: Stefan Kangas <stefan@marxist.se>
> Date: Mon, 17 Aug 2020 15:34:48 +0000
> Cc: 42889@debbugs.gnu.org
> 
> > 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?

Hmm... this won't work on mouse-capable TTY frames, would it?

I actually thought about something more direct: force
note_mouse_highlight return early before highlighting anything, when a
certain variable is non-nil (that variable could be f->pointer_invisible).

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

Definitely optional, IMO.  But maybe others diagree?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2020-08-17 16:56     ` Eli Zaretskii
@ 2020-08-18 15:21       ` Eli Zaretskii
  2021-10-20 15:07         ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2020-08-18 15:21 UTC (permalink / raw)
  To: stefan; +Cc: 42889

> Date: Mon, 17 Aug 2020 19:56:40 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 42889@debbugs.gnu.org
> 
> I actually thought about something more direct: force
> note_mouse_highlight return early before highlighting anything, when a
> certain variable is non-nil (that variable could be f->pointer_invisible).

Btw, please take a look at the variable mouse-highlight: doesn't it
already provide support for the feature being sought here?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  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
@ 2021-08-27 17:51 ` Lars Ingebrigtsen
  2021-10-20 14:52   ` Stefan Kangas
  1 sibling, 1 reply; 10+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27 17:51 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 42889

Stefan Kangas <stefan@marxist.se> 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'm not quite sure I understand this report.  `make-pointer-invisible'
makes the pointer invisible when you type something -- not when you use
point movement commands like `C-n'.  So Emacs seems to be behaving as
intended here.

If I go to the "Search" entry field and type something in the Customize
buffer, then the mouse pointer disappears, and the highlight over
"Editing" also disappears.

(But this is with the current trunk -- perhaps something has been fixed
in the year since this was reported?  Or I might be misunderstanding
something in the recipe.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2021-08-27 17:51 ` Lars Ingebrigtsen
@ 2021-10-20 14:52   ` Stefan Kangas
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2021-10-20 14:52 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 42889

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefan@marxist.se> 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'm not quite sure I understand this report.  `make-pointer-invisible'
> makes the pointer invisible when you type something -- not when you use
> point movement commands like `C-n'.  So Emacs seems to be behaving as
> intended here.

You are correct; I want the cursor to be made invisible also with
navigation commands.  The highlighting is jarring here, not least
because I use "unclutter" to hide the mouse cursor automatically after 3
seconds of mouse inactivity.

> If I go to the "Search" entry field and type something in the Customize
> buffer, then the mouse pointer disappears, and the highlight over
> "Editing" also disappears.

Yes, I can reproduce this here.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2020-08-18 15:21       ` Eli Zaretskii
@ 2021-10-20 15:07         ` Stefan Kangas
  2021-10-20 16:20           ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Kangas @ 2021-10-20 15:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 42889

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

tags 42889 + patch
thanks

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Mon, 17 Aug 2020 19:56:40 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: 42889@debbugs.gnu.org
>>
>> I actually thought about something more direct: force
>> note_mouse_highlight return early before highlighting anything, when a
>> certain variable is non-nil (that variable could be f->pointer_invisible).
>
> Btw, please take a look at the variable mouse-highlight: doesn't it
> already provide support for the feature being sought here?

Yes, I think it does.  I think this is strictly a documentation bug
then, thanks for pointing it out.

I guess the attached patch should be okay for emacs-28.

[-- Attachment #2: 0001-Refer-to-mouse-highlight-from-make-pointer-invisible.patch --]
[-- Type: text/x-diff, Size: 1075 bytes --]

From 8da55ed988d59f95426da2f8d9af6efe7bbd740c Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Wed, 20 Oct 2021 16:53:44 +0200
Subject: [PATCH] Refer to mouse-highlight from make-pointer-invisible
 docstring

* src/frame.c (syms_of_frame) <Vmake_pointer_invisible>: Doc fix;
add reference to 'mouse-highlight'.  (Bug#42889)
---
 src/frame.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/frame.c b/src/frame.c
index f95566818a..2b1cb452ef 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -6238,7 +6238,10 @@ syms_of_frame (void)
 
   DEFVAR_LISP ("make-pointer-invisible", Vmake_pointer_invisible,
                doc: /* If non-nil, make mouse pointer invisible while typing.
-The pointer becomes visible again when the mouse is moved.  */);
+The pointer becomes visible again when the mouse is moved.
+
+When using this, you might also want to disable highlighting of
+clickable text.  See `mouse-highlight'.  */);
   Vmake_pointer_invisible = Qt;
 
   DEFVAR_LISP ("move-frame-functions", Vmove_frame_functions,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2021-10-20 15:07         ` Stefan Kangas
@ 2021-10-20 16:20           ` Eli Zaretskii
  2021-10-20 16:40             ` Stefan Kangas
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2021-10-20 16:20 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 42889

> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 20 Oct 2021 08:07:32 -0700
> Cc: 42889@debbugs.gnu.org
> 
>    DEFVAR_LISP ("make-pointer-invisible", Vmake_pointer_invisible,
>                 doc: /* If non-nil, make mouse pointer invisible while typing.
> -The pointer becomes visible again when the mouse is moved.  */);
> +The pointer becomes visible again when the mouse is moved.
> +
> +When using this, you might also want to disable highlighting of
> +clickable text.  See `mouse-highlight'.  */);

Fine with me, thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#42889: 28.0.50; make-pointer-invisible t should work also for navigation commands
  2021-10-20 16:20           ` Eli Zaretskii
@ 2021-10-20 16:40             ` Stefan Kangas
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Kangas @ 2021-10-20 16:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 42889

close 42889 28.1
thanks

Eli Zaretskii <eliz@gnu.org> writes:

> Fine with me, thanks.

Thanks, pushed to emacs-28 (commit 7236592668).





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-10-20 16:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).