diff options
| author | Glenn Morris | 2013-12-17 19:21:48 -0800 |
|---|---|---|
| committer | Glenn Morris | 2013-12-17 19:21:48 -0800 |
| commit | 1f41ee56ace98fe0d5f288c97ddb73870befed45 (patch) | |
| tree | 6bee6711c5e9c8d2cc03d102b8bd5e1b27ba13c7 | |
| parent | e82134b1e4efb363e21b1f9103af7ee5ec885ce4 (diff) | |
| download | emacs-1f41ee56ace98fe0d5f288c97ddb73870befed45.tar.gz emacs-1f41ee56ace98fe0d5f288c97ddb73870befed45.zip | |
Add load-prefer-newer option, to load .el if newer than .elc
* src/lread.c (Fload): Pass load_prefer_newer to openp.
Don't bother checking mtime if openp already did it.
(openp): Add `newer' argument, to check all suffixes
and find the newest file.
(syms_of_lread) <load_prefer_newer>: New option.
* src/callproc.c (call_process):
* src/charset.c (load_charset_map_from_file):
* src/emacs.c (init_cmdargs):
* src/image.c (x_create_bitmap_from_file, x_find_image_file):
* src/lisp.h (openp):
* lread.c (Flocate_file_internal):
* src/process.c (Fformat_network_address):
* src/sound.c (Fplay_sound_internal):
* src/w32.c (check_windows_init_file):
* src/w32proc.c (sys_spawnve): Update for new arg spec of openp.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): Set load-prefer-newer to t.
* etc/NEWS: Mention this.
Fixes: debbugs:2061
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/Makefile.in | 3 | ||||
| -rw-r--r-- | lisp/cus-start.el | 1 | ||||
| -rw-r--r-- | src/ChangeLog | 16 | ||||
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/charset.c | 20 | ||||
| -rw-r--r-- | src/emacs.c | 2 | ||||
| -rw-r--r-- | src/image.c | 4 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/lread.c | 121 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/sound.c | 2 | ||||
| -rw-r--r-- | src/w32.c | 5 | ||||
| -rw-r--r-- | src/w32proc.c | 5 |
15 files changed, 138 insertions, 58 deletions
| @@ -807,6 +807,11 @@ for something (not just adding elements to it), it ought not to affect you. | |||
| 807 | 807 | ||
| 808 | * Lisp Changes in Emacs 24.4 | 808 | * Lisp Changes in Emacs 24.4 |
| 809 | 809 | ||
| 810 | ** New option `load-prefer-newer', if non-nil, means that when both | ||
| 811 | .el and .elc versions of a file exist, rather than `load' always | ||
| 812 | choosing the .elc version, it will choose whichever is newer | ||
| 813 | (unless you explicitly specify one or the other). | ||
| 814 | |||
| 810 | ** New function get-pos-property. | 815 | ** New function get-pos-property. |
| 811 | 816 | ||
| 812 | ** New hook `pre-redisplay-function'. | 817 | ** New hook `pre-redisplay-function'. |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 126f10ae79b..435581799b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-12-18 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * Makefile.in (BYTE_COMPILE_FLAGS): Set load-prefer-newer to t. | ||
| 4 | |||
| 1 | 2013-12-18 Le Wang <l26wang@gmail.com> | 5 | 2013-12-18 Le Wang <l26wang@gmail.com> |
| 2 | 6 | ||
| 3 | * comint.el (comint-previous-matching-input-from-input): Retain | 7 | * comint.el (comint-previous-matching-input-from-input): Retain |
| @@ -9,6 +13,8 @@ | |||
| 9 | 13 | ||
| 10 | 2013-12-18 Glenn Morris <rgm@gnu.org> | 14 | 2013-12-18 Glenn Morris <rgm@gnu.org> |
| 11 | 15 | ||
| 16 | * cus-start.el (load-prefer-newer): New option. | ||
| 17 | |||
| 12 | * mail/emacsbug.el (report-emacs-bug): | 18 | * mail/emacsbug.el (report-emacs-bug): |
| 13 | Only mention enable-multibyte-characters if non-standard. | 19 | Only mention enable-multibyte-characters if non-standard. |
| 14 | 20 | ||
diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 2ac2f3e8d6b..39452edcbf4 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in | |||
| @@ -88,7 +88,8 @@ AUTOGEN_VCS = \ | |||
| 88 | BIG_STACK_DEPTH = 2200 | 88 | BIG_STACK_DEPTH = 2200 |
| 89 | BIG_STACK_OPTS = --eval "(setq max-lisp-eval-depth $(BIG_STACK_DEPTH))" | 89 | BIG_STACK_OPTS = --eval "(setq max-lisp-eval-depth $(BIG_STACK_DEPTH))" |
| 90 | 90 | ||
| 91 | BYTE_COMPILE_FLAGS = $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS) | 91 | # Set load-prefer-newer for the benefit of the non-bootstrappers. |
| 92 | BYTE_COMPILE_FLAGS = $(BIG_STACK_OPTS) --eval '(setq load-prefer-newer t)' $(BYTE_COMPILE_EXTRA_FLAGS) | ||
| 92 | 93 | ||
| 93 | # Files to compile before others during a bootstrap. This is done to | 94 | # Files to compile before others during a bootstrap. This is done to |
| 94 | # speed up the bootstrap process. They're ordered by size, so we use | 95 | # speed up the bootstrap process. They're ordered by size, so we use |
diff --git a/lisp/cus-start.el b/lisp/cus-start.el index 8e94e85f84c..32013b71125 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el | |||
| @@ -312,6 +312,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of | |||
| 312 | ;; :format "%[Current dir?%] %v" | 312 | ;; :format "%[Current dir?%] %v" |
| 313 | ;; (const :tag " current dir" nil) | 313 | ;; (const :tag " current dir" nil) |
| 314 | ;; (directory :format "%v")))) | 314 | ;; (directory :format "%v")))) |
| 315 | (load-prefer-newer lisp boolean "24.4") | ||
| 315 | ;; minibuf.c | 316 | ;; minibuf.c |
| 316 | (enable-recursive-minibuffers minibuffer boolean) | 317 | (enable-recursive-minibuffers minibuffer boolean) |
| 317 | (history-length minibuffer | 318 | (history-length minibuffer |
diff --git a/src/ChangeLog b/src/ChangeLog index 5933f145b48..937b5c7c4c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,21 @@ | |||
| 1 | 2013-12-18 Glenn Morris <rgm@gnu.org> | 1 | 2013-12-18 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * lread.c (Fload): Pass load_prefer_newer to openp. | ||
| 4 | Don't bother checking mtime if openp already did it. | ||
| 5 | (openp): Add `newer' argument, to check all suffixes | ||
| 6 | and find the newest file. | ||
| 7 | (syms_of_lread) <load_prefer_newer>: New option. (Bug#2061) | ||
| 8 | * callproc.c (call_process): | ||
| 9 | * charset.c (load_charset_map_from_file): | ||
| 10 | * emacs.c (init_cmdargs): | ||
| 11 | * image.c (x_create_bitmap_from_file, x_find_image_file): | ||
| 12 | * lisp.h (openp): | ||
| 13 | * lread.c (Flocate_file_internal): | ||
| 14 | * process.c (Fformat_network_address): | ||
| 15 | * sound.c (Fplay_sound_internal): | ||
| 16 | * w32.c (check_windows_init_file): | ||
| 17 | * w32proc.c (sys_spawnve): Update for new arg spec of openp. | ||
| 18 | |||
| 3 | * emacs.c (standard_args) [HAVE_NS]: Remove -disable-font-backend. | 19 | * emacs.c (standard_args) [HAVE_NS]: Remove -disable-font-backend. |
| 4 | 20 | ||
| 5 | 2013-12-17 Eli Zaretskii <eliz@gnu.org> | 21 | 2013-12-17 Eli Zaretskii <eliz@gnu.org> |
diff --git a/src/callproc.c b/src/callproc.c index b44f680b352..0d30fe549ea 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -465,7 +465,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 465 | int ok; | 465 | int ok; |
| 466 | 466 | ||
| 467 | GCPRO3 (buffer, current_dir, error_file); | 467 | GCPRO3 (buffer, current_dir, error_file); |
| 468 | ok = openp (Vexec_path, args[0], Vexec_suffixes, &path, make_number (X_OK)); | 468 | ok = openp (Vexec_path, args[0], Vexec_suffixes, &path, make_number (X_OK), 0); |
| 469 | UNGCPRO; | 469 | UNGCPRO; |
| 470 | if (ok < 0) | 470 | if (ok < 0) |
| 471 | report_file_error ("Searching for program", args[0]); | 471 | report_file_error ("Searching for program", args[0]); |
diff --git a/src/charset.c b/src/charset.c index 2ef060228ee..1e14475f111 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -1,13 +1,15 @@ | |||
| 1 | /* Basic character set support. | 1 | /* Basic character set support. |
| 2 | Copyright (C) 2001-2013 Free Software Foundation, Inc. | ||
| 3 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | ||
| 4 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 | ||
| 5 | National Institute of Advanced Industrial Science and Technology (AIST) | ||
| 6 | Registration Number H14PRO021 | ||
| 7 | 2 | ||
| 8 | Copyright (C) 2003, 2004 | 3 | Copyright (C) 2001-2013 Free Software Foundation, Inc. |
| 9 | National Institute of Advanced Industrial Science and Technology (AIST) | 4 | |
| 10 | Registration Number H13PRO009 | 5 | Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
| 6 | 2005, 2006, 2007, 2008, 2009, 2010, 2011 | ||
| 7 | National Institute of Advanced Industrial Science and Technology (AIST) | ||
| 8 | Registration Number H14PRO021 | ||
| 9 | |||
| 10 | Copyright (C) 2003, 2004 | ||
| 11 | National Institute of Advanced Industrial Science and Technology (AIST) | ||
| 12 | Registration Number H13PRO009 | ||
| 11 | 13 | ||
| 12 | This file is part of GNU Emacs. | 14 | This file is part of GNU Emacs. |
| 13 | 15 | ||
| @@ -493,7 +495,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, | |||
| 493 | count = SPECPDL_INDEX (); | 495 | count = SPECPDL_INDEX (); |
| 494 | record_unwind_protect_nothing (); | 496 | record_unwind_protect_nothing (); |
| 495 | specbind (Qfile_name_handler_alist, Qnil); | 497 | specbind (Qfile_name_handler_alist, Qnil); |
| 496 | fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil); | 498 | fd = openp (Vcharset_map_path, mapfile, suffixes, NULL, Qnil, 0); |
| 497 | fp = fd < 0 ? 0 : fdopen (fd, "r"); | 499 | fp = fd < 0 ? 0 : fdopen (fd, "r"); |
| 498 | if (!fp) | 500 | if (!fp) |
| 499 | { | 501 | { |
diff --git a/src/emacs.c b/src/emacs.c index 89e04b12b45..791e0524e15 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -424,7 +424,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) | |||
| 424 | { | 424 | { |
| 425 | Lisp_Object found; | 425 | Lisp_Object found; |
| 426 | int yes = openp (Vexec_path, Vinvocation_name, | 426 | int yes = openp (Vexec_path, Vinvocation_name, |
| 427 | Vexec_suffixes, &found, make_number (X_OK)); | 427 | Vexec_suffixes, &found, make_number (X_OK), 0); |
| 428 | if (yes == 1) | 428 | if (yes == 1) |
| 429 | { | 429 | { |
| 430 | /* Add /: to the front of the name | 430 | /* Add /: to the front of the name |
diff --git a/src/image.c b/src/image.c index e1c6e5df3cd..85f29329bd3 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -327,7 +327,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file) | |||
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | /* Search bitmap-file-path for the file, if appropriate. */ | 329 | /* Search bitmap-file-path for the file, if appropriate. */ |
| 330 | if (openp (Vx_bitmap_file_path, file, Qnil, &found, make_number (R_OK)) < 0) | 330 | if (openp (Vx_bitmap_file_path, file, Qnil, &found, make_number (R_OK), 0) < 0) |
| 331 | return -1; | 331 | return -1; |
| 332 | 332 | ||
| 333 | filename = SSDATA (found); | 333 | filename = SSDATA (found); |
| @@ -2242,7 +2242,7 @@ x_find_image_file (Lisp_Object file) | |||
| 2242 | Vx_bitmap_file_path); | 2242 | Vx_bitmap_file_path); |
| 2243 | 2243 | ||
| 2244 | /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ | 2244 | /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ |
| 2245 | fd = openp (search_path, file, Qnil, &file_found, Qnil); | 2245 | fd = openp (search_path, file, Qnil, &file_found, Qnil, 0); |
| 2246 | 2246 | ||
| 2247 | if (fd == -1) | 2247 | if (fd == -1) |
| 2248 | file_found = Qnil; | 2248 | file_found = Qnil; |
diff --git a/src/lisp.h b/src/lisp.h index 1e68b152dfc..e53d25b3fcb 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3791,7 +3791,7 @@ LOADHIST_ATTACH (Lisp_Object x) | |||
| 3791 | Vcurrent_load_list = Fcons (x, Vcurrent_load_list); | 3791 | Vcurrent_load_list = Fcons (x, Vcurrent_load_list); |
| 3792 | } | 3792 | } |
| 3793 | extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, | 3793 | extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, |
| 3794 | Lisp_Object *, Lisp_Object); | 3794 | Lisp_Object *, Lisp_Object, int); |
| 3795 | extern Lisp_Object string_to_number (char const *, int, bool); | 3795 | extern Lisp_Object string_to_number (char const *, int, bool); |
| 3796 | extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), | 3796 | extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), |
| 3797 | Lisp_Object); | 3797 | Lisp_Object); |
diff --git a/src/lread.c b/src/lread.c index 2bada06f2ad..c24af0cf9cd 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1129,7 +1129,7 @@ Return t if the file exists and loads successfully. */) | |||
| 1129 | } | 1129 | } |
| 1130 | } | 1130 | } |
| 1131 | 1131 | ||
| 1132 | fd = openp (Vload_path, file, suffixes, &found, Qnil); | 1132 | fd = openp (Vload_path, file, suffixes, &found, Qnil, load_prefer_newer); |
| 1133 | UNGCPRO; | 1133 | UNGCPRO; |
| 1134 | } | 1134 | } |
| 1135 | 1135 | ||
| @@ -1252,29 +1252,36 @@ Return t if the file exists and loads successfully. */) | |||
| 1252 | #ifdef DOS_NT | 1252 | #ifdef DOS_NT |
| 1253 | fmode = "rb"; | 1253 | fmode = "rb"; |
| 1254 | #endif /* DOS_NT */ | 1254 | #endif /* DOS_NT */ |
| 1255 | result = stat (SSDATA (efound), &s1); | ||
| 1256 | if (result == 0) | ||
| 1257 | { | ||
| 1258 | SSET (efound, SBYTES (efound) - 1, 0); | ||
| 1259 | result = stat (SSDATA (efound), &s2); | ||
| 1260 | SSET (efound, SBYTES (efound) - 1, 'c'); | ||
| 1261 | } | ||
| 1262 | 1255 | ||
| 1263 | if (result == 0 | 1256 | /* openp already checked for newness, no point doing it again. |
| 1264 | && timespec_cmp (get_stat_mtime (&s1), get_stat_mtime (&s2)) < 0) | 1257 | FIXME would be nice to get a message when openp |
| 1265 | { | 1258 | ignores suffix order due to load_prefer_newer. */ |
| 1266 | /* Make the progress messages mention that source is newer. */ | 1259 | if (!load_prefer_newer) |
| 1267 | newer = 1; | 1260 | { |
| 1261 | result = stat (SSDATA (efound), &s1); | ||
| 1262 | if (result == 0) | ||
| 1263 | { | ||
| 1264 | SSET (efound, SBYTES (efound) - 1, 0); | ||
| 1265 | result = stat (SSDATA (efound), &s2); | ||
| 1266 | SSET (efound, SBYTES (efound) - 1, 'c'); | ||
| 1267 | } | ||
| 1268 | 1268 | ||
| 1269 | /* If we won't print another message, mention this anyway. */ | 1269 | if (result == 0 |
| 1270 | if (!NILP (nomessage) && !force_load_messages) | 1270 | && timespec_cmp (get_stat_mtime (&s1), get_stat_mtime (&s2)) < 0) |
| 1271 | { | 1271 | { |
| 1272 | Lisp_Object msg_file; | 1272 | /* Make the progress messages mention that source is newer. */ |
| 1273 | msg_file = Fsubstring (found, make_number (0), make_number (-1)); | 1273 | newer = 1; |
| 1274 | message_with_string ("Source file `%s' newer than byte-compiled file", | 1274 | |
| 1275 | msg_file, 1); | 1275 | /* If we won't print another message, mention this anyway. */ |
| 1276 | } | 1276 | if (!NILP (nomessage) && !force_load_messages) |
| 1277 | } | 1277 | { |
| 1278 | Lisp_Object msg_file; | ||
| 1279 | msg_file = Fsubstring (found, make_number (0), make_number (-1)); | ||
| 1280 | message_with_string ("Source file `%s' newer than byte-compiled file", | ||
| 1281 | msg_file, 1); | ||
| 1282 | } | ||
| 1283 | } | ||
| 1284 | } /* !load_prefer_newer */ | ||
| 1278 | UNGCPRO; | 1285 | UNGCPRO; |
| 1279 | } | 1286 | } |
| 1280 | } | 1287 | } |
| @@ -1413,7 +1420,7 @@ directories, make sure the PREDICATE function returns `dir-ok' for them. */) | |||
| 1413 | (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) | 1420 | (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) |
| 1414 | { | 1421 | { |
| 1415 | Lisp_Object file; | 1422 | Lisp_Object file; |
| 1416 | int fd = openp (path, filename, suffixes, &file, predicate); | 1423 | int fd = openp (path, filename, suffixes, &file, predicate, 0); |
| 1417 | if (NILP (predicate) && fd >= 0) | 1424 | if (NILP (predicate) && fd >= 0) |
| 1418 | emacs_close (fd); | 1425 | emacs_close (fd); |
| 1419 | return file; | 1426 | return file; |
| @@ -1440,11 +1447,14 @@ static Lisp_Object Qdir_ok; | |||
| 1440 | nil is stored there on failure. | 1447 | nil is stored there on failure. |
| 1441 | 1448 | ||
| 1442 | If the file we find is remote, return -2 | 1449 | If the file we find is remote, return -2 |
| 1443 | but store the found remote file name in *STOREPTR. */ | 1450 | but store the found remote file name in *STOREPTR. |
| 1451 | |||
| 1452 | If NEWER is true, try all SUFFIXes and return the result for the | ||
| 1453 | newest file that exists. Does not apply to remote files. */ | ||
| 1444 | 1454 | ||
| 1445 | int | 1455 | int |
| 1446 | openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | 1456 | openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, |
| 1447 | Lisp_Object *storeptr, Lisp_Object predicate) | 1457 | Lisp_Object *storeptr, Lisp_Object predicate, int newer) |
| 1448 | { | 1458 | { |
| 1449 | ptrdiff_t fn_size = 100; | 1459 | ptrdiff_t fn_size = 100; |
| 1450 | char buf[100]; | 1460 | char buf[100]; |
| @@ -1453,9 +1463,11 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1453 | ptrdiff_t want_length; | 1463 | ptrdiff_t want_length; |
| 1454 | Lisp_Object filename; | 1464 | Lisp_Object filename; |
| 1455 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 1465 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 1456 | Lisp_Object string, tail, encoded_fn; | 1466 | Lisp_Object string, tail, encoded_fn, save_string; |
| 1457 | ptrdiff_t max_suffix_len = 0; | 1467 | ptrdiff_t max_suffix_len = 0; |
| 1458 | int last_errno = ENOENT; | 1468 | int last_errno = ENOENT; |
| 1469 | struct timespec save_mtime; | ||
| 1470 | int save_fd = 0; | ||
| 1459 | 1471 | ||
| 1460 | CHECK_STRING (str); | 1472 | CHECK_STRING (str); |
| 1461 | 1473 | ||
| @@ -1556,17 +1568,18 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1556 | 1568 | ||
| 1557 | if (exists) | 1569 | if (exists) |
| 1558 | { | 1570 | { |
| 1559 | /* We succeeded; return this descriptor and filename. */ | 1571 | /* We succeeded; return this descriptor and filename. */ |
| 1560 | if (storeptr) | 1572 | if (storeptr) |
| 1561 | *storeptr = string; | 1573 | *storeptr = string; |
| 1562 | UNGCPRO; | 1574 | UNGCPRO; |
| 1563 | return -2; | 1575 | return -2; |
| 1564 | } | 1576 | } |
| 1565 | } | 1577 | } |
| 1566 | else | 1578 | else |
| 1567 | { | 1579 | { |
| 1568 | int fd; | 1580 | int fd; |
| 1569 | const char *pfn; | 1581 | const char *pfn; |
| 1582 | struct stat st; | ||
| 1570 | 1583 | ||
| 1571 | encoded_fn = ENCODE_FILE (string); | 1584 | encoded_fn = ENCODE_FILE (string); |
| 1572 | pfn = SSDATA (encoded_fn); | 1585 | pfn = SSDATA (encoded_fn); |
| @@ -1597,7 +1610,6 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1597 | } | 1610 | } |
| 1598 | else | 1611 | else |
| 1599 | { | 1612 | { |
| 1600 | struct stat st; | ||
| 1601 | int err = (fstat (fd, &st) != 0 ? errno | 1613 | int err = (fstat (fd, &st) != 0 ? errno |
| 1602 | : S_ISDIR (st.st_mode) ? EISDIR : 0); | 1614 | : S_ISDIR (st.st_mode) ? EISDIR : 0); |
| 1603 | if (err) | 1615 | if (err) |
| @@ -1611,12 +1623,36 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1611 | 1623 | ||
| 1612 | if (fd >= 0) | 1624 | if (fd >= 0) |
| 1613 | { | 1625 | { |
| 1614 | /* We succeeded; return this descriptor and filename. */ | 1626 | if (newer) |
| 1615 | if (storeptr) | 1627 | { |
| 1616 | *storeptr = string; | 1628 | struct timespec mtime = get_stat_mtime (&st); |
| 1617 | UNGCPRO; | 1629 | |
| 1618 | return fd; | 1630 | if (!save_fd || timespec_cmp (save_mtime, mtime) < 0) |
| 1631 | { | ||
| 1632 | if (save_fd) emacs_close (save_fd); | ||
| 1633 | save_fd = fd; | ||
| 1634 | save_mtime = mtime; | ||
| 1635 | save_string = string; | ||
| 1636 | } | ||
| 1637 | } | ||
| 1638 | else | ||
| 1639 | { | ||
| 1640 | /* We succeeded; return this descriptor and filename. */ | ||
| 1641 | if (storeptr) | ||
| 1642 | *storeptr = string; | ||
| 1643 | UNGCPRO; | ||
| 1644 | return fd; | ||
| 1645 | } | ||
| 1619 | } | 1646 | } |
| 1647 | |||
| 1648 | /* No more suffixes. Return the newest. */ | ||
| 1649 | if (newer && save_fd && ! CONSP (XCDR (tail))) | ||
| 1650 | { | ||
| 1651 | if (storeptr) | ||
| 1652 | *storeptr = save_string; | ||
| 1653 | UNGCPRO; | ||
| 1654 | return save_fd; | ||
| 1655 | } | ||
| 1620 | } | 1656 | } |
| 1621 | } | 1657 | } |
| 1622 | if (absolute) | 1658 | if (absolute) |
| @@ -4632,6 +4668,17 @@ variables, this must be set in the first line of a file. */); | |||
| 4632 | Vold_style_backquotes = Qnil; | 4668 | Vold_style_backquotes = Qnil; |
| 4633 | DEFSYM (Qold_style_backquotes, "old-style-backquotes"); | 4669 | DEFSYM (Qold_style_backquotes, "old-style-backquotes"); |
| 4634 | 4670 | ||
| 4671 | DEFVAR_BOOL ("load-prefer-newer", load_prefer_newer, | ||
| 4672 | doc: /* Non-nil means `load' prefers the newest version of a file. | ||
| 4673 | This applies when a filename suffix is not explicitly specified and | ||
| 4674 | `load' is trying various possible suffixes (see `load-suffixes' and | ||
| 4675 | `load-file-rep-suffixes'). Normally, it stops at the first file | ||
| 4676 | that exists. If this option is non-nil, it checks all suffixes and | ||
| 4677 | uses whichever file is newest. | ||
| 4678 | Note that if you customize this, obviously it will not affect files | ||
| 4679 | that are loaded before your customizations are read! */); | ||
| 4680 | load_prefer_newer = 0; | ||
| 4681 | |||
| 4635 | /* Vsource_directory was initialized in init_lread. */ | 4682 | /* Vsource_directory was initialized in init_lread. */ |
| 4636 | 4683 | ||
| 4637 | DEFSYM (Qcurrent_load_list, "current-load-list"); | 4684 | DEFSYM (Qcurrent_load_list, "current-load-list"); |
diff --git a/src/process.c b/src/process.c index dac4b14dcea..bef1e6d68f3 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1530,7 +1530,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1530 | 1530 | ||
| 1531 | tem = Qnil; | 1531 | tem = Qnil; |
| 1532 | GCPRO4 (name, program, buffer, current_dir); | 1532 | GCPRO4 (name, program, buffer, current_dir); |
| 1533 | openp (Vexec_path, program, Vexec_suffixes, &tem, make_number (X_OK)); | 1533 | openp (Vexec_path, program, Vexec_suffixes, &tem, make_number (X_OK), 0); |
| 1534 | UNGCPRO; | 1534 | UNGCPRO; |
| 1535 | if (NILP (tem)) | 1535 | if (NILP (tem)) |
| 1536 | report_file_error ("Searching for program", program); | 1536 | report_file_error ("Searching for program", program); |
diff --git a/src/sound.c b/src/sound.c index f8c6b483056..e84f7415cd3 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -1332,7 +1332,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1332 | { | 1332 | { |
| 1333 | /* Open the sound file. */ | 1333 | /* Open the sound file. */ |
| 1334 | current_sound->fd = openp (list1 (Vdata_directory), | 1334 | current_sound->fd = openp (list1 (Vdata_directory), |
| 1335 | attrs[SOUND_FILE], Qnil, &file, Qnil); | 1335 | attrs[SOUND_FILE], Qnil, &file, Qnil, 0); |
| 1336 | if (current_sound->fd < 0) | 1336 | if (current_sound->fd < 0) |
| 1337 | sound_perror ("Could not open sound file"); | 1337 | sound_perror ("Could not open sound file"); |
| 1338 | 1338 | ||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API. | 1 | /* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API. |
| 2 | Copyright (C) 1994-1995, 2000-2013 Free Software Foundation, Inc. | 2 | |
| 3 | Copyright (C) 1994-1995, 2000-2013 Free Software Foundation, Inc. | ||
| 3 | 4 | ||
| 4 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 5 | 6 | ||
| @@ -8602,7 +8603,7 @@ check_windows_init_file (void) | |||
| 8602 | need to ENCODE_FILE here, but we do need to convert the file | 8603 | need to ENCODE_FILE here, but we do need to convert the file |
| 8603 | names from UTF-8 to ANSI. */ | 8604 | names from UTF-8 to ANSI. */ |
| 8604 | init_file = build_string ("term/w32-win"); | 8605 | init_file = build_string ("term/w32-win"); |
| 8605 | fd = openp (Vload_path, init_file, Fget_load_suffixes (), NULL, Qnil); | 8606 | fd = openp (Vload_path, init_file, Fget_load_suffixes (), NULL, Qnil, 0); |
| 8606 | if (fd < 0) | 8607 | if (fd < 0) |
| 8607 | { | 8608 | { |
| 8608 | Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil); | 8609 | Lisp_Object load_path_print = Fprin1_to_string (Vload_path, Qnil); |
diff --git a/src/w32proc.c b/src/w32proc.c index 7d4fb9825fa..2b583efba56 100644 --- a/src/w32proc.c +++ b/src/w32proc.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* Process support for GNU Emacs on the Microsoft Windows API. | 1 | /* Process support for GNU Emacs on the Microsoft Windows API. |
| 2 | Copyright (C) 1992, 1995, 1999-2013 Free Software Foundation, Inc. | 2 | |
| 3 | Copyright (C) 1992, 1995, 1999-2013 Free Software Foundation, Inc. | ||
| 3 | 4 | ||
| 4 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 5 | 6 | ||
| @@ -1592,7 +1593,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp) | |||
| 1592 | program = build_string (cmdname); | 1593 | program = build_string (cmdname); |
| 1593 | full = Qnil; | 1594 | full = Qnil; |
| 1594 | GCPRO1 (program); | 1595 | GCPRO1 (program); |
| 1595 | openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK)); | 1596 | openp (Vexec_path, program, Vexec_suffixes, &full, make_number (X_OK), 0); |
| 1596 | UNGCPRO; | 1597 | UNGCPRO; |
| 1597 | if (NILP (full)) | 1598 | if (NILP (full)) |
| 1598 | { | 1599 | { |