Re: file-error "not a regular file"

2016-01-04 Thread Peter Salazar
This seems to have done the trick! Thank you so much!

This is wrong for notmuch - you need to use `notmuch-mua-send' rather
> than calling `message-send' directly.



On Tue, Dec 29, 2015 at 4:48 PM, David Edmondson  wrote:

> On Tue, Dec 29 2015, Peter Salazar  wrote:
> > send-message-without-bullets simply turns off org-bullets-mode before
> doing
> > message-send, since org-bullets-mode seemed to be interfering with
> > org-mime-htmlize.
> >
> > (defun send-message-without-bullets ()
> >   (interactive)
> >   (remove-hook 'org-mode-hook 'org-bullets-mode)
> >   (message-send)
>
> This is wrong for notmuch - you need to use `notmuch-mua-send' rather
> than calling `message-send' directly.
>
> >   (add-hook 'org-mode-hook 'org-bullets-mode))
> >
> > I also have this:
> >
> > (setq message-send-hook (quote (org-mime-htmlize)))
> >
> >
> > On Tue, Dec 29, 2015 at 3:44 PM, David Bremner 
> wrote:
> >
> >> Peter Salazar  writes:
> >>
> >>
> >> > Yes, following your steps, emacs -q followed by "M-x load-library
> >> 
> >> > notmuch", I was able to send an email without the error. It prompted
> me
> >> for
> >> > my smtp server, username, and password, then returned this:
> >> >
> >>
> >> [snip]
> >> > Does this give us any leads?
> >>
> >> It seems to be some interaction with your configuration. I'm not
> >> familiar with this "send-message-without-bullets" function. Perhaps you
> >> could point us to the source?
> >>
> >> d
> >>
> >>
> > ___
> > notmuch mailing list
> > notmuch@notmuchmail.org
> > https://notmuchmail.org/mailman/listinfo/notmuch
>
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH v5] devel/emacs: add devel/try-emacs-mua

2016-01-04 Thread Michal Sojka
Hi Tomi,

this looks almost good. A few minor comments below.

On Mon, Jan 04 2016, Tomi Ollila wrote:
> devel/try-emacs-mua provides an easy way to try and experiment
> with the notmuch emacs client distributed in emacs subdirectory of
> the notmuch source tree.
>
> try-emacs-mua starts a new emacs process and if initial checks pass
> *scratch* buffer is filled with information of how to begin.
>
> Normal emacs command line arguments can be used, like -q or -Q.
> These arguments are appended verbatim to the starting emacs process.
>
> If the emacs version in use is smaller than 24.4, special care is taken
> to ensure that notmuch*.elc files older than corresponding .el files
> are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
> takes care of this.
> ---
>
> Thanks to Michal for review of v4
> id:1450610032-23776-1-git-send-email-tomi.oll...@iki.fi
> in id:87vb7aco77@steelpick.2x.cz
>
> This should address the issues:
>
> 1) no more command line filtering
> 2) dropped (outcommented) file-truename advising
> 3) added information which notmuch binary is used
> 4) dropped popping messages buffer (fixing 2 issues)
>
> Added:
> * code to load ~/.emacs.d/notmuch-config.el if exists and not loaded already
> * pop messages buffer if (require 'notmuch) fails
> * don't suggest package-initialize if emacs version is 23
>
>
>  devel/try-emacs-mua | 156 
> 
>  1 file changed, 156 insertions(+)
>  create mode 100755 devel/try-emacs-mua
>
> diff --git a/devel/try-emacs-mua b/devel/try-emacs-mua
> new file mode 100755
> index ..0236b438c30a
> --- /dev/null
> +++ b/devel/try-emacs-mua
> @@ -0,0 +1,156 @@
> +#!/bin/sh
> +:; set -x; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit
> +;;
> +;; Try the notmuch emacs client located in ../notmuch/emacs directory
> +;;
> +;; Run this without arguments; emacs window opens with some usage information
> +;;
> +;; Authors: Tomi Ollila 
> +;;
> +;; http://www.emacswiki.org/emacs/EmacsScripts was a useful starting point...
> +;;
> +;; Licence: GPLv3+
> +;;
> +
> +(message "Starting '%s'" load-file-name)
> +
> +(set-buffer "*scratch*")
> +
> +(setq initial-buffer-choice t) ;; *scratch* buffer

After initial tuning of emacs configuration according to the hints in
the scratch buffer, people might want to automate things. For example
something like:

devel/try-emacs-mua -q -f notmuch-hello

This does not work as one would expect, because the notmuch-hello buffer
is buried under the *scratch* buffer. To get the hello screen after the
start one has to run:

devel/try-emacs-mua -q -f notmuch-hello --eval '(setq initial-buffer-choice 
nil)'

