]> git.eshelyaron.com Git - emacs.git/commitdiff
Add a <a id=...> skeleton to html-mode
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 3 Nov 2019 15:06:26 +0000 (16:06 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 3 Nov 2019 15:06:35 +0000 (16:06 +0100)
* lisp/textmodes/sgml-mode.el (html-id-anchor): New skeleton
and keystroke (bug#37651).

etc/NEWS
lisp/textmodes/sgml-mode.el

index 033cb4897884d5b77f4078e00e51181f2cc8cde7..e897fe06c99f7b15192121f284d9ab91ac347319 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -575,6 +575,11 @@ current and the previous or the next line, as before.
 \f
 * Changes in Specialized Modes and Packages in Emacs 27.1
 
+---
+** New HTML mode skeleton 'html-id-anchor'.
+This new command (which inserts an <a id="foo">_</a> skeleton) is
+bound to 'C-c C-c #'.
+
 +++
 ** New command 'font-lock-refontify'.
 This is an interactive convenience function to be used when developing
index d8210037c6d2e967b7897731280d26e28967466f..f75ce90547289b11848a13a361997a8e7326d3c5 100644 (file)
@@ -1801,6 +1801,7 @@ This takes effect when first loading the library.")
     (define-key map "\C-c\C-cl" 'html-list-item)
     (define-key map "\C-c\C-ch" 'html-href-anchor)
     (define-key map "\C-c\C-cn" 'html-name-anchor)
+    (define-key map "\C-c\C-c#" 'html-id-anchor)
     (define-key map "\C-c\C-ci" 'html-image)
     (when html-quick-keys
       (define-key map "\C-c-" 'html-horizontal-rule)
@@ -1812,6 +1813,7 @@ This takes effect when first loading the library.")
       (define-key map "\C-cl" 'html-list-item)
       (define-key map "\C-ch" 'html-href-anchor)
       (define-key map "\C-cn" 'html-name-anchor)
+      (define-key map "\C-c#" 'html-id-anchor)
       (define-key map "\C-ci" 'html-image)
       (define-key map "\C-cs" 'html-span))
     (define-key map "\C-c\C-s" 'html-autoview-mode)
@@ -1839,6 +1841,7 @@ This takes effect when first loading the library.")
     (define-key menu-map "i" '("Image" . html-image))
     (define-key menu-map "h" '("Href Anchor" . html-href-anchor))
     (define-key menu-map "n" '("Name Anchor" . html-name-anchor))
+    (define-key menu-map "#" '("ID Anchor" . html-id-anchor))
     map)
   "Keymap for commands for use in HTML mode.")
 
@@ -2451,6 +2454,11 @@ HTML Autoview mode is a buffer-local minor mode for use with
   (if sgml-xml-mode (concat " id=\"" str "\""))
   ">" _ "</a>")
 
+(define-skeleton html-id-anchor
+  "HTML anchor tag with id attribute."
+  "ID: "
+  "<a id=\"" str "\">" _ "</a>")
+
 (define-skeleton html-headline-1
   "HTML level 1 headline tags."
   nil