unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v5] devel/emacs: add devel/try-emacs-mua
@ 2016-01-04 22:21 Tomi Ollila
  2016-01-04 23:19 ` Michal Sojka
  0 siblings, 1 reply; 3+ messages in thread
From: Tomi Ollila @ 2016-01-04 22:21 UTC (permalink / raw)
  To: notmuch, sojkam1; +Cc: 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.ollila@iki.fi
in id:87vb7aco77.fsf@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 000000000000..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 <tomi.ollila@iki.fi>
+;;
+;; 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 "\n")
+     (message "Loading notmuch failed: %s" error-message-string)
+     (insert "See *Messages* buffer for more information.\n")
+     (if init-file-user
+	 (message "Hint: %s -q (or -Q) may help" load-file-name))
+     (pop-to-buffer "*Messages*")
+     (error "Stopped reading %s" load-file-name))))
+
+(insert "
+Go to the end of the following lines and type C-x C-e to evaluate
+(or C-j which is shorter but inserts evaluation results into buffer)
+
+To \"disable\" mail sending, evaluate
+* (setq message-send-mail-function (lambda () t))
+")
+
+(if (file-exists-p (concat try-notmuch-source-directory "/notmuch"))
+    (insert "
+To use accompanied notmuch binary from the same source, evaluate
+* (setq exec-path (cons \"" try-notmuch-source-directory  "\" exec-path))
+Note: Evaluating the above may be followed by unintended database
+upgrade and getting back to old version may require dump & restore.
+"))
+
+(if init-file-user ;; nil, if '-q' or '-Q' is given, but no '-u' 'USER'
+    (insert "
+Your init file was processed during emacs startup. If you want to test
+notmuch emacs mail client without your emacs init file interfering, Run\n\""
+(file-name-nondirectory load-file-name) "\" with '-q' (or '-Q') as an argument.
+")
+  (let ((emacs-init-file-name) (notmuch-init-file-name))
+    ;; determining init file name in startup.el/command-line is too complicated
+    ;; to be duplicated here; these 3 file names covers most of the users
+    (mapc (lambda (fn) (if (file-exists-p fn) (setq emacs-init-file-name fn)))
+	  '("~/.emacs.d/init.el" "~/.emacs" "~/.emacs.el"))
+    (setq notmuch-init-file-name "~/.emacs.d/notmuch-config.el")
+    (unless (file-exists-p notmuch-init-file-name)
+	(setq notmuch-init-file-name nil))
+    (if (and emacs-init-file-name notmuch-init-file-name)
+	(insert "
+If you want to load your initialization files now, evaluate\n* (progn")
+      (if (or emacs-init-file-name notmuch-init-file-name)
+	  (insert "
+If you want to load your initialization file now, evaluate\n*")))
+    (if emacs-init-file-name
+	(insert " (load \"" emacs-init-file-name "\")"))
+    (if notmuch-init-file-name
+	(insert " (load \"" notmuch-init-file-name "\")"))
+    (if (and emacs-init-file-name notmuch-init-file-name)
+	(insert ")"))
+    (if (or emacs-init-file-name notmuch-init-file-name)
+	(insert "\n")))
+  (if (>= emacs-major-version 24)
+      (insert "
+If you want to use packages (e.g. company from elpa) evaluate
+* (progn (require 'package) (package-initialize))
+")))
+
+(insert "
+To start notmuch (hello) screen, evaluate
+* (notmuch-hello)")
+
+(add-hook 'emacs-startup-hook
+	  (lambda ()
+	    (set-buffer "*scratch*")
+	    (lisp-interaction-mode)
+	    (goto-char (point-min))
+	    (forward-line 2)
+	    (set-buffer-modified-p nil)))
+
+;; Local Variables:
+;; mode: emacs-lisp
+;; End:
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v5] devel/emacs: add devel/try-emacs-mua
  2016-01-04 22:21 [PATCH v5] devel/emacs: add devel/try-emacs-mua Tomi Ollila
@ 2016-01-04 23:19 ` Michal Sojka
  2016-01-05 20:36   ` Tomi Ollila
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Sojka @ 2016-01-04 23:19 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: tomi.ollila

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.ollila@iki.fi
> in id:87vb7aco77.fsf@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 000000000000..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 <tomi.ollila@iki.fi>
> +;;
> +;; 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)
> +    (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 "

Nitpick: I'd prefer CLI in all caps.

Thanks.
-Michal

> +	  (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 "\n")
> +     (message "Loading notmuch failed: %s" error-message-string)
> +     (insert "See *Messages* buffer for more information.\n")
> +     (if init-file-user
> +	 (message "Hint: %s -q (or -Q) may help" load-file-name))
> +     (pop-to-buffer "*Messages*")
> +     (error "Stopped reading %s" load-file-name))))
> +
> +(insert "
> +Go to the end of the following lines and type C-x C-e to evaluate
> +(or C-j which is shorter but inserts evaluation results into buffer)
> +
> +To \"disable\" mail sending, evaluate
> +* (setq message-send-mail-function (lambda () t))
> +")
> +
> +(if (file-exists-p (concat try-notmuch-source-directory "/notmuch"))
> +    (insert "
> +To use accompanied notmuch binary from the same source, evaluate
> +* (setq exec-path (cons \"" try-notmuch-source-directory  "\" exec-path))
> +Note: Evaluating the above may be followed by unintended database
> +upgrade and getting back to old version may require dump & restore.
> +"))
> +
> +(if init-file-user ;; nil, if '-q' or '-Q' is given, but no '-u' 'USER'
> +    (insert "
> +Your init file was processed during emacs startup. If you want to test
> +notmuch emacs mail client without your emacs init file interfering, Run\n\""
> +(file-name-nondirectory load-file-name) "\" with '-q' (or '-Q') as an argument.
> +")
> +  (let ((emacs-init-file-name) (notmuch-init-file-name))
> +    ;; determining init file name in startup.el/command-line is too complicated
> +    ;; to be duplicated here; these 3 file names covers most of the users
> +    (mapc (lambda (fn) (if (file-exists-p fn) (setq emacs-init-file-name fn)))
> +	  '("~/.emacs.d/init.el" "~/.emacs" "~/.emacs.el"))
> +    (setq notmuch-init-file-name "~/.emacs.d/notmuch-config.el")
> +    (unless (file-exists-p notmuch-init-file-name)
> +	(setq notmuch-init-file-name nil))
> +    (if (and emacs-init-file-name notmuch-init-file-name)
> +	(insert "
> +If you want to load your initialization files now, evaluate\n* (progn")
> +      (if (or emacs-init-file-name notmuch-init-file-name)
> +	  (insert "
> +If you want to load your initialization file now, evaluate\n*")))
> +    (if emacs-init-file-name
> +	(insert " (load \"" emacs-init-file-name "\")"))
> +    (if notmuch-init-file-name
> +	(insert " (load \"" notmuch-init-file-name "\")"))
> +    (if (and emacs-init-file-name notmuch-init-file-name)
> +	(insert ")"))
> +    (if (or emacs-init-file-name notmuch-init-file-name)
> +	(insert "\n")))
> +  (if (>= emacs-major-version 24)
> +      (insert "
> +If you want to use packages (e.g. company from elpa) evaluate
> +* (progn (require 'package) (package-initialize))
> +")))
> +
> +(insert "
> +To start notmuch (hello) screen, evaluate
> +* (notmuch-hello)")
> +
> +(add-hook 'emacs-startup-hook
> +	  (lambda ()
> +	    (set-buffer "*scratch*")
> +	    (lisp-interaction-mode)
> +	    (goto-char (point-min))
> +	    (forward-line 2)
> +	    (set-buffer-modified-p nil)))
> +
> +;; Local Variables:
> +;; mode: emacs-lisp
> +;; End:
> --
> 2.6.4

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v5] devel/emacs: add devel/try-emacs-mua
  2016-01-04 23:19 ` Michal Sojka
