[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: remove all my added face text properties?
From: |
Samuel Wales |
Subject: |
Re: remove all my added face text properties? |
Date: |
Wed, 2 Nov 2022 22:04:10 -0700 |
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