From 995f11b8034855ef510e6fe24bc9b3735ac5072c Mon Sep 17 00:00:00 2001 From: Zzull Date: Tue, 7 Nov 2023 14:29:20 +0100 Subject: [PATCH] Add a command to delete history item at point --- CHANGELOG.md | 4 ++++ cider-repl-history.el | 10 ++++++++++ doc/modules/ROOT/pages/repl/history.adoc | 3 +++ 3 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72f2d9a2a..024ca19e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master (unreleased) +### New features + +- CIDER [History](https://docs.cider.mx/cider/repl/history.html): Add a command to delete history item at point. + ## 1.11.0 (2023-11-07) ### New features diff --git a/cider-repl-history.el b/cider-repl-history.el index 404f96e0a..4e96ecbe3 100644 --- a/cider-repl-history.el +++ b/cider-repl-history.el @@ -567,6 +567,15 @@ 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))) + (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; @@ -685,6 +694,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). |===