* remove all my added face text properties?
@ 2022-10-31 2:57 Samuel Wales
2022-10-31 4:36 ` Jean Louis
0 siblings, 1 reply; 5+ messages in thread
From: Samuel Wales @ 2022-10-31 2:57 UTC (permalink / raw)
To: help-gnu-emacs
i set face properties in a roughly as follows:
(defun highlight-1 (extent)
(let ((p (point)))
;; fixme what do we do to =remove= all of these
;; added face properties in the buffer? we need
;; to do that when re-running this function to not
;; keep the old stuff around.
;;
;; get-text-property but we need to get all?
;; set-text-properties start end face?
(add-face-text-property p (+ extent p) '(:inverse-video t))))
what does one do to keep all the text properties, including face text
properties, in the buffer, as they were before i first highlighted
anyghing, while at the same time removing the face properties i added?
thank you.
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: remove all my added face text properties?
2022-10-31 2:57 remove all my added face text properties? Samuel Wales
@ 2022-10-31 4:36 ` Jean Louis
2022-10-31 11:30 ` Emanuel Berg
2022-11-03 5:04 ` Samuel Wales
0 siblings, 2 replies; 5+ messages in thread
From: Jean Louis @ 2022-10-31 4:36 UTC (permalink / raw)
To: Samuel Wales; +Cc: help-gnu-emacs
* Samuel Wales <samologist@gmail.com> [2022-10-31 05:58]:
> i set face properties in a roughly as follows:
>
> (defun highlight-1 (extent)
> (let ((p (point)))
> ;; fixme what do we do to =remove= all of these
> ;; added face properties in the buffer? we need
> ;; to do that when re-running this function to not
> ;; keep the old stuff around.
> ;;
> ;; get-text-property but we need to get all?
> ;; set-text-properties start end face?
> (add-face-text-property p (+ extent p) '(:inverse-video t))))
>
> what does one do to keep all the text properties, including face text
> properties, in the buffer, as they were before i first highlighted
> anyghing, while at the same time removing the face properties i added?
> thank you.
This function will take buffer text without properties and insert it
again. This will most probably remove your properties, and then
because of major mode again highlight whatever was highlighted.
(defun rcd-buffer-remove-properties (&optional text)
"Remove all properties for TEXT, otherwise buffer."
(interactive)
(let* ((buffer-or-text (if text nil t))
(text (if buffer-or-text (buffer-substring-no-properties (point-min) (point-max)) text))
(point (point)))
(erase-buffer)
(insert text)
(goto-char point)))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: remove all my added face text properties?
2022-10-31 4:36 ` Jean Louis
@ 2022-10-31 11:30 ` Emanuel Berg
2022-10-31 18:23 ` Jean Louis
2022-11-03 5:04 ` Samuel Wales
1 sibling, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2022-10-31 11:30 UTC (permalink / raw)
To: help-gnu-emacs
Jean Louis wrote:
> (if text nil t)
(not text)
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: remove all my added face text properties?
2022-10-31 4:36 ` Jean Louis
2022-10-31 11:30 ` Emanuel Berg
@ 2022-11-03 5:04 ` Samuel Wales
1 sibling, 0 replies; 5+ messages in thread
From: Samuel Wales @ 2022-11-03 5:04 UTC (permalink / raw)
To: Samuel Wales, help-gnu-emacs
your idea is that magit will add its face properties again? would
that be using normal-mode or somehing?
On 10/30/22, Jean Louis <bugs@gnu.support> wrote:
> * Samuel Wales <samologist@gmail.com> [2022-10-31 05:58]:
>> i set face properties in a roughly as follows:
>>
>> (defun highlight-1 (extent)
>> (let ((p (point)))
>> ;; fixme what do we do to =remove= all of these
>> ;; added face properties in the buffer? we need
>> ;; to do that when re-running this function to not
>> ;; keep the old stuff around.
>> ;;
>> ;; get-text-property but we need to get all?
>> ;; set-text-properties start end face?
>> (add-face-text-property p (+ extent p) '(:inverse-video
>> t))))
>>
>> what does one do to keep all the text properties, including face text
>> properties, in the buffer, as they were before i first highlighted
>> anyghing, while at the same time removing the face properties i added?
>> thank you.
>
> This function will take buffer text without properties and insert it
> again. This will most probably remove your properties, and then
> because of major mode again highlight whatever was highlighted.
>
> (defun rcd-buffer-remove-properties (&optional text)
> "Remove all properties for TEXT, otherwise buffer."
> (interactive)
> (let* ((buffer-or-text (if text nil t))
> (text (if buffer-or-text (buffer-substring-no-properties (point-min)
> (point-max)) text))
> (point (point)))
> (erase-buffer)
> (insert text)
> (goto-char point)))
>
> --
> Jean
>
> Take action in Free Software Foundation campaigns:
> https://www.fsf.org/campaigns
>
> In support of Richard M. Stallman
> https://stallmansupport.org/
>
--
The Kafka Pandemic
A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-03 5:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-31 2:57 remove all my added face text properties? Samuel Wales
2022-10-31 4:36 ` Jean Louis
2022-10-31 11:30 ` Emanuel Berg
2022-10-31 18:23 ` Jean Louis
2022-11-03 5:04 ` Samuel Wales
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).