unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How do I give an overlay a priority lower to that of hl-line-mode?
@ 2016-05-31  4:46 Clément Pit--Claudel
  2016-05-31 20:28 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Clément Pit--Claudel @ 2016-05-31  4:46 UTC (permalink / raw)
  To: Emacs developers


[-- Attachment #1.1: Type: text/plain, Size: 996 bytes --]

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!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2016-06-01  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-31  4:46 How do I give an overlay a priority lower to that of hl-line-mode? Clément Pit--Claudel
2016-05-31 20:28 ` Stefan Monnier
2016-05-31 20:46   ` Clément Pit--Claudel
2016-06-01  2:29     ` Stefan Monnier

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