[PATCH v5 1/4] emacs: show: modify insert-part-header to save the button text

2012-12-21 Thread David Bremner
Mark Walters  writes:

> This just make notmuch-show-insert-part-header save the basic button
> text for parts as an attribute. This makes it simpler for the button
> action (added in a later patch) to reword the label as appropriate (eg
> append "(not shown)" or not as appropriate).

Pushed. At a quick try, it seems very nice. 

I had to rebase patch 2, please double check I didn't mangle something.

Also, definitely NEWS-worthy...

d


Re: [PATCH v5 1/4] emacs: show: modify insert-part-header to save the button text

2012-12-21 Thread David Bremner
Mark Walters markwalters1...@gmail.com writes:

 This just make notmuch-show-insert-part-header save the basic button
 text for parts as an attribute. This makes it simpler for the button
 action (added in a later patch) to reword the label as appropriate (eg
 append (not shown) or not as appropriate).

Pushed. At a quick try, it seems very nice. 

I had to rebase patch 2, please double check I didn't mangle something.

Also, definitely NEWS-worthy...

d
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v5 1/4] emacs: show: modify insert-part-header to save the button text

2012-12-18 Thread Mark Walters
This just make notmuch-show-insert-part-header save the basic button
text for parts as an attribute. This makes it simpler for the button
action (added in a later patch) to reword the label as appropriate (eg
append "(not shown)" or not as appropriate).
---
 emacs/notmuch-show.el |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4bdd5af..5248fba 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -483,17 +483,17 @@ message at DEPTH in the current thread."
 (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)

 (defun notmuch-show-insert-part-header (nth content-type declared-type 
 name comment)
-  (let ((button))
+  (let ((button)
+   (base-label (concat (when name (concat name ": "))
+   declared-type
+   (unless (string-equal declared-type content-type)
+ (concat " (as " content-type ")"))
+   comment)))
+
 (setq button
  (insert-button
-  (concat "[ "
-  (if name (concat name ": ") "")
-  declared-type
-  (if (not (string-equal declared-type content-type))
-  (concat " (as " content-type ")")
-"")
-  (or comment "")
-  " ]")
+  (concat "[ " base-label " ]")
+  :base-label base-label
   :type 'notmuch-show-part-button-type
   :notmuch-part nth
   :notmuch-filename name
-- 
1.7.9.1



[PATCH v5 1/4] emacs: show: modify insert-part-header to save the button text

2012-12-18 Thread Mark Walters
This just make notmuch-show-insert-part-header save the basic button
text for parts as an attribute. This makes it simpler for the button
action (added in a later patch) to reword the label as appropriate (eg
append (not shown) or not as appropriate).
---
 emacs/notmuch-show.el |   18 +-
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 4bdd5af..5248fba 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -483,17 +483,17 @@ message at DEPTH in the current thread.
 (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
 
 (defun notmuch-show-insert-part-header (nth content-type declared-type 
optional name comment)
-  (let ((button))
+  (let ((button)
+   (base-label (concat (when name (concat name : ))
+   declared-type
+   (unless (string-equal declared-type content-type)
+ (concat  (as  content-type )))
+   comment)))
+
 (setq button
  (insert-button
-  (concat [ 
-  (if name (concat name : ) )
-  declared-type
-  (if (not (string-equal declared-type content-type))
-  (concat  (as  content-type ))
-)
-  (or comment )
-   ])
+  (concat [  base-label  ])
+  :base-label base-label
   :type 'notmuch-show-part-button-type
   :notmuch-part nth
   :notmuch-filename name
-- 
1.7.9.1

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch