Skip to content

Commit

Permalink
Add a command to delete history item at point
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzull committed Nov 7, 2023
1 parent 142cf4d commit 995f11b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions cider-repl-history.el
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions doc/modules/ROOT/pages/repl/history.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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).
|===

0 comments on commit 995f11b

Please sign in to comment.