branch: elpa/haskell-tng-mode commit 611711a7e5c4eec49f8ae5f7c0489b78217138a4 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
address melpa review --- Cask | 4 +- README.md | 93 ++++++++++++++++++++++++-------------- haskell-tng-compile.el | 16 +------ haskell-tng-contrib-projectile.el | 21 +++++++++ haskell-tng-contrib-smartparens.el | 31 +++++++++++++ haskell-tng-contrib-yasnippet.el | 26 +++++++++++ haskell-tng-contrib.el | 57 ++++++++--------------- haskell-tng-font-lock.el | 3 +- haskell-tng-layout.el | 15 +++--- haskell-tng-mode.el | 19 ++------ haskell-tng-smie.el | 26 ++++++----- haskell-tng-syntax.el | 24 ++++++---- test/haskell-tng-compile-test.el | 1 - test/haskell-tng-indent-test.el | 9 ++-- test/haskell-tng-lexer-test.el | 6 +-- test/haskell-tng-sexp-test.el | 12 +++-- 16 files changed, 217 insertions(+), 146 deletions(-) diff --git a/Cask b/Cask index 02fcf2b..f6e916e 100644 --- a/Cask +++ b/Cask @@ -19,6 +19,8 @@ ;; ;;; Code: +;; TODO set up CI on gitlab + (source melpa-stable) (source melpa) ;; for faceup @@ -27,7 +29,7 @@ (development (depends-on "faceup") (depends-on "ert-runner") - (depends-on "undercover") + ;;(depends-on "undercover") (depends-on "projectile") (depends-on "smartparens") (depends-on "yasnippet")) diff --git a/README.md b/README.md index d46bff4..cab773e 100644 --- a/README.md +++ b/README.md @@ -20,55 +20,81 @@ We choose to use idiomatic libraries to provide features, rather than building g The goal of this friendly rewrite is to produce software that any Haskell developer can use, understand and build upon ([Emacs Lisp](https://www.gnu.org/software/emacs/manual/elisp.html) is fun to learn). -This can be achieved by preferring a simple and small codebase targeting [Haskell2010](https://www.haskell.org/onlinereport/haskell2010/), with automated tests for every feature. +This can be achieved in a small codebase with zero dependencies and high test coverage, targeting [Haskell2010](https://www.haskell.org/onlinereport/haskell2010/). Old versions of `ghc` and extensions to the Haskell language may not be supported, to reduce the complexity of the codebase. For example, [literate Haskell](https://wiki.haskell.org/Literate_programming) will not be supported, and `ghc` language extensions must be justified on a per-case basis. We are sympathetic to language extensions that are popular in the free software and commercial ecosystems. If it is possible to implement a feature using another minor mode, or command line tool, then we would prefer not to accept the feature. -## Issue Tracker - -Bug reports and feature requests are a source of anxiety for maintainers, and encourage an unhealthy customer / supplier relationship between users and contributors. - -Instead, and following the [anarchical spirit of Haskell](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/history.pdf), we encourage discussions and debate around code contributions. Merge requests can be raised by anybody and discussed by anybody, and do not need to be complete. An automated test is the only way to report a bug. If the maintainers are convinced by the technical merit and quality of a proposal, they may accept it. - ## Install -Check out the source code repository and add to your load path: - -```lisp -(add-to-list 'load-path (expand-file-name "~/Projects/haskell-tng.el/")) -(require 'haskell-tng-mode) -``` - -Integrations are provided for common libraries, enable them with +Check out the source code repository and enable with [`use-package`](https://github.com/jwiegley/use-package): ```lisp -(require 'haskell-tng-contrib) - -(add-hook - 'haskell-tng-mode-hook - (lambda () - (prettify-symbols-mode 1) - (smartparens-mode 1) - (yas-minor-mode 1)) +(use-package haskell-tng-mode + ;; these 3 lines are only needed for local checkouts + :ensure nil + :load-path "/path/to/haskell-tng.el" + :mode ("\\.hs\\'" . haskell-tng-mode) + + :bind + (:map + haskell-tng-compilation-mode-map + (("C-c c" . haskell-tng-compile) + ("C-c e" . next-error))) + (:map + haskell-tng-mode-map + ("<return>" . haskell-tng-newline) + ("C-c c" . haskell-tng-compile) + ("C-c e" . next-error))) ``` -## Commands - -### Core +Giving the following commands - `C-c c` compile, prompt on first use - `C-u C-c c` always prompt - `C-- C-c c` clean project - `C-c e` jump to error -### Contrib +## Contrib + +Integrations are provided for common libraries, enable them from `use-package` with + +```lisp + :config + (require 'haskell-tng-contrib) + (require 'haskell-tng-contrib-projectile) + (require 'haskell-tng-contrib-smartparens) + (require 'haskell-tng-contrib-yasnippet) + + :bind + (:map + haskell-tng-mode-map + (("C-c C" . haskell-tng-stack2cabal) + ("C-c C-r f" . haskell-tng-stylish-haskell))) +``` -- `C-c C-C` invoke [`stack2cabal`](https://hackage.haskell.org/package/stack2cabal) +providing project navigation, enchanced matched parenthesis handling, and templates that can be expanded with your `yas-expand` hotkey. + +Ensure that third party Haskell tools are available (e.g. via `cabal v2-install`) for: + +- `C-c C` invoke [`stack2cabal`](https://hackage.haskell.org/package/stack2cabal) - `C-c C-r f` invoke [`stylish-haskell`](https://hackage.haskell.org/package/stylish-haskell) - `C-c p R` invoke [`fast-tags`](https://hackage.haskell.org/package/fast-tags) via [`projectile`](https://github.com/bbatsov/projectile) +## Contributing + +Bug reports and feature requests are a source of anxiety for maintainers, and encourage an unhealthy customer / supplier relationship between users and contributors. + +Instead, and following the [anarchical spirit of Haskell](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/history.pdf), we encourage discussions and debate around code contributions. Merge requests can be raised by anybody and discussed by anybody, and do not need to be complete. An automated test is the only way to report a bug. If the maintainers are convinced by the technical merit and quality of a proposal, they may accept it. + +To run the tests, install [`cask`](https://cask.readthedocs.io/en/latest/guide/installation.html) and type + +``` +cask install +cask exec ert-runner +``` + ## Plan This is the status of core features: @@ -87,20 +113,17 @@ This is the status of core features: - [x] `stack`, `nix`, `shake`, etc support (customise `haskell-tng--compile-*`) - [ ] `comint-mode` based `ghc` repl -Compatibility with `lsp-mode` / [`haskell-ide-engine`](https://github.com/haskell/haskell-ide-engine) is important for more advanced IDE features. - -## Future Plans - -Semantic tooling will likely take the form of a standalone cli tool that is called from Emacs. +### Next -The highest priority features are: +Semantic tooling will likely take the form of a standalone cli tool that is called from Emacs: 1. fully qualified name and type of symbol at point 2. search for symbol and typesig (e.g. import symbol at point) 3. jump to source of symbol at point -Blue sky features: +### Blue Sky +- `lsp-mode` / [`haskell-ide-engine`](https://github.com/haskell/haskell-ide-engine) for more advanced IDE features. - Imports - quick manual add `import` - company-mode backend specific to import sections that detect context, powered by local hoogle cli diff --git a/haskell-tng-compile.el b/haskell-tng-compile.el index 5a56623..e83e482 100644 --- a/haskell-tng-compile.el +++ b/haskell-tng-compile.el @@ -115,21 +115,7 @@ will cause the subsequent call to prompt." (define-compilation-mode haskell-tng-compilation-mode "haskell-tng-compilation" (add-hook 'compilation-filter-hook - 'haskell-tng--compile-ansi-color nil t) - - ;; TODO prettify-symbol rules for home dirs, project dirs, and hide .o files, etc - ;; https://emacs.stackexchange.com/questions/51691 - ;; (setq - ;; prettify-symbols-alist - ;; `((,(expand-file-name - ;; ;; i.e. the parent directory of this one - ;; (directory-file-name (file-name-directory (directory-file-name default-directory)))) . ?ยง) - ;; (,(expand-file-name "~") . ?~))) - - (cl-flet ((bind (key def) - (define-key haskell-tng-compilation-mode-map (kbd key) def))) - (bind "C-c c" 'haskell-tng-compile) - (bind "C-c e" 'next-error))) + 'haskell-tng--compile-ansi-color nil t)) (provide 'haskell-tng-compile) ;;; haskell-tng-compile.el ends here diff --git a/haskell-tng-contrib-projectile.el b/haskell-tng-contrib-projectile.el new file mode 100644 index 0000000..b599c6d --- /dev/null +++ b/haskell-tng-contrib-projectile.el @@ -0,0 +1,21 @@ +;;; haskell-tng-contrib-projectile.el --- Projectile integration -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Tseen She +;; License: GPL 3 or any later version + +;;; Commentary: +;; +;;; Code: + +(require 'projectile) + +;; TODO fix the haskell-stack detection to also include cabal + +(add-hook + 'haskell-tng-mode-hook + (lambda () + (setq-local projectile-tags-command "fast-tags -Re --exclude=dist-newstyle .") + )) + +(provide 'haskell-tng-contrib-projectile) +;;; haskell-tng-contrib-projectile.el ends here diff --git a/haskell-tng-contrib-smartparens.el b/haskell-tng-contrib-smartparens.el new file mode 100644 index 0000000..b34fa07 --- /dev/null +++ b/haskell-tng-contrib-smartparens.el @@ -0,0 +1,31 @@ +;;; haskell-tng-contrib-smartparens.el --- smartparens integration -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Tseen She +;; License: GPL 3 or any later version + +;;; Commentary: +;; +;;; Code: + +(require 'smartparens) + +(dolist (pair '(("(" . ")") + ("[" . "]") + ("{" . "}") + ("{-" . "-}") + ("{-#" . "#-}"))) + (sp-local-pair 'haskell-tng-mode (car pair) (cdr pair) + :post-handlers '(("| " "SPC")))) + +;; WORKAROUND smartparens is indenting all the time, which is not good +(defun sp--indent-region (_1 _2 &optional _3) + ;; TODO disable this function just in this mode + ) + +(add-hook + 'haskell-tng-mode-hook + (lambda () + (smartparens-mode 1))) + +(provide 'haskell-tng-contrib-smartparens) +;;; haskell-tng-contrib-smartparens.el ends here diff --git a/haskell-tng-contrib-yasnippet.el b/haskell-tng-contrib-yasnippet.el new file mode 100644 index 0000000..6fb2e40 --- /dev/null +++ b/haskell-tng-contrib-yasnippet.el @@ -0,0 +1,26 @@ +;;; haskell-tng-contrib-yasnippet.el --- yasnippet integration -*- lexical-binding: t -*- + +;; Copyright (C) 2019 Tseen She +;; License: GPL 3 or any later version + +;;; Commentary: +;; +;;; Code: + +(require 'yasnippet) + +(add-to-list + 'yas-snippet-dirs + (expand-file-name + "snippets" + (when load-file-name + (file-name-directory load-file-name)))) +(yas-reload-all nil t) + +(add-hook + 'haskell-tng-mode-hook + (lambda () + (yas-minor-mode 1))) + +(provide 'haskell-tng-contrib-yasnippet) +;;; haskell-tng-contrib-yasnippet.el ends here diff --git a/haskell-tng-contrib.el b/haskell-tng-contrib.el index 8976251..4f06107 100644 --- a/haskell-tng-contrib.el +++ b/haskell-tng-contrib.el @@ -10,21 +10,16 @@ ;; ;;; Code: -(require 'subr-x) - -(require 'haskell-tng-util) - -;; optional third party dependencies -(require 'projectile nil t) -(require 'smartparens nil t) -(require 'yasnippet nil t) - ;; TODO a generic wrapper around commands that can be downloaded and built using ;; cabal v2-install. +(require 'subr-x) + ;;;###autoload (defun haskell-tng-stylish-haskell () "Apply `stylish-haskell' rules." + ;; TODO use https://github.com/purcell/reformatter.el + ;; TODO error buffer should be easy to dismiss (interactive) (save-buffer) (unless (= 0 (call-process "stylish-haskell" nil "*stylish-haskell*" nil "-i" buffer-file-name)) @@ -38,38 +33,24 @@ (when-let (default-directory (locate-dominating-file default-directory "stack.yaml")) (call-process "stack2cabal"))) -(defalias 'stack2cabal 'haskell-tng-stack2cabal) ;;;###autoload -(progn - ;; TODO split into separate files that require their dependency - - (when (boundp yas-minor-mode) - (add-to-list - 'yas-snippet-dirs - (expand-file-name - "snippets" - (when load-file-name - (file-name-directory load-file-name)))) - (yas-reload-all nil t)) - - (when (fboundp 'sp-local-pair) - (dolist (pair '(("(" . ")") - ("[" . "]") - ("{" . "}") - ("{-" . "-}") - ("{-#" . "#-}"))) - (sp-local-pair 'haskell-tng-mode (car pair) (cdr pair) - :post-handlers '(("| " "SPC"))))) - - (add-hook - 'haskell-tng-mode-hook - (lambda () - (when (boundp projectile-mode) - ;; TODO fix the haskell-stack detection to also include cabal - (setq-local projectile-tags-command "fast-tags -Re --exclude=dist-newstyle ."))) +(defun haskell-tng-goto-imports () + "Hack to jump to imports" + ;; TODO imenu navigation will replace this + (interactive) + (re-search-backward (rx line-start "import"))) - )) +;;;###autoload +(defun haskell-tng-current-module () + "Puts the current module name into the kill ring." + (interactive) + (save-excursion + (goto-char (point-min)) + (re-search-forward (rx bol "module" word-end) nil nil) + (forward-comment (point-max)) + (re-search-forward (rx point (group (+ (not space))) space)) + (kill-new (match-string 1)))) (provide 'haskell-tng-contrib) ;;; haskell-tng-contrib.el ends here diff --git a/haskell-tng-font-lock.el b/haskell-tng-font-lock.el index 17c3d6b..8d18859 100644 --- a/haskell-tng-font-lock.el +++ b/haskell-tng-font-lock.el @@ -34,7 +34,6 @@ ;; ;;; Code: -(require 'dash) (require 'haskell-tng-rx) (require 'haskell-tng-util) @@ -260,7 +259,7 @@ succeeds and may further restrict the FIND search limit." ((finder (lim) `(re-search-forward ,regexp-2 - (-min (cons ,lim (-non-nil (-map 'funcall ',limiters)))) + (seq-min (cons ,lim (seq-remove 'null (seq-map 'funcall ',limiters)))) t))) `(progn (defconst ,regexp-1 ,trigger) diff --git a/haskell-tng-layout.el b/haskell-tng-layout.el index 1f49b78..d5893e5 100644 --- a/haskell-tng-layout.el +++ b/haskell-tng-layout.el @@ -27,8 +27,6 @@ ;; Galaxy brain caching would use properties and put dirty markers on inserted ;; or deleted regions. Would give fast lookup at point. -(require 'dash) - (require 'haskell-tng-util) ;; A alist of lists of (OPEN . (CLOSE . SEPS)) positions, keyed by (START . END) @@ -43,6 +41,9 @@ (defun haskell-tng--layout-cache-invalidation (_beg _end _pre-length) "For use in `after-change-functions' to invalidate the state of the layout engine." + ;; TODO we only need to invalidate regions that are on or after the _beg. But + ;; doing so might slow down insertions. We could be smarter and store the _beg + ;; then prune when doing the cache retrieval. (when haskell-tng--layout-cache (setq haskell-tng--layout-cache nil))) @@ -74,16 +75,18 @@ Designed to be called repeatedly, managing its own caching." "t if there is a virtual at POINT" ;; avoids a measured performance hit (append indentation) (when-let (cache (haskell-tng--layout-at-point)) - (--any (member (point) it) cache))) + (seq-find + (lambda (it) (member (point) it)) + cache))) (defun haskell-tng--layout-at-point () "Returns the relevant virtual tokens for the current point, using a cache if available." (when-let (layout (or - (cdr (--find - (and (< (caar it) (point)) - (<= (point) (cdar it))) + (cdr (seq-find + (lambda (it) (and (< (caar it) (point)) + (<= (point) (cdar it)))) haskell-tng--layout-cache)) (haskell-tng--layout-rebuild-cache-at-point))) (unless (eq layout t) layout))) diff --git a/haskell-tng-mode.el b/haskell-tng-mode.el index a0fc5e9..eb3ec62 100644 --- a/haskell-tng-mode.el +++ b/haskell-tng-mode.el @@ -6,7 +6,7 @@ ;; Homepage: https://gitlab.com/tseenshe/haskell-tng-mode ;; Keywords: languages ;; Package-Version: 0.0.1 -;; Package-Requires: ((dash "2.16.0") (emacs "24.3")) +;; Package-Requires: ((emacs "24.3")) ;;; Commentary: ;; @@ -15,6 +15,7 @@ ;;; Code: (require 'dabbrev) +(require 'rx) (require 'haskell-tng-syntax) (require 'haskell-tng-font-lock) @@ -82,23 +83,13 @@ Load `prettify-symbols-mode' in `haskell-tng-mode-hook'." (haskell-tng--smie-setup) - (cl-flet ((bind (key def) (define-key haskell-tng-mode-map (kbd key) def))) - (bind "<return>" 'haskell-tng-newline) - - ;; core compilation loop, supports C-u and C-- prefixes - (bind "C-c c" 'haskell-tng-compile) - (bind "C-c e" 'next-error) - - ;; external tools - (bind "C-c C" 'haskell-tng-stack2cabal) - (bind "C-c C-r f" 'haskell-tng-stylish-haskell) - ) + (prettify-symbols-mode 1) ) ;;;###autoload (progn - (add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-tng-mode)) - (modify-coding-system-alist 'file "\\.hs\\'" 'utf-8)) + (add-to-list 'auto-mode-alist `(,(rx ".hs" eos) . haskell-tng-mode)) + (modify-coding-system-alist 'file (rx ".hs" eos) 'utf-8)) (provide 'haskell-tng-mode) ;;; haskell-tng-mode.el ends here diff --git a/haskell-tng-smie.el b/haskell-tng-smie.el index bd0c157..43e8bfd 100644 --- a/haskell-tng-smie.el +++ b/haskell-tng-smie.el @@ -24,7 +24,8 @@ ;; ;;; Code: -(require 'dash) +(require 'cl-seq) +(require 'seq) (require 'smie) (require 'haskell-tng-font-lock) @@ -250,7 +251,7 @@ information, to aid in the creation of new rules." (equal next ",") (equal grand ",") (member parent '("[" "(" ",")) - (-is-infix-p '("{" "=") ancestors)) + (cl-search '("{" "=") ancestors :test 'equal)) ",") ((or (equal parent "|") @@ -260,7 +261,7 @@ information, to aid in the creation of new rules." "|") ((and (member parent '("::" "=>")) - (< (--count (equal it "=>") prevline) 2) + (< (seq-count (lambda (it) (equal it "=>")) prevline) 2) (not (haskell-tng--smie-prev-line-blank-p))) "=>") @@ -344,6 +345,7 @@ information, to aid in the creation of new rules." ("::" 2) ((guard (looking-at (rx "\n" (or word-start "(")))) ;; insertion before a top-level + ;; TODO this breaks when newlining in the middle of a matched paren '(column . 0)) ("," (smie-rule-separator method)) ;; TODO ; as a separator, might remove ad-hoc WLDO rules @@ -379,7 +381,7 @@ information, to aid in the creation of new rules." (setq haskell-tng--smie-indentations (append ;; TODO backtab cycle in reverse - (-remove-item prime (haskell-tng--smie-indent-alts)) + (remove prime (haskell-tng--smie-indent-alts)) (list prime)))))) (when haskell-tng--smie-debug (when-let (alts haskell-tng--smie-indentations) @@ -404,13 +406,15 @@ current line." ;; TODO SMIE +2 might be good to have ;; next / previous line should be top priority alts - (--each '(-1 1) - (save-excursion - (forward-line it) - (when-let (new (haskell-tng--smie-relevant-alts (point-at-eol) (< it 0))) - (setq indents (append new indents))))) - - (-distinct indents))) + (seq-do + (lambda (it) + (save-excursion + (forward-line it) + (when-let (new (haskell-tng--smie-relevant-alts (point-at-eol) (< it 0))) + (setq indents (append new indents))))) + '(-1 1)) + + (seq-uniq indents))) (defun haskell-tng--smie-relevant-alts (bound before) "A list of indentation levels from point to BOUND. diff --git a/haskell-tng-syntax.el b/haskell-tng-syntax.el index 9925be7..c8ce28a 100644 --- a/haskell-tng-syntax.el +++ b/haskell-tng-syntax.el @@ -15,7 +15,7 @@ ;;; Code: (require 'cl-lib) -(require 'dash) +(require 'seq) (defconst haskell-tng--syntax-table (let ((table (make-syntax-table))) @@ -23,7 +23,7 @@ #'(lambda (k v) ;; reset the (surprisingly numerous) defaults (let ((class (syntax-class v))) - (when (-contains? '(1 4 5 6 9) class) + (when (seq-contains '(1 4 5 6 9) class) (modify-syntax-entry k "_" table)))) (char-table-parent table)) @@ -33,12 +33,14 @@ ;; class they are given. ;; whitechar - (--each (string-to-list "\r\n\f\v \t") - (modify-syntax-entry it " " table)) + (seq-do + (lambda (it) (modify-syntax-entry it " " table)) + (string-to-list "\r\n\f\v \t")) ;; ascSymbol - (--each (string-to-list "!#$%&*+./<=>?\\^|-~:") - (modify-syntax-entry it "_" table)) + (seq-do + (lambda (it) (modify-syntax-entry it "_" table)) + (string-to-list "!#$%&*+./<=>?\\^|-~:")) ;; TODO: debatable. User nav vs fonts and lexing. getting "word boundaries" ;; is important, same for apostrophe. small (underscore is a lowercase @@ -51,8 +53,9 @@ ;; matchers because greedy matching will be much simpler. ;; some special (treated like punctuation) - (--each (string-to-list ",;@") - (modify-syntax-entry it "." table)) + (seq-do + (lambda (it) (modify-syntax-entry it "." table)) + (string-to-list ",;@")) ;; apostrophe as a word, not delimiter (modify-syntax-entry ?\' "w" table) @@ -71,8 +74,9 @@ (modify-syntax-entry ?\{ "(}1nb" table) (modify-syntax-entry ?\} "){4nb" table) (modify-syntax-entry ?- "_ 123" table) - (--each (string-to-list "\r\n\f\v") - (modify-syntax-entry it ">" table)) + (seq-do + (lambda (it) (modify-syntax-entry it ">" table)) + (string-to-list "\r\n\f\v")) table) "Haskell syntax table.") diff --git a/test/haskell-tng-compile-test.el b/test/haskell-tng-compile-test.el index 0d0b40d..8301d04 100644 --- a/test/haskell-tng-compile-test.el +++ b/test/haskell-tng-compile-test.el @@ -4,7 +4,6 @@ ;; License: GPL 3 or any later version (require 'ert) -(require 'dash) (require 'faceup) (require 'haskell-tng-mode) diff --git a/test/haskell-tng-indent-test.el b/test/haskell-tng-indent-test.el index cde166e..54f7d7e 100644 --- a/test/haskell-tng-indent-test.el +++ b/test/haskell-tng-indent-test.el @@ -137,22 +137,21 @@ the current line). INDENT is the integer suggested next line indentation column and ALTS is a list of integer alternative indentations." - (s-join "\n" (-flatten - (-map #'haskell-tng--indent-test-indent-to-string indents)))) + (s-join "\n" (seq-mapcat #'haskell-tng--indent-test-indent-to-string indents))) (defun haskell-tng--indent-test-indent-to-string (indent) (let* ((ret (car indent)) (line (cadr indent)) (prime (caddr indent)) (alts (cdddr indent)) - (widest (-max (cddr indent))) + (widest (seq-max (cddr indent))) repr) - (--dotimes (+ 1 widest) + (dotimes (it (+ 1 widest)) (push (cond ((eq it prime) "v") ((member it alts) - (let ((i (-elem-index it alts))) + (let ((i (seq-position alts it))) (if (< i 9) (number-to-string (+ 1 i)) "."))) diff --git a/test/haskell-tng-lexer-test.el b/test/haskell-tng-lexer-test.el index 95f8b05..548feff 100644 --- a/test/haskell-tng-lexer-test.el +++ b/test/haskell-tng-lexer-test.el @@ -159,17 +159,17 @@ When called interactively, shows the tokens in a buffer." (when string-hack (push token (car lines))) (unless (not multiline) - (setq lines (append (-repeat (abs line-diff) nil) lines))) + (setq lines (append (make-list (abs line-diff) nil) lines))) (if (and (not token) (if reverse (bobp) (eobp))) (setq quit 't) (unless (or (s-blank? token) string-hack) (push token (car lines))))))) (if reverse lines - (reverse (--map (reverse it) lines))))) + (reverse (seq-map (lambda (it) (reverse it)) lines))))) (defun haskell-tng--lexer-test-tokens-to-string (lines) - (concat (s-join "\n" (--map (s-join " " it) lines)) "\n")) + (concat (s-join "\n" (seq-map (lambda (it) (s-join " " it)) lines)) "\n")) (defun have-expected-forward-lex (file) (haskell-tng--testutils-assert-file-contents diff --git a/test/haskell-tng-sexp-test.el b/test/haskell-tng-sexp-test.el index bbf07ee..1bf5b1f 100644 --- a/test/haskell-tng-sexp-test.el +++ b/test/haskell-tng-sexp-test.el @@ -83,11 +83,13 @@ (goto-char (point-min)) (while (not exit) ;; there is ambiguity around multiple parens at the same point - (--each (reverse sexps) - (cond - ((= (point) (cdr it)) (push ")" chars)) - ((= (point) (car it)) (push "(" chars)) - (t nil))) + (seq-do + (lambda (it) + (cond + ((= (point) (cdr it)) (push ")" chars)) + ((= (point) (car it)) (push "(" chars)) + (t nil))) + (reverse sexps)) (if (eobp) (setq exit 't) (let ((c (string (char-after))))