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 f84d279 commit 47608c1
Show file tree
Hide file tree
Showing 3 changed files with 18 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.

### Changes

- 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.
Expand Down
11 changes: 11 additions & 0 deletions cider-repl-history.el
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,16 @@ 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)))
(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;
Expand Down Expand Up @@ -694,6 +704,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 47608c1

Please sign in to comment.