/[emacs]/emacs/lisp/progmodes/scheme.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/scheme.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.56 by monnier, Wed Oct 5 14:23:13 2005 UTC revision 1.57 by monnier, Wed Oct 5 15:28:44 2005 UTC
# Line 100  Line 100 
100      ;; Other atom delimiters      ;; Other atom delimiters
101      (modify-syntax-entry ?\( "()  " st)      (modify-syntax-entry ?\( "()  " st)
102      (modify-syntax-entry ?\) ")(  " st)      (modify-syntax-entry ?\) ")(  " st)
103      (modify-syntax-entry ?\; "<   " st)      ;; It's used for single-line comments as well as for #;(...) sexp-comments.
104      (modify-syntax-entry ?\" "\"    " st)      (modify-syntax-entry ?\; "< 2 " st)
105        (modify-syntax-entry ?\" "\"   " st)
106      (modify-syntax-entry ?' "'   " st)      (modify-syntax-entry ?' "'   " st)
107      (modify-syntax-entry ?` "'   " st)      (modify-syntax-entry ?` "'   " st)
108    
# Line 168  Line 169 
169    (setq imenu-generic-expression scheme-imenu-generic-expression)    (setq imenu-generic-expression scheme-imenu-generic-expression)
170    (set (make-local-variable 'imenu-syntax-alist)    (set (make-local-variable 'imenu-syntax-alist)
171          '(("+-*/.<>=?!$%_&~^:" . "w")))          '(("+-*/.<>=?!$%_&~^:" . "w")))
172    (make-local-variable 'font-lock-defaults)    (set (make-local-variable 'font-lock-defaults)
173    (setq font-lock-defaults         '((scheme-font-lock-keywords
174          '((scheme-font-lock-keywords            scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
175             scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)           nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
176            nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))           beginning-of-defun
177            beginning-of-defun           (font-lock-mark-block-function . mark-defun)
178            (font-lock-mark-block-function . mark-defun)           (font-lock-syntactic-face-function
179            (font-lock-syntactic-face-function            . scheme-font-lock-syntactic-face-function)
180             . scheme-font-lock-syntactic-face-function))))           (parse-sexp-lookup-properties . t)
181             (font-lock-extra-managed-props syntax-table)))
182      (set (make-local-variable 'lisp-doc-string-elt-property)
183           'scheme-doc-string-elt))
184    
185  (defvar scheme-mode-line-process "")  (defvar scheme-mode-line-process "")
186    
# Line 352  See `run-hooks'." Line 356  See `run-hooks'."
356  (defvar scheme-font-lock-keywords scheme-font-lock-keywords-1  (defvar scheme-font-lock-keywords scheme-font-lock-keywords-1
357    "Default expressions to highlight in Scheme modes.")    "Default expressions to highlight in Scheme modes.")
358    
359    (defconst scheme-sexp-comment-syntax-table
360      (let ((st (make-syntax-table scheme-mode-syntax-table)))
361        (modify-syntax-entry ?\; "." st)
362        (modify-syntax-entry ?\n " " st)
363        (modify-syntax-entry ?#  "'" st)
364        st))
365    
366    (put 'lambda 'scheme-doc-string-elt 2)
367    ;; Docstring's pos in a `define' depends on whether it's a var or fun def.
368    (put 'define 'scheme-doc-string-elt
369         (lambda ()
370           ;; The function is called with point right after "define".
371           (forward-comment (point-max))
372           (if (eq (char-after) ?\() 2 0)))
373    
374  (defun scheme-font-lock-syntactic-face-function (state)  (defun scheme-font-lock-syntactic-face-function (state)
375    (if (nth 3 state)    (when (and (null (nth 3 state))
376        ;; In a string.               (eq (char-after (nth 8 state)) ?#)
377        (if (eq (char-after (nth 8 state)) ?|)               (eq (char-after (1+ (nth 8 state))) ?\;))
378            ;; This is not a string, but a |...| symbol.      ;; It's a sexp-comment.  Tell parse-partial-sexp where it ends.
379            nil      (save-excursion
380          font-lock-string-face)        (let ((pos (point))
381      ;; In a comment.              (end
382      font-lock-comment-face))               (condition-case err
383                     (let ((parse-sexp-lookup-properties nil))
384                       (goto-char (+ 2 (nth 8 state)))
385                       ;; FIXME: this doesn't handle the case where the sexp
386                       ;; itself contains a #; comment.
387                       (forward-sexp 1)
388                       (point))
389                   (scan-error (nth 2 err)))))
390            (when (< pos (- end 2))
391              (put-text-property pos (- end 2)
392                                 'syntax-table scheme-sexp-comment-syntax-table))
393            (put-text-property (- end 1) end 'syntax-table '(12)))))
394      ;; Choose the face to use.
395      (lisp-font-lock-syntactic-face-function state))
396    
397  ;;;###autoload  ;;;###autoload
398  (define-derived-mode dsssl-mode scheme-mode "DSSSL"  (define-derived-mode dsssl-mode scheme-mode "DSSSL"

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26