unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* bug: notmuch-poll doesn't check return value
@ 2015-09-14 12:18 Ketil Malde
  2015-10-28 18:28 ` [PATCH] emacs: poll: return useful errors when poll fails Mark Walters
  0 siblings, 1 reply; 4+ messages in thread
From: Ketil Malde @ 2015-09-14 12:18 UTC (permalink / raw)
  To: notmuch


Hi,

I've been stumped occasionally when new mail fails to appear in notmuch,
and then I suddenly discover it by some other means (web front end,
mobile, etc).

The problem is that notmuch-poll fails silently when it fails, which is
usually due to broken symlinks in my mail directories, or some IMAP
configuration mistake.  Easy to fix when you know about it.

I've, uh, "fixed" this by redefining notmuch-poll like so:

---8<-------------------------------------
;;; Make notmuch-poll fail gracelessly when something goes wrong
;;; Better than failing silently, in ancy case.
(defun notmuch-poll ()
  "Run \"notmuch new\" or an external script to import mail.

Invokes `notmuch-poll-script', \"notmuch new\", or does nothing
depending on the value of `notmuch-poll-script'."
  (interactive)
  (if (not (equal 0
		  (if (stringp notmuch-poll-script)
		      (unless (string= notmuch-poll-script "")
			(call-process notmuch-poll-script nil nil))
		    (call-process notmuch-command nil nil nil "new"))))
     (error "Notmuch: poll failed!")))
---8<-------------------------------------

Surely, somebody who knows lisp can do something far more elegant than
this, but the point is to bug out when something doesn't work.

In addtion, I had to fix my notmuch-poll-script, which contains
'offlineimap', then 'notmuch new', followed by some tagging commands.
As the tagging commands tend to work even if 'new' doesn't, this will
often (pretend to) exit successfully.  A 'set -e' at the top of the
script is probably a good idea, and should probably be mentioned in
documentation somewhere.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants

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

end of thread, other threads:[~2015-11-23 13:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 12:18 bug: notmuch-poll doesn't check return value Ketil Malde
2015-10-28 18:28 ` [PATCH] emacs: poll: return useful errors when poll fails Mark Walters
2015-10-28 20:18   ` Tomi Ollila
2015-11-23 12:51   ` David Bremner

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