comparison src/dired.c @ 48906:141c4fba25c0

(file_name_completion): Fix that change. Delete special quit-handling code; just use QUIT.
author Richard M. Stallman <rms@gnu.org>
date Sat, 21 Dec 2002 17:56:16 +0000
parents 0d51b82bd792
children 23a1cea22d13
comparison
equal deleted inserted replaced
48905:0d51b82bd792 48906:141c4fba25c0
517 ** It would not actually be helpful to the user to ignore any possible 517 ** It would not actually be helpful to the user to ignore any possible
518 completions when making a list of them.** */ 518 completions when making a list of them.** */
519 519
520 for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++) 520 for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++)
521 { 521 {
522 int inner_count = SPECPDL_INDEX ();
523
522 d = opendir (SDATA (Fdirectory_file_name (encoded_dir))); 524 d = opendir (SDATA (Fdirectory_file_name (encoded_dir)));
523 if (!d) 525 if (!d)
524 report_file_error ("Opening directory", Fcons (dirname, Qnil)); 526 report_file_error ("Opening directory", Fcons (dirname, Qnil));
525 527
526 record_unwind_protect (directory_files_internal_unwind, 528 record_unwind_protect (directory_files_internal_unwind,
541 #endif 543 #endif
542 if (!dp) break; 544 if (!dp) break;
543 545
544 len = NAMLEN (dp); 546 len = NAMLEN (dp);
545 547
546 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) 548 QUIT;
547 goto quit;
548 if (! DIRENTRY_NONEMPTY (dp) 549 if (! DIRENTRY_NONEMPTY (dp)
549 || len < SCHARS (encoded_file) 550 || len < SCHARS (encoded_file)
550 || 0 <= scmp (dp->d_name, SDATA (encoded_file), 551 || 0 <= scmp (dp->d_name, SDATA (encoded_file),
551 SCHARS (encoded_file))) 552 SCHARS (encoded_file)))
552 continue; 553 continue;
717 && IS_ANY_SEP (p1[matchsize])) 718 && IS_ANY_SEP (p1[matchsize]))
718 matchsize++; 719 matchsize++;
719 bestmatchsize = matchsize; 720 bestmatchsize = matchsize;
720 } 721 }
721 } 722 }
722 closedir (d); 723 /* This closes the directory. */
723 /* Discard the unwind protect. */ 724 bestmatch = unbind_to (inner_count, bestmatch);
724 specpdl_ptr = specpdl + count;
725 } 725 }
726 726
727 UNGCPRO; 727 UNGCPRO;
728 bestmatch = unbind_to (count, bestmatch);
728 729
729 if (all_flag || NILP (bestmatch)) 730 if (all_flag || NILP (bestmatch))
730 { 731 {
731 if (STRINGP (bestmatch)) 732 if (STRINGP (bestmatch))
732 bestmatch = DECODE_FILE (bestmatch); 733 bestmatch = DECODE_FILE (bestmatch);
738 make_number (bestmatchsize)); 739 make_number (bestmatchsize));
739 /* Now that we got the right initial segment of BESTMATCH, 740 /* Now that we got the right initial segment of BESTMATCH,
740 decode it from the coding system in use. */ 741 decode it from the coding system in use. */
741 bestmatch = DECODE_FILE (bestmatch); 742 bestmatch = DECODE_FILE (bestmatch);
742 return bestmatch; 743 return bestmatch;
743
744 quit:
745 if (d) closedir (d);
746 /* Discard the unwind protect. */
747 specpdl_ptr = specpdl + count;
748 Vquit_flag = Qnil;
749 return Fsignal (Qquit, Qnil);
750 } 744 }
751 745
752 /* Compare exactly LEN chars of strings at S1 and S2, 746 /* Compare exactly LEN chars of strings at S1 and S2,
753 ignoring case if appropriate. 747 ignoring case if appropriate.
754 Return -1 if strings match, 748 Return -1 if strings match,