emacs-devel
[Top][All Lists]
Advanced

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

find-file-noselect-1


From: Luc Teirlinck
Subject: find-file-noselect-1
Date: Mon, 17 May 2004 22:07:53 -0500 (CDT)

If there are no objections, I will commit the following patch to
files.el, in a few days.  I proposed this patch before.  I want to
point out that after the patch, inhibit-read-only will be nil instead
of t, as is currently the case, during the execution of
`find-file-not-found-functions' and `find-file-hook'.  This current
"feature" is completely undocumented.  The patch is intended to fix a
bug where the minibuffer prompt is not read-only during the execution
of find-file-hook.

===File ~/files-diff-new====================================
*** /home/teirllm/emacscvsdir/emacs/lisp/files.el       Mon May 17 21:29:37 2004
--- /home/teirllm/stored/files.el       Thu May 13 18:21:30 2004
***************
*** 1357,1370 ****
                                rawfile truename number))))))
  
  (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
!   (let ((inhibit-read-only t)
!       error)
      (with-current-buffer buf
        (kill-local-variable 'find-file-literally)
        ;; Needed in case we are re-visiting the file with a different
        ;; text representation.
        (kill-local-variable 'buffer-file-coding-system)
        (kill-local-variable 'cursor-type)
        (erase-buffer)
        (and (default-value 'enable-multibyte-characters)
           (not rawfile)
--- 1357,1370 ----
                                rawfile truename number))))))
  
  (defun find-file-noselect-1 (buf filename nowarn rawfile truename number)
!   (let (error)
      (with-current-buffer buf
        (kill-local-variable 'find-file-literally)
        ;; Needed in case we are re-visiting the file with a different
        ;; text representation.
        (kill-local-variable 'buffer-file-coding-system)
        (kill-local-variable 'cursor-type)
+       (let ((inhibit-read-only t))
        (erase-buffer)
        (and (default-value 'enable-multibyte-characters)
             (not rawfile)
***************
*** 1379,1387 ****
               (signal 'file-error (list "File is not readable"
                                         filename)))
             ;; Unconditionally set error
!            (setq error t)))
        (condition-case ()
!           (insert-file-contents filename t)
          (file-error
           (when (and (file-exists-p filename)
                      (not (file-readable-p filename)))
--- 1379,1388 ----
                 (signal 'file-error (list "File is not readable"
                                           filename)))
               ;; Unconditionally set error
!              (setq error t)))))
        (condition-case ()
!         (let ((inhibit-read-only t))
!           (insert-file-contents filename t))
        (file-error
         (when (and (file-exists-p filename)
                    (not (file-readable-p filename)))
***************
*** 1391,1397 ****
           ;; Run find-file-not-found-hooks until one returns non-nil.
           (or (run-hook-with-args-until-success 'find-file-not-found-functions)
               ;; If they fail too, set error.
!              (setq error t)))))
        ;; Record the file's truename, and maybe use that as visited name.
        (if (equal filename buffer-file-name)
          (setq buffer-file-truename truename)
--- 1392,1398 ----
         ;; Run find-file-not-found-hooks until one returns non-nil.
         (or (run-hook-with-args-until-success 'find-file-not-found-functions)
             ;; If they fail too, set error.
!            (setq error t))))
        ;; Record the file's truename, and maybe use that as visited name.
        (if (equal filename buffer-file-name)
          (setq buffer-file-truename truename)
============================================================




reply via email to

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