diff options
| author | Andreas Schwab | 2008-04-27 18:06:51 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2008-04-27 18:06:51 +0000 |
| commit | 9c691c002b1b93b53d3eba75dd8a4bffa709daa0 (patch) | |
| tree | e0591dfc7822449cfadf2d384437c11c29e038ef /src | |
| parent | 87bdd2c7a5481583bcaf0853ad94561917d64534 (diff) | |
| download | emacs-9c691c002b1b93b53d3eba75dd8a4bffa709daa0.tar.gz emacs-9c691c002b1b93b53d3eba75dd8a4bffa709daa0.zip | |
(file_name_completion): Fix inappropriate mixing of
encoded and decoded names.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/dired.c | 25 |
2 files changed, 14 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4e28dc90fa7..fe51098d917 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2008-04-27 Andreas Schwab <schwab@suse.de> | 1 | 2008-04-27 Andreas Schwab <schwab@suse.de> |
| 2 | 2 | ||
| 3 | * dired.c (file_name_completion): Fix inappropriate mixing of | ||
| 4 | encoded and decoded names. | ||
| 5 | |||
| 3 | * xterm.c (XTread_socket): Fix use of uninitialized variable. | 6 | * xterm.c (XTread_socket): Fix use of uninitialized variable. |
| 4 | 7 | ||
| 5 | * puresize.h (BASE_PURESIZE): Increase to 1200000. | 8 | * puresize.h (BASE_PURESIZE): Increase to 1200000. |
diff --git a/src/dired.c b/src/dired.c index 85558592be6..3fa32b474da 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -539,6 +539,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 539 | { | 539 | { |
| 540 | DIRENTRY *dp; | 540 | DIRENTRY *dp; |
| 541 | int len; | 541 | int len; |
| 542 | Lisp_Object decoded_name; | ||
| 542 | 543 | ||
| 543 | #ifdef VMS | 544 | #ifdef VMS |
| 544 | dp = (*readfunc) (d); | 545 | dp = (*readfunc) (d); |
| @@ -640,6 +641,9 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 640 | if (!passcount && CONSP (tem)) | 641 | if (!passcount && CONSP (tem)) |
| 641 | continue; | 642 | continue; |
| 642 | 643 | ||
| 644 | name = make_unibyte_string (dp->d_name, len); | ||
| 645 | decoded_name = DECODE_FILE (name); | ||
| 646 | |||
| 643 | if (!passcount) | 647 | if (!passcount) |
| 644 | { | 648 | { |
| 645 | Lisp_Object regexps; | 649 | Lisp_Object regexps; |
| @@ -650,8 +654,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 650 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 654 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
| 651 | regexps = XCDR (regexps)) | 655 | regexps = XCDR (regexps)) |
| 652 | { | 656 | { |
| 653 | tem = Fstring_match (XCAR (regexps), | 657 | tem = Fstring_match (XCAR (regexps), decoded_name, zero); |
| 654 | make_string (dp->d_name, len), zero); | ||
| 655 | if (NILP (tem)) | 658 | if (NILP (tem)) |
| 656 | break; | 659 | break; |
| 657 | } | 660 | } |
| @@ -663,10 +666,8 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 663 | if (directoryp) | 666 | if (directoryp) |
| 664 | { | 667 | { |
| 665 | /* This completion is a directory; make it end with '/' */ | 668 | /* This completion is a directory; make it end with '/' */ |
| 666 | name = Ffile_name_as_directory (make_string (dp->d_name, len)); | 669 | name = ENCODE_FILE (Ffile_name_as_directory (decoded_name)); |
| 667 | } | 670 | } |
| 668 | else | ||
| 669 | name = make_string (dp->d_name, len); | ||
| 670 | 671 | ||
| 671 | /* Test the predicate, if any. */ | 672 | /* Test the predicate, if any. */ |
| 672 | 673 | ||
| @@ -674,10 +675,10 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 674 | { | 675 | { |
| 675 | Lisp_Object decoded; | 676 | Lisp_Object decoded; |
| 676 | Lisp_Object val; | 677 | Lisp_Object val; |
| 677 | struct gcpro gcpro1; | 678 | struct gcpro gcpro1, gcpro2; |
| 678 | 679 | ||
| 679 | GCPRO1 (name); | 680 | GCPRO2 (name, decoded_name); |
| 680 | decoded = Fexpand_file_name (DECODE_FILE (name), dirname); | 681 | decoded = Fexpand_file_name (decoded_name, dirname); |
| 681 | val = call1 (predicate, decoded); | 682 | val = call1 (predicate, decoded); |
| 682 | UNGCPRO; | 683 | UNGCPRO; |
| 683 | 684 | ||
| @@ -690,10 +691,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 690 | matchcount++; | 691 | matchcount++; |
| 691 | 692 | ||
| 692 | if (all_flag) | 693 | if (all_flag) |
| 693 | { | 694 | bestmatch = Fcons (decoded_name, bestmatch); |
| 694 | name = DECODE_FILE (name); | ||
| 695 | bestmatch = Fcons (name, bestmatch); | ||
| 696 | } | ||
| 697 | else if (NILP (bestmatch)) | 695 | else if (NILP (bestmatch)) |
| 698 | { | 696 | { |
| 699 | bestmatch = name; | 697 | bestmatch = name; |
| @@ -729,8 +727,7 @@ file_name_completion (file, dirname, all_flag, ver_flag, predicate) | |||
| 729 | either both or neither are exact. */ | 727 | either both or neither are exact. */ |
| 730 | (((matchsize == len) | 728 | (((matchsize == len) |
| 731 | == | 729 | == |
| 732 | (matchsize + !!directoryp | 730 | (matchsize + !!directoryp == SCHARS (bestmatch))) |
| 733 | == SCHARS (bestmatch))) | ||
| 734 | && !bcmp (p2, SDATA (encoded_file), SCHARS (encoded_file)) | 731 | && !bcmp (p2, SDATA (encoded_file), SCHARS (encoded_file)) |
| 735 | && bcmp (p1, SDATA (encoded_file), SCHARS (encoded_file)))) | 732 | && bcmp (p1, SDATA (encoded_file), SCHARS (encoded_file)))) |
| 736 | bestmatch = name; | 733 | bestmatch = name; |