From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Samuel Wales Newsgroups: gmane.emacs.help Subject: Re: remove all my added face text properties? Date: Wed, 2 Nov 2022 22:04:10 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16468"; mail-complaints-to="usenet@ciao.gmane.io" To: Samuel Wales , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 03 06:04:44 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oqSPD-00045N-KT for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 03 Nov 2022 06:04:43 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqSOo-0004Ph-8a; Thu, 03 Nov 2022 01:04:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqSOm-0004PI-BX for help-gnu-emacs@gnu.org; Thu, 03 Nov 2022 01:04:16 -0400 Original-Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqSOk-0005nt-FC for help-gnu-emacs@gnu.org; Thu, 03 Nov 2022 01:04:15 -0400 Original-Received: by mail-lf1-x12c.google.com with SMTP id d6so1012254lfs.10 for ; Wed, 02 Nov 2022 22:04:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=lG2yEpP6MuhepzkExHYZQb2NJOtVhTB5ZotwBM27Zzk=; b=CKShCK4Zpm9NLXUEQkbto6wQqjMVXF8h60ryPIofhtrv7ScRYBmoAR5BALEdqpUd0u sC42bNSBJB38KsFt70qVrMEExA4FlXd3Nvk6+B03KRqWHUQoTMtQd6XcmAoaZnLoZj93 yWV0AdRP5jrVGg9LH/8oB8sLHBp38LUCAZqDvwaGT1fZsbPYO2V2xSpJ8wMXaZ0XRhK3 5DBNVx3gbv7nBxmQ0elcciSYT0gfbqH3BX8RSnA5MYIe40Mr7zZc9djd8yIhvadLW/4h ftyCZujLWxKFOYS5swhtyCzX+8YDH03fd8elnIJdVJHzEfLsdEPSIH5HWmoi3txlcPLp cpXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lG2yEpP6MuhepzkExHYZQb2NJOtVhTB5ZotwBM27Zzk=; b=t5ae83H+7O6LEkhkdD1/MXv9/iV7ljbedafKlnGimqF+1fbBLzGKsWyuUasxPJYuh2 sbqwrMUd6Vv1PN99WLZ9bdiASUXQaL75BR1XPHp27mYEXyUh77w+8B3xTCs49BxyxlA/ 2ZvKe4W5TU7s31bo6H6/obi7OSbtdgbb8mHyLImBZGsxXuNWFK0RFIyzk7BugydqXExw 1EgRc4eLLirIDyo10nnrBYNBsrC+77TlCYYMU9iY+w6QJjcK2oZHbMkeqEJsAPT/t0L5 zI93RJc1qEMbdEGalkOfTeb8PBTHHzATVLKPWDO3xPIjDuclCE7c+M4Mq6TSL75TTZ/l QlXw== X-Gm-Message-State: ACrzQf1kTcWm7drYOsdFKejAUXs5k7UZLR+JfecGNjT6sgdypCb9eimD v5ikTQ7+0s0hINKnDmw70KKKqGpgBON/YOorCFo= X-Google-Smtp-Source: AMsMyM5ejRzEFerX+wyrSaWj3Ij5ShnoRMtMzqSWAT0D34H4DNd0NxDQHJEgqYoDS2hOHXmzrscEuJXVkmv7T41s/Fk= X-Received: by 2002:a05:6512:11c2:b0:4b0:12f5:280 with SMTP id h2-20020a05651211c200b004b012f50280mr11638166lfr.597.1667451851645; Wed, 02 Nov 2022 22:04:11 -0700 (PDT) Original-Received: by 2002:a05:6520:4af1:b0:22a:e96a:7f9b with HTTP; Wed, 2 Nov 2022 22:04:10 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=samologist@gmail.com; helo=mail-lf1-x12c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "help-gnu-emacs" Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140589 Archived-At: 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 wrote: > * Samuel Wales [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