Skip to content

Commit 47608c1

Browse files
committed
Add a command to delete history item at point
1 parent f84d279 commit 47608c1

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master (unreleased)
44

5+
### New features
6+
7+
- CIDER [History](https://docs.cider.mx/cider/repl/history.html): Add a command to delete history item at point.
8+
59
### Changes
610

711
- CIDER [History](https://docs.cider.mx/cider/repl/history.html): store history on a per-project basis. `cider-repl-history-file` is not longer customizable.

cider-repl-history.el

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,16 @@ text from the *cider-repl-history* buffer."
576576
(with-current-buffer cider-repl-history-repl-buffer
577577
(undo)))
578578

579+
(defun cider-repl-history-delete ()
580+
"Delete history item (at point)."
581+
(interactive)
582+
(let* ((orig (point))
583+
(str (cider-repl-history-current-string orig)))
584+
(with-current-buffer cider-repl-history-repl-buffer
585+
(delete str cider-repl-input-history))
586+
(cider-repl-history-update)
587+
(goto-char orig)))
588+
579589
(defun cider-repl-history-setup (repl-win repl-buf history-buf &optional regexp)
580590
"Setup.
581591
REPL-WIN and REPL-BUF are where to insert commands;
@@ -694,6 +704,7 @@ HISTORY-BUF is the history, and optional arg REGEXP is a filter."
694704
(define-key map (kbd "g") #'cider-repl-history-update)
695705
(define-key map (kbd "q") #'cider-repl-history-quit)
696706
(define-key map (kbd "U") #'cider-repl-history-undo-other-window)
707+
(define-key map (kbd "D") #'cider-repl-history-delete)
697708
(define-key map (kbd "?") #'describe-mode)
698709
(define-key map (kbd "h") #'describe-mode)
699710
map))

doc/modules/ROOT/pages/repl/history.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,7 @@ There are a number of important keybindings in history buffers.
175175

176176
| kbd:[U]
177177
| Undo in the REPL buffer.
178+
179+
| kbd:[D]
180+
| Delete history item (at point).
178181
|===

0 commit comments

Comments
 (0)