* Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)]
@ 2019-12-27 14:56 Steve Miano
2019-12-27 17:25 ` Fabrice Popineau
0 siblings, 1 reply; 6+ messages in thread
From: Steve Miano @ 2019-12-27 14:56 UTC (permalink / raw)
To: emacs-orgmode
On WSL, using emacs 25.1, in org-mode there is a bug/design issue.
It the issue is:
When opening a link in org-mode using C-c C-o, org-open-at-point doesn't
work. It does find the browser, if you have set
(setq browse-url-firefox-program "/mnt/c/PROGRA~1/MOZILL~1/firefox.exe")
and does run the process, but it doesn't bring up a browser. You can
see the process in list-processes and if you run that command in the
console it works, but in org-mode the console never show and the
process remains.
The function browse-url-default-browse finds and runs the correct
browser. However, it runs the browser using the wrong command
depending on the case. If you are on WSL, without the graphical
interface, you need to run the shell-command to use the windows
browser. This is how it is done when it detects cygwin using
system-type. However, System-type cannot be used to detect WSL because
it doesn't find that you are on windows. The uname command detects it.
Obviously this isn't straight forward as in different situations you
want to do different things, graphical vs non-graphical. Perhaps
modify the function which sets system-type to return wsl then detect
graphical environment and use the non shell-command approach?
I humbly bring this to your attention. Thanks in advance.
Emacs : GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-09-15, modified by Debian
Package: Org mode version 9.1.14 (9.1.14-9-g131531-elpa @
/home/XXXX/.emacs.d/elpa/org-20181112/)
current state:
==============
(setq
org-src-lang-modes '(("python" . python) ("plantuml" . fundamental)
("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
("asymptote" . asy)
("dot" . fundamental) ("sqlite" . sql) ("calc" .
fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++) ("screen" . shell-script)
("shell" . sh) ("bash" . sh))
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-babel-results-keyword "results"
org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
org-occur-hook '(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-log-done t
org-confirm-shell-link-function 'yes-or-no-p
org-link-search-must-match-exact-headline nil
org-default-notes-file "~/org/notes.org"
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-from-is-user-regexp "\\<XXXXXX-XXXXXX\\>"
org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-table-use-standard-references t
org-font-lock-set-keywor
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)]
2019-12-27 14:56 Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)] Steve Miano
@ 2019-12-27 17:25 ` Fabrice Popineau
2019-12-27 17:28 ` Fabrice Popineau
2020-02-05 6:25 ` Bastien
0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Popineau @ 2019-12-27 17:25 UTC (permalink / raw)
To: Steve Miano; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 4027 bytes --]
Hi,
I had to solve this problem too.
I used these functions:
(defun w32-shell-execute (operation document &optional parameters
show-flag)
(if (and operation (not (string= "open" operation)))
(error "Don't know how to %s %s" operation document)
(call-process "/mnt/c/Windows/System32/cmd.exe" nil nil t "/c"
"start" "\"\""
(concat ""
(replace-regexp-in-string "^/mnt/c/" "c:/"
(replace-regexp-in-string "^\\(/mnt/c\\)?/home/Fabrice/" "c:/home/"
document))
""))))
(defun wsl-open-url (url &rest args)
(w32-shell-execute "open" url))
(setq browse-url-browser-function #'wsl-open-url)
(setq browse-url-mailto-function #'wsl-open-url)
Regards,
Fabrice
Le ven. 27 déc. 2019 à 18:10, Steve Miano <stevem995@comcast.net> a écrit :
> On WSL, using emacs 25.1, in org-mode there is a bug/design issue.
>
> It the issue is:
> When opening a link in org-mode using C-c C-o, org-open-at-point doesn't
> work. It does find the browser, if you have set
>
> (setq browse-url-firefox-program "/mnt/c/PROGRA~1/MOZILL~1/firefox.exe")
>
> and does run the process, but it doesn't bring up a browser. You can
> see the process in list-processes and if you run that command in the
> console it works, but in org-mode the console never show and the
> process remains.
>
> The function browse-url-default-browse finds and runs the correct
> browser. However, it runs the browser using the wrong command
> depending on the case. If you are on WSL, without the graphical
> interface, you need to run the shell-command to use the windows
> browser. This is how it is done when it detects cygwin using
> system-type. However, System-type cannot be used to detect WSL because
> it doesn't find that you are on windows. The uname command detects it.
>
> Obviously this isn't straight forward as in different situations you
> want to do different things, graphical vs non-graphical. Perhaps
> modify the function which sets system-type to return wsl then detect
> graphical environment and use the non shell-command approach?
>
> I humbly bring this to your attention. Thanks in advance.
>
>
> Emacs : GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
> of 2017-09-15, modified by Debian
> Package: Org mode version 9.1.14 (9.1.14-9-g131531-elpa @
> /home/XXXX/.emacs.d/elpa/org-20181112/)
>
> current state:
> ==============
> (setq
> org-src-lang-modes '(("python" . python) ("plantuml" . fundamental)
> ("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
> ("asymptote" . asy)
> ("dot" . fundamental) ("sqlite" . sql) ("calc" .
> fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++) ("screen" .
> shell-script)
> ("shell" . sh) ("bash" . sh))
> org-tab-first-hook '(org-babel-hide-result-toggle-maybe
> org-babel-header-arg-expand)
> org-babel-results-keyword "results"
> org-speed-command-hook '(org-speed-command-activate
> org-babel-speed-command-activate)
> org-occur-hook '(org-first-headline-recenter)
> org-metaup-hook '(org-babel-load-in-session-maybe)
> org-log-done t
> org-confirm-shell-link-function 'yes-or-no-p
> org-link-search-must-match-exact-headline nil
> org-default-notes-file "~/org/notes.org"
> org-after-todo-state-change-hook '(org-clock-out-if-current)
> org-from-is-user-regexp "\\<XXXXXX-XXXXXX\\>"
> org-src-mode-hook '(org-src-babel-configure-edit-buffer
> org-src-mode-configure-edit-buffer)
> org-agenda-before-write-hook '(org-agenda-add-entry-text)
> org-babel-pre-tangle-hook '(save-buffer)
> org-table-use-standard-references t
> org-font-lock-set-keywor
>
>
>
--
Fabrice Popineau
-----------------------------
CentraleSupelec
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------
[-- Attachment #2: Type: text/html, Size: 5715 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)]
2019-12-27 17:25 ` Fabrice Popineau
@ 2019-12-27 17:28 ` Fabrice Popineau
2020-02-05 6:25 ` Bastien
1 sibling, 0 replies; 6+ messages in thread
From: Fabrice Popineau @ 2019-12-27 17:28 UTC (permalink / raw)
To: Steve Miano; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 4798 bytes --]
Sent the message too quickly.
Obviously, you will have to adapt the paths in w32-shell-execute with your
own setup and the location of files you want to open.
WSL allows different options to mount your NTFS drive or to create links
between directories.
Regards,
Fabrice
Le ven. 27 déc. 2019 à 18:25, Fabrice Popineau <
fabrice.popineau@centralesupelec.fr> a écrit :
> Hi,
>
> I had to solve this problem too.
>
> I used these functions:
>
> (defun w32-shell-execute (operation document &optional parameters
> show-flag)
> (if (and operation (not (string= "open" operation)))
> (error "Don't know how to %s %s" operation document)
> (call-process "/mnt/c/Windows/System32/cmd.exe" nil nil t "/c"
> "start" "\"\""
> (concat ""
> (replace-regexp-in-string "^/mnt/c/" "c:/"
>
> (replace-regexp-in-string "^\\(/mnt/c\\)?/home/Fabrice/" "c:/home/"
> document))
> ""))))
> (defun wsl-open-url (url &rest args)
> (w32-shell-execute "open" url))
>
> (setq browse-url-browser-function #'wsl-open-url)
> (setq browse-url-mailto-function #'wsl-open-url)
>
> Regards,
>
> Fabrice
>
> Le ven. 27 déc. 2019 à 18:10, Steve Miano <stevem995@comcast.net> a
> écrit :
>
>> On WSL, using emacs 25.1, in org-mode there is a bug/design issue.
>>
>> It the issue is:
>> When opening a link in org-mode using C-c C-o, org-open-at-point doesn't
>> work. It does find the browser, if you have set
>>
>> (setq browse-url-firefox-program "/mnt/c/PROGRA~1/MOZILL~1/firefox.exe")
>>
>> and does run the process, but it doesn't bring up a browser. You can
>> see the process in list-processes and if you run that command in the
>> console it works, but in org-mode the console never show and the
>> process remains.
>>
>> The function browse-url-default-browse finds and runs the correct
>> browser. However, it runs the browser using the wrong command
>> depending on the case. If you are on WSL, without the graphical
>> interface, you need to run the shell-command to use the windows
>> browser. This is how it is done when it detects cygwin using
>> system-type. However, System-type cannot be used to detect WSL because
>> it doesn't find that you are on windows. The uname command detects it.
>>
>> Obviously this isn't straight forward as in different situations you
>> want to do different things, graphical vs non-graphical. Perhaps
>> modify the function which sets system-type to return wsl then detect
>> graphical environment and use the non shell-command approach?
>>
>> I humbly bring this to your attention. Thanks in advance.
>>
>>
>> Emacs : GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
>> of 2017-09-15, modified by Debian
>> Package: Org mode version 9.1.14 (9.1.14-9-g131531-elpa @
>> /home/XXXX/.emacs.d/elpa/org-20181112/)
>>
>> current state:
>> ==============
>> (setq
>> org-src-lang-modes '(("python" . python) ("plantuml" . fundamental)
>> ("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
>> ("asymptote" . asy)
>> ("dot" . fundamental) ("sqlite" . sql) ("calc" .
>> fundamental) ("C" . c) ("cpp" . c++) ("C++" . c++) ("screen" .
>> shell-script)
>> ("shell" . sh) ("bash" . sh))
>> org-tab-first-hook '(org-babel-hide-result-toggle-maybe
>> org-babel-header-arg-expand)
>> org-babel-results-keyword "results"
>> org-speed-command-hook '(org-speed-command-activate
>> org-babel-speed-command-activate)
>> org-occur-hook '(org-first-headline-recenter)
>> org-metaup-hook '(org-babel-load-in-session-maybe)
>> org-log-done t
>> org-confirm-shell-link-function 'yes-or-no-p
>> org-link-search-must-match-exact-headline nil
>> org-default-notes-file "~/org/notes.org"
>> org-after-todo-state-change-hook '(org-clock-out-if-current)
>> org-from-is-user-regexp "\\<XXXXXX-XXXXXX\\>"
>> org-src-mode-hook '(org-src-babel-configure-edit-buffer
>> org-src-mode-configure-edit-buffer)
>> org-agenda-before-write-hook '(org-agenda-add-entry-text)
>> org-babel-pre-tangle-hook '(save-buffer)
>> org-table-use-standard-references t
>> org-font-lock-set-keywor
>>
>>
>>
>
> --
> Fabrice Popineau
> -----------------------------
> CentraleSupelec
> Département Informatique
> 3, rue Joliot Curie
> 91192 Gif/Yvette Cedex
> Tel direct : +33 (0) 169851950
> Standard : +33 (0) 169851212
> ------------------------------
>
>
--
Fabrice Popineau
-----------------------------
CentraleSupelec
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
------------------------------
[-- Attachment #2: Type: text/html, Size: 7115 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)]
2019-12-27 17:25 ` Fabrice Popineau
2019-12-27 17:28 ` Fabrice Popineau
@ 2020-02-05 6:25 ` Bastien
2020-02-05 8:13 ` Fabrice Popineau
1 sibling, 1 reply; 6+ messages in thread
From: Bastien @ 2020-02-05 6:25 UTC (permalink / raw)
To: Fabrice Popineau; +Cc: emacs-orgmode, Steve Miano
Hi Steve,
thanks for reporting this issue. Can you or Fabrice suggests what
change should be done in Org, if any? Also, perhaps another solution
can be found by adapting `org-file-apps'?
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)]
2020-02-05 6:25 ` Bastien
@ 2020-02-05 8:13 ` Fabrice Popineau
2020-02-05 10:15 ` Bastien
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2020-02-05 8:13 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode, Steve Miano
[-- Attachment #1: Type: text/plain, Size: 846 bytes --]
Le mer. 5 févr. 2020 à 07:25, Bastien <bzg@gnu.org> a écrit :
> Hi Steve,
>
> thanks for reporting this issue. Can you or Fabrice suggests what
> change should be done in Org, if any? Also, perhaps another solution
> can be found by adapting `org-file-apps'?
>
>
I am not sure that it is an issue that should be solved by org-mode.
It is more a problem of setting up WSL such that it meets well
some expectations. Basically, you need an equivalent of xdg-open
which redirects requests to the w32 system.
The suggestion I made to solve the issue is working for me, but as you see,
it is a crude hack: the paths need to be adapted to each individual
setting.
If someone comes up with a cleaner, more general solution, solution,
it should be published somewhere as an example of how to setup things with
WSL.
Fabrice
[-- Attachment #2: Type: text/html, Size: 1316 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)]
2020-02-05 8:13 ` Fabrice Popineau
@ 2020-02-05 10:15 ` Bastien
0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2020-02-05 10:15 UTC (permalink / raw)
To: Fabrice Popineau; +Cc: emacs-orgmode, Steve Miano
Hi Fabrice,
Fabrice Popineau <fabrice.popineau@centralesupelec.fr> writes:
> I am not sure that it is an issue that should be solved by
> org-mode.
Thanks for taking the time to answer -- I'll leave this "bug" out of
my radar for now then.
Thanks,
--
Bastien
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-02-05 10:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-27 14:56 Bug: wsl org-open-at-point [9.1.14 (9.1.14-9-g131531-elpa @ /home/boss5/.emacs.d/elpa/org-20181112/)] Steve Miano
2019-12-27 17:25 ` Fabrice Popineau
2019-12-27 17:28 ` Fabrice Popineau
2020-02-05 6:25 ` Bastien
2020-02-05 8:13 ` Fabrice Popineau
2020-02-05 10:15 ` Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.