Skip to content

Commit f009efe

Browse files
Zzullbbatsov
authored andcommitted
Add a command to delete history item at point
1 parent 62bc590 commit f009efe

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

CHANGELOG.md

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

33
## master (unreleased)
44

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

710
- [#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.

cider-repl-history.el

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

578+
(defun cider-repl-history-delete-entry-at-point ()
579+
"Delete history entry (at point)."
580+
(interactive)
581+
(let* ((orig (point))
582+
(str (cider-repl-history-current-string orig)))
583+
(with-current-buffer cider-repl-history-repl-buffer
584+
(delete str cider-repl-input-history))
585+
(cider-repl-history-update)
586+
(goto-char orig)))
587+
578588
(defun cider-repl-history-setup (repl-win repl-buf history-buf &optional regexp)
579589
"Setup.
580590
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."
693703
(define-key map (kbd "g") #'cider-repl-history-update)
694704
(define-key map (kbd "q") #'cider-repl-history-quit)
695705
(define-key map (kbd "U") #'cider-repl-history-undo-other-window)
706+
(define-key map (kbd "D") #'cider-repl-history-delete-entry-at-point)
696707
(define-key map (kbd "?") #'describe-mode)
697708
(define-key map (kbd "h") #'describe-mode)
698709
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)