Re: [PATCH] emacs: add function to toggle display of all multipart/alternative parts

2012-08-09 Thread Jameson Graef Rollins
On Mon, Jun 18 2012, Mark Walters  wrote:
> I agree with this cycling approach but I think it needs to be per
> message rather than per buffer. I attach a rather hacky attempt at this
> below: on minimal testing it seems to work. But the lisp is really a bit
> gross. In particular  I have no idea if I should be escaping the message
> ids (so this could break in unfortunate/insecure ways)

Thanks to broken Apple mail clients, I'm getting more and more messages
that have attachments hidden in multipart/"alternatives" to text/plain
parts.  So I would really like to revive this patch.

I just tested it and it still applies to current master, and actually
seems to work great.  'W' cycles through which part is displayed in the
current message.  Pretty much exactly what I want.

Mark seems to think this patch is less than ideal.  One issue is that
it's trying to store a setting for a single displayed message in a
variable of full buffer scope.  So he's storing a list of message ids
there:

> +(defvar notmuch-show-message-multipart/alternative nil)
> +(make-variable-buffer-local 'notmuch-show-message-multipart/alternative)
> +(put 'notmuch-show-message-multipart/alternative 'permanent-local t)
...
> + (lax-plist-put notmuch-show-message-multipart/alternative 
> (plist-get msg :id) 0)))

I can see that might get a little hairy.  Can any elisp experts out
there think of a better way to do this?  (actually, this is making me
again want a show mode that only displays one message at a time (which I
guess means I need to try pick again)).

jamie.


pgpUviqcHfzbW.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: add function to toggle display of all multipart/alternative parts

2012-08-09 Thread Jameson Graef Rollins
On Mon, Jun 18 2012, Mark Walters  wrote:
> I agree with this cycling approach but I think it needs to be per
> message rather than per buffer. I attach a rather hacky attempt at this
> below: on minimal testing it seems to work. But the lisp is really a bit
> gross. In particular  I have no idea if I should be escaping the message
> ids (so this could break in unfortunate/insecure ways)

Thanks to broken Apple mail clients, I'm getting more and more messages
that have attachments hidden in multipart/"alternatives" to text/plain
parts.  So I would really like to revive this patch.

I just tested it and it still applies to current master, and actually
seems to work great.  'W' cycles through which part is displayed in the
current message.  Pretty much exactly what I want.

Mark seems to think this patch is less than ideal.  One issue is that
it's trying to store a setting for a single displayed message in a
variable of full buffer scope.  So he's storing a list of message ids
there:

> +(defvar notmuch-show-message-multipart/alternative nil)
> +(make-variable-buffer-local 'notmuch-show-message-multipart/alternative)
> +(put 'notmuch-show-message-multipart/alternative 'permanent-local t)
...
> + (lax-plist-put notmuch-show-message-multipart/alternative 
> (plist-get msg :id) 0)))

I can see that might get a little hairy.  Can any elisp experts out
there think of a better way to do this?  (actually, this is making me
again want a show mode that only displays one message at a time (which I
guess means I need to try pick again)).

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120809/d468b6e2/attachment.pgp>


[PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Tomi Ollila
On Thu, Aug 09 2012, Austin Clements  wrote:

> Previously, the Emacs byte compiler produced the warning
>
> the function `remove-if-not' might not be defined at runtime.
>
> because we only required cl at compile-time (not runtime).  This fixes
> this warning by requiring cl at runtime, ensuring that the definition
> of remove-if-not is available.
> ---

LGTM. 

It took me a while to understand this. Now I just don't understand
how did this work before. And why (require 'cl) is enough as 
remove-if-not is defined in cl-seq.el -- cl-seq.el requires cl
but not vice-versa -- or at least I don't see that. Anyway
(require 'cl) is the common way.

Tomi

>  emacs/notmuch-lib.el |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 30db58f..900235b 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -24,7 +24,7 @@
>  (require 'mm-view)
>  (require 'mm-decode)
>  (require 'json)
> -(eval-when-compile (require 'cl))
> +(require 'cl)
>  
>  (defvar notmuch-command "notmuch"
>"Command to run the notmuch binary.")
> -- 
> 1.7.10
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Austin Clements
Quoth Jameson Graef Rollins on Aug 09 at 12:54 am:
> On Wed, Aug 08 2012, Austin Clements  wrote:
> > Previously, the Emacs byte compiler produced the warning
> >
> > the function `remove-if-not' might not be defined at runtime.
> >
> > because we only required cl at compile-time (not runtime).  This fixes
> > this warning by requiring cl at runtime, ensuring that the definition
> > of remove-if-not is available.
> > ---
> >  emacs/notmuch-lib.el |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> > index 30db58f..900235b 100644
> > --- a/emacs/notmuch-lib.el
> > +++ b/emacs/notmuch-lib.el
> > @@ -24,7 +24,7 @@
> >  (require 'mm-view)
> >  (require 'mm-decode)
> >  (require 'json)
> > -(eval-when-compile (require 'cl))
> > +(require 'cl)
> >  
> >  (defvar notmuch-command "notmuch"
> >"Command to run the notmuch binary.")
> 
> LGTM.  I think it would be good to finally just give in a require cl, so
> we can finally put to rest the long standing schizophrenia we've had in
> regards to using it, and maybe finally kill the compile warnings that
> keep popping up.

I think we already gave in [0], we just weren't very thorough about
it.

[0] id:"m262g864dz.fsf at wal122.wireless-pennnet.upenn.edu"


[PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Austin Clements
Quoth Tomi Ollila on Aug 09 at 10:46 am:
> On Thu, Aug 09 2012, Austin Clements  wrote:
> 
> > Previously, the Emacs byte compiler produced the warning
> >
> > the function `remove-if-not' might not be defined at runtime.
> >
> > because we only required cl at compile-time (not runtime).  This fixes
> > this warning by requiring cl at runtime, ensuring that the definition
> > of remove-if-not is available.
> > ---
> 
> LGTM. 
> 
> It took me a while to understand this. Now I just don't understand
> how did this work before. And why (require 'cl) is enough as 
> remove-if-not is defined in cl-seq.el -- cl-seq.el requires cl
> but not vice-versa -- or at least I don't see that. Anyway
> (require 'cl) is the common way.

This worked before in practice because 'cl is inevitably loaded by
some package, somewhere, but I'm sure it could be broken by a
sufficiently stripped down Emacs environment.

(require 'cl) is enough because cl.el contains
  (load "cl-loaddefs" nil 'quiet)
and cl-loaddefs.el defines an autoload for remove-if-not that in turn
loads cl-seq the first time remove-if-not is called.

In fact, we *can't* (require 'cl-seq) because cl-seq.el never (provide
'cl-seq)s.  We could (load ...) it, but the fact that it never
provides a package name strongly suggests that the division of cl into
separate files is an implementation detail.

> Tomi
> 
> >  emacs/notmuch-lib.el |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> > index 30db58f..900235b 100644
> > --- a/emacs/notmuch-lib.el
> > +++ b/emacs/notmuch-lib.el
> > @@ -24,7 +24,7 @@
> >  (require 'mm-view)
> >  (require 'mm-decode)
> >  (require 'json)
> > -(eval-when-compile (require 'cl))
> > +(require 'cl)
> >  
> >  (defvar notmuch-command "notmuch"
> >"Command to run the notmuch binary.")


Vim plugins

2012-08-09 Thread Sepp Tannhuber
Dear Anton,

for some reason the file did not exist here. Perhaps I deleted it accidentally. 
So I cloned the
repository again. And there it is.
Now I'm trying?if it is useful for me. I changed some code that I can use 
python-ranger to
attach files:
##
function! s:NM_compose_attach()

if filereadable('/tmp/chosendir')
silent !ranger --choosefiles=/tmp/chosenfiles --choosedir=/tmp/chosendir "$(cat 
/tmp/chosendir)"
else
silent !ranger --choosefiles=/tmp/chosenfiles --choosedir=/tmp/chosendir
endif
if filereadable('/tmp/chosenfiles')
let attachments = readfile('/tmp/chosenfiles')
call system('rm /tmp/chosenfiles')
for attach in attachments
python nm_vim.get_current_buffer().attach(vim.eval('attach'))
endfor
call append(10, map(attachments, '"Attach: ".escape(v:val," \t\\")'))
redraw!
endif
endfunction
##
It's even possible to mark and attach multiple files at once.

Is it possible suppress the message returned by
? ? python nm_vim.get_current_buffer()?
?
And do you have?an idea?what's the reason for the following message?

##
:call 33_NM_folders_show_search('') ? ? ? Exception in thread Thread-1: ? 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
Traceback (most recent call last):
? File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
? ? self.run()
? File "/usr/lib/python2.7/threading.py", line 504, in run
? ? self.__target(*self.__args, **self.__kwargs)
? File "/home/sepp/.vim/plugin/nm_vim.py", line 195, in _refresh_thread
? ? authors, subj, tags)).encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal 
not in range(128)
##

Thanks for your great work and support
Joseph


Re: [PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Austin Clements
Quoth Jameson Graef Rollins on Aug 09 at 12:54 am:
> On Wed, Aug 08 2012, Austin Clements  wrote:
> > Previously, the Emacs byte compiler produced the warning
> >
> > the function `remove-if-not' might not be defined at runtime.
> >
> > because we only required cl at compile-time (not runtime).  This fixes
> > this warning by requiring cl at runtime, ensuring that the definition
> > of remove-if-not is available.
> > ---
> >  emacs/notmuch-lib.el |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> > index 30db58f..900235b 100644
> > --- a/emacs/notmuch-lib.el
> > +++ b/emacs/notmuch-lib.el
> > @@ -24,7 +24,7 @@
> >  (require 'mm-view)
> >  (require 'mm-decode)
> >  (require 'json)
> > -(eval-when-compile (require 'cl))
> > +(require 'cl)
> >  
> >  (defvar notmuch-command "notmuch"
> >"Command to run the notmuch binary.")
> 
> LGTM.  I think it would be good to finally just give in a require cl, so
> we can finally put to rest the long standing schizophrenia we've had in
> regards to using it, and maybe finally kill the compile warnings that
> keep popping up.

I think we already gave in [0], we just weren't very thorough about
it.

[0] id:"m262g864dz@wal122.wireless-pennnet.upenn.edu"
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Austin Clements
Quoth Tomi Ollila on Aug 09 at 10:46 am:
> On Thu, Aug 09 2012, Austin Clements  wrote:
> 
> > Previously, the Emacs byte compiler produced the warning
> >
> > the function `remove-if-not' might not be defined at runtime.
> >
> > because we only required cl at compile-time (not runtime).  This fixes
> > this warning by requiring cl at runtime, ensuring that the definition
> > of remove-if-not is available.
> > ---
> 
> LGTM. 
> 
> It took me a while to understand this. Now I just don't understand
> how did this work before. And why (require 'cl) is enough as 
> remove-if-not is defined in cl-seq.el -- cl-seq.el requires cl
> but not vice-versa -- or at least I don't see that. Anyway
> (require 'cl) is the common way.

This worked before in practice because 'cl is inevitably loaded by
some package, somewhere, but I'm sure it could be broken by a
sufficiently stripped down Emacs environment.

(require 'cl) is enough because cl.el contains
  (load "cl-loaddefs" nil 'quiet)
and cl-loaddefs.el defines an autoload for remove-if-not that in turn
loads cl-seq the first time remove-if-not is called.

In fact, we *can't* (require 'cl-seq) because cl-seq.el never (provide
'cl-seq)s.  We could (load ...) it, but the fact that it never
provides a package name strongly suggests that the division of cl into
separate files is an implementation detail.

> Tomi
> 
> >  emacs/notmuch-lib.el |2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> > index 30db58f..900235b 100644
> > --- a/emacs/notmuch-lib.el
> > +++ b/emacs/notmuch-lib.el
> > @@ -24,7 +24,7 @@
> >  (require 'mm-view)
> >  (require 'mm-decode)
> >  (require 'json)
> > -(eval-when-compile (require 'cl))
> > +(require 'cl)
> >  
> >  (defvar notmuch-command "notmuch"
> >"Command to run the notmuch binary.")
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: Vim plugins

2012-08-09 Thread Sepp Tannhuber
Dear Anton,

for some reason the file did not exist here. Perhaps I deleted it accidentally. 
So I cloned the
repository again. And there it is.
Now I'm trying if it is useful for me. I changed some code that I can use 
python-ranger to
attach files:
##
function! s:NM_compose_attach()

if filereadable('/tmp/chosendir')
silent !ranger --choosefiles=/tmp/chosenfiles --choosedir=/tmp/chosendir "$(cat 
/tmp/chosendir)"
else
silent !ranger --choosefiles=/tmp/chosenfiles --choosedir=/tmp/chosendir
endif
if filereadable('/tmp/chosenfiles')
let attachments = readfile('/tmp/chosenfiles')
call system('rm /tmp/chosenfiles')
for attach in attachments
python nm_vim.get_current_buffer().attach(vim.eval('attach'))
endfor
call append(10, map(attachments, '"Attach: ".escape(v:val," \t\\")'))
redraw!
endif
endfunction
##
It's even possible to mark and attach multiple files at once.

Is it possible suppress the message returned by
    python nm_vim.get_current_buffer()?
 
And do you have an idea what's the reason for the following message?

##
:call 33_NM_folders_show_search('')       Exception in thread Thread-1:    
                            
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/sepp/.vim/plugin/nm_vim.py", line 195, in _refresh_thread
    authors, subj, tags)).encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal 
not in range(128)
##

Thanks for your great work and support
Joseph
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Jameson Graef Rollins
On Wed, Aug 08 2012, Austin Clements  wrote:
> Previously, the Emacs byte compiler produced the warning
>
> the function `remove-if-not' might not be defined at runtime.
>
> because we only required cl at compile-time (not runtime).  This fixes
> this warning by requiring cl at runtime, ensuring that the definition
> of remove-if-not is available.
> ---
>  emacs/notmuch-lib.el |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 30db58f..900235b 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -24,7 +24,7 @@
>  (require 'mm-view)
>  (require 'mm-decode)
>  (require 'json)
> -(eval-when-compile (require 'cl))
> +(require 'cl)
>  
>  (defvar notmuch-command "notmuch"
>"Command to run the notmuch binary.")

LGTM.  I think it would be good to finally just give in a require cl, so
we can finally put to rest the long standing schizophrenia we've had in
regards to using it, and maybe finally kill the compile warnings that
keep popping up.

jamie.


pgpXst7vhLvVJ.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Jameson Graef Rollins
On Wed, Aug 08 2012, Austin Clements  wrote:
> Previously, the Emacs byte compiler produced the warning
>
> the function `remove-if-not' might not be defined at runtime.
>
> because we only required cl at compile-time (not runtime).  This fixes
> this warning by requiring cl at runtime, ensuring that the definition
> of remove-if-not is available.
> ---
>  emacs/notmuch-lib.el |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 30db58f..900235b 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -24,7 +24,7 @@
>  (require 'mm-view)
>  (require 'mm-decode)
>  (require 'json)
> -(eval-when-compile (require 'cl))
> +(require 'cl)
>  
>  (defvar notmuch-command "notmuch"
>"Command to run the notmuch binary.")

LGTM.  I think it would be good to finally just give in a require cl, so
we can finally put to rest the long standing schizophrenia we've had in
regards to using it, and maybe finally kill the compile warnings that
keep popping up.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20120809/db08813f/attachment.pgp>


Re: [PATCH] emacs: Fix "not defined at runtime" warning

2012-08-09 Thread Tomi Ollila
On Thu, Aug 09 2012, Austin Clements  wrote:

> Previously, the Emacs byte compiler produced the warning
>
> the function `remove-if-not' might not be defined at runtime.
>
> because we only required cl at compile-time (not runtime).  This fixes
> this warning by requiring cl at runtime, ensuring that the definition
> of remove-if-not is available.
> ---

LGTM. 

It took me a while to understand this. Now I just don't understand
how did this work before. And why (require 'cl) is enough as 
remove-if-not is defined in cl-seq.el -- cl-seq.el requires cl
but not vice-versa -- or at least I don't see that. Anyway
(require 'cl) is the common way.

Tomi

>  emacs/notmuch-lib.el |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 30db58f..900235b 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -24,7 +24,7 @@
>  (require 'mm-view)
>  (require 'mm-decode)
>  (require 'json)
> -(eval-when-compile (require 'cl))
> +(require 'cl)
>  
>  (defvar notmuch-command "notmuch"
>"Command to run the notmuch binary.")
> -- 
> 1.7.10
>
> ___
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch