diff --git a/etc/init.lisp b/etc/init.lisp index 9d67b51..b3d7cf0 100644 --- a/etc/init.lisp +++ b/etc/init.lisp @@ -640,8 +640,13 @@ "Copy the selected link to clipboard" (copy-link-to-clipboard specials:*open-attach-window*)) +(defun open-attachment-ignoring-cache () + (open-message-attach-perform-opening :ignore-cache t)) + (define-key "C-J" #'open-message-attach-perform-opening *open-attach-keymap*) +(define-key "O" #'open-attachment-ignoring-cache *open-attach-keymap*) + (define-key "C-c" #'copy-from-attach-window-to-clipboard *open-attach-keymap*) (define-key "a" #'open-all-message-attachments *open-attach-keymap*) @@ -650,7 +655,7 @@ (define-key "j" #'open-message-attach-go-down *open-attach-keymap*) -(define-key "k" #'open-message-attach-go-up *open-attach-keymap*) +(define-key "k" #'open-message-attach-go-up *open-attach-keymap*) (define-key "q" #'close-open-attach-window *open-attach-keymap*) diff --git a/src/open-attach-window.lisp b/src/open-attach-window.lisp index c41d21c..2c2c4e3 100644 --- a/src/open-attach-window.lisp +++ b/src/open-attach-window.lisp @@ -136,7 +136,7 @@ (when matchedp (first-elt res)))) -(defun open-attachment (url) +(defun open-attachment (url &key (ignore-cache nil)) (labels ((add-extension (cached-value) (strcat (to-s cached-value) (get-extension url))) (fill-cache (url) @@ -164,7 +164,8 @@ (open-attachment url))) (let ((cached-file (os-utils:cached-file-path (add-extension cached)))) (if (or (not (fs:file-exists-p cached-file)) - (<= (fs:file-size cached-file) 0)) + (<= (fs:file-size cached-file) 0) + ignore-cache) (progn (db:cache-invalidate url) (open-attachment url)) diff --git a/src/ui-goodies.lisp b/src/ui-goodies.lisp index d9a7723..8cd31b7 100644 --- a/src/ui-goodies.lisp +++ b/src/ui-goodies.lisp @@ -1494,10 +1494,10 @@ It an existing file path is provided the command will refuse to run." (defun open-message-attach-go-up () (open-message-attach-move -1)) -(defun open-message-attach-perform-opening () +(defun open-message-attach-perform-opening (&key (ignore-cache nil)) (when-let* ((selected-line (line-oriented-window:selected-row *open-attach-window*)) (url (line-oriented-window:normal-text selected-line))) - (open-attach-window:open-attachment url))) + (open-attach-window:open-attachment url :ignore-cache ignore-cache))) (defun close-open-attach-window () (close-window-and-return-to-threads *open-attach-window*))