10
10
; ; Artur Malabarba <[email protected] >
11
11
; ; URL: http://github.com/clojure-emacs/clojure-mode
12
12
; ; Keywords: languages clojure clojurescript lisp
13
- ; ; Version: 5.10.0-snapshot
13
+ ; ; Version: 5.10.0
14
14
; ; Package-Requires: ((emacs "25.1"))
15
15
16
16
; ; This file is not part of GNU Emacs.
94
94
" Face used to font-lock Clojure character literals."
95
95
:package-version '(clojure-mode . " 3.0.0" ))
96
96
97
- (defcustom clojure-indent-style : always-align
97
+ (defcustom clojure-indent-style ' always-align
98
98
" Indentation style to use for function forms and macro forms.
99
99
There are two cases of interest configured by this variable.
100
100
@@ -112,7 +112,7 @@ already use special indentation rules.
112
112
The possible values for this variable are keywords indicating how
113
113
to indent function forms.
114
114
115
- `: always-align' - Follow the same rules as `lisp-mode' . All
115
+ `always-align' - Follow the same rules as `lisp-mode' . All
116
116
args are vertically aligned with the first arg in case (A),
117
117
and vertically aligned with the function name in case (B).
118
118
For instance:
@@ -122,30 +122,27 @@ to indent function forms.
122
122
merge
123
123
some-coll)
124
124
125
- `: always-indent' - All args are indented like a macro body.
125
+ `always-indent' - All args are indented like a macro body.
126
126
(reduce merge
127
127
some-coll)
128
128
(reduce
129
129
merge
130
130
some-coll)
131
131
132
- `: align-arguments' - Case (A) is indented like `lisp' , and
132
+ `align-arguments' - Case (A) is indented like `lisp' , and
133
133
case (B) is indented like a macro body.
134
134
(reduce merge
135
135
some-coll)
136
136
(reduce
137
137
merge
138
138
some-coll)"
139
- :safe #'keywordp
140
- :type '(choice (const :tag " Same as `lisp-mode' " : always-align )
141
- (const :tag " Indent like a macro body" : always-indent )
139
+ :safe #'symbolp
140
+ :type '(choice (const :tag " Same as `lisp-mode' " ' always-align )
141
+ (const :tag " Indent like a macro body" ' always-indent )
142
142
(const :tag " Indent like a macro body unless first arg is on the same line"
143
- : align-arguments ))
143
+ ' align-arguments ))
144
144
:package-version '(clojure-mode . " 5.2.0" ))
145
145
146
- (define-obsolete-variable-alias 'clojure-defun-style-default-indent
147
- 'clojure-indent-style " 5.2.0" )
148
-
149
146
(defcustom clojure-use-backtracking-indent t
150
147
" When non-nil, enable context sensitive indentation."
151
148
:type 'boolean
@@ -1370,6 +1367,10 @@ spec."
1370
1367
(let ((function (thing-at-point 'symbol )))
1371
1368
(clojure--get-indent-method function))))
1372
1369
1370
+ (defun clojure--keyword-to-symbol (keyword )
1371
+ " Convert KEYWORD to symbol."
1372
+ (intern (substring (symbol-name keyword) 1 )))
1373
+
1373
1374
(defun clojure--normal-indent (last-sexp indent-mode )
1374
1375
" Return the normal indentation column for a sexp.
1375
1376
Point should be after the open paren of the _enclosing_ sexp, and
@@ -1395,19 +1396,22 @@ accepted by `clojure-indent-style'."
1395
1396
; ; Here we have reached the start of the enclosing sexp (point is now at
1396
1397
; ; the function name), so the behaviour depends on INDENT-MODE and on
1397
1398
; ; whether there's also an argument on this line (case A or B).
1398
- (let ((case-a ; The meaning of case-a is explained in `clojure-indent-style' .
1399
+ (let ((indent-mode (if (keywordp indent-mode)
1400
+ ; ; needed for backwards compatibility
1401
+ ; ; as before clojure-mode 5.10 indent-mode was a keyword
1402
+ (clojure--keyword-to-symbol indent-mode)
1403
+ indent-mode))
1404
+ (case-a ; The meaning of case-a is explained in `clojure-indent-style' .
1399
1405
(and last-sexp-start
1400
1406
(< last-sexp-start (line-end-position )))))
1401
1407
(cond
1402
- ; ; For compatibility with the old `clojure-defun-style-default-indent' , any
1403
- ; ; value other than these 3 is equivalent to `always-body' .
1404
- ((not (memq indent-mode '(:always-align :align-arguments nil )))
1408
+ ((eq indent-mode 'always-indent )
1405
1409
(+ (current-column ) lisp-body-indent -1 ))
1406
1410
; ; There's an arg after the function name, so align with it.
1407
1411
(case-a (goto-char last-sexp-start)
1408
1412
(current-column ))
1409
1413
; ; Not same line.
1410
- ((eq indent-mode : align-arguments )
1414
+ ((eq indent-mode ' align-arguments )
1411
1415
(+ (current-column ) lisp-body-indent -1 ))
1412
1416
; ; Finally, just align with the function name.
1413
1417
(t (current-column )))))))
@@ -1479,7 +1483,7 @@ This function also returns nil meaning don't specify the indentation."
1479
1483
(+ lisp-body-indent containing-form-column))
1480
1484
; ; Further non-special args, align with the arg above.
1481
1485
((> pos (1+ method))
1482
- (clojure--normal-indent last-sexp : always-align ))
1486
+ (clojure--normal-indent last-sexp ' always-align ))
1483
1487
; ; Special arg. Rigidly indent with a large indentation.
1484
1488
(t
1485
1489
(+ (* 2 lisp-body-indent) containing-form-column)))))
@@ -1493,7 +1497,7 @@ This function also returns nil meaning don't specify the indentation."
1493
1497
(cond
1494
1498
; ; Preserve useful alignment of :require (and friends) in `ns' forms.
1495
1499
((and function (string-match " ^:" function))
1496
- (clojure--normal-indent last-sexp : always-align ))
1500
+ (clojure--normal-indent last-sexp ' always-align ))
1497
1501
; ; This should be identical to the :defn above.
1498
1502
((and function
1499
1503
(string-match " \\ `\\ (?:\\ S +/\\ )?\\ (def[a-z]*\\ |with-\\ )"
0 commit comments