+2006-10-03 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * gnus-util.el (gnus-with-local-quit): New macro.
+
+ * gnus-demon.el (gnus-demon): Replace with-local-quit with it.
+
2006-10-02 Teodor Zlatanov <tzz@lifelogs.com>
* gnus-util.el (gnus-string-remove-all-properties): another fix
(< idle gnus-demon-idle-time)) ; Idle timed out.
(t (< 0 gnus-demon-idle-time)))) ; Or just need to be idle.
;; So we call the handler.
- (with-local-quit
+ (gnus-with-local-quit
(ignore-errors (funcall (car handler)))
;; And reset the timer.
(setcar (nthcdr 1 handler)
(gnus-demon-is-idle-p))
;; We want to call this handler each and every time that
;; Emacs is idle.
- (with-local-quit
+ (gnus-with-local-quit
(ignore-errors (funcall (car handler)))))
(t
;; We want to call this handler only if Emacs has been idle
(and (not (memq (car handler) gnus-demon-idle-has-been-called))
(< idle gnus-demon-idle-time)
(gnus-demon-is-idle-p)
- (with-local-quit
+ (gnus-with-local-quit
(ignore-errors (funcall (car handler)))
;; Make sure the handler won't be called once more in
;; this idle-cycle.
(defalias 'gnus-set-process-query-on-exit-flag
'process-kill-without-query))
+(if (fboundp 'with-local-quit)
+ (defalias 'gnus-with-local-quit 'with-local-quit)
+ (defmacro gnus-with-local-quit (&rest body)
+ "Execute BODY, allowing quits to terminate BODY but not escape further.
+When a quit terminates BODY, `gnus-with-local-quit' returns nil but
+requests another quit. That quit will be processed as soon as quitting
+is allowed once again. (Immediately, if `inhibit-quit' is nil.)"
+ ;;(declare (debug t) (indent 0))
+ `(condition-case nil
+ (let ((inhibit-quit nil))
+ ,@body)
+ (quit (setq quit-flag t)
+ ;; This call is to give a chance to handle quit-flag
+ ;; in case inhibit-quit is nil.
+ ;; Without this, it will not be handled until the next function
+ ;; call, and that might allow it to exit thru a condition-case
+ ;; that intends to handle the quit signal next time.
+ (eval '(ignore nil))))))
+
(provide 'gnus-util)
;;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49