1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-04 02:51:31 -08:00

Support yank-media in html-mode

* lisp/textmodes/sgml-mode.el (html-mode--html-yank-handler): New
function.
(html-mode): Handle text/html.
This commit is contained in:
Lars Ingebrigtsen 2021-11-06 22:45:05 +01:00
parent 14a5ad139c
commit bb495329e7
2 changed files with 9 additions and 0 deletions

View file

@ -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.