Skip to content

Commit 41bf024

Browse files
committed
Use syntax-ppss to detect when in a string or comment
1 parent d8b830a commit 41bf024

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

haskell-collapse.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
(let ((break nil))
3030
(while (and (not break)
3131
(search-backward-regexp "[[({]" beg t 1))
32-
(unless (eq (get-text-property (point) 'face) 'font-lock-string-face)
32+
(unless (elt (syntax-ppss) 3)
3333
(let ((orig (point)))
3434
(haskell-collapse-sexp)
3535
(goto-char orig)

haskell-decl-scan.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ then point does not move if already at the start of a declaration."
258258
;; here seems to be the only addition to make this
259259
;; module support LaTeX-style literate scripts.
260260
(if (and (looking-at start-decl-re)
261-
(not (eq (get-text-property (point) 'face)
262-
'font-lock-comment-face)))
261+
(not (elt (syntax-ppss) 4)))
263262
(match-beginning 1)))))
264263
(if (and start
265264
;; This complicated boolean determines whether we

haskell-font-lock.el

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ Regexp match data 0 points to the chars."
236236
sym-data)
237237
(if (or (memq (char-syntax (or (char-before start) ?\ )) syntaxes)
238238
(memq (char-syntax (or (char-after end) ?\ )) syntaxes)
239-
(memq (get-text-property start 'face)
240-
'(font-lock-doc-face font-lock-string-face
241-
font-lock-comment-face))
239+
(or (elt (syntax-ppss) 3) (elt (syntax-ppss) 4))
242240
(and (consp (setq sym-data (cdr (assoc (match-string 0) alist))))
243241
(let ((pred (cadr sym-data)))
244242
(setq sym-data (car sym-data))

0 commit comments

Comments
 (0)