Skip to content

Commit 980901d

Browse files
committed
doc: desc hooks made with rename in module man
1 parent b665387 commit 980901d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

doc/source/module.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,6 +2638,22 @@ example setup a procedure that is executed before each modulefile evaluation:
26382638
}
26392639
trace add execution execute-modulefile enter beforeEval
26402640
2641+
Another possibility is to override the definition of an existing procedure by
2642+
first renaming its original version then creating a new procedure that will add
2643+
specific code and rely on the renamed original procedure for the rest. See
2644+
:manpage:`rename(n)` man page for details. As an example, the following code
2645+
adds a new query option to the :mfcmd:`module-info` modulefile command:
2646+
2647+
.. code-block:: tcl
2648+
2649+
rename module-info __module-info
2650+
proc module-info {what {more {}}} {
2651+
switch -- $what {
2652+
platform { return myhost-$::tcl_platform(machine) }
2653+
default { return [__module-info $what $more] }
2654+
}
2655+
}
2656+
26412657
Siteconfig hook variables
26422658
"""""""""""""""""""""""""
26432659

@@ -4125,7 +4141,6 @@ FILES
41254141
:envvar:`MODULES_SITECONFIG` environment variable. See :ref:`Site-specific
41264142
configuration` for detailed information.
41274143

4128-
41294144
|file etcdir_rc|
41304145

41314146
The system-wide modules rc file. The location of this file can be changed
@@ -4158,5 +4173,5 @@ FILES
41584173
SEE ALSO
41594174
--------
41604175

4161-
:ref:`ml(1)`, :ref:`modulefile(4)`, :manpage:`trace(n)`
4176+
:ref:`ml(1)`, :ref:`modulefile(4)`
41624177

0 commit comments

Comments
 (0)