emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/julia-mode d74b8a3 171/352: Use the syntax table to detect


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode d74b8a3 171/352: Use the syntax table to detect if point is in a comment.
Date: Sun, 29 Aug 2021 11:22:38 -0400 (EDT)

branch: elpa/julia-mode
commit d74b8a311c4eac92bea3a3998343e02711d54f1f
Author: Wilfred Hughes <me@wilfred.me.uk>
Commit: Yichao Yu <yyc1992@gmail.com>

    Use the syntax table to detect if point is in a comment.
    
    This fixes #8538, where `julia-comment-open` was getting confused by
    strings inside comments.
    
    It also generalises `julia-in-comment` to handle multi-line comments.
---
 julia-mode.el | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/julia-mode.el b/julia-mode.el
index d3932ce..cb66002 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -189,24 +189,10 @@
     (or (equal item (car lst))
        (julia-member item (cdr lst)))))
 
-(if (not (fboundp 'evenp))
-    (defun evenp (x) (zerop (% x 2))))
-
-(defun julia-find-comment-open (p0)
-  (if (< (point) p0)
-      nil
-    (if (and (equal (char-after (point)) ?#)
-            (evenp (julia-strcount
-                    (buffer-substring p0 (point)) ?\")))
-       t
-      (if (= (point) p0)
-         nil
-       (progn (backward-char 1)
-              (julia-find-comment-open p0))))))
-
 (defun julia-in-comment ()
-  (save-excursion
-    (julia-find-comment-open (line-beginning-position))))
+  "Return non-nil if point is inside a comment.
+Handles both single-line and multi-line comments."
+  (nth 4 (syntax-ppss)))
 
 (defun julia-strcount (str chr)
   (let ((i 0)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]