From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: org-program-exists vs executable-find Date: Wed, 18 Apr 2012 15:25:45 +0200 Message-ID: <874nshjhnq.fsf@altern.org> References: <80mx69us0v.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKUsF-0006u4-76 for emacs-orgmode@gnu.org; Wed, 18 Apr 2012 09:24:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SKUs8-00017h-8b for emacs-orgmode@gnu.org; Wed, 18 Apr 2012 09:24:42 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:64766) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SKUs7-00017Q-WC for emacs-orgmode@gnu.org; Wed, 18 Apr 2012 09:24:36 -0400 Received: by wgbdr1 with SMTP id dr1so5539172wgb.30 for ; Wed, 18 Apr 2012 06:24:34 -0700 (PDT) In-Reply-To: <80mx69us0v.fsf@somewhere.org> (Sebastien Vauban's message of "Wed, 18 Apr 2012 14:46:24 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: emacs-orgmode@gnu.org Hi Sébastien, "Sebastien Vauban" 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