6

You probably try that in the *scratch* buffer or any other buffer with active font-lock-mode. In such a buffer the faces are immediately adapted to the rules prescribed by the variable font-lock-keywords. Use the property font-lock-face instead of face in those buffers. The modified version of your example would be: (insert #("abc" 0 3 (font-lock-face (:...


3

The text property is removed by font-lock in org-mode buffers. The list org-font-lock-extra-keywords contains the function org-fontify-meta-lines-and-blocks as a matcher of a font lock keyword for meta lines, i.e., lines starting with #+ followed by a keyword. That function calls org-fontify-meta-lines-and-blocks-1 which has the following lines for lines ...


3

You can filter the interesting isearch-matches by the function registered at the variable isearch-filter-predicate. I demonstrate this below in a simplified way. I only check the first letter of the match. I accept the match if that letter is bold. Apparently face-attribute interferes with isearch in Emacs 26.2. For that reason I introduced the variable ...


2

buffer-invisibility-spec is a buffer local variable. If you want globally set the key you must add a to the default value of buffer-invisible-spec. global-set-key is a function therefore the argument (add-text-properties ...) is evaluated before global-set-key. The return value of add-text-properties is undefined in the doc. So you bind your keys to some ...


2

Try (defconst trigger-zone-highlights '(("trigger-zone" (0 '(face trigger-zone-face keymap trigger-zone-map)))))


2

You can extract properties from a given position of a string or buffer with function text-properties-at. Here's its docstring (C-h f text-properties-at): text-properties-at is a built-in function in ‘C source code’. (text-properties-at POSITION &optional OBJECT) Return the list of properties of the character at POSITION in OBJECT. If the ...


2

This complements the answer given by @Tobias, where it is explained how org-mode removes the display property. One way to get around this is to use the variable char-property-alias-alist. It is used by Emacs to make one property to behave like another property. If you add (display my-display) to this list, you can set the property my-display on text and it ...


1

An overlay can have property modification-hooks, which specifies particular hooks. Buffer text or a string can have text property modification-hooks, which is similar but slightly different. See the Elisp manual: Node Overlay Properties Node Special Properties There you'll see how inhibit-modification-hooks relates to these properties.


1

I had the same question for a long time. I don't know a "native" solution but a work-around using (format "%S" ...): (propertize "hello" 'face 'italic) ;; => #("hello" 0 5 (face italic)) (substring (format "%S" (propertize "hello" 'face 'italic)) 1) ;; => "(\"hello\" 0 5 (face italic))" (cdr (read (substring (format "%S" (propertize "hello" 'face '...


1

I don't know how to get it in to both normal view and the agenda view. But, in case it's helpful, one simple way to get effort into headlines in to the agenda view at least, is to edit org-agenda-prefix-format. (Also with this, you are restricted as to where exactly you can place the effort indicator. The prefix is everything before the headline itself, ...


1

One easy solution is to use libraries zones.el and isearch-prop.el. zones.el is about defining and using sets of zones of contiguous text. In this case, you use only one zone, defined by the region. isearch-prop.el is about isearching text-property or overlay-property contexts. Visibility is just one kind of property. (You can do the same thing using just ...


1

Another answer: Using @Tobias's isearch-face-bold-p, but corrected per this answer to this: (defun isearch-face-bold-p (start end) "Return non-nil if face at START is bold." (save-excursion (goto-char start) (cl-some (lambda (face) (and face (face-bold-p face nil t))) (face-at-point nil t)))) You can do what you want using just C-z & ...


1

It seems it is intentional according to read-only's info manual (info "(elisp) Special Properties"): read-only Insertion next to a read-only character is an error if inserting ordinary text there would inherit the read-only property due to stickiness. Thus, you can control permission to insert next to read-only text by controlling the ...


Only top voted, non community-wiki answers of a minimum length are eligible