diff options
| author | Stefan Monnier | 2005-10-05 14:23:13 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-10-05 14:23:13 +0000 |
| commit | f17ae68f2a52e51d304480e4e8ce1d1e6385f401 (patch) | |
| tree | a18597e9262f543663743ab7418c6da01aba927a | |
| parent | efbbcafbbecd28a962fe20b9afc45c353c0d7245 (diff) | |
| download | emacs-f17ae68f2a52e51d304480e4e8ce1d1e6385f401.tar.gz emacs-f17ae68f2a52e51d304480e4e8ce1d1e6385f401.zip | |
(scheme-mode-syntax-table): Move the nesting bit from # to |.
(scheme-font-lock-syntactic-face-function): New function, to
distinguish strings from |...| symbols.
(scheme-mode-variables): Use it. Also fix up the font-lock-time
syntax-table so that #|...|# is properly highlighted.
| -rw-r--r-- | lisp/progmodes/scheme.el | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index aa50a013585..cae3ac582ef 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el | |||
| @@ -90,7 +90,12 @@ | |||
| 90 | (modify-syntax-entry ?\] ")[ " st) | 90 | (modify-syntax-entry ?\] ")[ " st) |
| 91 | (modify-syntax-entry ?{ "(} " st) | 91 | (modify-syntax-entry ?{ "(} " st) |
| 92 | (modify-syntax-entry ?} "){ " st) | 92 | (modify-syntax-entry ?} "){ " st) |
| 93 | (modify-syntax-entry ?\| "\" 23b" st) | 93 | (modify-syntax-entry ?\| "\" 23bn" st) |
| 94 | ;; Guile allows #! ... !# comments. | ||
| 95 | ;; But SRFI-22 defines the comment as #!...\n instead. | ||
| 96 | ;; Also Guile says that the !# should be on a line of its own. | ||
| 97 | ;; It's too difficult to get it right, for too little benefit. | ||
| 98 | ;; (modify-syntax-entry ?! "_ 2" st) | ||
| 94 | 99 | ||
| 95 | ;; Other atom delimiters | 100 | ;; Other atom delimiters |
| 96 | (modify-syntax-entry ?\( "() " st) | 101 | (modify-syntax-entry ?\( "() " st) |
| @@ -103,7 +108,7 @@ | |||
| 103 | ;; Special characters | 108 | ;; Special characters |
| 104 | (modify-syntax-entry ?, "' " st) | 109 | (modify-syntax-entry ?, "' " st) |
| 105 | (modify-syntax-entry ?@ "' " st) | 110 | (modify-syntax-entry ?@ "' " st) |
| 106 | (modify-syntax-entry ?# "' 14bn" st) | 111 | (modify-syntax-entry ?# "' 14b" st) |
| 107 | (modify-syntax-entry ?\\ "\\ " st) | 112 | (modify-syntax-entry ?\\ "\\ " st) |
| 108 | st)) | 113 | st)) |
| 109 | 114 | ||
| @@ -167,9 +172,11 @@ | |||
| 167 | (setq font-lock-defaults | 172 | (setq font-lock-defaults |
| 168 | '((scheme-font-lock-keywords | 173 | '((scheme-font-lock-keywords |
| 169 | scheme-font-lock-keywords-1 scheme-font-lock-keywords-2) | 174 | scheme-font-lock-keywords-1 scheme-font-lock-keywords-2) |
| 170 | nil t (("+-*/.<>=!?$%_&~^:#" . "w")) beginning-of-defun | 175 | nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14")) |
| 176 | beginning-of-defun | ||
| 171 | (font-lock-mark-block-function . mark-defun) | 177 | (font-lock-mark-block-function . mark-defun) |
| 172 | (font-lock-syntactic-face-function . lisp-font-lock-syntactic-face-function)))) | 178 | (font-lock-syntactic-face-function |
| 179 | . scheme-font-lock-syntactic-face-function)))) | ||
| 173 | 180 | ||
| 174 | (defvar scheme-mode-line-process "") | 181 | (defvar scheme-mode-line-process "") |
| 175 | 182 | ||
| @@ -345,6 +352,16 @@ See `run-hooks'." | |||
| 345 | (defvar scheme-font-lock-keywords scheme-font-lock-keywords-1 | 352 | (defvar scheme-font-lock-keywords scheme-font-lock-keywords-1 |
| 346 | "Default expressions to highlight in Scheme modes.") | 353 | "Default expressions to highlight in Scheme modes.") |
| 347 | 354 | ||
| 355 | (defun scheme-font-lock-syntactic-face-function (state) | ||
| 356 | (if (nth 3 state) | ||
| 357 | ;; In a string. | ||
| 358 | (if (eq (char-after (nth 8 state)) ?|) | ||
| 359 | ;; This is not a string, but a |...| symbol. | ||
| 360 | nil | ||
| 361 | font-lock-string-face) | ||
| 362 | ;; In a comment. | ||
| 363 | font-lock-comment-face)) | ||
| 364 | |||
| 348 | ;;;###autoload | 365 | ;;;###autoload |
| 349 | (define-derived-mode dsssl-mode scheme-mode "DSSSL" | 366 | (define-derived-mode dsssl-mode scheme-mode "DSSSL" |
| 350 | "Major mode for editing DSSSL code. | 367 | "Major mode for editing DSSSL code. |