Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Highlighting current window
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Francesco Mazzoli  
View profile  
 More options Jun 30 2012, 6:30 am
Newsgroups: gnu.emacs.help
From: Francesco Mazzoli <f...@mazzo.li>
Date: Sat, 30 Jun 2012 11:30:29 +0100
Local: Sat, Jun 30 2012 6:30 am
Subject: Highlighting current window
Hi list,

I was looking for ways to make the focused window clearer. The best
way would probably a slightly lighter background.

However, I couldn't find any hooks to easily do that. I was expecting
something along the lines of `window-leave-hook' and
`window-focus-hook' but I couldn't find anything similar.

The best suggestion that the IRC people came up with is to use
`post-command-hook' and match `switch-buffer', but that sounds a bit
ugly. Is there a better way?

--
Francesco * Often in error, never in doubt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Jun 30 2012, 2:23 pm
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sat, 30 Jun 2012 11:23:50 -0700
Local: Sat, Jun 30 2012 2:23 pm
Subject: RE: Highlighting current window

> I was looking for ways to make the focused window clearer. The best
> way would probably a slightly lighter background.

> However, I couldn't find any hooks to easily do that. I was expecting
> something along the lines of `window-leave-hook' and
> `window-focus-hook' but I couldn't find anything similar.

> The best suggestion that the IRC people came up with is to use
> `post-command-hook' and match `switch-buffer', but that sounds a bit
> ugly. Is there a better way?

Typically folks just look at the mode line to tell which window is selected.
Can you get by by customizing faces `mode-line' and `mode-line-inactive', making
the former something that stands out for you?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francesco Mazzoli  
View profile  
 More options Jun 30 2012, 3:30 pm
Newsgroups: gnu.emacs.help
From: Francesco Mazzoli <f...@mazzo.li>
Date: Sat, 30 Jun 2012 20:30:56 +0100
Local: Sat, Jun 30 2012 3:30 pm
Subject: Re: Highlighting current window
Hi Drew, thanks for your answer.

At Sat, 30 Jun 2012 11:23:50 -0700,

Drew Adams wrote:
> Typically folks just look at the mode line to tell which window is selected.
> Can you get by by customizing faces `mode-line' and `mode-line-inactive', making
> the former something that stands out for you?

Yes, I am aware of that. However I often find myself not being sure
about what is focused, so I think that some more visual aid would
help.

--
Francesco * Often in error, never in doubt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Grubert  
View profile  
 More options Jun 30 2012, 4:16 pm
Newsgroups: gnu.emacs.help
From: Christopher Grubert <cgruber...@comcast.net>
Date: Sat, 30 Jun 2012 16:16:21 -0400
Local: Sat, Jun 30 2012 4:16 pm
Subject: Re: Re: Highlighting current window
On 01/-10/-28163 02:59 PM, Francesco Mazzoli wrote:

> Hi Drew, thanks for your answer.

> At Sat, 30 Jun 2012 11:23:50 -0700,
> Drew Adams wrote:
>> Typically folks just look at the mode line to tell which window is selected.
>> Can you get by by customizing faces `mode-line' and `mode-line-inactive', making
>> the former something that stands out for you?
> Yes, I am aware of that. However I often find myself not being sure
> about what is focused, so I think that some more visual aid would
> help.

> --
> Francesco * Often in error, never in doubt

I use a combination of the three faces mode-line, mode-line-inactive,
mode-line-buffer-id and the hl-line+ package which gives current line
highlighting but only in the active window.  I've found this combination
to work pretty well for me.  I also use a fairly innocuous line
highlighting color (:background "#222") so that it doesn't really
conflict with any other fontification colors, but still draws attention
to where I am.  It draws your attention to the exact line you're on as
opposed to just the window you're in, but I've found that useful.
Chris.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Drew Adams  
View profile  
 More options Jun 30 2012, 9:22 pm