This could be also documented in the scratch buffer. Or it might be
easier, in this case, to run emacs without this script at all. There
will be no logging, but this might be OK for some people.

Actually I don't know who are you writing this script for? For notmuch
developers or for users who want to debug or test development version? 

> +
> +(when (featurep 'notmuch)
> +  (insert "
> +Notmuch has been loaded to this emacs (during processing of the init file)
> +which means it is (most probably) loaded from different source than expected.
> +
> +Please run \"" (file-name-nondirectory load-file-name)
> +"\" with '-q' (or '-Q') as an argument, to disable
> +processing of the init file -- you can load it after emacs has started\n
> +exit emacs (y or n)? ")
> +  (if (y-or-n-p "exit emacs")
> +  (kill-emacs)
> +(error "Stopped reading %s" load-file-name)))
> +
> +(let ((pdir (file-name-directory
> +  (directory-file-name (file-name-directory load-file-name)
> +  (unless (file-exists-p (concat pdir "emacs/notmuch-lib.el"))
> +(insert "Cannot find notmuch-emacs source directory
> +while looking at: " pdir "emacs\n\nexit emacs (y or n)? ")
> +(if (y-or-n-p "exit emacs")
> + (kill-emacs)
> +  (error "Stopped reading %s" load-file-name)))
> +  (setq try-notmuch-source-directory (directory-file-name pdir))
> +  (setq try-notmuch-emacs-directory (concat pdir "emacs/"))
> +  (setq load-path (cons try-notmuch-emacs-directory load-path)))
> +
> +;; they say advice doesn't work for primitives (functions from c source)
> +;; well, these 'before' advice works for emacs 23.1 - 24.5 (at least)
> +;; ...and for our purposes 24.3 is enough (there is no load-prefer-newer 
> there)
> +;; note also that the old, "obsolete" defadvice mechanism was used, but that
> +;; is the only one available for emacs 23 and 24 up to 24.3.
> +
> +(if (boundp 'load-prefer-newer)
> +(defadvice require (before before-require activate)
> +  (unless (featurep feature)
> + (message "require: %s" feature)))
> +  ;; else: special require "short-circuit"; after load feature is provided...
> +  ;; ... in notmuch sources we always use require and there are no loops
> +  (defadvice require (before before-require activate)
> +

Re: Two Questions

2016-01-04 Thread MaDhAt2r


On Jan 04 at 04:50 PM, Tomi Ollila  said thus:
> On Tue, Jan 05 2016, MaDhAt2r  wrote:
>
>> Hello All!
>>
>> I have been using notmuch/emacs for about two years now. I of course
>> love the setup, but there have always been two main issues I have yet to
>> find a solution for. I am hoping someone on here has found some answers.
>>
>> 1. How to change the time/date to use 12h format in all displays.
>
> This probably requires some coding...
That is too bad, but this was just an annoyance, so oh well.
>
>> 2. How to handle mailto:// hyperlinks and force the use of emacs/notmuch
>
> You can try
>
> https://github.com/domo141/nottoomuch/blob/master/nottoomuch-emacs-mailto.rst
>

This worked great! Thanks!!
> (hmm, I wonder what happens if the link is mailto:// and not just mailto:)
>
>
> Tomi
>
>>
>> I am running on ArchLinux (4.1.15-1-lts kenel), Emacs 24.5.1, notmuch 0.21
>>
>> Thanks for your help!
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] devel/emacs: add devel/try-emacs-mua.sh

2016-01-04 Thread Michal Sojka
On Thu, Nov 12 2015, Mark Walters wrote:
>> devel/try-emacs-mua.sh provides an easy way to try and experiment with
>> the notmuch emacs client provided in emacs subdirectory of notmuch
>> source tree.

[...]

>
> I like this -- a nice simple way to get to a working but uncustomised
> test environment.
>
> I don't know how easy the following would be but one addition that I
> would find very useful would be a way to make this use the test
> corpus. This would be useful for giving a completely standard
> environment for interactive testing, but also for debugging what is
> going on when tests fail.

This is already possible. If a test fails, its working directory is not
deleted and you can run e.g. ./test/tmp.T310-emacs/run_emacs, where you
can interactively reproduce the test. What you miss compared to Tomi's
approach is the hint screen and extra logging.

BR
-Michal
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v5] devel/emacs: add devel/try-emacs-mua

2016-01-04 Thread Tomi Ollila
devel/try-emacs-mua provides an easy way to try and experiment
with the notmuch emacs client distributed in emacs subdirectory of
the notmuch source tree.

try-emacs-mua starts a new emacs process and if initial checks pass
*scratch* buffer is filled with information of how to begin.

Normal emacs command line arguments can be used, like -q or -Q.
These arguments are appended verbatim to the starting emacs process.

If the emacs version in use is smaller than 24.4, special care is taken
to ensure that notmuch*.elc files older than corresponding .el files
are not loaded. Since emacs 24.4, setting `load-prefer-newer' variable
takes care of this.
---

Thanks to Michal for review of v4
id:1450610032-23776-1-git-send-email-tomi.oll...@iki.fi
in id:87vb7aco77@steelpick.2x.cz

This should address the issues:

1) no more command line filtering
2) dropped (outcommented) file-truename advising
3) added information which notmuch binary is used
4) dropped popping messages buffer (fixing 2 issues)

Added:
* code to load ~/.emacs.d/notmuch-config.el if exists and not loaded already
* pop messages buffer if (require 'notmuch) fails
* don't suggest package-initialize if emacs version is 23


 devel/try-emacs-mua | 156 
 1 file changed, 156 insertions(+)
 create mode 100755 devel/try-emacs-mua

diff --git a/devel/try-emacs-mua b/devel/try-emacs-mua
new file mode 100755
index ..0236b438c30a
--- /dev/null
+++ b/devel/try-emacs-mua
@@ -0,0 +1,156 @@
+#!/bin/sh
+:; set -x; exec "${EMACS:-emacs}" --debug-init --load "$0" "$@"; exit
+;;
+;; Try the notmuch emacs client located in ../notmuch/emacs directory
+;;
+;; Run this without arguments; emacs window opens with some usage information
+;;
+;; Authors: Tomi Ollila 
+;;
+;; http://www.emacswiki.org/emacs/EmacsScripts was a useful starting point...
+;;
+;; Licence: GPLv3+
+;;
+
+(message "Starting '%s'" load-file-name)
+
+(set-buffer "*scratch*")
+
+(setq initial-buffer-choice t) ;; *scratch* buffer
+
+(when (featurep 'notmuch)
+  (insert "
+Notmuch has been loaded to this emacs (during processing of the init file)
+which means it is (most probably) loaded from different source than expected.
+
+Please run \"" (file-name-nondirectory load-file-name)
+"\" with '-q' (or '-Q') as an argument, to disable
+processing of the init file -- you can load it after emacs has started\n
+exit emacs (y or n)? ")
+  (if (y-or-n-p "exit emacs")
+  (kill-emacs)
+(error "Stopped reading %s" load-file-name)))
+
+(let ((pdir (file-name-directory
+(directory-file-name (file-name-directory load-file-name)
+  (unless (file-exists-p (concat pdir "emacs/notmuch-lib.el"))
+(insert "Cannot find notmuch-emacs source directory
+while looking at: " pdir "emacs\n\nexit emacs (y or n)? ")
+(if (y-or-n-p "exit emacs")
+   (kill-emacs)
+  (error "Stopped reading %s" load-file-name)))
+  (setq try-notmuch-source-directory (directory-file-name pdir))
+  (setq try-notmuch-emacs-directory (concat pdir "emacs/"))
+  (setq load-path (cons try-notmuch-emacs-directory load-path)))
+
+;; they say advice doesn't work for primitives (functions from c source)
+;; well, these 'before' advice works for emacs 23.1 - 24.5 (at least)
+;; ...and for our purposes 24.3 is enough (there is no load-prefer-newer there)
+;; note also that the old, "obsolete" defadvice mechanism was used, but that
+;; is the only one available for emacs 23 and 24 up to 24.3.
+
+(if (boundp 'load-prefer-newer)
+(defadvice require (before before-require activate)
+  (unless (featurep feature)
+   (message "require: %s" feature)))
+  ;; else: special require "short-circuit"; after load feature is provided...
+  ;; ... in notmuch sources we always use require and there are no loops
+  (defadvice require (before before-require activate)
+(unless (featurep feature)
+  (message "require: %s" feature)
+  (let ((name (symbol-name feature)))
+   (if (and (string-match "^notmuch" name)
+(file-newer-than-file-p
+ (concat try-notmuch-emacs-directory name ".el")
+ (concat try-notmuch-emacs-directory name ".elc")))
+   (load (concat try-notmuch-emacs-directory name ".el") nil nil t t)
+ )
+
+(insert "Found notmuch emacs client in " try-notmuch-emacs-directory "\n")
+
+(let ((notmuch-path (executable-find "notmuch")))
+  (insert "Notmuch cli executable "
+ (if notmuch-path (concat "is " notmuch-path) "not found!") "\n"))
+
+(condition-case err
+;; "opportunistic" load-prefer-newer -- will be effective since emacs 24.4
+(let ((load-prefer-newer t)
+ (force-load-messages t))
+  (require 'notmuch))
+  ;; specifying `debug' here lets the debugger run
+  ;; if `debug-on-error' is non-nil.
+  ((debug error)
+   (let ((error-message-string (error-message-string err)))
+ (insert "\nLoading notmuch failed: " error-message-string 

Two Questions

2016-01-04 Thread MaDhAt2r

Hello All!

I have been using notmuch/emacs for about two years now. I of course
love the setup, but there have always been two main issues I have yet to
find a solution for. I am hoping someone on here has found some answers.

1. How to change the time/date to use 12h format in all displays.

2. How to handle mailto:// hyperlinks and force the use of emacs/notmuch

I am running on ArchLinux (4.1.15-1-lts kenel), Emacs 24.5.1, notmuch 0.21

Thanks for your help!
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Two Questions

2016-01-04 Thread Tomi Ollila
On Tue, Jan 05 2016, MaDhAt2r  wrote:

> Hello All!
>
> I have been using notmuch/emacs for about two years now. I of course
> love the setup, but there have always been two main issues I have yet to
> find a solution for. I am hoping someone on here has found some answers.
>
> 1. How to change the time/date to use 12h format in all displays.

This probably requires some coding...

> 2. How to handle mailto:// hyperlinks and force the use of emacs/notmuch

You can try

https://github.com/domo141/nottoomuch/blob/master/nottoomuch-emacs-mailto.rst

(hmm, I wonder what happens if the link is mailto:// and not just mailto:)


Tomi

>
> I am running on ArchLinux (4.1.15-1-lts kenel), Emacs 24.5.1, notmuch 0.21
>
> Thanks for your help!
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 1/3] emacs: Fix mail composition under Emacs 23

2016-01-04 Thread David Bremner
Michal Sojka  writes:

> +(when return-action (nconc args '(return-action)))
> +(apply 'message-setup-1
> +;; The following sexp is copied from `message-mail'

> +(nconc
> + `((To . ,(or to "")) (Subject . ,(or subject "")))

I missed this the first time, but I a bit worried about this used of
nconc. It seems to fall under "A common pitfall is to use a quoted
constant list as a non-last argument to ‘nconc’"  (from the elisp
manual).  In any case it's not really performance critical code (I
guess?) so maybe we could just use append?

The other use of nconc is more understandable to me.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch