From 5db4044f29e431f2cb4689ffb476ad7346642dec Mon Sep 17 00:00:00 2001 From: Alejandro Serrano Date: Wed, 2 Jul 2014 17:04:28 +0200 Subject: [PATCH] Use a struct for accessing initial info data --- elisp/ghc-rewrite.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/elisp/ghc-rewrite.el b/elisp/ghc-rewrite.el index 90f5138..681c897 100644 --- a/elisp/ghc-rewrite.el +++ b/elisp/ghc-rewrite.el @@ -47,17 +47,19 @@ ;;; Initial code from signature ;;; +(ghc-defstruct icsinfo sort pos fns) + (defun ghc-initial-code-from-signature () (interactive) (let ((info (ghc-obtain-initial-code-from-signature))) (if (null info) (message "Cannot obtain initial code") (let* ((ln-current (line-number-at-pos)) - (sort (car info)) - (pos (cadr info)) + (sort (ghc-icsinfo-get-sort info)) + (pos (ghc-icsinfo-get-pos info)) (ln-end (ghc-sinfo-get-end-line pos)) (ln-diff (+ 1 (- ln-end ln-current))) - (fns-to-insert (caddr info))) + (fns-to-insert (ghc-icsinfo-get-fns info))) (goto-char (line-end-position ln-diff)) (dolist (fn-to-insert fns-to-insert) (if (equal sort "function")