emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
@ 2013-11-30  8:44 Miguel Ruiz
  2013-11-30 10:16 ` Jambunathan K
  0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ruiz @ 2013-11-30  8:44 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]

Hello,

I use cygwin only cli, so I depend on html, pdf and odt MSWindows viewer.

I could manage to add this code to my .emacs:

(if (eq system-type 'cygwin)
 (add-hook 'org-mode-hook
      '(lambda ()
         (delete '("\\.x?html?\\'" . default) org-file-apps)
         (add-to-list 'org-file-apps '("\\.x?html?\\'" . "cygstart %s"))
         (delete '("\\.pdf\\'" . default) org-file-apps)
         (add-to-list 'org-file-apps '("\\.pdf\\'" . "cygstart %s"))
         (delete '("\\.odt\\'" . default) org-file-apps)
         (add-to-list 'org-file-apps '("\\.odt\\'" . "cygstart %s")))))

so I can org-open-file html/pdf/odt files successfully.

But with (require 'ox-odt) + C-c C-e o O , my odt files open in emacs instead of LibreOffice.

I am aware of (org-open-file (org-odt-export-to-odt nil s v) 'system) line in ox-odt.el: 
- If I run (org-open-file "file.odt") I get the desired behaviour; 
- If I run (org-open-file "file.odt" 'system) I get file.odt open in emacs as a zip file.

So:

- How can redefine or supress 'system in (org-open-file (org-odt-export-to-odt nil s v) 'system) line in ox-odt.el?

- May I propose to developers to include (defconst org-file-apps-defaults-cygwin ... or similar?

- Could you help me in any other way?

Thank you so much.

Miguel Ruiz,
Sevilla (Spain).

[-- Attachment #2: Type: text/html, Size: 2054 bytes --]

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

* Re: Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
  2013-11-30  8:44 Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip Miguel Ruiz
@ 2013-11-30 10:16 ` Jambunathan K
  2013-11-30 10:43   ` Miguel Ruiz
  0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-11-30 10:16 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode@gnu.org


Miguel Ruiz <rbenit68@yahoo.es> writes:

Remove all your configurations and try this.  This will use windows
"open".

(require 'org)  ;; Make sure org is loaded

(defun org-default-apps ()
  "Return the default applications for this operating system."
  (cond
   ((eq system-type 'darwin)
    org-file-apps-defaults-macosx)
   ((memq system-type '(cygwin windows-nt)) ;;  <============
    org-file-apps-defaults-windowsnt)
   (t org-file-apps-defaults-gnu)))

> "cygstart %s"

Any reason why this one is preferable windows's default "open".  Is
cygstart a recent addition or is it available even on older
distributions.

> - How can redefine or supress 'system in (org-open-file
> (org-odt-export-to-odt nil s v) 'system) line in ox-odt.el?

ODT files are zip files (can be opened in archive-mode) or they can be
opened in doc-view.

Use of 'system has generally not proved to be problematic in practice.
I think it is possible to accomplish what you want without touch or
modifying that particular line.

> - May I propose to developers to include (defconst
> org-file-apps-defaults-cygwin ... or similar?

It would be a good idea.

But, does the Emacs come from cygwin distribution or is it NT Emacs
(ftp://ftp.gnu.org/gnu/emacs/windows/).

----------------------------------------------------------------

Sorry, I am unable to provide concrete feedback.

As sometime user of Cygwin + Windows, I found that Cygwin is a pain and
started using native Windows Emacs and Gnu Win32 libraries.

I have now moved to Debian now.

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

* Re: Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
  2013-11-30 10:16 ` Jambunathan K
@ 2013-11-30 10:43   ` Miguel Ruiz
  2013-11-30 16:02     ` Jambunathan K
  0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ruiz @ 2013-11-30 10:43 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2288 bytes --]

Thank you, Jambunathan.

1/ I'm running Emacs 24.3.1 (i686-pc-cygwin) of 2013-08-14 on moufang; it's Windows Emacs built into cygwin, so you don't have to have X11 installed in cygwin for graphical Emacs.

2/ I forgot to say I'm a running mintty 1.1.3 so "open" is not available, I can use cygstart instead.

3/ I will try the code you provide and I'll commit the list the progress I get.

