File tree Expand file tree Collapse file tree 1 file changed +26
-13
lines changed Expand file tree Collapse file tree 1 file changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -930,19 +930,32 @@ to point."
930
930
" Prepare :type-at command to be send to haskell process.
931
931
POS is a cons cell containing min and max positions, i.e. target
932
932
expression bounds."
933
- (replace-regexp-in-string
934
- " \n $"
935
- " "
936
- (format " :type-at %s %d %d %d %d %s "
937
- (buffer-file-name )
938
- (progn (goto-char (car pos))
939
- (line-number-at-pos ))
940
- (1+ (current-column ))
941
- (progn (goto-char (cdr pos))
942
- (line-number-at-pos ))
943
- (1+ (current-column ))
944
- (buffer-substring-no-properties (car pos)
945
- (cdr pos)))))
933
+ (save-excursion
934
+ (let ((start-p (car pos))
935
+ (end-p (cdr pos))
936
+ start-l
937
+ start-c
938
+ end-l
939
+ end-c
940
+ value)
941
+ (goto-char start-p)
942
+ (setq start-l (line-number-at-pos ))
943
+ (setq start-c (1+ (current-column )))
944
+ (goto-char end-p)
945
+ (setq end-l (line-number-at-pos ))
946
+ (setq end-c (1+ (current-column )))
947
+ (setq value (buffer-substring-no-properties start-p end-p))
948
+ (replace-regexp-in-string
949
+ " \n $"
950
+ " "
951
+ (format " :type-at %s %d %d %d %d %s "
952
+ (buffer-file-name )
953
+ start-l
954
+ start-c
955
+ end-l
956
+ end-c
957
+ value)))))
958
+
946
959
947
960
(defun haskell-utils-insert-type-signature (signature )
948
961
" Insert type signature.
You can’t perform that action at this time.
0 commit comments