Skip to content

Commit

Permalink
Convert all tabs to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
gracjan committed Mar 15, 2016
1 parent 923e3f1 commit 65bdfd8
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 209 deletions.
8 changes: 4 additions & 4 deletions haskell-cabal.el
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ file), then this function returns nil."
(let* ((file (haskell-cabal-find-file))
(dir (if file (file-name-directory file) default-directory)))
(if use-defaults
dir
(haskell-utils-read-directory-name
(format "Cabal dir%s: " (if file (format " (guessed from %s)" (file-relative-name file)) ""))
dir))))
dir
(haskell-utils-read-directory-name
(format "Cabal dir%s: " (if file (format " (guessed from %s)" (file-relative-name file)) ""))
dir))))

(defun haskell-cabal-compute-checksum (dir)
"Compute MD5 checksum of package description file in DIR.
Expand Down
16 changes: 8 additions & 8 deletions haskell-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,8 @@ of which the latter defaults to the current buffer."
(or (haskell-session-get session 'current-dir)
(haskell-session-get session 'cabal-dir)
(if (buffer-file-name buffer)
(file-name-directory (buffer-file-name buffer))
"~/")))
(file-name-directory (buffer-file-name buffer))
"~/")))

(defun haskell-session-prompt-set-current-dir (session &optional use-default)
"Prompt for the current directory.
Expand All @@ -537,8 +537,8 @@ Return current working directory for SESSION."
(haskell-session-set-current-dir
session
(if use-default
default
(haskell-utils-read-directory-name "Set current directory: " default))))
default
(haskell-utils-read-directory-name "Set current directory: " default))))
(haskell-session-get session 'current-dir))

(defun haskell-process-change-dir (session process dir)
Expand Down Expand Up @@ -813,8 +813,8 @@ output. If CMD fails the buffer remains unchanged."
(setq str (replace-match "" t t str)))
str))
(_errout (lambda (fmt &rest args)
(let* ((warning-fill-prefix " "))
(display-warning cmd (apply 'format fmt args) :warning))))
(let* ((warning-fill-prefix " "))
(display-warning cmd (apply 'format fmt args) :warning))))
(filename (buffer-file-name (current-buffer)))
(cmd-prefix (replace-regexp-in-string " .*" "" cmd))
(tmp-file (make-temp-file cmd-prefix))
Expand All @@ -824,8 +824,8 @@ output. If CMD fails the buffer remains unchanged."
(haskell-session-cabal-dir haskell-session)
default-directory))
(_errcode (with-temp-file tmp-file
(call-process cmd filename
(list (current-buffer) err-file) nil)))
(call-process cmd filename
(list (current-buffer) err-file) nil)))
(stderr-output
(with-temp-buffer
(insert-file-contents err-file)
Expand Down
24 changes: 12 additions & 12 deletions haskell-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ Regexp match data 0 points to the chars."

(defun haskell-font-lock-symbols-keywords ()
(when (and haskell-font-lock-symbols
haskell-font-lock-symbols-alist)
haskell-font-lock-symbols-alist)
`((,(regexp-opt (mapcar 'car haskell-font-lock-symbols-alist) t)
(0 (haskell-font-lock-compose-symbol ',haskell-font-lock-symbols-alist)
;; In Emacs-21, if the `override' field is nil, the face
;; expressions is only evaluated if the text has currently
;; no face. So force evaluation by using `keep'.
keep)))))
;; In Emacs-21, if the `override' field is nil, the face
;; expressions is only evaluated if the text has currently
;; no face. So force evaluation by using `keep'.
keep)))))

(defun haskell-font-lock-keywords ()
;; this has to be a function because it depends on global value of
Expand Down Expand Up @@ -437,13 +437,13 @@ Regexp match data 0 points to the chars."
((save-excursion
(goto-char (nth 8 state))
(or (looking-at-p "\\(?:{- ?\\|-- \\)[|^*$]")
(and (looking-at-p "--") ; are we at double dash comment
(forward-line -1) ; this is nil on first line
(eq (get-text-property (line-end-position) 'face)
'font-lock-doc-face) ; is a doc face
(forward-line)
(skip-syntax-forward "-") ; see if there is only whitespace
(eq (point) (nth 8 state))))) ; we are back in position
(and (looking-at-p "--") ; are we at double dash comment
(forward-line -1) ; this is nil on first line
(eq (get-text-property (line-end-position) 'face)
'font-lock-doc-face) ; is a doc face
(forward-line)
(skip-syntax-forward "-") ; see if there is only whitespace
(eq (point) (nth 8 state))))) ; we are back in position
'font-lock-doc-face)
(t 'font-lock-comment-face)))

Expand Down
12 changes: 6 additions & 6 deletions haskell-interactive-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ SESSION, otherwise operate on the current buffer."
(with-current-buffer (haskell-session-interactive-buffer session)
(goto-char (point-max))
(insert (ansi-color-apply
(propertize text
'font-lock-face 'haskell-interactive-face-result
(propertize text
'font-lock-face 'haskell-interactive-face-result
'front-sticky t
'prompt t
'read-only t
'rear-nonsticky t
'result t)))
'prompt t
'read-only t
'rear-nonsticky t
'result t)))
(haskell-interactive-mode-handle-h)
(let ((marker (set (make-local-variable 'haskell-interactive-mode-result-end)
(make-marker))))
Expand Down
2 changes: 1 addition & 1 deletion haskell-lexeme.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(and (consp key) (> (car key) 128))
(and (numberp key) (> key 128)))
(if (member val '(Pc Pd Po Sm Sc Sk So))
(modify-category-entry key ?P))))
(modify-category-entry key ?P))))
unicode-category-table)

(dolist (key (string-to-list "!#$%&*+./<=>?@^|~\\-"))
Expand Down
2 changes: 1 addition & 1 deletion haskell-navigate-imports.el
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
(haskell-navigate-imports-line)))
(forward-line))
(if (haskell-navigate-imports-line)
(point)
(point)
nil)))

(defun haskell-navigate-imports-line ()
Expand Down
6 changes: 3 additions & 3 deletions haskell-process.el
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
(apply haskell-process-wrapper-function
(list
(append (haskell-process-path-to-list haskell-process-path-ghci)
haskell-process-args-ghci)))))
haskell-process-args-ghci)))))
('cabal-repl
(append (list (format "Starting inferior `cabal repl' process using %s ..."
haskell-process-path-cabal)
Expand All @@ -95,7 +95,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
(apply haskell-process-wrapper-function
(list
(append
(haskell-process-path-to-list haskell-process-path-cabal)
(haskell-process-path-to-list haskell-process-path-cabal)
(list "repl")
haskell-process-args-cabal-repl
(let ((target (haskell-session-target session)))
Expand All @@ -107,7 +107,7 @@ HPTYPE is the result of calling `'haskell-process-type`' function."
(apply haskell-process-wrapper-function
(list
(append
(haskell-process-path-to-list haskell-process-path-stack)
(haskell-process-path-to-list haskell-process-path-stack)
(list "ghci")
(let ((target (haskell-session-target session)))
(if target (list target) nil))
Expand Down
16 changes: 8 additions & 8 deletions haskell-session.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
(let ((dir (haskell-session-get a 'cabal-dir)))
(if dir
(if (string-prefix-p dir
(file-name-directory (buffer-file-name)))
(file-name-directory (buffer-file-name)))
(if acc
(if (and
(> (length (haskell-session-get a 'cabal-dir))
Expand Down Expand Up @@ -155,9 +155,9 @@ If `haskell-process-load-or-reload-prompt' is nil, accept `default'."
(let* ((maybe-target (haskell-session-get s 'target))
(target (if maybe-target maybe-target
(let ((new-target
(if haskell-process-load-or-reload-prompt
(read-string "build target (empty for default):")
"")))
(if haskell-process-load-or-reload-prompt
(read-string "build target (empty for default):")
"")))
(haskell-session-set-target s new-target)))))
(if (not (string= target "")) target nil)))

Expand Down Expand Up @@ -198,10 +198,10 @@ If `haskell-process-load-or-reload-prompt' is nil, accept `default'."
"Get the session cabal-dir."
(or (haskell-session-get s 'cabal-dir)
(let ((set-dir (haskell-cabal-get-dir (not haskell-process-load-or-reload-prompt))))
(if set-dir
(progn (haskell-session-set-cabal-dir s set-dir)
set-dir)
(haskell-session-cabal-dir s)))))
(if set-dir
(progn (haskell-session-set-cabal-dir s set-dir)
set-dir)
(haskell-session-cabal-dir s)))))

(defun haskell-session-modify (session key update)
"Update the value at KEY in SESSION with UPDATE."
Expand Down
24 changes: 12 additions & 12 deletions haskell-sort-imports.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ within that region."
(haskell-sort-imports-goto-import-start))
(haskell-sort-imports-goto-group-start))
(let* ((start (point))
(imports (haskell-sort-imports-collect-imports))
(sorted (sort (cl-copy-list imports)
(lambda (a b)
(string< (haskell-sort-imports-normalize a)
(haskell-sort-imports-normalize b))))))
(when (not (equal imports sorted))
(delete-region start (point))
(mapc (lambda (import) (insert import "\n")) sorted))
(goto-char start)
(when (search-forward current-string nil t 1)
(forward-char (- (length current-string)))
(forward-char current-offset))))))
(imports (haskell-sort-imports-collect-imports))
(sorted (sort (cl-copy-list imports)
(lambda (a b)
(string< (haskell-sort-imports-normalize a)
(haskell-sort-imports-normalize b))))))
(when (not (equal imports sorted))
(delete-region start (point))
(mapc (lambda (import) (insert import "\n")) sorted))
(goto-char start)
(when (search-forward current-string nil t 1)
(forward-char (- (length current-string)))
(forward-char current-offset))))))

(defun haskell-sort-imports-normalize (i)
"Normalize an import, if possible, so that it can be sorted."
Expand Down
2 changes: 1 addition & 1 deletion haskell.el
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"A `completion-at-point' function using the current haskell process."
(when (haskell-session-maybe)
(let ((process (haskell-process))
symbol-bounds)
symbol-bounds)
(cond
;; ghci can complete module names, but it needs the "import "
;; string at the beginning
Expand Down
16 changes: 8 additions & 8 deletions tests/haskell-cabal-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
(with-temp-buffer
(haskell-cabal-mode)
(let ((scriptDir
(file-name-directory
(or (symbol-file 'haskell-cabal-enum-targets-1)
(buffer-file-name)))))
(file-name-directory
(or (symbol-file 'haskell-cabal-enum-targets-1)
(buffer-file-name)))))
(setq default-directory (expand-file-name "test-data" scriptDir)))
(should (equal '("Test" "test-1" "bench-1" "bin-1")
(haskell-cabal-enum-targets)))))
(haskell-cabal-enum-targets)))))

(ert-deftest haskell-cabal-get-field-1 ()
(with-temp-buffer
(let ((scriptDir
(file-name-directory
(or (symbol-file 'haskell-cabal-get-field-1)
(buffer-file-name)))))
(file-name-directory
(or (symbol-file 'haskell-cabal-get-field-1)
(buffer-file-name)))))
(set-visited-file-name (expand-file-name "test-data/Source.hs" scriptDir) t t))
(should (equal "Simple"
(haskell-cabal-get-field "build-type")))))
(haskell-cabal-get-field "build-type")))))

(ert-deftest haskell-cabal-compute-checksum-1 ()
(let ((scriptDir
Expand Down
Loading

0 comments on commit 65bdfd8

Please sign in to comment.