Mercurial > hg > xemacs-beta
comparison lisp/files.el @ 2718:5427b625d5cc
[xemacs-hg @ 2005-04-08 14:06:58 by aidan]
Make find-file with prefix-arg on a nonexistent file behave properly.
author | aidan |
---|---|
date | Fri, 08 Apr 2005 14:07:00 +0000 |
parents | 54fd042e254c |
children | fd1acd2f457a |
comparison
equal
deleted
inserted
replaced
2717:834cce9b2360 | 2718:5427b625d5cc |
---|---|
862 (interactive (list (read-file-name "Find file: ") | 862 (interactive (list (read-file-name "Find file: ") |
863 (and current-prefix-arg | 863 (and current-prefix-arg |
864 (read-coding-system "Coding system: ")) | 864 (read-coding-system "Coding system: ")) |
865 t)) | 865 t)) |
866 (if codesys | 866 (if codesys |
867 (let ((coding-system-for-read | 867 (let* ((coding-system-for-read (get-coding-system codesys)) |
868 (get-coding-system codesys))) | 868 (value (find-file-noselect filename nil nil wildcards)) |
869 (let ((value (find-file-noselect filename nil nil wildcards))) | 869 (bufname (if (listp value) (car (nreverse value)) value))) |
870 (if (listp value) | 870 ;; If a user explicitly specified the coding system with a prefix |
871 (mapcar 'switch-to-buffer (nreverse value)) | 871 ;; argument when opening a nonexistent file, insert-file-contents |
872 (switch-to-buffer value)))) | 872 ;; hasn't preserved that coding system as the local |
873 ;; buffer-file-coding-system. Do that ourselves. | |
874 (unless (and bufname | |
875 (file-exists-p (buffer-file-name bufname)) | |
876 (local-variable-p 'buffer-file-coding-system bufname)) | |
877 (save-excursion | |
878 (set-buffer bufname) | |
879 (setq buffer-file-coding-system coding-system-for-read))) | |
880 (switch-to-buffer bufname)) | |
873 (let ((value (find-file-noselect filename nil nil wildcards))) | 881 (let ((value (find-file-noselect filename nil nil wildcards))) |
874 (if (listp value) | 882 (if (listp value) |
875 (mapcar 'switch-to-buffer (nreverse value)) | 883 (mapcar 'switch-to-buffer (nreverse value)) |
876 (switch-to-buffer value))))) | 884 (switch-to-buffer value))))) |
877 | 885 |