Case splitting works in Emacs!

This commit is contained in:
Alejandro Serrano 2014-06-26 21:17:22 +02:00
parent 40cd5b7deb
commit 3ef1979f67
2 changed files with 12 additions and 9 deletions

View File

@ -257,7 +257,7 @@ sig opt file lineNo colNo = ghandle handler body
modSum <- Gap.fileModSummary file
sigTy <- getSignature modSum lineNo colNo
case sigTy of
Nothing -> return ""
Nothing -> return $ convert opt ([] :: [String])
Just (Signature loc names ty) -> do
return $ convert opt $ ( "function"
, fourInts loc

View File

@ -23,14 +23,17 @@
(let ((info (ghc-obtain-case-split)))
(if (null info)
(message "Cannot split in cases")
(let ((varinfo (car info))
(declinfo (cadr info))
(cases (caddr info)))
(message cases)
)
)
)
)
(let* ((current-line (line-number-at-pos))
(begin-line (ghc-sinfo-get-beg-line info))
(begin-line-diff (+ 1 (- begin-line current-line)))
(begin-line-pos (line-beginning-position begin-line-diff))
(begin-pos (- (+ begin-line-pos (ghc-sinfo-get-beg-column info)) 1))
(end-line (ghc-sinfo-get-end-line info))
(end-line-diff (+ 1 (- end-line current-line)))
(end-line-pos (line-beginning-position end-line-diff))
(end-pos (- (+ end-line-pos (ghc-sinfo-get-end-column info)) 1)) )
(delete-region begin-pos end-pos)
(insert (ghc-sinfo-get-info info)) ) )))
(defun ghc-obtain-case-split ()
(let* ((ln (int-to-string (line-number-at-pos)))