Skip to content

wiki code for pre-selecting nearest heading erroring out vertico--exhibit wrong-type-argument #891

Answered by cpbotha
cpbotha asked this question in Q&A
Discussion options

You must be logged in to vote

Ok here's a nice new variation which maintains your selected heading even as you change the filter string.

It's largely the same as what's on the wiki, plus the org-marker fix, and it keeps track of the current input so that it can determine whether the user is filtering (changing the input string), in which case they want to stay close to their pre-selected heading, or moving around, in which case we want to let them.

  (defvar consult--previous-point nil
    "Location of point before entering minibuffer.
Used to preselect nearest headings and imenu items.")

  (defvar vertico--previous-input nil
    "Previous vertico input so we can distinguish whether user is changing input string.")

  (

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@stefanv
Comment options

@NightMachinery
Comment options

@NightMachinery
Comment options

@cpbotha
Comment options

Answer selected by minad
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #890 on November 15, 2023 07:43.