Skip to content

Commit

Permalink
Use remq instead of delq in `selectrum-prescient-create-and-bind-…
Browse files Browse the repository at this point in the history
…toggle-command`. (#124)

Even though we use `make-local-variable` to ensure that
`prescient-filter-method` is buffer-local in the minibuffer, it seems
that `delq` might still modify `prescient-filter-method` as a global
variable.  It was assumed that destructive functions would only modify
the buffer-local value, but that is apparently not the case.

See also issue #123 and PR #124.

Co-authored-by: okamsn <[email protected]>
  • Loading branch information
okamsn and okamsn authored Sep 3, 2022
1 parent 07d61b7 commit 412410b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog].

## Unreleased
### Bugs fixed
* Toggling off filter methods no longer accidentally changes the
global value of `prescient-filter-method`. See [#123], [#124].

[#123]: https://github.com/radian-software/prescient.el/issues/123
[#124]: https://github.com/radian-software/prescient.el/pull/124

## 5.2.1 (released 2022-06-01)
### Bugs fixed
* ivy doesn't convert all variables to string when sorting or calling
Expand Down
5 changes: 4 additions & 1 deletion selectrum-prescient.el
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ buffer. It does not affect the default behavior (determined by

(setq prescient-filter-method
(if (memq ',filter-type prescient-filter-method)
(delq ',filter-type prescient-filter-method)
;; Even when running `make-local-variable',
;; it seems `delq' might still modify the
;; global value, so we use `remq' here.
(remq ',filter-type prescient-filter-method)
(cons ',filter-type prescient-filter-method)))))

;; After changing `prescient-filter-method', tell the user
Expand Down

0 comments on commit 412410b

Please sign in to comment.