all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Samuel Wales <samologist@gmail.com>
To: Samuel Wales <samologist@gmail.com>, help-gnu-emacs@gnu.org
Subject: Re: remove all my added face text properties?
Date: Wed, 2 Nov 2022 22:04:10 -0700	[thread overview]
Message-ID: <CAJcAo8t3VqoN1wYTSZ7DydoHBVE941aE7FtDtb7Zs8w4TPLDKw@mail.gmail.com> (raw)
In-Reply-To: <Y19QxunsjDrJ9KRI@protected.localdomain>

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



      parent reply	other threads:[~2022-11-03  5:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJcAo8t3VqoN1wYTSZ7DydoHBVE941aE7FtDtb7Zs8w4TPLDKw@mail.gmail.com \
    --to=samologist@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.