Skip to content

Commit d774996

Browse files
committed
doc: desc. refresh only modules requiring it
1 parent 7b5d8a4 commit d774996

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

NEWS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ Modules 5.2.0 (not yet released)
144144
terminology.
145145
* Mark loaded modules that could benefit from a refresh evaluation in the
146146
:envvar:`__MODULES_LMREFRESH` environment variable.
147+
* Optimize :subcmd:`refresh` sub-command to only evaluate loaded modules that
148+
defines volatile environment changes (shell completion, alias or function).
147149

148150
.. _Nagelfar: http://nagelfar.sourceforge.net/
149151
.. _ShellCheck: https://www.shellcheck.net/

doc/source/changes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,11 @@ The following module sub-commands appeared on Modules 5.
839839
* the :option:`--starts-with` and :option:`--contains` options are supported
840840
on this sub-command to provide the regular search match capabilities.
841841

842+
:subcmd:`refresh`
843+
844+
Starting Modules 5.2, only the loaded modules listed in the
845+
:envvar:`__MODULES_LMREFRESH` environment variables are refreshed.
846+
842847
:subcmd:`restore`
843848

844849
Starting Modules 5.2, initial environment is restored when specified

doc/source/module.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,16 +1686,20 @@ Module Sub-Commands
16861686
.. subcmd:: refresh
16871687

16881688
Force a refresh of all non-persistent components of currently loaded modules.
1689-
This should be used on derived shells where shell aliases or shell functions
1690-
need to be reinitialized but the environment variables have already been set
1691-
by the currently loaded modules.
1689+
This should be used on derived shells where shell completions, shell aliases
1690+
or shell functions need to be reinitialized but the environment variables
1691+
have already been set by the currently loaded modules.
16921692

16931693
Loaded modules are evaluated in ``refresh`` mode following their load order.
1694-
In this evaluation mode only the :mfcmd:`set-alias` and :mfcmd:`set-function`
1695-
modulefile commands will produce environment changes. Other modulefile
1696-
commands that produce environment changes (like :mfcmd:`setenv` or
1697-
:mfcmd:`append-path`) are ignored during a ``refresh`` evaluation as their
1698-
changes should already be applied.
1694+
In this evaluation mode only the :mfcmd:`complete`, :mfcmd:`set-alias` and
1695+
:mfcmd:`set-function` modulefile commands will produce environment changes.
1696+
Other modulefile commands that produce environment changes (like
1697+
:mfcmd:`setenv` or :mfcmd:`append-path`) are ignored during a ``refresh``
1698+
evaluation as their changes should already be applied.
1699+
1700+
Only the loaded modules defining non-persistent environment changes are
1701+
evaluated in ``refresh`` mode. Such loaded modules are listed in the
1702+
:envvar:`__MODULES_LMREFRESH` environment variable.
16991703

17001704
.. only:: html
17011705

@@ -1705,6 +1709,9 @@ Module Sub-Commands
17051709
.. versionchanged:: 5.0
17061710
Behavior of version 3.2 :subcmd:`refresh` sub-command restored
17071711

1712+
.. versionchanged:: 5.2
1713+
Only evaluate modules listed in :envvar:`__MODULES_LMREFRESH`
1714+
17081715
.. subcmd:: reload
17091716

17101717
Unload then load all loaded *modulefiles*.

0 commit comments

Comments
 (0)