Questions tagged [text-properties]

is for any text property, such as `face`, that Emacs can associate with text. Emacs moves, copies, or displays the text using the text properties, which are specified as name-value pairs along with the text in a special Lisp structure. Emacs uses a special read and print syntax for text properties.

Filter by
Sorted by
Tagged with
1
vote
1answer
70 views

How to use text-properties in a lambda function

I wish to map the text properties onto a list and them insert them on a new buffer. For some reason the following snippet doesn't work. I've used the -map utility from dash.el package for the map. ...
0
votes
1answer
70 views

Locally modify the syntax-table via text-properties

I’m trying to make a particular exclamation point behave like a word constituent (from the point of view of the syntax table), using the syntax-table text property, but I can’t get it to work. In an ...
0
votes
1answer
184 views

Add text property, when global-font-lock mode is on

I am trying to set the foreground color for first line in my buffer which has global-font-lock ON. Buffer contents - (ignore) (add-text-properties 1 8 '(:...
1
vote
1answer
70 views

add-text-properties throws args out of range

I have a reasonably large buffer, whose first five characters i like to make as comment (this is a simplified problem of a larger issue, so bear with me). Buffer contents: ;;some comment text, whose ...
3
votes
1answer
200 views

How can I edit read-only text after pasting?

I want to create a buffer where some parts are editable, but others are not. I'm using the read-only string property to do this, e.g.: (with-current-buffer (get-buffer-create "*scratch-demo*") (...
1
vote
2answers
289 views

How to get an insert-text-button 'action property accessing a dynamically-bound buffer-local variable

In realgud I have a text button that needs access to a dynamically-bound buffer-local variable. The situation occurs like this. Inside one buffer that has the buffer local variable, there is a ...
0
votes
0answers
164 views

Change the background color with region text as color code

I have many color variables defined in my css - LESS file, whose background color i like to highlight on text selection and running this elisp block. (add-text-properties (region-beginning) (region-...
2
votes
1answer
161 views

How to programmatically walk along string and add text properties

I have a function that gathers strings that looks like these: Example #1:   :event:lawlist:HIGH:misc: Example #2:  :LOW: Example #3: :MEDIUM:task:george: I created a monstrosity of a snippet that ...
2
votes
2answers
71 views

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

How can I get the previous-or-equal single property change for a given property? For example, assume AAA, BBB, and CCC below have different faces. AAABBBCCC Here is the return value that I would ...
0
votes
0answers
37 views

Is this possible to prettify \(A_i\) to A_i (A<sub>i</sub>) in org-mode?

I would like to prettify \(A_i\) to Ai. Is this possible? I looked up the source of org-match-substring-regexp and tried to modify it, but no luck. any help?
12
votes
2answers
522 views

Can I use an image in my modeline lighter?

My modeline is cluttered. Can I make it display pictures instead of mode names? I could use unicode Emoji (such as 🐍 for Python or 🐓 for Coq), but some machines on which I use my Emacs config do ...
0
votes
1answer
498 views

My org-mode has different size text at different level

Actually what happened was this. I was looking for a good theme for my emacs. In the process I have changed many themes. I don't know which theme caused this but now my org-mode has different size ...
1
vote
1answer
539 views

Add clickable text in read only buffer?

If i have a writable buffer, i can use this to insert hyperlink. (require 'button) (insert-button "foo" 'action (lambda (x) (find-file "~/test.py"))) But i have to add clickable text property to a ...
2
votes
1answer
115 views

Debugging / understanding placement of keymap with text-properties

Q:  Why does there appear to be a keymap on the hyphen of hello-world in the following example? GOAL:  Place text properties before the hyphen and after the hyphen -- without any keymap being placed ...
2
votes
1answer
393 views

Make all text of a given face invisible

Is there a straightforward way to make all text with a given face invisible? I don't believe I can make invisibility be intrinsic to the face, but can I perhaps specify a minor mode that makes sure ...
3
votes
1answer
122 views

How to modify string height while keeping the face?

Here's a code that works for setting a string foreground: (defface test-face '((t (:height 1.2 :foreground "green"))) "doc.") (setq asdf (propertize "asdf" 'face 'test-face)) (add-face-text-...
3
votes
1answer
676 views

How to remove all text properties in a buffer

The function remove-text-properties requires a list for the third argument props -- e.g., (remove-text-properties start end '(face nil)) How can I remove all text properties in a buffer in one fell ...
1
vote
1answer
131 views

Adding text properties to empty strings?

Is there a way to add text properties to empty strings? As far as I can tell, calling put-text-property on an empty string silently does nothing. I seem to recall reading somewhere that the empty ...
2
votes
2answers
313 views

compose-region and TABs

I'm trying to use compose-region with TABs but fail to see difference. I'd like to get 'sqrt' composed to '√' but taking as much space as original text and aligned to the right. I tried each of: (...
3
votes
0answers
101 views

How would one fake kerning adjustments in propertized text?

I've successfully managed adjusting the displayed size of spaces and raising/lowering propertized text by making use of the display property, however I cannot find anything that would allow me to fake ...
1
vote
2answers
352 views

Get width of an image

How can I determine the width of an image of the imagemagick type? I am inserting an image into a buffer, whose size is (initally) completely unknown to me. I do it more or less like this: (insert-...
1
vote
1answer
96 views

Why don't insert-in-front-hooks run?

Open a scratch buffer, paste the following an evaluate it: (insert (propertize "hello" 'insert-in-front-hooks (list (lambda (&rest unused) (message "test"))))) Typing ...
12
votes
5answers
410 views

Ways to unobtrusively vary text rendering?

I'm writing an emacs extension for use with speech recognition, and I'm looking for help with a particular feature. Some words the speech recognizer (Dragon) recognizes consistently poorly -- it doesn'...
4
votes
1answer
730 views

Properties inheriting in org doesn't work

I have this sample org file: #+COLUMNS: %25ITEM %TODO %5owner %3PRIORITY %TAGS * test1 :PROPERTIES: :owner: own1 :END: ** test2 ** test3 I also have in my .emacs file: (setq org-use-...
6
votes
2answers
288 views

How to set the glyph of a unicode character?

I would like to set the glyph of a certain unicode character. Specifically, I would like the glyph § (SECTION SIGN) to represent the unicode character U+202A (LEFT-TO-RIGHT EMBEDDING), a normally non-...
2
votes
1answer
539 views

How to use the highlight-chars.el package?

How can I use the highlight-chars.el package mentioned here (and here's its code) to highlight custom characters? Specifically, I'd like to highlight the unicode directional formatting characters for ...
4
votes
0answers
69 views

Custom follow mode

I want to make a follow mode where placing the cursor within certain parts of the buffer will cause some action to happen in another window. For example, using helm-follow-mode with helm-occur will ...
7
votes
2answers
338 views

Strip text properties in savehist

I save the kill-ring using the savehist package. savehist saves the kill ring with text-properties intact. Unfortunately, this is a problem. I have a rather large emacs config, and I use a lot of ...
7
votes
1answer
174 views

How does AucTeX display superscripts?

latex-mode is has a nice display of superscripts and subscripts. Not only are they reduced in size, but they are respectively raised and lowered a bit relative to the current line. Q: How can I make ...
1
vote
1answer
133 views

Strange cursor behavior with text property invisible

I am trying to hide some text in my buffer using text property invisible. This works fine, except that the cursor is not moving correctly when the text is hidden. To reproduce this clearly I think I ...
4
votes
3answers
285 views

Prevent Emacs from asking “kill anyway” when only text properties have changed

I have a read-only file that I open in Emacs. I have created a keyboard shortcut to hide some regions of the file. For example: (defun hide-beginning () (interactive) (setq buffer-read-only nil) ...
2
votes
1answer
154 views

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

I need to add a text-property to the entire buffer. However, parts of the buffer might already have that property with a different value. Q: What's the easiest way to apply a text property only to ...
4
votes
2answers
467 views

How to make mode-line text look like a link/button on hover

What face/text/other property should I use to have mode-line text look like a button/link/stuff to click on while I am hovering over it with the cursor? Some examples: different background, 3D-like ...
9
votes
2answers
608 views

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

Q: how do I temporarily show text in a window at screen locations with no text to propertize/overlay? I'm familiar with the basic idea behind text properties and overlays (see also this thread), have ...
10
votes
1answer
455 views

Are there any libraries for input fields in Emacs?

Quite a few Emacs modes use (something like) forms: the customization interface is one of them, the Message mode (read: its header part) is another one; there are more of them, unfortunately not ...
5
votes
3answers
122 views

elisp: retaining data structure after inserting string representation to buffer?

I'm currently writing a major mode (for interacting with a remote Grid Engine) which involves fetching data, parsing it into an alist, formating the alist into a string and then inserting the ...
23
votes
2answers
2k views

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

The manual states: You can use overlays to alter the appearance of a buffer's text on the screen, for the sake of presentation features. From its name, it suggests it can be used to create “...
8
votes
1answer
242 views

Prevent inserting text at the beginning of a buffer that starts with read-only text

I'm extending an existing Emacs package and I want to make a part of the buffer not editable (read only). In fact, I want to make only one line in the middle of the buffer editable and I use the ...
5
votes
2answers
762 views

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

I want to transform a text file with many lines : | refXXXXX | here useful text, first sentence, last word. | | refYYYYY | First word, second sentence. | into : here useful ...