@ 2016-01-05 20:36   ` Tomi Ollila
  0 siblings, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2016-01-05 20:36 UTC (permalink / raw)
  To: Michal Sojka, notmuch

On Tue, Jan 05 2016, Michal Sojka <sojkam1@fel.cvut.cz> wrote:

> 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.ollila@iki.fi
>> in id:87vb7aco77.fsf@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 000000000000..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 <tomi.ollila@iki.fi>
>> +;;
>> +;; 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)'

Simpler is to change the above code line to:

(setq initial-buffer-choice nil
      inhibit-startup-screen t)

Now the visible buffer is *scratch* by default -- and works more closely
how emacs works normally.

> 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? 

First of all, for me & other notmuch developers. After a few months break
when I do some notmuch elisp coding and try to test it I hope I don't have
to remember so much setup things and if something initially goes wrong I
might get visible hints to the screen.

And also to users to test development version -- or any other version by
copying this file to notmuch/devel *OR* notmuch/emacs directory (works
from both locations). And when they run and get into problems, posting
the contents of *Messages* buffer may provide useful information.

>> +
>> +(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 "
>
> Nitpick: I'd prefer CLI in all caps.

That looks better to me, too.

>
> Thanks.
> -Michal

Thanks for the review,

Tomi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-05 20:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-04 22:21 [PATCH v5] devel/emacs: add devel/try-emacs-mua Tomi Ollila
2016-01-04 23:19 ` Michal Sojka
2016-01-05 20:36   ` Tomi Ollila

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).