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

Command to apply invisible property to selection

I would like to have a command that makes selected text invisible, and another to make selected text visible. Currently I have (buffer-invisibility-spec '(a . t)) (global-set-key (kbd "C-c i") (...
3
votes
2answers
58 views

How can I search for bolded text?

My reasons for doing so are exactly like https://unix.stackexchange.com/questions/271550/how-can-i-search-for-bolded-or-underlined-text , but the accepted solution there is to use vim. I don't fancy ...
2
votes
1answer
19 views

The insert function seems to be inheriting the read-only property

I'trying to insert a row of characters into a buffer, where the first four characters should be read-only. Here's the relevant part of the code : (insert (propertize "cn) " 'read-only t)) (insert (...
0
votes
0answers
34 views

Have Emacs remember text properties of buffer [duplicate]

I am using the following code to insert colored text into an Emacs buffer. (insert (propertize "green" 'font-lock-face '(:strike-through t :foreground "green" :background "blue"))) ...
4
votes
3answers
276 views

How to modify a string without altering its text properties

If I propertize a string and save it to a variable, how can I change the string within that variable without altering its text properties? For example: (setq myvar (propertize "testing" ...
2
votes
0answers
22 views

isearch with invisible text properties, not overlays?

Q: how can I get isearch to understand invisible text properties, not just overlays? I'm writing a major mode that uses text properties rather than overlays to toggle visibility. I'd like to use ...
2
votes
0answers
31 views

Why does setting the 'face property trigger fontification?

I'm trying to write a major mode for a programming language with JSX based syntax. Here's a minimal implementation. (defun example-forward-parse-jsx (start-pos limit) "Move point past the JSX ...
0
votes
1answer
55 views

Changing font size of a region or single characters

Is it possible in Emacs to change the font size of a single character or region, without affecting the whole Emacs window?
1
vote
2answers
48 views

Make text clickable: add urls with a loop

In my LaTeX code I have functions that generate hyperlinks in the PDF file. I have, e.g.: \newcommand{\arXivid}[1]{\href{https://arxiv.org/abs/#1}{\tt arXiv:#1}} So, in my LaTeX code I have strings ...
3
votes
1answer
72 views

Make region(s) invisible (not evaluated) to “string-match”, “occur” and similar commands

In a previous question, Make region(s) invisible (not evaluated) to query-replacy and similar commands, I learned about isearch-filter-predicate. Now, I wonder if is there a similar method to make ...
3
votes
2answers
83 views

Make region(s) invisible (not evaluated) to query-replacy and similar commands

Is there a way to make some regions of the buffer invisible (I mean not evaluated by) to query-replace and similar commands? Let me better explain with an example. Let's take a piece of LaTeX code .....
0
votes
2answers
114 views

Change foreground color of a region (temporarily)

I need to change the "OBJECT" string foreground color (let's say "red") in all the occurrences of the string "\command{OBJECT}" in my buffer and I need to restore the original foreground color at the ...
1
vote
1answer
24 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
51 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
66 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
88 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
35 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)) ...
1
vote
1answer
42 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
55 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
42 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
44 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
44 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
102 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
56 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
41 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
27 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
104 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
41 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
37 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
111 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
93 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. ...
3
votes
1answer
96 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
212 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
76 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
124 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
264 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
91 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 ...
3
votes
2answers
143 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
267 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
45 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 "...
6
votes
1answer
299 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
153 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
82 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 ...
17
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
148 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
87 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
42 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
343 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
314 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
33 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 ...