+(require 'cl-lib)
(require 'notmuch-mua)
(defun attachment-check-test (&optional fn)
(condition-case nil
;; Force `y-or-n-p' to always return `nil', as if the user
;; pressed "n".
- (letf (((symbol-function 'y-or-n-p) (lambda (&rest args) nil)))
+ (cl-letf (((symbol-function 'y-or-n-p)
+ (lambda (&rest args) nil)))
(notmuch-mua-attachment-check)
t)
('error nil))
;; fontification properties. For fontification to happen we need to
;; allow some time for redisplay.
(sit-for 0.01)))
+ (t . (lambda ()
+ ;; "attach" is only mentioned in a forwarded message.
+ (insert "Hello\n")
+ (insert "<#mml type=message/rfc822 disposition=inline>\n")
+ (insert "X-Has-Attach:\n")
+ (insert "<#/mml>\n")))
;; These should not be okay:
(nil . (lambda () (insert "Here is an attachment:\n")))
;; looking at fontification properties. For fontification
;; to happen we need to allow some time for redisplay.
(sit-for 0.01)))
+ (nil . (lambda ()
+ ;; "attachment" is mentioned before a forwarded message.
+ (insert "I also attach something.\n")
+ (insert "<#mml type=message/rfc822 disposition=inline>\n")
+ (insert "X-Has-Attach:\n")
+ (insert "<#/mml>\n")))
))
(defun notmuch-test-attachment-warning-1 ()