Mercurial > hg > xemacs-beta
comparison lisp/prim/files.el @ 185:3d6bfa290dbd r20-3b19
Import from CVS: tag r20-3b19
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:55:28 +0200 |
parents | bfd6434d15b3 |
children | 489f57a838ef |
comparison
equal
deleted
inserted
replaced
184:bcd2674570bf | 185:3d6bfa290dbd |
---|---|
633 (interactive "BSwitch to buffer in other frame: ") | 633 (interactive "BSwitch to buffer in other frame: ") |
634 (let* ((name (get-frame-name-for-buffer buffer)) | 634 (let* ((name (get-frame-name-for-buffer buffer)) |
635 (frame (make-frame (if name | 635 (frame (make-frame (if name |
636 (list (cons 'name (symbol-name name))))))) | 636 (list (cons 'name (symbol-name name))))))) |
637 (pop-to-buffer buffer t frame) | 637 (pop-to-buffer buffer t frame) |
638 (select-frame frame) | |
638 (make-frame-visible frame) | 639 (make-frame-visible frame) |
639 buffer)) | 640 buffer)) |
640 | 641 |
641 (defun find-file (filename &optional codesys) | 642 (defun find-file (filename &optional codesys) |
642 "Edit file FILENAME. | 643 "Edit file FILENAME. |
944 (defun find-file-noselect (filename &optional nowarn rawfile) | 945 (defun find-file-noselect (filename &optional nowarn rawfile) |
945 "Read file FILENAME into a buffer and return the buffer. | 946 "Read file FILENAME into a buffer and return the buffer. |
946 If a buffer exists visiting FILENAME, return that one, but | 947 If a buffer exists visiting FILENAME, return that one, but |
947 verify that the file has not changed since visited or saved. | 948 verify that the file has not changed since visited or saved. |
948 The buffer is not selected, just returned to the caller. | 949 The buffer is not selected, just returned to the caller. |
949 If NOWARN is non-nil warning messages about several potential | 950 If NOWARN is non-nil, warning messages about several potential |
950 problems will be suppressed." | 951 problems will be suppressed." |
951 (setq filename (abbreviate-file-name (expand-file-name filename))) | 952 (setq filename (abbreviate-file-name (expand-file-name filename))) |
952 (if (file-directory-p filename) | 953 (if (file-directory-p filename) |
953 (if find-file-run-dired | 954 (if find-file-run-dired |
954 (dired-noselect (if find-file-use-truenames | 955 (dired-noselect (if find-file-use-truenames |
974 ; filename (buffer-file-name same-number)))) | 975 ; filename (buffer-file-name same-number)))) |
975 ; ;; Optionally also find that buffer. | 976 ; ;; Optionally also find that buffer. |
976 ; (if (or find-file-existing-other-name find-file-visit-truename) | 977 ; (if (or find-file-existing-other-name find-file-visit-truename) |
977 ; (setq buf (or same-truename same-number))) | 978 ; (setq buf (or same-truename same-number))) |
978 | 979 |
979 (if (and buf | 980 (when (and buf |
980 (or find-file-compare-truenames find-file-use-truenames) | 981 (or find-file-compare-truenames find-file-use-truenames) |
981 (not nowarn)) | 982 (not nowarn)) |
982 (save-excursion | 983 (save-excursion |
983 (set-buffer buf) | 984 (set-buffer buf) |
984 (if (not (string-equal buffer-file-name filename)) | 985 (if (not (string-equal buffer-file-name filename)) |
985 (message "%s and %s are the same file (%s)" | 986 (message "%s and %s are the same file (%s)" |
986 filename buffer-file-name | 987 filename buffer-file-name |
987 buffer-file-truename)))) | 988 buffer-file-truename)))) |
988 | 989 |
989 (if buf | 990 (if buf |
990 (or nowarn | 991 (or nowarn |
991 (verify-visited-file-modtime buf) | 992 (verify-visited-file-modtime buf) |
992 (cond ((not (file-exists-p filename)) | 993 (cond ((not (file-exists-p filename)) |
1006 (file-name-nondirectory filename) | 1007 (file-name-nondirectory filename) |
1007 (buffer-name buf)))) | 1008 (buffer-name buf)))) |
1008 (save-excursion | 1009 (save-excursion |
1009 (set-buffer buf) | 1010 (set-buffer buf) |
1010 (revert-buffer t t))))) | 1011 (revert-buffer t t))))) |
1012 ;; Else: we must create a new buffer for filename | |
1011 (save-excursion | 1013 (save-excursion |
1012 ;;; The truename stuff makes this obsolete. | 1014 ;;; The truename stuff makes this obsolete. |
1013 ;;; (let* ((link-name (car (file-attributes filename))) | 1015 ;;; (let* ((link-name (car (file-attributes filename))) |
1014 ;;; (linked-buf (and (stringp link-name) | 1016 ;;; (linked-buf (and (stringp link-name) |
1015 ;;; (get-file-buffer link-name)))) | 1017 ;;; (get-file-buffer link-name)))) |
1064 (progn | 1066 (progn |
1065 (make-local-variable 'backup-inhibited) | 1067 (make-local-variable 'backup-inhibited) |
1066 (setq backup-inhibited t))) | 1068 (setq backup-inhibited t))) |
1067 (if rawfile | 1069 (if rawfile |
1068 nil | 1070 nil |
1069 (after-find-file error (not nowarn))))) | 1071 (after-find-file error (not nowarn)) |
1072 (setq buf (current-buffer))))) | |
1070 buf))) | 1073 buf))) |
1071 | 1074 |
1072 (defvar after-find-file-from-revert-buffer nil) | 1075 (defvar after-find-file-from-revert-buffer nil) |
1073 | 1076 |
1074 (defun after-find-file (&optional error warn noauto | 1077 (defun after-find-file (&optional error warn noauto |
1933 ;; so as of now I am leaving it alone. | 1936 ;; so as of now I am leaving it alone. |
1934 (defun backup-extract-version (fn) | 1937 (defun backup-extract-version (fn) |
1935 "Given the name of a numeric backup file, return the backup number. | 1938 "Given the name of a numeric backup file, return the backup number. |
1936 Uses the free variable `bv-length', whose value should be | 1939 Uses the free variable `bv-length', whose value should be |
1937 the index in the name where the version number begins." | 1940 the index in the name where the version number begins." |
1941 (declare (special bv-length)) | |
1938 (if (and (string-match "[0-9]+~\\'" fn bv-length) | 1942 (if (and (string-match "[0-9]+~\\'" fn bv-length) |
1939 (= (match-beginning 0) bv-length)) | 1943 (= (match-beginning 0) bv-length)) |
1940 (string-to-int (substring fn bv-length -1)) | 1944 (string-to-int (substring fn bv-length -1)) |
1941 0)) | 1945 0)) |
1942 | 1946 |