Skip to content

Commit a6c7e4c

Browse files
authored
Merge pull request #1 from purescript-emacs/misc-fixes
Misc fixes
2 parents a41757a + 5986b68 commit a6c7e4c

12 files changed

+32
-69
lines changed

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ ELCHECKS=$(addprefix check-, $(ELFILES:.el=))
3434

3535
%.elc: %.el
3636
@$(BATCH) \
37-
--eval "(byte-compile-disable-warning 'cl-functions)" \
3837
-f batch-byte-compile $<
3938

4039
.PHONY: all compile info clean check $(ELCHECKS) elpa package
@@ -47,7 +46,6 @@ $(ELCHECKS): check-%: %.el
4746
@$(BATCH) --eval '(when (check-declare-file "$*.el") (error "check-declare failed"))'
4847
@$(BATCH) \
4948
--eval "(setq byte-compile-error-on-warn t)" \
50-
--eval "(byte-compile-disable-warning 'cl-functions)" \
5149
-f batch-byte-compile $*.el
5250
@$(RM) $*.elc
5351
@if [ -f "$(<:%.el=tests/%-tests.el)" ]; then \
@@ -105,6 +103,6 @@ $(AUTOLOADS): $(ELFILES) purescript-mode.elc
105103
# HACK: embed version number into .elc file
106104
purescript-mode.elc: purescript-mode.el
107105
$(SUBST_ATAT) < purescript-mode.el > purescript-mode.tmp.el
108-
@$(BATCH) --eval "(byte-compile-disable-warning 'cl-functions)" -f batch-byte-compile purescript-mode.tmp.el
106+
@$(BATCH) -f batch-byte-compile purescript-mode.tmp.el
109107
mv purescript-mode.tmp.elc purescript-mode.elc
110108
$(RM) purescript-mode.tmp.el

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ be referred to as the `.emacs` file.
2323
Installation
2424
------------
2525

26-
GNU Emacs version 23 or later is officially supported. It may work
26+
GNU Emacs version 24 or later is officially supported. It may work
2727
with other Emacsen, but we don't have the resources to support other
2828
versions.
2929

