* Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
@ 2013-09-01 19:13 Austin Clements
0 siblings, 0 replies; 7+ messages in thread
From: Austin Clements @ 2013-09-01 19:13 UTC (permalink / raw)
To: Jani Nikula; +Cc: notmuch
LGTM. Though, based on the zero, one, infinity principle, I suspect this is not the last we'll see of HIDE.
Jani Nikula <jani@nikula.org> wrote:
>In reply, insert quotable parts using notmuch-show-insert-bodypart
>instead of calling notmuch-mm-display-part-inline directly to render
>the quoted parts as they are rendered in show view.
>
>We use a temp buffer to not leak text properties from the show
>renderer into the reply. This way we also don't need to worry about
>narrowing or point placement. Credits to Mark Walters
><markwalters1009@gmail.com> and Austin Clements <amdragon@MIT.EDU> for
>getting this part straight.
>
>The notable change is that replies to text/calendar parts quote the
>pretty printed output of icalendar-import-buffer rather than the ugly
>raw vcalendar.
>
>---
>
>v2: use (narrow-to-region (point-min) (point)) in
>notmuch-mua-insert-quotable-part instead of adding the ugly recenter
>in notmuch-mua-reply. Thanks to Austin and Mark for figuring this out.
>
>v3: Incorporate id:87eh98twws.fsf@qmul.ac.uk from Mark
>---
> emacs/notmuch-mua.el | 17 +++++++++++------
> emacs/notmuch-show.el | 18 +++++++++++++-----
> 2 files changed, 24 insertions(+), 11 deletions(-)
>
>diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
>index 2baae5f..ff8149b 100644
>--- a/emacs/notmuch-mua.el
>+++ b/emacs/notmuch-mua.el
>@@ -28,6 +28,8 @@
>
> (eval-when-compile (require 'cl))
>
>+(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
>+
> ;;
>
> (defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
>@@ -128,12 +130,15 @@ list."
> collect part))
>
> (defun notmuch-mua-insert-quotable-part (message part)
>- (save-restriction
>- (narrow-to-region (point) (point))
>- (notmuch-mm-display-part-inline message part (plist-get part :id)
>- (plist-get part :content-type)
>- notmuch-show-process-crypto)
>- (goto-char (point-max))))
>+ ;; We don't want text properties leaking from the show renderer into
>+ ;; the reply so we use a temp buffer. Also we don't want hooks, such
>+ ;; as notmuch-wash-*, to be run on the quotable part so we set
>+ ;; notmuch-show-insert-text/plain-hook to nil.
>+ (insert (with-temp-buffer
>+ (let ((notmuch-show-insert-text/plain-hook nil))
>+ ;; Show the part but do not add buttons.
>+ (notmuch-show-insert-bodypart message part 0 'no-buttons))
>+ (buffer-substring-no-properties (point-min) (point-max)))))
>
> ;; There is a bug in emacs 23's message.el that results in a newline
> ;; not being inserted after the References header, so the next header
>diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
>index 2896aae..904b98e 100644
>--- a/emacs/notmuch-show.el
>+++ b/emacs/notmuch-show.el
>@@ -844,7 +844,11 @@ message at DEPTH in the current thread."
> (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
> "Insert the body part PART at depth DEPTH in the current thread.
>
>-If HIDE is non-nil then initially hide this part."
>+HIDE determines whether to show or hide the part and the button
>+as follows: If HIDE is nil, show the part and the button. If HIDE
>+is t, hide the part initially and show the button. If HIDE is
>+'no-buttons, show the part but do not add any buttons (this is
>+useful for quoting in replies)."
>
> (let* ((content-type (downcase (plist-get part :content-type)))
> (mime-type (or (and (string= content-type "application/octet-stream")
>@@ -854,15 +858,19 @@ If HIDE is non-nil then initially hide this part."
> content-type))
> (nth (plist-get part :id))
> (beg (point))
>- ;; We omit the part button for the first (or only) part if this is text/plain.
>- (button (unless (and (string= mime-type "text/plain") (<= nth 1))
>+ ;; Hide the part initially if HIDE is t.
>+ (show-part (not (equal hide t)))
>+ ;; We omit the part button for the first (or only) part if
>+ ;; this is text/plain, or HIDE is 'no-buttons.
>+ (button (unless (or (equal hide 'no-buttons)
>+ (and (string= mime-type "text/plain") (<= nth 1)))
> (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
> (content-beg (point)))
>
> ;; Store the computed mime-type for later use (e.g. by attachment handlers).
> (plist-put part :computed-type mime-type)
>
>- (if (not hide)
>+ (if show-part
> (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
> (button-put button :notmuch-lazy-part
> (list msg part mime-type nth depth button)))
>@@ -875,7 +883,7 @@ If HIDE is non-nil then initially hide this part."
> (insert "\n"))
> ;; We do not create the overlay for hidden (lazy) parts until
> ;; they are inserted.
>- (if (not hide)
>+ (if show-part
> (notmuch-show-create-part-overlays button content-beg (point))
> (save-excursion
> (notmuch-show-toggle-part-invisibility button)))
>--
>1.8.4.rc3
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
@ 2013-09-01 17:59 Jani Nikula
2013-09-01 18:03 ` Mark Walters
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jani Nikula @ 2013-09-01 17:59 UTC (permalink / raw)
To: notmuch
In reply, insert quotable parts using notmuch-show-insert-bodypart
instead of calling notmuch-mm-display-part-inline directly to render
the quoted parts as they are rendered in show view.
We use a temp buffer to not leak text properties from the show
renderer into the reply. This way we also don't need to worry about
narrowing or point placement. Credits to Mark Walters
<markwalters1009@gmail.com> and Austin Clements <amdragon@MIT.EDU> for
getting this part straight.
The notable change is that replies to text/calendar parts quote the
pretty printed output of icalendar-import-buffer rather than the ugly
raw vcalendar.
---
v2: use (narrow-to-region (point-min) (point)) in
notmuch-mua-insert-quotable-part instead of adding the ugly recenter
in notmuch-mua-reply. Thanks to Austin and Mark for figuring this out.
v3: Incorporate id:87eh98twws.fsf@qmul.ac.uk from Mark
---
emacs/notmuch-mua.el | 17 +++++++++++------
emacs/notmuch-show.el | 18 +++++++++++++-----
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2baae5f..ff8149b 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -28,6 +28,8 @@
(eval-when-compile (require 'cl))
+(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
+
;;
(defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
@@ -128,12 +130,15 @@ list."
collect part))
(defun notmuch-mua-insert-quotable-part (message part)
- (save-restriction
- (narrow-to-region (point) (point))
- (notmuch-mm-display-part-inline message part (plist-get part :id)
- (plist-get part :content-type)
- notmuch-show-process-crypto)
- (goto-char (point-max))))
+ ;; We don't want text properties leaking from the show renderer into
+ ;; the reply so we use a temp buffer. Also we don't want hooks, such
+ ;; as notmuch-wash-*, to be run on the quotable part so we set
+ ;; notmuch-show-insert-text/plain-hook to nil.
+ (insert (with-temp-buffer
+ (let ((notmuch-show-insert-text/plain-hook nil))
+ ;; Show the part but do not add buttons.
+ (notmuch-show-insert-bodypart message part 0 'no-buttons))
+ (buffer-substring-no-properties (point-min) (point-max)))))
;; There is a bug in emacs 23's message.el that results in a newline
;; not being inserted after the References header, so the next header
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 2896aae..904b98e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -844,7 +844,11 @@ message at DEPTH in the current thread."
(defun notmuch-show-insert-bodypart (msg part depth &optional hide)
"Insert the body part PART at depth DEPTH in the current thread.
-If HIDE is non-nil then initially hide this part."
+HIDE determines whether to show or hide the part and the button
+as follows: If HIDE is nil, show the part and the button. If HIDE
+is t, hide the part initially and show the button. If HIDE is
+'no-buttons, show the part but do not add any buttons (this is
+useful for quoting in replies)."
(let* ((content-type (downcase (plist-get part :content-type)))
(mime-type (or (and (string= content-type "application/octet-stream")
@@ -854,15 +858,19 @@ If HIDE is non-nil then initially hide this part."
content-type))
(nth (plist-get part :id))
(beg (point))
- ;; We omit the part button for the first (or only) part if this is text/plain.
- (button (unless (and (string= mime-type "text/plain") (<= nth 1))
+ ;; Hide the part initially if HIDE is t.
+ (show-part (not (equal hide t)))
+ ;; We omit the part button for the first (or only) part if
+ ;; this is text/plain, or HIDE is 'no-buttons.
+ (button (unless (or (equal hide 'no-buttons)
+ (and (string= mime-type "text/plain") (<= nth 1)))
(notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
(content-beg (point)))
;; Store the computed mime-type for later use (e.g. by attachment handlers).
(plist-put part :computed-type mime-type)
- (if (not hide)
+ (if show-part
(notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
(button-put button :notmuch-lazy-part
(list msg part mime-type nth depth button)))
@@ -875,7 +883,7 @@ If HIDE is non-nil then initially hide this part."
(insert "\n"))
;; We do not create the overlay for hidden (lazy) parts until
;; they are inserted.
- (if (not hide)
+ (if show-part
(notmuch-show-create-part-overlays button content-beg (point))
(save-excursion
(notmuch-show-toggle-part-invisibility button)))
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
2013-09-01 17:59 Jani Nikula
@ 2013-09-01 18:03 ` Mark Walters
2013-09-01 18:13 ` Tomi Ollila
2013-09-05 9:42 ` David Bremner
2 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2013-09-01 18:03 UTC (permalink / raw)
To: Jani Nikula, notmuch
This version gets a +1 from me
Mark
On Sun, 01 Sep 2013, Jani Nikula <jani@nikula.org> wrote:
> In reply, insert quotable parts using notmuch-show-insert-bodypart
> instead of calling notmuch-mm-display-part-inline directly to render
> the quoted parts as they are rendered in show view.
>
> We use a temp buffer to not leak text properties from the show
> renderer into the reply. This way we also don't need to worry about
> narrowing or point placement. Credits to Mark Walters
> <markwalters1009@gmail.com> and Austin Clements <amdragon@MIT.EDU> for
> getting this part straight.
>
> The notable change is that replies to text/calendar parts quote the
> pretty printed output of icalendar-import-buffer rather than the ugly
> raw vcalendar.
>
> ---
>
> v2: use (narrow-to-region (point-min) (point)) in
> notmuch-mua-insert-quotable-part instead of adding the ugly recenter
> in notmuch-mua-reply. Thanks to Austin and Mark for figuring this out.
>
> v3: Incorporate id:87eh98twws.fsf@qmul.ac.uk from Mark
> ---
> emacs/notmuch-mua.el | 17 +++++++++++------
> emacs/notmuch-show.el | 18 +++++++++++++-----
> 2 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 2baae5f..ff8149b 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -28,6 +28,8 @@
>
> (eval-when-compile (require 'cl))
>
> +(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
> +
> ;;
>
> (defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
> @@ -128,12 +130,15 @@ list."
> collect part))
>
> (defun notmuch-mua-insert-quotable-part (message part)
> - (save-restriction
> - (narrow-to-region (point) (point))
> - (notmuch-mm-display-part-inline message part (plist-get part :id)
> - (plist-get part :content-type)
> - notmuch-show-process-crypto)
> - (goto-char (point-max))))
> + ;; We don't want text properties leaking from the show renderer into
> + ;; the reply so we use a temp buffer. Also we don't want hooks, such
> + ;; as notmuch-wash-*, to be run on the quotable part so we set
> + ;; notmuch-show-insert-text/plain-hook to nil.
> + (insert (with-temp-buffer
> + (let ((notmuch-show-insert-text/plain-hook nil))
> + ;; Show the part but do not add buttons.
> + (notmuch-show-insert-bodypart message part 0 'no-buttons))
> + (buffer-substring-no-properties (point-min) (point-max)))))
>
> ;; There is a bug in emacs 23's message.el that results in a newline
> ;; not being inserted after the References header, so the next header
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 2896aae..904b98e 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -844,7 +844,11 @@ message at DEPTH in the current thread."
> (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
> "Insert the body part PART at depth DEPTH in the current thread.
>
> -If HIDE is non-nil then initially hide this part."
> +HIDE determines whether to show or hide the part and the button
> +as follows: If HIDE is nil, show the part and the button. If HIDE
> +is t, hide the part initially and show the button. If HIDE is
> +'no-buttons, show the part but do not add any buttons (this is
> +useful for quoting in replies)."
>
> (let* ((content-type (downcase (plist-get part :content-type)))
> (mime-type (or (and (string= content-type "application/octet-stream")
> @@ -854,15 +858,19 @@ If HIDE is non-nil then initially hide this part."
> content-type))
> (nth (plist-get part :id))
> (beg (point))
> - ;; We omit the part button for the first (or only) part if this is text/plain.
> - (button (unless (and (string= mime-type "text/plain") (<= nth 1))
> + ;; Hide the part initially if HIDE is t.
> + (show-part (not (equal hide t)))
> + ;; We omit the part button for the first (or only) part if
> + ;; this is text/plain, or HIDE is 'no-buttons.
> + (button (unless (or (equal hide 'no-buttons)
> + (and (string= mime-type "text/plain") (<= nth 1)))
> (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
> (content-beg (point)))
>
> ;; Store the computed mime-type for later use (e.g. by attachment handlers).
> (plist-put part :computed-type mime-type)
>
> - (if (not hide)
> + (if show-part
> (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
> (button-put button :notmuch-lazy-part
> (list msg part mime-type nth depth button)))
> @@ -875,7 +883,7 @@ If HIDE is non-nil then initially hide this part."
> (insert "\n"))
> ;; We do not create the overlay for hidden (lazy) parts until
> ;; they are inserted.
> - (if (not hide)
> + (if show-part
> (notmuch-show-create-part-overlays button content-beg (point))
> (save-excursion
> (notmuch-show-toggle-part-invisibility button)))
> --
> 1.8.4.rc3
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
2013-09-01 17:59 Jani Nikula
2013-09-01 18:03 ` Mark Walters
@ 2013-09-01 18:13 ` Tomi Ollila
2013-09-05 9:42 ` David Bremner
2 siblings, 0 replies; 7+ messages in thread
From: Tomi Ollila @ 2013-09-01 18:13 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Sun, Sep 01 2013, Jani Nikula <jani@nikula.org> wrote:
> In reply, insert quotable parts using notmuch-show-insert-bodypart
> instead of calling notmuch-mm-display-part-inline directly to render
> the quoted parts as they are rendered in show view.
>
> We use a temp buffer to not leak text properties from the show
> renderer into the reply. This way we also don't need to worry about
> narrowing or point placement. Credits to Mark Walters
> <markwalters1009@gmail.com> and Austin Clements <amdragon@MIT.EDU> for
> getting this part straight.
>
> The notable change is that replies to text/calendar parts quote the
> pretty printed output of icalendar-import-buffer rather than the ugly
> raw vcalendar.
LGTM.
Tomi
> ---
>
> v2: use (narrow-to-region (point-min) (point)) in
> notmuch-mua-insert-quotable-part instead of adding the ugly recenter
> in notmuch-mua-reply. Thanks to Austin and Mark for figuring this out.
>
> v3: Incorporate id:87eh98twws.fsf@qmul.ac.uk from Mark
> ---
> emacs/notmuch-mua.el | 17 +++++++++++------
> emacs/notmuch-show.el | 18 +++++++++++++-----
> 2 files changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 2baae5f..ff8149b 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -28,6 +28,8 @@
>
> (eval-when-compile (require 'cl))
>
> +(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
> +
> ;;
>
> (defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
> @@ -128,12 +130,15 @@ list."
> collect part))
>
> (defun notmuch-mua-insert-quotable-part (message part)
> - (save-restriction
> - (narrow-to-region (point) (point))
> - (notmuch-mm-display-part-inline message part (plist-get part :id)
> - (plist-get part :content-type)
> - notmuch-show-process-crypto)
> - (goto-char (point-max))))
> + ;; We don't want text properties leaking from the show renderer into
> + ;; the reply so we use a temp buffer. Also we don't want hooks, such
> + ;; as notmuch-wash-*, to be run on the quotable part so we set
> + ;; notmuch-show-insert-text/plain-hook to nil.
> + (insert (with-temp-buffer
> + (let ((notmuch-show-insert-text/plain-hook nil))
> + ;; Show the part but do not add buttons.
> + (notmuch-show-insert-bodypart message part 0 'no-buttons))
> + (buffer-substring-no-properties (point-min) (point-max)))))
>
> ;; There is a bug in emacs 23's message.el that results in a newline
> ;; not being inserted after the References header, so the next header
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 2896aae..904b98e 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -844,7 +844,11 @@ message at DEPTH in the current thread."
> (defun notmuch-show-insert-bodypart (msg part depth &optional hide)
> "Insert the body part PART at depth DEPTH in the current thread.
>
> -If HIDE is non-nil then initially hide this part."
> +HIDE determines whether to show or hide the part and the button
> +as follows: If HIDE is nil, show the part and the button. If HIDE
> +is t, hide the part initially and show the button. If HIDE is
> +'no-buttons, show the part but do not add any buttons (this is
> +useful for quoting in replies)."
>
> (let* ((content-type (downcase (plist-get part :content-type)))
> (mime-type (or (and (string= content-type "application/octet-stream")
> @@ -854,15 +858,19 @@ If HIDE is non-nil then initially hide this part."
> content-type))
> (nth (plist-get part :id))
> (beg (point))
> - ;; We omit the part button for the first (or only) part if this is text/plain.
> - (button (unless (and (string= mime-type "text/plain") (<= nth 1))
> + ;; Hide the part initially if HIDE is t.
> + (show-part (not (equal hide t)))
> + ;; We omit the part button for the first (or only) part if
> + ;; this is text/plain, or HIDE is 'no-buttons.
> + (button (unless (or (equal hide 'no-buttons)
> + (and (string= mime-type "text/plain") (<= nth 1)))
> (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
> (content-beg (point)))
>
> ;; Store the computed mime-type for later use (e.g. by attachment handlers).
> (plist-put part :computed-type mime-type)
>
> - (if (not hide)
> + (if show-part
> (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)
> (button-put button :notmuch-lazy-part
> (list msg part mime-type nth depth button)))
> @@ -875,7 +883,7 @@ If HIDE is non-nil then initially hide this part."
> (insert "\n"))
> ;; We do not create the overlay for hidden (lazy) parts until
> ;; they are inserted.
> - (if (not hide)
> + (if show-part
> (notmuch-show-create-part-overlays button content-beg (point))
> (save-excursion
> (notmuch-show-toggle-part-invisibility button)))
> --
> 1.8.4.rc3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
>
--
uussigu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
2013-09-01 17:59 Jani Nikula
2013-09-01 18:03 ` Mark Walters
2013-09-01 18:13 ` Tomi Ollila
@ 2013-09-05 9:42 ` David Bremner
2 siblings, 0 replies; 7+ messages in thread
From: David Bremner @ 2013-09-05 9:42 UTC (permalink / raw)
To: Jani Nikula, notmuch
Jani Nikula <jani@nikula.org> writes:
> In reply, insert quotable parts using notmuch-show-insert-bodypart
> instead of calling notmuch-mm-display-part-inline directly to render
> the quoted parts as they are rendered in show view.
pushed,
d
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
@ 2013-08-19 8:38 Jani Nikula
2013-08-23 14:50 ` Mark Walters
0 siblings, 1 reply; 7+ messages in thread
From: Jani Nikula @ 2013-08-19 8:38 UTC (permalink / raw)
To: notmuch
In reply, insert quotable parts using notmuch-show-insert-bodypart
instead of calling notmuch-mm-display-part-inline directly to render
the quoted parts as they are rendered in show view.
The notable change is that replies to text/calendar parts quote the
pretty printed output of icalendar-import-buffer rather than the ugly
raw vcalendar.
---
emacs/notmuch-mua.el | 7 ++++---
emacs/notmuch-show.el | 9 ++++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 2baae5f..24b0d0f 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -130,9 +130,10 @@ list."
(defun notmuch-mua-insert-quotable-part (message part)
(save-restriction
(narrow-to-region (point) (point))
- (notmuch-mm-display-part-inline message part (plist-get part :id)
- (plist-get part :content-type)
- notmuch-show-process-crypto)
+ ;; We don't want hooks, such as notmuch-wash-*, to be run on the
+ ;; quotable part.
+ (let ((notmuch-show-insert-text/plain-hook nil))
+ (notmuch-show-insert-bodypart message part 0 nil t))
(goto-char (point-max))))
;; There is a bug in emacs 23's message.el that results in a newline
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 82b70ba..1fb48aa 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -874,7 +874,7 @@ message at DEPTH in the current thread."
;; showable this returns nil.
(notmuch-show-create-part-overlays button part-beg part-end))))
-(defun notmuch-show-insert-bodypart (msg part depth &optional hide)
+(defun notmuch-show-insert-bodypart (msg part depth &optional hide quote)
"Insert the body part PART at depth DEPTH in the current thread.
If HIDE is non-nil then initially hide this part."
@@ -887,8 +887,11 @@ If HIDE is non-nil then initially hide this part."
content-type))
(nth (plist-get part :id))
(beg (point))
- ;; We omit the part button for the first (or only) part if this is text/plain.
- (button (unless (and (string= mime-type "text/plain") (<= nth 1))
+ ;; We omit the part button for the first (or only) part if
+ ;; this is text/plain, or we're inserting the part for
+ ;; quoting in reply.
+ (button (unless (or quote
+ (and (string= mime-type "text/plain") (<= nth 1)))
(notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
(content-beg (point)))
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] emacs: insert quotable parts in reply as they are displayed in show view
2013-08-19 8:38 Jani Nikula
@ 2013-08-23 14:50 ` Mark Walters
0 siblings, 0 replies; 7+ messages in thread
From: Mark Walters @ 2013-08-23 14:50 UTC (permalink / raw)
To: Jani Nikula, notmuch
Hi
On Mon, 19 Aug 2013, Jani Nikula <jani@nikula.org> wrote:
> In reply, insert quotable parts using notmuch-show-insert-bodypart
> instead of calling notmuch-mm-display-part-inline directly to render
> the quoted parts as they are rendered in show view.
>
> The notable change is that replies to text/calendar parts quote the
> pretty printed output of icalendar-import-buffer rather than the ugly
> raw vcalendar.
In general I like this.
I am slightly worried whether this changes replies to text/html message:
from code following I think it does not but I don't have enough
text/html messages to check this. (Note unless the user customises
notmuch-multipart/alternative-discouraged it definitely does not affect
multipart messages with a text/html alternative)
If someone who does have text/html messages could test that would be
very helpful.
Otherwise just a couple of nits in the code:
> ---
> emacs/notmuch-mua.el | 7 ++++---
> emacs/notmuch-show.el | 9 ++++++---
> 2 files changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
> index 2baae5f..24b0d0f 100644
> --- a/emacs/notmuch-mua.el
> +++ b/emacs/notmuch-mua.el
> @@ -130,9 +130,10 @@ list."
> (defun notmuch-mua-insert-quotable-part (message part)
> (save-restriction
> (narrow-to-region (point) (point))
> - (notmuch-mm-display-part-inline message part (plist-get part :id)
> - (plist-get part :content-type)
> - notmuch-show-process-crypto)
> + ;; We don't want hooks, such as notmuch-wash-*, to be run on the
> + ;; quotable part.
> + (let ((notmuch-show-insert-text/plain-hook nil))
> + (notmuch-show-insert-bodypart message part 0 nil t))
> (goto-char (point-max))))
>
> ;; There is a bug in emacs 23's message.el that results in a newline
notmuch-show-insert-bodypart might need to be declared in notmuch-mua.el
as I seem to get a compile warning.
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 82b70ba..1fb48aa 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -874,7 +874,7 @@ message at DEPTH in the current thread."
> ;; showable this returns nil.
> (notmuch-show-create-part-overlays button part-beg part-end))))
>
> -(defun notmuch-show-insert-bodypart (msg part depth &optional hide)
> +(defun notmuch-show-insert-bodypart (msg part depth &optional hide quote)
> "Insert the body part PART at depth DEPTH in the current thread.
>
> If HIDE is non-nil then initially hide this part."
> @@ -887,8 +887,11 @@ If HIDE is non-nil then initially hide this part."
> content-type))
> (nth (plist-get part :id))
> (beg (point))
> - ;; We omit the part button for the first (or only) part if this is text/plain.
> - (button (unless (and (string= mime-type "text/plain") (<= nth 1))
> + ;; We omit the part button for the first (or only) part if
> + ;; this is text/plain, or we're inserting the part for
> + ;; quoting in reply.
> + (button (unless (or quote
> + (and (string= mime-type "text/plain") (<= nth 1)))
Since quote is the name of a lisp function I would prefer some other name
for the variable. It is correct code as is but my eye sort of slipped
over the initial "or" and assumed quote was the function.
Best wishes
Mark
> (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))
> (content-beg (point)))
>
> --
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-05 9:43 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-01 19:13 [PATCH] emacs: insert quotable parts in reply as they are displayed in show view Austin Clements
-- strict thread matches above, loose matches on Subject: below --
2013-09-01 17:59 Jani Nikula
2013-09-01 18:03 ` Mark Walters
2013-09-01 18:13 ` Tomi Ollila
2013-09-05 9:42 ` David Bremner
2013-08-19 8:38 Jani Nikula
2013-08-23 14:50 ` Mark Walters
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).