From 39e85dc85a4ba364302fee9319dbf50cb61e9ba7 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 30 Jul 2012 17:29:32 -0600 Subject: [PATCH] let* instead of flet so function name may be used * lisp/ob-comint.el (org-babel-comint-with-output): Use let* instead of flet so function name may be used in a hook. --- lisp/ob-comint.el | 68 +++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index f7403dc..8a7dbc8 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -74,40 +74,40 @@ or user `keyboard-quit' during execution of body." (remove-echo (cadr (cdr meta))) (full-body (cadr (cdr (cdr meta))))) `(org-babel-comint-in-buffer ,buffer - (let ((string-buffer "") dangling-text raw) - (org-flet ((my-filt (text) - (setq string-buffer (concat string-buffer text)))) - ;; setup filter - (add-hook 'comint-output-filter-functions 'my-filt) - (unwind-protect - (progn - ;; got located, and save dangling text - (goto-char (process-mark (get-buffer-process (current-buffer)))) - (let ((start (point)) - (end (point-max))) - (setq dangling-text (buffer-substring start end)) - (delete-region start end)) - ;; pass FULL-BODY to process - ,@body - ;; wait for end-of-evaluation indicator - (while (progn - (goto-char comint-last-input-end) - (not (save-excursion - (and (re-search-forward - (regexp-quote ,eoe-indicator) nil t) - (re-search-forward - comint-prompt-regexp nil t))))) - (accept-process-output (get-buffer-process (current-buffer))) - ;; thought the following this would allow async - ;; background running, but I was wrong... - ;; (run-with-timer .5 .5 'accept-process-output - ;; (get-buffer-process (current-buffer))) - ) - ;; replace cut dangling text - (goto-char (process-mark (get-buffer-process (current-buffer)))) - (insert dangling-text)) - ;; remove filter - (remove-hook 'comint-output-filter-functions 'my-filt))) + (let* ((string-buffer "") + (my-filt (lambda (text) (setq string-buffer (concat string-buffer text)))) + dangling-text raw) + ;; setup filter + (add-hook 'comint-output-filter-functions 'my-filt) + (unwind-protect + (progn + ;; got located, and save dangling text + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (let ((start (point)) + (end (point-max))) + (setq dangling-text (buffer-substring start end)) + (delete-region start end)) + ;; pass FULL-BODY to process + ,@body + ;; wait for end-of-evaluation indicator + (while (progn + (goto-char comint-last-input-end) + (not (save-excursion + (and (re-search-forward + (regexp-quote ,eoe-indicator) nil t) + (re-search-forward + comint-prompt-regexp nil t))))) + (accept-process-output (get-buffer-process (current-buffer))) + ;; thought the following this would allow async + ;; background running, but I was wrong... + ;; (run-with-timer .5 .5 'accept-process-output + ;; (get-buffer-process (current-buffer))) + ) + ;; replace cut dangling text + (goto-char (process-mark (get-buffer-process (current-buffer)))) + (insert dangling-text)) + ;; remove filter + (remove-hook 'comint-output-filter-functions 'my-filt)) ;; remove echo'd FULL-BODY from input (if (and ,remove-echo ,full-body (string-match -- 1.7.11.3