From fd2050fd3cfcad37632975fc83fca0f3ffcabfce Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Fri, 30 May 2025 01:03:15 +0300 Subject: [PATCH 1/2] 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. --- README.md | 17 +++++++++++++---- purescript-mode.el | 5 ++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd62e7f..2b1a524 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,19 @@ and recommended installation method. Basic Configuration ------------------- -For setup instructions, please consult the new integrated purescript-mode -[Info](https://www.gnu.org/software/texinfo/manual/info/info.html) -manual which can be accessed after installation via -`M-x info-display-manual [RET] purescript-mode`. +PureScript mode provides multiple indentation engines, and leaves the choice up to the user. To have indentation an according indentation mode needs to be enabled. Otherwise, attempting to indent will print an error describing this. + +Minimal configuration may look something like: + +```lisp +(use-package purescript-mode + :defer t + :config + (defun myhook-purescript-mode () + (turn-on-purescript-indentation) + (add-hook 'before-save-hook #'purescript-sort-imports nil t)) + (add-hook 'purescript-mode-hook #'myhook-purescript-mode)) +``` Support ------- diff --git a/purescript-mode.el b/purescript-mode.el index 787eb9a..e24d5ce 100644 --- a/purescript-mode.el +++ b/purescript-mode.el @@ -407,7 +407,10 @@ is asked to show extra info for the items matching QUERY.." has been selected. Brings up the documentation for purescript-mode-hook." - (describe-variable 'purescript-mode-hook)) + (error + "To use indentation you need to turn-on one of the indentation modes. Please see `purescript-mode-hook' documentation for examples. + +Currently `purescript-indentation' is the most maintained mode.")) (defun purescript-mode-format-imports () "Format the imports by aligning and sorting them." From c5ed55ac08c785264248807dcdaca4451ab18d52 Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Fri, 30 May 2025 01:12:49 +0300 Subject: [PATCH 2/2] README: remove "contributing" and "support" sections These sections have no useful information. "Support" is just a link to the project (which is pointless, because if a user reads this section, they already at the project), and "Contributing" just contains nothing useful. --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 2b1a524..bc0ef21 100644 --- a/README.md +++ b/README.md @@ -81,13 +81,3 @@ Minimal configuration may look something like: (add-hook 'before-save-hook #'purescript-sort-imports nil t)) (add-hook 'purescript-mode-hook #'myhook-purescript-mode)) ``` - -Support -------- - -- [Github homepage](https://github.com/purescript-emacs/purescript-mode) - -Contributing ------------- - -Please make sure your pull requests are at least properly rebased and up to date.