diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/textmodes/sgml-mode.el | 22 |
2 files changed, 17 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 555619a37e4..7a14c1a419d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2002-04-09 Mike Williams <mdub@bigfoot.com> | ||
| 2 | |||
| 3 | * textmodes/sgml-mode.el (sgml-lexical-context): Use | ||
| 4 | sgml-parse-tag-backward to find start point. | ||
| 5 | (sgml-looking-back-at): Doc fix. | ||
| 6 | |||
| 1 | 2002-04-09 Pavel Jan,Bm(Bk <Pavel@Janik.cz> | 7 | 2002-04-09 Pavel Jan,Bm(Bk <Pavel@Janik.cz> |
| 2 | 8 | ||
| 3 | * isearch.el (isearch-message-prefix): Use minibuffer-prompt face | 9 | * isearch.el (isearch-message-prefix): Use minibuffer-prompt face |
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index a5532146b7c..9df19cc1180 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el | |||
| @@ -863,17 +863,16 @@ and move to the line in the SGML document that caused it." | |||
| 863 | START is the location of the start of the lexical element. | 863 | START is the location of the start of the lexical element. |
| 864 | TYPE is one of `string', `comment', `tag', `cdata', or `text'. | 864 | TYPE is one of `string', `comment', `tag', `cdata', or `text'. |
| 865 | 865 | ||
| 866 | If non-nil LIMIT is a nearby position before point outside of any tag." | 866 | Optional argument LIMIT is the position to start parsing from. |
| 867 | ;; As usual, it's difficult to get a reliable answer without parsing the | 867 | If nil, start from a preceding tag at indentation." |
| 868 | ;; whole buffer. We'll assume that a tag at indentation is outside of | ||
| 869 | ;; any string or tag or comment or ... | ||
| 870 | (save-excursion | 868 | (save-excursion |
| 871 | (let ((pos (point)) | 869 | (let ((pos (point)) |
| 872 | text-start state) | 870 | text-start state) |
| 873 | (if limit (goto-char limit) | 871 | (if limit |
| 874 | ;; Hopefully this regexp will match something that's not inside | 872 | (goto-char limit) |
| 875 | ;; a tag and also hopefully the match is nearby. | 873 | ;; Skip tags backwards until we find one at indentation |
| 876 | (re-search-backward "^[ \t]*<[_:[:alpha:]/%!?#]" nil 'move)) | 874 | (while (and (ignore-errors (sgml-parse-tag-backward)) |
| 875 | (not (sgml-at-indentation-p))))) | ||
| 877 | (with-syntax-table sgml-tag-syntax-table | 876 | (with-syntax-table sgml-tag-syntax-table |
| 878 | (while (< (point) pos) | 877 | (while (< (point) pos) |
| 879 | ;; When entering this loop we're inside text. | 878 | ;; When entering this loop we're inside text. |
| @@ -966,10 +965,11 @@ With prefix argument, unquote the region." | |||
| 966 | (buffer-substring-no-properties | 965 | (buffer-substring-no-properties |
| 967 | (point) (progn (skip-syntax-forward "w_") (point)))) | 966 | (point) (progn (skip-syntax-forward "w_") (point)))) |
| 968 | 967 | ||
| 969 | (defsubst sgml-looking-back-at (s) | 968 | (defsubst sgml-looking-back-at (str) |
| 970 | (let ((start (- (point) (length s)))) | 969 | "Return t if the test before point matches STR." |
| 970 | (let ((start (- (point) (length str)))) | ||
| 971 | (and (>= start (point-min)) | 971 | (and (>= start (point-min)) |
| 972 | (equal s (buffer-substring-no-properties start (point)))))) | 972 | (equal str (buffer-substring-no-properties start (point)))))) |
| 973 | 973 | ||
| 974 | (defun sgml-parse-tag-backward () | 974 | (defun sgml-parse-tag-backward () |
| 975 | "Parse an SGML tag backward, and return information about the tag. | 975 | "Parse an SGML tag backward, and return information about the tag. |