From 74bf5e5879376a0b66dfda8c266705ef8c721669 Mon Sep 17 00:00:00 2001 From: Antal Spector-Zabusky Date: Sat, 25 Apr 2015 01:25:40 -0400 Subject: [PATCH 1/2] Check that `string-match`ed things are strings. In `haskell-do-try-info` and `haskell-do-try-type`, there is code of the form `(string-match "^[A-Za-z_]" (cdr state))` that didn't check `(stringp (cdr state))`. --- haskell-commands.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/haskell-commands.el b/haskell-commands.el index c94d49a63..00da38efc 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -580,7 +580,8 @@ command from GHCi." :go (lambda (state) (haskell-process-send-string (car state) - (if (string-match "^[A-Za-z_]" (cdr state)) + (if (and (stringp (cdr state)) + (string-match "^[A-Za-z_]" (cdr state)) (format ":info %s" (cdr state)) (format ":info (%s)" (cdr state))))) :complete (lambda (state response) @@ -598,7 +599,8 @@ command from GHCi." :go (lambda (state) (haskell-process-send-string (car state) - (if (string-match "^[A-Za-z_]" (cdr state)) + (if (and (stringp (cdr state)) + (string-match "^[A-Za-z_]" (cdr state)) (format ":type %s" (cdr state)) (format ":type (%s)" (cdr state))))) :complete (lambda (state response) From 94c747be4bcbe4b77d36cd771a83df1a534ca69d Mon Sep 17 00:00:00 2001 From: Antal Spector-Zabusky Date: Sat, 25 Apr 2015 01:47:54 -0400 Subject: [PATCH 2/2] Add missing parentheses. --- haskell-commands.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haskell-commands.el b/haskell-commands.el index 00da38efc..2b81eaa13 100644 --- a/haskell-commands.el +++ b/haskell-commands.el @@ -581,7 +581,7 @@ command from GHCi." (haskell-process-send-string (car state) (if (and (stringp (cdr state)) - (string-match "^[A-Za-z_]" (cdr state)) + (string-match "^[A-Za-z_]" (cdr state))) (format ":info %s" (cdr state)) (format ":info (%s)" (cdr state))))) :complete (lambda (state response) @@ -600,7 +600,7 @@ command from GHCi." (haskell-process-send-string (car state) (if (and (stringp (cdr state)) - (string-match "^[A-Za-z_]" (cdr state)) + (string-match "^[A-Za-z_]" (cdr state))) (format ":type %s" (cdr state)) (format ":type (%s)" (cdr state))))) :complete (lambda (state response)