From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: Re: How to remove all text properties? Date: Sun, 13 Nov 2022 02:16:11 -0300 Message-ID: References: <2eca931bf774b4459744cabda9638c49.support1@rcdrun.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6074"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help GNU Emacs To: Jean Louis Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 13 06:16:55 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 1ou5MV-0001L5-0L for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 13 Nov 2022 06:16:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ou5M5-0004zE-UF; Sun, 13 Nov 2022 00:16:29 -0500 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 1ou5M4-0004z2-CF for help-gnu-emacs@gnu.org; Sun, 13 Nov 2022 00:16:28 -0500 Original-Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ou5M2-0006oC-8v for help-gnu-emacs@gnu.org; Sun, 13 Nov 2022 00:16:27 -0500 Original-Received: by mail-io1-xd2e.google.com with SMTP id s10so6155344ioa.5 for ; Sat, 12 Nov 2022 21:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0XsqOMk4K0NIZuaqXFxcqKjpn0s/4XXXKHDCNzW3LQs=; b=afj9McJZyp8CiG3YRqFFS2/dPK1nIAFDYdHeoDjd0GIIvn9iMZT1fVUw9oNXhcp4xe ZRwTvLRbSQZhq7LRObV9qw9nx2gWiOvcn0LSpVShmKVRPNzpl6s9RNQWbKymWwg7w/5x xgxWukbT9h30J/eBZVRHsxZJ0MRUnpkIvtYOiGoGlEuMhZYiIRm/49A94FlJG/S2WbGJ 3GgYewhPePCqdX9DeMpKLGrzvxSI86yEpUV/sMwkSj8OmKDcAn0TTgGAji4S8ox6xLj8 BJfSuLJanhyVWgP8TEzDCvRq1tq5orrnbOuAcwj61vhlOngWpq0Awl0BkpiWkbEt7jlo GDsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0XsqOMk4K0NIZuaqXFxcqKjpn0s/4XXXKHDCNzW3LQs=; b=VhgLfCDPbd+EupqqwYHkg/tQH5UZZVnFGjlw01j/t259GItPVpIDUtmKvwVFjQoHJ6 Wt70fGX8EP1dfaaRQtDkafy7CELYClgplBtqf3+ZYG7LsCSWHrnoisZ2+4YX12bHfc31 CyOA8JCyzBw/M5jRxa+Cwf8+wpDycuNU9mWPMb041uWvWV4Hq9g3EI0MLJZEt7a6b98Z 9t+TbSO9QegHl3SDJzgWFqCz5ZJqsxYre+fJL/l4qK3QmrS0sU5OzpdGa+2D0CEEfFk4 xlegUBoX3a0qvqpxtZFMDiqsk9hKmhrHc4Ab/G1WAltJD6hkpyuoJn0qxa4bR23ZUgaU tptw== X-Gm-Message-State: ANoB5pkoe0aYoJmf36m+ORJNVUJmojYo89SksUCBdVSagCA85uO0M/Oo JQaGQ74SlvKuPyRt5ocaPXIQGr+tybx8IHssomDt3gM+Sp0= X-Google-Smtp-Source: AA0mqf5pVh6jCqQvA7mACMeTfU/udnYSh4HuqeCWB2dHam/krF06AHeLoVebjHZzqLAok28obAyf/ftqxhckFrF217Q= X-Received: by 2002:a05:6638:35ac:b0:363:738a:bb7c with SMTP id v44-20020a05663835ac00b00363738abb7cmr3539664jal.227.1668316583358; Sat, 12 Nov 2022 21:16:23 -0800 (PST) In-Reply-To: <2eca931bf774b4459744cabda9638c49.support1@rcdrun.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::d2e; envelope-from=eduardoochs@gmail.com; helo=mail-io1-xd2e.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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140919 Archived-At: On Thu, 10 Nov 2022 at 01:26, Jean Louis wrote: > > The problem that I see is that my function above can revert text > properties in this *mail* buffer in major-mode =E2=87=92 mail-mode, but i= t > cannot revert text properties in emacs-lisp-mode, where "Hello" > becomes read, and then after reverting, the original snippet =E2=9F=A6 > (hyperscope 123) =E2=9F=A7 becomes red too. Hi Jean Louis, I saved this to the file /tmp/o, --snip--snip-- (defun rcd-insert-hello () (interactive) (insert-text-button "Hello" 'action (lambda (b) (message "Here")) 'follow-link t 'hyperscope-link 123)) (defun rcd-revert-source () (interactive) (let ((point (point))) (save-excursion (goto-char (point-min)) (let (my-prop) (while (setq my-prop (text-property-search-forward 'hyperscope-link)) (when my-prop (let ((begin (prop-match-beginning my-prop)) (end (prop-match-end my-prop)) (value (prop-match-value my-prop))) (set-text-properties (1- begin) end nil) (delete-region begin end) (goto-char begin) (insert (format "=E2=9F=A6 (hyperscope-link %s) =E2=9F=A7" va= lue))))))) (goto-char point))) ;; (rcd-insert-hello) ;; (rcd-revert-source) --snip--snip-- and then I tried this: 1. without changing its mode from fundamental-mode to something else I ran the two defuns and the (rcd-insert-hello); it inserted a button whose text was "Hello", 2. I ran my `find-eregionpp', defined here, (find-efunction 'find-eregionpp) (find-eev "eev-blinks.el" "find-eregionpp") http://angg.twu.net/eev-current/eev-blinks.el.html#find-eregionpp on the ")Hello\n", and saved its output in another file - I will discuss it soon, 3. I ran the (rcd-revert-source) - it converted the "Hello" to this: "=E2=9F=A6 (hyperscope-link 123) =E2=9F=A7" 4. I ran some undos to delete the "=E2=9F=A6 (hyperscope-link 123) =E2=9F= =A7" and the "Hello", 5. I ran `M-x emacs-lisp-mode', 6. I ran the (rcd-insert-hello) again. It inserted a button whose text was "Hello". That button worked as expected - typing RET on it ran (message "Here") - but it didn't look like a button: it was displayed in font-lock-comment-face, 7. I ran `M-x find-eregionpp' on the ")Hello\n" and saved its output in another file, 8. I ran the (rcd-revert-source). It worked as before - it converted the "Hello" to this: "=E2=9F=A6 (hyperscope-link 123) =E2=9F=A7" 9. I ran some undos. Here is the output of the `find-eregionpp's. The first one, that was run with the file in fundamental-mode, gave this: ((")") ("Hello" (action (lambda (b) (message "Here"))) (button (t)) (category default-button) (follow-link t) (hyperscope-link 123)) ("\n")) and the second one, that was run with the file in emacs-lisp-mode, gave this: ((")" (face font-lock-comment-face) (fontified t)) ("Hello" (action (lambda (b) (message "Here"))) (button (t)) (category default-button) (face font-lock-comment-face) (follow-link t) (fontified t) (hyperscope-link 123)) ("\n" (face font-lock-comment-face) (fontified t))) The difference was that in emacs-lisp-mode all three intervals had these extra properties: (face font-lock-comment-face) (fontified t) In fundamental-mode the face of the "Hello" was inherited from the `(category default-button)'. I found that face - `button' - with `C-u C-x =3D', but here are three low-level links that sort of point to that information: (find-egrep "grep --color=3Dauto -nH --null -e default-button *.el */*.el= ") (find-efile "button.el" "(put 'default-button 'face 'button)") (describe-text-category 'default-button) In emacs-lisp-mode the "Hello" had this among its text properties, (face font-lock-comment-face) and this took precedence over the face from the category. Does that help? Cheers, Eduardo Ochs http://angg.twu.net/eepitch.html