From: Lars Ingebrigtsen Date: Sun, 7 Nov 2021 01:34:54 +0000 (+0100) Subject: Fix html-mode--image-yank-handler prompting X-Git-Tag: emacs-29.0.90~3671^2~155 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6a546a248696ff82152fbafb46b7cc3586abbb1d;p=emacs.git Fix html-mode--image-yank-handler prompting * lisp/textmodes/sgml-mode.el (html-mode--image-yank-handler): Fix two format statements and rearrange images. --- diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 2b3db0bfeb2..8985fe5cdf9 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -2438,22 +2438,22 @@ To work around that, do: (sgml-pretty-print (point-min) (point-max)))) (defun html-mode--image-yank-handler (type image) - (let ((file (read-file-name "Save %s image to: "))) + (let ((file (read-file-name (format "Save %s image to: " type)))) (when (file-directory-p file) (user-error "%s is a directory")) (when (and (file-exists-p file) - (not (yes-or-no-p "%s exists; overwrite?"))) + (not (yes-or-no-p (format "%s exists; overwrite?" file)))) (user-error "%s exists")) (with-temp-buffer (set-buffer-multibyte nil) (insert image) (write-region (point-min) (point-max) file)) + (insert (format "\n" (file-relative-name file))) (insert-image (create-image file (mailcap-mime-type-to-extension type) nil :max-width 200 :max-height 200) - " ") - (insert (format "\n" (file-relative-name file))))) + " "))) (defvar html-imenu-regexp "\\s-*]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"