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.

The Text Properties menu item under the Edit menu of Emacs by default has several options for displaying or editing . The manual describes the various , including face and some special properties, margins, and stickiness and inheritance characteristics that are not in the menu.

Strings with text properties have a special read and print syntax. Emacs uses a property-list (plist for short) for text properties. See the category property for setting default properties. See the fields for specifying properties by strings, and intervals for when to use (overlay properties) instead of text properties. See searching for locating (text or overlay) property changes in the buffer.

139 questions
5
votes
1 answer

Why does `insert` not insert colorized text?

For instance, why does (insert #("abc" 0 3 (face (:foreground "red")))) not insert red text?
extremeaxe5
  • 659
  • 3
  • 11
5
votes
1 answer

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 swoop, without necessarily knowing what all of…
lawlist
  • 19,106
  • 5
  • 38
  • 120
4
votes
0 answers

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 cause another window to jump to the context of the…
nispio
  • 8,225
  • 2
  • 36
  • 74
4
votes
2 answers

How to extract text properties into a string?

Is it possible to separate text properties and convert them into a string? For example, with a string with properties: #("gfsd \"fsgfd\" sdfdsgfs \"fsdfs\"s sfg fdg fdffffffffffffff" 0 5 (fontified t) 5 6 (fontified t syntax-table (15) face…
DataHungry
  • 247
  • 1
  • 7
4
votes
3 answers

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) (put-text-property 1 10 'invisible t) (setq…
Håkon Hægland
  • 3,648
  • 1
  • 22
  • 51
3
votes
2 answers

Text as text properties?

Is it possible to have a text string as a text property in emacs? Let me explain. I usually work with latex documents and I need to format their bibliographies that have, e.g., this structure: \begin{thebibliography}{9} \bibitem{bib1} Some…
Gabriele
  • 1,554
  • 9
  • 21
2
votes
2 answers

Is there a way to attach hidden/invisible data to a place in text?

I want to keep track of some stuff happening in the buffer, with elisp, and display indicators depending on that stuff. To that end, I need to cache calculated data for different parts of the file, and then quickly access and update that data.…
aaa
  • 436
  • 3
  • 9
2
votes
2 answers

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 :ascent center). The image may change, so I'd like…
lawlist
  • 19,106
  • 5
  • 38
  • 120
2
votes
1 answer

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 breaks the string down into various…
lawlist
  • 19,106
  • 5
  • 38
  • 120
1
vote
1 answer

[up/down]case-region: Skip read-only text; Operate on read-write text; No Error

The buffer contains a mixture of text that is read-only (with 'read-only text properties) and read-write (i.e., no 'read-only text properties). I want to [up/down]case-region as to the read-write sections, but am unable to do so due to the…
lawlist
  • 19,106
  • 5
  • 38
  • 120
1
vote
1 answer

Set text-property a buffer text automatically

I use Julia REPL, Singular or some other math software in my emacs. In every case, I have a buffer (*julia* or *Singular*,...) synchronise with some running process. The last line of this buffer is where I introduce the commands to execute. This…
MonLau
  • 81
  • 7
1
vote
1 answer

`text-property-not-all` doesn't seem to work as documented

Why I get 1 instead of nil for following function? Am I misunderstanding how text property searching works? (defun set-properties() (interactive) (add-text-properties 1 6 '(test "em")) (message (format "%s" (text-property-not-all 1 6 'test…
laplazul
  • 11
  • 1
1
vote
0 answers

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 each Header: without being able to move point into…
Sean Allred
  • 6,921
  • 18
  • 86
1
vote
1 answer

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 property needs to be changed. (add-text-properties…
Saravana
  • 2,071
  • 13
  • 32
0
votes
1 answer

Show a highly visual indicator for consecutive newlines

The context I'm editing some text files that contain paragraphs of text. Some of these paragraphs are not correctly separated (paragraphs are separated with two newlines), so I need to manually edit the file to get the correct separation. This is a…
rdrg109
  • 408
  • 2
  • 10
1
2