GNU bug report logs - #22091
[PATCH 1/2] * lisp/env.el: Add (whereis-command)

Previous Next

Package: emacs;

Reported by: lu4nx <lx <at> shellcodes.org>

Date: Fri, 4 Dec 2015 07:27:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 25.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: lu4nx <lx <at> shellcodes.org>
To: bug-gnu-emacs <at> gnu.org
Cc: lu4nx <lx <at> shellcodes.org>
Subject: [PATCH 1/2] * lisp/env.el: Add (whereis-command)
Date: Fri,  4 Dec 2015 14:25:12 +0800
---
 lisp/env.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/env.el b/lisp/env.el
index 3966ab1..a16f534 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -218,6 +218,13 @@ in the environment list of the selected frame."
       (message "%s" (if value value "Not set")))
     value))
 
+(defun whereis-command (command)
+  (let ((paths (split-string (getenv "PATH") ":")))
+    (remove-if-not
+     (lambda (path)
+       (file-exists-p (format "%s/%s" path command)))
+     paths)))
+
 (provide 'env)
 
 ;;; env.el ends here
-- 
2.5.0







This bug report was last modified 9 years and 174 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.