emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH 2/2] babel: don’t add babel eval to the session’s comint input ring
@ 2013-10-28 22:58 Aaron Ecay
  2013-10-30  1:20 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Ecay @ 2013-10-28 22:58 UTC (permalink / raw)
  To: emacs-orgmode

* lisp/ob-comint.el (org-babel-comint-in-buffer): don’t add to
comint-input-ring

Previously, babel code would be added to the comint input ring of a
babel session, making interactive use of the session difficult: one
had to page through the babel generated commands when browsing the
comint history with M-p/M-n.  The session repl’s history should just
contain commands the user has specifically entered in the repl buffer,
and not those which are fed in from org mode.  So, we bind
‘comint-input-filter’ to a function that always returns nil in the
‘org-babel-comint-in-buffer’ macro, to avoid any additions to the
input ring while executing code from babel.
---
 lisp/ob-comint.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
index 4e2b352..1f28a2c 100644
--- a/lisp/ob-comint.el
+++ b/lisp/ob-comint.el
@@ -53,7 +53,8 @@ executed inside the protection of `save-excursion' and
        (error "Buffer %s does not exist or has no process" ,buffer))
      (save-match-data
        (with-current-buffer ,buffer
-	 ,@body))))
+	 (let ((comint-input-filter (lambda (input) nil)))
+	   ,@body)))))
 (def-edebug-spec org-babel-comint-in-buffer (form body))
 
 (defmacro org-babel-comint-with-output (meta &rest body)
-- 
1.8.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] babel: don’t add babel eval to the session’s comint input ring
  2013-10-28 22:58 [PATCH 2/2] babel: don’t add babel eval to the session’s comint input ring Aaron Ecay
@ 2013-10-30  1:20 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2013-10-30  1:20 UTC (permalink / raw)
  To: Aaron Ecay; +Cc: emacs-orgmode

Very nice.  Thank you for this patch.  Applied.

Aaron Ecay <aaronecay@gmail.com> writes:

> * lisp/ob-comint.el (org-babel-comint-in-buffer): don’t add to
> comint-input-ring
>
> Previously, babel code would be added to the comint input ring of a
> babel session, making interactive use of the session difficult: one
> had to page through the babel generated commands when browsing the
> comint history with M-p/M-n.  The session repl’s history should just
> contain commands the user has specifically entered in the repl buffer,
> and not those which are fed in from org mode.  So, we bind
> ‘comint-input-filter’ to a function that always returns nil in the
> ‘org-babel-comint-in-buffer’ macro, to avoid any additions to the
> input ring while executing code from babel.
> ---
>  lisp/ob-comint.el | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el
> index 4e2b352..1f28a2c 100644
> --- a/lisp/ob-comint.el
> +++ b/lisp/ob-comint.el
> @@ -53,7 +53,8 @@ executed inside the protection of `save-excursion' and
>         (error "Buffer %s does not exist or has no process" ,buffer))
>       (save-match-data
>         (with-current-buffer ,buffer
> -	 ,@body))))
> +	 (let ((comint-input-filter (lambda (input) nil)))
> +	   ,@body)))))
>  (def-edebug-spec org-babel-comint-in-buffer (form body))
>  
>  (defmacro org-babel-comint-with-output (meta &rest body)

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-30  1:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28 22:58 [PATCH 2/2] babel: don’t add babel eval to the session’s comint input ring Aaron Ecay
2013-10-30  1:20 ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).