* [PATCH 1/2] emacs: remove some code duplication in notmuch-show
@ 2011-11-25 22:23 Dmitry Kurochkin
2011-11-25 22:23 ` [PATCH 2/2] emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822' Dmitry Kurochkin
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Dmitry Kurochkin @ 2011-11-25 22:23 UTC (permalink / raw)
To: notmuch
Add optional props argument to `notmuch-show-get-header'. Use it to
get headers in `notmuch-show-insert-part-multipart/signed' and
`notmuch-show-insert-part-multipart/encrypted'.
---
emacs/notmuch-show.el | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 7be88f8..bcc436f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -450,8 +450,7 @@ current buffer, if possible."
(button-put button 'face '(:foreground "blue"))
;; add signature status button if sigstatus provided
(if (plist-member part :sigstatus)
- (let* ((headers (plist-get msg :headers))
- (from (plist-get headers :From))
+ (let* ((from (notmuch-show-get-header :From msg))
(sigstatus (car (plist-get part :sigstatus))))
(notmuch-crypto-insert-sigstatus-button sigstatus from))
;; if we're not adding sigstatus, tell the user how they can get it
@@ -477,8 +476,7 @@ current buffer, if possible."
(notmuch-crypto-insert-encstatus-button encstatus)
;; add signature status button if sigstatus specified
(if (plist-member part :sigstatus)
- (let* ((headers (plist-get msg :headers))
- (from (plist-get headers :From))
+ (let* ((from (notmuch-show-get-header :From msg))
(sigstatus (car (plist-get part :sigstatus))))
(notmuch-crypto-insert-sigstatus-button sigstatus from))))
;; if we're not adding encstatus, tell the user how they can get it
@@ -1079,9 +1077,9 @@ All currently available key bindings:
"Return the filename of the current message."
(notmuch-show-get-prop :filename))
-(defun notmuch-show-get-header (header)
+(defun notmuch-show-get-header (header &optional props)
"Return the named header of the current message, if any."
- (plist-get (notmuch-show-get-prop :headers) header))
+ (plist-get (notmuch-show-get-prop :headers props) header))
(defun notmuch-show-get-cc ()
(notmuch-show-get-header :Cc))
--
1.7.7.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822'
2011-11-25 22:23 [PATCH 1/2] emacs: remove some code duplication in notmuch-show Dmitry Kurochkin
@ 2011-11-25 22:23 ` Dmitry Kurochkin
2011-11-28 2:30 ` [PATCH 1/2] emacs: remove some code duplication in notmuch-show Austin Clements
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Dmitry Kurochkin @ 2011-11-25 22:23 UTC (permalink / raw)
To: notmuch
An obvious cleanup. I wonder why there was no warning about this
during compilation.
---
emacs/notmuch-show.el | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index bcc436f..66c08cc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -509,7 +509,6 @@ current buffer, if possible."
(defun notmuch-show-insert-part-message/rfc822 (msg part content-type nth depth declared-type)
(notmuch-show-insert-part-header nth declared-type content-type nil)
(let* ((message (car (plist-get part :content)))
- (headers (plist-get message :headers))
(body (car (plist-get message :body)))
(start (point)))
--
1.7.7.3
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-25 22:23 [PATCH 1/2] emacs: remove some code duplication in notmuch-show Dmitry Kurochkin
2011-11-25 22:23 ` [PATCH 2/2] emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822' Dmitry Kurochkin
@ 2011-11-28 2:30 ` Austin Clements
2011-11-28 14:24 ` Jameson Graef Rollins
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Austin Clements @ 2011-11-28 2:30 UTC (permalink / raw)
To: Dmitry Kurochkin, notmuch
Both patches look good to me.
(I don't think the compiler could warn about the unused `headers'
binding even if it wanted to because of dynamic scoping.)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-25 22:23 [PATCH 1/2] emacs: remove some code duplication in notmuch-show Dmitry Kurochkin
2011-11-25 22:23 ` [PATCH 2/2] emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822' Dmitry Kurochkin
2011-11-28 2:30 ` [PATCH 1/2] emacs: remove some code duplication in notmuch-show Austin Clements
@ 2011-11-28 14:24 ` Jameson Graef Rollins
2011-11-28 18:11 ` Dmitry Kurochkin
2011-11-28 18:28 ` Austin Clements
2011-12-07 15:14 ` Dmitry Kurochkin
2011-12-08 1:02 ` David Bremner
4 siblings, 2 replies; 9+ messages in thread
From: Jameson Graef Rollins @ 2011-11-28 14:24 UTC (permalink / raw)
To: Dmitry Kurochkin, notmuch
[-- Attachment #1: Type: text/plain, Size: 591 bytes --]
On Sat, 26 Nov 2011 02:23:30 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> -(defun notmuch-show-get-header (header)
> +(defun notmuch-show-get-header (header &optional props)
> "Return the named header of the current message, if any."
> - (plist-get (notmuch-show-get-prop :headers) header))
> + (plist-get (notmuch-show-get-prop :headers props) header))
Hey, Dmitry. It looks like the new plist-get call is assuming props is
defined, but it looks like it's only optional in the argument list.
Wouldn't the function fail if the props argument is not supplied?
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-28 14:24 ` Jameson Graef Rollins
@ 2011-11-28 18:11 ` Dmitry Kurochkin
2011-11-28 18:28 ` Austin Clements
1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Kurochkin @ 2011-11-28 18:11 UTC (permalink / raw)
To: Jameson Graef Rollins, notmuch
Hi Jamie.
On Mon, 28 Nov 2011 06:24:19 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Sat, 26 Nov 2011 02:23:30 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > -(defun notmuch-show-get-header (header)
> > +(defun notmuch-show-get-header (header &optional props)
> > "Return the named header of the current message, if any."
> > - (plist-get (notmuch-show-get-prop :headers) header))
> > + (plist-get (notmuch-show-get-prop :headers props) header))
>
> Hey, Dmitry. It looks like the new plist-get call is assuming props is
> defined, but it looks like it's only optional in the argument list.
> Wouldn't the function fail if the props argument is not supplied?
>
If props is not supplied it is bound to nil. There is no special
"undefined" value.
Regards,
Dmitry
> jamie.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-28 14:24 ` Jameson Graef Rollins
2011-11-28 18:11 ` Dmitry Kurochkin
@ 2011-11-28 18:28 ` Austin Clements
2011-11-28 19:51 ` Jameson Graef Rollins
1 sibling, 1 reply; 9+ messages in thread
From: Austin Clements @ 2011-11-28 18:28 UTC (permalink / raw)
To: Jameson Graef Rollins; +Cc: notmuch
Quoth Jameson Graef Rollins on Nov 28 at 6:24 am:
> On Sat, 26 Nov 2011 02:23:30 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > -(defun notmuch-show-get-header (header)
> > +(defun notmuch-show-get-header (header &optional props)
> > "Return the named header of the current message, if any."
> > - (plist-get (notmuch-show-get-prop :headers) header))
> > + (plist-get (notmuch-show-get-prop :headers props) header))
>
> Hey, Dmitry. It looks like the new plist-get call is assuming props is
> defined, but it looks like it's only optional in the argument list.
> Wouldn't the function fail if the props argument is not supplied?
If props isn't provided, it'll be nil, so notmuch-show-get-prop will
also interpret its optional props argument as not being provided.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-28 18:28 ` Austin Clements
@ 2011-11-28 19:51 ` Jameson Graef Rollins
0 siblings, 0 replies; 9+ messages in thread
From: Jameson Graef Rollins @ 2011-11-28 19:51 UTC (permalink / raw)
To: Austin Clements; +Cc: notmuch
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
On Mon, 28 Nov 2011 13:28:55 -0500, Austin Clements <amdragon@MIT.EDU> wrote:
> If props isn't provided, it'll be nil, so notmuch-show-get-prop will
> also interpret its optional props argument as not being provided.
On Mon, 28 Nov 2011 22:11:43 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> If props is not supplied it is bound to nil. There is no special
> "undefined" value.
jinx!
Thanks for the clarification, guys. So this looks like a nice
simplification to me.
I'm surprised there are no other functions that could make use of this
newly modified notmuch-show-get-header...
jamie.
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-25 22:23 [PATCH 1/2] emacs: remove some code duplication in notmuch-show Dmitry Kurochkin
` (2 preceding siblings ...)
2011-11-28 14:24 ` Jameson Graef Rollins
@ 2011-12-07 15:14 ` Dmitry Kurochkin
2011-12-08 1:02 ` David Bremner
4 siblings, 0 replies; 9+ messages in thread
From: Dmitry Kurochkin @ 2011-12-07 15:14 UTC (permalink / raw)
To: David Bremner; +Cc: notmuch
David, this seems ready for push as well.
Regards,
Dmitry
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] emacs: remove some code duplication in notmuch-show
2011-11-25 22:23 [PATCH 1/2] emacs: remove some code duplication in notmuch-show Dmitry Kurochkin
` (3 preceding siblings ...)
2011-12-07 15:14 ` Dmitry Kurochkin
@ 2011-12-08 1:02 ` David Bremner
4 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2011-12-08 1:02 UTC (permalink / raw)
To: Dmitry Kurochkin, notmuch
On Sat, 26 Nov 2011 02:23:30 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> Add optional props argument to `notmuch-show-get-header'. Use it to
> get headers in `notmuch-show-insert-part-multipart/signed' and
> `notmuch-show-insert-part-multipart/encrypted'.
Pushed this series.
d
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-12-08 1:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-25 22:23 [PATCH 1/2] emacs: remove some code duplication in notmuch-show Dmitry Kurochkin
2011-11-25 22:23 ` [PATCH 2/2] emacs: remove unused variable in `notmuch-show-insert-part-message/rfc822' Dmitry Kurochkin
2011-11-28 2:30 ` [PATCH 1/2] emacs: remove some code duplication in notmuch-show Austin Clements
2011-11-28 14:24 ` Jameson Graef Rollins
2011-11-28 18:11 ` Dmitry Kurochkin
2011-11-28 18:28 ` Austin Clements
2011-11-28 19:51 ` Jameson Graef Rollins
2011-12-07 15:14 ` Dmitry Kurochkin
2011-12-08 1:02 ` 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).