30+
### Installation using package.el
31+
32+
Users of [MELPA](https://melpa.org) can install `purescript-mode`
33+
using `M-x package-install`. This is the most straightforward
34+
and recommended installation method.
35+
3036
### Installation from Git
3137

3238
- `git clone https://github.com/purescript-emacs/purescript-mode.git` into a

purescript-align-imports.el

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595

9696
;;; Code:
9797

98-
(with-no-warnings (require 'cl))
98+
(require 'cl-lib)
9999

100100
(defvar purescript-align-imports-regexp
101101
(concat "^\\(import[ ]+\\)"
@@ -147,8 +147,8 @@
147147
(when line
148148
(let ((match
149149
(purescript-align-imports-merge-parts
150-
(loop for i from 1 to 8
151-
collect (purescript-align-imports-chomp (match-string i line))))))
150+
(cl-loop for i from 1 to 8
151+
collect (purescript-align-imports-chomp (match-string i line))))))
152152
(setq imports (cons (cons match (line-beginning-position))
153153
imports)))))
154154
(forward-line))
@@ -227,8 +227,4 @@
227227

228228
(provide 'purescript-align-imports)
229229

230-
;; Local Variables:
231-
;; byte-compile-warnings: (not cl-functions)
232-
;; End:
233-
234230
;;; purescript-align-imports.el ends here

purescript-decl-scan.el

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
(require 'purescript-mode)
104104
(require 'syntax)
105-
(with-no-warnings (require 'cl))
105+
(require 'cl-lib)
106106
(require 'imenu)
107107

108108
(defgroup purescript-decl-scan nil
@@ -125,10 +125,7 @@
125125
;; General declaration scanning functions.
126126

127127
(defvar purescript-ds-start-keywords-re
128-
(concat "\\(\\<"
129-
"class\\|data\\|derive instance\\|i\\(mport\\|n\\(fix\\(\\|[lr]\\)\\|stance\\)\\)\\|"
130-
"module\\|primitive\\|type\\|newtype"
131-
"\\)\\>")
128+
(regexp-opt '("class" "data" "derive instance" "import" "instance" "infixl" "infixr" "module" "primitive" "type" "newtype") 'words)
132129
"Keywords that may start a declaration.")
133130

134131
(defvar purescript-ds-syntax-table
@@ -195,7 +192,7 @@ current line that starts with REGEXP and is not in `font-lock-comment-face'."
195192
"Like purescript-ds-move-to-start-regexp, but uses syntax-ppss to
196193
skip comments"
197194
(let (p)
198-
(loop
195+
(cl-loop
199196
do (setq p (point))
200197
(purescript-ds-move-to-start-regexp inc regexp)
201198
while (and (nth 4 (syntax-ppss))
@@ -602,8 +599,4 @@ Invokes `purescript-decl-scan-mode-hook' on activation."
602599

603600
(provide 'purescript-decl-scan)
604601

605-
;; Local Variables:
606-
;; byte-compile-warnings: (not cl-functions)
607-
;; End:
608-
609602
;;; purescript-decl-scan.el ends here

purescript-font-lock.el

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,17 +278,14 @@ Returns keywords suitable for `font-lock-keywords'."
278278
"\\S_"))
279279
;; Reserved identifiers
280280
(reservedid
281-
(concat "\\<"
282-
;; `as', `hiding', and `qualified' are part of the import
283-
;; spec syntax, but they are not reserved.
284-
;; `_' can go in here since it has temporary word syntax.
285-
;; (regexp-opt
286-
;; '("case" "class" "data" "default" "deriving" "do"
287-
;; "else" "if" "import" "in" "infix" "infixl"
288-
;; "infixr" "instance" "let" "module" "newtype" "of"
289-
;; "then" "type" "where" "_") t)
290-
"\\(_\\|c\\(ase\\|lass\\)\\|d\\(ata\\|e\\(fault\\|riving\\)\\|o\\)\\|else\\|i\\(mport\\|n\\(fix[lr]?\\|stance\\)\\|[fn]\\)\\|let\\|module\\|mdo\\|newtype\\|of\\|rec\\|proc\\|t\\(hen\\|ype\\)\\|where\\)"
291-
"\\>"))
281+
;; `as', `hiding', and `qualified' are part of the import
282+
;; spec syntax, but they are not reserved.
283+
;; `_' can go in here since it has temporary word syntax.
284+
(regexp-opt
285+
'("case" "class" "data" "default" "deriving" "do"
286+
"else" "if" "import" "in" "infix" "infixl"
287+
"infixr" "instance" "let" "module" "newtype" "of"
288+
"then" "type" "where" "_") 'words))
292289

293290
;; This unreadable regexp matches strings and character
294291
;; constants. We need to do this with one regexp to handle
@@ -640,7 +637,6 @@ Invokes `purescript-font-lock-hook' if not nil."
640637
(provide 'purescript-font-lock)
641638

642639
;; Local Variables:
643-
;; byte-compile-warnings: (not cl-functions)
644640
;; tab-width: 8
645641
;; End:
646642

purescript-indent.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,6 @@ Invokes `purescript-indent-hook' if not nil."
15841584
(provide 'purescript-indent)
15851585

15861586
;; Local Variables:
1587-
;; byte-compile-warnings: (not cl-functions)
15881587
;; End:
15891588

15901589
;;; purescript-indent.el ends here

purescript-indentation.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,6 @@ Preserves indentation and removes extra whitespace"
10411041
(provide 'purescript-indentation)
10421042

10431043
;; Local Variables:
1044-
;; byte-compile-warnings: (not cl-functions)
10451044
;; tab-width: 8
10461045
;; End:
10471046

purescript-mode-pkg.el.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
(define-package "purescript-mode" "@VERSION@" "A PureScript editing mode")
1+
(define-package "purescript-mode" "@VERSION@" "A PureScript editing mode"
2+
'((cl-lib "0.6")))

purescript-mode.el

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
(require 'purescript-align-imports)
3636
(require 'purescript-sort-imports)
3737
(require 'purescript-string)
38-
(with-no-warnings (require 'cl))
38+
(require 'cl-lib)
3939

4040
;; All functions/variables start with `(literate-)purescript-'.
4141

@@ -288,13 +288,9 @@ details."
288288

289289
(defvar eldoc-print-current-symbol-info-function)
290290

291-
;; For compatibility with Emacs < 24, derive conditionally
292-
(defalias 'purescript-parent-mode
293-
(if (fboundp 'prog-mode) 'prog-mode 'fundamental-mode))
294-
295291
;; The main mode functions
296292
;;;###autoload
297-
(define-derived-mode purescript-mode purescript-parent-mode "PureScript"
293+
(define-derived-mode purescript-mode prog-mode "PureScript"
298294
"Major mode for editing PureScript programs.
299295
300296
See also Info node `(purescript-mode)Getting Started' for more
@@ -344,8 +340,6 @@ see documentation for that variable for more details."
344340
(set (make-local-variable 'dabbrev-case-distinction) nil)
345341
(set (make-local-variable 'dabbrev-case-replace) nil)
346342
(set (make-local-variable 'dabbrev-abbrev-char-regexp) "\\sw\\|[.]")
347-
(add-hook 'before-save-hook 'purescript-mode-before-save-handler nil t)
348-
(add-hook 'after-save-hook 'purescript-mode-after-save-handler nil t)
349343
)
350344

351345
(defun purescript-fill-paragraph (justify)
@@ -433,17 +427,19 @@ is asked to show extra info for the items matching QUERY.."
433427
current-prefix-arg)))
434428
(browse-url (format "https://pursuit.purescript.org/search?q=%s" query)))
435429

436-
(defcustom purescript-completing-read-function 'ido-completing-read
430+
(defcustom purescript-completing-read-function 'completing-read
437431
"Default function to use for completion."
438432
:group 'purescript
439433
:type '(choice
434+
(function-item :tag "completing-read" :value completing-read)
440435
(function-item :tag "ido" :value ido-completing-read)
441436
(function-item :tag "helm" :value helm--completing-read-default)
442-
(function-item :tag "completing-read" :value completing-read)
443437
(function :tag "Custom function")))
444438

445439
(defcustom purescript-indent-spaces 2
446-
"Number of spaces to indent inwards.")
440+
"Number of spaces to indent inwards."
441+
:type 'integer
442+
:safe 'integerp)
447443

448444
(defun purescript-mode-suggest-indent-choice ()
449445
"Ran when the user tries to indent in the buffer but no indentation mode has been selected.
@@ -469,20 +465,7 @@ Brings up the documentation for purescript-mode-hook."
469465
(format " [ %s .. ]" (purescript-string-take (purescript-trim (cadr lines)) 10))
470466
""))))))
471467

472-
(defun purescript-mode-before-save-handler ()
473-
"Function that will be called before buffer's saving."
474-
)
475-
476-
(defun purescript-mode-after-save-handler ()
477-
"Function that will be called after buffer's saving."
478-
)
479-
480-
;; Provide ourselves:
481468

482469
(provide 'purescript-mode)
483470

484-
;; Local Variables:
485-
;; byte-compile-warnings: (not cl-functions)
486-
;; End:
487-
488471
;;; purescript-mode.el ends here

purescript-package.el

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,4 @@
154154

155155
(provide 'purescript-package)
156156

157-
;; Local Variables:
158-
;; byte-compile-warnings: (not cl-functions)
159-
;; End:
160-
161157
;;; purescript-package.el ends here

0 commit comments

Comments
 (0)