126
126
(defun scheme-mode-variables ()
127
127
(set-syntax-table scheme-mode-syntax-table)
128
128
(setq local-abbrev-table scheme-mode-abbrev-table)
129
(set (make-local-variable 'paragraph-start) (concat "$\\|" page-delimiter))
130
(set (make-local-variable 'paragraph-separate) paragraph-start)
131
(set (make-local-variable 'paragraph-ignore-fill-prefix) t)
132
(set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph)
129
(setq-local paragraph-start (concat "$\\|" page-delimiter))
130
(setq-local paragraph-separate paragraph-start)
131
(setq-local paragraph-ignore-fill-prefix t)
132
(setq-local fill-paragraph-function 'lisp-fill-paragraph)
133
133
;; Adaptive fill mode gets in the way of auto-fill,
134
134
;; and should make no difference for explicit fill
135
135
;; because lisp-fill-paragraph should do the job.
136
(set (make-local-variable 'adaptive-fill-mode) nil)
137
(set (make-local-variable 'indent-line-function) 'lisp-indent-line)
138
(set (make-local-variable 'parse-sexp-ignore-comments) t)
139
(set (make-local-variable 'outline-regexp) ";;; \\|(....")
140
(set (make-local-variable 'comment-start) ";")
141
(set (make-local-variable 'comment-add) 1)
142
;; Look within the line for a ; following an even number of backslashes
143
;; after either a non-backslash or the line beginning.
144
(set (make-local-variable 'comment-start-skip)
145
"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\);+[ \t]*")
146
(set (make-local-variable 'font-lock-comment-start-skip) ";+ *")
147
(set (make-local-variable 'comment-column) 40)
148
(set (make-local-variable 'parse-sexp-ignore-comments) t)
149
(set (make-local-variable 'lisp-indent-function) 'scheme-indent-function)
136
(setq-local adaptive-fill-mode nil)
137
(setq-local indent-line-function 'lisp-indent-line)
138
(setq-local parse-sexp-ignore-comments t)
139
(setq-local outline-regexp ";;; \\|(....")
140
(setq-local add-log-current-defun-function #'lisp-current-defun-name)
141
(setq-local comment-start ";")
142
(setq-local comment-add 1)
143
(setq-local comment-start-skip ";+[ \t]*")
144
(setq-local comment-use-syntax t)
145
(setq-local comment-column 40)
146
(setq-local parse-sexp-ignore-comments t)
147
(setq-local lisp-indent-function 'scheme-indent-function)
150
148
(setq mode-line-process '("" scheme-mode-line-process))
151
(set (make-local-variable 'imenu-case-fold-search) t)
152
(setq imenu-generic-expression scheme-imenu-generic-expression)
153
(set (make-local-variable 'imenu-syntax-alist)
154
'(("+-*/.<>=?!$%_&~^:" . "w")))
155
(set (make-local-variable 'font-lock-defaults)
156
'((scheme-font-lock-keywords
157
scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
158
nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
160
(font-lock-mark-block-function . mark-defun)
161
(font-lock-syntactic-face-function
162
. scheme-font-lock-syntactic-face-function)
163
(parse-sexp-lookup-properties . t)
164
(font-lock-extra-managed-props syntax-table)))
165
(set (make-local-variable 'lisp-doc-string-elt-property)
166
'scheme-doc-string-elt))
149
(setq-local imenu-case-fold-search t)
150
(setq-local imenu-generic-expression scheme-imenu-generic-expression)
151
(setq-local imenu-syntax-alist '(("+-*/.<>=?!$%_&~^:" . "w")))
152
(setq-local syntax-propertize-function #'scheme-syntax-propertize)
153
(setq font-lock-defaults
154
'((scheme-font-lock-keywords
155
scheme-font-lock-keywords-1 scheme-font-lock-keywords-2)
156
nil t (("+-*/.<>=!?$%_&~^:" . "w") (?#. "w 14"))
158
(font-lock-mark-block-function . mark-defun)))
159
(setq-local lisp-doc-string-elt-property 'scheme-doc-string-elt))
168
161
(defvar scheme-mode-line-process "")
351
348
(forward-comment (point-max))
352
349
(if (eq (char-after) ?\() 2 0)))
354
(defun scheme-font-lock-syntactic-face-function (state)
355
(when (and (null (nth 3 state))
356
(eq (char-after (nth 8 state)) ?#)
357
(eq (char-after (1+ (nth 8 state))) ?\;))
358
;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
363
(let ((parse-sexp-lookup-properties nil))
364
(goto-char (+ 2 (nth 8 state)))
365
;; FIXME: this doesn't handle the case where the sexp
366
;; itself contains a #; comment.
369
(scan-error (nth 2 err)))))
370
(when (< pos (- end 2))
371
(put-text-property pos (- end 2)
372
'syntax-table scheme-sexp-comment-syntax-table))
373
(put-text-property (- end 1) end 'syntax-table '(12)))))
374
;; Choose the face to use.
375
(lisp-font-lock-syntactic-face-function state))
351
(defun scheme-syntax-propertize (beg end)
353
(scheme-syntax-propertize-sexp-comment (point) end)
355
(syntax-propertize-rules
356
("\\(#\\);" (1 (prog1 "< cn"
357
(scheme-syntax-propertize-sexp-comment (point) end)))))
360
(defun scheme-syntax-propertize-sexp-comment (_ end)
361
(let ((state (syntax-ppss)))
362
(when (eq 2 (nth 7 state))
363
;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
366
(goto-char (+ 2 (nth 8 state)))
367
;; FIXME: this doesn't handle the case where the sexp
368
;; itself contains a #; comment.
370
(put-text-property (1- (point)) (point)
371
'syntax-table (string-to-syntax "> cn")))
372
(scan-error (goto-char end))))))
378
375
(define-derived-mode dsssl-mode scheme-mode "DSSSL"
397
394
nil t (("+-*/.<>=?$%_&~^:" . "w"))
398
395
beginning-of-defun
399
396
(font-lock-mark-block-function . mark-defun)))
400
(set (make-local-variable 'imenu-case-fold-search) nil)
397
(setq-local add-log-current-defun-function #'lisp-current-defun-name)
398
(setq-local imenu-case-fold-search nil)
401
399
(setq imenu-generic-expression dsssl-imenu-generic-expression)
402
(set (make-local-variable 'imenu-syntax-alist)
403
'(("+-*/.<>=?$%_&~^:" . "w"))))
400
(setq-local imenu-syntax-alist '(("+-*/.<>=?$%_&~^:" . "w"))))
405
402
;; Extra syntax for DSSSL. This isn't separated from Scheme, but
406
403
;; shouldn't cause much trouble in scheme-mode.