Skip to main content
Became Hot Network Question

When using the propertize function alone on an entire string, it works. How to return a string, after changing its different sections separately with add-face-text-property (probably later repeatedly on different sections)?

 (let ((heading "Heading [50%] [1/2]")) (concat ... (when heading ;; (propertize heading 'face 'header-line) (set-text-properties 0 (length heading) '(face header-line) heading) (add-face-text-property (string-match "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" heading 0) (match-end 0) `(:foreground ,(face-foreground (org-get-todo-face keyword) nil 1)) nil heading) ) ) ) 
(let ((heading "Heading [50%] [1/2]")) (concat "..." (when heading ;; (propertize heading 'face 'header-line) (set-text-properties 0 (length heading) '(face header-line) heading) (add-face-text-property (string-match "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" heading 0) (match-end 0) `(:foreground ,(face-foreground (org-get-todo-face keyword) nil 1)) nil heading)))) 

When using the propertize function alone on an entire string, it works. How to return a string, after changing its different sections separately with add-face-text-property (probably later repeatedly on different sections)?

 (let ((heading "Heading [50%] [1/2]")) (concat ... (when heading ;; (propertize heading 'face 'header-line) (set-text-properties 0 (length heading) '(face header-line) heading) (add-face-text-property (string-match "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" heading 0) (match-end 0) `(:foreground ,(face-foreground (org-get-todo-face keyword) nil 1)) nil heading) ) ) ) 

When using the propertize function alone on an entire string, it works. How to return a string, after changing its different sections separately with add-face-text-property (probably later repeatedly on different sections)?

(let ((heading "Heading [50%] [1/2]")) (concat "..." (when heading ;; (propertize heading 'face 'header-line) (set-text-properties 0 (length heading) '(face header-line) heading) (add-face-text-property (string-match "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" heading 0) (match-end 0) `(:foreground ,(face-foreground (org-get-todo-face keyword) nil 1)) nil heading)))) 
edited tags
Link
NickD
  • 36k
  • 4
  • 33
  • 50
Source Link

How to return "string" after changing it's text properties?

When using the propertize function alone on an entire string, it works. How to return a string, after changing its different sections separately with add-face-text-property (probably later repeatedly on different sections)?

 (let ((heading "Heading [50%] [1/2]")) (concat ... (when heading ;; (propertize heading 'face 'header-line) (set-text-properties 0 (length heading) '(face header-line) heading) (add-face-text-property (string-match "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)" heading 0) (match-end 0) `(:foreground ,(face-foreground (org-get-todo-face keyword) nil 1)) nil heading) ) ) )