* [PATCH] emacs: Fix applying stickiness to the :notmuch-part property
@ 2013-06-03 15:17 Austin Clements
2013-06-03 16:33 ` Mark Walters
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Austin Clements @ 2013-06-03 15:17 UTC (permalink / raw)
To: notmuch
Previously, we simply called pushnew to add :notmuch-part to the
front-sticky and rear-nonsticky text property lists. This works if
these are nil or lists, but they can also have the value t, meaning
that all properties are front-sticky/rear-nonsticky. In this case,
pushnew will signal an error because t is not a list. We never set
these properties to t ourselves, but since we apply these property
changes over arbitrary renderer output, we have to deal with this
possibility.
---
emacs/notmuch-show.el | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 5771950..83bb9ad 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part."
(notmuch-map-text-property beg (point) :notmuch-part
(lambda (v) (or v part)))
;; Make :notmuch-part front sticky and rear non-sticky so it stays
- ;; applied to the beginning of each line when we indent the message.
+ ;; applied to the beginning of each line when we indent the
+ ;; message. Since we're operating on arbitrary renderer output,
+ ;; watch out for sticky specs of t, which means all properties are
+ ;; front-sticky/rear-nonsticky.
(notmuch-map-text-property beg (point) 'front-sticky
- (lambda (v) (pushnew :notmuch-part v)))
+ (lambda (v) (if (listp v)
+ (pushnew :notmuch-part v)
+ v)))
(notmuch-map-text-property beg (point) 'rear-nonsticky
- (lambda (v) (pushnew :notmuch-part v)))))
+ (lambda (v) (if (listp v)
+ (pushnew :notmuch-part v)
+ v)))))
(defun notmuch-show-insert-body (msg body depth)
"Insert the body BODY at depth DEPTH in the current thread."
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property
2013-06-03 15:17 [PATCH] emacs: Fix applying stickiness to the :notmuch-part property Austin Clements
@ 2013-06-03 16:33 ` Mark Walters
2013-06-03 17:21 ` Tomi Ollila
2013-06-04 11:43 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: Mark Walters @ 2013-06-03 16:33 UTC (permalink / raw)
To: Austin Clements, notmuch
LGTM +1. This fixes the test failures (and errors in the emacs display) I was seeing on one of my systems.
Best wishes
Mark
Austin Clements <amdragon@MIT.EDU> writes:
> Previously, we simply called pushnew to add :notmuch-part to the
> front-sticky and rear-nonsticky text property lists. This works if
> these are nil or lists, but they can also have the value t, meaning
> that all properties are front-sticky/rear-nonsticky. In this case,
> pushnew will signal an error because t is not a list. We never set
> these properties to t ourselves, but since we apply these property
> changes over arbitrary renderer output, we have to deal with this
> possibility.
> ---
> emacs/notmuch-show.el | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 5771950..83bb9ad 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part."
> (notmuch-map-text-property beg (point) :notmuch-part
> (lambda (v) (or v part)))
> ;; Make :notmuch-part front sticky and rear non-sticky so it stays
> - ;; applied to the beginning of each line when we indent the message.
> + ;; applied to the beginning of each line when we indent the
> + ;; message. Since we're operating on arbitrary renderer output,
> + ;; watch out for sticky specs of t, which means all properties are
> + ;; front-sticky/rear-nonsticky.
> (notmuch-map-text-property beg (point) 'front-sticky
> - (lambda (v) (pushnew :notmuch-part v)))
> + (lambda (v) (if (listp v)
> + (pushnew :notmuch-part v)
> + v)))
> (notmuch-map-text-property beg (point) 'rear-nonsticky
> - (lambda (v) (pushnew :notmuch-part v)))))
> + (lambda (v) (if (listp v)
> + (pushnew :notmuch-part v)
> + v)))))
>
> (defun notmuch-show-insert-body (msg body depth)
> "Insert the body BODY at depth DEPTH in the current thread."
> --
> 1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property
2013-06-03 15:17 [PATCH] emacs: Fix applying stickiness to the :notmuch-part property Austin Clements
2013-06-03 16:33 ` Mark Walters
@ 2013-06-03 17:21 ` Tomi Ollila
2013-06-04 11:43 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2013-06-03 17:21 UTC (permalink / raw)
To: Austin Clements, notmuch
On Mon, Jun 03 2013, Austin Clements <amdragon@MIT.EDU> wrote:
> Previously, we simply called pushnew to add :notmuch-part to the
> front-sticky and rear-nonsticky text property lists. This works if
> these are nil or lists, but they can also have the value t, meaning
> that all properties are front-sticky/rear-nonsticky. In this case,
> pushnew will signal an error because t is not a list. We never set
> these properties to t ourselves, but since we apply these property
> changes over arbitrary renderer output, we have to deal with this
> possibility.
> ---
LGTM (took a while to understand :D).
Tomi
> emacs/notmuch-show.el | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 5771950..83bb9ad 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -846,11 +846,18 @@ If HIDE is non-nil then initially hide this part."
> (notmuch-map-text-property beg (point) :notmuch-part
> (lambda (v) (or v part)))
> ;; Make :notmuch-part front sticky and rear non-sticky so it stays
> - ;; applied to the beginning of each line when we indent the message.
> + ;; applied to the beginning of each line when we indent the
> + ;; message. Since we're operating on arbitrary renderer output,
> + ;; watch out for sticky specs of t, which means all properties are
> + ;; front-sticky/rear-nonsticky.
> (notmuch-map-text-property beg (point) 'front-sticky
> - (lambda (v) (pushnew :notmuch-part v)))
> + (lambda (v) (if (listp v)
> + (pushnew :notmuch-part v)
> + v)))
> (notmuch-map-text-property beg (point) 'rear-nonsticky
> - (lambda (v) (pushnew :notmuch-part v)))))
> + (lambda (v) (if (listp v)
> + (pushnew :notmuch-part v)
> + v)))))
>
> (defun notmuch-show-insert-body (msg body depth)
> "Insert the body BODY at depth DEPTH in the current thread."
> --
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] emacs: Fix applying stickiness to the :notmuch-part property
2013-06-03 15:17 [PATCH] emacs: Fix applying stickiness to the :notmuch-part property Austin Clements
2013-06-03 16:33 ` Mark Walters
2013-06-03 17:21 ` Tomi Ollila
@ 2013-06-04 11:43 ` David Bremner
2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2013-06-04 11:43 UTC (permalink / raw)
To: Austin Clements, notmuch
Austin Clements <amdragon@MIT.EDU> writes:
> Previously, we simply called pushnew to add :notmuch-part to the
> front-sticky and rear-nonsticky text property lists. This works if
> these are nil or lists, but they can also have the value t, meaning
> that all properties are front-sticky/rear-nonsticky. In this case,
> pushnew will signal an error because t is not a list. We never set
> these properties to t ourselves, but since we apply these property
> changes over arbitrary renderer output, we have to deal with this
> possibility.
Pushed,
d
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-04 11:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-03 15:17 [PATCH] emacs: Fix applying stickiness to the :notmuch-part property Austin Clements
2013-06-03 16:33 ` Mark Walters
2013-06-03 17:21 ` Tomi Ollila
2013-06-04 11:43 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.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).