Skip to content

Pr fix string suffix prefix #473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions haskell-session.el
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
(cl-reduce (lambda (acc a)
(let ((dir (haskell-session-cabal-dir a t)))
(if dir
(if (haskell-is-prefix-of dir
(file-name-directory (buffer-file-name)))
(if (string-prefix-p dir
(file-name-directory (buffer-file-name)))
(if acc
(if (and
(> (length (haskell-session-cabal-dir a t))
Expand Down
13 changes: 0 additions & 13 deletions haskell-str.el
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,6 @@ Note: The implementation currently only supports ASCII
"Return (up to) N character length prefix of STRING."
(substring string 0 (min (length string) n)))

(defalias 'haskell-str-is-prefix-of-p 'string-prefix-p)

(defun haskell-str-is-suffix-of-p (str1 str2 &optional ignore-case)
"Return non-nil if STR1 is a suffix of STR2.
If IGNORE-CASE is non-nil, the comparison is done without paying attention
to case differences.

Dual to `haskell-str-is-prefix-of-p'"
(let ((pos (- (length str2) (length str1))))
(if (>= pos 0)
(eq t (compare-strings str1 nil nil
str2 pos nil ignore-case)))))

(defconst haskell-str-literal-encode-ascii-array
[ "\\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" ]
"Array of encodings for 7-bit ASCII character points indexed by ASCII value.")
Expand Down
5 changes: 0 additions & 5 deletions haskell-string.el
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@
0
(min (length string) n)))

;;;###autoload
(defun haskell-is-prefix-of (x y)
"Is x string a prefix of y string?"
(string= x (substring y 0 (min (length y) (length x)))))

(defun haskell-string ())

(provide 'haskell-string)