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
18
votes
1answer
2k views

How to strip decorations (text properties) from a string?

By a "decorated string" I mean something like #("foo" 0 4 (fontified t face font-lock-function-name-face)) ...as opposed to the "plain string" "foo" (If Elisp code reads a string directly from a ...
6
votes
3answers
158 views

masking text in an org-mode buffer

Sometimes I want parts of the text within an org buffer to be 'masked' by default. The reason is that I may want to look at that file with someone looking over my shoulder, where they should be able ...
2
votes
1answer
95 views

text-properties bloat persistent undo files

I'm using undo-tree with AUCTeX, and I am persisting my undo files like so: (setq undo-tree-auto-save-history t) Unfortunately, this regularly results in large (~1MB) undo save files which cause my ...
1
vote
0answers
45 views

How do I insert read-only, HTTP-style headers with editable values?

I'm creating a 'form' of sorts in a buffer that has a few required arguments: Title: Labels: content content content When the form is presented, I'd like to be able to edit any and all text after ...
2
votes
2answers
382 views

How to remove certain text-properties from a list of properties

text-properties-at returns a list of various text properties. I want to remove: display (image :type xpm :file /Users/HOME/.0.data/.0.emacs/.0.images/ezimage/box-plus.xpm :scale 1.1070588235294117 :...
1
vote
2answers
345 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
0answers
37 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 ...
1
vote
1answer
73 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
74 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 ...
1
vote
1answer
220 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
81 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
206 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
310 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
208 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
174 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
74 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
39 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
542 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
561 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
591 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
116 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
416 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
130 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
725 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
138 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
329 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
104 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
2answers
368 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
105 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
428 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
778 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
312 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
573 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
71 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
359 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
184 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
143 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
292 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
160 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
499 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
635 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
506 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
124 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 ...
24
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
253 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
795 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 ...