unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* find-file-noselect-1
@ 2004-05-18  3:07 Luc Teirlinck
  0 siblings, 0 replies; only message in thread
From: Luc Teirlinck @ 2004-05-18  3:07 UTC (permalink / raw)


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)
============================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-18  3:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-18  3:07 find-file-noselect-1 Luc Teirlinck

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).