unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Cc: 11274@debbugs.gnu.org
Subject: bug#11274: 23.1; auto-save invoked in read-only directories
Date: Fri, 20 Apr 2012 03:06:04 +0200	[thread overview]
Message-ID: <87lilrnrer.fsf@web.de> (raw)
In-Reply-To: <jmoc6p$k0$1@dough.gmane.org> (Kevin Rodgers's message of "Thu, 19 Apr 2012 00:44:33 -0600")

Hello Kevin,

> On 4/18/12 3:03 PM, danh@mail.archive.org wrote:
> > When i edit a file in a directory to which i do not have
> > write-permission (such as /etc), after i type a line or
> > two of text, or type a few characters and then move around
> > in the buffer, emacs will suddenly freeze and just print
> > a message in the mini-buffer that my text could not be auto-saved.
> >
> > The message stays up for several seconds before it
> > yields control of the terminal back to me.
> >
> > This is extremely inconvenient, and the only way i can
> > prevent this from happening is to frequently save the file.
>
> These statements seem contradictory to me:
>
> > I do not want to turn auto-save off, or to mark any buffers
>                                        ^^^^^^^^^^^^^^^^^^^^^^
> > as to not be auto-saved, or to change the location of the
>   ^^^^^^^^^^^^^^^^^^^^^^^
> > auto-saves (unless it can be done once and forever, only
> > apply to files in write-protected directories and no others,
> > and not require a listing of either the files or directories
> > to which it is to be applied).
> >
> > The desired behavior is that emacs recognize that a directory
>                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > is write-protected, and if an attempt to write to that directory
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > fails, that it fail silently.  (It would be quite OK to have
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > this governed by the behavior of a variable set in my .emacs file.)

He means that he doesn't want to have to intervene in any form.  He
wants that Emacs turns off auto saving for the file when it's not
possible to auto-save.

> (add-hook 'find-file-hook
> 	  (lambda () (when (file-writable-p
> 			    (file-name-directory buffer-file-name))
> 		       (auto-save-mode 0))))
>
> (add-hook 'find-file-not-found-functions
> 	  (lambda () (when (file-writable-p
> 			    (file-name-directory buffer-file-name))
> 		       (auto-save-mode 0))
> 		     ;; don't short-circuit run-hook-with-args-until-success:
> 		     nil))

Yes, something like that works no doubt (I think you mean
(not (file-writable-p ...)) ).

In addition, there should be a warning for the user.

But something like that should not have to be done in the user's
configuration.  The current behavior of Emacs makes no sense at all.  It
continues to try to autosave, fails every time, beeps and beeps and
shows messages.  This is not only very annoying, it does not make any
sense at all - it has no benefit for the user.

So, can we add something like the above code to Emacs?


Michael.






  reply	other threads:[~2012-04-20  1:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-18 21:03 bug#11274: 23.1; auto-save invoked in read-only directories danh
2012-04-19  6:44 ` Kevin Rodgers
2012-04-20  1:06   ` Michael Heerdegen [this message]
2021-05-28  2:29     ` bug#11274: bug#18907: 25.0.50; long pause when auto-save fails Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lilrnrer.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=11274@debbugs.gnu.org \
    --cc=kevin.d.rodgers@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).