-
Notifications
You must be signed in to change notification settings - Fork 14
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
Target buffer selection #52
base: master
Are you sure you want to change the base?
Conversation
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.
Came across a few typos in docstrings
biblio-core.el
Outdated
@@ -71,6 +72,13 @@ This variable is local to each search results buffer.") | |||
:group 'biblio-core | |||
:type 'integer) | |||
|
|||
(defcustom biblio-target-buffer-functions (list #'biblio-target-buffer-default) | |||
"Select the target buffer for a bibliographci search. |
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.
Typo: bibliographci
-> bibliographic
biblio-core.el
Outdated
(defcustom biblio-target-buffer-functions (list #'biblio-target-buffer-default) | ||
"Select the target buffer for a bibliographci search. | ||
Each function should take no arguments and return either nil or a buffer. | ||
The first non-nill resukt is set as the target buffer." |
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.
Typo: resukt
-> result
This looks really useful! :) As I discussed in #54, I think it'd be nice to support the use case where the user (or a calling library) can just specify precisely what buffer should be used. I think you could accomplish this by
|
Assuming we can get this integrated, I think this would set the stage for a nice enhancement in |
Thanks I fixed these. |
This seems like a good idea to me so I implemented it but directly. |
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.
Added a few design suggestions and found one more typo
(defcustom biblio-target-buffer-functions (list #'biblio-target-buffer-default) | ||
"Select the target buffer for a bibliographic search. | ||
Each function should take no arguments and return either nil or a buffer. | ||
The first non-nill result is set as the target buffer." |
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.
Typo: nill to nil
(directory-name-p file))))))) | ||
(if (equal "bib" (file-name-extension filename)) | ||
filename | ||
(user-error "Choosen file %s is not a bib file" filename)))) |
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.
If the user wants to insert into a file that doesn't end in .bib (either because they are using a different extension or because they want to insert directly into say a .tex or .org file) is there a way they can work around this?
"Just like `biblio-lookup' on BACKEND and QUERY, but never prompt." | ||
(let ((results-buffer (biblio--make-results-buffer (current-buffer) query backend))) | ||
(defun biblio--lookup-1 (backend query target) | ||
"Just like `biblio-lookup' on BACKEND, QUERY and TARGET, but never prompt." |
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.
I know that technically biblio--lookup-1
is, by convention, a private function, but any code that currently calls it with two arguments will now behave oddly: it will pass nil
as target
to biblio--make-results-buffer
which is different than the previous behavior (which would pass (current-buffer)
.
I think it would make more sense to move the (unless target (setq target...
) logic from where it currently is in biblio-lookup
and put it here instead.
`biblio-backends'. Returns the buffer in which results will be | ||
inserted." | ||
`biblio-backends'. TARGET is the buffer into which bibliographic | ||
entries will be inserted. Returns the buffer in which results |
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 might be nice to add something to the doc string about what happens if target
is nil, i.e., refer to biblio-target-buffer-functions
to control the behavior of how target
is chosen when passed as nil
.
Makes the default choice target buffer sensitive to the major-mode of the buffer from which the search was started.
Also changes the behavior of
biblio--selection-change-buffer
. Now it only offers buffers with major mode derived from frombibtex-mode
. This usesdirectory-name-p
with requires emacs 25.1 but can be avoided.