unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Background color past the end of the buffer
@ 2015-07-09 18:36 Yuri D'Elia
  2015-07-10  8:24 ` Vaidheeswaran C
  0 siblings, 1 reply; 15+ messages in thread
From: Yuri D'Elia @ 2015-07-09 18:36 UTC (permalink / raw)
  To: emacs-devel

I'd like to highlight the region past the end of the buffer; that is:
assuming the buffer ends somewhere halfway the current frame (either due
to scrolling or due to the buffer being short), I'd like to set an
highlight between (point-max) and down to the modeline.

I assume it's not possible using markers, and thus overlays.

I don't want to display anything important right now, just change the
background color.

Any other trick I could use?





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

* Re: Background color past the end of the buffer
  2015-07-09 18:36 Background color past the end of the buffer Yuri D'Elia
@ 2015-07-10  8:24 ` Vaidheeswaran C
  2015-07-12 18:54   ` Yuri D'Elia
  0 siblings, 1 reply; 15+ messages in thread
From: Vaidheeswaran C @ 2015-07-10  8:24 UTC (permalink / raw)
  To: Emacs developers

On Friday 10 July 2015 12:06 AM, Yuri D'Elia wrote:
> I'd like to highlight the region past the end of the buffer; that is:
> assuming the buffer ends somewhere halfway the current frame (either due
> to scrolling or due to the buffer being short), I'd like to set an
> highlight between (point-max) and down to the modeline.
> 
> I assume it's not possible using markers, and thus overlays.
> 
> I don't want to display anything important right now, just change the
> background color.
> 
> Any other trick I could use?

Install these ... and then do M-x highlight-buffer-footer.

(defface buffer-footer
  '((t (:background "gold1")))
  "Face for buffer footer")

(defface buffer-text
  '((t (:background "white")))
  "Face for buffer text.")

(defun highlight-buffer-footer ()
  (interactive)
  (custom-set-variables
   '(buffer-face-mode-face (quote buffer-footer)))
  (buffer-face-mode 1)
  (overlay-put (make-overlay (point-min) (point-max)) 'face 'buffer-text))

Use of overlays (as seen above) may not be a good idea.  It would be
worth exploring if face remapping could be used (or improved upon) to
achieve the above effect.

----------------------------------------------------------------

If you are only intereseted in catching whitespaces at the tail end of
the buffer, you can turn on the `empty' style in M-x whitespace-mode
and M-x whitespace-toggle-options.



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

* Re: Background color past the end of the buffer
  2015-07-10  8:24 ` Vaidheeswaran C
@ 2015-07-12 18:54   ` Yuri D'Elia
  2015-07-12 19:08     ` Achim Gratz
  2015-07-13  2:08     ` Vaidheeswaran C
  0 siblings, 2 replies; 15+ messages in thread
From: Yuri D'Elia @ 2015-07-12 18:54 UTC (permalink / raw)
  To: emacs-devel

