From 8eeeacd58dc4c6b5ebca1bb959e18843523d01bc Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Thu, 14 Aug 2014 17:59:46 +0200 Subject: [PATCH] Case splitting in M-t and initial-code in C-u M-t --- elisp/ghc-command.el | 3 ++- elisp/ghc-comp.el | 7 +++---- elisp/ghc-rewrite.el | 12 ------------ elisp/ghc.el | 4 ++-- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/elisp/ghc-command.el b/elisp/ghc-command.el index dfb7679..cb9b2b9 100644 --- a/elisp/ghc-command.el +++ b/elisp/ghc-command.el @@ -19,7 +19,8 @@ ((ghc-check-overlay-at (point)) (ghc-check-insert-from-warning)) (t - (message "Nothing to be done")))) + (when (null (ghc-try-case-split)) + (message "Nothing to be done"))))) (defun ghc-insert-module-template () (let* ((fullname (file-name-sans-extension (buffer-file-name))) diff --git a/elisp/ghc-comp.el b/elisp/ghc-comp.el index a8f067b..2b26a16 100644 --- a/elisp/ghc-comp.el +++ b/elisp/ghc-comp.el @@ -125,10 +125,9 @@ unloaded modules are loaded") (defun ghc-complete () (interactive) - (when (null (ghc-try-rewrite)) - (if (ghc-should-scroll) - (ghc-scroll-completion-buffer) - (ghc-try-complete)))) + (if (ghc-should-scroll) + (ghc-scroll-completion-buffer) + (ghc-try-complete))) (defun ghc-should-scroll () (let ((window (ghc-completion-window))) diff --git a/elisp/ghc-rewrite.el b/elisp/ghc-rewrite.el index 47ea5b8..14432f9 100644 --- a/elisp/ghc-rewrite.el +++ b/elisp/ghc-rewrite.el @@ -33,18 +33,6 @@ (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 diff --git a/elisp/ghc.el b/elisp/ghc.el index 5a196fb..c541301 100644 --- a/elisp/ghc.el +++ b/elisp/ghc.el @@ -74,7 +74,7 @@ (defvar ghc-shallower-key "\C-c<") (defvar ghc-deeper-key "\C-c>") ;(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-auto-key "\C-c\C-a") (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-deeper-key 'ghc-make-indent-deeper) ;(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-auto-key 'ghc-auto) (define-key haskell-mode-map ghc-prev-hole-key 'ghc-goto-prev-hole)