all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleh Krehel <ohwoeowho@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: [PATCH] update the behavior of highlight-nonselected-windows
Date: Tue, 31 Mar 2015 13:53:33 +0200	[thread overview]
Message-ID: <CAA01p3rX+SSAh=4gofj6D8uEDiiyVUwfMv2-v2m1AqsNwFhfCg@mail.gmail.com> (raw)

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


             reply	other threads:[~2015-03-31 11:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 11:53 Oleh Krehel [this message]
2015-03-31 12:52 ` [PATCH] update the behavior of highlight-nonselected-windows Stefan Monnier
2015-03-31 12:59 ` Eli Zaretskii

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='CAA01p3rX+SSAh=4gofj6D8uEDiiyVUwfMv2-v2m1AqsNwFhfCg@mail.gmail.com' \
    --to=ohwoeowho@gmail.com \
    --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.