On 10/07/15 10:24, Vaidheeswaran C wrote:
> (defun highlight-buffer-footer ()
>   (interactive)
>   (custom-set-variables
>    '(buffer-face-mode-face (quote buffer-footer)))
>   (buffer-face-mode 1)
>   (overlay-put (make-overlay (point-min) (point-max)) 'face 'buffer-text))

Huh, that's pretty nasty indeed.

> If you are only intereseted in catching whitespaces at the tail end of
> the buffer, you can turn on the `empty' style in M-x whitespace-mode
> and M-x whitespace-toggle-options.

Not quite. In a hack I'm doing, I want to define a binary boundary in
the text (in the sense: above/below), and I do that by changing the
background color of one of the two.

I just overlay the region I'm interested in, but I want to extend the
background color of the face to the end of the frame, since it creates a
visually ambiguous situation otherwise (besides not looking good).

Maybe I can just temporarily extend the buffer content instead, but I
would loose the EOF fringe indicator and need to calculate how much
lines I need to append...





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

* Re: Background color past the end of the buffer
  2015-07-12 18:54   ` Yuri D'Elia
@ 2015-07-12 19:08     ` Achim Gratz
  2015-07-12 19:37       ` Yuri D'Elia
  2015-07-13  2:08     ` Vaidheeswaran C
  1 sibling, 1 reply; 15+ messages in thread
From: Achim Gratz @ 2015-07-12 19:08 UTC (permalink / raw)
  To: emacs-devel

Yuri D'Elia writes:
> Not quite. In a hack I'm doing, I want to define a binary boundary in
> the text (in the sense: above/below), and I do that by changing the
> background color of one of the two.

So changing the background color of the first part should just work the
way you want, no?


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada




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

* Re: Background color past the end of the buffer
  2015-07-12 19:08     ` Achim Gratz
@ 2015-07-12 19:37       ` Yuri D'Elia
  2015-07-12 19:44         ` Yuri D'Elia
                           ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Yuri D'Elia @ 2015-07-12 19:37 UTC (permalink / raw)
  To: emacs-devel

On 12/07/15 21:08, Achim Gratz wrote:
> Yuri D'Elia writes:
>> Not quite. In a hack I'm doing, I want to define a binary boundary in
>> the text (in the sense: above/below), and I do that by changing the
>> background color of one of the two.
> 
> So changing the background color of the first part should just work the
> way you want, no?

The part that needs highliting is not related to above/below, and it
might end up being under the first.





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

* Re: Background color past the end of the buffer
  2015-07-12 19:37       ` Yuri D'Elia
@ 2015-07-12 19:44         ` Yuri D'Elia
  2015-07-12 19:56         ` Eli Zaretskii
  2015-07-12 20:03         ` Achim Gratz
  2 siblings, 0 replies; 15+ messages in thread
From: Yuri D'Elia @ 2015-07-12 19:44 UTC (permalink / raw)
  To: emacs-devel

On 12/07/15 21:37, Yuri D'Elia wrote:
> On 12/07/15 21:08, Achim Gratz wrote:
>> Yuri D'Elia writes:
>>> Not quite. In a hack I'm doing, I want to define a binary boundary in
>>> the text (in the sense: above/below), and I do that by changing the
>>> background color of one of the two.
>>
>> So changing the background color of the first part should just work the
>> way you want, no?
> 
> The part that needs highliting is not related to above/below, and it
> might end up being under the first.

If you want more reasons to see why it would make "visual" sense, have a
look at this test:

https://github.com/k-talo/volatile-highlights.el/pull/9

This spawns from the idea that sometimes, instead of highlighting, it
makes more sense to "de-light" text: i/e attetuate the stuff *around*
the selection/mark/region instead.

The trouble with this, as for my request, is that you'll want the
"delighting" effect to continue beyond EOF.





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

* Re: Background color past the end of the buffer
  2015-07-12 19:37       ` Yuri D'Elia
  2015-07-12 19:44         ` Yuri D'Elia
@ 2015-07-12 19:56         ` Eli Zaretskii
  2015-07-12 20:02           ` Yuri D'Elia
  2015-07-12 20:03         ` Achim Gratz
  2 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2015-07-12 19:56 UTC (permalink / raw)
  To: Yuri D'Elia; +Cc: emacs-devel

> From: Yuri D'Elia <wavexx@thregr.org>
> Date: Sun, 12 Jul 2015 21:37:27 +0200
> 
> On 12/07/15 21:08, Achim Gratz wrote:
> > Yuri D'Elia writes:
> >> Not quite. In a hack I'm doing, I want to define a binary boundary in
> >> the text (in the sense: above/below), and I do that by changing the
> >> background color of one of the two.
> > 
> > So changing the background color of the first part should just work the
> > way you want, no?
> 
> The part that needs highliting is not related to above/below, and it
> might end up being under the first.

Then you could change the default face's background instead, no?



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

* Re: Background color past the end of the buffer
  2015-07-12 19:56         ` Eli Zaretskii
@ 2015-07-12 20:02           ` Yuri D'Elia
  2015-07-13  2:33             ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Yuri D'Elia @ 2015-07-12 20:02 UTC (permalink / raw)
  To: emacs-devel

On 12/07/15 21:56, Eli Zaretskii wrote:
>> The part that needs highliting is not related to above/below, and it
>> might end up being under the first.
> 
> Then you could change the default face's background instead, no?

This would also work (change the default face's background, then overlay
the rest with the original color).

But this also changes too much stuff as a result (including frame's
borders).





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

* Re: Background color past the end of the buffer
  2015-07-12 19:37       ` Yuri D'Elia
  2015-07-12 19:44         ` Yuri D'Elia
  2015-07-12 19:56         ` Eli Zaretskii
@ 2015-07-12 20:03         ` Achim Gratz
  2015-07-12 20:07           ` Yuri D'Elia
  2 siblings, 1 reply; 15+ messages in thread
From: Achim Gratz @ 2015-07-12 20:03 UTC (permalink / raw)
  To: emacs-devel

Yuri D'Elia writes:
>> So changing the background color of the first part should just work the
>> way you want, no?
>
> The part that needs highliting is not related to above/below, and it
> might end up being under the first.

My point is that you can always make the buffer colored the way you want
by simply reversing the default and then coloring the first part
differently via highlighting.  It's just a suggestion to let you do what
you want in a slightly different way that doesn't need to wait for any
changes to Emacs.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




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

* Re: Background color past the end of the buffer
  2015-07-12 20:03         ` Achim Gratz
@ 2015-07-12 20:07           ` Yuri D'Elia
  0 siblings, 0 replies; 15+ messages in thread
From: Yuri D'Elia @ 2015-07-12 20:07 UTC (permalink / raw)
  To: emacs-devel

On 12/07/15 22:03, Achim Gratz wrote:
> Yuri D'Elia writes:
>>> So changing the background color of the first part should just work the
>>> way you want, no?
>>
>> The part that needs highliting is not related to above/below, and it
>> might end up being under the first.
> 
> My point is that you can always make the buffer colored the way you want
> by simply reversing the default and then coloring the first part
> differently via highlighting.  It's just a suggestion to let you do what
> you want in a slightly different way that doesn't need to wait for any
> changes to Emacs.

See my reply to Eli: if you mean just by changing the 'default face, it
breaks in too many other places, including all inheriting fonts.





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

* Re: Background color past the end of the buffer
  2015-07-12 18:54   ` Yuri D'Elia
  2015-07-12 19:08     ` Achim Gratz
@ 2015-07-13  2:08     ` Vaidheeswaran C
  2015-08-07 17:22       ` Yuri D'Elia
  1 sibling, 1 reply; 15+ messages in thread
From: Vaidheeswaran C @ 2015-07-13  2:08 UTC (permalink / raw)
  To: emacs-devel

On Monday 13 July 2015 12:24 AM, Yuri D'Elia wrote:
> In a hack I'm doing, I want to define a binary boundary in
> the text (in the sense: above/below), and I do that by changing the
> background color of one of the two.
> 
> I just overlay the region I'm interested in, but I want to extend the
> background color of the face to the end of the frame, since it creates a
> visually ambiguous situation otherwise (besides not looking good).
> 
> Maybe I can just temporarily extend the buffer content instead, but I
> would loose the EOF fringe indicator and need to calculate how much
> lines I need to append...


A picture is worth a thousand words.  Why not share a picture.




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

* Re: Background color past the end of the buffer
  2015-07-12 20:02           ` Yuri D'Elia
@ 2015-07-13  2:33             ` Eli Zaretskii
  2015-07-13  3:34               ` Vaidheeswaran C
  0 siblings, 1 reply; 15+ messages in thread
From: Eli Zaretskii @ 2015-07-13  2:33 UTC (permalink / raw)
  To: Yuri D'Elia; +Cc: emacs-devel

> From: Yuri D'Elia <wavexx@thregr.org>
> Date: Sun, 12 Jul 2015 22:02:14 +0200
> 
> On 12/07/15 21:56, Eli Zaretskii wrote:
> >> The part that needs highliting is not related to above/below, and it
> >> might end up being under the first.
> > 
> > Then you could change the default face's background instead, no?
> 
> This would also work (change the default face's background, then overlay
> the rest with the original color).
> 
> But this also changes too much stuff as a result (including frame's
> borders).

What do you mean by "frame's borders"?

In any case, if you change the default face by remapping, I don't
think it affects any other faces.  Did you try that?



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

* Re: Background color past the end of the buffer
  2015-07-13  2:33             ` Eli Zaretskii
@ 2015-07-13  3:34               ` Vaidheeswaran C
  2015-07-13 14:45                 ` Eli Zaretskii
  0 siblings, 1 reply; 15+ messages in thread
From: Vaidheeswaran C @ 2015-07-13  3:34 UTC (permalink / raw)
  To: emacs-devel

One thing that I noticed while cooking the recipe I posted.

1. emacs -q
2. C-x b *scratch*
3. M-x whitespace-mode
4. C-p

Whatever at 3 and 4 is a behaviour that surprises me. WDYT?








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

* Re: Background color past the end of the buffer
  2015-07-13  3:34               ` Vaidheeswaran C
@ 2015-07-13 14:45                 ` Eli Zaretskii
  0 siblings, 0 replies; 15+ messages in thread
From: Eli Zaretskii @ 2015-07-13 14:45 UTC (permalink / raw)
  To: vaidheeswaran.chinnaraju; +Cc: emacs-devel

> From: Vaidheeswaran C <vaidheeswaran.chinnaraju@gmail.com>
> Date: Mon, 13 Jul 2015 09:04:53 +0530
> 
> 1. emacs -q
> 2. C-x b *scratch*
> 3. M-x whitespace-mode
> 4. C-p
> 
> Whatever at 3 and 4 is a behaviour that surprises me. WDYT?

It's a feature, see the functions whitespace-empty-at-eob-regexp and
whitespace-post-command-hook.



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

* Re: Background color past the end of the buffer
  2015-07-13  2:08     ` Vaidheeswaran C
@ 2015-08-07 17:22       ` Yuri D'Elia
  0 siblings, 0 replies; 15+ messages in thread
From: Yuri D'Elia @ 2015-08-07 17:22 UTC (permalink / raw)
  To: emacs-devel

On 13/07/15 04:08, Vaidheeswaran C wrote:
> On Monday 13 July 2015 12:24 AM, Yuri D'Elia wrote:
>> In a hack I'm doing, I want to define a binary boundary in
>> the text (in the sense: above/below), and I do that by changing the
>> background color of one of the two.
>>
>> I just overlay the region I'm interested in, but I want to extend the
>> background color of the face to the end of the frame, since it creates a
>> visually ambiguous situation otherwise (besides not looking good).
>>
>> Maybe I can just temporarily extend the buffer content instead, but I
>> would loose the EOF fringe indicator and need to calculate how much
>> lines I need to append...
> 
> 
> A picture is worth a thousand words.  Why not share a picture.

Forgot about this, but there was one test I needed it for:

https://github.com/k-talo/volatile-highlights.el/pull/9

for a true inverse highlight you'd need to fill the background correctly.





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

end of thread, other threads:[~2015-08-07 17:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-09 18:36 Background color past the end of the buffer Yuri D'Elia
2015-07-10  8:24 ` Vaidheeswaran C
2015-07-12 18:54   ` Yuri D'Elia
2015-07-12 19:08     ` Achim Gratz
2015-07-12 19:37       ` Yuri D'Elia
2015-07-12 19:44         ` Yuri D'Elia
2015-07-12 19:56         ` Eli Zaretskii
2015-07-12 20:02           ` Yuri D'Elia
2015-07-13  2:33             ` Eli Zaretskii
2015-07-13  3:34               ` Vaidheeswaran C
2015-07-13 14:45                 ` Eli Zaretskii
2015-07-12 20:03         ` Achim Gratz
2015-07-12 20:07           ` Yuri D'Elia
2015-07-13  2:08     ` Vaidheeswaran C
2015-08-07 17:22       ` Yuri D'Elia

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