GNU bug report logs -
#33065
[PATCH]: Eliminate obtrusive ghost cursors in follow mode in GUIs.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Tue, 16 Oct 2018 16:30:02 UTC
Severity: normal
Tags: patch
Done: Alan Mackenzie <acm <at> muc.de>
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 33065 in the body.
You can then email your comments to 33065 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#33065
; Package
emacs
.
(Tue, 16 Oct 2018 16:30:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Alan Mackenzie <acm <at> muc.de>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 16 Oct 2018 16:30:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello, Emacs.
In X Windows (amd probably other GUIs), when follow mode is active, and
the cursor passes from one follow window to another, an objectionable
hollow block cursor is left behind. (At least, I personally find it
objectionable. :-)
The following patch (to the master branch) ameliorates this by creating
buffer local values of cursor-in-non-selected-windows and setting these
to nil when one of the buffer's windows is selected.
This is, of course, controlled by a boolean option, which I propose to
enable by default.
Yes, this will need an entry in NEWS, too.
Comments?
diff --git a/lisp/follow.el b/lisp/follow.el
index e2d3a11b65..c04e787919 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -311,6 +311,17 @@ follow-auto
(remove-hook 'find-file-hook 'follow-find-file-hook))
(set-default symbol value)))
+(defcustom follow-hide-ghost-cursors t ; Maybe this should be nil.
+ "When non-nil, Follow mode attempts to hide the obtrusive cursors
+in the non-selected windows of a window group.
+
+This variable takes effect when `follow-mode' is initialized.
+
+Due to limitations in Emacs, this only operates on the followers
+of the current window."
+ :type 'boolean
+ :group 'follow)
+
(defvar follow-cache-command-list
'(next-line previous-line forward-char backward-char right-char left-char)
"List of commands that don't require recalculation.
@@ -427,6 +438,8 @@ follow-mode
(when isearch-lazy-highlight
(setq-local isearch-lazy-highlight 'all-windows))
+ (when follow-hide-ghost-cursors
+ (setq-local cursor-in-non-selected-windows nil))
(setq window-group-start-function 'follow-window-start)
(setq window-group-end-function 'follow-window-end)
@@ -456,6 +469,8 @@ follow-mode
(kill-local-variable 'window-group-end-function)
(kill-local-variable 'window-group-start-function)
+ (kill-local-variable 'cursor-in-non-selected-windows)
+
(remove-hook 'ispell-update-post-hook 'follow-post-command-hook t)
(remove-hook 'replace-update-post-hook 'follow-post-command-hook t)
(remove-hook 'isearch-update-post-hook 'follow-post-command-hook t)
@@ -1262,6 +1277,10 @@ follow-avoid-tail-recenter
;;; Pre Display Function
+(defvar follow-prev-buffer nil
+ "The current buffer at the last call to `follow-adjust-window' or nil.
+follow-mode is not necessarily enabled in this buffer.")
+
;; This function is added to `pre-display-function' and is thus called
;; before each redisplay operation. It supersedes (2018-09) the
;; former use of the post command hook, and now does the right thing
@@ -1310,6 +1329,24 @@ follow-post-command-hook
(defun follow-adjust-window (win)
;; Adjust the window WIN and its followers.
(cl-assert (eq (window-buffer win) (current-buffer)))
+
+ ;; Have we moved out of or into a follow-mode window group?
+ ;; If so, attend to the visibility of the cursors.
+ (when (not (eq (current-buffer) follow-prev-buffer))
+ ;; Do we need to switch off cursor handling in the previous buffer?
+ (when (buffer-live-p follow-prev-buffer)
+ (with-current-buffer follow-prev-buffer
+ (when (and follow-mode
+ (local-variable-p 'cursor-in-non-selected-windows))
+ (setq cursor-in-non-selected-windows
+ (default-value 'cursor-in-non-selected-windows)))))
+ ;; Do we need to switch on cursor handling in the current buffer?
+ (when (and follow-mode
+ (local-variable-p 'cursor-in-non-selected-windows))
+ (setq cursor-in-non-selected-windows nil))
+ (when (buffer-live-p (current-buffer))
+ (setq follow-prev-buffer (current-buffer))))
+
(when (and follow-mode
(not (window-minibuffer-p win)))
(let ((windows (follow-all-followers win)))
--
Alan Mackenzie (Nuremberg, Germany).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Fri, 19 Oct 2018 10:10:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Alan Mackenzie <acm <at> muc.de>
:
bug acknowledged by developer.
(Fri, 19 Oct 2018 10:10:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 33065-done <at> debbugs.gnu.org (full text, mbox):
In article <mailman.2257.1539707430.1284.bug-gnu-emacs <at> gnu.org> you wrote:
Amendment committed.
--
Alan Mackenzie (Nuremberg, Germany).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 16 Nov 2018 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 277 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.