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
[WIP] A customization mechanism for ivy-height #1531
Conversation
* ivy-height-alist: new variable. counsel.el: * (counsel-el, counsel--generic, counsel-git-log): make height customizable. * (counsel-yank-pop-height, counsel-evil-registers-height): kill now useless variable. * (counsel-yank-pop, counsel-evil-registers): adapt to ivy-height-alist.
:predicate pred | ||
:initial-input str | ||
:action #'ivy-completion-in-region-action))) | ||
|
||
(add-to-list 'ivy-height-alist '(counsel-el . 7)) |
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.
The docstring of add-to-list
says
This is handy to add some elements to configuration variables,
but please do not abuse it in Elisp code, where you are usually
better off using ‘push’ or ‘cl-pushnew’.
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.
it's precisely configuration stuff.
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.
@mookid While you're not wrong, and it shouldn't make a difference here, "configuration" generally refers to user customisations, i.e. init file code. In particular, add-to-list
can misbehave under lexical scope/extent.
counsel.el
Outdated
@@ -3207,11 +3212,6 @@ A is the left hand side, B the right hand side." | |||
:group 'ivy | |||
:type 'string) | |||
|
|||
(defcustom counsel-yank-pop-height 5 |
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.
Probably best to mark this as obsolete and point to ivy-height-alist
instead via make-obsolete-variable
. Ditto for other removed user options.
ivy.el
Outdated
"Number of lines for the minibuffer window." | ||
"Number of lines for the minibuffer window. | ||
Also see `ivy-height-alist'." |
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.
"See also" seems to be more common than "Also see", FWIW.
ivy.el
Outdated
(defcustom ivy-height-alist nil | ||
"An alist to customize `ivy-height'. | ||
It is a list of (CALLER . HEIGHT). CALLER is either a caller of |
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.
is either a caller of
ivy-read
Should "either" be removed from the sentence? If not, what is the alternative value?
ivy.el
Outdated
(assq t ivy-display-functions-alist)))))) | ||
(height | ||
(if caller | ||
(let ((try-assoc (assoc caller ivy-height-alist))) |
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.
How about the name "entry" instead of "try-assoc"?
Nice work, I've merged the current changes. And now I see in the comments that you planned to make more changes:) Feel free to do them in a new PR. |
fix #1527
Summary of changes:
ivy.el:
counsel.el:
(counsel-yank-pop-height, counsel-evil-registers-height): kill now useless variable.Discussion
It's always quite nice to get rid of magic numbers.Should we get rid of the customization variables? (probably not, this is just proof of concept).TODO
make-obsolete-variable
calls