emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Define Keyboard Shortcut for "Open in Emacs"
@ 2015-04-03 13:33 Rainer M Krug
  2015-04-03 13:51 ` John Kitchin
  2015-04-03 17:27 ` Jorge A. Alfaro-Murillo
  0 siblings, 2 replies; 12+ messages in thread
From: Rainer M Krug @ 2015-04-03 13:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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 --]

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 13:33 Define Keyboard Shortcut for "Open in Emacs" Rainer M Krug
@ 2015-04-03 13:51 ` John Kitchin
  2015-04-03 17:04   ` J. David Boyd
  2015-04-07 13:06   ` Rainer M Krug
  2015-04-03 17:27 ` Jorge A. Alfaro-Murillo
  1 sibling, 2 replies; 12+ messages in thread
From: John Kitchin @ 2015-04-03 13:51 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

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

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 13:51 ` John Kitchin
@ 2015-04-03 17:04   ` J. David Boyd
  2015-04-03 17:35     ` Nicolas Goaziou
  2015-04-07 13:06   ` Rainer M Krug
  1 sibling, 1 reply; 12+ messages in thread
From: J. David Boyd @ 2015-04-03 17:04 UTC (permalink / raw)
  To: emacs-orgmode

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

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 13:33 Define Keyboard Shortcut for "Open in Emacs" Rainer M Krug
  2015-04-03 13:51 ` John Kitchin
@ 2015-04-03 17:27 ` Jorge A. Alfaro-Murillo
  2015-04-04 21:44   ` Xavier Maillard
  2015-04-07 13:09   ` Rainer M Krug
  1 sibling, 2 replies; 12+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-04-03 17:27 UTC (permalink / raw)
  To: emacs-orgmode

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.

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 17:04   ` J. David Boyd
@ 2015-04-03 17:35     ` Nicolas Goaziou
  0 siblings, 0 replies; 12+ messages in thread
From: Nicolas Goaziou @ 2015-04-03 17:35 UTC (permalink / raw)
  To: J. David Boyd; +Cc: emacs-orgmode

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

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 17:27 ` Jorge A. Alfaro-Murillo
@ 2015-04-04 21:44   ` Xavier Maillard
  2015-04-04 22:56     ` Jorge A. Alfaro-Murillo
  2015-04-07 13:09   ` Rainer M Krug
  1 sibling, 1 reply; 12+ messages in thread
From: Xavier Maillard @ 2015-04-04 21:44 UTC (permalink / raw)
  To: Jorge A. Alfaro-Murillo; +Cc: emacs-orgmode

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

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-04 21:44   ` Xavier Maillard
@ 2015-04-04 22:56     ` Jorge A. Alfaro-Murillo
  2015-04-05  4:59       ` Xavier Maillard
  0 siblings, 1 reply; 12+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-04-04 22:56 UTC (permalink / raw)
  To: emacs-orgmode

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.

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-04 22:56     ` Jorge A. Alfaro-Murillo
@ 2015-04-05  4:59       ` Xavier Maillard
  2015-04-06 13:44         ` Jorge A. Alfaro-Murillo
  0 siblings, 1 reply; 12+ messages in thread
From: Xavier Maillard @ 2015-04-05  4:59 UTC (permalink / raw)
  To: Jorge A. Alfaro-Murillo; +Cc: emacs-orgmode

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.

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-05  4:59       ` Xavier Maillard
@ 2015-04-06 13:44         ` Jorge A. Alfaro-Murillo
  2015-04-07  4:53           ` Xavier Maillard
  0 siblings, 1 reply; 12+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-04-06 13:44 UTC (permalink / raw)
  To: emacs-orgmode

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.

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-06 13:44         ` Jorge A. Alfaro-Murillo
@ 2015-04-07  4:53           ` Xavier Maillard
  0 siblings, 0 replies; 12+ messages in thread
From: Xavier Maillard @ 2015-04-07  4:53 UTC (permalink / raw)
  To: Jorge A. Alfaro-Murillo; +Cc: emacs-orgmode


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.

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 13:51 ` John Kitchin
  2015-04-03 17:04   ` J. David Boyd
@ 2015-04-07 13:06   ` Rainer M Krug
  1 sibling, 0 replies; 12+ messages in thread
From: Rainer M Krug @ 2015-04-07 13:06 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode

[-- 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 --]

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

* Re: Define Keyboard Shortcut for "Open in Emacs"
  2015-04-03 17:27 ` Jorge A. Alfaro-Murillo
  2015-04-04 21:44   ` Xavier Maillard
@ 2015-04-07 13:09   ` Rainer M Krug
  1 sibling, 0 replies; 12+ messages in thread
From: Rainer M Krug @ 2015-04-07 13:09 UTC (permalink / raw)
  To: Jorge A. Alfaro-Murillo; +Cc: emacs-orgmode

[-- 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 --]

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

end of thread, other threads:[~2015-04-07 13:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-03 13:33 Define Keyboard Shortcut for "Open in Emacs" Rainer M Krug
2015-04-03 13:51 ` John Kitchin
2015-04-03 17:04   ` J. David Boyd
2015-04-03 17:35     ` Nicolas Goaziou
2015-04-07 13:06   ` Rainer M Krug
2015-04-03 17:27 ` Jorge A. Alfaro-Murillo
2015-04-04 21:44   ` Xavier Maillard
2015-04-04 22:56     ` Jorge A. Alfaro-Murillo
2015-04-05  4:59       ` Xavier Maillard
2015-04-06 13:44         ` Jorge A. Alfaro-Murillo
2015-04-07  4:53           ` Xavier Maillard
2015-04-07 13:09   ` Rainer M Krug

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).