You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the great package! I love how customizable it is.
Is your feature request related to a problem? Please describe.
This is a common use case for me, when I want to open a library file if it exists, and if not, open the link in browser.
In bibtex-completion, this is implemented in bibtex-completion-open-any.
Describe the solution you'd like
A proper way to achieve this would be if citar-open-* functions in general, and citar-open-files function in particular, return non-nil upon success, then the function would be very easy to write:
(defuncitar-open-files-or-links (citekey-or-citekeys)
"Open library file or URL or DOI link associated with CITEKEY-OR-CITEKEYS. Open library file associated with CITEKEY-OR-CITEKEYS. If no library file exists, open URL or DOI link associated with CITEKEY-OR-CITEKEYS in a browser."
(interactive (list (citar-select-refs)))
(unless (citar-open-files citekey-or-citekeys)
(citar-open-links citekey-or-citekeys)))
Describe alternatives you've considered
Currently, this can be implemented by hacking the messaging mechanism:
(defuncitar-open-files-or-links (citekey-or-citekeys)
"Open library file or URL or DOI link associated with CITEKEY-OR-CITEKEYS. Open library file associated with CITEKEY-OR-CITEKEYS. If no library file exists, open URL or DOI link associated with CITEKEY-OR-CITEKEYS in a browser."
(interactive (list (citar-select-refs)))
(let* ((hasfile t)
(set-message-functions
(append set-message-functions
'((lambda (msg)
(when (string-prefix-p"No associated files for" msg)
(setq hasfile nil)))))))
(citar-open-files citekey-or-citekeys)
(unless hasfile
(citar-open-links citekey-or-citekeys))))
The text was updated successfully, but these errors were encountered:
It does for the most part. It's just more convenient if I don't have to select the file option every time I want to open a file. What I want is something like a fallback option if the first command fails.
Even if the function is not implemented, I think it would be good to have a meaningful return value for citar-open* functions.
Thanks for the great package! I love how customizable it is.
Is your feature request related to a problem? Please describe.
This is a common use case for me, when I want to open a library file if it exists, and if not, open the link in browser.
In
bibtex-completion
, this is implemented inbibtex-completion-open-any
.Describe the solution you'd like
A proper way to achieve this would be if
citar-open-*
functions in general, andcitar-open-files
function in particular, return non-nil upon success, then the function would be very easy to write:Describe alternatives you've considered
Currently, this can be implemented by hacking the messaging mechanism:
The text was updated successfully, but these errors were encountered: