unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: lu4nx <lx@shellcodes.org>
To: 22091@debbugs.gnu.org
Cc: lu4nx <lx@shellcodes.org>
Subject: bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command)
Date: Fri,  4 Dec 2015 14:25:12 +0800	[thread overview]
Message-ID: <1449210313-10200-1-git-send-email-lx@shellcodes.org> (raw)

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








             reply	other threads:[~2015-12-04  6:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04  6:25 lu4nx [this message]
2015-12-04  6:25 ` bug#22091: [PATCH 2/2] * lisp/net/net-utils.el: (ifconfig) function support `ip` command lu4nx
2015-12-04  8:03 ` bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command) Glenn Morris
2015-12-04  8:17   ` bug#22091: �ظ���bug#22091: " lux
2015-12-05  0:53     ` bug#22091: " Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449210313-10200-1-git-send-email-lx@shellcodes.org \
    --to=lx@shellcodes.org \
    --cc=22091@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).