Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion extensions/lisp-syntax/indent.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@
(when method
(return-from find-indent-method method))))
(f (get-indentation name))
(let ((name1 (ppcre:scan-to-strings "(?<=:)[^:]+" name)))
(let ((name1 (let ((registers (nth-value 1 (ppcre:scan-to-strings "^[^:]+:{1,2}([^:].*)$" name))))
(when (and registers (plusp (length registers)))
(aref registers 0)))))
(when name1
(f (get-indentation name1)))
(f (and *get-method-function*
Expand Down
21 changes: 21 additions & 0 deletions tests/lisp-syntax/indent-test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@
y))
")

(deftest defpackage-use-clause-not-affected-by-use-macro
;; A user-defined macro named USE must not influence the indentation of
;; the :USE clause keyword in DEFPACKAGE. The package prefix of a
;; package-qualified symbol may be stripped to look up its indentation,
;; but a keyword such as :USE has no package prefix and must be left alone.
(let ((lem-lisp-mode/test-api:*disable-self-connect* t))
(lem-lisp-syntax.indent:set-indentation "use" '(&body))
(unwind-protect
(run-indent-test "defpackage-use-clause-not-affected-by-use-macro"
"
(defpackage :foo
(:use :cl
:bar))
"
"
(defpackage :foo
(:use :cl
:bar))
")
(lem-lisp-syntax.indent:set-indentation "use" nil))))

(defun get-location-from-buffer-point (point pathname)
(format nil "~A:~D:~A" pathname (lem:line-number-at-point point) (lem:line-string point)))

Expand Down
Loading