From: Lars Ingebrigtsen Date: Thu, 6 Aug 2020 13:11:48 +0000 (+0200) Subject: Add a new HTML skeleton for relative (file) URLs X-Git-Tag: emacs-28.0.90~6789 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=51d063e484c185b7e1d9cb4c6bf56d67b9af4781;p=emacs.git Add a new HTML skeleton for relative (file) URLs * lisp/textmodes/sgml-mode.el (html-href-anchor-file): New skeleton and keystroke (bug#37644). --- diff --git a/etc/NEWS b/etc/NEWS index 2df7bac9d73..c57773922ed 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -659,6 +659,13 @@ custom rules, see the variables 'bug-reference-setup-from-vc-alist', 'bug-reference-setup-from-mail-alist', and 'bug-reference-setup-from-irc-alist'. +** HTML Mode + +--- +*** A new skeleton for adding relative URLs has been added. +It's bound to the 'C-c C-c f' keystroke, and prompts for a local file +name. + * New Modes and Packages in Emacs 28.1 diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index b5ff6a69671..1672dce4f23 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -1806,6 +1806,7 @@ This takes effect when first loading the library.") (define-key map "\C-c\C-cc" 'html-checkboxes) (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-cf" 'html-href-anchor-file) (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) @@ -1818,6 +1819,7 @@ This takes effect when first loading the library.") (define-key map "\C-cc" 'html-checkboxes) (define-key map "\C-cl" 'html-list-item) (define-key map "\C-ch" 'html-href-anchor) + (define-key map "\C-cf" 'html-href-anchor-file) (define-key map "\C-cn" 'html-name-anchor) (define-key map "\C-c#" 'html-id-anchor) (define-key map "\C-ci" 'html-image) @@ -1845,7 +1847,8 @@ This takes effect when first loading the library.") (define-key menu-map "\n" '("Line Break" . html-line)) (define-key menu-map "\r" '("Paragraph" . html-paragraph)) (define-key menu-map "i" '("Image" . html-image)) - (define-key menu-map "h" '("Href Anchor" . html-href-anchor)) + (define-key menu-map "h" '("Href Anchor URL" . html-href-anchor)) + (define-key menu-map "f" '("Href Anchor File" . html-href-anchor-file)) (define-key menu-map "n" '("Name Anchor" . html-name-anchor)) (define-key menu-map "#" '("ID Anchor" . html-id-anchor)) map) @@ -2453,6 +2456,11 @@ HTML Autoview mode is a buffer-local minor mode for use with ;; '(setq input "http:") "" _ "") +(define-skeleton html-href-anchor-file + "HTML anchor tag with href attribute (from a local file)." + (file-relative-name (read-file-name "File name: ") default-directory) + "" _ "") + (define-skeleton html-name-anchor "HTML anchor tag with name attribute." "Name: "