GNU bug report logs - #3016
23.0.92.2; offer to make a directory when saving if it is needed

Previous Next

Package: emacs;

Reported by: dcl441-bugs <at> yahoo.com

Date: Thu, 16 Apr 2009 12:45:04 UTC

Severity: wishlist

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3016 in the body.
You can then email your comments to 3016 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3016; Package emacs. (Thu, 16 Apr 2009 12:45:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to dcl441-bugs <at> yahoo.com:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 16 Apr 2009 12:45:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Daniel Clemente <dcl441-bugs <at> yahoo.com>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.92.2; offer to make a directory when saving if it is needed
Date: Thu, 16 Apr 2009 05:37:44 -0700 (PDT)

1. Do: C-x C-f /tmp/doesnotexist/myfile RET. Emacs tells you about make-directory
2. Type something.
3. C-x C-s. Error: no such directory

I suggest that Emacs not only tell the user about make-directory, but actually ask him/her in a y-n question if the directory should be created. This should happen on save.

The script could be then:

a. User does: C-x C-f /tmp/doesnotexist/myfile RET
b. Emacs warns: Warning: Directory /tmp/doesnotexist does not exist
c. User types something
d. User does: C-x C-s
e. Emacs asks: Create directory /tmp/doesnotexist? (y/n)
f1. If yes, it (and the above directories) are created
f2. If not, issue an error. The user can then do M-x make-directory as needed


This allows a faster save with just one extra key (C-x C-s y) instead of having to type M-x make-directory /tmp/doesnotexist RET C-x C-s








Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sat, 18 Apr 2009 00:10:04 GMT) Full text and rfc822 format available.

Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Tue, 12 Feb 2013 08:39:02 GMT) Full text and rfc822 format available.

Notification sent to dcl441-bugs <at> yahoo.com:
bug acknowledged by developer. (Tue, 12 Feb 2013 08:39:02 GMT) Full text and rfc822 format available.

Message #12 received at 3016-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 3016-done <at> debbugs.gnu.org
Subject: Re: bug#3016: 23.0.92.2;
	offer to make a directory when saving if it is needed
Date: Tue, 12 Feb 2013 03:37:39 -0500
Version: 24.4

Daniel Clemente wrote:

> 1. Do: C-x C-f /tmp/doesnotexist/myfile RET. Emacs tells you about
> make-directory
> 2. Type something.
> 3. C-x C-s. Error: no such directory
>
> I suggest that Emacs not only tell the user about make-directory, but
> actually ask him/her in a y-n question if the directory should be
> created. This should happen on save.

Sorry for the huge delay. This seems like a good idea, so I did it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3016; Package emacs. (Wed, 20 Feb 2013 15:35:01 GMT) Full text and rfc822 format available.

Message #15 received at 3016 <at> debbugs.gnu.org (full text, mbox):

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: rgm <at> gnu.org
Cc: dcl441-bugs <at> yahoo.com, 3016 <at> debbugs.gnu.org
Subject: Re: bug#3016: 23.0.92.2;
	offer to make a directory when saving if it is needed
Date: Thu, 21 Feb 2013 00:33:10 +0900
At Tue, 12 Feb 2013 03:37:39 -0500,
Glenn Morris wrote:
> 
> Version: 24.4
> 
> Daniel Clemente wrote:
> 
> > 1. Do: C-x C-f /tmp/doesnotexist/myfile RET. Emacs tells you about
> > make-directory
> > 2. Type something.
> > 3. C-x C-s. Error: no such directory
> >
> > I suggest that Emacs not only tell the user about make-directory, but
> > actually ask him/her in a y-n question if the directory should be
> > created. This should happen on save.
> 
> Sorry for the huge delay. This seems like a good idea, so I did it.

I want this check is done more later.  Because, in draft buffers of
Wanderlust (a message user agent), buffer-file-name does not indicate
actual file name and saving file is done via hook functions (such as
write-contents-functions, local-write-file-hooks,
write-file-functions).  In such case, this offer could make incorrect
directory.

-- 
Kazuhiro Ito




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3016; Package emacs. (Wed, 20 Feb 2013 21:30:02 GMT) Full text and rfc822 format available.

