Mercurial > emacs
comparison src/fileio.c @ 94220:47134e6f8c9b
(Qdefault_directory): New variable.
(Fread_file_name): Use it to pass `dir' to the completion functions.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 21 Apr 2008 21:26:02 +0000 |
parents | 3af508d0bd74 |
children | b47239d57d36 |
comparison
equal
deleted
inserted
replaced
94219:185747659a29 | 94220:47134e6f8c9b |
---|---|
6154 return Qt; | 6154 return Qt; |
6155 #endif | 6155 #endif |
6156 return Qnil; | 6156 return Qnil; |
6157 } | 6157 } |
6158 | 6158 |
6159 Lisp_Object Qdefault_directory; | |
6160 | |
6159 DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, | 6161 DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, |
6160 doc: /* Read file name, prompting with PROMPT and completing in directory DIR. | 6162 doc: /* Read file name, prompting with PROMPT and completing in directory DIR. |
6161 Value is not expanded---you must call `expand-file-name' yourself. | 6163 Value is not expanded---you must call `expand-file-name' yourself. |
6162 Default name to DEFAULT-FILENAME if user exits the minibuffer with | 6164 Default name to DEFAULT-FILENAME if user exits the minibuffer with |
6163 the same non-empty string that was inserted by this function. | 6165 the same non-empty string that was inserted by this function. |
6277 args[6] = predicate; | 6279 args[6] = predicate; |
6278 RETURN_UNGCPRO (Ffuncall (7, args)); | 6280 RETURN_UNGCPRO (Ffuncall (7, args)); |
6279 } | 6281 } |
6280 | 6282 |
6281 count = SPECPDL_INDEX (); | 6283 count = SPECPDL_INDEX (); |
6284 specbind (Qdefault_directory, | |
6285 Ffile_name_as_directory (Fexpand_file_name (dir, Qnil))); | |
6282 specbind (Qcompletion_ignore_case, | 6286 specbind (Qcompletion_ignore_case, |
6283 read_file_name_completion_ignore_case ? Qt : Qnil); | 6287 read_file_name_completion_ignore_case ? Qt : Qnil); |
6284 specbind (intern ("minibuffer-completing-file-name"), Qt); | 6288 specbind (intern ("minibuffer-completing-file-name"), Qt); |
6285 specbind (intern ("read-file-name-predicate"), | 6289 specbind (intern ("read-file-name-predicate"), |
6286 (NILP (predicate) ? Qfile_exists_p : predicate)); | 6290 (NILP (predicate) ? Qfile_exists_p : predicate)); |
6305 add_to_history = 1; | 6309 add_to_history = 1; |
6306 } | 6310 } |
6307 else | 6311 else |
6308 #endif | 6312 #endif |
6309 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), | 6313 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), |
6310 dir, mustmatch, insdef, | 6314 Qnil, mustmatch, insdef, |
6311 Qfile_name_history, default_filename, Qnil); | 6315 Qfile_name_history, default_filename, Qnil); |
6312 | 6316 |
6313 tem = Fsymbol_value (Qfile_name_history); | 6317 tem = Fsymbol_value (Qfile_name_history); |
6314 if (CONSP (tem) && EQ (XCAR (tem), val)) | 6318 if (CONSP (tem) && EQ (XCAR (tem), val)) |
6315 replace_in_history = 1; | 6319 replace_in_history = 1; |
6482 of file names regardless of the current language environment. */); | 6486 of file names regardless of the current language environment. */); |
6483 Vdefault_file_name_coding_system = Qnil; | 6487 Vdefault_file_name_coding_system = Qnil; |
6484 | 6488 |
6485 Qformat_decode = intern ("format-decode"); | 6489 Qformat_decode = intern ("format-decode"); |
6486 staticpro (&Qformat_decode); | 6490 staticpro (&Qformat_decode); |
6491 Qdefault_directory = intern ("default-directory"); | |
6492 staticpro (&Qdefault_directory); | |
6487 Qformat_annotate_function = intern ("format-annotate-function"); | 6493 Qformat_annotate_function = intern ("format-annotate-function"); |
6488 staticpro (&Qformat_annotate_function); | 6494 staticpro (&Qformat_annotate_function); |
6489 Qafter_insert_file_set_coding = intern ("after-insert-file-set-coding"); | 6495 Qafter_insert_file_set_coding = intern ("after-insert-file-set-coding"); |
6490 staticpro (&Qafter_insert_file_set_coding); | 6496 staticpro (&Qafter_insert_file_set_coding); |
6491 | 6497 |