diff options
| author | Lars Ingebrigtsen | 2019-11-03 16:06:26 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-11-03 16:06:35 +0100 |
| commit | ba8a7882de5bbdb39c9c1d74297a9613aa28463f (patch) | |
| tree | 121691f6fecefcccf8bbbfa7d374b8262ad98da0 | |
| parent | e323a84c9f208f7ce5c3416581c8b14c75ec5c11 (diff) | |
| download | emacs-ba8a7882de5bbdb39c9c1d74297a9613aa28463f.tar.gz emacs-ba8a7882de5bbdb39c9c1d74297a9613aa28463f.zip | |
Add a <a id=...> skeleton to html-mode
* lisp/textmodes/sgml-mode.el (html-id-anchor): New skeleton
and keystroke (bug#37651).
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 8 |
2 files changed, 13 insertions, 0 deletions
| @@ -575,6 +575,11 @@ current and the previous or the next line, as before. | |||
| 575 | 575 | ||
| 576 | * Changes in Specialized Modes and Packages in Emacs 27.1 | 576 | * Changes in Specialized Modes and Packages in Emacs 27.1 |
| 577 | 577 | ||
| 578 | --- | ||
| 579 | ** New HTML mode skeleton 'html-id-anchor'. | ||
| 580 | This new command (which inserts an <a id="foo">_</a> skeleton) is | ||
| 581 | bound to 'C-c C-c #'. | ||
| 582 | |||
| 578 | +++ | 583 | +++ |
| 579 | ** New command 'font-lock-refontify'. | 584 | ** New command 'font-lock-refontify'. |
| 580 | This is an interactive convenience function to be used when developing | 585 | This is an interactive convenience function to be used when developing |
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index d8210037c6d..f75ce905472 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -1801,6 +1801,7 @@ This takes effect when first loading the library.") | |||
| 1801 | (define-key map "\C-c\C-cl" 'html-list-item) | 1801 | (define-key map "\C-c\C-cl" 'html-list-item) |
| 1802 | (define-key map "\C-c\C-ch" 'html-href-anchor) | 1802 | (define-key map "\C-c\C-ch" 'html-href-anchor) |
| 1803 | (define-key map "\C-c\C-cn" 'html-name-anchor) | 1803 | (define-key map "\C-c\C-cn" 'html-name-anchor) |
| 1804 | (define-key map "\C-c\C-c#" 'html-id-anchor) | ||
| 1804 | (define-key map "\C-c\C-ci" 'html-image) | 1805 | (define-key map "\C-c\C-ci" 'html-image) |
| 1805 | (when html-quick-keys | 1806 | (when html-quick-keys |
| 1806 | (define-key map "\C-c-" 'html-horizontal-rule) | 1807 | (define-key map "\C-c-" 'html-horizontal-rule) |
| @@ -1812,6 +1813,7 @@ This takes effect when first loading the library.") | |||
| 1812 | (define-key map "\C-cl" 'html-list-item) | 1813 | (define-key map "\C-cl" 'html-list-item) |
| 1813 | (define-key map "\C-ch" 'html-href-anchor) | 1814 | (define-key map "\C-ch" 'html-href-anchor) |
| 1814 | (define-key map "\C-cn" 'html-name-anchor) | 1815 | (define-key map "\C-cn" 'html-name-anchor) |
| 1816 | (define-key map "\C-c#" 'html-id-anchor) | ||
| 1815 | (define-key map "\C-ci" 'html-image) | 1817 | (define-key map "\C-ci" 'html-image) |
| 1816 | (define-key map "\C-cs" 'html-span)) | 1818 | (define-key map "\C-cs" 'html-span)) |
| 1817 | (define-key map "\C-c\C-s" 'html-autoview-mode) | 1819 | (define-key map "\C-c\C-s" 'html-autoview-mode) |
| @@ -1839,6 +1841,7 @@ This takes effect when first loading the library.") | |||
| 1839 | (define-key menu-map "i" '("Image" . html-image)) | 1841 | (define-key menu-map "i" '("Image" . html-image)) |
| 1840 | (define-key menu-map "h" '("Href Anchor" . html-href-anchor)) | 1842 | (define-key menu-map "h" '("Href Anchor" . html-href-anchor)) |
| 1841 | (define-key menu-map "n" '("Name Anchor" . html-name-anchor)) | 1843 | (define-key menu-map "n" '("Name Anchor" . html-name-anchor)) |
| 1844 | (define-key menu-map "#" '("ID Anchor" . html-id-anchor)) | ||
| 1842 | map) | 1845 | map) |
| 1843 | "Keymap for commands for use in HTML mode.") | 1846 | "Keymap for commands for use in HTML mode.") |
| 1844 | 1847 | ||
| @@ -2451,6 +2454,11 @@ HTML Autoview mode is a buffer-local minor mode for use with | |||
| 2451 | (if sgml-xml-mode (concat " id=\"" str "\"")) | 2454 | (if sgml-xml-mode (concat " id=\"" str "\"")) |
| 2452 | ">" _ "</a>") | 2455 | ">" _ "</a>") |
| 2453 | 2456 | ||
| 2457 | (define-skeleton html-id-anchor | ||
| 2458 | "HTML anchor tag with id attribute." | ||
| 2459 | "ID: " | ||
| 2460 | "<a id=\"" str "\">" _ "</a>") | ||
| 2461 | |||
| 2454 | (define-skeleton html-headline-1 | 2462 | (define-skeleton html-headline-1 |
| 2455 | "HTML level 1 headline tags." | 2463 | "HTML level 1 headline tags." |
| 2456 | nil | 2464 | nil |