15 votes
Accepted

What are overlays for, and how do they differ from text properties?

What are Overlays? First of all, they are elisp objects. This will be relevant later. As you said yourself, they represent layers that apply on top of regions of the buffer. These layers have text ...
user avatar
  • 22.3k
8 votes
Accepted

Understanding why two apparently different overlay strings are `equal`

equal compares by string content and ignores text properties. If you wish to include properties into your check, use equal-including-properties.
user avatar
  • 21k
8 votes
Accepted

Display list of words along bottom of frame?

With a lot of hacky experimentation I was able to get #6 (using minibuffer text) to a 'good enough' working state. Here's a screenshot: There are several key parts to make this work: Inserting text ...
user avatar
8 votes

How to display overlay like this screencast?

Indeed it does accomplish that behavior using overlays. Specifically- it uses the 'after-string property to show the documentation (see: Overlay Properties). If you examine the function company-coq--...
user avatar
  • 6,794
6 votes
Accepted

Temporary text in window location with no text to propertize/overlay?

I've whipped up a working example of a function that takes a string and temporarily displays it with a timeout after the buffer text: (defun my-momentarily-display-after-buffer-end (string &...
user avatar
  • 21k
6 votes
Accepted

How to apply overlay or text properties to text matching a regexp?

Yes, it’s possible A couple of points on your function: Don’t cut the text before you need it. Use the third argument for search-forward-regexp to avoid getting errors. And so: (defun source-to-...
user avatar
  • 22.3k
5 votes
Accepted

Concatenate multiple 'help-echo strings

The help-echo property can be a function that returns the actual string to display, so you could add an additional overlay with higher priority with a special help-echo property which will compute the ...
user avatar
  • 25.2k
5 votes
Accepted

Line highlighting canceling out syntax highlighting

Basically, the hl-line face is defining a :foreground property, which is overriding the other foreground colors in your theme. misterioso defines hl-line in terms of highlight using inheritance, and ...
user avatar
  • 9,993
4 votes
Accepted

Display other text centered

While my solution doesn't really center, it comes close enough I hope. There is a display property that adjusts the width of all spaces, if I use the string ≡ and make its spaces half the width, it ...
user avatar
  • 21k
4 votes
Accepted

Ways to unobtrusively vary text rendering?

Another possibility would be to display line numbers and say the line number before the word, or, since looking over to get the exact line number would be bothersome, you could have the algorithm ...
user avatar
4 votes
Accepted

display eldoc help info behind point

As with the comment, pos-tip-show works fine for me too. I did hack together a better (but not perfect) version of the momentary-string-display version. I just rewrote the display function so that it ...
user avatar
  • 1,490
3 votes

Simplest way to add-text-properties without overriding existing ones

Use next-single-property-change in a loop, to scan forward for the particular property. Examine the property value each time there is a change in it, and DTRT at that location.
user avatar
  • 69.2k
3 votes
Accepted

Highlighting selected region in same buffer, displayed in multiple windows

Not sure what the question is. Are you asking for code that gives you the behavior you want? Are you asking that Emacs Dev change simple.el so that it behaves as you want? At any rate, this is the ...
user avatar
  • 69.2k
3 votes

How do I get the closest property change before a given point?

Something like this should work: (defun last-prop-change (prop &optional limit) (let ((pos+1 (min (1+ (point)) (point-max)))) (previous-single-char-property-change pos+1 prop nil limit))) ...
user avatar
  • 7,763
3 votes
Accepted

Move point inside of image overlay

I believe you are looking for the variable disable-point-adjustment. You will want to read its docstring to better understand how you want to use it (i.e. you'll have to reset it every time point &...
user avatar
  • 25.2k
2 votes

Temporary text in window location with no text to propertize/overlay?

You can temporarily display text in a buffer with the function momentary-string-display. It takes a message to display and a position in the buffer. This: (momentary-string-display "hello there" ...
user avatar
  • 5,206
2 votes

How to apply overlay or text properties to text matching a regexp?

Library isearch-prop.el can help with at least some of what you want to do, I think. See command isearchp-add-regexp-as-property or function isearchp-regexp-scan, for adding text properties based on ...
user avatar
  • 69.2k
2 votes

Ways to unobtrusively vary text rendering?

Have you heard of ace-jump-mode? It doesn't meet any of the requirements you specify, but it looks like it fits perfectly what you're trying to achieve. It would allow the user to specify any word by ...
user avatar
  • 22.3k
2 votes
Accepted

how to use the STRING parameter in put-image?

You're misinterpreting the STRING parameter here. The docs state it's a string used as the before-string property with an image on top of it. Therefore, if you do (put-image (create-image "image.gif")...
user avatar
  • 21k
2 votes
Accepted

Theme background with opacity? Or theme callback?

I finally found more-or-less satisfactory solution myself. Still, not sure whether it is perfect. 1) Library hexrgb.el provides nice functions to perform actual color calculations. For example: (...
user avatar
  • 1,017
2 votes

A simple overlay program

Reproducing lawlist's comments here, To make an overlay and minify the code block as "...", you can do, (overlay-put (make-overlay (point-at-bol) (point-at-eol)) 'display "...") Now, to expand ...
user avatar
  • 1,887
2 votes
Accepted

overlay and buffer content

Here is a reprint of the example referred to in the comment above: (save-excursion (end-of-line) (let ((eol-floating-column (+ (current-column) 10))) (overlay-put (make-overlay (point) (point)...
user avatar
  • 17.6k
2 votes
Accepted

Inserting before an after-string overlay

The simplest way is probably to use: (let ((overlay (make-overlay (point-max) (point-max) nil t t))) ...) The additional t t arguments will mark the overlays's boundaries as being "insert-before" ...
user avatar
  • 25.2k
2 votes
Accepted

Forbid inserting text before and after overlay

Indeed @Dan's advice helped me. My final solution is: Mark all text beginning one character before overlay (that is including newline before it) and ending where overlay ends as read-only: (set-text-...
user avatar
  • 4,743
2 votes
Accepted

face vs overlays, can face ever win?

If you want a whitespace warning face to win, then use an overlay for that face, and give it a higher priority value than the overlay you want to shadow. You can use library Highlight to do this. It ...
user avatar
  • 69.2k
2 votes
Accepted

Overlay into empty line truncates line, workarounds?

The question has nothing to do with spacemacs, so the reference to that library/configuration should be removed from the question so as not to confuse other forum participants. The original poster ...
user avatar
  • 17.6k
2 votes
Accepted

Create term buffer duplicate with coloring preserved

(defun sandric/duplicate-current-term-buffer () (interactive) (let ((duplicate-buffer (get-buffer-create "NEWBUF")) (term-point (point)) (term-window-start (window-start)) (...
user avatar
  • 1,829
2 votes
Accepted

Modifying the insertion type of overlay markers after creation

It would be safe to let the user change the insertion type of the start/end position of an overlay. It just hasn't been needed until now. I guess those people who have needed such a thing haven't ...
user avatar
  • 25.2k

Only top scored, non community-wiki answers of a minimum length are eligible