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

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

[nongnu] elpa/julia-mode 76d5d75 183/352: Optimising julia-at-keyword.


From: ELPA Syncer
Subject: [nongnu] elpa/julia-mode 76d5d75 183/352: Optimising julia-at-keyword.
Date: Sun, 29 Aug 2021 11:22:41 -0400 (EDT)

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

    Optimising julia-at-keyword.
    
    It's an expensive function and we call it quite often. Ensure
    we do the cheap checks first, and avoid calling julia-in-brackets
    only if necessary.
---
 julia-mode.el | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/julia-mode.el b/julia-mode.el
index 7419cfe..cac3f03 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -220,12 +220,6 @@ This function provides equivalent functionality, but makes 
no efforts to optimis
 (defconst julia-block-end-keywords
   (list "end" "else" "elseif" "catch" "finally"))
 
-(defun julia-member (item lst)
-  (if (null lst)
-      nil
-    (or (equal item (car lst))
-       (julia-member item (cdr lst)))))
-
 (defun julia-in-comment ()
   "Return non-nil if point is inside a comment.
 Handles both single-line and multi-line comments."
@@ -289,9 +283,11 @@ a keyword if used as a field name, X.word, or quoted, 
:word."
   (and (or (= (point) 1)
           (and (not (equal (char-before (point)) ?.))
                (not (equal (char-before (point)) ?:))))
+       (member (current-word t) kw-list)
        (not (julia-in-comment))
-       (not (julia-in-brackets))
-       (julia-member (current-word t) kw-list)))
+       ;; 'end' is not a keyword when used for indexing, e.g. foo[end-2]
+       (or (not (equal (current-word t) "end"))
+           (not (julia-in-brackets)))))
 
 ;; if backward-sexp gives an error, move back 1 char to move over the '('
 (defun julia-safe-backward-sexp ()



reply via email to

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