Skip to content

Commit fcb48c7

Browse files
committed
Merge pull request #473 from gracjan/pr-fix-string-suffix-prefix
Pr fix string suffix prefix
2 parents 505e683 + 04f5e14 commit fcb48c7

File tree

3 files changed

+2
-20
lines changed

3 files changed

+2
-20
lines changed

haskell-session.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
(cl-reduce (lambda (acc a)
6565
(let ((dir (haskell-session-cabal-dir a t)))
6666
(if dir
67-
(if (haskell-is-prefix-of dir
68-
(file-name-directory (buffer-file-name)))
67+
(if (string-prefix-p dir
68+
(file-name-directory (buffer-file-name)))
6969
(if acc
7070
(if (and
7171
(> (length (haskell-session-cabal-dir a t))

haskell-str.el

-13
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,6 @@ Note: The implementation currently only supports ASCII
5151
"Return (up to) N character length prefix of STRING."
5252
(substring string 0 (min (length string) n)))
5353

54-
(defalias 'haskell-str-is-prefix-of-p 'string-prefix-p)
55-
56-
(defun haskell-str-is-suffix-of-p (str1 str2 &optional ignore-case)
57-
"Return non-nil if STR1 is a suffix of STR2.
58-
If IGNORE-CASE is non-nil, the comparison is done without paying attention
59-
to case differences.
60-
61-
Dual to `haskell-str-is-prefix-of-p'"
62-
(let ((pos (- (length str2) (length str1))))
63-
(if (>= pos 0)
64-
(eq t (compare-strings str1 nil nil
65-
str2 pos nil ignore-case)))))
66-
6754
(defconst haskell-str-literal-encode-ascii-array
6855
[ "\\NUL" "\\SOH" "\\STX" "\\ETX" "\\EOT" "\\ENQ" "\\ACK" "\\a" "\\b" "\\t" "\\n" "\\v" "\\f" "\\r" "\\SO" "\\SI" "\\DLE" "\\DC1" "\\DC2" "\\DC3" "\\DC4" "\\NAK" "\\SYN" "\\ETB" "\\CAN" "\\EM" "\\SUB" "\\ESC" "\\FS" "\\GS" "\\RS" "\\US" " " "!" "\\\"" "#" "$" "%" "&" "'" "(" ")" "*" "+" "," "-" "." "/" "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" ":" ";" "<" "=" ">" "?" "@" "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "L" "M" "N" "O" "P" "Q" "R" "S" "T" "U" "V" "W" "X" "Y" "Z" "[" "\\\\" "]" "^" "_" "`" "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" "{" "|" "}" "~" "\\DEL" ]
6956
"Array of encodings for 7-bit ASCII character points indexed by ASCII value.")

haskell-string.el

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
0
1414
(min (length string) n)))
1515

16-
;;;###autoload
17-
(defun haskell-is-prefix-of (x y)
18-
"Is x string a prefix of y string?"
19-
(string= x (substring y 0 (min (length y) (length x)))))
20-
2116
(defun haskell-string ())
2217

2318
(provide 'haskell-string)

0 commit comments

Comments
 (0)