diff options
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-connection.el | 3 | ||||
-rw-r--r-- | elisp/geiser-debug.el | 16 | ||||
-rw-r--r-- | elisp/geiser-syntax.el | 38 |
3 files changed, 31 insertions, 26 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index 702f3b6..33579f6 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -204,7 +204,8 @@ (geiser-con--connection-clean-current-request geiser-con--connection))))) (defadvice comint-redirect-setup - (after geiser-con--advice (output-buffer comint-buffer finished-regexp &optional echo)) + (after geiser-con--advice + (output-buffer comint-buffer finished-regexp &optional echo)) (with-current-buffer comint-buffer (when geiser-con--connection (setq mode-line-process nil)))) (ad-activate 'comint-redirect-setup) diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el index bc155c9..7ebd0b5 100644 --- a/elisp/geiser-debug.el +++ b/elisp/geiser-debug.el @@ -72,14 +72,9 @@ (defsubst geiser-debug--frame-source-column (src) (or (caddr src) 0)) (defun geiser-debug--display-stack (stack) - (let* ((frames (cdr stack)) - (step 2) - (indent (* (length frames) step))) - (dolist (f frames) - (geiser-debug--display-stack-frame f indent) - (setq indent (- indent step))))) - -(defun geiser-debug--display-stack-frame (frame offset) + (mapc 'geiser-debug--display-stack-frame (reverse (cdr stack)))) + +(defun geiser-debug--display-stack-frame (frame) (let ((procedure (geiser-debug--frame-proc frame)) (source (geiser-debug--frame-source frame)) (description (geiser-debug--frame-desc frame))) @@ -89,7 +84,7 @@ (geiser-debug--frame-source-line source) (1+ (geiser-debug--frame-source-column source)))) (insert "In expression:\n")) - (insert (format "%s%s\n" (make-string offset ?\ ) description)))) + (insert (format "%s\n" description)))) (defsubst geiser-debug--wrap-region (str) (format "(begin %s)" str)) @@ -112,7 +107,8 @@ (defun geiser-debug--expand-region (start end all wrap) (let* ((str (buffer-substring-no-properties start end)) (wrapped (if wrap (geiser-debug--wrap-region str) str)) - (code `(:eval ((:ge macroexpand) (quote (:scm ,wrapped)) ,(if all :t :f)))) + (code `(:eval ((:ge macroexpand) (quote (:scm ,wrapped)) + ,(if all :t :f)))) (ret (geiser-eval--send/wait code)) (err (geiser-eval--retort-error ret)) (result (geiser-eval--retort-result ret))) diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index 472a4e5..14d996c 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -85,20 +85,27 @@ (geiser-popup--define syntax " *geiser syntax analyst*" scheme-mode) (defun geiser-syntax--prepare-scheme-for-elisp-reader () - (goto-char (point-min)) - (while (re-search-forward "#\<\\([^>]*?\\)\>" nil t) - (let ((from (match-beginning 1)) - (to (match-end 1))) - (goto-char from) - (while (re-search-forward "\\([() ;'`]\\)" to t) - (replace-match "\\\\\\1")) - (goto-char to))) - (goto-char (point-min)) - (while (re-search-forward "#(" nil t) (replace-match "(vector ")) - (goto-char (point-min)) - (while (re-search-forward "#" nil t) (replace-match "\\\\#")) - (goto-char (point-min)) - (skip-syntax-forward "^(")) + (let ((end (save-excursion + (goto-char (point-max)) + (and (re-search-backward "(output \\. \"" nil t) + (point))))) + (goto-char (point-min)) + (while (re-search-forward "#\<\\([^>]*?\\)\>" end t) + (let ((from (match-beginning 1)) + (to (match-end 1))) + (goto-char from) + (while (re-search-forward "\\([ ;'`]\\)" to t) + (replace-match "\\\\\\1")) + (goto-char from) + (while (re-search-forward "[()]" to t) + (replace-match "")) + (goto-char to))) + (goto-char (point-min)) + (while (re-search-forward "#(" end t) (replace-match "(vector ")) + (goto-char (point-min)) + (while (re-search-forward "#" end t) (replace-match "\\\\#")) + (goto-char (point-min)) + (skip-syntax-forward "^("))) (defsubst geiser-syntax--del-sexp (arg) (let ((p (point))) @@ -121,7 +128,8 @@ (when p ;; inside a comment or string (delete-region p (point-max)) (insert geiser-syntax--placeholder))) - (when (cond ((eq (char-after (1- (point))) ?\)) (geiser-syntax--del-sexp -1) t) + (when (cond ((eq (char-after (1- (point))) ?\)) + (geiser-syntax--del-sexp -1) t) ((geiser-syntax--beginning-of-form) (delete-region (point) (point-max)) t) ((memq (char-after (1- (point))) (list ?. ?@ ?, ?\' ?\` ?\# ?\\)) |