Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Script output in mail-source directory :prescript
@ 2006-04-18 21:20 Timo Lilja
  2006-04-23 14:09 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Timo Lilja @ 2006-04-18 21:20 UTC (permalink / raw)


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

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

end of thread, other threads:[~2006-05-13 17:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-18 21:20 Script output in mail-source directory :prescript Timo Lilja
2006-04-23 14:09 ` Lars Magne Ingebrigtsen
2006-04-26  5:56   ` Timo Lilja
2006-04-30 10:51     ` Lars Magne Ingebrigtsen
2006-05-13 17:04       ` Timo Lilja

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 NNTP newsgroup(s).