emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: Opening org-cite links with different application
@ 2022-05-25 14:10 Alessandro Bertulli
  2022-05-25 14:49 ` Bruce D'Arcus
  2022-05-25 15:21 ` Max Nikulin
  0 siblings, 2 replies; 15+ messages in thread
From: Alessandro Bertulli @ 2022-05-25 14:10 UTC (permalink / raw)
  To: bdarcus; +Cc: emacs-orgmode

Thanks! Precise as always.

I'm not sure if it's the best way to do so, but it worked for me by
using a lambda:

(setq citar-file-open-function '(lambda (file)
	  (async-shell-command (format-message "sioyek \"%s\"" file))))

Moreover, since I don't really care about the terminal output of the PDF
viewer, I followed an Emacs SE suggestion
(https://emacs.stackexchange.com/a/58341/29817) and made the output
buffer not brought up:

(add-to-list 'display-buffer-alist '("*Async Shell Command*"
display-buffer-no-window (nil)))

which, in case I want to inspect it, it's still visitable with the usual
C-x b.

Thank you!

Alessandro


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Opening org-cite links with different application
@ 2022-05-27 11:15 Alessandro Bertulli
  0 siblings, 0 replies; 15+ messages in thread
From: Alessandro Bertulli @ 2022-05-27 11:15 UTC (permalink / raw)
  To: theophilusx, bdarcus, manikulin; +Cc: emacs-orgmode

Thanks to all for your answers!

Max wrote:
> I mean
>    (call-process "xdg-open" nil 0 nil url)
> with "sioyek" instead of "xdg-open" if you do not like to set the 
> application as the default handler for PDF files. It will allow to avoid 
> additional settings for shell buffers. Of course, you will loose ability 
> to check command output for errors, it is shoot and forget method 
> suitable for most of viewers however.
Thanks for the suggestion, it works quite well. I can't inspect the
output, but for a PDF viewer that's actually the pretty standard
behaviour, so for me it works fine right now.

To Bruce and Tim: thanks, right now this solution works, but if I figure
out a more clever way to do it (based on your suggestions) I'll give a
shout.

Alessando


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Opening org-cite links with different application
@ 2022-05-25 16:24 Alessandro Bertulli
  2022-05-31 14:53 ` Max Nikulin
  0 siblings, 1 reply; 15+ messages in thread
From: Alessandro Bertulli @ 2022-05-25 16:24 UTC (permalink / raw)
  To: manikulin; +Cc: emacs-orgmode

Thanks for the suggestion! I wasn't aware of shell-quote-argument, now
it seems much more robust:

(setq citar-file-open-function '(lambda (file)
				  (async-shell-command (format-message
				  "sioyek %s" (shell-quote-argument
				  file)))))

I can't use browse-url-xdg-open because the PDF viewer I want to use
it's not the system default one: when opening PDFs from Org-cite I
expect to open academic documents, so I use Sioyek for them.

However, this creates an annoying problem: now if I want to open two
documents, when opening the second link Emacs asks "A command is running
in the default buffer. Use a new buffer? (yes on no) " which is very
annoying. I suppose that with xdg there's no problem. Do you have any
idea how to make Emacs "not worry" about output buffers?

Alessandro

P.S. I'm afraid I can't follow you: what's the point with mailcap?


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: Opening org-cite links with different application
@ 2022-05-25 16:16 Alessandro Bertulli
  0 siblings, 0 replies; 15+ messages in thread
From: Alessandro Bertulli @ 2022-05-25 16:16 UTC (permalink / raw)
  To: bdarcus; +Cc: emacs-orgmode

It's a PDF viewer that tries to display scientific and academic writings
at his best. It's actually still experimental, in a way, but it looks
promising and, for now, I don't have big problems. Unfortunately, it has
vi-style keybindings :-)

Anyway, I think I need a lambda because there's not a single function
that do what I want for me. Moreover, I need to take an argument (the
file name), to then call, in an async process, "sioyek
/path/to/file.pdf". I don't know, it seemed the most straightforward to
me. Do you have any better idea?

Alessandro


^ permalink raw reply	[flat|nested] 15+ messages in thread
* Opening org-cite links with different application
@ 2022-05-25 10:52 Alessandro Bertulli
  2022-05-25 11:00 ` Bruce D'Arcus
  0 siblings, 1 reply; 15+ messages in thread
From: Alessandro Bertulli @ 2022-05-25 10:52 UTC (permalink / raw)
  To: emacs-orgmode

Hi all!

I'm keeping a journal of my research activity with org-cite, and
together with citar and vertico, it works great. I have a question
though.

How can I make Org open the PDF file of a resource, using an external
application?

Let me explain: with the point on a org-cite link, pressing C-c C-o asks
me for the resource to open. Selecting the PDF file opens it with
DocView. I want instead to open it with an external PDF viewer
(specifically, Sioyek). But I can't make it do so! Changing
org-file-apps works only when I open "file:" type links. Apparently,
org-cite links don't read that value.

So I'm asking, particularly to org-cite people: is there a way to do so?

Thanks for your time and your patience.

Bertulli


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-06-02 15:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-25 14:10 Opening org-cite links with different application Alessandro Bertulli
2022-05-25 14:49 ` Bruce D'Arcus
2022-05-25 15:21 ` Max Nikulin
2022-05-25 16:00   ` Bruce D'Arcus
2022-05-25 16:46     ` Max Nikulin
2022-05-26 18:45       ` Bruce D'Arcus
2022-05-26 22:17         ` Tim Cross
  -- strict thread matches above, loose matches on Subject: below --
2022-05-27 11:15 Alessandro Bertulli
2022-05-25 16:24 Alessandro Bertulli
2022-05-31 14:53 ` Max Nikulin
2022-06-01 10:33   ` Alessandro Bertulli
2022-06-02 15:53     ` Max Nikulin
2022-05-25 16:16 Alessandro Bertulli
2022-05-25 10:52 Alessandro Bertulli
2022-05-25 11:00 ` Bruce D'Arcus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).