[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How do I give an overlay a priority lower to that of hl-line-mode?
From: |
Clément Pit--Claudel |
Subject: |
How do I give an overlay a priority lower to that of hl-line-mode? |
Date: |
Tue, 31 May 2016 00:46:55 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 |
Hi emacs-dev,
A mode that I contribute to uses overlays to highlight certain lines. The added
overlays typically cover (point-at-bol) .. (1+ (point-at-eol)), which
unfortunately does not play nicely with hl-line-mode: my overlays hide the one
added by hl-line-mode.
Demo:
(with-current-buffer (get-buffer-create "*hl*")
(erase-buffer)
(fundamental-mode)
(hl-line-mode)
(dotimes (_ 5) (insert "AAAAAAAAAA\n"))
(goto-char 25)
(let ((ov (make-overlay (point-at-bol) (1+ (point-at-eol)))))
(overlay-put ov 'face '(:background "red")))
(pop-to-buffer (current-buffer)))
Of course, the temptation is great to add a little (overlay-put ov 'priority
-100), but it's explicitly a bad idea:
> This property’s value determines the priority of the overlay. If you
> want to specify a priority value, use either nil (or zero), or a
> positive integer. Any other value has undefined behavior.
What alternatives do I have? (In fact, do I have any?)
Thanks!
signature.asc
Description: OpenPGP digital signature
- How do I give an overlay a priority lower to that of hl-line-mode?,
Clément Pit--Claudel <=