aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/scheme.el33
1 files changed, 21 insertions, 12 deletions
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index 79d076ff145..3242f1c345c 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -387,12 +387,12 @@ See `run-hooks'."
387(defvar scheme-font-lock-keywords scheme-font-lock-keywords-1 387(defvar scheme-font-lock-keywords scheme-font-lock-keywords-1
388 "Default expressions to highlight in Scheme modes.") 388 "Default expressions to highlight in Scheme modes.")
389 389
390(defconst scheme-sexp-comment-syntax-table 390;; (defconst scheme-sexp-comment-syntax-table
391 (let ((st (make-syntax-table scheme-mode-syntax-table))) 391;; (let ((st (make-syntax-table scheme-mode-syntax-table)))
392 (modify-syntax-entry ?\; "." st) 392;; (modify-syntax-entry ?\; "." st)
393 (modify-syntax-entry ?\n " " st) 393;; (modify-syntax-entry ?\n " " st)
394 (modify-syntax-entry ?# "'" st) 394;; (modify-syntax-entry ?# "'" st)
395 st)) 395;; st))
396 396
397(put 'lambda 'scheme-doc-string-elt 2) 397(put 'lambda 'scheme-doc-string-elt 2)
398(put 'lambda* 'scheme-doc-string-elt 2) 398(put 'lambda* 'scheme-doc-string-elt 2)
@@ -428,6 +428,7 @@ See `run-hooks'."
428 428
429(defun scheme-syntax-propertize-sexp-comment (end) 429(defun scheme-syntax-propertize-sexp-comment (end)
430 (let ((state (syntax-ppss)) 430 (let ((state (syntax-ppss))
431 ;; (beg (point))
431 (checked (point))) 432 (checked (point)))
432 (when (eq 2 (nth 7 state)) 433 (when (eq 2 (nth 7 state))
433 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends. 434 ;; It's a sexp-comment. Tell parse-partial-sexp where it ends.
@@ -437,9 +438,11 @@ See `run-hooks'."
437 (progn 438 (progn
438 (setq found nil) 439 (setq found nil)
439 (condition-case nil 440 (condition-case nil
440 (progn 441 (save-restriction
442 (narrow-to-region (point-min) end)
441 (goto-char startpos) 443 (goto-char startpos)
442 (forward-sexp 1) 444 (forward-sexp 1)
445 ;; (cl-assert (> (point) beg))
443 (setq found (point))) 446 (setq found (point)))
444 (scan-error (goto-char end))) 447 (scan-error (goto-char end)))
445 ;; If there's a nested `#;', the syntax-tables will normally 448 ;; If there's a nested `#;', the syntax-tables will normally
@@ -447,16 +450,22 @@ See `run-hooks'."
447 ;; (forward-sexp 1) above may have landed at the wrong place. 450 ;; (forward-sexp 1) above may have landed at the wrong place.
448 ;; So look for `#;' in the text over which we jumped, and 451 ;; So look for `#;' in the text over which we jumped, and
449 ;; mark those we found as nested sexp-comments. 452 ;; mark those we found as nested sexp-comments.
450 (let ((limit (or found end))) 453 (let ((limit (min end (or found end))))
451 (when (< checked limit) 454 (when (< checked limit)
452 (goto-char checked) 455 (goto-char checked)
453 (when (re-search-forward "\\(#\\);" limit 'move) 456 (while (and (re-search-forward "\\(#\\);" limit 'move)
454 (setq checked (point)) 457 ;; Skip those #; inside comments and strings.
458 (nth 8 (save-excursion
459 (parse-partial-sexp
460 startpos (match-beginning 0))))))
461 (setq checked (point))
462 (when (< (point) limit)
455 (put-text-property (match-beginning 1) (match-end 1) 463 (put-text-property (match-beginning 1) (match-end 1)
456 'syntax-table 464 'syntax-table
457 (string-to-syntax "< cn")) 465 (string-to-syntax "< cn"))
458 (loop (point))) 466 (loop (point))
459 (< (point) limit))))) 467 ;; Try the `forward-sexp' with the new text state.
468 t)))))
460 (when found 469 (when found
461 (goto-char found) 470 (goto-char found)
462 (put-text-property (1- found) found 471 (put-text-property (1- found) found