unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] update the behavior of highlight-nonselected-windows
@ 2015-03-31 11:53 Oleh Krehel
  2015-03-31 12:52 ` Stefan Monnier
  2015-03-31 12:59 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: Oleh Krehel @ 2015-03-31 11:53 UTC (permalink / raw)
  To: emacs-devel

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

Hi all,

I like to use the `highlight-nonselected-windows' option, but it
becomes very annoying for the case when I have the same buffer in a
few windows.

Please check the attached patch. Maybe there's a better way to solve
the problem, or maybe this one is good enough. If there aren't
objections, I'll apply this one.

regards,
Oleh

[-- Attachment #2: 0001-Ignore-highlight-nonselected-windows-for-same-buffer.patch --]
[-- Type: text/x-patch, Size: 1482 bytes --]

From 6ba6216a5105a777f7e2f8128bcb9c0a77b6b2c4 Mon Sep 17 00:00:00 2001
From: Oleh Krehel <ohwoeowho@gmail.com>
Date: Tue, 31 Mar 2015 13:42:04 +0200
Subject: [PATCH] Ignore `highlight-nonselected-windows' for same buffer in two
 windows

* lisp/simple.el (redisplay--update-region-highlights): Update.

It looks really weird when the same buffer is opened in multiple
windows and `highlight-nonselected-windows' is t. Especially when the
mouse is pressed.
---
 lisp/simple.el | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 5185607..ce6e24e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4955,7 +4955,13 @@ also checks the value of `use-empty-active-region'."
         (redisplay--update-region-highlight (selected-window))
       (unless (listp windows) (setq windows (window-list-1 nil nil t)))
       (if highlight-nonselected-windows
-          (mapc #'redisplay--update-region-highlight windows)
+          (mapc #'redisplay--update-region-highlight
+                (delq nil
+                      (mapcar (lambda (w)
+                                (unless (eq (window-buffer w)
+                                            (current-buffer))
+                                  w))
+                              windows)))
         (let ((msw (and (window-minibuffer-p) (minibuffer-selected-window))))
           (dolist (w windows)
             (if (or (eq w (selected-window)) (eq w msw))
-- 
1.8.4


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

end of thread, other threads:[~2015-03-31 12:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-31 11:53 [PATCH] update the behavior of highlight-nonselected-windows Oleh Krehel
2015-03-31 12:52 ` Stefan Monnier
2015-03-31 12:59 ` Eli Zaretskii

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