[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/exec-path-from-shell 39aca32dda 001/114: Initial check-in
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/exec-path-from-shell 39aca32dda 001/114: Initial check-in |
Date: |
Tue, 5 Sep 2023 03:59:56 -0400 (EDT) |
branch: elpa/exec-path-from-shell
commit 39aca32dda87b843ec9deb53c7c6c5bb0f2458ef
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>
Initial check-in
---
.gitignore | 1 +
exec-path-from-shell.el | 86 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 87 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..1eb95fe886
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/exec-path-from-shell.elc
diff --git a/exec-path-from-shell.el b/exec-path-from-shell.el
new file mode 100644
index 0000000000..70bfb47cc1
--- /dev/null
+++ b/exec-path-from-shell.el
@@ -0,0 +1,86 @@
+;;; exec-path-from-shell.el --- Make Emacs use the $PATH set up by the user's
shell
+
+;; Copyright (C) 2012 Steve Purcell
+
+;; Author: Steve Purcell <steve@sanityinc.com>
+;; Keywords: environment
+;; URL: https://github.com/purcell/exec-path-from-shell
+;; Version: DEV
+
+;; This file is not part of GNU Emacs.
+
+;; This file is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This file is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this file. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; On OS X (and perhaps elsewhere) the $PATH environment variable and
+;; `exec-path' used by a windowed Emacs instance will usually be the
+;; system-wide default path, rather than that seen in a terminal
+;; window.
+
+;; This library allows the user to set Emacs' `exec-path' and $PATH
+;; from the shell path, so that `shell-command', `compile' and the
+;; like work as expected.
+
+;; Installation:
+
+;; ELPA packages are available on Marmalade and Melpa. Alternatively, place
+;; this file on a directory in your `load-path', and explicitly require it.
+
+;; Usage:
+;;
+;; (require 'exec-path-from-shell) ;; if not using the ELPA package
+;; (exec-path-from-shell-initialize)
+;;
+;; If you use your Emacs config on other platforms, you can instead
+;; make initialization conditional as follows:
+;;
+;; (when (and window-system (eq system-type 'darwin))
+;; (exec-path-from-shell-initialize))
+;;
+;; To copy the values of other environment variables, you can use
+;; `exec-path-from-shell-copy-env', e.g.
+;;
+;; (exec-path-from-shell-copy-env "PYTHONPATH")
+
+;;; Code:
+
+(defun exec-path-from-shell-getenv (name)
+ (replace-regexp-in-string
+ "[ \t\n]*$" ""
+ (shell-command-to-string (format "$SHELL --login -i -c 'echo $%s'" name))))
+
+(defun exec-path-from-shell-copy-env (name)
+ "Set the environment variable with `NAME' to match the value seen in the
user's shell."
+ (interactive "sCopy value of which environment variable from shell? ")
+ (setenv name (exec-path-from-shell-getenv name)))
+
+(defun exec-path-from-shell-initialize ()
+ "Set the PATH environment variable and `exec-path' to match that seen in the
user's shell."
+ (interactive)
+ (let ((path-from-shell (exec-path-from-shell-getenv "PATH")))
+ (setenv "PATH" path-from-shell)
+ (setq exec-path (split-string path-from-shell path-separator))))
+
+
+(provide 'exec-path-from-shell)
+
+;; Local Variables:
+;; coding: utf-8
+;; indent-tabs-mode: nil
+;; mangle-whitespace: t
+;; require-final-newline: t;; eval: (checkdoc-minor-mode 1)
+;; End:
+
+;;; exec-path-from-shell.el ends here
- [nongnu] elpa/exec-path-from-shell d8aa7765a1 084/114: Merge pull request #82 from mernst/installation-instructions, (continued)
- [nongnu] elpa/exec-path-from-shell d8aa7765a1 084/114: Merge pull request #82 from mernst/installation-instructions, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 53ca76b97f 089/114: Link to flowbok article about shell startup files, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 3cfedb8791 088/114: Merge pull request #90 from lassik/error-if-remote, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 2d152d1781 095/114: Clarify what the sample usage snippet does, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell ad68d36747 102/114: Instead of checking startup files, just warn if execution is slow, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 6336db9be1 111/114: Add Emacs 28.1 to CI matrix, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 03fc0a38af 114/114: Release 2.1, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell d17c4e0b73 094/114: Notes about increasing speed, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 81125c5adb 093/114: Add FUNDING.yml, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell e1f14450f1 098/114: Fix MELPA URL, add author footer, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 39aca32dda 001/114: Initial check-in,
ELPA Syncer <=
- [nongnu] elpa/exec-path-from-shell 9c25f03459 006/114: Simplify initialization, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 0b81e0bf05 007/114: Copy $MANPATH on initialization, too, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell f349bc25aa 009/114: Merge pull request #2 from lunaryorn/init-manpath, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell f88aa7edec 010/114: Make the list of copied variables customizable. (See #2), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell ed17558245 011/114: Fix local variables block formatting, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 3b280d3093 013/114: Set all variables using just one shell invocation, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 4b2f672301 020/114: Make use of printf safer, in case env var values contain escapes (see #5), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 89aed99c12 021/114: Can now single-quote format argument to printf, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 2b6651242f 018/114: Unambigiously escape the null character (fixes #5), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 9f034cdb97 022/114: Explicitly double-quote args, so empty var values don't mess things up, ELPA Syncer, 2023/09/05