Skip to content

Commit a6c3ae6

Browse files
authored
Merge pull request #57 from Hi-Angel/cleanup-purescript-string
Get rid of purescript-string module
2 parents 40f1d0f + baa0714 commit a6c3ae6

File tree

4 files changed

+12
-30
lines changed

4 files changed

+12
-30
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ ELFILES = \
2020
purescript-simple-indent.el \
2121
purescript-sort-imports.el \
2222
purescript-str.el \
23-
purescript-string.el \
2423
purescript-unicode-input-method.el \
2524
purescript-utils.el \
2625
purescript-decl-scan.el \

purescript-indent.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@
8989
;;; Code:
9090

9191
(require 'purescript-vars)
92-
(require 'purescript-string)
9392
(require 'cl-lib)
93+
(eval-when-compile
94+
(when (< emacs-major-version 28)
95+
(require 'subr-x)))
9496

9597
(defgroup purescript-indent nil
9698
"PureScript indentation."
@@ -655,8 +657,8 @@ symbols in the sexp."
655657
(string-match "where[ \t]*" purescript-indent-current-line-first-ident))
656658
(diff-first ; not a function def with the same name
657659
(or (null valname-string)
658-
(not (string= (purescript-trim valname-string)
659-
(purescript-trim purescript-indent-current-line-first-ident)))))
660+
(not (string= (string-trim valname-string)
661+
(string-trim purescript-indent-current-line-first-ident)))))
660662

661663
;; (is-type-def
662664
;; (and rpurs-sign (eq (char-after rpurs-sign) ?\:)))

purescript-mode.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
(require 'purescript-vars)
3838
(require 'purescript-align-imports)
3939
(require 'purescript-sort-imports)
40-
(require 'purescript-string)
4140
(require 'purescript-font-lock)
4241
(require 'cl-lib)
4342
(cl-eval-when 'compile (require 'find-file))
@@ -419,14 +418,20 @@ Brings up the documentation for purescript-mode-hook."
419418
(goto-char (+ (line-beginning-position)
420419
col))))
421420

421+
(defun purescript-string-take (string n)
422+
"Take n chars from string."
423+
(substring string
424+
0
425+
(min (length string) n)))
426+
422427
(defun purescript-mode-message-line (str)
423428
"Message only one line, multiple lines just disturbs the programmer."
424429
(let ((lines (split-string str "\n" t)))
425430
(when (and (car lines) (stringp (car lines)))
426431
(message "%s"
427432
(concat (car lines)
428433
(if (and (cdr lines) (stringp (cadr lines)))
429-
(format " [ %s .. ]" (purescript-string-take (purescript-trim (cadr lines)) 10))
434+
(format " [ %s .. ]" (purescript-string-take (string-trim (cadr lines)) 10))
430435
""))))))
431436

432437
(defun purescript-current-line-string ()

purescript-string.el

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)