diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f6fd330..36e8d8768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### New features - CIDER [History](https://docs.cider.mx/cider/repl/history.html): if `cider-repl-history-file` is unset, the history is saved on a per-project basis. +- CIDER [History](https://docs.cider.mx/cider/repl/history.html): Add a command to delete history item at point. ### Changes diff --git a/cider-repl-history.el b/cider-repl-history.el index db167db7a..3e78116ca 100644 --- a/cider-repl-history.el +++ b/cider-repl-history.el @@ -577,6 +577,16 @@ text from the *cider-repl-history* buffer." (with-current-buffer cider-repl-history-repl-buffer (undo))) +(defun cider-repl-history-delete () + "Delete history item (at point)." + (interactive) + (let* ((orig (point)) + (str (cider-repl-history-current-string orig))) + (with-current-buffer cider-repl-history-repl-buffer + (delete str cider-repl-input-history)) + (cider-repl-history-update) + (goto-char orig))) + (defun cider-repl-history-setup (repl-win repl-buf history-buf &optional regexp) "Setup. REPL-WIN and REPL-BUF are where to insert commands; @@ -695,6 +705,7 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter." (define-key map (kbd "g") #'cider-repl-history-update) (define-key map (kbd "q") #'cider-repl-history-quit) (define-key map (kbd "U") #'cider-repl-history-undo-other-window) + (define-key map (kbd "D") #'cider-repl-history-delete) (define-key map (kbd "?") #'describe-mode) (define-key map (kbd "h") #'describe-mode) map)) diff --git a/doc/modules/ROOT/pages/repl/history.adoc b/doc/modules/ROOT/pages/repl/history.adoc index 7e095ee43..88a34a1a2 100644 --- a/doc/modules/ROOT/pages/repl/history.adoc +++ b/doc/modules/ROOT/pages/repl/history.adoc @@ -175,4 +175,7 @@ There are a number of important keybindings in history buffers. | kbd:[U] | Undo in the REPL buffer. + +| kbd:[D] +| Delete history item (at point). |===