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 properties, just like
the actual text in the buffer. Any regular property that an overlay
has, applies to the text below it. However, there are some properties
Overlays and text properties have exactly the same capabilities. They add change margins, buttons, faces, fringe icons, tooltips, images, highlights, etc. to a specific part of of text. However, there is a huge conceptual difference:
Overlays are independent, text properties are not. Emacs has a distinct overlay type, but there is no “text property type”....
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 into the minibuffer surprisingly almost does the right thing out of the box. Text inserted there will actually show up.
By making the text be the 'after-string ...
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--show-definition-overlay-at-point (ex: via M-x find-function) you can see exactly how it's created:
(setq company-coq-definition-overlay (make-overlay ins-pos ...
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 &optional timeout)
(let ((ov (make-overlay (point-max) (point-max))))
(overlay-put ov 'after-string
(concat (propertize " " 'display
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.
(defun source-to-final ()
"Cut refs from the txt, but letting them appear as text properties."
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 union/concatenation of all the help-echo properties it covers.
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 because of an awkward issue (which I asked about here), it's not possible AFAIK to directly inherit from a face, and override one of the properties to be unset.
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 will look centered and two characters wide. The only downside I could find so far is that putting the cursor on the propertized string highlights its first space....
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 search within + or - 5 or 10 lines of the number you say.
Or perhaps declare a region or function that you are working in and have all searches only look there. I ...
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 deleted the overlay passively through a hook instead of waiting for an exit-char, which doesn't seem appropriate for what you are trying to do. The display ...
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 problem: Each window has its own window point, which is the position that point would have if that window were selected. This means that the region when that ...
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)))
The following is a more complete wrapper than the one given above in that it supports arbitrary positions within object.
;; source: http://emacs....
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.
(momentary-string-display "hello there" 200)
will place the string "hello there" at position 200 in the buffer. It will move all other text at this point to the side to make room for "hello world", ...
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 regexps, to give you propertied zones amenable for searching.
Other commands and functions in the library let you search such propertied zones or their ...
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 saying only 2 or 3 words.
You can define the set of characters it offers you, so you can avoid consonants that are hard to distinguish. Then the use could ...
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") (point) "Some image"), "Some image" would be displayed before point weren't it for the image layered on top of it which visually replaces that text. You can ...
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:
(hexrgb-increment-green (face-background 'default) 2 20)
calculates color which is a bit more green than current background (in params above, 2 is how many digits ...
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 the contents and bring the buffer to its original form,
(remove-overlays (point-min) (point-max) 'display "...")
Here is a reprint of the example referred to in the comment above:
(let ((eol-floating-column (+ (current-column) 10)))
(overlay-put (make-overlay (point) (point))
(propertize (char-to-string ?\uE001)
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" rather than "insert-after".
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-properties (1- beg) end '(read-only t))
Now create overlay.
When it's time to remove overlay don't forget to remove read-only
property as well:
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 lets you highlight using text properties or overlays (or both).
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 should use a test to determine whether point -- where the overlay will be placed -- is at the end of the line, and use either of the following if that is the case:...
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 been vocal enough, or manually adjusting the overlay position (rather than its insertion type) was easy enough.
[ BTW: the fact that overlays use markers is an ...
I believe you are looking for the variable disable-point-adjustment. You will want to dead its docstring to better understand how you want to use it (i.e. you'll have to reset it every time point "enters" one of those overlays).