Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
19 views

`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 ...
1
vote
0answers
21 views

Display done org-habit habits in a different face

I'm experimenting with org-habit and currently have org-habit-show-all-today set to t so I can see a habit even when I've done it for that day. I'm doing that because I want to get the little reward ...
1
vote
0answers
34 views

Make text Invisible with font-lock-keywords

I'm interested in changing my org-mode buffers to have a better looking logbook. My ideal state to end up in is that text that looks like this: - State "WAITING" from "WAITING" [2018-11-16 Fri ...
0
votes
2answers
53 views

Make parts of a working buffer read-only

Is it possible to make only parts of a buffer read-only? Say I have set two marks or line-numbers in the buffer and I would like to make everything between those two marks or line-numbers as read-...
0
votes
1answer
27 views

How the get the text value of a complete value of a variable?

here a little example to explain my problem : How to get "marge" or ("marge") from oef-highlighted-variable ? oef-highlighted-variable #("marge" 0 5 (fontified nil face oef-font-variable-name-face)) ...
0
votes
0answers
12 views

Can I align based on text-properties?

Can I align text-based on text-properties. Given that I have a linter that understands my source code, this seems like it would be immensely useful. In my case I have a block like this: import Data....
1
vote
1answer
38 views

Read-only text stops working after a while

This is a very strange issue and its cause is hard to determine. I often leave Emacs open for days, or even weeks at a time. My current emacs-uptime is 9 and a half days. That's pretty normal and ...
2
votes
0answers
40 views

Calculate current-column including display properties

I am trying to calculate the width of text within either a buffer or a string after it has been displayed, i.e. after taking into account the width of any display properties, such as embedded images, ...
0
votes
1answer
30 views

Determine the face(s) that would be applied to a character inserted at point, after font-lock does its thing?

Suppose I am trying to write a major mode. In this mode, certain ordinary characters should have special "electric" behavior when typed, but only in some contexts (e.g. in code but not in strings or ...
1
vote
0answers
34 views

scrolling text in the mode-line

Since the mode-line space is precious, I'd like to display some information in a fixed size area (60 char for example). To do so, I'd like the text to scroll, like when music players display music ...
0
votes
1answer
27 views

with-temp-buffer removes text properties

Given e.g. (with-temp-buffer (clojure-mode) (insert ":hello") (buffer-string)), I'd expected the result to be propertized, however it isn't. How to get a propertized string out of a temporary buffer?
4
votes
1answer
96 views

Format fails to copy text properties from the format-string for adjacent %-sequences

Take a look at this example: (format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar") "foobar" (format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar") #("foo bar" 4 7 (face error)...
3
votes
1answer
47 views

How to display a marked-up string without the markup?

Q: how can I display a marked-up string without the markup? I have a string with LaTeX markup, such as the following name with an umlaut: Tezc\"ur I want to display the string in a buffer without ...
0
votes
1answer
32 views

Change text properties conditionally?

Q: how do I change text properties conditional on other properties? I have text between region beg and end. Each character has text properties. I know I can change those text properties in an ...
0
votes
1answer
22 views

Using equal-including-properties to compare # string and propertized string

I'm writing some tests for my first emacs package but am running into an issue to do with asserting that two text properties are the same - one that's created with # and another with propertize: ;; ...
0
votes
1answer
36 views

How to prevent Text is read-only error inside minibuffer after typing C-x h and typing text

When This is reproducible in emacs -Q in my version of GNU Emacs running on my Ubuntu machine: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian The ...
1
vote
0answers
35 views

Get repeating value for org entry

I want to use the repeat-duration of tasks in the org-agenda-cmp-user-defined value of my custom agenda view. For example, let's say I have the following task. * TODO Reticulate Splines SCHEDULED: &...
1
vote
0answers
34 views

Difference between =text= and ~text~ in org-mode [duplicate]

On org-mode's website, =text= is called "verbatim", whereas ~text~ is called "code". However, when exporting an org document to LaTeX, both are translated to \texttt{text}. When exporting to HTML, ...
1
vote
2answers
84 views

re-search-forward through visible text only

I have one big org file. Sometimes I only want to search for a regular expression through the visible text, not the text that is folded; otherwise my search will take much longer. How can I search ...
1
vote
0answers
63 views

Setting margins in `text-mode`

I use text files for most of my work. But for printing them on letterhead, I need to set margins to say 3 cm for upper margin and 2.5 cm for lower. Is there any way I can define them in text-mode. ...
1
vote
1answer
62 views

New line in cursor-intangible area and line-beginning position

I want to make the beginning of a line uneditable, which I can achieve by applying the read-only and cursor-intangible properties. But I have the problem, that line-beginning-position moves point not ...
1
vote
0answers
169 views

Org agenda using default face for some things (not caused by font-lock)

Org agenda is using the default face for some items, preventing customization. I've seen Org Agenda faces do not appear after applying themes, but font-lock is not enabled for my agenda buffer (the ...
0
votes
1answer
64 views

Why would `symbol-name' return a fontified string?

I've got a weird bug in a GraphQL encoder I'm writing that I've tracked down to one form: (symbol-name 'world) ;; yields #("world" 0 5 (fontified t)) I can reproduce the issue in a *scratch* ...
2
votes
0answers
66 views

How can I make hl-line mode not override the color of rainbow-mode? [duplicate]

Is there an non-intrusive way to do this? I've made a fork of rainbow-mode that uses overlay instead of text properties, which solves this :) https://github.com/amosbird/rainbow-mode
3
votes
1answer
177 views

How can I eliminate the side effect of left margin?

I've set a left margin like this: (set-window-margins (get-buffer-window) 20 0) (let ((gutter-sep (concat (make-string (- (car (window-margins (get-buffer-window))) 2) ? ) "+"))) (propertize "." '...
2
votes
2answers
62 views

Evaluate parts inside text-property string using read syntax?

I just discovered that it is possible to define strings with text properties using the special read syntax. Now I'm trying to evaluate a value of a property within the string definition so something ...
4
votes
2answers
98 views

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{...
0
votes
2answers
168 views

After installing an icon font, propertize still show unknown characters

I'm trying to use custom icons from https://materialdesignicons.com/. (defface mdi-face `((t (:family "Material Design Icons"))) "Face for Material design icons.") (insert (propertize "\f004" '...
0
votes
1answer
39 views

buffer-file-name can return propertized text?

Once upon a time I was surprised to see buffer-file-name sometimes return propertized text like #("/tmp/foo" 1 4 (face flx-highlight-face)) instead of "/tmp/foo". I got in the habit of defensively "...
7
votes
1answer
249 views

undo-tree — history file without text-properties

Q:  How can I modify undo-tree-save-history to remove the text-properties from all entries that make their way into the saved history file? In a related thread, @PythonNut was on a very similar quest ...
1
vote
2answers
89 views

delete trailing new lines / whitespace, but not an image at eob

I have a buffer that will have either plain text or an image (text properties) near the end of the buffer. I would like to delete any new lines or whitespace at the end of the buffer. How can I do ...
0
votes
1answer
62 views

Revert `font-lock-face` changes

I have a custom face defined as (defface my-underlined '((t (:underline "red"))) :group 'my-group) At some place I underline some words with something like (add-text-properties (match-beginning ...
13
votes
1answer
1k 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
130 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 ...
3
votes
1answer
74 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
25 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 ...
1
vote
2answers
250 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
250 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
29 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
66 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
62 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
119 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
55 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
176 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
243 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
126 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
123 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 ...
3
votes
2answers
70 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
29 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
450 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 ...