[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/julia-mode b5f5983 346/352: Indent lines after hanging ope
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/julia-mode b5f5983 346/352: Indent lines after hanging operator even if previous line contains # (#115) |
Date: |
Sun, 29 Aug 2021 11:23:15 -0400 (EDT) |
branch: elpa/julia-mode
commit b5f5983d2b232c8bba4c5eff75cccdb787c19d98
Author: Adam B <adam_gpg@thebeckmeyers.xyz>
Commit: GitHub <noreply@github.com>
Indent lines after hanging operator even if previous line contains # (#115)
* General refactor and improvements
These are changes unrelated to #15 that just make the code a bit more
readable. This commit should be reviewed separately.
Since the julia group was declared with a :prefix of julia- all of
these customization variables will be in the julia group anyway. Also,
since julia-mode didn't declare it's group, an anonymous julia-mode
group was getting created for faces.
* Move around definitions to get code byte-compiling cleanly
* Indent lines after hanging operator even if previous line contains #
Because the previous implementation used a regex to detect whether the
hanging operator was in a comment or not, it did not detect hanging
operators following a # in a string.
Fixes #19
* Add comment explaining automatic adding to latest defgroup
---
julia-mode-tests.el | 36 +++++++++-
julia-mode.el | 194 ++++++++++++++++++++++++++--------------------------
2 files changed, 130 insertions(+), 100 deletions(-)
diff --git a/julia-mode-tests.el b/julia-mode-tests.el
index 94d46bb..f348821 100644
--- a/julia-mode-tests.el
+++ b/julia-mode-tests.el
@@ -88,6 +88,8 @@ matching line or end of match if END is non-nil. Optional
ARG is passed to FUN.
(point-at-bol)))
,to)))))
+;;; indent tests
+
(ert-deftest julia--test-indent-if ()
"We should indent inside if bodies."
(julia--should-indent
@@ -452,6 +454,36 @@ end"
end")
)
+(ert-deftest julia--test-indent-hanging ()
+ "Test indentation for line following a hanging operator."
+ (julia--should-indent
+ "
+f(x) =
+x*
+x"
+ "
+f(x) =
+ x*
+ x")
+ (julia--should-indent
+ "
+a = \"#\" |>
+identity"
+ "
+a = \"#\" |>
+ identity")
+ ;; make sure we don't interpret a hanging operator in a comment as
+ ;; an actual hanging operator for indentation
+ (julia--should-indent
+ "
+a = \"#\" # |>
+identity"
+ "
+a = \"#\" # |>
+identity"))
+
+;;; font-lock tests
+
(ert-deftest julia--test-symbol-font-locking-at-bol ()
"Symbols get font-locked at beginning or line."
(julia--should-font-lock
@@ -598,8 +630,8 @@ end")
"Point moves to beginning of multi-line assignment function."
(julia--should-move-point
"f(x)=
-x*
-x" 'beginning-of-defun "\\*\nx" 1))
+ x*
+ x" 'beginning-of-defun "x$" 1))
(ert-deftest julia--test-beginning-of-defun-assn-3 ()
"Point moves to beginning of multi-line assignment function adjoining
diff --git a/julia-mode.el b/julia-mode.el
index dedf966..0230ff6 100644
--- a/julia-mode.el
+++ b/julia-mode.el
@@ -45,22 +45,19 @@
"Major mode for the julia programming language."
:group 'languages
:prefix "julia-")
+;; all custom variables are automatically added to the most recent defgroup
(defcustom julia-indent-offset 4
"Number of spaces per indentation level."
- :type 'integer
- :group 'julia)
+ :type 'integer)
(defface julia-macro-face
'((t :inherit font-lock-preprocessor-face))
- "Face for Julia macro invocations."
- :group 'julia-mode)
+ "Face for Julia macro invocations.")
(defface julia-quoted-symbol-face
'((t :inherit font-lock-constant-face))
- "Face for quoted Julia symbols, e.g. :foo."
- :group 'julia-mode)
-
+ "Face for quoted Julia symbols, e.g. :foo.")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.jl\\'" . julia-mode))
@@ -119,68 +116,68 @@
(defconst julia-hanging-operator-regexp
;; taken from julia-parser.scm
- (concat "^[^#\n]+ "
- (regexp-opt
- '( ;; conditional
- "?"
- ;; assignment
- "=" ":=" "+=" "-=" "*=" "/=" "//=" ".//=" ".*=" "./=" "\\=" ".\\="
- "^=" ".^=" "÷=" ".÷=" "%=" ".%=" "|=" "&=" "$=" "=>" "<<=" ">>="
- ">>>=" "~" ".+=" ".-="
- ;; arrow
- "--" "-->" "←" "→" "↔" "↚" "↛" "↠" "↣" "↦" "↮" "⇎" "⇏" "⇒" "⇔" "⇴"
- "⇶" "⇷" "⇸" "⇹" "⇺" "⇻" "⇼" "⇽" "⇾" "⇿" "⟵" "⟶" "⟷" "⟷" "⟹"
- "⟺" "⟻" "⟼" "⟽" "⟾" "⟿" "⤀" "⤁" "⤂" "⤃" "⤄" "⤅" "⤆" "⤇" "⤌"
- "⤍" "⤎" "⤏" "⤐" "⤑" "⤔" "⤕" "⤖" "⤗" "⤘" "⤝" "⤞" "⤟" "⤠" "⥄" "⥅"
- "⥆" "⥇" "⥈" "⥊" "⥋" "⥎" "⥐" "⥒" "⥓" "⥖" "⥗" "⥚" "⥛" "⥞" "⥟" "⥢"
- "⥤" "⥦" "⥧" "⥨" "⥩" "⥪" "⥫" "⥬" "⥭" "⥰" "⧴" "⬱" "⬰" "⬲" "⬳" "⬴"
- "⬵" "⬶" "⬷" "⬸" "⬹" "⬺" "⬻" "⬼" "⬽" "⬾" "⬿" "⭀" "⭁" "⭂" "⭃" "⭄"
- "⭇" "⭈" "⭉" "⭊" "⭋" "⭌" "←" "→"
- ;; or and and
- "&&" "||"
- ;; comparison
- ">" "<" ">=" "≥" "<=" "≤" "==" "===" "≡" "!=" "≠" "!==" "≢" ".>"
- ".<" ".>=" ".≥" ".<=" ".≤" ".==" ".!=" ".≠" ".=" ".!" "<:" ">:"
"∈"
- "∉" "∋" "∌" "⊆" "⊈" "⊂" "⊄" "⊊" "∝" "∊" "∍" "∥" "∦" "∷" "∺" "∻"
"∽"
- "∾" "≁" "≃" "≄" "≅" "≆" "≇" "≈" "≉" "≊" "≋" "≌" "≍" "≎" "≐" "≑"
"≒"
- "≓" "≔" "≕" "≖" "≗" "≘" "≙" "≚" "≛" "≜" "≝" "≞" "≟" "≣" "≦" "≧"
"≨"
- "≩" "≪" "≫" "≬" "≭" "≮" "≯" "≰" "≱" "≲" "≳" "≴" "≵" "≶" "≷" "≸"
"≹"
- "≺" "≻" "≼" "≽" "≾" "≿" "⊀" "⊁" "⊃" "⊅" "⊇" "⊉" "⊋" "⊏" "⊐" "⊑"
"⊒"
- "⊜" "⊩" "⊬" "⊮" "⊰" "⊱" "⊲" "⊳" "⊴" "⊵" "⊶" "⊷" "⋍" "⋐" "⋑" "⋕"
"⋖"
- "⋗" "⋘" "⋙" "⋚" "⋛" "⋜" "⋝" "⋞" "⋟" "⋠" "⋡" "⋢" "⋣" "⋤" "⋥" "⋦"
"⋧"
- "⋨" "⋩" "⋪" "⋫" "⋬" "⋭" "⋲" "⋳" "⋴" "⋵" "⋶" "⋷" "⋸" "⋹" "⋺" "⋻"
"⋼"
- "⋽" "⋾" "⋿" "⟈" "⟉" "⟒" "⦷" "⧀" "⧁" "⧡" "⧣" "⧤" "⧥" "⩦" "⩧" "⩪"
"⩫"
- "⩬" "⩭" "⩮" "⩯" "⩰" "⩱" "⩲" "⩳" "⩴" "⩵" "⩶" "⩷" "⩸" "⩹" "⩺" "⩻"
"⩼"
- "⩽" "⩾" "⩿" "⪀" "⪁" "⪂" "⪃" "⪄" "⪅" "⪆" "⪇" "⪈" "⪉" "⪊" "⪋" "⪌"
"⪍"
- "⪎" "⪏" "⪐" "⪑" "⪒" "⪓" "⪔" "⪕" "⪖" "⪗" "⪘" "⪙" "⪚" "⪛" "⪜" "⪝"
"⪞"
- "⪟" "⪠" "⪡" "⪢" "⪣" "⪤" "⪥" "⪦" "⪧" "⪨" "⪩" "⪪" "⪫" "⪬" "⪭" "⪮"
"⪯"
- "⪰" "⪱" "⪲" "⪳" "⪴" "⪵" "⪶" "⪷" "⪸" "⪹" "⪺" "⪻" "⪼" "⪽" "⪾" "⪿"
"⫀"
- "⫁" "⫂" "⫃" "⫄" "⫅" "⫆" "⫇" "⫈" "⫉" "⫊" "⫋" "⫌" "⫍" "⫎" "⫏" "⫐"
"⫑"
- "⫒" "⫓" "⫔" "⫕" "⫖" "⫗" "⫘" "⫙" "⫷" "⫸" "⫹" "⫺" "⊢" "⊣"
- ;; pipe, colon
- "|>" "<|" ":" ".."
- ;; plus
- "+" "-" "⊕" "⊖" "⊞" "⊟" ".+" ".-" "++" "|" "∪" "∨" "$" "⊔" "±" "∓"
- "∔" "∸" "≂" "≏" "⊎" "⊻" "⊽" "⋎" "⋓" "⧺" "⧻" "⨈" "⨢" "⨣" "⨤" "⨥"
"⨦"
- "⨧" "⨨" "⨩" "⨪" "⨫" "⨬" "⨭" "⨮" "⨹" "⨺" "⩁" "⩂" "⩅" "⩊" "⩌" "⩏"
"⩐"
- "⩒" "⩔" "⩖" "⩗" "⩛" "⩝" "⩡" "⩢" "⩣"
- ;; bitshift
- "<<" ">>" ">>>" ".<<" ".>>" ".>>>"
- ;; times
- "*" "/" "./" "÷" ".÷" "%" "⋅" "∘" "×" ".%" ".*" "\\"
- ".\\" "&" "∩" "∧" "⊗" "⊘" "⊙" "⊚" "⊛" "⊠" "⊡" "⊓" "∗" "∙" "∤" "⅋"
- "≀" "⊼" "⋄" "⋆" "⋇" "⋉" "⋊" "⋋" "⋌" "⋏" "⋒" "⟑" "⦸" "⦼" "⦾" "⦿"
"⧶"
- "⧷" "⨇" "⨰" "⨱" "⨲" "⨳" "⨴" "⨵" "⨶" "⨷" "⨸" "⨻" "⨼" "⨽" "⩀" "⩃"
"⩄"
- "⩋" "⩍" "⩎" "⩑" "⩓" "⩕" "⩘" "⩚" "⩜" "⩞" "⩟" "⩠" "⫛" "⊍" "▷" "⨝"
"⟕"
- "⟖" "⟗"
- ;; rational
- "//" ".//"
- ;; power
- "^" ".^" "↑" "↓" "⇵" "⟰" "⟱" "⤈" "⤉" "⤊" "⤋" "⤒" "⤓" "⥉" "⥌" "⥍"
- "⥏" "⥑" "⥔" "⥕" "⥘" "⥙" "⥜" "⥝" "⥠" "⥡" "⥣" "⥥" "⥮" "⥯" "↑" "↓"
- ;; decl, dot
- "::" "."))
- (regexp-opt '(" #" " \n" "#" "\n"))))
+ (rx (or
+ ;; conditional
+ "?"
+ ;; assignment
+ "=" ":=" "+=" "-=" "*=" "/=" "//=" ".//=" ".*=" "./=" "\\=" ".\\="
+ "^=" ".^=" "÷=" ".÷=" "%=" ".%=" "|=" "&=" "$=" "=>" "<<=" ">>="
+ ">>>=" "~" ".+=" ".-="
+ ;; arrow
+ "--" "-->" "←" "→" "↔" "↚" "↛" "↠" "↣" "↦" "↮" "⇎" "⇏" "⇒" "⇔" "⇴"
+ "⇶" "⇷" "⇸" "⇹" "⇺" "⇻" "⇼" "⇽" "⇾" "⇿" "⟵" "⟶" "⟷" "⟷" "⟹"
+ "⟺" "⟻" "⟼" "⟽" "⟾" "⟿" "⤀" "⤁" "⤂" "⤃" "⤄" "⤅" "⤆" "⤇" "⤌"
+ "⤍" "⤎" "⤏" "⤐" "⤑" "⤔" "⤕" "⤖" "⤗" "⤘" "⤝" "⤞" "⤟" "⤠" "⥄" "⥅"
+ "⥆" "⥇" "⥈" "⥊" "⥋" "⥎" "⥐" "⥒" "⥓" "⥖" "⥗" "⥚" "⥛" "⥞" "⥟" "⥢"
+ "⥤" "⥦" "⥧" "⥨" "⥩" "⥪" "⥫" "⥬" "⥭" "⥰" "⧴" "⬱" "⬰" "⬲" "⬳" "⬴"
+ "⬵" "⬶" "⬷" "⬸" "⬹" "⬺" "⬻" "⬼" "⬽" "⬾" "⬿" "⭀" "⭁" "⭂" "⭃" "⭄"
+ "⭇" "⭈" "⭉" "⭊" "⭋" "⭌" "←" "→"
+ ;; or and and
+ "&&" "||"
+ ;; comparison
+ ">" "<" ">=" "≥" "<=" "≤" "==" "===" "≡" "!=" "≠" "!==" "≢" ".>"
+ ".<" ".>=" ".≥" ".<=" ".≤" ".==" ".!=" ".≠" ".=" ".!" "<:" ">:" "∈"
+ "∉" "∋" "∌" "⊆" "⊈" "⊂" "⊄" "⊊" "∝" "∊" "∍" "∥" "∦" "∷" "∺" "∻" "∽"
+ "∾" "≁" "≃" "≄" "≅" "≆" "≇" "≈" "≉" "≊" "≋" "≌" "≍" "≎" "≐" "≑" "≒"
+ "≓" "≔" "≕" "≖" "≗" "≘" "≙" "≚" "≛" "≜" "≝" "≞" "≟" "≣" "≦" "≧" "≨"
+ "≩" "≪" "≫" "≬" "≭" "≮" "≯" "≰" "≱" "≲" "≳" "≴" "≵" "≶" "≷" "≸" "≹"
+ "≺" "≻" "≼" "≽" "≾" "≿" "⊀" "⊁" "⊃" "⊅" "⊇" "⊉" "⊋" "⊏" "⊐" "⊑" "⊒"
+ "⊜" "⊩" "⊬" "⊮" "⊰" "⊱" "⊲" "⊳" "⊴" "⊵" "⊶" "⊷" "⋍" "⋐" "⋑" "⋕" "⋖"
+ "⋗" "⋘" "⋙" "⋚" "⋛" "⋜" "⋝" "⋞" "⋟" "⋠" "⋡" "⋢" "⋣" "⋤" "⋥" "⋦" "⋧"
+ "⋨" "⋩" "⋪" "⋫" "⋬" "⋭" "⋲" "⋳" "⋴" "⋵" "⋶" "⋷" "⋸" "⋹" "⋺" "⋻" "⋼"
+ "⋽" "⋾" "⋿" "⟈" "⟉" "⟒" "⦷" "⧀" "⧁" "⧡" "⧣" "⧤" "⧥" "⩦" "⩧" "⩪" "⩫"
+ "⩬" "⩭" "⩮" "⩯" "⩰" "⩱" "⩲" "⩳" "⩴" "⩵" "⩶" "⩷" "⩸" "⩹" "⩺" "⩻" "⩼"
+ "⩽" "⩾" "⩿" "⪀" "⪁" "⪂" "⪃" "⪄" "⪅" "⪆" "⪇" "⪈" "⪉" "⪊" "⪋" "⪌" "⪍"
+ "⪎" "⪏" "⪐" "⪑" "⪒" "⪓" "⪔" "⪕" "⪖" "⪗" "⪘" "⪙" "⪚" "⪛" "⪜" "⪝" "⪞"
+ "⪟" "⪠" "⪡" "⪢" "⪣" "⪤" "⪥" "⪦" "⪧" "⪨" "⪩" "⪪" "⪫" "⪬" "⪭" "⪮" "⪯"
+ "⪰" "⪱" "⪲" "⪳" "⪴" "⪵" "⪶" "⪷" "⪸" "⪹" "⪺" "⪻" "⪼" "⪽" "⪾" "⪿" "⫀"
+ "⫁" "⫂" "⫃" "⫄" "⫅" "⫆" "⫇" "⫈" "⫉" "⫊" "⫋" "⫌" "⫍" "⫎" "⫏" "⫐" "⫑"
+ "⫒" "⫓" "⫔" "⫕" "⫖" "⫗" "⫘" "⫙" "⫷" "⫸" "⫹" "⫺" "⊢" "⊣"
+ ;; pipe, colon
+ "|>" "<|" ":" ".."
+ ;; plus
+ "+" "-" "⊕" "⊖" "⊞" "⊟" ".+" ".-" "++" "|" "∪" "∨" "$" "⊔" "±" "∓"
+ "∔" "∸" "≂" "≏" "⊎" "⊻" "⊽" "⋎" "⋓" "⧺" "⧻" "⨈" "⨢" "⨣" "⨤" "⨥" "⨦"
+ "⨧" "⨨" "⨩" "⨪" "⨫" "⨬" "⨭" "⨮" "⨹" "⨺" "⩁" "⩂" "⩅" "⩊" "⩌" "⩏" "⩐"
+ "⩒" "⩔" "⩖" "⩗" "⩛" "⩝" "⩡" "⩢" "⩣"
+ ;; bitshift
+ "<<" ">>" ">>>" ".<<" ".>>" ".>>>"
+ ;; times
+ "*" "/" "./" "÷" ".÷" "%" "⋅" "∘" "×" ".%" ".*" "\\"
+ ".\\" "&" "∩" "∧" "⊗" "⊘" "⊙" "⊚" "⊛" "⊠" "⊡" "⊓" "∗" "∙" "∤" "⅋"
+ "≀" "⊼" "⋄" "⋆" "⋇" "⋉" "⋊" "⋋" "⋌" "⋏" "⋒" "⟑" "⦸" "⦼" "⦾" "⦿" "⧶"
+ "⧷" "⨇" "⨰" "⨱" "⨲" "⨳" "⨴" "⨵" "⨶" "⨷" "⨸" "⨻" "⨼" "⨽" "⩀" "⩃" "⩄"
+ "⩋" "⩍" "⩎" "⩑" "⩓" "⩕" "⩘" "⩚" "⩜" "⩞" "⩟" "⩠" "⫛" "⊍" "▷" "⨝" "⟕"
+ "⟖" "⟗"
+ ;; rational
+ "//" ".//"
+ ;; power
+ "^" ".^" "↑" "↓" "⇵" "⟰" "⟱" "⤈" "⤉" "⤊" "⤋" "⤒" "⤓" "⥉" "⥌" "⥍"
+ "⥏" "⥑" "⥔" "⥕" "⥘" "⥙" "⥜" "⥝" "⥠" "⥡" "⥣" "⥥" "⥮" "⥯" "↑" "↓"
+ ;; decl, dot
+ "::" ".")
+ (* blank)
+ (or eol ?#)))
(defconst julia-unquote-regex
"\\(\\s(\\|\\s-\\|-\\|[,%=<>\\+*/?&|!\\^~\\\\;:]\\|^\\)\\($[a-zA-Z0-9_]+\\)")
@@ -302,6 +299,21 @@
(defconst julia-block-end-keywords
(list "end" "else" "elseif" "catch" "finally"))
+(defsubst julia-syntax-comment-or-string-p (&optional syntax-ppss)
+ "Return non-nil if SYNTAX-PPSS is inside string or comment."
+ (nth 8 (or syntax-ppss (syntax-ppss))))
+
+(defun julia-in-comment (&optional syntax-ppss)
+ "Return non-nil if point is inside a comment using SYNTAX-PPSS.
+Handles both single-line and multi-line comments."
+ (nth 4 (or syntax-ppss (syntax-ppss))))
+
+(defun julia-in-string (&optional syntax-ppss)
+ "Return non-nil if point is inside a string using SYNTAX-PPSS.
+Note this is Emacs' notion of what is highlighted as a string.
+As a result, it is true inside \"foo\", `foo` and 'f'."
+ (nth 3 (or syntax-ppss (syntax-ppss))))
+
(defconst julia-syntax-propertize-function
(syntax-propertize-rules
;; triple-quoted strings are a single string rather than 3
@@ -312,7 +324,8 @@
(0 (ignore (julia-syntax-stringify))))
;; backslash acts as an operator if it's not inside a string
("\\\\"
- (0 (unless (nth 3 (save-excursion (syntax-ppss (match-beginning 0))))
+ (0 (unless (julia-in-string
+ (save-excursion (syntax-ppss (match-beginning 0))))
(string-to-syntax "."))))
(julia-char-regex
;; treat ' in 'c' as string-delimiter
@@ -344,17 +357,6 @@
;; of overlapping triple-quotes with first escaped
((backward-char 2)))))
-(defun julia-in-comment (&optional syntax-ppss)
- "Return non-nil if point is inside a comment using SYNTAX-PPSS.
-Handles both single-line and multi-line comments."
- (nth 4 (or syntax-ppss (syntax-ppss))))
-
-(defun julia-in-string (&optional syntax-ppss)
- "Return non-nil if point is inside a string using SYNTAX-PPSS.
-Note this is Emacs' notion of what is highlighted as a string.
-As a result, it is true inside \"foo\", `foo` and 'f'."
- (nth 3 (or syntax-ppss (syntax-ppss))))
-
(defun julia-in-brackets ()
"Return non-nil if point is inside square brackets."
(let ((start-pos (point))
@@ -365,7 +367,7 @@ As a result, it is true inside \"foo\", `foo` and 'f'."
(while (< (point) start-pos)
;; Don't count [ or ] inside strings, characters or comments.
- (unless (or (julia-in-string) (julia-in-comment))
+ (unless (julia-syntax-comment-or-string-p)
(when (looking-at (rx "["))
(cl-incf open-count))
@@ -381,7 +383,7 @@ As a result, it is true inside \"foo\", `foo` and 'f'."
"Return the word at point if it matches any keyword in KW-LIST.
KW-LIST is a list of strings. The word at point is not considered
a keyword if used as a field name, X.word, or quoted, :word."
- (and (or (= (point) 1)
+ (and (or (bobp)
(and (not (equal (char-before (point)) ?.))
(not (equal (char-before (point)) ?:))))
(not (looking-at "(")) ; handle "function(" when on (
@@ -411,7 +413,7 @@ symbol, gives up when this is not true."
(while (and (not done) (< (point-min) (point)))
(julia-safe-backward-sexp)
(cond
- ((looking-at (rx (or "import" "export" "using")))
+ ((looking-at (regexp-opt (list "import" "export" "using")))
(setf done (point)))
((looking-at (rx (group (* (or word (syntax symbol)))) (0+ space)
":"))
(if module
@@ -452,12 +454,6 @@ Do not move back beyond MIN."
(goto-char pos)
(+ julia-indent-offset (current-indentation))))))
-(defsubst julia--safe-backward-char ()
- "Move back one character, but don't error if we're at the
-beginning of the buffer."
- (unless (eq (point) (point-min))
- (backward-char)))
-
(defcustom julia-max-block-lookback 20000
"When indenting, don't look back more than this many characters
to see if there are unclosed blocks.
@@ -465,8 +461,7 @@ to see if there are unclosed blocks.
This variable has a small effect on indent performance if set
too high, but stops indenting in the middle of long blocks if set
too low."
- :type 'integer
- :group 'julia)
+ :type 'integer)
(defun julia-paren-indent ()
"Return the column of the text following the innermost
@@ -528,6 +523,12 @@ the (possibly narrowed) buffer, so there is nowhere else
to go."
(t
(throw 'result 0)))))))
+(defun julia--hanging-operator-p ()
+ "Return t if current line ends with a hanging operator."
+ (and (re-search-forward julia-hanging-operator-regexp (line-end-position) t)
+ (not (julia-syntax-comment-or-string-p
+ (save-excursion (syntax-ppss (match-beginning 0)))))))
+
(defun julia-indent-hanging ()
"Calculate indentation for lines that follow \"hanging\"
operators (operators that end the previous line) as defined in
@@ -540,9 +541,9 @@ only comments."
(save-excursion
(when (> (julia-prev-line-skip-blank-or-comment) 0)
(setq prev-indent (current-indentation))
- (when (looking-at-p julia-hanging-operator-regexp)
+ (when (julia--hanging-operator-p)
(if (and (> (julia-prev-line-skip-blank-or-comment) 0)
- (looking-at-p julia-hanging-operator-regexp))
+ (julia--hanging-operator-p))
;; two preceding hanging operators => indent same as line
;; above
prev-indent
@@ -620,10 +621,6 @@ TYPE can be `comment', `string' or `paren'."
((nth 8 ppss) (if (nth 4 ppss) 'comment 'string))
((nth 1 ppss) 'paren))))
-(defsubst julia-syntax-comment-or-string-p (&optional syntax-ppss)
- "Return non-nil if SYNTAX-PPSS is inside string or comment."
- (nth 8 (or syntax-ppss (syntax-ppss))))
-
(defun julia-looking-at-beginning-of-defun (&optional syntax-ppss)
"Check if point is at `beginning-of-defun' using SYNTAX-PPSS."
(and (not (julia-syntax-comment-or-string-p (or syntax-ppss (syntax-ppss))))
@@ -746,6 +743,7 @@ Return nil if point is not in a function, otherwise point."
;;;###autoload
(define-derived-mode julia-mode prog-mode "Julia"
"Major mode for editing julia code."
+ :group 'julia
(set-syntax-table julia-mode-syntax-table)
(setq-local comment-start "# ")
(setq-local comment-start-skip "#+\\s-*")
- [nongnu] elpa/julia-mode 864e124 311/352: remove newline, (continued)
- [nongnu] elpa/julia-mode 864e124 311/352: remove newline, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 686bed3 309/352: remove unused lexical args that gave a warning, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 4515765 320/352: add a changelog (#96), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode bfa54b2 331/352: Minor point about preferring the rx macro for regexs., ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 88d7d87 332/352: Merge pull request #121 from JuliaEditorSupport/tp/prefer-rx, ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d91f1d0 324/352: Remove regexp-opt workarounds for Emacs < 24 (#101), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode d69b095 342/352: Removed require statement for auctex that broke prettify. Fixes #99 (#116), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 8ea90c7 347/352: Rec/quoted quote (#143), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode 5cccdbd 350/352: Fixed installation documentation (#147), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode fe6f6f7 348/352: Allow block indentation inside of parentheticals (#152), ELPA Syncer, 2021/08/29
- [nongnu] elpa/julia-mode b5f5983 346/352: Indent lines after hanging operator even if previous line contains # (#115),
ELPA Syncer <=
- [nongnu] elpa/julia-mode 69bc337 270/352: add support for `where` keyword, ELPA Syncer, 2021/08/29