File tree Expand file tree Collapse file tree 4 files changed +17
-10
lines changed Expand file tree Collapse file tree 4 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 120
120
" Define a grammar for the language to be given to SMIE" )
121
121
122
122
; ; indentation rules
123
- (setq smie-indent-basic sysver-default-indent) ; big to be sure it has an effect
124
123
(defun sysver-smie-rules (kind token )
125
124
126
125
; ; -----------------------------------------------------------------------------------------------
140
139
; ; the following sequence of rules are always run in sequence until the first one returns non-nil
141
140
(cond
142
141
; ; default rules
143
- ; ; ('(:elem . args) smie-indent-basic )
144
- ; ; ('(:elem . basic) smie-indent-basic )
142
+ ; ; ('(:elem . args) sysver-default-indent )
143
+ ; ; ('(:elem . basic) sysver-default-indent )
145
144
((and (eq kind :elem ) (equal token 'empty-line-token ))
146
145
0 )
147
146
148
147
; ; ----------------------------------------------------------------------------------------------
149
148
; ; module structure
150
149
((and (eq kind :before ) (member token `(" (" , smie-syntoken-params-start-list )))
151
- smie-indent-basic )
150
+ sysver-default-indent )
152
151
((and (eq kind :before ) (equal token " ," ))
153
152
; ; align to the end of "#(" and "(" start-list-delimiters
154
153
(save-excursion
176
175
; ; loops (for, while)
177
176
178
177
; ; case
178
+
179
+ ; ; as all these rules are applied in order and the function exits as the first returns non-nil,
180
+ ; ; here the default option is placed
181
+ ; ; (t sysver-default-indent)
179
182
)
180
183
181
184
; ; (pcase (cons method arg)
182
185
; ; ('(:before . "endmodule") 0)
183
- ; ; ('(:before . ";") smie-indent-basic )
186
+ ; ; ('(:before . ";") sysver-default-indent )
184
187
; ; )
185
188
)
186
189
Original file line number Diff line number Diff line change @@ -252,7 +252,8 @@ This is useful to let the user customize it via the customization options"
252
252
; ; re-fontify current buffer as the defaults are directly changed
253
253
(font-lock-refresh-defaults )
254
254
255
- ; ; set up indentation engine
255
+ ; ; set up the indentation engine SMIE
256
+ (setq smie-indent-basic sysver-default-indent)
256
257
(smie-setup sysver-smie-grammar #'sysver-smie-rules
257
258
:forward-token #'sysver-forward-token
258
259
:backward-token #'sysver-backward-token )
Original file line number Diff line number Diff line change @@ -23,4 +23,4 @@ test_files := $(wildcard *.el)
23
23
all : $(test_files )
24
24
25
25
$(test_files ) :
26
- emacs -batch -l ../sysver.el -l ert -l $@ -f ert-run-tests-batch-and-exit
26
+ emacs -batch -L ../ -L . -l ert -l $@ -f ert-run-tests-batch-and-exit
Original file line number Diff line number Diff line change 16
16
(make-string indent-test ?\ ) " (param3, param4, param5)\n "
17
17
" endmodule" )
18
18
,(concat " module a_module_name_id1 #(param0,\n "
19
- (make-string (+ indent-test 2 ) ?\ ) " param1, param2)\n "
19
+ ; ; The list of parameters after the first one in the previous line
20
+ ; ; is indented to the parameter-list starting column.
21
+ (make-string (+ (length " module a_module_name_id0 " ) 2 ) ?\ )
22
+ " param1, param2)\n "
20
23
(make-string indent-test ?\ ) " (param3, param4, param5)\n "
21
24
" endmodule" )
22
25
,(concat " module a_module_name_id2\n "
43
46
(setq current-string (pop strings))
44
47
(with-temp-buffer
45
48
(sysver-utc-environment
46
-
47
49
current-string
48
50
49
51
; ; set-up indentation parameters
53
55
((save-excursion
54
56
(indent-region (point-min ) (point-max )))
55
57
; ; verify
56
- (should (equal (buffer-string ) current-string))))))))))
58
+ (should (equal (buffer-substring-no-properties (point-min ) (point-max ))
59
+ current-string))))))))))
You can’t perform that action at this time.
0 commit comments