aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorLars Ingebrigtsen2021-11-07 02:34:54 +0100
committerLars Ingebrigtsen2021-11-07 02:35:00 +0100
commit6a546a248696ff82152fbafb46b7cc3586abbb1d (patch)
tree974986554880e4b87502bced6404d1c079d29206 /lisp/textmodes
parent0cac4598a77028a64dde9df74c76549cf48a19f2 (diff)
downloademacs-6a546a248696ff82152fbafb46b7cc3586abbb1d.tar.gz
emacs-6a546a248696ff82152fbafb46b7cc3586abbb1d.zip
Fix html-mode--image-yank-handler prompting
* lisp/textmodes/sgml-mode.el (html-mode--image-yank-handler): Fix two format statements and rearrange images.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/sgml-mode.el8
1 files changed, 4 insertions, 4 deletions
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:
2438 (sgml-pretty-print (point-min) (point-max)))) 2438 (sgml-pretty-print (point-min) (point-max))))
2439 2439
2440(defun html-mode--image-yank-handler (type image) 2440(defun html-mode--image-yank-handler (type image)
2441 (let ((file (read-file-name "Save %s image to: "))) 2441 (let ((file (read-file-name (format "Save %s image to: " type))))
2442 (when (file-directory-p file) 2442 (when (file-directory-p file)
2443 (user-error "%s is a directory")) 2443 (user-error "%s is a directory"))
2444 (when (and (file-exists-p file) 2444 (when (and (file-exists-p file)
2445 (not (yes-or-no-p "%s exists; overwrite?"))) 2445 (not (yes-or-no-p (format "%s exists; overwrite?" file))))
2446 (user-error "%s exists")) 2446 (user-error "%s exists"))
2447 (with-temp-buffer 2447 (with-temp-buffer
2448 (set-buffer-multibyte nil) 2448 (set-buffer-multibyte nil)
2449 (insert image) 2449 (insert image)
2450 (write-region (point-min) (point-max) file)) 2450 (write-region (point-min) (point-max) file))
2451 (insert (format "<img src=%S>\n" (file-relative-name file)))
2451 (insert-image 2452 (insert-image
2452 (create-image file (mailcap-mime-type-to-extension type) nil 2453 (create-image file (mailcap-mime-type-to-extension type) nil
2453 :max-width 200 2454 :max-width 200
2454 :max-height 200) 2455 :max-height 200)
2455 " ") 2456 " ")))
2456 (insert (format "<img src=%S>\n" (file-relative-name file)))))
2457 2457
2458(defvar html-imenu-regexp 2458(defvar html-imenu-regexp
2459 "\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)" 2459 "\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"