Commit Graph

20 Commits

Author SHA1 Message Date
Arif Er 00f9ab19ac chore: update copyright headers to 2022
The script used to identify and update the change is added into the GitHub
workflows script directory. A workflow action can be created to trigger the
script to update the headers on the first of every new year. Possibly a task for
a consequent PR.
2022-06-03 17:32:20 +02:00
Thanh dd1e077c5d [core] enable lexical binding for all 2022-05-11 19:48:17 +02:00
Daniel Nicolai c5248ac465 fix issue #14919 (force-init-spacemacs-env fails)
Currently when running the env shell-command, emacs does so using its current
process-environment. Instead we should run the command with the
`initial-environment`, which fixes issue #14919.
2021-07-28 15:37:14 +02:00
syl20bnr 97cd83e169 Apply GPLv3 terms explicitly to all elisp files 2021-03-25 22:59:32 -04:00
syl20bnr d55a9e2e67 Update header for year 2021 2021-03-25 22:59:32 -04:00
William McBee 40c42e6af5 Support system-type 'cygwin
A minor change allowing environment variables to be stored when running Cygwin version of Emacs.
2021-02-28 22:17:07 +01:00
Lin Sun 722fa45ea1 [core-env] #14348 ignore env "DISPLAY" for .spacemacs.env 2021-02-22 23:46:20 +02:00
Brandon T. Willard ac3c3546a2 Fix misc. compilation warnings 2020-10-15 23:49:33 +02:00
Robert O'Connor 82ba73a1c0
update copyright to 2020 2020-09-23 21:25:01 +02:00
Alex d17492e6d5 [core] Fix append path from .spacemacs.env 2020-08-26 22:18:53 +02:00
Miciah Masters a55df96caa [core] Environment variable caching fixes
Fix several problems with environment variable caching.

First, if a shell printed extra output besides the command output,
spacemacs//init-spacemacs-env included the extra output in .spacemacs.env.
For example, a login shell could print a motd, which would be erroneously
included in .spacemacs.env.  To avoid this, spacemacs//init-spacemacs-env
now redirects the command output to a temporary file and then reads the
file.

Second, spacemacs//init-spacemacs-env sorted lines using the entire
"name=value" string for each line whereas the correct behavior is to sort
only on the "name" part.  To fix this, spacemacs//init-spacemacs-env now
uses sort-regexp-fields with an appropriate regexp to match the "name" part
and ignore the "value" part.

Third, although load-env-vars-set-env added all PATH settings in
.spacemacs.env to exec-path, it set PATH to the first PATH setting in
.spacemacs.env.  Now load-env-vars-set-env sets PATH from exec-path so that
it will reflect that combined value.

Fourth, load-env-vars-set-env set exec-path and PATH without consideration
to the operating system's directory separator.  Now load-env-vars-set-env
converts backslashes to forward slashes when adding path entries to
exec-path and converts forward slashes to backslashes when setting PATH on
platforms that use backslashes.

Fifth, load-env-vars-set-env now normalizes exec-path by deleting trailing
slashes from path entries, converting drive letters in path entries to
lower-case, and deleting duplicate path entries.

Sixth, Spacemacs no longer uses exec-path-from-shell, but a changelog entry
said that it did.  This commit corrects the changelog entry, deletes
another outdated entry, and merges two entries that covered the same
functionality.

Finally, this commit corrects several typos and tries to improve wording in
several docstrings, messages, and comments.

* CHANGELOG.develop: Delete mention of exec-path-from-shell, which
Spacemacs no longer uses by default.  Delete mention of
dotspacemacs-import-env-vars-from-shell and
dotspacemacs-import-env-vars-shell-file-name, which no longer exist.
Merge entries about synchronizing environment variables.
* core/core-env.el (spacemacs-ignored-environment-variables): Fix typos and
mention that the strings are regexps that are matched against the names of
environment variables.
(spacemacs//init-spacemacs-env): Use a temporary file rather than standard
output in order to avoid getting motd and other noise.  Sort lines using
only environment variables' names, not their values.  Better describe the
behavior with respect to spacemacs-ignored-environment-variables, duplicate
settings, and PATH.  Try to make wording clearer.
(spacemacs/edit-env): Fix typos in the docstring.
* core/libs/load-env-vars.el (load-env-vars-set-env): Fix typos in the
docstring.  Delete trailing slashes from path entries in exec-path, convert
drive letters to lower-case, delete duplicate path entries, and convert
backslashes to forward slashes when setting exec-path.  Set PATH from
exec-path, converting forward slashes to backslashes on platforms that use
backslashes.
2019-11-03 22:25:05 +01:00
sergeiz2 365c92bae5 Add force option to spacemacs//init-spacemacs-env call 2019-06-13 18:42:15 +02:00
sorawee 616ca1443d Fix a typo (overwite -> overwrite) 2018-07-24 00:27:15 +03:00
syl20bnr 7c9f612c4f core: try to fetch all env vars by calling the shell multiple times
Since bash will source different files depending on its mode, for instance
login vs. non-login shells, we fetch the env vars from both a login shell and
an interactive non-login shell. We try to cleanup the resulting file by removing
duplicates, sorting env vars etc...
2018-07-05 01:43:14 -04:00
Paolo G. Giarrusso f4506aa445 Extract env. vars from *login* shell
Bash needs the `-l` flag, as pointed out in 6220ace290 (r29480946) and https://github.com/syl20bnr/spacemacs/issues/10906#issuecomment-402184237.
2018-07-05 00:04:52 -04:00
syl20bnr ba2f692366 core: add GPG_AGENT_INFO and SSH_AGENT_PID to ignored env vars 2018-07-04 03:44:15 -04:00
syl20bnr ee5166949d core-env: add support for Windows
Fix fetching of env. vars on Microsoft Windows (tested with Windows 10 only)
2018-07-04 02:34:54 -04:00
et2010 e33638d920 Fix typo 2018-07-03 10:31:05 -04:00
syl20bnr a013d86874 core: update environment variables management
* add new dotfile function `dotspacemacs/user-env`
* add ignored env. vars with variable spacemacs-ignored-environment-variables
* ignore env vars: SSH_AUTH_SOCK and DBUS_SESSION_BUS_ADDRESS
* update documentation in DOCUMENTATION.org
* update .spacemacs.template with new function
* rename environment file from spacemacs.env to .spacemacs.env
* move location of .spacemacs.env file to home or dotdirectory
* add a header to the generated .spacemacs.env file to explain what it is
* make SPC f e e fallbacks to the function dotspacemacs/user-env if the user
  manages the env var by themselves
* make SPC f e E call the new function dotspacemacs/user-env
* sort environment variables in .spacemacs.env file
2018-07-03 01:25:28 -04:00
syl20bnr 6220ace290 core: rework environment variables and PATH management
See updated DOCUMENTATION.org and FAQ.org for more info.

* add core-env.el
* add library load-env-vars.el
* add bootstrap package dotenv-mode.el
* remove spacemacs-environment from bootstrap layer
* remove dotspacemacs variable dotspacemacs-import-env-vars-from-shell
* remove dotspacemacs variable dotspacemacs-improt-env-vars-shell-file-name
* add new key binding SPC f e e to open spacemacs.env file
* add new key binding SPC f e E to reload environment variable from env file
* add new key binding SPC f e C-e to re-initialize the env file from shell.
2018-06-25 02:55:28 -04:00