Skip to content

Commit

Permalink
Try to load .lispwords from the current directory first.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamFIREcracker committed Jun 1, 2020
1 parent 08732be commit 88366a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
15 changes: 7 additions & 8 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,15 @@ have an LIN of 0.

== Customization

You can specify your own LINs for keywords via a customization
file. The name of the file is the first available of the
following:
You can specify your own LINs for keywords via one customization
files; `lispindent` will try and read these files, in this order:

- the value of the environment variable `LISPWORDS`, if set
- the file `.lispwords` in your home directory
- the file `.lispwords` in the current directory
- the value of the environment variable `LISPWORDS`, if set, or `.lispwords` in
your home directory

If `LISPWORDS` isn't set and `~/.lispwords` doesn't exist, no
customization is done. If `LISPWORDS` is set but the thus named
file doesn't exist, no customization is done.
If `lispindent` for whatever reason can't read any of these `.lispindent` files,
then no customization is done.

`~/.lispwords` can contain any number of
2-element lists: The first element of each list is a Lisp symbol
Expand Down
10 changes: 5 additions & 5 deletions lispindent.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
#+mkcl (mkcl:getenv s)
#+sbcl (sb-ext:posix-getenv s))

(defun read-home-lispwords ()
(with-open-file (i (or (retrieve-env "LISPWORDS")
(merge-pathnames ".lispwords" (user-homedir-pathname)))
:if-does-not-exist nil)
(defun read-lisp-words (path)
(with-open-file (i path :if-does-not-exist nil)
(when i
(loop
(let ((w (or (read i nil) (return))))
Expand Down Expand Up @@ -176,7 +174,9 @@
(incf i))
(incr-finished-subforms)))))))

(read-home-lispwords)
(read-lisp-words (merge-pathnames ".lispwords"))
(read-lisp-words (or (retrieve-env "LISPWORDS")
(merge-pathnames ".lispwords" (user-homedir-pathname))))

(indent-lines)

Expand Down

0 comments on commit 88366a8

Please sign in to comment.