From 952c255696064fe2e77a5286157aae71e25aa886 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Wed, 15 Feb 2012 11:03:51 +0900 Subject: [PATCH] cosmetic change. --- elisp/ghc-comp.el | 15 ++++++++++----- elisp/ghc-info.el | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/elisp/ghc-comp.el b/elisp/ghc-comp.el index b15dddb..1d1a0f3 100644 --- a/elisp/ghc-comp.el +++ b/elisp/ghc-comp.el @@ -269,14 +269,19 @@ unloaded modules are loaded") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(ghc-defstruct buffer name file) + +(defun ghc-buffer-name-file (buf) + (ghc-make-buffer (buffer-name buf) (buffer-file-name buf))) + (defun ghc-gather-import-modules-all-buffers () - (let ((bufs (mapcar (lambda (b) (cons (buffer-name b) (buffer-file-name b))) - (buffer-list))) - ret) + (let ((bufs (mapcar 'ghc-buffer-name-file (buffer-list))) + ret file) (save-excursion (dolist (buf bufs (ghc-uniq-lol ret)) - (when (and (cdr buf) (string-match "\\.hs$" (cdr buf))) - (set-buffer (car buf)) + (setq file (ghc-buffer-get-file buf)) + (when (and file (string-match "\\.hs$" file)) + (set-buffer (ghc-buffer-get-name buf)) (ghc-add ret (ghc-gather-import-modules-buffer))))))) (defun ghc-gather-import-modules-buffer () diff --git a/elisp/ghc-info.el b/elisp/ghc-info.el index a470ea1..c5dee19 100644 --- a/elisp/ghc-info.el +++ b/elisp/ghc-info.el @@ -23,7 +23,7 @@ (let* ((expr0 (ghc-things-at-point)) (expr (if ask (ghc-read-expression expr0) expr0)) (cdir default-directory) - (file buffer-file-name) + (file (buffer-file-name)) (buf (get-buffer-create ghc-error-buffer-name))) (with-current-buffer buf (erase-buffer) @@ -120,7 +120,7 @@ (let* ((ln (int-to-string (line-number-at-pos))) (cn (int-to-string (current-column))) (cdir default-directory) - (file buffer-file-name)) + (file (buffer-file-name))) (ghc-read-lisp (lambda () (cd cdir)