4/ So far, cygwin+emacs+orgmode+python+perl+latex it's very nice, specially by the fact that you can propagate an  ultra-customized working-environment as easy as just copy, no doubt, a very big folder.

Miguel.



El Sábado 30 de noviembre de 2013 11:18, Jambunathan K <kjambunathan@gmail.com> escribió:
 

Miguel Ruiz <rbenit68@yahoo.es> writes:

Remove all your configurations and try this.  This will use windows
"open".

(require 'org)  ;; Make sure org is loaded

(defun org-default-apps ()
  "Return the default applications for this operating system."
  (cond
   ((eq system-type 'darwin)
    org-file-apps-defaults-macosx)
   ((memq system-type '(cygwin windows-nt)) ;;  <============
    org-file-apps-defaults-windowsnt)
   (t org-file-apps-defaults-gnu)))

> "cygstart %s"

Any reason why this one is preferable windows's default "open".  Is
cygstart a recent addition or is it available even on older
distributions.

> - How can redefine or supress 'system in (org-open-file
> (org-odt-export-to-odt nil s v) 'system) line in ox-odt.el?

ODT files are zip files (can be opened in archive-mode) or they can be
opened in doc-view.

Use of 'system has generally not proved to be problematic in practice.
I think it is possible to accomplish what you want without touch or
modifying that particular line.


> - May I propose to developers to include (defconst
> org-file-apps-defaults-cygwin ... or similar?

It would be a good idea.

But, does the Emacs come from cygwin distribution or is it NT Emacs
(ftp://ftp.gnu.org/gnu/emacs/windows/).

----------------------------------------------------------------

Sorry, I am unable to provide concrete feedback.

As sometime user of Cygwin + Windows, I found that Cygwin is a pain and
started using native Windows Emacs and Gnu Win32 libraries.

I have now moved to Debian now.

[-- Attachment #2: Type: text/html, Size: 5877 bytes --]

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

* Re: Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
  2013-11-30 10:43   ` Miguel Ruiz
@ 2013-11-30 16:02     ` Jambunathan K
  2013-11-30 16:03       ` Jambunathan K
  0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-11-30 16:02 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode@gnu.org


Ignore my earlier suggestion.

> (if (eq system-type 'cygwin)
> (add-hook 'org-mode-hook
> '(lambda ()
> (delete '("\\.x?html?\\'" . default) org-file-apps)
> (add-to-list 'org-file-apps '("\\.x?html?\\'" . "cygstart %s"))
> (delete '("\\.pdf\\'" . default) org-file-apps)
> (add-to-list 'org-file-apps '("\\.pdf\\'" . "cygstart %s"))
> (delete '("\\.odt\\'" . default) org-file-apps)
> (add-to-list 'org-file-apps '("\\.odt\\'" . "cygstart %s")))))

You can also remove the above settings.

----------------------------------------------------------------

Use the following setting instead.

`org-default-apps' uses the value of `org-file-apps-defaults-gnu' for
cygwin as well.  You just need to remove the mailcap entry in that
variable and replace it with "cygstart" as below.

    (eval-after-load 'org
      '(when (eq system-type 'gnu/linux)
         (setcdr (assq 'system org-file-apps-defaults-gnu ) "cygstart %s")
         (setcdr (assq t org-file-apps-defaults-gnu ) "cygstart %s")))

----------------------------------------------------------------
         
As you rightly suggest, `org-default-apps' doesn't handle `system-type'
value of 'cygwin.

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

* Re: Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
  2013-11-30 16:02     ` Jambunathan K
@ 2013-11-30 16:03       ` Jambunathan K
  2013-12-01  9:44         ` Miguel Ruiz
  0 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2013-11-30 16:03 UTC (permalink / raw)
  To: Miguel Ruiz; +Cc: emacs-orgmode@gnu.org



Jambunathan K <kjambunathan@gmail.com> writes:

>     (eval-after-load 'org
>       '(when (eq system-type 'gnu/linux)
                                ^^^^^^^^^
                                ^^^^^^^^^
                                'cygwin
>          (setcdr (assq 'system org-file-apps-defaults-gnu ) "cygstart %s")
>          (setcdr (assq t org-file-apps-defaults-gnu ) "cygstart %s")))

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

* Re: Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
  2013-11-30 16:03       ` Jambunathan K
@ 2013-12-01  9:44         ` Miguel Ruiz
  2013-12-02  6:54           ` Jambunathan K
  0 siblings, 1 reply; 7+ messages in thread
From: Miguel Ruiz @ 2013-12-01  9:44 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1518 bytes --]

Thank you, Jambunathan.

I was exploring

(defconst org-file-apps-defaults-cygwin
  '((remote . emacs)
    (t . "cygstart %s")
    (system . "cygstart %s")
    ("ps.gz"  . "gv %s") 
    ("eps.gz" . "gv %s")
    ("dvi"    . "xdvi %s")
    ("fig"    . "xfig %s")))

(defun org-default-apps () "Return the default applications for this operating system." (cond ((eq system-type 'darwin)     org-file-apps-defaults-macosx)
((eq system-type 'cygwin)     org-file-apps-defaults-cygwin) 
 ((eq system-type 'windows-nt) org-file-apps-defaults-windowsnt)
   (t org-file-apps-defaults-gnu)))And it works for me so far. Your code is more compact but an ad-hoc solution as well. It is worth to take into consideration. Thanks again.

I suppose you would like to know I have also tweaked your directions about odt-mathml for cygwin:

(setq org-latex-to-mathml-convert-command 
  "java -jar $(cygpath -pw %j) -unicode -force -df %o %I")

(setq org-latex-to-mathml-jar-file 
"/home/user/tmp-odt/mathtoweb.jar")

with great success (Java 1.7 update 25, mathtoweb 4.0.0).

Miguel.







 


Jambunathan K <kjambunathan@gmail.com> writes:

>     (eval-after-load 'org
>       '(when (eq system-type 'gnu/linux)

                                ^^^^^^^^^
                       
         ^^^^^^^^^
                                'cygwin
>          (setcdr (assq 'system org-file-apps-defaults-gnu ) "cygstart %s")
>          (setcdr (assq t org-file-apps-defaults-gnu ) "cygstart %s")))

[-- Attachment #2: Type: text/html, Size: 6128 bytes --]

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

* Re: Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip
  2013-12-01  9:44         ` Miguel Ruiz
@ 2013-12-02  6:54           ` Jambunathan K
  0 siblings, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2013-12-02  6:54 UTC (permalink / raw)
  Cc: emacs-orgmode@gnu.org

Miguel Ruiz <rbenit68@yahoo.es> writes:

> (defconst org-file-apps-defaults-cygwin
> '((remote . emacs)
> (t . "cygstart %s")
> (system . "cygstart %s")
> ("ps.gz" . "gv %s") 
> ("eps.gz" . "gv %s")
> ("dvi" . "xdvi %s")
> ("fig" . "xfig %s")))
> (defun org-default-apps ()
>   "Return the default applications for this operating system."
>   (cond
>    ((eq system-type 'darwin)     org-file-apps-defaults-macosx)
>    ((eq system-type 'cygwin)     org-file-apps-defaults-cygwin) 
>    ((eq system-type 'windows-nt) org-file-apps-defaults-windowsnt)
>    (t org-file-apps-defaults-gnu)))

The cygwin issue your report should have been picked up by now.  It is a
good idea to do a

    M-x report-emacs-bug

so that this issue is recorded.

> I suppose you would like to know I have also tweaked your directions
> about odt-mathml for cygwin:
>
> (setq org-latex-to-mathml-convert-command 
> "java -jar $(cygpath -pw %j) -unicode -force -df %o %I")
> (setq org-latex-to-mathml-jar-file 
>   "/home/user/tmp-odt/mathtoweb.jar")

Thanks.  I see mathml has improved since I added support for it.  You
are the second ever user I heard from.  (Search for plasticml in the
mailing list to see the "other" mathml thread)

> with great success (Java 1.7 update 25, mathtoweb 4.0.0).

Good to hear that.

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

end of thread, other threads:[~2013-12-02  6:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-30  8:44 Cygwin (org-open-file (org-odt-export-to-odt nil s v) 'system) opens odt as zip Miguel Ruiz
2013-11-30 10:16 ` Jambunathan K
2013-11-30 10:43   ` Miguel Ruiz
2013-11-30 16:02     ` Jambunathan K
2013-11-30 16:03       ` Jambunathan K
2013-12-01  9:44         ` Miguel Ruiz
2013-12-02  6:54           ` Jambunathan K

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