diff --git a/elisp/ghc-command.el b/elisp/ghc-command.el index 7970a12..df9a69f 100644 --- a/elisp/ghc-command.el +++ b/elisp/ghc-command.el @@ -53,7 +53,7 @@ (let ((inhibit-field-text-motion t)) (sort-subr nil 'forward-line 'end-of-line (lambda () - (re-search-forward "^import\\( *qualified\\)? *" nil t) + (re-search-forward "^import +\\(qualified\\)? *" nil t) nil) 'end-of-line)) (ghc-merge-lines)))) @@ -64,7 +64,7 @@ (while (not (eolp)) ;; qualified modlues are not merged at this moment. ;; 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)) (syms (match-string-no-properties 2)) (beg (point))) @@ -73,7 +73,7 @@ (forward-line))))) (defun ghc-merge-line (beg mod syms) - (let ((regex (concat "^import *" (regexp-quote mod) " *(\\(.*\\))$")) + (let ((regex (concat "^import +" (regexp-quote mod) " *(\\(.*\\))$")) duplicated) (while (looking-at regex) (setq duplicated t) diff --git a/elisp/ghc-comp.el b/elisp/ghc-comp.el index 2209ca2..20be9a1 100644 --- a/elisp/ghc-comp.el +++ b/elisp/ghc-comp.el @@ -265,7 +265,7 @@ unloaded modules are loaded") (let (ret) (save-excursion (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)) (forward-line))) ret)) diff --git a/elisp/ghc-ins-mod.el b/elisp/ghc-ins-mod.el index 14db867..d567ec2 100644 --- a/elisp/ghc-ins-mod.el +++ b/elisp/ghc-ins-mod.el @@ -56,7 +56,7 @@ (defun ghc-goto-module-position () (goto-char (point-max)) - (if (re-search-backward "^import" nil t) + (if (re-search-backward "^import +" nil t) (ghc-goto-empty-line) (if (not (re-search-backward "^module" nil t)) (goto-char (point-min))