Is there a way to get the script output and some kind of a notice if
the exit status of the script is non-zero in a directory mail source
:prescript?

I have the following in ~/.gnus:

(setq mail-sources '((directory :path "~/path/to/mail-in"
                                :prescript "~/path/to/get-mail-script")))

Now, the problem is that if the get-mail-script has a non-zero exit or
produces some output, nothing is shown in the Emacs buffers.

The following patch almost does what I have in mind:

--- orig.mail-source.el 2005-03-18 06:35:29.000000000 +0200
+++ mail-source.el      2006-04-19 00:09:56.000000000 +0300
@@ -667,12 +667,9 @@
     (sleep-for delay)))

 (defun mail-source-call-script (script)
-  (let ((background nil))
-    (when (string-match "& *$" script)
-      (setq script (substring script 0 (match-beginning 0))
-           background 0))
-    (call-process shell-file-name nil background nil
-                 shell-command-switch script)))
+  (let ((resize-mini-windows nil)
+        (max-mini-window-height 0))
+    (shell-command script)))

 ;;;
 ;;; Different fetchers


Unfortunately (shell-command) does not pop the output buffer if there
is only single line of output. It doesn't help to change the
`resize-mini-windows' or `max-mini-window-height' either.

If the script exist status is non-zero, (shell-command) produces no
output.

-- 
Timo Lilja

"It's a 106 miles to Chicago. We've got a full tank of gas, 
half a pack of cigarettes, it's dark, and we're wearing sunglasses."
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english

Reply via email to