emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] lisp/org.el: Fix removing timestamp overlays
@ 2024-08-26  4:22 Joseph Turner
  2024-08-26  5:03 ` Joseph Turner
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Turner @ 2024-08-26  4:22 UTC (permalink / raw)
  To: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 30 bytes --]

Thank you!  Cheers!  -Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org.el-Fix-removing-timestamp-overlays.patch --]
[-- Type: text/x-diff, Size: 849 bytes --]

From 2289e6cd9f27bee04fa9004d757b23d3f1ef9e9c Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 25 Aug 2024 21:20:06 -0700
Subject: [PATCH] lisp/org.el: Fix removing timestamp overlays

---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index d5c1dcb35..9e80c4b70 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14614,7 +14614,7 @@ (defun org-toggle-timestamp-overlays ()
     (let ((p (point-min)) (bmp (buffer-modified-p)))
       (while (setq p (next-single-property-change p 'display))
 	(when (and (get-text-property p 'display)
-		   (eq (get-text-property p 'face) 'org-date))
+		   (memq 'org-date (get-text-property p 'face)))
 	  (remove-text-properties
 	   p (setq p (next-single-property-change p 'display))
 	   '(display t))))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lisp/org.el: Fix removing timestamp overlays
  2024-08-26  4:22 [PATCH] lisp/org.el: Fix removing timestamp overlays Joseph Turner
@ 2024-08-26  5:03 ` Joseph Turner
  2024-09-01 14:55   ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Turner @ 2024-08-26  5:03 UTC (permalink / raw)
  To: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Thank you!  Cheers!  -Joseph
>
> [2. text/x-diff; 0001-lisp-org.el-Fix-removing-timestamp-overlays.patch]...

Woops!  The 'display text property may be symbol or list - here's a
better patch.

Thanks,

Joseph


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org.el-Fix-removing-timestamp-overlays.patch --]
[-- Type: text/x-diff, Size: 863 bytes --]

From 9351b3c8f960ac6d2fba3c2de0c46e8474719582 Mon Sep 17 00:00:00 2001
From: Joseph Turner <joseph@breatheoutbreathe.in>
Date: Sun, 25 Aug 2024 21:20:06 -0700
Subject: [PATCH] lisp/org.el: Fix removing timestamp overlays

---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index d5c1dcb35..24a32227c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14614,7 +14614,7 @@ (defun org-toggle-timestamp-overlays ()
     (let ((p (point-min)) (bmp (buffer-modified-p)))
       (while (setq p (next-single-property-change p 'display))
 	(when (and (get-text-property p 'display)
-		   (eq (get-text-property p 'face) 'org-date))
+		   (memq 'org-date (ensure-list (get-text-property p 'face))))
 	  (remove-text-properties
 	   p (setq p (next-single-property-change p 'display))
 	   '(display t))))
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lisp/org.el: Fix removing timestamp overlays
  2024-08-26  5:03 ` Joseph Turner
@ 2024-09-01 14:55   ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2024-09-01 14:55 UTC (permalink / raw)
  To: Joseph Turner; +Cc: Org Mode Mailing List

Joseph Turner <joseph@breatheoutbreathe.in> writes:

> Subject: [PATCH] lisp/org.el: Fix removing timestamp overlays

Thanks, although I believe that we can fix things even better.
(If I understand the problem you are trying to solve correctly; just in
case, please explain what you are trying to solve ;])

>  	(when (and (get-text-property p 'display)
> -		   (eq (get-text-property p 'face) 'org-date))
> +		   (memq 'org-date (ensure-list (get-text-property p 'face))))

Rather than relying upon fontification settings, we may modify
`org-display-custom-time' to put a special text property to mark the
overlayed timestamps. Then, searching for that property will give
reliable info on what is and what is not a time overlay.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-01 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  4:22 [PATCH] lisp/org.el: Fix removing timestamp overlays Joseph Turner
2024-08-26  5:03 ` Joseph Turner
2024-09-01 14:55   ` Ihor Radchenko

Code repositories for project(s) associated with this public inbox

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

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).