branch: elpa/cider
commit f009efed1aa2a8fdbb0246925811c02f9cb02e33
Author: Baptiste Strazzulla <baptiste.strazzu...@protonmail.com>
Commit: Bozhidar Batsov <bozhi...@batsov.dev>

    Add a command to delete history item at point
---
 CHANGELOG.md                             |  3 +++
 cider-repl-history.el                    | 11 +++++++++++
 doc/modules/ROOT/pages/repl/history.adoc |  3 +++
 3 files changed, 17 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4faa571e0d..6838c3737d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,9 @@
 
 ## master (unreleased)
 
+### New features
+- CIDER [History](https://docs.cider.mx/cider/repl/history.html): Add a 
command to delete history item at point.
+
 ### Changes
 
 - [#3574](https://github.com/clojure-emacs/cider/issues/3574): New value 
`per-project` for `cider-repl-history-file` to save the history on a 
per-project basis.
diff --git a/cider-repl-history.el b/cider-repl-history.el
index e7b08cd35e..c205b65027 100644
--- a/cider-repl-history.el
+++ b/cider-repl-history.el
@@ -575,6 +575,16 @@ text from the *cider-repl-history* buffer."
   (with-current-buffer cider-repl-history-repl-buffer
     (undo)))
 
+(defun cider-repl-history-delete-entry-at-point ()
+  "Delete history entry (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;
@@ -693,6 +703,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-entry-at-point)
     (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 7e095ee439..88a34a1a22 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).
 |===

Reply via email to