Skip to content

Commit dcf2554

Browse files
committed
Be explicit about indentation mode not being enabled
Currently when a new user tries indenting, that basically invokes help for the mode hook, which isn't useful and looks more like a bug than anything else. Solve this by printing an explicit explanation that a user needs to enable an indentation mode.
1 parent 530dc6d commit dcf2554

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,19 @@ and recommended installation method.
6868
Basic Configuration
6969
-------------------
7070
71-
For setup instructions, please consult the new integrated purescript-mode
72-
[Info](https://www.gnu.org/software/texinfo/manual/info/info.html)
73-
manual which can be accessed after installation via
74-
`M-x info-display-manual [RET] purescript-mode`.
71+
PureScript mode provides multiple indentation engines, and leaves it up to the user to chose one. To have indentation you need to add a hook that enables according mode. Otherwise, attempting to indent will just print an error about indentation mode not being enabled.
72+
73+
Minimal configuration may look something like this:
74+
75+
```lisp
76+
(use-package purescript-mode
77+
:defer t
78+
:config
79+
(defun myhook-purescript-mode ()
80+
(turn-on-purescript-indentation)
81+
(add-hook 'before-save-hook #'purescript-sort-imports nil t))
82+
(add-hook 'purescript-mode-hook 'myhook-purescript-mode))
83+
```
7584

7685
Support
7786
-------

purescript-mode.el

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,10 @@ is asked to show extra info for the items matching QUERY.."
407407
has been selected.
408408
409409
Brings up the documentation for purescript-mode-hook."
410-
(describe-variable 'purescript-mode-hook))
410+
(error
411+
"To use indentation you need to turn-on one of the indentation modes. Please see `purescript-mode-hook' documentation for examples.
412+
413+
Currently `purescript-indentation' is the most maintained mode."))
411414

412415
(defun purescript-mode-format-imports ()
413416
"Format the imports by aligning and sorting them."

0 commit comments

Comments
 (0)