Skip to content

Commit cf424aa

Browse files
committed
config option renamed and add-path reviewed
1 parent 9f5864b commit cf424aa

File tree

3 files changed

+28
-30
lines changed

3 files changed

+28
-30
lines changed

init/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ comp_lint_opts := -a -i --all --icase
136136
comp_modtosh_opts := --auto --no-auto --force -f --icase -i
137137
comp_path_opts := -d --delim --duplicates
138138
comp_rm_path_opts := -d --delim --index
139-
comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277 lmod_path_rule
139+
comp_config_opts := --dump-state --reset abort_on_error advanced_version_spec auto_handling avail_indepth avail_output avail_terse_output cache_buffer_bytes cache_expiry_secs collection_pin_version collection_pin_tag collection_target color colors conflict_unload contact editor extended_default extra_siteconfig hide_auto_loaded home icase ignore_cache ignore_user_rc implicit_default implicit_requirement list_output list_terse_output locked_configs logged_events logger mcookie_check mcookie_version_check ml nearly_forbidden_days pager protected_envvars quarantine_support rcfile redirect_output require_via reset_target_state run_quarantine search_match set_shell_startup shells_with_ksh_fpath silent_shell_debug source_cache spider_indepth spider_output spider_terse_output sticky_purge tag_abbrev tag_color_name tcl_linter term_background term_width unique_name_loaded unload_match_order variant_shortcut verbosity wa_277 path_entry_reorder
140140

141141
define translate-in-script
142142
$(ECHO_GEN)
@@ -167,7 +167,7 @@ sed -e 's|@prefix@|$(prefix)|g' \
167167
-e 's|@comp_path_opts@|$(comp_path_opts)|g' \
168168
-e 's|@comp_rm_path_opts@|$(comp_rm_path_opts)|g' \
169169
-e 's|@comp_config_opts@|$(comp_config_opts)|g' \
170-
-e 's|@comp_lmod_path_rule@|$(comp_lmod_path_rule)|g' \
170+
-e 's|@comp_path_entry_reorder@|$(comp_path_entry_reorder)|g' \
171171
-e '$(setzshfpathre)' \
172172
-e $$'s|@modulerc@|$(modulerc)|g' \
173173
-e 's|@modulepath@|$(modulepath)|g' \

tcl/envmngt.tcl.in

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ proc add-path {cmd mode dflbhv args} {
17961796
set bhv $dflbhv
17971797
} else {
17981798
lassign [parsePathCommandArgs $cmd $mode $dflbhv {*}$args] separator\
1799-
allow_dup idx_val ign_refcount val_set_is_delim glob_match bhv var\
1799+
allow_dup idx_val ign_refcount val_set_is_delim glob_match bhv var\
18001800
path_list
18011801
}
18021802

@@ -1815,33 +1815,29 @@ proc add-path {cmd mode dflbhv args} {
18151815

18161816
set val [get-env $var]
18171817

1818-
if {[getConf lmod_path_rule]} {
1819-
set mpath_list [split $val $separator]
1820-
foreach dir $path_list {
1821-
if {$bhv eq {prepend}} {
1822-
set mpath_list "$dir [lsearch -inline -all -not -exact\
1823-
$mpath_list $dir]"
1824-
} else {
1825-
set mpath_list "[lsearch -inline -all -not -exact\
1826-
$mpath_list $dir] $dir"
1818+
foreach dir $path_list {
1819+
set dir_removed 0
1820+
if {[getConf path_entry_reorder]} {
1821+
if {[info exists countarr($dir)] && ! $allow_dup} {
1822+
# remove dir if in $val and duplicates are not allowed
1823+
set mpath_list [split $val $separator]
1824+
set mpath_list [lsearch -inline -all -not -exact $mpath_list $dir]
1825+
set val [join $mpath_list $separator]
1826+
set countarr($dir) 0
1827+
set dir_removed 1
18271828
}
1828-
set val [join $mpath_list $separator]
18291829
}
1830-
set countarr($dir) 1
1831-
} else {
1832-
foreach dir $path_list {
1833-
if {![info exists countarr($dir)] || $allow_dup} {
1834-
# ignore env var set empty if no empty entry found in reference
1835-
# counter array (sometimes var is cleared by setting it empty not
1836-
# unsetting it)
1837-
if {$val ne {} || [info exists countarr()]} {
1838-
set sep [expr {$val eq $separator ? {} : $separator}]
1839-
set val [expr {$bhv eq {prepend} ? "$dir$sep$val" :\
1840-
"$val$sep$dir"}]
1830+
if {![info exists countarr($dir)] || $dir_removed || $allow_dup} {
1831+
# ignore env var set empty if no empty entry found in reference
1832+
# counter array (sometimes var is cleared by setting it empty not
1833+
# unsetting it)
1834+
if {$val ne {} || [info exists countarr()]} {
1835+
set sep [expr {$val eq $separator ? {} : $separator}]
1836+
set val [expr {$bhv eq {prepend} ? "$dir$sep$val" :\
1837+
"$val$sep$dir"}]
18411838
} else {
18421839
set val $dir
18431840
}
1844-
}
18451841
}
18461842
if {[info exists countarr($dir)]} {
18471843
# do not increase counter if bare separator string is added or if
@@ -2069,8 +2065,10 @@ proc getModulesEnvVarGlobList {{loaded_ctx 0}} {
20692065
return $envvar_glob_list
20702066
}
20712067

2072-
# Local Variables:
2073-
# Mode: tcl-mode
2074-
# tcl-indent-level: 3
2075-
# End:
2068+
# ;;; Local Variables:
2069+
# ;;; Mode: tcl-mode
2070+
# ;;; tcl-indent-level: 3
2071+
# ;;; tcl-continued-indent-level: 3
2072+
# ;;; indent-tabs-mode: nil
2073+
# ;;; End:
20762074
# vim:set tabstop=3 shiftwidth=3 expandtab autoindent:

tcl/init.tcl.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ array set g_config_defs [list\
111111
alias indesym sym tag hidden key} {} {} eltlist}\
112112
list_terse_output {MODULES_LIST_TERSE_OUTPUT {@listterseoutput@} 0 l\
113113
{header idx variant alias indesym sym tag hidden key} {} {} eltlist}\
114-
lmod_path_rule {MODULES_LMOD_PATH_RULE 1 0 b {0 1}}\
114+
path_entry_reorder {MODULES_PATH_ENTRY_REORDER 1 0 b {0 1}}\
115115
locked_configs {{} {@lockedconfigs@} 0 o}\
116116
logged_events {MODULES_LOGGED_EVENTS {@loggedevents@} 1 l {auto_eval\
117117
requested_eval requested_cmd} {} {} eltlist}\

0 commit comments

Comments
 (0)