unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11274: 23.1; auto-save invoked in read-only directories
@ 2012-04-18 21:03 danh
  2012-04-19  6:44 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: danh @ 2012-04-18 21:03 UTC (permalink / raw)
  To: 11274; +Cc: danh

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.

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

I am not the only person who has reported this problem to
newsgroups, but i wasn't aware of the possibility of filing
a bug from within emacs until Michael Heerdegen told me
about it.

(Note that emacs does not crash, and never has for me.  But
the freezing happens to me, colleagues of mine, and people
i've never heard of on the newsgroups.)

dan  (danh@archive.org)


In GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-11-23 on yellow, modified by Debian
configured using `configure  '--build=x86_64-linux-gnu' '--host=x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.utf8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
ESC [ > 1 ; 2 4 0 3 ; 0 c ESC x C-f r e p o r t - e 
m TAB RET

Recent messages:
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50git-core.el (source)...done
Loading /etc/emacs/site-start.d/50js2-mode.el (source)...done
Loading /etc/emacs/site-start.d/50mmm-mode.el (source)...done
Loading /etc/emacs/site-start.d/50php-elisp.el (source)...done
Loading /etc/emacs/site-start.d/50psvn.el (source)...done
Loading /home/danh/elisp/readonly.el (source)...done
Loading /home/danh/.abbrev_defs...done
For information about GNU Emacs and the GNU system, type C-h C-a.
call-interactively: End of buffer





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#11274: 23.1; auto-save invoked in read-only directories
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2012-04-19  6:44 UTC (permalink / raw)
  To: 11274

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

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

> I am not the only person who has reported this problem to
> newsgroups, but i wasn't aware of the possibility of filing
> a bug from within emacs until Michael Heerdegen told me
> about it.
>
> (Note that emacs does not crash, and never has for me.  But
> the freezing happens to me, colleagues of mine, and people
> i've never heard of on the newsgroups.)
>
> dan  (danh@archive.org)

-- 
Kevin Rodgers
Denver, Colorado, USA






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#11274: 23.1; auto-save invoked in read-only directories
  2012-04-19  6:44 ` Kevin Rodgers
@ 2012-04-20  1:06   ` Michael Heerdegen
  2021-05-28  2:29     ` bug#11274: bug#18907: 25.0.50; long pause when auto-save fails Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Heerdegen @ 2012-04-20  1:06 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: 11274

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.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#11274: bug#18907: 25.0.50; long pause when auto-save fails
  2012-04-20  1:06   ` Michael Heerdegen
@ 2021-05-28  2:29     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-05-28  2:29 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 18907, 11274, Kevin Rodgers

Michael Heerdegen <michael_heerdegen@web.de> writes:

> 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.

I think that this has basically been implemented in the years since this
was reported.

These days, Emacs will warn by popping up the *Warnings* buffer:

Error (auto-save): Auto-saving foo: Opening output file: Permission denied, /etc/#foo# Disable showing Disable logging

And you can disable these messages by clicking on the links.

So I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-05-28  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2021-05-28  2:29     ` bug#11274: bug#18907: 25.0.50; long pause when auto-save fails Lars Ingebrigtsen

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