File tree Expand file tree Collapse file tree 3 files changed +29
-17
lines changed Expand file tree Collapse file tree 3 files changed +29
-17
lines changed Original file line number Diff line number Diff line change @@ -614,32 +614,24 @@ TODO/WRITEME
614614@findex  haskell-session-change-target  
615615@vindex  haskell-interactive-mode-hook  
616616
617- With @code {haskell-session-change-target } you can change the section
618- (defined in project's @file {.cabal } file) the interactive REPL session is
619- started with.
617+ With @code {haskell-session-change-target } you can change the target for
618+ REPL session.
620619
621- After the session is started, you can switch the target for
620+ 
621+ After REPL session started, in @code {haskell-interactive-mode } buffer invoke the
622+ @code {haskell-session-change-target } and select from available targets for
622623
623624@cindex  testing  
624625- Testing
625626
626- In @code {haskell-interactive-mode } buffer invoke the
627- @code {haskell-session-change-target } and enter the name of the test you
628- wish to perform, i.e. ``test''.
629- Answer ``yes'' to restart the session.
630- 
631627@cindex  benchmarking  
632628- Benchmark
633629
634- In @code {haskell-interactive-mode } buffer invoke the  @code {haskell-session-change-target }
635- and enter the name of the benchmark you wish to perform, i.e. ``bench''.
636- Answer ``yes'' to restart the session.
637- 
638630- Executable
639631
640- In  @code { haskell-interactive-mode } buffer invoke the   @code { haskell-session-change-target } 
641- and enter the name of the executable you wish to work with. 
642- Answer ``yes'' to restart the session.
632+ - Library 
633+ 
634+ Answer ``yes'' to restart the session and run your tests, benchmarks, executables .
643635
644636
645637TODO/WRITEME
Original file line number Diff line number Diff line change @@ -444,6 +444,21 @@ OTHER-WINDOW use `find-file-other-window'."
444444(defun  haskell-cabal-section-data-start-column  (section )
445445  (plist-get  section :data-start-column ))
446446
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+ 
447462(defmacro  haskell-cabal-with-subsection  (subsection  replace  &rest  funs )
448463  " Copy subsection data into a temporary buffer, save indentation
449464and execute FORMS 
Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ Use to update mtime on BUFFER's file."
169169
170170(defvar  url-http-response-status )
171171(defvar  url-http-end-of-headers )
172+ (defvar  haskell-cabal-targets-history  nil 
173+   " History list for session targets." 
172174
173175(defun  haskell-process-hayoo-ident  (ident )
174176  ; ; FIXME Obsolete doc string, CALLBACK is not used.
@@ -773,7 +775,10 @@ inferior GHCi process."
773775;;;### autoload 
774776(defun  haskell-session-change-target  (target )
775777  " Set the build TARGET for cabal REPL." 
776-   (interactive  " sNew build target:" 
778+   (interactive 
779+    (list 
780+      (completing-read  " New build target: " 
781+ 		      nil  nil  nil  'haskell-cabal-targets-history )))
777782  (let*  ((session haskell-session)
778783         (old-target (haskell-session-get session 'target )))
779784    (when  session
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments