Case splitting in M-t and initial-code in C-u M-t

This commit is contained in:
Alejandro Serrano 2014-08-14 17:59:46 +02:00
parent 7ecb66f32e
commit 8eeeacd58d
4 changed files with 7 additions and 19 deletions

View File

@ -19,7 +19,8 @@
((ghc-check-overlay-at (point)) ((ghc-check-overlay-at (point))
(ghc-check-insert-from-warning)) (ghc-check-insert-from-warning))
(t (t
(message "Nothing to be done")))) (when (null (ghc-try-case-split))
(message "Nothing to be done")))))
(defun ghc-insert-module-template () (defun ghc-insert-module-template ()
(let* ((fullname (file-name-sans-extension (buffer-file-name))) (let* ((fullname (file-name-sans-extension (buffer-file-name)))

View File

@ -125,10 +125,9 @@ unloaded modules are loaded")
(defun ghc-complete () (defun ghc-complete ()
(interactive) (interactive)
(when (null (ghc-try-rewrite)) (if (ghc-should-scroll)
(if (ghc-should-scroll) (ghc-scroll-completion-buffer)
(ghc-scroll-completion-buffer) (ghc-try-complete)))
(ghc-try-complete))))
(defun ghc-should-scroll () (defun ghc-should-scroll ()
(let ((window (ghc-completion-window))) (let ((window (ghc-completion-window)))

View File

@ -33,18 +33,6 @@
(insert (ghc-sinfo-get-info info)) ) (insert (ghc-sinfo-get-info info)) )
) )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Combined rewriting
;;;
(defun ghc-try-rewrite ()
"Try to apply initial code generation and case splitting"
(interactive)
(when (null (ghc-try-initial-code-from-signature))
(ghc-try-case-split)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ;;;
;;; Case splitting ;;; Case splitting

View File

@ -74,7 +74,7 @@
(defvar ghc-shallower-key "\C-c<") (defvar ghc-shallower-key "\C-c<")
(defvar ghc-deeper-key "\C-c>") (defvar ghc-deeper-key "\C-c>")
;(defvar ghc-case-split-key "\C-c\C-s") ;(defvar ghc-case-split-key "\C-c\C-s")
;(defvar ghc-initial-sig-key "\C-c\C-g") (defvar ghc-initial-sig-key "\C-u\et")
(defvar ghc-refine-key "\C-c\C-f") (defvar ghc-refine-key "\C-c\C-f")
(defvar ghc-auto-key "\C-c\C-a") (defvar ghc-auto-key "\C-c\C-a")
(defvar ghc-prev-hole-key "\C-c\ep") (defvar ghc-prev-hole-key "\C-c\ep")
@ -112,7 +112,7 @@
(define-key haskell-mode-map ghc-shallower-key 'ghc-make-indent-shallower) (define-key haskell-mode-map ghc-shallower-key 'ghc-make-indent-shallower)
(define-key haskell-mode-map ghc-deeper-key 'ghc-make-indent-deeper) (define-key haskell-mode-map ghc-deeper-key 'ghc-make-indent-deeper)
;(define-key haskell-mode-map ghc-case-split-key 'ghc-case-split) ;(define-key haskell-mode-map ghc-case-split-key 'ghc-case-split)
;(define-key haskell-mode-map ghc-initial-sig-key 'ghc-initial-code-from-signature) (define-key haskell-mode-map ghc-initial-sig-key 'ghc-initial-code-from-signature)
(define-key haskell-mode-map ghc-refine-key 'ghc-refine) (define-key haskell-mode-map ghc-refine-key 'ghc-refine)
(define-key haskell-mode-map ghc-auto-key 'ghc-auto) (define-key haskell-mode-map ghc-auto-key 'ghc-auto)
(define-key haskell-mode-map ghc-prev-hole-key 'ghc-goto-prev-hole) (define-key haskell-mode-map ghc-prev-hole-key 'ghc-goto-prev-hole)