Skip to content

Commit

Permalink
Merge pull request JuliaLang#8633 from Wilfred/further_indentation_im…
Browse files Browse the repository at this point in the history
…provements

Indentation fixes for julia-mode
  • Loading branch information
pao committed Oct 10, 2014
2 parents 4dc1679 + aaa2a8e commit 5e32a66
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions contrib/julia-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -362,7 +348,7 @@ Do not move back beyond MIN."

(defvar julia-latexsubs (make-hash-table :test 'equal))

(defun julia-latexsub (arg)
(defun julia-latexsub ()
"Perform a LaTeX-like Unicode symbol substitution."
(interactive "*i")
(let ((orig-pt (point)))
Expand All @@ -385,8 +371,8 @@ Do not move back beyond MIN."
(defun julia-latexsub-or-indent (arg)
"Either indent according to mode or perform a LaTeX-like symbol substution"
(interactive "*i")
(if (latexsub arg)
(indent-according-to-mode)))
(if (latexsub)
(indent-for-tab-command arg)))
(define-key julia-mode-map (kbd "TAB") 'julia-latexsub-or-indent)

(defalias 'latexsub-or-indent 'julia-latexsub-or-indent)
Expand Down

0 comments on commit 5e32a66

Please sign in to comment.