Using "^import +". (#570)
This commit is contained in:
parent
c5db06af0f
commit
7e908fcd5e
@ -53,7 +53,7 @@
|
|||||||
(let ((inhibit-field-text-motion t))
|
(let ((inhibit-field-text-motion t))
|
||||||
(sort-subr nil 'forward-line 'end-of-line
|
(sort-subr nil 'forward-line 'end-of-line
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(re-search-forward "^import\\( *qualified\\)? *" nil t)
|
(re-search-forward "^import +\\(qualified\\)? *" nil t)
|
||||||
nil)
|
nil)
|
||||||
'end-of-line))
|
'end-of-line))
|
||||||
(ghc-merge-lines))))
|
(ghc-merge-lines))))
|
||||||
@ -64,7 +64,7 @@
|
|||||||
(while (not (eolp))
|
(while (not (eolp))
|
||||||
;; qualified modlues are not merged at this moment.
|
;; qualified modlues are not merged at this moment.
|
||||||
;; fixme if it is improper.
|
;; fixme if it is improper.
|
||||||
(if (looking-at "^import *\\([A-Z][^ \n]+\\) *(\\(.*\\))$")
|
(if (looking-at "^import +\\([A-Z][^ \n]+\\) *(\\(.*\\))$")
|
||||||
(let ((mod (match-string-no-properties 1))
|
(let ((mod (match-string-no-properties 1))
|
||||||
(syms (match-string-no-properties 2))
|
(syms (match-string-no-properties 2))
|
||||||
(beg (point)))
|
(beg (point)))
|
||||||
@ -73,7 +73,7 @@
|
|||||||
(forward-line)))))
|
(forward-line)))))
|
||||||
|
|
||||||
(defun ghc-merge-line (beg mod syms)
|
(defun ghc-merge-line (beg mod syms)
|
||||||
(let ((regex (concat "^import *" (regexp-quote mod) " *(\\(.*\\))$"))
|
(let ((regex (concat "^import +" (regexp-quote mod) " *(\\(.*\\))$"))
|
||||||
duplicated)
|
duplicated)
|
||||||
(while (looking-at regex)
|
(while (looking-at regex)
|
||||||
(setq duplicated t)
|
(setq duplicated t)
|
||||||
|
@ -265,7 +265,7 @@ unloaded modules are loaded")
|
|||||||
(let (ret)
|
(let (ret)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "^import\\( *qualified\\)? +\\([^\n ]+\\)" nil t)
|
(while (re-search-forward "^import +\\(qualified\\)? *\\([^\n ]+\\)" nil t)
|
||||||
(ghc-add ret (match-string-no-properties 2))
|
(ghc-add ret (match-string-no-properties 2))
|
||||||
(forward-line)))
|
(forward-line)))
|
||||||
ret))
|
ret))
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
(defun ghc-goto-module-position ()
|
(defun ghc-goto-module-position ()
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(if (re-search-backward "^import" nil t)
|
(if (re-search-backward "^import +" nil t)
|
||||||
(ghc-goto-empty-line)
|
(ghc-goto-empty-line)
|
||||||
(if (not (re-search-backward "^module" nil t))
|
(if (not (re-search-backward "^module" nil t))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
Loading…
Reference in New Issue
Block a user