diff options
| -rw-r--r-- | lisp/ediff-util.el | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/ediff-util.el b/lisp/ediff-util.el index e87cd821e32..6f864639c7a 100644 --- a/lisp/ediff-util.el +++ b/lisp/ediff-util.el | |||
| @@ -2899,33 +2899,37 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 2899 | f)) | 2899 | f)) |
| 2900 | 2900 | ||
| 2901 | ;; If PREFIX is given, then it is used as a prefix for the temp file | 2901 | ;; If PREFIX is given, then it is used as a prefix for the temp file |
| 2902 | ;; name. Otherwise, `ediff_' is used. If FILE is given, use this | 2902 | ;; name. Otherwise, `ediff' is used. If FILE is given, use this |
| 2903 | ;; file and don't create a new one. | 2903 | ;; file and don't create a new one. |
| 2904 | ;; On MS-DOS, make sure the prefix isn't longer than 7 characters, or | 2904 | ;; On MS-DOS, make sure the prefix isn't too long, or else |
| 2905 | ;; else `make-temp-name' isn't guaranteed to return a unique filename. | 2905 | ;; `make-temp-name' isn't guaranteed to return a unique filename. |
| 2906 | ;; Also, save buffer from START to END in the file. | 2906 | ;; Also, save buffer from START to END in the file. |
| 2907 | ;; START defaults to (point-min), END to (point-max) | 2907 | ;; START defaults to (point-min), END to (point-max) |
| 2908 | (defun ediff-make-temp-file (buff &optional prefix given-file start end) | 2908 | (defun ediff-make-temp-file (buff &optional prefix given-file start end) |
| 2909 | (let ((p (or prefix "ediff")) | 2909 | (let* ((p (ediff-convert-standard-filename (or prefix "ediff"))) |
| 2910 | f) | 2910 | (short-p p) |
| 2911 | (if (and (eq system-type 'ms-dos) (> (length p) 7)) | 2911 | f short-f) |
| 2912 | (setq p (substring p 0 7))) | 2912 | (if (and (fboundp 'msdos-long-file-names) |
| 2913 | (not (msdos-long-file-names)) | ||
| 2914 | (> (length p) 2)) | ||
| 2915 | (setq short-p (substring p 0 2))) | ||
| 2913 | 2916 | ||
| 2914 | (setq f (concat ediff-temp-file-prefix p) | 2917 | (setq f (concat ediff-temp-file-prefix p) |
| 2918 | short-f (concat ediff-temp-file-prefix short-p) | ||
| 2915 | f (cond (given-file) | 2919 | f (cond (given-file) |
| 2916 | ((find-file-name-handler f 'find-file-noselect) | 2920 | ((find-file-name-handler f 'find-file-noselect) |
| 2917 | ;; to thwart file handlers in write-region, e.g., if file | 2921 | ;; to thwart file handlers in write-region, e.g., if file |
| 2918 | ;; name ends with .Z or .gz | 2922 | ;; name ends with .Z or .gz |
| 2919 | ;; This is needed so that patches produced by ediff will | 2923 | ;; This is needed so that patches produced by ediff will |
| 2920 | ;; have more meaningful names | 2924 | ;; have more meaningful names |
| 2921 | (make-temp-name f)) | 2925 | (make-temp-name short-f)) |
| 2922 | ;; Prefix is most often the same as the file name for the | 2926 | ;; Prefix is most often the same as the file name for the |
| 2923 | ;; variant. Here we are trying to use the original file name | 2927 | ;; variant. Here we are trying to use the original file name |
| 2924 | ;; but in the temp directory. | 2928 | ;; but in the temp directory. |
| 2925 | ((and prefix (not (file-exists-p f))) f) | 2929 | ((and prefix (not (file-exists-p f))) f) |
| 2926 | ;; If a file with the orig name exists, add some random stuff | 2930 | ;; If a file with the orig name exists, add some random stuff |
| 2927 | ;; to it. | 2931 | ;; to it. |
| 2928 | (t (make-temp-name f)))) | 2932 | (t (make-temp-name short-f)))) |
| 2929 | 2933 | ||
| 2930 | ;; create the file | 2934 | ;; create the file |
| 2931 | (ediff-with-current-buffer buff | 2935 | (ediff-with-current-buffer buff |
| @@ -2935,7 +2939,7 @@ Hit \\[ediff-recenter] to reset the windows afterward." | |||
| 2935 | nil ; don't append---erase | 2939 | nil ; don't append---erase |
| 2936 | 'no-message) | 2940 | 'no-message) |
| 2937 | (set-file-modes f ediff-temp-file-mode) | 2941 | (set-file-modes f ediff-temp-file-mode) |
| 2938 | (ediff-convert-standard-filename (expand-file-name f))))) | 2942 | (expand-file-name f)))) |
| 2939 | 2943 | ||
| 2940 | ;; Quote metacharacters (using \) when executing diff in Unix, but not in | 2944 | ;; Quote metacharacters (using \) when executing diff in Unix, but not in |
| 2941 | ;; EMX OS/2 | 2945 | ;; EMX OS/2 |