Message #18 received at 3016 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: dcl441-bugs <at> yahoo.com, 3016 <at> debbugs.gnu.org
Subject: Re: bug#3016: 23.0.92.2;
	offer to make a directory when saving if it is needed
Date: Wed, 20 Feb 2013 16:28:21 -0500
Kazuhiro Ito wrote:

> I want this check is done more later.  Because, in draft buffers of
> Wanderlust (a message user agent), buffer-file-name does not indicate
> actual file name and saving file is done via hook functions (such as
> write-contents-functions, local-write-file-hooks,
> write-file-functions).  In such case, this offer could make incorrect
> directory.

My initial reaction is to ask why you can't just set buffer-file-name to
the right value (or to nil, so that basic-save-buffer will prompt for
it); or at least to something whose parent directory exists, and then do
whatever checks you want in your hook functions?

By doing it the way you do, it sounds like you must already be missing
the other checks that basic-save-buffer does (overwriting an existing
file, saving to a directory rather than a file, verify file modtime),
though they may not be relevant in your case.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3016; Package emacs. (Thu, 21 Feb 2013 09:55:02 GMT) Full text and rfc822 format available.

Message #21 received at 3016 <at> debbugs.gnu.org (full text, mbox):

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: Glenn Morris <rgm <at> gnu.org>
Cc: dcl441-bugs <at> yahoo.com, 3016 <at> debbugs.gnu.org
Subject: Re: bug#3016: 23.0.92.2;
	offer to make a directory when saving if it is needed
Date: Thu, 21 Feb 2013 18:52:55 +0900
At Wed, 20 Feb 2013 16:28:21 -0500,
Glenn Morris wrote:
> 
> Kazuhiro Ito wrote:
> 
> > I want this check is done more later.  Because, in draft buffers of
> > Wanderlust (a message user agent), buffer-file-name does not indicate
> > actual file name and saving file is done via hook functions (such as
> > write-contents-functions, local-write-file-hooks,
> > write-file-functions).  In such case, this offer could make incorrect
> > directory.
> 
> My initial reaction is to ask why you can't just set buffer-file-name to
> the right value (or to nil, so that basic-save-buffer will prompt for
> it); or at least to something whose parent directory exists, and then do
> whatever checks you want in your hook functions?

In Wanderlust, the file name (represented by message number) for the
draft is decided when buffer is made.  But Wanderlust updates it to
make the latest saved draft have largest number.  So, Wanderlust needs
to check and modify the file name at saving for the case that another
draft is saved while editing the draft.  Setting buffer-file-name to
existing directory could avoid the present problem, but I think that
is very ad hoc.

> By doing it the way you do, it sounds like you must already be missing
> the other checks that basic-save-buffer does (overwriting an existing
> file, saving to a directory rather than a file, verify file modtime),
> though they may not be relevant in your case.

Thank you for pointing it out.  It seems that Emacs does not expect
buffer-file-name is modified while hook functions.  Additionally, I
noticed that Wanderlust could save draft into non-local file, i.e.
remote imap4 server.  If basic-save-buffer really does not support
such cases, Wanderlust would need the workaround or to have own draft
saving function.

-- 
Kazuhiro Ito




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3016; Package emacs. (Thu, 21 Feb 2013 17:08:01 GMT) Full text and rfc822 format available.

Message #24 received at 3016 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Cc: 3016 <at> debbugs.gnu.org
Subject: Re: bug#3016: 23.0.92.2;
	offer to make a directory when saving if it is needed
Date: Thu, 21 Feb 2013 12:05:44 -0500
Kazuhiro Ito wrote:

>> > I want this check is done more later.  Because, in draft buffers of
>> > Wanderlust (a message user agent), buffer-file-name does not indicate
>> > actual file name and saving file is done via hook functions (such as
>> > write-contents-functions, local-write-file-hooks,
>> > write-file-functions).  In such case, this offer could make incorrect
>> > directory.

I had to move it after the hooks anyway, due to

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13773





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 22 Mar 2013 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 74 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.