* Set org-file-apps to open a *.doc file under linux with Word ?
@ 2013-12-04 21:56 AW
2013-12-04 23:26 ` Nick Dokos
2013-12-05 9:01 ` Achim Gratz
0 siblings, 2 replies; 13+ messages in thread
From: AW @ 2013-12-04 21:56 UTC (permalink / raw)
To: emacs-orgmode
Hi!
I'm using orgmode as a replacement for folders, you know, real folders, lots
of paper inside.
In my orgfiles I link to many other files, mostly *.tex and *.pdf, links look
like
[[./foo.pdf][About foo]]
Sometimes I can't avoid to link to doc or docx files. So I need my linux pc to
start word and load a certain file.
I'd like to link to *.doc files in the same way:
[[./bar.doc][About that draft]]
But how can I set org-file-apps to open a *.doc file with MS Word under Linux?
Word works, more or less.
To start word the command is:
env WINEPREFIX="/home/AW/.wine-office" wine "C:\windows\command\start.exe" /Unix
"/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft
Office/Microsoft Word 2010.lnk"
But how in the world can I put in my .emacs file? I tried:
(add-to-list 'org-file-apps
'("\\.doc" . "\"env WINEPREFIX="/home/AW/.wine-office" wine
"C:/windows/command/start.exe"
/Unix "/home/AW/.wine-office/dosdevices/c:/users/AW/Start
Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk"\" %s"))
But I get:
Invalid read syntax: ". in wrong context"
Any suggestions would be welcome!
Regards,
Alexander
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-04 21:56 Set org-file-apps to open a *.doc file under linux with Word ? AW
@ 2013-12-04 23:26 ` Nick Dokos
2013-12-05 3:12 ` Jambunathan K
` (2 more replies)
2013-12-05 9:01 ` Achim Gratz
1 sibling, 3 replies; 13+ messages in thread
From: Nick Dokos @ 2013-12-04 23:26 UTC (permalink / raw)
To: emacs-orgmode
AW <alexander.willand@t-online.de> writes:
> Hi!
>
> I'm using orgmode as a replacement for folders, you know, real folders, lots
> of paper inside.
>
> In my orgfiles I link to many other files, mostly *.tex and *.pdf, links look
> like
>
> [[./foo.pdf][About foo]]
>
> Sometimes I can't avoid to link to doc or docx files. So I need my linux pc to
> start word and load a certain file.
>
> I'd like to link to *.doc files in the same way:
>
> [[./bar.doc][About that draft]]
>
> But how can I set org-file-apps to open a *.doc file with MS Word under Linux?
> Word works, more or less.
>
> To start word the command is:
>
> env WINEPREFIX="/home/AW/.wine-office" wine "C:\windows\command\start.exe" /Unix
> "/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft
> Office/Microsoft Word 2010.lnk"
>
> But how in the world can I put in my .emacs file? I tried:
>
> (add-to-list 'org-file-apps
> '("\\.doc" . "\"env WINEPREFIX="/home/AW/.wine-office" wine
> "C:/windows/command/start.exe"
> /Unix "/home/AW/.wine-office/dosdevices/c:/users/AW/Start
> Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk"\" %s"))
>
Off the top of my head, I would say
(add-to-list 'org-file-apps
'("\\.doc" . "env WINEPREFIX=\"/home/AW/.wine-office\" wine \"C:\\windows\\command\\start.exe\" /Unix \"/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk\""))
i.e. just the command you provided enclosed in double quotes, except that
certain characters within have to be escaped:
" -> \"
\ -> \\
The long string will probably be broken up into multiple lines by some
mailer but it is supposed to be one long string with no newlines. I
don't know if the spaces in the path will cause problems.
Untested (except that I did evaluate the add-to-list and got no errors):
no Word and no wine here.
BTW, why not LibreOffice? Does it mishandle your .doc files?
Nick
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-04 23:26 ` Nick Dokos
@ 2013-12-05 3:12 ` Jambunathan K
2013-12-05 3:18 ` Jambunathan K
2013-12-05 13:34 ` AW
2 siblings, 0 replies; 13+ messages in thread
From: Jambunathan K @ 2013-12-05 3:12 UTC (permalink / raw)
To: Nick Dokos; +Cc: emacs-orgmode
Nick Dokos <ndokos@gmail.com> writes:
> Off the top of my head, I would say
>
> (add-to-list 'org-file-apps
> '("\\.doc" . "env WINEPREFIX=\"/home/AW/.wine-office\" wine \"C:\\windows\\command\\start.exe\" /Unix \"/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk\""))
>
>
> i.e. just the command you provided enclosed in double quotes, except that
> certain characters within have to be escaped:
The easiest way to get the same effect is to use
M-x customize-variable RET org-file-apps RET
and specify a command. Once it is saved, the .emacs will have the
resulting "nightmarish string" :-)
----------------------------------------------------------------
Another way to "quote" a string would be to use
M-x pp-eval-expression RET (read-string "Enter string: ") RET
and copy-paste the output from *Pp Eval Output* to .emacs or .el file.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-04 23:26 ` Nick Dokos
2013-12-05 3:12 ` Jambunathan K
@ 2013-12-05 3:18 ` Jambunathan K
2013-12-05 13:36 ` AW
2013-12-05 13:34 ` AW
2 siblings, 1 reply; 13+ messages in thread
From: Jambunathan K @ 2013-12-05 3:18 UTC (permalink / raw)
Cc: emacs-orgmode
Nick Dokos <ndokos@gmail.com> writes:
> Off the top of my head, I would say
>
> (add-to-list 'org-file-apps
> '("\\.doc" . "env WINEPREFIX=\"/home/AW/.wine-office\" wine \"C:\\windows\\command\\start.exe\" /Unix \"/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk\""))
>
>
> i.e. just the command you provided enclosed in double quotes, except that
> certain characters within have to be escaped:
>
> " -> \"
> \ -> \\
>
> The long string will probably be broken up into multiple lines by some
> mailer but it is supposed to be one long string with no newlines. I
> don't know if the spaces in the path will cause problems.
>
> Untested (except that I did evaluate the add-to-list and got no errors):
> no Word and no wine here.
>
> BTW, why not LibreOffice? Does it mishandle your .doc files?
>
> Nick
The easiest way to get the same effect is to use
M-x customize-variable RET org-file-apps RET
and specify a command. Once it is saved, the .emacs will have the
resulting "nightmarish string" :-)
----------------------------------------------------------------
Another way to "quote" a string would be to use
M-x pp-eval-expression RET (read-string "Enter string: ") RET
and copy-paste the output from *Pp Eval Output* to .emacs or .el file.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 3:18 ` Jambunathan K
@ 2013-12-05 13:36 ` AW
2013-12-05 15:17 ` Jambunathan K
2013-12-05 15:21 ` Jambunathan K
0 siblings, 2 replies; 13+ messages in thread
From: AW @ 2013-12-05 13:36 UTC (permalink / raw)
To: emacs-orgmode
Am Donnerstag, 5. Dezember 2013, 08:48:11 schrieb Jambunathan K:
> Nick Dokos <ndokos@gmail.com> writes:
> > Off the top of my head, I would say
> >
> > (add-to-list 'org-file-apps
> >
> > '("\\.doc" . "env WINEPREFIX=\"/home/AW/.wine-office\" wine
> > \"C:\\windows\\command\\start.exe\" /Unix
> > \"/home/AW/.wine-office/dosdevices/c:/users/AW/Start
> > Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk\""))>
> > i.e. just the command you provided enclosed in double quotes, except that
> >
> > certain characters within have to be escaped:
> > " -> \"
> > \ -> \\
> >
> > The long string will probably be broken up into multiple lines by some
> > mailer but it is supposed to be one long string with no newlines. I
> > don't know if the spaces in the path will cause problems.
> >
> > Untested (except that I did evaluate the add-to-list and got no errors):
> > no Word and no wine here.
> >
> > BTW, why not LibreOffice? Does it mishandle your .doc files?
> >
> > Nick
>
> The easiest way to get the same effect is to use
>
> M-x customize-variable RET org-file-apps RET
>
> and specify a command. Once it is saved, the .emacs will have the
> resulting "nightmarish string" :-)
>
> ----------------------------------------------------------------
>
> Another way to "quote" a string would be to use
>
> M-x pp-eval-expression RET (read-string "Enter string: ") RET
>
> and copy-paste the output from *Pp Eval Output* to .emacs or .el file.
Thank you, customization worked, but it did not start word -- I'm going
another way now.
Regards,
Alexander
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 13:36 ` AW
@ 2013-12-05 15:17 ` Jambunathan K
2013-12-05 15:21 ` Jambunathan K
1 sibling, 0 replies; 13+ messages in thread
From: Jambunathan K @ 2013-12-05 15:17 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 707 bytes --]
AW <alexander.willand@t-online.de> writes:
> Thank you, customization worked, but it did not start word -- I'm going
> another way now.
I am playing a guessing game and don't know what I am saying. Try this.
M-: (shell-quote-argument (read-string "Enter string:"))
^^^^^^^^^^^^^^^^^^^^
When prompted enter
<whatever wine whatever> "%s"
Now put whatever string you get in *Pp Eval Output* DIRECTLY in to your
.emacs. See the attached snippet.el for an idea of what I get.
Instead of passing env as part of the command, I think you can add this
to your .emacs.
(setenv "WINEPREFIX" "/home/AW/.wine-office")
You can also do
M-x setenv
to set environment variables.
[-- Attachment #2: snippet.el --]
[-- Type: application/emacs-lisp, Size: 493 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 13:36 ` AW
2013-12-05 15:17 ` Jambunathan K
@ 2013-12-05 15:21 ` Jambunathan K
2013-12-05 16:35 ` AW
1 sibling, 1 reply; 13+ messages in thread
From: Jambunathan K @ 2013-12-05 15:21 UTC (permalink / raw)
Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 701 bytes --]
AW <alexander.willand@t-online.de> writes:
> Thank you, customization worked, but it did not start word -- I'm going
> another way now.
I am playing a guessing game and really don't know what I am saying.
Try this.
M-: (shell-quote-argument (read-string "Enter string:"))
^^^^^^^^^^^^^^^^^^^^
When prompted enter
whatever wine whatever "%s"
Now put whatever string you get in *Pp Eval Output* DIRECTLY in to your
.emacs. See the attached snippet.el for what I get.
Instead of passing env as part of the command, I think you can add this
to your .emacs.
(setenv "WINEPREFIX" "/home/AW/.wine-office")
You can also do
M-x setenv
to set environment variables.
[-- Attachment #2: snippet.el --]
[-- Type: application/emacs-lisp, Size: 493 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 15:21 ` Jambunathan K
@ 2013-12-05 16:35 ` AW
2013-12-05 16:40 ` Jambunathan K
0 siblings, 1 reply; 13+ messages in thread
From: AW @ 2013-12-05 16:35 UTC (permalink / raw)
To: Jambunathan K; +Cc: emacs-orgmode
Am Donnerstag, 5. Dezember 2013, 20:51:04 schrieb Jambunathan K:
> AW <alexander.willand@t-online.de> writes:
> > Thank you, customization worked, but it did not start word -- I'm going
> > another way now.
>
> I am playing a guessing game and really don't know what I am saying.
>
> Try this.
>
>
> M-: (shell-quote-argument (read-string "Enter string:"))
> ^^^^^^^^^^^^^^^^^^^^
>
> When prompted enter
>
> whatever wine whatever "%s"
>
> Now put whatever string you get in *Pp Eval Output* DIRECTLY in to your
> .emacs. See the attached snippet.el for what I get.
>
> Instead of passing env as part of the command, I think you can add this
> to your .emacs.
>
> (setenv "WINEPREFIX" "/home/AW/.wine-office")
>
> You can also do
>
> M-x setenv
>
> to set environment variables.
I found out, that things are much more complicated:
I wrote a bash script "word.sh" (see my other mail on this) and tried to figure
out how to pass a filename to it. Even this is not obvious, because from the
viewpoint of Word under Wine filenames differ from the real filename in the
system. I did not suceed to make Word start and open a file foo.docx. You know,
something weird as
"word.sh" "C:/users/AW/Meine Dokumente/Dokumente/temp/foo.docx"
made Word start, but not open a document, and Word complains about missing dot
something. And often people send files with names which are a pain to read,
including "$" -signs, brackets and whatever.
The whole thing is way too difficult for me and I have to dismiss the idea.
Thanks to you and everyone who offered help, but it was not a good idea.
Regards,
Alexander
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 16:35 ` AW
@ 2013-12-05 16:40 ` Jambunathan K
0 siblings, 0 replies; 13+ messages in thread
From: Jambunathan K @ 2013-12-05 16:40 UTC (permalink / raw)
Cc: emacs-orgmode
AW <alexander.willand@t-online.de> writes:
> I found out, that things are much more complicated:
Did you try my suggestion?
What happened?
I gave a snippet.el. You just need to copy paste that to .emacs. It is
easy to figure out where and how.
(I know nothing about shell programming or environment variables and
such things)
> Thanks to you and everyone who offered help, but it was not a good
> idea.
You are running away. We aren't.
Give it a try, Buddy. We will figure out something and make you happy.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-04 23:26 ` Nick Dokos
2013-12-05 3:12 ` Jambunathan K
2013-12-05 3:18 ` Jambunathan K
@ 2013-12-05 13:34 ` AW
2013-12-05 19:48 ` Achim Gratz
2 siblings, 1 reply; 13+ messages in thread
From: AW @ 2013-12-05 13:34 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Nick Dokos
Am Mittwoch, 4. Dezember 2013, 18:26:46 schrieb Nick Nick Dokos:
> AW <alexander.willand@t-online.de> writes:
> > Hi!
...
> Off the top of my head, I would say
>
> (add-to-list 'org-file-apps
> '("\\.doc" . "env WINEPREFIX=\"/home/AW/.wine-office\" wine
> \"C:\\windows\\command\\start.exe\" /Unix
> \"/home/AW/.wine-office/dosdevices/c:/users/AW/Start
> Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk\""))
>
>
> i.e. just the command you provided enclosed in double quotes, except that
> certain characters within have to be escaped:
>
> " -> \"
> \ -> \\
>
> The long string will probably be broken up into multiple lines by some
> mailer but it is supposed to be one long string with no newlines. I
> don't know if the spaces in the path will cause problems.
>
> Untested (except that I did evaluate the add-to-list and got no errors):
> no Word and no wine here.
>
I get no error message, but nothing happens, except Emacs telling me it has
run the command.
> BTW, why not LibreOffice? Does it mishandle your .doc files?
LibreOffice changes the content of word files slightly and for folks who panic if
not everything is like expected, that's too much already.
You know, if you are the guy who works with LaTeX, word users tend to be
somehow narrow minded.
However, thank you. I tried something different now: I wrote a bash script,
just two lines:
#!/bin/bash
env WINEPREFIX="/home/AW/.wine-office" wine "C:\windows\command\start.exe" /Unix
"/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft
Office/Microsoft Word 2010.lnk"
On the command line "word.sh" works.
But in .emacs the lines
(add-to-list 'org-file-apps
'("\\.docx" . "exec /home/AW/bin/word.sh %s"))
don't. What am I doing in the wrong way?
Regards,
Alexander
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 13:34 ` AW
@ 2013-12-05 19:48 ` Achim Gratz
0 siblings, 0 replies; 13+ messages in thread
From: Achim Gratz @ 2013-12-05 19:48 UTC (permalink / raw)
To: emacs-orgmode
AW writes:
> #!/bin/bash
>
> env WINEPREFIX="/home/AW/.wine-office" wine "C:\windows\command\start.exe" /Unix
> "/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft
> Office/Microsoft Word 2010.lnk"
>
> On the command line "word.sh" works.
>
> But in .emacs the lines
>
> (add-to-list 'org-file-apps
> '("\\.docx" . "exec /home/AW/bin/word.sh %s"))
>
> don't. What am I doing in the wrong way?
"exec" is a shell built-in. Try:
--8<---------------cut here---------------start------------->8---
#!/bin/sh
exec WINEPREFIX="/home/AW/.wine-office" \
wine "C:\windows\command\start.exe" /Unix \
"/home/AW/.wine-office/dosdevices/c:/users/AW/Start Menu/Programs/Microsoft Office/Microsoft Word 2010.lnk"
--8<---------------cut here---------------end--------------->8---
Then drop the exec from the emacs association to docx.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-04 21:56 Set org-file-apps to open a *.doc file under linux with Word ? AW
2013-12-04 23:26 ` Nick Dokos
@ 2013-12-05 9:01 ` Achim Gratz
2013-12-05 13:38 ` AW
1 sibling, 1 reply; 13+ messages in thread
From: Achim Gratz @ 2013-12-05 9:01 UTC (permalink / raw)
To: emacs-orgmode
AW <alexander.willand <at> t-online.de> writes:
> But how can I set org-file-apps to open a *.doc file with MS Word under Linux?
It's probably easiest to put that into a wrapper script and associate it
with .doc/.docx on your desktop environment. That way you probably wouldn't
even need to customize anything within Emacs or at least could avoid the
vagaries of UNIX vs. Windows quoting.
Regards,
Achim.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Set org-file-apps to open a *.doc file under linux with Word ?
2013-12-05 9:01 ` Achim Gratz
@ 2013-12-05 13:38 ` AW
0 siblings, 0 replies; 13+ messages in thread
From: AW @ 2013-12-05 13:38 UTC (permalink / raw)
To: emacs-orgmode
Am Donnerstag, 5. Dezember 2013, 09:01:40 schrieb Achim Gratz:
> AW <alexander.willand <at> t-online.de> writes:
> > But how can I set org-file-apps to open a *.doc file with MS Word under
> > Linux?
> It's probably easiest to put that into a wrapper script and associate it
> with .doc/.docx on your desktop environment. That way you probably wouldn't
> even need to customize anything within Emacs or at least could avoid the
> vagaries of UNIX vs. Windows quoting.
>
>
> Regards,
> Achim.
Great idea, thank you! Doesn't work yet (I'm lacking of lisp knowledge very
much), see my other mail re Nick Dokos.
Regards,
Alexander
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-12-05 19:48 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-04 21:56 Set org-file-apps to open a *.doc file under linux with Word ? AW
2013-12-04 23:26 ` Nick Dokos
2013-12-05 3:12 ` Jambunathan K
2013-12-05 3:18 ` Jambunathan K
2013-12-05 13:36 ` AW
2013-12-05 15:17 ` Jambunathan K
2013-12-05 15:21 ` Jambunathan K
2013-12-05 16:35 ` AW
2013-12-05 16:40 ` Jambunathan K
2013-12-05 13:34 ` AW
2013-12-05 19:48 ` Achim Gratz
2013-12-05 9:01 ` Achim Gratz
2013-12-05 13:38 ` AW
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).