Pass keyword option to ein:kernel-execute

This commit is contained in:
Takafumi Arakaki 2012-11-03 22:11:19 +01:00
parent aaf535d01b
commit 5a0605f586

View file

@ -56,10 +56,12 @@
;;; Cell related ;;; Cell related
(defmethod ein:cell-execute ((cell ein:shared-output-cell) kernel code (defmethod ein:cell-execute ((cell ein:shared-output-cell) kernel code
&optional popup) &optional popup &rest args)
(unless (plist-get args :silent)
(setq args (plist-put args :silent nil)))
(oset cell :popup popup) (oset cell :popup popup)
(oset cell :kernel kernel) (oset cell :kernel kernel)
(ein:cell-execute-internal cell kernel code :silent nil)) (apply #'ein:cell-execute-internal cell kernel code args))
(defmethod ein:cell--handle-output ((cell ein:shared-output-cell) (defmethod ein:cell--handle-output ((cell ein:shared-output-cell)
msg-type content -metadata-not-used-) msg-type content -metadata-not-used-)
@ -167,12 +169,16 @@ See also `ein:cell-max-num-outputs'."
"History of the `ein:shared-output-eval-string' prompt.") "History of the `ein:shared-output-eval-string' prompt.")
;;;###autoload ;;;###autoload
(defun ein:shared-output-eval-string (code &optional popup verbose kernel) (defun ein:shared-output-eval-string (code &optional popup verbose kernel
"Evaluate a code. Prompt will appear asking the code to run. &rest args)
"Evaluate a piece of code. Prompt will appear asking the code to run.
This is handy when you want to execute something quickly without This is handy when you want to execute something quickly without
making a cell. If the code outputs something, it will go to the making a cell. If the code outputs something, it will go to the
shared output buffer. You can open the buffer by the command shared output buffer. You can open the buffer by the command
`ein:shared-output-pop-to-buffer'." `ein:shared-output-pop-to-buffer'.
.. ARGS is passed to `ein:kernel-execute'. Unlike `ein:kernel-execute',
`:silent' is `nil' by default."
(interactive (interactive
(let ((kernel (ein:get-kernel-or-error)) (let ((kernel (ein:get-kernel-or-error))
;; ... so error will be raised before user typing code if it ;; ... so error will be raised before user typing code if it
@ -182,7 +188,7 @@ shared output buffer. You can open the buffer by the command
(list code nil t kernel))) (list code nil t kernel)))
(unless kernel (setq kernel (ein:get-kernel-or-error))) (unless kernel (setq kernel (ein:get-kernel-or-error)))
(let ((cell (ein:shared-output-get-cell))) (let ((cell (ein:shared-output-get-cell)))
(ein:cell-execute cell kernel (ein:trim-indent code) popup)) (apply #'ein:cell-execute cell kernel (ein:trim-indent code) popup args))
(when verbose (when verbose
(ein:log 'info "Code \"%s\" is sent to the kernel." code))) (ein:log 'info "Code \"%s\" is sent to the kernel." code)))