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
2 votes
2 answers
803 views

text-scale for all faces in buffer

I often use text scaling, but it only seems to work on the default face. This is a problem, for instance, when I write text that also has italics (e.g., markdown, org text). The text scale commands ...
1 vote
1 answer
102 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. ...
1 vote
0 answers
54 views

Displaying adjacent boxed text (Zero-length/invisible delimiters for text properties?)

I'm interested in displaying adjacent boxed text using the :box t face property in the following manner for adjacent text: Is there an accepted convention for delimiting/isolating text properties ...
3 votes
1 answer
192 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 ...
3 votes
1 answer
246 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
1 answer
227 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 ...
0 votes
1 answer
115 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 ...
2 votes
1 answer
669 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
2 answers
614 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
0 answers
380 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
1 answer
238 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
2 answers
105 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 ...
3 votes
2 answers
538 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: (...
0 votes
0 answers
48 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?
13 votes
2 answers
937 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 ...
11 votes
2 answers
969 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 ...
1 vote
1 answer
1k 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
1 answer
978 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
1 answer
754 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
1 answer
466 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-...
4 votes
1 answer
1k 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-...
1 vote
1 answer
214 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 ...
10 votes
1 answer
334 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
1 answer
1k 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 ...
6 votes
2 answers
644 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-...
12 votes
5 answers
606 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'...
3 votes
0 answers
127 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 ...
2 votes
2 answers
795 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
1 answer
141 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 ...
4 votes
3 answers
498 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
1 answer
838 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 ...
9 votes
2 answers
947 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 ...
4 votes
0 answers
80 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
1 answer
286 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 ...
2 votes
1 answer
300 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 ...
9 votes
1 answer
847 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
3 answers
161 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 ...
28 votes
2 answers
4k 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 “...
5 votes
2 answers
1k 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 ...

1 2
3