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
1answer
103 views

Is there a way to add some margin/padding above a line?

For example I have this text in a buffer: aaa bbb ccc and I want it displayed with some spacing above the bbb line: aaa bbb ccc Is there a face or something which I could add to the bbb line, so ...
0
votes
0answers
25 views

Problem with font in markdown-mode table

I am using variable-pitch for markdown-mode. Tables use fixed-pitch (markdown-table-face). The table aligns for regular text. It breaks alignment for links. The spaces are also underlined. ...
1
vote
0answers
28 views

Is it possible to add visual padding around a character?

Is it possible to add visual padding around a variable width character (generally too, I suppose)? I've looked into using propertize and buffer-display-table to accomplish this, but every solution ...
1
vote
1answer
14 views

List of hooks inhibited by inhibit-modification-hooks

The documentation of inhibit-modification-hooks states Non-nil means don't run any of the hooks that respond to buffer changes. This affects before-change-functions and after-change-functions, as ...
0
votes
1answer
45 views

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 ...
0
votes
0answers
23 views

Text properties overriden in org-agenda header

I do load a sexp entry - as a diary- from one of my agenda files which calls a custom function. Everything works fine except that the propertized text using utf glyphs is overriden in the agenda view ...
3
votes
2answers
76 views

Why adding the display property does not work on some part of a file, while it works on other parts?

Let's say I have an org file with this content (this is the Org Manual): *** System-wide header arguments #+vindex: org-babel-default-header-args The file is opened normally, highlighted and ...
4
votes
1answer
81 views

Why does `insert` not insert colorized text?

For instance, why does (insert #("abc" 0 3 (face (:foreground "red")))) not insert red text?
1
vote
0answers
50 views

keymap (overlay / text property): how to create and modify?

I'd like to have certain keymap active when the cursor is in a particular highlighted area. For instance, I would like to bind hl-todo-next to some easy key combination, but only when the cursor is on ...
0
votes
0answers
21 views

Is it a bug that isearch goes into text replaced with a display property?

The manual says: Some kinds of display specifications specify something to display instead of the text that has the property. These are called replacing display specifications. Emacs does not ...
2
votes
2answers
94 views

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 ...
3
votes
1answer
42 views

How to use font-lock to set other text properties (particularly keymap)?

I'm trying to make a mode where certain strings in the buffer have a special keymap active when the point is inside them. The documentation for font-lock-extra-managed-props and the Elisp info manual ...
1
vote
2answers
109 views

Org-mode add a property (e.g. effort) on the same row as my task (similar to priority and tags)

I'd like to show an additional property (e.g. EFFORT) on the same line as my tasks, so that it is always visible in both org-mode and agenda view. An example is below. Current display: TODO [#A] ...
3
votes
2answers
105 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
68 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
67 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
44 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
56 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
408 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" ...
4
votes
2answers
555 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 ...
2
votes
0answers
48 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
32 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
167 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?
3
votes
1answer
84 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 ...
1
vote
2answers
56 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 ...
0
votes
2answers
264 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
154 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 ...
1
vote
1answer
26 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
169 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 ...
2
votes
0answers
108 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
161 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
41 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)) ...
3
votes
1answer
70 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 ...
1
vote
1answer
45 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 ...
0
votes
1answer
59 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 ...
3
votes
0answers
82 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, ...
1
vote
0answers
58 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
57 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
114 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)...
0
votes
1answer
54 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
34 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
248 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
44 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
39 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
149 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
133 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
143 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
254 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
88 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
177 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