Newsgroups: gnu.emacs.help
From: "Drew Adams" <drew.ad...@oracle.com>
Date: Sat, 30 Jun 2012 18:22:02 -0700
Local: Sat, Jun 30 2012 9:22 pm
Subject: RE: Re: Highlighting current window

> I use ... the hl-line+ package which gives current line
> highlighting but only in the active window....
> I also use a fairly innocuous line highlighting color
> (:background "#222") so that it doesn't really conflict...,
> but still draws attention to where I am.  It draws your
> attention to the exact line you're on as opposed to just
> the window you're in, but I've found that useful.

Thanks for mentioning hl-line+, Chris.  There is also crosshairs.el, which
extends hl-line+ by adding a vertical line through point.  So it is easy to see
where the cursor is (e.g. when you move your attention to another window).
Typically you use the crosshairs display temporarily.

http://www.emacswiki.org/emacs/CrosshairHighlighting


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Grubert  
View profile  
 More options Jun 30 2012, 9:48 pm
Newsgroups: gnu.emacs.help
From: Christopher Grubert <cgruber...@comcast.net>
Date: Sat, 30 Jun 2012 21:48:39 -0400
Local: Sat, Jun 30 2012 9:48 pm
Subject: Re: Highlighting current window
On 06/30/2012 09:22 PM, Drew Adams wrote:
>> I use ... the hl-line+ package which gives current line
>> highlighting but only in the active window....
>> I also use a fairly innocuous line highlighting color
>> (:background "#222") so that it doesn't really conflict...,
>> but still draws attention to where I am.  It draws your
>> attention to the exact line you're on as opposed to just
>> the window you're in, but I've found that useful.
> Thanks for mentioning hl-line+, Chris.  There is also crosshairs.el, which
> extends hl-line+ by adding a vertical line through point.  So it is easy to see
> where the cursor is (e.g. when you move your attention to another window).
> Typically you use the crosshairs display temporarily.

> http://www.emacswiki.org/emacs/CrosshairHighlighting

Yes, I use that as well.  I've found that it is slow to refresh and
creates a flickering effect when typing so I have it bound to a function
key and don't normally leave it turned on.  It is useful at times when
you want to see where you are in relation to some location on another
line (typically when setting up rectangular operations).  I didn't
mention it here because I don't leave it on and use it to identify point
like I do with hl-line which is what the OP was after, but yes, it's a
nice complementary package.
Chris.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Heerdegen  
View profile  
 More options Jun 30 2012, 9:56 pm
Newsgroups: gnu.emacs.help
From: Michael Heerdegen <michael_heerde...@web.de>
Date: Sun, 01 Jul 2012 03:56:34 +0200
Local: Sat, Jun 30 2012 9:56 pm
Subject: Re: Highlighting current window

"Drew Adams" <drew.ad...@oracle.com> writes:
> There is also crosshairs.el, which extends hl-line+ by adding a
> vertical line through point.  So it is easy to see where the cursor is
> (e.g. when you move your attention to another window).  Typically you
> use the crosshairs display temporarily.

> http://www.emacswiki.org/emacs/CrosshairHighlighting

This indeed works very well for this purpose.  You see which window is
selected, as well as the position of point in that window at the same
time.

I use a setup like the following (just as an example):

--8<---------------cut here---------------start------------->8---
(add-hook   ;flash selected window when changing window config
 'window-size-change-functions
 #'(lambda (_)
     (when
         (memq last-command
               '(split-window-vertically
                 split-window-horizontally
                 delete-window icicle-delete-window
                 delete-other-windows))
        (crosshairs-flash))))

(global-set-key [S-next]
                (lambda () (interactive)
                  (other-window  1) (crosshairs-flash)))
