-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Make consult--find accept an "initial" argument? #144
Comments
Hi Prot, thank you for reporting this! This is an oversight of mine when the initial argument has been added to grep. Note that there is also the option to have fine-grained control over the arguments passed to Daniel |
I added an extra section for the |
Thanks for the quick fix!
That is promising!
I think it is of a high standard already, though I agree that it can always be improved (and I am still reading through the code base when I find time for it). The doc strings could benefit from some cross-references or more examples. Such as: consult.el | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/consult.el b/consult.el
index 54e9b16..94f1a9b 100644
--- a/consult.el
+++ b/consult.el
@@ -64,7 +64,10 @@
;;;###autoload
(define-minor-mode consult-preview-mode
- "Enable preview for consult commands."
+ "Enable preview for all (some?) consult commands.
+
+Preview can be disabled on a per-command basis by configuring
+`consult-config-alist'.
+
+(if 'some', then provide a list somewhere)"
:global t)
(defcustom consult-narrow-key nil
@@ -209,8 +212,18 @@ You may want to add a function which pulses the current line, e.g.,
"Number of files to keep open at once during preview."
:type 'integer)
-(defcustom consult-config nil
- "Command configuration alists."
+(define-obsolete-variable-alias
+ 'consult-config
+ 'consult-config-alist
+ "VERSION HERE")
+
+(defcustom consult-config-alist nil
+ "Alist of configurations for individual commands.
+
+Each list consists of a command's symbol and a plist, such
+as: (consult-theme :preview-key nil).
+
+Available plist entries can in found in WHERE?."
:type '(list (cons symbol plist)))
;;;; Faces P.S. |
Cross references are a good idea!
I am not sure about this naming convention - I think I've seen both ways and I am usually not a big fan of type information in names. But for lists it is quite common and maybe more readable here. The deprecation info you proposed is a good idea in general but for now I just break things, I will stop at some point when things have stabilized more. The consult-config feature has been introduced a few days ago, so I can just break it now. At some point I should probably tag a release and from that point on a stronger stability guarantee should hold. |
Regarding |
You are right. Don't do that.
|
|
Btw @protesilaos, I think I recall correctly that you are one of the people, who do not prefer to use automatic preview since it makes things jump around. Maybe this is interesting for you #143. |
Very well! Will pull the changes later and adapt things accordingly. |
Oh, I see! How about something like |
I am now trying this and it also works with my quick-and-dirty wrapper functions (those that preconfigure orderless): (setq consult-preview-key nil) ; see `consult-config' further below
(let ((key (kbd "C-v"))) ; "view" mnemonic
(setq consult-config `((consult-buffer :preview-key ,key)
(consult-line :preview-key ,key)
(prot-consult-line :preview-key ,key)))) Setting |
I would write it like this: (setq consult-config '((consult-buffer :preview-key "\C-v")
(consult-line :preview-key "\C-v")
(prot-consult-line :preview-key "\C-v")))) For C-v you can use a normal character, since it is an ASCII control key. This works also, and just enables the key for every command. Note that preview is generally very benign, no open files will be left behind etc. So you can enable if for everything. (setq consult-preview-key "\C-v") |
This is what I did wrong. I used |
Yes, I am not passing everything through kbd as of now. I expect the low-level format. Maybe I should change this. But consult is in the end just aligned with define-key. |
I see. No problem! I always forget when to prepend the backslash, so I use (define-key map (kbd "C-v") command) Though I normally just test the key with |
Hello Daniel! I just noticed that the argument list for
consult--find
differs from that ofconsult--grep
. Maybe there is some good reason for it. Do you think, however, that it would be possible to at least accept aninitial
arg? There are a few cases that are affected, but this prototype worked in my quick demo:The text was updated successfully, but these errors were encountered: