changeset 27834:ef6378f8e420

Document order in which multiple directories are processed by addpath. * load-path.cc (Faddpath): Document order in which multiple directories are processed.
author Philip Nienhuis <prnienhuis@users.sf.net>
date Sat, 14 Dec 2019 22:41:20 +0100
parents c0ff4cb335a0
children 8b514b304be8
files libinterp/corefcn/load-path.cc
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/load-path.cc	Sat Dec 14 22:33:34 2019 +0100
+++ b/libinterp/corefcn/load-path.cc	Sat Dec 14 22:41:20 2019 +0100
@@ -2487,10 +2487,10 @@
 @deftypefnx {} {} addpath (@var{dir1}, @dots{}, @var{option})
 Add named directories to the function search path.
 
-If @var{option} is @qcode{"-begin"} or 0 (the default), prepend the
-directory name to the current path.  If @var{option} is @qcode{"-end"}
-or 1, append the directory name to the current path.
-Directories added to the path must exist.
+If @var{option} is @qcode{"-begin"} or 0 (the default), prepend the directory
+name(s) to the current path.  If @var{option} is @qcode{"-end"} or 1, append
+the directory name(s) to the current path.  Directories added to the path must
+exist.
 
 In addition to accepting individual directory arguments, lists of
 directory names separated by @code{pathsep} are also accepted.  For example:
@@ -2499,6 +2499,12 @@
 addpath ("dir1:/dir2:~/dir3")
 @end example
 
+The newly added paths appear in the load path in the same order that they
+appear in the arguments of @code{addpath}.  When extending the load path to
+the front, the last path in the list of arguments is added first.  When
+extending the load path to the end, the first path in the list of arguments
+is added first.
+
 For each directory that is added, and that was not already in the path,
 @code{addpath} checks for the existence of a file named @file{PKG_ADD}
 (note lack of .m extension) and runs it if it exists.