diff options
| author | Juri Linkov | 2005-03-08 21:45:00 +0000 |
|---|---|---|
| committer | Juri Linkov | 2005-03-08 21:45:00 +0000 |
| commit | af3abed1268fe43c04c2b3974ff8f1c723a8bdb0 (patch) | |
| tree | 1037c3586455c698f0e1d0d8e3e3f4737ca527ed | |
| parent | 9b54d4534e0f8a14a077900d07786d9455b8e134 (diff) | |
| download | emacs-af3abed1268fe43c04c2b3974ff8f1c723a8bdb0.tar.gz emacs-af3abed1268fe43c04c2b3974ff8f1c723a8bdb0.zip | |
(sgml-tag, html-tag-alist)
(html-horizontal-rule, html-line, html-image, html-checkboxes)
(html-radio-buttons): Add a space before the trailing `/>' where
sgml-xml-mode is non-nil.
(sgml-delete-tag): Check if the tag ends with `/>' to not delete
the subsequent tag of the empty XML tag.
(html-href-anchor): Don't set initial input to "http:".
(html-image): Ask for the image URL and set point inside alt="".
(html-name-anchor): Duplicate the name in the `id' attribute when
sgml-xml-mode is non-nil.
(html-paragraph): Remove \n before <p>.
(html-checkboxes, html-radio-buttons): Insert `checked="checked"'
instead of `checked' when sgml-xml-mode is non-nil.
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 694903b1fb6..6fcf5869143 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -350,7 +350,7 @@ an optional alist of possible values." | |||
| 350 | "*When non-nil, tag insertion functions will be XML-compliant. | 350 | "*When non-nil, tag insertion functions will be XML-compliant. |
| 351 | If this variable is customized, the custom value is used always. | 351 | If this variable is customized, the custom value is used always. |
| 352 | Otherwise, it is set to be buffer-local when the file has | 352 | Otherwise, it is set to be buffer-local when the file has |
| 353 | a DOCTYPE or an XML declaration." | 353 | a DOCTYPE or an XML declaration." |
| 354 | :type 'boolean | 354 | :type 'boolean |
| 355 | :version "22.1" | 355 | :version "22.1" |
| 356 | :group 'sgml) | 356 | :group 'sgml) |
| @@ -629,7 +629,7 @@ skeleton-transformation RET upcase RET, or put this in your `.emacs': | |||
| 629 | (backward-char) | 629 | (backward-char) |
| 630 | '(("") " [ " _ " ]]")) | 630 | '(("") " [ " _ " ]]")) |
| 631 | ((and (eq v2 t) sgml-xml-mode (member ,str sgml-empty-tags)) | 631 | ((and (eq v2 t) sgml-xml-mode (member ,str sgml-empty-tags)) |
| 632 | '(("") -1 "/>")) | 632 | '(("") -1 " />")) |
| 633 | ((or (and (eq v2 t) (not sgml-xml-mode)) (string-match "^[/!?]" ,str)) | 633 | ((or (and (eq v2 t) (not sgml-xml-mode)) (string-match "^[/!?]" ,str)) |
| 634 | nil) | 634 | nil) |
| 635 | ((symbolp v2) | 635 | ((symbolp v2) |
| @@ -818,7 +818,8 @@ With prefix argument ARG, repeat this ARG times." | |||
| 818 | (goto-char close) | 818 | (goto-char close) |
| 819 | (kill-sexp 1)) | 819 | (kill-sexp 1)) |
| 820 | (setq open (point)) | 820 | (setq open (point)) |
| 821 | (when (sgml-skip-tag-forward 1) | 821 | (when (and (sgml-skip-tag-forward 1) |
| 822 | (not (looking-back "/>"))) | ||
| 822 | (kill-sexp -1))) | 823 | (kill-sexp -1))) |
| 823 | ;; Delete any resulting empty line. If we didn't kill-sexp, | 824 | ;; Delete any resulting empty line. If we didn't kill-sexp, |
| 824 | ;; this *should* do nothing, because we're right after the tag. | 825 | ;; this *should* do nothing, because we're right after the tag. |
| @@ -1572,7 +1573,7 @@ This takes effect when first loading the library.") | |||
| 1572 | ("dir" ,@list) | 1573 | ("dir" ,@list) |
| 1573 | ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7) | 1574 | ("font" nil "size" ("-1") ("+1") ("-2") ("+2") ,@1-7) |
| 1574 | ("form" (\n _ \n "<input type=\"submit\" value=\"\"" | 1575 | ("form" (\n _ \n "<input type=\"submit\" value=\"\"" |
| 1575 | (if sgml-xml-mode "/>" ">")) | 1576 | (if sgml-xml-mode " />" ">")) |
| 1576 | ("action" ,@(cdr href)) ("method" ("get") ("post"))) | 1577 | ("action" ,@(cdr href)) ("method" ("get") ("post"))) |
| 1577 | ("h1" ,@align) | 1578 | ("h1" ,@align) |
| 1578 | ("h2" ,@align) | 1579 | ("h2" ,@align) |
| @@ -1891,13 +1892,15 @@ Can be used as a value for `html-mode-hook'." | |||
| 1891 | (define-skeleton html-href-anchor | 1892 | (define-skeleton html-href-anchor |
| 1892 | "HTML anchor tag with href attribute." | 1893 | "HTML anchor tag with href attribute." |
| 1893 | "URL: " | 1894 | "URL: " |
| 1894 | '(setq input "http:") | 1895 | ;; '(setq input "http:") |
| 1895 | "<a href=\"" str "\">" _ "</a>") | 1896 | "<a href=\"" str "\">" _ "</a>") |
| 1896 | 1897 | ||
| 1897 | (define-skeleton html-name-anchor | 1898 | (define-skeleton html-name-anchor |
| 1898 | "HTML anchor tag with name attribute." | 1899 | "HTML anchor tag with name attribute." |
| 1899 | "Name: " | 1900 | "Name: " |
| 1900 | "<a name=\"" str "\">" _ "</a>") | 1901 | "<a name=\"" str "\"" |
| 1902 | (if sgml-xml-mode (concat " id=\"" str "\"")) | ||
| 1903 | ">" _ "</a>") | ||
| 1901 | 1904 | ||
| 1902 | (define-skeleton html-headline-1 | 1905 | (define-skeleton html-headline-1 |
| 1903 | "HTML level 1 headline tags." | 1906 | "HTML level 1 headline tags." |
| @@ -1932,18 +1935,18 @@ Can be used as a value for `html-mode-hook'." | |||
| 1932 | (define-skeleton html-horizontal-rule | 1935 | (define-skeleton html-horizontal-rule |
| 1933 | "HTML horizontal rule tag." | 1936 | "HTML horizontal rule tag." |
| 1934 | nil | 1937 | nil |
| 1935 | (if sgml-xml-mode "<hr/>" "<hr>") \n) | 1938 | (if sgml-xml-mode "<hr />" "<hr>") \n) |
| 1936 | 1939 | ||
| 1937 | (define-skeleton html-image | 1940 | (define-skeleton html-image |
| 1938 | "HTML image tag." | 1941 | "HTML image tag." |
| 1939 | nil | 1942 | "Image URL: " |
| 1940 | "<img src=\"" _ "\"" | 1943 | "<img src=\"" str "\" alt=\"" _ "\"" |
| 1941 | (if sgml-xml-mode "/>" ">")) | 1944 | (if sgml-xml-mode " />" ">")) |
| 1942 | 1945 | ||
| 1943 | (define-skeleton html-line | 1946 | (define-skeleton html-line |
| 1944 | "HTML line break tag." | 1947 | "HTML line break tag." |
| 1945 | nil | 1948 | nil |
| 1946 | (if sgml-xml-mode "<br/>" "<br>") \n) | 1949 | (if sgml-xml-mode "<br />" "<br>") \n) |
| 1947 | 1950 | ||
| 1948 | (define-skeleton html-ordered-list | 1951 | (define-skeleton html-ordered-list |
| 1949 | "HTML ordered list tags." | 1952 | "HTML ordered list tags." |
| @@ -1969,7 +1972,7 @@ Can be used as a value for `html-mode-hook'." | |||
| 1969 | "HTML paragraph tag." | 1972 | "HTML paragraph tag." |
| 1970 | nil | 1973 | nil |
| 1971 | (if (bolp) nil ?\n) | 1974 | (if (bolp) nil ?\n) |
| 1972 | \n "<p>" _ (if sgml-xml-mode "</p>")) | 1975 | "<p>" _ (if sgml-xml-mode "</p>")) |
| 1973 | 1976 | ||
| 1974 | (define-skeleton html-checkboxes | 1977 | (define-skeleton html-checkboxes |
| 1975 | "Group of connected checkbox inputs." | 1978 | "Group of connected checkbox inputs." |
| @@ -1981,12 +1984,13 @@ Can be used as a value for `html-mode-hook'." | |||
| 1981 | "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: "))) | 1984 | "\" name=\"" (or v1 (setq v1 (skeleton-read "Name: "))) |
| 1982 | "\" value=\"" str ?\" | 1985 | "\" value=\"" str ?\" |
| 1983 | (when (y-or-n-p "Set \"checked\" attribute? ") | 1986 | (when (y-or-n-p "Set \"checked\" attribute? ") |
| 1984 | (funcall skeleton-transformation " checked")) | 1987 | (funcall skeleton-transformation |
| 1985 | (if sgml-xml-mode "/>" ">") | 1988 | (if sgml-xml-mode " checked=\"checked\"" " checked"))) |
| 1989 | (if sgml-xml-mode " />" ">") | ||
| 1986 | (skeleton-read "Text: " (capitalize str)) | 1990 | (skeleton-read "Text: " (capitalize str)) |
| 1987 | (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") | 1991 | (or v2 (setq v2 (if (y-or-n-p "Newline after text? ") |
| 1988 | (funcall skeleton-transformation | 1992 | (funcall skeleton-transformation |
| 1989 | (if sgml-xml-mode "<br/>" "<br>")) | 1993 | (if sgml-xml-mode "<br />" "<br>")) |
| 1990 | ""))) | 1994 | ""))) |
| 1991 | \n)) | 1995 | \n)) |
| 1992 | 1996 | ||
| @@ -2000,12 +2004,13 @@ Can be used as a value for `html-mode-hook'." | |||
| 2000 | "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: "))) | 2004 | "\" name=\"" (or (car v2) (setcar v2 (skeleton-read "Name: "))) |
| 2001 | "\" value=\"" str ?\" | 2005 | "\" value=\"" str ?\" |
| 2002 | (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) | 2006 | (when (and (not v1) (setq v1 (y-or-n-p "Set \"checked\" attribute? "))) |
| 2003 | (funcall skeleton-transformation " checked")) | 2007 | (funcall skeleton-transformation |
| 2004 | (if sgml-xml-mode "/>" ">") | 2008 | (if sgml-xml-mode " checked=\"checked\"" " checked"))) |
| 2009 | (if sgml-xml-mode " />" ">") | ||
| 2005 | (skeleton-read "Text: " (capitalize str)) | 2010 | (skeleton-read "Text: " (capitalize str)) |
| 2006 | (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") | 2011 | (or (cdr v2) (setcdr v2 (if (y-or-n-p "Newline after text? ") |
| 2007 | (funcall skeleton-transformation | 2012 | (funcall skeleton-transformation |
| 2008 | (if sgml-xml-mode "<br/>" "<br>")) | 2013 | (if sgml-xml-mode "<br />" "<br>")) |
| 2009 | ""))) | 2014 | ""))) |
| 2010 | \n)) | 2015 | \n)) |
| 2011 | 2016 | ||