Subject: bug#8129: "File exists, but cannot be read" message on Windows with NT Emacs for .gpg files.

From: Oleksandr Gavenko <[email-masked]>
Date: Sun, 27 Feb 2011 12:41:08 +0000

I try open file with '.gpg' extension and get message:

   File exists, but cannot be read

and file content not shown.

This happen in 'runemacs.exe -q' version 23.1/23.2.
Emacs 22.3 and 21.4 have no this issue.

Problem come from 'e:/opt/emacs-23.2/lisp/files.el':

(defun after-find-file (&optional error warn noauto
				  after-find-file-from-revert-buffer
				  nomodes)
   (setq buffer-read-only (not (file-writable-p buffer-file-name)))
   (if noninteractive
       nil
     (let* (not-serious
	   (msg
	    (cond
	     ((not warn) nil)
	     ((and error (file-attributes buffer-file-name))
	      (setq buffer-read-only t)
	      "File exists, but cannot be read")

This function for .gpg file invoked with warn=t, error=t.

For other file ext it invoked as warn=t, error=nil <<==
so work good.

To workaround I try

   (fset 'epa-file 'text-mode)

as in 'auto-mode-alist':

    ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file)

without happiness.

-- 
Best regards!