@@ -974,46 +974,43 @@ which is called with a single parameter, STATE (which is, in
974974turn, returned by `parse-partial-sexp' at the beginning of the
975975highlighted region)."
976976 (if (nth 3 state)
977- ; ; This might be a (doc)string or a |...| symbol.
978- (let ((startpos (nth 8 state)))
979- (if (eq (char-after startpos) ?| )
980- ; ; This is not a string, but a |...| symbol.
981- nil
982- (let* ((listbeg (nth 1 state))
983- (firstsym (and listbeg
984- (save-excursion
985- (goto-char listbeg)
986- (and (looking-at " ([ \t\n ]*\\ (\\ (\\ sw\\ |\\ s_\\ )+\\ )" )
987- (match-string 1 )))))
988- (docelt (and firstsym
989- (function-get (intern-soft firstsym)
990- lisp-doc-string-elt-property))))
991- (if (and docelt
992- ; ; It's a string in a form that can have a docstring.
993- ; ; Check whether it's in docstring position.
994- (save-excursion
995- (when (functionp docelt)
996- (goto-char (match-end 1 ))
997- (setq docelt (funcall docelt)))
998- (goto-char listbeg)
999- (forward-char 1 )
1000- (ignore-errors
1001- (while (and (> docelt 0 ) (< (point ) startpos)
1002- (progn (forward-sexp 1 ) t ))
1003- ; ; ignore metadata and type hints
1004- (unless (looking-at " [ \n\t ]*\\ (\\ ^[A-Z:].+\\ |\\ ^?{.+\\ )" )
1005- (setq docelt (1- docelt)))))
1006- (and (zerop docelt) (<= (point ) startpos)
1007- (progn (forward-comment (point-max )) t )
1008- (= (point ) (nth 8 state))))
1009- ; ; In a def, at last position is not a docstring
1010- (not (and (string= " def" firstsym)
1011- (save-excursion
1012- (goto-char startpos)
1013- (goto-char (+ startpos (length (sexp-at-point )) 2 ))
1014- (looking-at " [ \r\n\t ]*\) " )))))
1015- font-lock-doc-face
1016- font-lock-string-face ))))
977+ ; ; This is a (doc)string
978+ (let* ((startpos (nth 8 state))
979+ (listbeg (nth 1 state))
980+ (firstsym (and listbeg
981+ (save-excursion
982+ (goto-char listbeg)
983+ (and (looking-at " ([ \t\n ]*\\ (\\ (\\ sw\\ |\\ s_\\ )+\\ )" )
984+ (match-string 1 )))))
985+ (docelt (and firstsym
986+ (function-get (intern-soft firstsym)
987+ lisp-doc-string-elt-property))))
988+ (if (and docelt
989+ ; ; It's a string in a form that can have a docstring.
990+ ; ; Check whether it's in docstring position.
991+ (save-excursion
992+ (when (functionp docelt)
993+ (goto-char (match-end 1 ))
994+ (setq docelt (funcall docelt)))
995+ (goto-char listbeg)
996+ (forward-char 1 )
997+ (ignore-errors
998+ (while (and (> docelt 0 ) (< (point ) startpos)
999+ (progn (forward-sexp 1 ) t ))
1000+ ; ; ignore metadata and type hints
1001+ (unless (looking-at " [ \n\t ]*\\ (\\ ^[A-Z:].+\\ |\\ ^?{.+\\ )" )
1002+ (setq docelt (1- docelt)))))
1003+ (and (zerop docelt) (<= (point ) startpos)
1004+ (progn (forward-comment (point-max )) t )
1005+ (= (point ) (nth 8 state))))
1006+ ; ; In a def, at last position is not a docstring
1007+ (not (and (string= " def" firstsym)
1008+ (save-excursion
1009+ (goto-char startpos)
1010+ (goto-char (+ startpos (length (sexp-at-point )) 2 ))
1011+ (looking-at " [ \r\n\t ]*\) " )))))
1012+ font-lock-doc-face
1013+ font-lock-string-face ))
10171014 font-lock-comment-face ))
10181015
10191016(defun clojure-font-lock-setup ()
0 commit comments