[PATCH v3 3/3] emacs: Don't insert a part header if it's the first part and text/*.

2012-02-12 Thread Mark Walters

On Sun, 12 Feb 2012 09:24:09 +, Mark Walters  
wrote:
> On Mon,  6 Feb 2012 15:39:08 +, David Edmondson  wrote:
> > Previously this logic applied only to text/plain. Allow it for other
> > text/* parts as well.
> 
> What is the reason for treating the first part differently? 
> 
> Personally, I would prefer to keep it as now since pressing v on the
> [text/html] `views' the message in my mailcap preferred html viewer
> which can be convenient.

Actually I experimented with this and if I remove the special case
totally (i.e., for text/plain as well) I get a button which lets me save
the text part of the email fixing the problem I mentioned in
id:"87y5tl3xz0.fsf at qmul.ac.uk"

I wonder if it would be possible to always include the button but
possibly at the end rather than the start of the message? Or possibly
add a view-mime-part-structure function which showed all the buttons.

Best wishes

Mark

> 
> Thanks
> 
> Mark
> 
> 
> > ---
> >  emacs/notmuch-show.el |9 -
> >  1 files changed, 4 insertions(+), 5 deletions(-)
> > 
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index ce79762..c60e613 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -412,7 +412,9 @@ CONTENT-TYPE parts."
> >  (defun notmuch-show-insert-part-header (nth content-type declared-type
> >  name comment
> >  button-parameters)
> > -  (unless (notmuch-show-hidden-part-header content-type)
> > +  (unless (or (notmuch-show-hidden-part-header content-type)
> > + (and (= nth 1)
> > +  (string-match "text/*" content-type)))
> >  (apply #'insert-button
> >(concat "[ "
> >(if name (concat name ": ") "")
> > @@ -703,10 +705,7 @@ current buffer, if possible."
> >  
> >  (defun notmuch-show-insert-part-text/plain (msg part content-type nth 
> > depth declared-type)
> >(let ((start (point)))
> > -;; If this text/plain part is not the first part in the message,
> > -;; insert a header to make this clear.
> > -(if (> nth 1)
> > -   (notmuch-show-insert-part-header nth declared-type content-type 
> > (plist-get part :filename)))
> > +(notmuch-show-insert-part-header nth declared-type content-type 
> > (plist-get part :filename))
> >  (insert (notmuch-show-get-bodypart-content msg part nth))
> >  (save-excursion
> >(save-restriction
> > -- 
> > 1.7.8.3
> > 
> > ___
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 3/3] emacs: Don't insert a part header if it's the first part and text/*.

2012-02-12 Thread Mark Walters
On Mon,  6 Feb 2012 15:39:08 +, David Edmondson  wrote:
> Previously this logic applied only to text/plain. Allow it for other
> text/* parts as well.

What is the reason for treating the first part differently? 

Personally, I would prefer to keep it as now since pressing v on the
[text/html] `views' the message in my mailcap preferred html viewer
which can be convenient.

Thanks

Mark


> ---
>  emacs/notmuch-show.el |9 -
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index ce79762..c60e613 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -412,7 +412,9 @@ CONTENT-TYPE parts."
>  (defun notmuch-show-insert-part-header (nth content-type declared-type
>name comment
>button-parameters)
> -  (unless (notmuch-show-hidden-part-header content-type)
> +  (unless (or (notmuch-show-hidden-part-header content-type)
> +   (and (= nth 1)
> +(string-match "text/*" content-type)))
>  (apply #'insert-button
>  (concat "[ "
>  (if name (concat name ": ") "")
> @@ -703,10 +705,7 @@ current buffer, if possible."
>  
>  (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth 
> declared-type)
>(let ((start (point)))
> -;; If this text/plain part is not the first part in the message,
> -;; insert a header to make this clear.
> -(if (> nth 1)
> - (notmuch-show-insert-part-header nth declared-type content-type 
> (plist-get part :filename)))
> +(notmuch-show-insert-part-header nth declared-type content-type 
> (plist-get part :filename))
>  (insert (notmuch-show-get-bodypart-content msg part nth))
>  (save-excursion
>(save-restriction
> -- 
> 1.7.8.3
> 
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3 3/3] emacs: Don't insert a part header if it's the first part and text/*.

2012-02-12 Thread Mark Walters
On Mon,  6 Feb 2012 15:39:08 +, David Edmondson d...@dme.org wrote:
 Previously this logic applied only to text/plain. Allow it for other
 text/* parts as well.

What is the reason for treating the first part differently? 

Personally, I would prefer to keep it as now since pressing v on the
[text/html] `views' the message in my mailcap preferred html viewer
which can be convenient.

Thanks

Mark


 ---
  emacs/notmuch-show.el |9 -
  1 files changed, 4 insertions(+), 5 deletions(-)
 
 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
 index ce79762..c60e613 100644
 --- a/emacs/notmuch-show.el
 +++ b/emacs/notmuch-show.el
 @@ -412,7 +412,9 @@ CONTENT-TYPE parts.
  (defun notmuch-show-insert-part-header (nth content-type declared-type
   optional name comment
   rest button-parameters)
 -  (unless (notmuch-show-hidden-part-header content-type)
 +  (unless (or (notmuch-show-hidden-part-header content-type)
 +   (and (= nth 1)
 +(string-match text/* content-type)))
  (apply #'insert-button
  (concat [ 
  (if name (concat name : ) )
 @@ -703,10 +705,7 @@ current buffer, if possible.
  
  (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth 
 declared-type)
(let ((start (point)))
 -;; If this text/plain part is not the first part in the message,
 -;; insert a header to make this clear.
 -(if ( nth 1)
 - (notmuch-show-insert-part-header nth declared-type content-type 
 (plist-get part :filename)))
 +(notmuch-show-insert-part-header nth declared-type content-type 
 (plist-get part :filename))
  (insert (notmuch-show-get-bodypart-content msg part nth))
  (save-excursion
(save-restriction
 -- 
 1.7.8.3
 
 ___
 notmuch mailing list
 notmuch@notmuchmail.org
 http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v3 3/3] emacs: Don't insert a part header if it's the first part and text/*.

2012-02-12 Thread Mark Walters

On Sun, 12 Feb 2012 09:24:09 +, Mark Walters markwalters1...@gmail.com 
wrote:
 On Mon,  6 Feb 2012 15:39:08 +, David Edmondson d...@dme.org wrote:
  Previously this logic applied only to text/plain. Allow it for other
  text/* parts as well.
 
 What is the reason for treating the first part differently? 
 
 Personally, I would prefer to keep it as now since pressing v on the
 [text/html] `views' the message in my mailcap preferred html viewer
 which can be convenient.

Actually I experimented with this and if I remove the special case
totally (i.e., for text/plain as well) I get a button which lets me save
the text part of the email fixing the problem I mentioned in
id:87y5tl3xz0@qmul.ac.uk

I wonder if it would be possible to always include the button but
possibly at the end rather than the start of the message? Or possibly
add a view-mime-part-structure function which showed all the buttons.

Best wishes

Mark

 
 Thanks
 
 Mark
 
 
  ---
   emacs/notmuch-show.el |9 -
   1 files changed, 4 insertions(+), 5 deletions(-)
  
  diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
  index ce79762..c60e613 100644
  --- a/emacs/notmuch-show.el
  +++ b/emacs/notmuch-show.el
  @@ -412,7 +412,9 @@ CONTENT-TYPE parts.
   (defun notmuch-show-insert-part-header (nth content-type declared-type
  optional name comment
  rest button-parameters)
  -  (unless (notmuch-show-hidden-part-header content-type)
  +  (unless (or (notmuch-show-hidden-part-header content-type)
  + (and (= nth 1)
  +  (string-match text/* content-type)))
   (apply #'insert-button
 (concat [ 
 (if name (concat name : ) )
  @@ -703,10 +705,7 @@ current buffer, if possible.
   
   (defun notmuch-show-insert-part-text/plain (msg part content-type nth 
  depth declared-type)
 (let ((start (point)))
  -;; If this text/plain part is not the first part in the message,
  -;; insert a header to make this clear.
  -(if ( nth 1)
  -   (notmuch-show-insert-part-header nth declared-type content-type 
  (plist-get part :filename)))
  +(notmuch-show-insert-part-header nth declared-type content-type 
  (plist-get part :filename))
   (insert (notmuch-show-get-bodypart-content msg part nth))
   (save-excursion
 (save-restriction
  -- 
  1.7.8.3
  
  ___
  notmuch mailing list
  notmuch@notmuchmail.org
  http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3 3/3] emacs: Don't insert a part header if it's the first part and text/*.

2012-02-06 Thread David Edmondson
Previously this logic applied only to text/plain. Allow it for other
text/* parts as well.
---
 emacs/notmuch-show.el |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index ce79762..c60e613 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -412,7 +412,9 @@ CONTENT-TYPE parts."
 (defun notmuch-show-insert-part-header (nth content-type declared-type
 name comment
 button-parameters)
-  (unless (notmuch-show-hidden-part-header content-type)
+  (unless (or (notmuch-show-hidden-part-header content-type)
+ (and (= nth 1)
+  (string-match "text/*" content-type)))
 (apply #'insert-button
   (concat "[ "
   (if name (concat name ": ") "")
@@ -703,10 +705,7 @@ current buffer, if possible."

 (defun notmuch-show-insert-part-text/plain (msg part content-type nth depth 
declared-type)
   (let ((start (point)))
-;; If this text/plain part is not the first part in the message,
-;; insert a header to make this clear.
-(if (> nth 1)
-   (notmuch-show-insert-part-header nth declared-type content-type 
(plist-get part :filename)))
+(notmuch-show-insert-part-header nth declared-type content-type (plist-get 
part :filename))
 (insert (notmuch-show-get-bodypart-content msg part nth))
 (save-excursion
   (save-restriction
-- 
1.7.8.3