comparison src/emacs.c @ 112132:4ef5cb86f2e8

Add --no-site-lisp option, make -Q use it. (Bug#5707) * lisp/Makefile.in (EMACSOPT): Add --no-site-lisp. * src/emacs.c (no_site_lisp): New int. (USAGE1): Add --no-site-lisp, mention -Q uses it. (main): Set no_site_lisp. (standard_args): Add --no-site-lisp. * src/lisp.h (no_site_lisp): New int. * src/lread.c (init_lread): If no_site_lisp, don't re-add site-lisp directories to Vload_path. * etc/NEWS: Mention --no-site-lisp.
author Glenn Morris <rgm@gnu.org>
date Thu, 06 Jan 2011 19:10:39 -0800
parents 5284aa9ea62d
children 826bb901e88b
comparison
equal deleted inserted replaced
112131:e0859218f943 112132:4ef5cb86f2e8
228 228
229 int noninteractive1; 229 int noninteractive1;
230 230
231 /* Nonzero means Emacs was run in --quick mode. */ 231 /* Nonzero means Emacs was run in --quick mode. */
232 int inhibit_x_resources; 232 int inhibit_x_resources;
233
234 /* Nonzero means remove site-lisp directories from load-path. */
235 int no_site_lisp;
233 236
234 /* Name for the server started by the daemon.*/ 237 /* Name for the server started by the daemon.*/
235 static char *daemon_name; 238 static char *daemon_name;
236 239
237 /* Pipe used to send exit notification to the daemon parent at 240 /* Pipe used to send exit notification to the daemon parent at
266 --display, -d DISPLAY use X server DISPLAY\n\ 269 --display, -d DISPLAY use X server DISPLAY\n\
267 --no-desktop do not load a saved desktop\n\ 270 --no-desktop do not load a saved desktop\n\
268 --no-init-file, -q load neither ~/.emacs nor default.el\n\ 271 --no-init-file, -q load neither ~/.emacs nor default.el\n\
269 --no-shared-memory, -nl do not use shared memory\n\ 272 --no-shared-memory, -nl do not use shared memory\n\
270 --no-site-file do not load site-start.el\n\ 273 --no-site-file do not load site-start.el\n\
274 --no-site-lisp, -nsl do not add site-lisp directories to load-path\n\
271 --no-splash do not display a splash screen on startup\n\ 275 --no-splash do not display a splash screen on startup\n\
272 --no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\ 276 --no-window-system, -nw do not communicate with X, ignoring $DISPLAY\n\
273 --quick, -Q equivalent to -q --no-site-file --no-splash\n\ 277 --quick, -Q equivalent to:\n\
278 -q --no-site-file --no-site-lisp --no-splash\n\
274 --script FILE run FILE as an Emacs Lisp script\n\ 279 --script FILE run FILE as an Emacs Lisp script\n\
275 --terminal, -t DEVICE use DEVICE for terminal I/O\n\ 280 --terminal, -t DEVICE use DEVICE for terminal I/O\n\
276 --user, -u USER load ~USER/.emacs instead of your own\n\ 281 --user, -u USER load ~USER/.emacs instead of your own\n\
277 \n%s" 282 \n%s"
278 283
1339 running_asynch_code = 0; 1344 running_asynch_code = 0;
1340 1345
1341 no_loadup 1346 no_loadup
1342 = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); 1347 = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args);
1343 1348
1349 no_site_lisp
1350 = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args);
1351
1344 #ifdef HAVE_NS 1352 #ifdef HAVE_NS
1345 ns_alloc_autorelease_pool(); 1353 ns_alloc_autorelease_pool();
1346 if (!noninteractive) 1354 if (!noninteractive)
1347 { 1355 {
1348 #ifdef NS_IMPL_COCOA 1356 #ifdef NS_IMPL_COCOA
1407 /* Change --display to -d, when its arg is separate. */ 1415 /* Change --display to -d, when its arg is separate. */
1408 else if (displayname != 0 && skip_args > count_before 1416 else if (displayname != 0 && skip_args > count_before
1409 && argv[count_before + 1][1] == '-') 1417 && argv[count_before + 1][1] == '-')
1410 argv[count_before + 1] = "-d"; 1418 argv[count_before + 1] = "-d";
1411 1419
1420 if (! no_site_lisp)
1421 {
1422 if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args)
1423 || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args))
1424 no_site_lisp = 1;
1425 }
1426
1412 /* Don't actually discard this arg. */ 1427 /* Don't actually discard this arg. */
1428 skip_args = count_before;
1429 }
1430 #else /* !HAVE_X_WINDOWS */
1431 if (! no_site_lisp)
1432 {
1433 int count_before = skip_args;
1434
1435 if (argmatch (argv, argc, "-Q", "--quick", 3, NULL, &skip_args)
1436 || argmatch (argv, argc, "-quick", 0, 2, NULL, &skip_args))
1437 no_site_lisp = 1;
1438
1413 skip_args = count_before; 1439 skip_args = count_before;
1414 } 1440 }
1415 #endif 1441 #endif
1416 1442
1417 /* argmatch must not be used after here, 1443 /* argmatch must not be used after here,
1741 { "-batch", "--batch", 100, 0 }, 1767 { "-batch", "--batch", 100, 0 },
1742 { "-script", "--script", 100, 1 }, 1768 { "-script", "--script", 100, 1 },
1743 { "-daemon", "--daemon", 99, 0 }, 1769 { "-daemon", "--daemon", 99, 0 },
1744 { "-help", "--help", 90, 0 }, 1770 { "-help", "--help", 90, 0 },
1745 { "-nl", "--no-loadup", 70, 0 }, 1771 { "-nl", "--no-loadup", 70, 0 },
1772 { "-nsl", "--no-site-lisp", 65, 0 },
1746 /* -d must come last before the options handled in startup.el. */ 1773 /* -d must come last before the options handled in startup.el. */
1747 { "-d", "--display", 60, 1 }, 1774 { "-d", "--display", 60, 1 },
1748 { "-display", 0, 60, 1 }, 1775 { "-display", 0, 60, 1 },
1749 /* Now for the options handled in `command-line' (startup.el). */ 1776 /* Now for the options handled in `command-line' (startup.el). */
1777 /* (Note that to imply -nsl, -Q is partially handled here.) */
1750 { "-Q", "--quick", 55, 0 }, 1778 { "-Q", "--quick", 55, 0 },
1751 { "-quick", 0, 55, 0 }, 1779 { "-quick", 0, 55, 0 },
1752 { "-q", "--no-init-file", 50, 0 }, 1780 { "-q", "--no-init-file", 50, 0 },
1753 { "-no-init-file", 0, 50, 0 }, 1781 { "-no-init-file", 0, 50, 0 },
1754 { "-no-site-file", "--no-site-file", 40, 0 }, 1782 { "-no-site-file", "--no-site-file", 40, 0 },