(global-set-key [S-prior]
                (lambda () (interactive)
--8<---------------cut here---------------end--------------->8---

Michael.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francesco Mazzoli  
View profile  
 More options Jul 1 2012, 7:49 am
Newsgroups: gnu.emacs.help
From: Francesco Mazzoli <f...@mazzo.li>
Date: Sun, 01 Jul 2012 12:49:13 +0100
Local: Sun, Jul 1 2012 7:49 am
Subject: Re: Highlighting current window
Hi Christopher,
At Sat, 30 Jun 2012 16:16:21 -0400,

Christopher Grubert wrote:
> I use a combination of the three faces mode-line, mode-line-inactive,
> mode-line-buffer-id and the hl-line+ package which gives current line
> highlighting but only in the active window.  I've found this combination
> to work pretty well for me.  I also use a fairly innocuous line
> highlighting color (:background "#222") so that it doesn't really
> conflict with any other fontification colors, but still draws attention
> to where I am.  It draws your attention to the exact line you're on as
> opposed to just the window you're in, but I've found that useful.
> Chris.

I looked at hl-line mode and it supports that functionality as well. I
looked at the source and the trick is using overlays. Knowing that, I
was able to do what I want quite quickly:

----------------8<-------------------------------

;;; Darker background for current buffer
(set-face-attribute 'default nil :background "#1e1e1e")
(set-cursor-color "#ffffff")

(defvar current-buffer-backround-overlay
  nil)

(defun darken-current-buffer-background ()
  (unless (window-minibuffer-p (selected-window))
    (unless current-buffer-backround-overlay
      (setq current-buffer-backround-overlay (make-overlay 1 1))
      (overlay-put current-buffer-backround-overlay 'face '(:background "black")))
    (overlay-put current-buffer-backround-overlay 'window
                 (selected-window))
    (move-overlay current-buffer-backround-overlay
                  (point-min) (point-max))))

(defun undarken-current-buffer-background ()
  (when darken-current-buffer-background
    (delete-overlay current-buffer-backround-overlay)))

(add-hook 'pre-command-hook #'undarken-current-buffer-background)
(add-hook 'post-command-hook #'darken-current-buffer-background)

---------------->8-------------------------------

However, I think that using hl-line might be an even better solution,
I'll try both a bit and see what I prefer.

--
Francesco * Often in error, never in doubt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Le Wang  
View profile  
 More options Jul 3 2012, 9:20 pm
Newsgroups: gnu.emacs.help
From: Le Wang <l26w...@gmail.com>
Date: Wed, 4 Jul 2012 09:20:05 +0800
Local: Tues, Jul 3 2012 9:20 pm
Subject: Re: Highlighting current window

Martin,

Sorry about the last message which didn't cc the group.

On Sun, Jul 1, 2012 at 5:06 PM, martin rudalics <rudal...@gmx.at> wrote:

> I attach an old version which can run into a problem I forgot about.
> There's a better way to provide whole-window overlays for Emacs 24.1 but
> I didn't implement them yet.  If you use Emacs 24, I can look into this.

This seems cool.  Can you elaborate on the "better way" in 24?

> martin

--
Le

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
martin rudalics  
View profile  
 More options Jul 4 2012, 5:18 am
Newsgroups: gnu.emacs.help
From: martin rudalics <rudal...@gmx.at>
Date: Wed, 04 Jul 2012 11:18:56 +0200
Local: Wed, Jul 4 2012 5:18 am
Subject: Re: Highlighting current window
 > Can you elaborate on the "better way" in 24?

The basic problem we have to solve is how to extend the window
background to the entire window and not only to the last buffer
position.  That's inherently what the after-string property of the
hiselwin overlay accomplishes.

Emacs 24.1 offers a better solution following the discussion of

bug#11068: 24.0.94; Face-remapped background does not extend to end of window

which you can find here:

http://lists.gnu.org/archive/html/bug-gnu-emacs/2012-03/msg00569.html

The solution has one drawback wrt to highlighting the selected window:
When the same buffer appears in the selected window _and_ in another
window, that other window will be highlighted too.

The solution is similar to the one proposed by Francesco Mazzoli: Show
the overlay only in the current buffer and give it a 'window property to
show it only in the selected window.

martin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »