summaryrefslogtreecommitdiff
path: root/lisp/textmodes/sgml-mode.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-06 22:45:05 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-06 22:45:05 +0100
commitbb495329e7da5026c115f6c2a28d877a8b84c4f3 (patch)
treed8391d862bcb382885886645b01b8c56fdaebb80 /lisp/textmodes/sgml-mode.el
parent14a5ad139caa96e253c3073f82ddba0ceb4f3cff (diff)
downloademacs-bb495329e7da5026c115f6c2a28d877a8b84c4f3.tar.gz
Support yank-media in html-mode
* lisp/textmodes/sgml-mode.el (html-mode--html-yank-handler): New function. (html-mode): Handle text/html.
Diffstat (limited to 'lisp/textmodes/sgml-mode.el')
-rw-r--r--lisp/textmodes/sgml-mode.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 22a90ca9cfb..c9d43b6ef86 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -2415,6 +2415,7 @@ To work around that, do:
(setq-local css-id-list-function #'html-current-buffer-ids))
(setq imenu-create-index-function 'html-imenu-index)
+ (register-yank-media-handler 'text/html #'html-mode--html-yank-handler)
(setq-local sgml-empty-tags
;; From HTML-4.01's loose.dtd, parsed with
@@ -2430,6 +2431,11 @@ To work around that, do:
;; (setq imenu-sort-function nil) ; sorting the menu defeats the purpose
)
+(defun html-mode--html-yank-handler (_type html)
+ (save-restriction
+ (insert html)
+ (sgml-pretty-print (point-min) (point-max))))
+
(defvar html-imenu-regexp
"\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"
"A regular expression matching a head line to be added to the menu.