Skip to content

Commit 4d84080

Browse files
committed
persistent history: :move-to-top
1 parent 441b1ff commit 4d84080

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

content/en/usage/configuration.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,20 @@ This is how you can add data to your history file. We use
346346
`lem/common/history:add-history hitsory input :allow-duplicates nil`
347347
followed by `save-file history`.
348348

349+
The `add-history` function also has the `:move-to-top` key parameter:
350+
if T, it moves the input on top of the stack if it already exists.
351+
352+
```lisp
353+
;; lem/common/history.lisp
354+
add-history (history input &key (allow-duplicates t) (test #'equal) move-to-top)
355+
"Add this INPUT to the HISTORY.
356+
357+
Doesn't add the same INPUT as the previous one.
358+
If ALLOW-DUPLICATES is non T, don't add duplicates at all.
359+
If LIMIT is set, overwrite oldest entry when reached.
360+
If MOVE-TO-TOP is T, move the entry to the top of the stack if it already exists."
361+
```
362+
349363
```lisp
350364
(defun remember-project (input)
351365
"Add this project path to the history file."

0 commit comments

Comments
 (0)