* Highlighting current window
@ 2012-06-30 10:30 Francesco Mazzoli
2012-06-30 18:23 ` Drew Adams
0 siblings, 1 reply; 8+ messages in thread
From: Francesco Mazzoli @ 2012-06-30 10:30 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Highlighting current window
2012-06-30 10:30 Highlighting current window Francesco Mazzoli
@ 2012-06-30 18:23 ` Drew Adams
2012-06-30 19:30 ` Francesco Mazzoli
0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2012-06-30 18:23 UTC (permalink / raw)
To: 'Francesco Mazzoli', 'help-gnu-emacs'
> 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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Highlighting current window
2012-06-30 18:23 ` Drew Adams
@ 2012-06-30 19:30 ` Francesco Mazzoli
2012-06-30 20:16 ` Christopher Grubert
0 siblings, 1 reply; 8+ messages in thread
From: Francesco Mazzoli @ 2012-06-30 19:30 UTC (permalink / raw)
To: 'help-gnu-emacs'
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: Highlighting current window
2012-06-30 19:30 ` Francesco Mazzoli
@ 2012-06-30 20:16 ` Christopher Grubert
2012-07-01 1:22 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Christopher Grubert @ 2012-06-30 20:16 UTC (permalink / raw)
To: 'help-gnu-emacs'
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: Re: Highlighting current window
2012-06-30 20:16 ` Christopher Grubert
@ 2012-07-01 1:22 ` Drew Adams
2012-07-01 1:48 ` Christopher Grubert
[not found] ` <mailman.3792.1341105740.855.help-gnu-emacs@gnu.org>
2012-07-01 11:49 ` Francesco Mazzoli
2 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2012-07-01 1:22 UTC (permalink / raw)
To: cgrubert02, 'help-gnu-emacs'
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Highlighting current window
2012-07-01 1:22 ` Drew Adams
@ 2012-07-01 1:48 ` Christopher Grubert
0 siblings, 0 replies; 8+ messages in thread
From: Christopher Grubert @ 2012-07-01 1:48 UTC (permalink / raw)
To: Drew Adams; +Cc: 'help-gnu-emacs'
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.3792.1341105740.855.help-gnu-emacs@gnu.org>]
* Re: Highlighting current window
[not found] ` <mailman.3792.1341105740.855.help-gnu-emacs@gnu.org>
@ 2012-07-01 1:56 ` Michael Heerdegen
0 siblings, 0 replies; 8+ messages in thread
From: Michael Heerdegen @ 2012-07-01 1:56 UTC (permalink / raw)
To: help-gnu-emacs
"Drew Adams" <drew.adams@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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Highlighting current window
2012-06-30 20:16 ` Christopher Grubert
2012-07-01 1:22 ` Drew Adams
[not found] ` <mailman.3792.1341105740.855.help-gnu-emacs@gnu.org>
@ 2012-07-01 11:49 ` Francesco Mazzoli
2 siblings, 0 replies; 8+ messages in thread
From: Francesco Mazzoli @ 2012-07-01 11:49 UTC (permalink / raw)
To: cgrubert02, 'help-gnu-emacs'
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
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-07-01 11:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-30 10:30 Highlighting current window Francesco Mazzoli
2012-06-30 18:23 ` Drew Adams
2012-06-30 19:30 ` Francesco Mazzoli
2012-06-30 20:16 ` Christopher Grubert
2012-07-01 1:22 ` Drew Adams
2012-07-01 1:48 ` Christopher Grubert
[not found] ` <mailman.3792.1341105740.855.help-gnu-emacs@gnu.org>
2012-07-01 1:56 ` Michael Heerdegen
2012-07-01 11:49 ` Francesco Mazzoli
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).