New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prompt buffer (minibuffer overhaul) #1157
Conversation
I've just pushed support for async initial suggestions. This is great since this means that the prompt buffer will always pop up instantaneously even when sources take a while to display their initial suggestions. No more hangs! |
You can now resume prompts! Try it out with the |
Prompt buffer history is in, try it out with Search is also tested and working: see |
@jmercouris: Last commit should be good to do! There are a few nits to fix here You can start converting all the minibuffers to prompt-buffer! :) Before getting started, have a look at the commits from last week until today |
@@ -46,7 +46,7 @@ Suitable as a `source' `suggestion-property-function'." | |||
(t (list :default (write-to-string object))))) | |||
|
|||
(define-class suggestion () | |||
((value nil | |||
((value nil ; TODO: Rename `data' as with the GHT? Maybe confusing since we have `match-data'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I would also prefer data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So any better naming suggestion for match-data
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matching-data?
I mean it's the "data" part that I don't like.
Plus the name is misleading, since we would expect that "match-data"
would contain what's matched, while really it's arbitrary data.
|
Shall we have the |
Yes, it should accept either a list, or a single source, that would simplify a lot of code. |
Done.
|
Do we want the :prompt argument to prompt to automatically append a colon if it is not present? E.g.
AND
would be both acceptable? |
John Mercouris <notifications@github.com> writes:
```
(prompt
:prompt "Ropen buffer(s):"
:sources (list (make-instance 'recent-buffer-source)))
```
AND
```
(prompt
:prompt "Ropen buffer(s)"
:sources (list (make-instance 'recent-buffer-source)))
```
Why not, the only pitfall is if a prompt specifically needs `::`, then
we would not be able to write it... Unless we suffix the string with
`::`. So yeah, I don't see any problem with that!
|
Any particular reason why you merged master? Can we revert this change and, if need be, rebase against master instead? |
I merged master because I didn't want to rebase on you in case you were doing something. Sorry if that made things confusing! Why I merged master: I wanted to update password.lisp and didn't want to work with the old-code! |
How can I I'm trying to replace calls like this:
|
Not sure how to undo my merge. I tried to revert the merge commit, and then it gives me a prompt "Replay merges relative to parent?". Apparently this is expecting some sort of integer... |
I think I've got it figured out. |
dc309cd
to
f6eb454
Compare
Here is what I ended up doing:
please let me know if you see anything problematic with this approach. |
To undo the merge, it's easier to
You are right that you should not rebase a public branch. But if you let me know in advance and I confirm, then you can go ahead. |
Aha you pretty much just wrote exactly what I did :-D |
John Mercouris <notifications@github.com> writes:
How can I `(prompt ...)` without any sources just to collect raw input from the user? Is this possible?
I'm trying to replace calls like this:
```
(prompt-minibuffer
:input-prompt argument)
```
Have a look at set-url2, it has a New URL source.
I think we should have a prompter:query-input-source just like we have a
prompter:yes-or-no-source, since this is probably going to be a common
use case.
Thoughts?
|
That's more or less what I ended up doing for now. I guess we could call it "raw-input-source" or something. |
I don't understand why using prompt in |
I'll have a look a bit later.
|
Remove comment on printing the counts since this is already done.
0831350
to
85aae31
Compare
Ready to merge :-) |
BUFFER arg was just introduced to allow for using (url buffer), while we just had to use the URL argument.
Just pushed a "fix fix", I'll have a final review tomorrow and merge!
|
Merged! There are important issues before we can release a new pre-release though. I'll open a new issue about it. |
See #1212. |
This is a rebase of #1054.
Left to be done:
Backport
test-fuzzy.lisp
to make sure we have at least the same matchingquality as master.
Tune paging. Have C-p recenter on suggestion?
See if we can keep
2eeafba ("prompt-buffer.lisp: remove
element-in-view-port code"), or else revert it.
(Optional) make-source should return a lambda that creates
minibuffer-source objects. Indeed, we don't want global, non-thread-safe
minibuffer-source object. The source object should be instantiated with the
minibuffer.
On second though, do we really need a macro to create top-level sources? What
about just using define-class? For instance
I'm thinking of renaming
initializer
andcleanup
toconstructor
anddestructor
respectively. This would be consistent with modes.(It's done now.)
While we are at it, we can make methods for them as suggested in Make mode constructors/destructors composable #1005. We
could still keep the slots which would allow for instance-specific overrides.
Have
prompt-buffer
inherit fromprompter
instead of having aprompter
slot. This would make the Nyxt side of things way less verbose, itwill also be easier for the end user to invoke the prompt buffer.
Rename the
prompter:prompter-source
class toprompter:source
.Contextual help display and discoverable bindings.
C-h b
should display the bindings in a help buffer.Add an action which opens a nested prompt buffer with all the key
bindings. Pressing
return
executes the bound command in the parentprompt buffer.
Should we have
C-h m
to explain how the prompt buffer works?VI bindings
Resume previous prompt-buffers.
Extend support for input history.
set-url2
has it, add support for all commands.Highlight portion of matching text.
Implement
search-buffer2
command usingprompt-buffer
.[-] Restore multi-buffer search leveraging the new multiple source feature.
Make meta command which allows for selecting sources, then drop into new
prompt buffer with given sources.
Performance:
set-url2
takes a while to show up when the history is big.switch-buffer2
loses the prompt focus when "following" the selection.Cosmetic: The top of the prompt input is swallowed.
Cosmetic: Option to not display the column names / . For instance in "New
URL" source.
Add
with-prompt
helper to avoid having to(when result ...)
after eachprompt.
We could even support chained prompts, like
sera:and-let*
.Echo message when no source has any suggestion (nor do they allow for raw
user input) instead of showing a useless prompt-buffer.
Add action to sort by column.
Would be great if we had mouse support, i.e. click on the column name to
sort by this column in ascending / descending order.
Add column filters.
This one is tricky, because we want to make it both flexible and
explorable.
We could add actions, but it can be a bit tedious to go through multiple
menus just to filter, say, by today's date or the +foo tag.
One option would be that the action actually inserts a special syntax in
the prompt which does the filtering.
This special syntax could be started from
(
.Example:
Could also be cool to enable column and predicate completion.
When implemented, remove
tags.lisp
.Shouldn't we avoid to play with
suggestion
object from the Nyxt side?Then we should not have
current-suggestion
,marked-suggestions
, etc.Instead we should have functions that return the values.
Make sure actions support both a single selection and
marked-suggestions when
multi-selection-p
is T.Remove
object-string
,object-display
if we don't need it anymore?Then remove
object-display.lisp
.What about tab-insert?
Remove
fuzzy.lisp
when done.Remove
must-match-p
.Use
yes-no-source
inif-confirm
.Suggestion properties should be an alist, so that properties can have
arbitrary names and casing.
I suggest un-dotted alists since they are shorter, more readable, more
beginner-friendly.
Rename
properties
toattributes
to avoid confusion with symbolproperties and "property lists" (
plist
).Don't expose
suggestion-maker
, revert tosuggestion-filter-funtion
andrename it
attribute-function
.Support multiple persistent actions, and add action to choose which one to
enable.
See also Multiple persistent actions emacs-helm/helm#1926.
3 types of functions can be run from the prompt buffer:
Can we conflate these into just 2 types, e.g. should all commands be actions?
If so, we need to away to set a bunch of default actions with their keymap.
Inheritance? Store actions in
prompter
?But isn't the job of the
prompt-buffer-mode
to deal with keymaps? It wouldbe more consistent for the user.
We can list actions and the previous point will allow us to list persistent
commands.
We need a way to list commands.
C-h b
mentioned above?Add command to list all functions? Multi-source?
Style: Refactor
update-suggestion-html
and a few other functions inprompt-buffer.lisp
.