Permalink
Browse files

Merge pull request #104 from ruediger/minor-changes

Several minor fixes.
  • Loading branch information...
2 parents a37fa71 + 14a523d commit 28e322877ddf82ae42687f91bfb10e050e4d3498 @gregorycollins gregorycollins committed Dec 13, 2012
Showing with 33 additions and 18 deletions.
  1. +8 −2 Makefile
  2. +2 −1 haskell-cabal.el
  3. +12 −6 haskell-interactive-mode.el
  4. +2 −1 haskell-process.el
  5. +9 −8 haskell-session.el
View
@@ -1,4 +1,5 @@
EMACS = emacs
+BATCH = $(EMACS) --batch -Q
ELFILES = \
haskell-c.el \
@@ -30,13 +31,18 @@ ELCFILES = $(ELFILES:.el=.elc)
AUTOLOADS = haskell-site-file.el
%.elc: %.el
- $(EMACS) --batch --eval '(setq load-path (cons "." load-path))' \
+ $(BATCH) --eval '(setq load-path (cons "." load-path))' \
-f batch-byte-compile $<
+.PHONY: all compile info dist clean
+
all: $(AUTOLOADS)
compile: $(ELCFILES)
+clean:
+ $(RM) $(ELCFILES)
+
info:
# No Texinfo file, sorry.
@@ -48,7 +54,7 @@ PACKAGE=haskell-mode
$(AUTOLOADS): $(ELFILES)
[ -f $@ ] || echo ' ' >$@
- $(EMACS) --batch --eval '(setq generated-autoload-file "'`pwd`'/$@")' -f batch-update-autoloads "."
+ $(BATCH) --eval '(setq generated-autoload-file "'`pwd`'/$@")' -f batch-update-autoloads "."
##
View
@@ -160,8 +160,9 @@
and indeed just prompting the user. Do them all."
(let* ((file (haskell-cabal-find-file))
(dir (when file (file-name-directory file))))
- (read-from-minibuffer
+ (read-directory-name
(format "Cabal dir%s: " (if file (format " (%s)" (file-relative-name file)) ""))
+ nil
(or dir default-directory))))
(defun haskell-cabal-compute-checksum (cabal-dir)
@@ -40,7 +40,7 @@
(defcustom haskell-interactive-mode-eval-mode
nil
"Use the given mode's font-locking to render some text."
- :type 'boolean
+ :type '(choice function (const :tag "None" nil))
:group 'haskell)
(defvar haskell-interactive-greetings
@@ -53,7 +53,10 @@
;;;###autoload
(defun haskell-interactive-mode (session)
- "Interactive mode for Haskell."
+ "Interactive mode for Haskell.
+
+Key bindings:
+\\{haskell-interactive-mode-map}"
(interactive)
(kill-all-local-variables)
(haskell-session-assign session)
@@ -209,7 +212,8 @@
(other-window 1)
(find-file file)
(haskell-interactive-bring)
- (goto-line (string-to-number line))
+ (goto-char (point-min))
+ (forward-line (1- (string-to-number line)))
(goto-char (+ (point) (string-to-number col)))
(haskell-mode-message-line orig-line)
t)))))))
@@ -228,7 +232,7 @@
(let ((inhibit-read-only t))
(set-text-properties (point-min) (point-max) nil))
(delete-region (point-min) (point-max))
- (mapcar 'delete-overlay (overlays-in (point-min) (point-max)))
+ (mapc 'delete-overlay (overlays-in (point-min) (point-max)))
(haskell-interactive-mode-prompt (haskell-session))))
(defun haskell-interactive-mode-input ()
@@ -252,7 +256,7 @@
'prompt t))))
(defun haskell-interactive-mode-eval-result (session text)
- "Insert the result of an eval as plain text"
+ "Insert the result of an eval as plain text."
(with-current-buffer (haskell-session-interactive-buffer session)
(goto-char (point-max))
(insert (propertize text
@@ -445,7 +449,7 @@
(with-current-buffer (haskell-session-interactive-buffer (haskell-session))
(if (progn (goto-char (line-beginning-position))
(looking-at "^[^:]+:[0-9]+:[0-9]+: "))
- (progn (previous-line)
+ (progn (forward-line -1)
(haskell-interactive-jump-to-error-line))
(progn (goto-char (point-max))
(haskell-interactive-mode-error-backward)
@@ -458,3 +462,5 @@
(goto-char (point-max))))
(provide 'haskell-interactive-mode)
+
+;;; haskell-interactive-mode.el ends here
View
@@ -555,8 +555,9 @@ to be loaded by ghci."
(defun haskell-process-prompt-dir (session)
"Prompt for the current directory."
- (read-from-minibuffer
+ (read-directory-name
"Set current directory: "
+ nil
(or (haskell-session-get session 'current-dir)
(if (buffer-file-name)
(file-name-directory (buffer-file-name))
View
@@ -113,14 +113,15 @@
(defun haskell-session-from-buffer ()
"Get the session based on the buffer."
- (let ((sessions (remove-if-not (lambda (session)
- (haskell-is-prefix-of (file-name-directory (buffer-file-name))
- (haskell-session-cabal-dir session)))
- haskell-sessions)))
- (sort sessions (lambda (a b) (< (length (haskell-session-cabal-dir a))
- (length (haskell-session-cabal-dir b)))))
- (when (consp sessions)
- (car sessions))))
+ (when (buffer-file-name)
+ (let ((sessions (remove-if-not (lambda (session)
+ (haskell-is-prefix-of (file-name-directory (buffer-file-name))
+ (haskell-session-cabal-dir session)))
+ haskell-sessions)))
+ (sort sessions (lambda (a b) (< (length (haskell-session-cabal-dir a))
+ (length (haskell-session-cabal-dir b)))))
+ (when (consp sessions)
+ (car sessions)))))
(defun haskell-session-new ()
"Make a new session."

0 comments on commit 28e3228

Please sign in to comment.