@@ -5950,25 +5950,28 @@ For use in `completion-at-point-functions'."
59505950
59515951;;;; Downloading media/files
59525952
5953+ ;; We load `eww' to define this variable on-demand.
59535954(defvar eww-download-directory)
59545955
59555956(defun ement-room-download-file (event destination)
59565957 "Download EVENT's file to DESTINATION.
59575958If DESTINATION is a directory, use the file's default name;
59585959otherwise, download to the filename. Interactively, download to
59595960`eww-download-directory'; with prefix, prompt for destination."
5960- (interactive (list (ement-room--event-at (point))
5961- (if current-prefix-arg
5961+ (interactive (progn
5962+ (require 'eww)
5963+ (list (ement-room--event-at (point))
5964+ (if current-prefix-arg
5965+ (expand-file-name
5966+ (read-file-name
5967+ "Download to: "
5968+ (cl-typecase eww-download-directory
5969+ (string eww-download-directory)
5970+ (function (funcall eww-download-directory)))))
59625971 (expand-file-name
5963- (read-file-name
5964- "Download to: "
5965- (cl-typecase eww-download-directory
5966- (string eww-download-directory)
5967- (function (funcall eww-download-directory)))))
5968- (expand-file-name
5969- (cl-typecase eww-download-directory
5970- (string eww-download-directory)
5971- (function (funcall eww-download-directory)))))))
5972+ (cl-typecase eww-download-directory
5973+ (string eww-download-directory)
5974+ (function (funcall eww-download-directory))))))))
59725975 (pcase-let (((cl-struct ement-event
59735976 (content (map ('filename event-filename)
59745977 ('url mxc-url))))
0 commit comments