Skip to content

Commit

Permalink
Add jupyter-repl-clear-input command
Browse files Browse the repository at this point in the history
* jupyter-repl.el (jupyter-repl-clear-input): The new command.
(jupyter-repl-mode-map): Add a binding for it.

closes #512
  • Loading branch information
nnicandro committed Dec 4, 2023
1 parent 42626c8 commit da306a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jupyter-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,14 @@ lines, truncate it to something less than
(jupyter-repl-insert-prompt 'in))))
(goto-char (point-max)))

(defun jupyter-repl-clear-input ()
"Clear the contents of the input cell."
(interactive)
(goto-char (point-max))
(delete-region
(jupyter-repl-cell-code-beginning-position)
(point-max)))

;;; Handlers

(defun jupyter-repl-history-add (code)
Expand Down Expand Up @@ -1649,6 +1657,7 @@ Return the buffer switched to."
(define-key map (kbd "M-n") #'jupyter-repl-history-next)
(define-key map (kbd "M-p") #'jupyter-repl-history-previous)
(define-key map (kbd "C-c C-o") #'jupyter-repl-clear-cells)
(define-key map (kbd "C-c C-u") #'jupyter-repl-clear-input)
(define-key map (kbd "C-c M-r") #'jupyter-repl-history-previous-matching)
(define-key map (kbd "C-c M-s") #'jupyter-repl-history-next-matching)
map))
Expand Down

0 comments on commit da306a6

Please sign in to comment.