aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
authorStefan Monnier2011-02-21 17:34:51 -0500
committerStefan Monnier2011-02-21 17:34:51 -0500
commitf619ad4ca2ce943d53589469c010e451afab97dd (patch)
treee1b71f79518372ecab4c677ae948504450d8bf5d /src/lread.c
parenta647cb26b695a542e3a546104afdf4c7c47eb061 (diff)
parent9f8370e63f65f76887b319ab6a0368d4a332777c (diff)
downloademacs-f619ad4ca2ce943d53589469c010e451afab97dd.tar.gz
emacs-f619ad4ca2ce943d53589469c010e451afab97dd.zip
Merge from trunk
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/lread.c b/src/lread.c
index 02b2fa39075..b30a75b67c3 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -212,7 +212,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
212 if (pt_byte >= BUF_ZV_BYTE (inbuffer)) 212 if (pt_byte >= BUF_ZV_BYTE (inbuffer))
213 return -1; 213 return -1;
214 214
215 if (! NILP (inbuffer->enable_multibyte_characters)) 215 if (! NILP (BVAR (inbuffer, enable_multibyte_characters)))
216 { 216 {
217 /* Fetch the character code from the buffer. */ 217 /* Fetch the character code from the buffer. */
218 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte); 218 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
@@ -241,7 +241,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
241 if (bytepos >= BUF_ZV_BYTE (inbuffer)) 241 if (bytepos >= BUF_ZV_BYTE (inbuffer))
242 return -1; 242 return -1;
243 243
244 if (! NILP (inbuffer->enable_multibyte_characters)) 244 if (! NILP (BVAR (inbuffer, enable_multibyte_characters)))
245 { 245 {
246 /* Fetch the character code from the buffer. */ 246 /* Fetch the character code from the buffer. */
247 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos); 247 unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
@@ -373,7 +373,7 @@ unreadchar (Lisp_Object readcharfun, int c)
373 EMACS_INT bytepos = BUF_PT_BYTE (b); 373 EMACS_INT bytepos = BUF_PT_BYTE (b);
374 374
375 BUF_PT (b)--; 375 BUF_PT (b)--;
376 if (! NILP (b->enable_multibyte_characters)) 376 if (! NILP (BVAR (b, enable_multibyte_characters)))
377 BUF_DEC_POS (b, bytepos); 377 BUF_DEC_POS (b, bytepos);
378 else 378 else
379 bytepos--; 379 bytepos--;
@@ -386,7 +386,7 @@ unreadchar (Lisp_Object readcharfun, int c)
386 EMACS_INT bytepos = XMARKER (readcharfun)->bytepos; 386 EMACS_INT bytepos = XMARKER (readcharfun)->bytepos;
387 387
388 XMARKER (readcharfun)->charpos--; 388 XMARKER (readcharfun)->charpos--;
389 if (! NILP (b->enable_multibyte_characters)) 389 if (! NILP (BVAR (b, enable_multibyte_characters)))
390 BUF_DEC_POS (b, bytepos); 390 BUF_DEC_POS (b, bytepos);
391 else 391 else
392 bytepos--; 392 bytepos--;
@@ -1375,7 +1375,9 @@ If SUFFIXES is non-nil, it should be a list of suffixes to append to
1375file name when searching. 1375file name when searching.
1376If non-nil, PREDICATE is used instead of `file-readable-p'. 1376If non-nil, PREDICATE is used instead of `file-readable-p'.
1377PREDICATE can also be an integer to pass to the access(2) function, 1377PREDICATE can also be an integer to pass to the access(2) function,
1378in which case file-name-handlers are ignored. */) 1378in which case file-name-handlers are ignored.
1379This function will normally skip directories, so if you want it to find
1380directories, make sure the PREDICATE function returns `dir-ok' for them. */)
1379 (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) 1381 (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate)
1380{ 1382{
1381 Lisp_Object file; 1383 Lisp_Object file;
@@ -1385,6 +1387,7 @@ in which case file-name-handlers are ignored. */)
1385 return file; 1387 return file;
1386} 1388}
1387 1389
1390static Lisp_Object Qdir_ok;
1388 1391
1389/* Search for a file whose name is STR, looking in directories 1392/* Search for a file whose name is STR, looking in directories
1390 in the Lisp list PATH, and trying suffixes from SUFFIX. 1393 in the Lisp list PATH, and trying suffixes from SUFFIX.
@@ -1447,7 +1450,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1447 /* Of course, this could conceivably lose if luser sets 1450 /* Of course, this could conceivably lose if luser sets
1448 default-directory to be something non-absolute... */ 1451 default-directory to be something non-absolute... */
1449 { 1452 {
1450 filename = Fexpand_file_name (filename, current_buffer->directory); 1453 filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
1451 if (!complete_filename_p (filename)) 1454 if (!complete_filename_p (filename))
1452 /* Give up on this path element! */ 1455 /* Give up on this path element! */
1453 continue; 1456 continue;
@@ -1502,9 +1505,12 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1502 if (NILP (predicate)) 1505 if (NILP (predicate))
1503 exists = !NILP (Ffile_readable_p (string)); 1506 exists = !NILP (Ffile_readable_p (string));
1504 else 1507 else
1505 exists = !NILP (call1 (predicate, string)); 1508 {
1506 if (exists && !NILP (Ffile_directory_p (string))) 1509 Lisp_Object tmp = call1 (predicate, string);
1507 exists = 0; 1510 exists = !NILP (tmp)
1511 && (EQ (tmp, Qdir_ok)
1512 || !NILP (Ffile_directory_p (string)));
1513 }
1508 1514
1509 if (exists) 1515 if (exists)
1510 { 1516 {
@@ -1714,7 +1720,7 @@ readevalloop (Lisp_Object readcharfun,
1714 { 1720 {
1715 int count1 = SPECPDL_INDEX (); 1721 int count1 = SPECPDL_INDEX ();
1716 1722
1717 if (b != 0 && NILP (b->name)) 1723 if (b != 0 && NILP (BVAR (b, name)))
1718 error ("Reading from killed buffer"); 1724 error ("Reading from killed buffer");
1719 1725
1720 if (!NILP (start)) 1726 if (!NILP (start))
@@ -1854,7 +1860,7 @@ This function preserves the position of point. */)
1854 tem = printflag; 1860 tem = printflag;
1855 1861
1856 if (NILP (filename)) 1862 if (NILP (filename))
1857 filename = XBUFFER (buf)->filename; 1863 filename = BVAR (XBUFFER (buf), filename);
1858 1864
1859 specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); 1865 specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list));
1860 specbind (Qstandard_output, tem); 1866 specbind (Qstandard_output, tem);
@@ -1897,7 +1903,7 @@ This function does not move point. */)
1897 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); 1903 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list));
1898 1904
1899 /* readevalloop calls functions which check the type of start and end. */ 1905 /* readevalloop calls functions which check the type of start and end. */
1900 readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, 1906 readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename),
1901 !NILP (printflag), Qnil, read_function, 1907 !NILP (printflag), Qnil, read_function,
1902 start, end); 1908 start, end);
1903 1909
@@ -4542,6 +4548,9 @@ This variable is automatically set from the file variables of an interpreted
4542 Qfile_truename = intern_c_string ("file-truename"); 4548 Qfile_truename = intern_c_string ("file-truename");
4543 staticpro (&Qfile_truename) ; 4549 staticpro (&Qfile_truename) ;
4544 4550
4551 Qdir_ok = intern_c_string ("dir-ok");
4552 staticpro (&Qdir_ok);
4553
4545 Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation"); 4554 Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation");
4546 staticpro (&Qdo_after_load_evaluation) ; 4555 staticpro (&Qdo_after_load_evaluation) ;
4547 4556