Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

haskell-session-from-buffer: Check if buffer has a file name.

Fixes: Calling `haskell-interactive-switch' from a buffer with no
associated file name causes a type error in
`haskell-session-from-buffer'.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
  • Loading branch information...
commit 7b6ce09d01fd02f8b30de2399c02b28812193dc1 1 parent b4c37b1
@ruediger ruediger authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 haskell-session.el
View
17 haskell-session.el
@@ -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."
Please sign in to comment.
Something went wrong with that request. Please try again.