From c5397312728e06b10a5d3ef20fb69308ff8baa6b Mon Sep 17 00:00:00 2001 From: Baptiste Strazzulla Date: Wed, 8 Nov 2023 00:53:23 +0100 Subject: [PATCH] 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 b5be5843b..3ccad05cd 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 - [#3754](https://github.com/clojure-emacs/cider/issues/3754): Fix regex in `cider-ns-from-p`. - [#3753](https://github.com/clojure-emacs/cider/pull/3753): Add `cider-log-show-frameworks` command to show available log frameworks in a buffer. diff --git a/cider-repl-history.el b/cider-repl-history.el index e7b08cd35..c205b6502 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 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). |===