-
Notifications
You must be signed in to change notification settings - Fork 54
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
feature(ui): add suffix #45
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f667d95
to
fd1267b
Compare
This comment has been minimized.
This comment has been minimized.
One of the nice side effects of using affixes is the target display string can be much more compact, which makes the current selectrum multi-select UI work better. |
bibtex-actions.el
Outdated
(add (s-trim-right (s-join " " (list pdf note link)))) | ||
; TODO: add separation between target and suffix | ||
(suffix (bibtex-completion-format-entry candidate (1- (frame-width)) | ||
bibtex-completion-display-formats-suffix))) |
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.
This and the template setq are the only pieces of code dependent on the bibtex-completion PR. Could comment out and add a fixed placeholder for now.
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.
This and the template setq are the only pieces of code dependent on the bibtex-completion PR. Could comment out and add a fixed placeholder for now.
Latest commit implements this. I'll wait a bit to see if Titus responds.
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 other alternative is to just add the two functions we need to do this ourselves, and then do this, so all of it is configurable. Can then remove or simplify if and when the other PR is accepted.
(defcustom bibtex-actions-display-templates
; prefix will only work with rich ui, and on Emacs 28
; 'target' is the default entry display string
'((prefix . '((t. "${=has-pdf=:1} ${=has-note=:1} ")))
; could just use bibtex-completion-display-formats here
(target . '((t . "${author:20} ${title:48} ${year:4}")))
(suffix . '((t. " ${=key=:15} ${=type=:12} ${tags:*}"))))
"Configures display formatting for 'target', 'prefix' and 'suffix'.
The latter two are optional, but are used in the 'rich ui'."
:group 'bibtex-actions
:type '(alist :key-type symbol :value-type function))
This reverts commit e646500.
Adapt the formatting logic from bibtex-completion to bibtex-actions, and make prefix, target and suffix all configurable, using the same code and config. Also, change 'bibtex-actions-icons' to 'bibtex-actions-symbols'.
OK, I changed the branch to not rely on the bibtex-completion PR. I'll take another look in the morning, and may merge it at that point. One thing: in bibtex-completion, the templates variables are updated in the init function. Here, I do it in a variable on the -format-entry function. Am not sure what relative pros and cons of each approach is. Certainly for this, it's easier as it's self-contained. |
Add suffix UI, using the same configuration method as for the main display formatting. Also add annotation-function, to provide the same UI pre-Emacs 28.. To enable this, I have adapted some code from bibtex-completion. I will remove that code, or greatly simplify it, if and when this PR is merged: tmalsburg/helm-bibtex#367 Also, change 'bibtex-actions-icons' to 'bibtex-actions-symbols'. Closes #44
Add suffix UI, using the same configuration method as for the main display formatting.
Also add annotation-function, to provide the same UI pre-Emacs 28..
To enable this, I have adapted some code from bibtex-completion. I will
that code, or greatly simplify it, if and when this PR is merged:
tmalsburg/helm-bibtex#367
Closes #44
Here's what it looks like now, with these two PRs, and configured to use
all-the-icons
: