Re: [O] org-program-exists vs executable-find
Da: Sebastien Vauban wxhgmqzgw...@spammotel.com Inviato: Venerdì 20 Aprile 2012 22:24 Bastien wrote: If there is an equivalent of `which' on windows let me know, Not that I know the command where [1][2] cheers, Giovanni [1] http://stackoverflow.com/questions/304319/is-there-an-equivalent-of-which-on-windows [2] http://superuser.com/questions/207707/what-is-windows-equivalent-of-which-command-in-linux-is-there-is-equivalent Some versions of Windows (I think Windows 2003 and up) have the where command: c:\where ping C:\Windows\System32\PING.EXE
Re: [O] org-program-exists vs executable-find
Sebastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes: Why not replacing it simply by `executable-find': I don't see what it adds to it? I would not say so if it was some upper abstraction, but I do feel they're simply the same. Actually `executable-find' is faster and already available, so yes, I removed ̀org-program-exists'. Thanks! -- Bastien
Re: [O] org-program-exists vs executable-find
Sebastien Vauban writes: Why not replacing it simply by `executable-find': I don't see what it adds to it? I would not say so if it was some upper abstraction, but I do feel they're simply the same. In principle, executable-find should (only) be used if the program in question is called directly from Emacs. If you invoke a shell to call a program, then that shell might have a completely different idea of what your path is and see different executables, so you'd have to check via the shell in this instance or provide the full absolute filename that executable-find gave you to the shell (which may have other problems when the path in Emacs and shell are indeed different). Regards, Achim. -- +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+ SD adaptation for Waldorf rackAttack V1.04R1: http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
Re: [O] org-program-exists vs executable-find
Hi Sébastien, Sebastien Vauban wxhgmqzgw...@spammotel.com writes: The name `org-program-exists' is actually misleading, it should be `org-executable-call' instead, while still checking if the executable exists before calling it. Nope, the name is not misleading. The documentation string is false -- what I hadn't noticed, btw. That function just checks if the executable can be found; it does _not_ call it afterward. You're right, I just fixed the docstring. On Linux and Mac OS, it just calls which + program name, no more... On Windows, it simply fails immediately (even if the program could be found). If there is an equivalent of `which' on windows let me know, we can generalize this function. Thanks, -- Bastien
Re: [O] org-program-exists vs executable-find
Hi Bastien, Bastien wrote: Sebastien Vauban wxhgmqzgw...@spammotel.com writes: The name `org-program-exists' is actually misleading, it should be `org-executable-call' instead, while still checking if the executable exists before calling it. Nope, the name is not misleading. The documentation string is false -- what I hadn't noticed, btw. That function just checks if the executable can be found; it does _not_ call it afterward. You're right, I just fixed the docstring. On Linux and Mac OS, it just calls which + program name, no more... On Windows, it simply fails immediately (even if the program could be found). If there is an equivalent of `which' on windows let me know, Not that I know, reason why I (must) have Cygwin... we can generalize this function. Why not replacing it simply by `executable-find': I don't see what it adds to it? I would not say so if it was some upper abstraction, but I do feel they're simply the same. If not, the opposite should be done: replacing the 10 calls to `executable-find' by calls to `org-program-exists'... Best regards, Seb -- Sebastien Vauban
Re: [O] org-program-exists vs executable-find
Hi Sebastien Vauban wxhgmqzgw...@spammotel.com writes: Hi Bastien, Bastien wrote: Sebastien Vauban wxhgmqzgw...@spammotel.com writes: The name `org-program-exists' is actually misleading, it should be `org-executable-call' instead, while still checking if the executable exists before calling it. Nope, the name is not misleading. The documentation string is false -- what I hadn't noticed, btw. That function just checks if the executable can be found; it does _not_ call it afterward. You're right, I just fixed the docstring. On Linux and Mac OS, it just calls which + program name, no more... On Windows, it simply fails immediately (even if the program could be found). If there is an equivalent of `which' on windows let me know, Not that I know, reason why I (must) have Cygwin... we can generalize this function. Why not replacing it simply by `executable-find': I don't see what it adds to it? I would not say so if it was some upper abstraction, but I do feel they're simply the same. If not, the opposite should be done: replacing the 10 calls to `executable-find' by calls to `org-program-exists'... Best regards, Seb IIRC on Mac OS `which' is not guaranteed to work anyway, since by default the `which database' is not instantiated or maintained. I had to kick that off manually here to have use of `which'. Best, Martyn
[O] org-program-exists vs executable-find
Hello, While browsing the Org code, I've found the function `org-program-exists': #+begin_src emacs-lisp (defun org-program-exists (program-name) Checks whenever we can locate program and launch it. (if (member system-type '(gnu/linux darwin)) (= 0 (call-process which nil nil nil program-name #+end_src It is used 3 times in `org-clock.el', nowhere else. On the contrary, `executable-find' is used 10 times in the Org code base (in 4 different libraries). Shouldn't we better use `executable-find' everywhere, instead of `org-program-exists' (which, btw, fails on Windows systems, even when they have the Cygwin `which' at their disposal)? I'm ready to submit a patch for this. Best regards, Seb -- Sebastien Vauban
Re: [O] org-program-exists vs executable-find
Hi Sébastien, Sebastien Vauban wxhgmqzgw...@spammotel.com writes: While browsing the Org code, I've found the function `org-program-exists': #+begin_src emacs-lisp (defun org-program-exists (program-name) Checks whenever we can locate program and launch it. (if (member system-type '(gnu/linux darwin)) (= 0 (call-process which nil nil nil program-name #+end_src It is used 3 times in `org-clock.el', nowhere else. The name `org-program-exists' is actually misleading, it should be `org-executable-call' instead, while still checking if the executable exists before calling it. On the contrary, `executable-find' is used 10 times in the Org code base (in 4 different libraries). Shouldn't we better use `executable-find' everywhere, instead of `org-program-exists' (which, btw, fails on Windows systems, even when they have the Cygwin `which' at their disposal)? I'm ready to submit a patch for this. Please submit a patch using `executable-find' in `org-executable-call'. ̀executable-find' takes care of (gnu/linux|darwin-windows). Also add an alias org-program-exists - org-executable-call in case people are using org-program-exists in their programs. Thanks! -- Bastien
Re: [O] org-program-exists vs executable-find
Hi Bastien, Bastien wrote: Sebastien Vauban wxhgmqzgw...@spammotel.com writes: While browsing the Org code, I've found the function `org-program-exists': #+begin_src emacs-lisp (defun org-program-exists (program-name) Checks whenever we can locate program and launch it. (if (member system-type '(gnu/linux darwin)) (= 0 (call-process which nil nil nil program-name #+end_src It is used 3 times in `org-clock.el', nowhere else. The name `org-program-exists' is actually misleading, it should be `org-executable-call' instead, while still checking if the executable exists before calling it. Nope, the name is not misleading. The documentation string is false -- what I hadn't noticed, btw. That function just checks if the executable can be found; it does _not_ call it afterward. On Linux and Mac OS, it just calls which + program name, no more... On Windows, it simply fails immediately (even if the program could be found). On the contrary, `executable-find' is used 10 times in the Org code base (in 4 different libraries). Shouldn't we better use `executable-find' everywhere, instead of `org-program-exists' (which, btw, fails on Windows systems, even when they have the Cygwin `which' at their disposal)? I'm ready to submit a patch for this. Please submit a patch using `executable-find' in `org-executable-call'. ̀executable-find' takes care of (gnu/linux|darwin-windows). Also add an alias org-program-exists - org-executable-call in case people are using org-program-exists in their programs. Best regards, Seb -- Sebastien Vauban