File tree 3 files changed +25
-17
lines changed 3 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -601,32 +601,24 @@ TODO/WRITEME
601
601
@findex haskell-session-change-target
602
602
@vindex haskell-interactive-mode-hook
603
603
604
- With @code {haskell-session-change-target } you can change the section
605
- (defined in project's @file {.cabal } file) the interactive REPL session is
606
- started with.
604
+ With @code {haskell-session-change-target } you can change the target for
605
+ REPL session.
607
606
608
- After the session is started, you can switch the target for
607
+
608
+ After REPL session started, in @code {haskell-interactive-mode } buffer invoke the
609
+ @code {haskell-session-change-target } and select from available targets for
609
610
610
611
@cindex testing
611
612
- Testing
612
613
613
- In @code {haskell-interactive-mode } buffer invoke the
614
- @code {haskell-session-change-target } and enter the name of the test you
615
- wish to perform, i.e. ``test''.
616
- Answer ``yes'' to restart the session.
617
-
618
614
@cindex benchmarking
619
615
- Benchmark
620
616
621
- In @code {haskell-interactive-mode } buffer invoke the @code {haskell-session-change-target }
622
- and enter the name of the benchmark you wish to perform, i.e. ``bench''.
623
- Answer ``yes'' to restart the session.
624
-
625
617
- Executable
626
618
627
- In @code { haskell-interactive-mode } buffer invoke the @code { haskell-session-change-target }
628
- and enter the name of the executable you wish to work with.
629
- Answer ``yes'' to restart the session.
619
+ - Library
620
+
621
+ Answer ``yes'' to restart the session and run your tests, benchmarks, executables .
630
622
631
623
632
624
TODO/WRITEME
Original file line number Diff line number Diff line change @@ -444,6 +444,21 @@ OTHER-WINDOW use `find-file-other-window'."
444
444
(defun haskell-cabal-section-data-start-column (section )
445
445
(plist-get section :data-start-column ))
446
446
447
+ (defun haskell-cabal-enum-targets ()
448
+ " Enumerate .cabal targets."
449
+ (let ((cabal-file (haskell-cabal-find-file)))
450
+ (when (and cabal-file (file-readable-p cabal-file))
451
+ (with-temp-buffer
452
+ (insert-file-contents cabal-file)
453
+ (haskell-cabal-mode )
454
+ (let (matches)
455
+ (goto-char (point-min ))
456
+ (haskell-cabal-next-section)
457
+ (while (not (eobp ))
458
+ (push (haskell-cabal-section-value (haskell-cabal-section)) matches)
459
+ (haskell-cabal-next-section))
460
+ (reverse matches))))))
461
+
447
462
(defmacro haskell-cabal-with-subsection (subsection replace &rest funs )
448
463
" Copy subsection data into a temporary buffer, save indentation
449
464
and execute FORMS
Original file line number Diff line number Diff line change @@ -773,7 +773,8 @@ inferior GHCi process."
773
773
;;;### autoload
774
774
(defun haskell-session-change-target (target )
775
775
" Set the build TARGET for cabal REPL."
776
- (interactive " sNew build target:" )
776
+ (interactive
777
+ (list (completing-read " New build target:" (haskell-cabal-enum-targets))))
777
778
(let* ((session haskell-session)
778
779
(old-target (haskell-session-get session 'target )))
779
780
(when session
You can’t perform that action at this time.
0 commit comments