[-- Attachment #1: Type: text/plain, Size: 713 bytes --] Hi I would like to open pdfs in emacs (using pdf-viewer) but there is only a shortcut (C-c C-o) to open a pdf externally, and no shortcut for the menu item below "Open in Emacs" in the context menu. How can I define a shortcut for this command (or re-use C-c C-o)? Thanks Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 494 bytes --]
I find C-u RET on a link will open a pdf in emacs. or C-u C-c C-o Rainer M Krug writes: > Hi > > I would like to open pdfs in emacs (using pdf-viewer) but there is only > a shortcut (C-c C-o) to open a pdf externally, and no shortcut for the > menu item below "Open in Emacs" in the context menu. > > How can I define a shortcut for this command (or re-use C-c C-o)? > Thanks > > Rainer -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> I find C-u RET on a link will open a pdf in emacs. or C-u C-c C-o
>
> Rainer M Krug writes:
>
>> Hi
>>
>> I would like to open pdfs in emacs (using pdf-viewer) but there is only
>> a shortcut (C-c C-o) to open a pdf externally, and no shortcut for the
>> menu item below "Open in Emacs" in the context menu.
>>
>> How can I define a shortcut for this command (or re-use C-c C-o)?
>> Thanks
>>
>> Rainer
>
> --
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
It's too bad there's not some way to find out all the different things C-u
does to commands when used...
Dave
Rainer M Krug writes:
> I would like to open pdfs in emacs (using pdf-viewer) but there
> is only a shortcut (C-c C-o) to open a pdf externally, and no
> shortcut for the menu item below "Open in Emacs" in the context
> menu.
>
> How can I define a shortcut for this command (or re-use C-c
> C-o)?
If you want C-c C-o to open in emacs, you can configure your
org-file-apps:
#+BEGIN_SRC emacs-lisp
(eval-after-load "org"
'(if (assoc "\\.pdf\\'" org-file-apps)
(setcdr (assoc "\\.pdf\\'" org-file-apps) 'emacs)
(add-to-list 'org-file-apps '("\\.pdf\\'" . 'emacs) t)))
#+END_SRC
Alternatively, if you are on Linux, you could make your
emacsclient your default pdf-viewer:
#+BEGIN_SRC shell
xdg-mime default emacsclient.desktop application/pdf
#+END_SRC
Then the external program called by C-c C-o would also be emacs =)
Best,
--
Jorge.
Hello,
dboyd2@mmm.com (J. David Boyd) writes:
> It's too bad there's not some way to find out all the different things C-u
> does to commands when used...
C-h k C-c C-o
Regards,
--
Nicolas Goaziou
Hello Jorge,
Jorge A. Alfaro-Murillo <jorge.alfaro-murillo@yale.edu> writes:
> Alternatively, if you are on Linux, you could make your
> emacsclient your default pdf-viewer:
>
> #+BEGIN_SRC shell
> xdg-mime default emacsclient.desktop application/pdf
> #+END_SRC
What is emacsclient.desktop exactly ? On my slackware, there is
nothing named like this.
Thank you for both your tip and probable answer.
-- Xavier
Xavier Maillard writes:
> What is emacsclient.desktop exactly ? On my slackware, there is
> nothing named like this.
Inside a desktop environment (e.g. GNOME, KDE, Xfce), xdg-open
passes the arguments to that desktop environment's file-opener
application (gvfs-open, kde-open, or exo-open, respectively).
When no desktop environment is detected (e.g. using Openbox),
xdg-open will use its own configuration files, emacsclient.desktop
is the call to the emacs server, if you do not use the server you
could use emacs.desktop instead.
Best,
--
Jorge.
Hello Jorge,
Jorge A. Alfaro-Murillo <jorge.alfaro-murillo@yale.edu> writes:
> Xavier Maillard writes:
>
>> What is emacsclient.desktop exactly ? On my slackware, there is
>> nothing named like this.
>
> Inside a desktop environment (e.g. GNOME, KDE, Xfce), xdg-open
> passes the arguments to that desktop environment's file-opener
> application (gvfs-open, kde-open, or exo-open, respectively).
> When no desktop environment is detected (e.g. using Openbox),
> xdg-open will use its own configuration files, emacsclient.desktop
> is the call to the emacs server, if you do not use the server you
> could use emacs.desktop instead.
Thank you very much for these clarifications. Should I expect
anything from xdg-* when not using a desktop environment at all ? (I
am using something home-brewed where I could add support for
something like this but that's not for now).
Also, can you share an emacsclient.desktop file ?
Regards
-- Xavier.
Xavier Maillard writes: > Thank you very much for these clarifications. Should I expect > anything from xdg-* when not using a desktop environment at all? > (I am using something home-brewed where I could add support for > something like this but that's not for now). I am not sure. You could try xdg-open in any file from the terminal, to see if it works as expected > Also, can you share an emacsclient.desktop file ? That is not a file, but how xdg identifies emacsclient. You can find more about it here: https://wiki.archlinux.org/index.php/Xdg-open Best, -- Jorge.
Jorge A. Alfaro-Murillo <jorge.alfaro-murillo@yale.edu> writes:
> Xavier Maillard writes:
>
>> Thank you very much for these clarifications. Should I expect
>> anything from xdg-* when not using a desktop environment at all?
>> (I am using something home-brewed where I could add support for
>> something like this but that's not for now).
>
> I am not sure. You could try xdg-open in any file from the
> terminal, to see if it works as expected
Lovely ! It just works.
-- Xavier.
[-- Attachment #1: Type: text/plain, Size: 1155 bytes --] John Kitchin <jkitchin@andrew.cmu.edu> writes: > I find C-u RET on a link will open a pdf in emacs. or C-u C-c C-o Thanks - C-u C-c C-o works for me Rainer > > Rainer M Krug writes: > >> Hi >> >> I would like to open pdfs in emacs (using pdf-viewer) but there is only >> a shortcut (C-c C-o) to open a pdf externally, and no shortcut for the >> menu item below "Open in Emacs" in the context menu. >> >> How can I define a shortcut for this command (or re-use C-c C-o)? >> Thanks >> >> Rainer > > -- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 494 bytes --]
[-- Attachment #1: Type: text/plain, Size: 1513 bytes --] jorge.alfaro-murillo@yale.edu (Jorge A. Alfaro-Murillo) writes: > Rainer M Krug writes: > >> I would like to open pdfs in emacs (using pdf-viewer) but there >> is only a shortcut (C-c C-o) to open a pdf externally, and no >> shortcut for the menu item below "Open in Emacs" in the context >> menu. >> >> How can I define a shortcut for this command (or re-use C-c >> C-o)? > > If you want C-c C-o to open in emacs, you can configure your > org-file-apps: > > #+BEGIN_SRC emacs-lisp > (eval-after-load "org" > '(if (assoc "\\.pdf\\'" org-file-apps) > (setcdr (assoc "\\.pdf\\'" org-file-apps) 'emacs) > (add-to-list 'org-file-apps '("\\.pdf\\'" . 'emacs) t))) > #+END_SRC Good idea - I will keep this in mind and see. > > Alternatively, if you are on Linux, you could make your > emacsclient your default pdf-viewer: Nope - Mac. Thanks, Rainer > > #+BEGIN_SRC shell > xdg-mime default emacsclient.desktop application/pdf > #+END_SRC > > Then the external program called by C-c C-o would also be emacs =) > > Best, -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 494 bytes --]