aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2019-04-30 16:00:46 -0700
committerEric Abrahamsen2019-06-24 10:21:09 -0700
commit535051db2a89a9aba615c0c4f385f70e5a77a99d (patch)
tree6550ab41ab53d138b863b96f31f01d4a520c6a8d
parent35c72aea449a0e05849cff8d8ad4b9bde25cebb5 (diff)
downloademacs-535051db2a89a9aba615c0c4f385f70e5a77a99d.tar.gz
emacs-535051db2a89a9aba615c0c4f385f70e5a77a99d.zip
Tweaks to html mode
* lisp/textmodes/sgml-mode.el (sgml-attributes): Add the "class" and "id" attributes when needed. (html-mode-map): Add the `html-div' and `html-span' commands to the `html-quick-keys' map. (html-ordered-list, html-unordered-list, html-paragraph): Use the "\n" element properly. (html-div, html-span): New HTML skeletons.
-rw-r--r--lisp/textmodes/sgml-mode.el39
1 files changed, 29 insertions, 10 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 0c5d5e56a69..8d3000e5d8b 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -816,8 +816,16 @@ If QUIET, do not print a message when there are no attributes for TAG."
816 (symbolp (car (car alist)))) 816 (symbolp (car (car alist))))
817 (setq car (car alist) 817 (setq car (car alist)
818 alist (cdr alist))) 818 alist (cdr alist)))
819 (or quiet 819 (unless (or alist quiet)
820 (message "No attributes configured.")) 820 (message "No attributes configured."))
821 (when alist
822 ;; Add class and id attributes if a) the element has any
823 ;; other attributes configured, and b) they're not already
824 ;; present.
825 (unless (assoc-string "class" alist)
826 (setq alist (cons '("class") alist)))
827 (unless (assoc-string "id" alist)
828 (setq alist (cons '("id") alist))))
821 (if (stringp (car alist)) 829 (if (stringp (car alist))
822 (progn 830 (progn
823 (insert (if (eq (preceding-char) ?\s) "" ?\s) 831 (insert (if (eq (preceding-char) ?\s) "" ?\s)
@@ -1795,6 +1803,7 @@ This takes effect when first loading the library.")
1795 (define-key map "\C-c\C-ci" 'html-image) 1803 (define-key map "\C-c\C-ci" 'html-image)
1796 (when html-quick-keys 1804 (when html-quick-keys
1797 (define-key map "\C-c-" 'html-horizontal-rule) 1805 (define-key map "\C-c-" 'html-horizontal-rule)
1806 (define-key map "\C-cd" 'html-div)
1798 (define-key map "\C-co" 'html-ordered-list) 1807 (define-key map "\C-co" 'html-ordered-list)
1799 (define-key map "\C-cu" 'html-unordered-list) 1808 (define-key map "\C-cu" 'html-unordered-list)
1800 (define-key map "\C-cr" 'html-radio-buttons) 1809 (define-key map "\C-cr" 'html-radio-buttons)
@@ -1802,7 +1811,8 @@ This takes effect when first loading the library.")
1802 (define-key map "\C-cl" 'html-list-item) 1811 (define-key map "\C-cl" 'html-list-item)
1803 (define-key map "\C-ch" 'html-href-anchor) 1812 (define-key map "\C-ch" 'html-href-anchor)
1804 (define-key map "\C-cn" 'html-name-anchor) 1813 (define-key map "\C-cn" 'html-name-anchor)
1805 (define-key map "\C-ci" 'html-image)) 1814 (define-key map "\C-ci" 'html-image)
1815 (define-key map "\C-cs" 'html-span))
1806 (define-key map "\C-c\C-s" 'html-autoview-mode) 1816 (define-key map "\C-c\C-s" 'html-autoview-mode)
1807 (define-key map "\C-c\C-v" 'browse-url-of-buffer) 1817 (define-key map "\C-c\C-v" 'browse-url-of-buffer)
1808 (define-key map [menu-bar html] (cons "HTML" menu-map)) 1818 (define-key map [menu-bar html] (cons "HTML" menu-map))
@@ -2003,7 +2013,7 @@ This takes effect when first loading the library.")
2003 ("dd" ,(not sgml-xml-mode)) 2013 ("dd" ,(not sgml-xml-mode))
2004 ("del" nil ("cite") ("datetime")) 2014 ("del" nil ("cite") ("datetime"))
2005 ("dfn") 2015 ("dfn")
2006 ("div") 2016 ("div" \n ("id") ("class"))
2007 ("dl" (nil \n 2017 ("dl" (nil \n
2008 ( "Term: " 2018 ( "Term: "
2009 "<dt>" str (if sgml-xml-mode "</dt>") 2019 "<dt>" str (if sgml-xml-mode "</dt>")
@@ -2489,16 +2499,16 @@ HTML Autoview mode is a buffer-local minor mode for use with
2489(define-skeleton html-ordered-list 2499(define-skeleton html-ordered-list
2490 "HTML ordered list tags." 2500 "HTML ordered list tags."
2491 nil 2501 nil
2492 "<ol>" \n 2502 \n "<ol>" \n
2493 "<li>" _ (if sgml-xml-mode "</li>") \n 2503 "<li>" _ (if sgml-xml-mode "</li>") \n
2494 "</ol>") 2504 "</ol>" > \n)
2495 2505
2496(define-skeleton html-unordered-list 2506(define-skeleton html-unordered-list
2497 "HTML unordered list tags." 2507 "HTML unordered list tags."
2498 nil 2508 nil
2499 "<ul>" \n 2509 \n "<ul>" \n
2500 "<li>" _ (if sgml-xml-mode "</li>") \n 2510 "<li>" _ (if sgml-xml-mode "</li>") \n
2501 "</ul>") 2511 "</ul>" > \n)
2502 2512
2503(define-skeleton html-list-item 2513(define-skeleton html-list-item
2504 "HTML list item tag." 2514 "HTML list item tag."
@@ -2509,8 +2519,17 @@ HTML Autoview mode is a buffer-local minor mode for use with
2509(define-skeleton html-paragraph 2519(define-skeleton html-paragraph
2510 "HTML paragraph tag." 2520 "HTML paragraph tag."
2511 nil 2521 nil
2512 (if (bolp) nil ?\n) 2522 \n "<p>" _ (if sgml-xml-mode "</p>"))
2513 "<p>" _ (if sgml-xml-mode "</p>")) 2523
2524(define-skeleton html-div
2525 "HTML div tag."
2526 nil
2527 "<div>" > \n _ \n "</div>" >)
2528
2529(define-skeleton html-span
2530 "HTML span tag."
2531 nil
2532 "<span>" > _ "</span>")
2514 2533
2515(define-skeleton html-checkboxes 2534(define-skeleton html-checkboxes
2516 "Group of connected checkbox inputs." 2535 "Group of connected checkbox inputs."