emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/files.el


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/files.el
Date: Sun, 14 Jul 2002 11:30:54 -0400

Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.593 emacs/lisp/files.el:1.594
*** emacs/lisp/files.el:1.593   Thu Jul 11 13:32:01 2002
--- emacs/lisp/files.el Sun Jul 14 11:30:54 2002
***************
*** 929,939 ****
                file-dir (file-name-directory file)))
       (list (read-file-name
            "Find alternate file: " file-dir nil nil file-name))))
!   (and (buffer-modified-p) (buffer-file-name)
!        ;; (not buffer-read-only)
!        (not (yes-or-no-p (format "Buffer %s is modified; kill anyway? "
!                                (buffer-name))))
!        (error "Aborted"))
    (let ((obuf (current-buffer))
        (ofile buffer-file-name)
        (onum buffer-file-number)
--- 929,942 ----
                file-dir (file-name-directory file)))
       (list (read-file-name
            "Find alternate file: " file-dir nil nil file-name))))
!   (unless (run-hook-with-args-until-failure 'kill-buffer-query-functions)
!     (error "Aborted"))
!   (when (and (buffer-modified-p) (buffer-file-name))
!     (if (yes-or-no-p (format "Buffer %s is modified; save it first? "
!                            (buffer-name)))
!       (save-buffer)
!       (unless (yes-or-no-p "Kill and replace the buffer without saving it? ")
!       (error "Aborted"))))
    (let ((obuf (current-buffer))
        (ofile buffer-file-name)
        (onum buffer-file-number)
***************
*** 949,962 ****
          (setq buffer-file-number nil)
          (setq buffer-file-truename nil)
          (find-file filename))
!       (cond ((eq obuf (current-buffer))
!            (setq buffer-file-name ofile)
!            (setq buffer-file-number onum)
!            (setq buffer-file-truename otrue)
!            (lock-buffer)
!            (rename-buffer oname))))
!     (or (eq (current-buffer) obuf)
!       (kill-buffer obuf))))
  
  (defun create-file-buffer (filename)
    "Create a suitably named buffer for visiting FILENAME, and return it.
--- 952,971 ----
          (setq buffer-file-number nil)
          (setq buffer-file-truename nil)
          (find-file filename))
!       (when (eq obuf (current-buffer))
!       ;; This executes if find-file gets an error
!       ;; and does not really find anything.
!       ;; We put things back as they were.
!       ;; If find-file actually finds something, we kill obuf below.
!       (setq buffer-file-name ofile)
!       (setq buffer-file-number onum)
!       (setq buffer-file-truename otrue)
!       (lock-buffer)
!       (rename-buffer oname)))
!     (unless (eq (current-buffer) obuf)
!       ;; We already asked; don't ask again.
!       (setq kill-buffer-query-functions nil)
!       (kill-buffer obuf))))
  
  (defun create-file-buffer (filename)
    "Create a suitably named buffer for visiting FILENAME, and return it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]