From 22b0343eea1fdea3f820bfb6e4152463586dce4b Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 16 Jul 2010 19:02:23 +0900 Subject: [PATCH] bug fix for module name completion in mini-buffer. --- elisp/ghc-comp.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/elisp/ghc-comp.el b/elisp/ghc-comp.el index c1f0931..1babca3 100644 --- a/elisp/ghc-comp.el +++ b/elisp/ghc-comp.el @@ -155,12 +155,15 @@ unloaded modules are loaded") (set-window-configuration ghc-window-configuration) (setq ghc-window-configuration nil))) +(defun ghc-module-completion-p () + (or (minibufferp) + (save-excursion + (beginning-of-line) + (looking-at "import ")))) + (defun ghc-select-completion-symbol () (cond - ((or (minibufferp) - (save-excursion - (beginning-of-line) - (looking-at "import "))) + ((ghc-module-completion-p) ghc-module-names) ((save-excursion (beginning-of-line) @@ -177,9 +180,7 @@ unloaded modules are loaded") (defun ghc-completion-start-point () (save-excursion (let ((beg (save-excursion (beginning-of-line) (point))) - (regex (save-excursion - (beginning-of-line) - (if (looking-at "^import ") "[ (,`]" "[ (,`.]")))) + (regex (if (ghc-module-completion-p) "[ (,`]" "[ (,`.]"))) (if (re-search-backward regex beg t) (1+ (point)) beg))))