diff options
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 71c40d384e0..ce42a5bcf7d 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -890,7 +890,7 @@ If this can't be done, return nil." | |||
| 890 | (sgml-beginning-of-tag t)))))) | 890 | (sgml-beginning-of-tag t)))))) |
| 891 | 891 | ||
| 892 | (defun sgml-value (alist) | 892 | (defun sgml-value (alist) |
| 893 | "Interactively insert value taken from attributerule ALIST. | 893 | "Interactively insert value taken from attribute-rule ALIST. |
| 894 | See `sgml-tag-alist' for info about attribute rules." | 894 | See `sgml-tag-alist' for info about attribute rules." |
| 895 | (setq alist (cdr alist)) | 895 | (setq alist (cdr alist)) |
| 896 | (if (stringp (car alist)) | 896 | (if (stringp (car alist)) |
| @@ -924,9 +924,20 @@ With prefix argument, unquote the region." | |||
| 924 | (?> . ">")))))))) | 924 | (?> . ">")))))))) |
| 925 | 925 | ||
| 926 | 926 | ||
| 927 | (defun sgml-empty-tag-p (tag-name) | ||
| 928 | "Return non-nil if TAG-NAME is an implicitly empty tag." | ||
| 929 | (and (not sgml-xml-mode) | ||
| 930 | (member-ignore-case tag-name sgml-empty-tags))) | ||
| 931 | |||
| 932 | (defun sgml-unclosed-tag-p (tag-name) | ||
| 933 | "Return non-nil if TAG-NAME is a tag for which an end-tag is optional." | ||
| 934 | (and (not sgml-xml-mode) | ||
| 935 | (member-ignore-case tag-name sgml-unclosed-tags))) | ||
| 936 | |||
| 927 | (defun sgml-calculate-indent () | 937 | (defun sgml-calculate-indent () |
| 928 | "Calculate the column to which this line should be indented." | 938 | "Calculate the column to which this line should be indented." |
| 929 | (let ((lcon (sgml-lexical-context))) | 939 | (let ((lcon (sgml-lexical-context))) |
| 940 | |||
| 930 | ;; Indent comment-start markers inside <!-- just like comment-end markers. | 941 | ;; Indent comment-start markers inside <!-- just like comment-end markers. |
| 931 | (if (and (eq (car lcon) 'tag) | 942 | (if (and (eq (car lcon) 'tag) |
| 932 | (looking-at "--") | 943 | (looking-at "--") |
| @@ -934,6 +945,7 @@ With prefix argument, unquote the region." | |||
| 934 | (setq lcon (cons 'comment (+ (cdr lcon) 2)))) | 945 | (setq lcon (cons 'comment (+ (cdr lcon) 2)))) |
| 935 | 946 | ||
| 936 | (case (car lcon) | 947 | (case (car lcon) |
| 948 | |||
| 937 | (string | 949 | (string |
| 938 | ;; Go back to previous non-empty line. | 950 | ;; Go back to previous non-empty line. |
| 939 | (while (and (> (point) (cdr lcon)) | 951 | (while (and (> (point) (cdr lcon)) |
| @@ -970,7 +982,7 @@ With prefix argument, unquote the region." | |||
| 970 | (goto-char (1+ (cdr lcon))) | 982 | (goto-char (1+ (cdr lcon))) |
| 971 | (+ (current-column) sgml-basic-offset))) | 983 | (+ (current-column) sgml-basic-offset))) |
| 972 | 984 | ||
| 973 | (t ;; text | 985 | (text |
| 974 | (while (looking-at "</") | 986 | (while (looking-at "</") |
| 975 | (forward-sexp 1) | 987 | (forward-sexp 1) |
| 976 | (skip-chars-forward " \t")) | 988 | (skip-chars-forward " \t")) |
| @@ -1006,7 +1018,12 @@ With prefix argument, unquote the region." | |||
| 1006 | (current-column) | 1018 | (current-column) |
| 1007 | (goto-char there) | 1019 | (goto-char there) |
| 1008 | (+ (current-column) | 1020 | (+ (current-column) |
| 1009 | (* sgml-basic-offset (length context))))))))) | 1021 | (* sgml-basic-offset (length context)))))) |
| 1022 | |||
| 1023 | (otherwise | ||
| 1024 | (error "Unrecognised context %s" (car lcon))) | ||
| 1025 | |||
| 1026 | ))) | ||
| 1010 | 1027 | ||
| 1011 | (defun sgml-indent-line () | 1028 | (defun sgml-indent-line () |
| 1012 | "Indent the current line as SGML." | 1029 | "Indent the current line as SGML." |