* Tramp and file-precious-flag.
@ 2004-07-12 19:34 Luc Teirlinck
2004-07-18 19:25 ` Michael Albinus
0 siblings, 1 reply; 11+ messages in thread
From: Luc Teirlinck @ 2004-07-12 19:34 UTC (permalink / raw)
Cc: emacs-devel
If `file-precious-flag' is t, then if one saves a remote file using
Tramp, the visited file modtime gets set to 0. As a result, there
will be no warning when trying to save the buffer if the file changed
on disk. This problem does not exist for local files.
Sincerely,
Luc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-12 19:34 Tramp and file-precious-flag Luc Teirlinck
@ 2004-07-18 19:25 ` Michael Albinus
2004-07-18 19:51 ` Luc Teirlinck
0 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus @ 2004-07-18 19:25 UTC (permalink / raw)
Cc: emacs-devel
Luc Teirlinck <teirllm@dms.auburn.edu> writes:
> If `file-precious-flag' is t, then if one saves a remote file using
> Tramp, the visited file modtime gets set to 0. As a result, there
> will be no warning when trying to save the buffer if the file changed
> on disk. This problem does not exist for local files.
Somehow, I'm not able to reproduce the behaviour. Scenario:
C-x C-f ~/123
M-: file-precious-flag -> t
M-: (file-attributes (buffer-name (current-buffer)))
-> (nil 1 1000 1000 (16634 52569) (16634 52242) (16634 52242) 125 "-rw-r--r--" nil 476194 770)
editing ... saving
M-: (file-attributes (buffer-name (current-buffer)))
-> (nil 1 1000 1000 (16634 52660) (16634 52660) (16634 52660) 137 "-rw-r--r--" nil 476526 770)
C-x C-f /ssh:localhost:~/123
M-: file-precious-flag -> t
M-: (file-attributes (buffer-name (current-buffer)))
-> (nil 1 1000 1000 (16634 52704) (16634 52660) (16634 52660) 137 "-rw-r--r--" t (7 . 17774) (-1 2))
editing ... saving
M-: (file-attributes (buffer-name (current-buffer)))
-> (nil 1 1000 1000 (16634 52728) (16634 52728) (16634 52729) 118 "-rw-r--r--" t (7 . 17443) (-1 2))
> Sincerely,
>
> Luc.
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-18 19:25 ` Michael Albinus
@ 2004-07-18 19:51 ` Luc Teirlinck
2004-07-22 20:35 ` Michael Albinus
0 siblings, 1 reply; 11+ messages in thread
From: Luc Teirlinck @ 2004-07-18 19:51 UTC (permalink / raw)
Cc: emacs-devel
Sorry, what I meant was not that the modtime in `file-attributes'
would get set to 0, what I meant was that (visited-file-modtime)
returns 0 after a precious file is saved using Tramp. I just double
checked with emacs -q with a file made precious using:
-*- file-precious-flag: t; -*-
Sincerely,
Luc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-18 19:51 ` Luc Teirlinck
@ 2004-07-22 20:35 ` Michael Albinus
2004-07-23 1:12 ` Luc Teirlinck
2004-07-24 3:02 ` Richard Stallman
0 siblings, 2 replies; 11+ messages in thread
From: Michael Albinus @ 2004-07-22 20:35 UTC (permalink / raw)
Cc: emacs-devel
Luc Teirlinck <teirllm@dms.auburn.edu> writes:
> Sorry, what I meant was not that the modtime in `file-attributes'
> would get set to 0, what I meant was that (visited-file-modtime)
> returns 0 after a precious file is saved using Tramp. I just double
> checked with emacs -q with a file made precious using:
>
> -*- file-precious-flag: t; -*-
OK, now I got. Fixed in Tramp CVS, sync with Emacs CVS will follow
next stable Tramp.
In fact, the problem was due to documentation vagueness of
`write-region'. It is said, that modtime of visited file must be
updated in case `visit' is equal t. Nothing is said if `visit' is a
string. But the code of `write-region' shows it must be updated always
when `visit' is not nil. Is it worth a documentation clarification?
> Sincerely,
>
> Luc.
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-22 20:35 ` Michael Albinus
@ 2004-07-23 1:12 ` Luc Teirlinck
2004-07-23 8:00 ` Michael Albinus
2004-07-24 3:02 ` Richard Stallman
1 sibling, 1 reply; 11+ messages in thread
From: Luc Teirlinck @ 2004-07-23 1:12 UTC (permalink / raw)
Cc: emacs-devel
Michael Albinus wrote:
In fact, the problem was due to documentation vagueness of
`write-region'. It is said, that modtime of visited file must be
updated in case `visit' is equal t. Nothing is said if `visit' is a
string. But the code of `write-region' shows it must be updated always
when `visit' is not nil.
Do you really mean "always when `visit' is not nil" or do you mean
"when `visit' is t or a string":
If visit is neither t nor nil nor a string,
that means do not display the "Wrote file" message.
Is it worth a documentation clarification?
Probably it might be good to clarify the docstring and the Elisp
manual, as long as it really makes things more clear.
Docstring:
Optional fifth argument VISIT if t means
set the last-save-file-modtime of buffer to this file's modtime
and mark buffer not modified.
If VISIT is a string, it is a second file name; the output goes to
FILENAME, but the buffer is marked as visiting VISIT. VISIT is also
the file name to lock and unlock for clash detection.
In the case of a string, one would have to specify which file's
modtime, because there is FILENAME and VISIT. I guess the buffer also
gets marked not modified (I did not check).
Sincerely,
Luc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-23 1:12 ` Luc Teirlinck
@ 2004-07-23 8:00 ` Michael Albinus
2004-07-24 1:54 ` Luc Teirlinck
0 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus @ 2004-07-23 8:00 UTC (permalink / raw)
Cc: emacs-devel
Luc Teirlinck <teirllm@dms.auburn.edu> writes:
> Michael Albinus wrote:
>
> In fact, the problem was due to documentation vagueness of
> `write-region'. It is said, that modtime of visited file must be
> updated in case `visit' is equal t. Nothing is said if `visit' is a
> string. But the code of `write-region' shows it must be updated always
> when `visit' is not nil.
>
> Do you really mean "always when `visit' is not nil" or do you mean
> "when `visit' is t or a string":
Now _I_ have been vague ... The code of write-region in fileio.c looks
like this:
int visiting = (EQ (visit, Qt) || STRINGP (visit));
...
if (visiting)
current_buffer->modtime = st.st_mtime;
I've been lazy, my changed code in tramp-handle-write-region is:
(when visit
(set-visited-file-modtime))
Maybe I should go exactly to the behaviour as implemented in
write-region.
> Sincerely,
>
> Luc.
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-23 8:00 ` Michael Albinus
@ 2004-07-24 1:54 ` Luc Teirlinck
2004-07-24 18:49 ` Michael Albinus
0 siblings, 1 reply; 11+ messages in thread
From: Luc Teirlinck @ 2004-07-24 1:54 UTC (permalink / raw)
Cc: emacs-devel
Michael Albinus wrote:
Maybe I should go exactly to the behaviour as implemented in
write-region.
Yes, because I believe that otherwise the user may risk winding up
overwriting changes on disk without proper warning.
Sincerely,
Luc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-24 1:54 ` Luc Teirlinck
@ 2004-07-24 18:49 ` Michael Albinus
2004-07-25 2:24 ` Luc Teirlinck
0 siblings, 1 reply; 11+ messages in thread
From: Michael Albinus @ 2004-07-24 18:49 UTC (permalink / raw)
Cc: emacs-devel
Luc Teirlinck <teirllm@dms.auburn.edu> writes:
> Michael Albinus wrote:
>
> Maybe I should go exactly to the behaviour as implemented in
> write-region.
>
> Yes, because I believe that otherwise the user may risk winding up
> overwriting changes on disk without proper warning.
Done.
> Sincerely,
>
> Luc.
Best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-24 18:49 ` Michael Albinus
@ 2004-07-25 2:24 ` Luc Teirlinck
2004-07-25 11:06 ` Michael Albinus
0 siblings, 1 reply; 11+ messages in thread
From: Luc Teirlinck @ 2004-07-25 2:24 UTC (permalink / raw)
Cc: emacs-devel
I am talking about the latest Tramp (not Emacs) CVS version of
tramp.el. (It seems obvious that a further merge with Emacs CVS is
necessary before release of Emacs-21.4.)
When I create a new file with `file-precious-flag' eq t, using Tramp
(ssh), then initially `visited-file-modtime' now returns (-1 65535).
That is good. However, when I then make changes and save them, the
return value after that is _still_ (-1 65535). As a result, when I
try to make changes, I get warned that the file has changed on disk.
Only when I save the file for the _second_ time does it get a "real"
modtime, after which everything works normally.
Sincerely,
Luc.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-25 2:24 ` Luc Teirlinck
@ 2004-07-25 11:06 ` Michael Albinus
0 siblings, 0 replies; 11+ messages in thread
From: Michael Albinus @ 2004-07-25 11:06 UTC (permalink / raw)
Cc: emacs-devel
Luc Teirlinck <teirllm@dms.auburn.edu> writes:
> When I create a new file with `file-precious-flag' eq t, using Tramp
> (ssh), then initially `visited-file-modtime' now returns (-1 65535).
> That is good. However, when I then make changes and save them, the
> return value after that is _still_ (-1 65535). As a result, when I
> try to make changes, I get warned that the file has changed on disk.
> Only when I save the file for the _second_ time does it get a "real"
> modtime, after which everything works normally.
The problem was that Tramp tried to examine the modtime of the file
the buffer is visiting. But this file is different from the file to
be saved in case `file-precious-flag' equals t, so Tramp is failing
(still believing the file does not exists yet).
I've changed it such a way that `set-visited-file-modtime' passes the
modtime of the file just saved as parameter. Committed to Tramp CVS,
branch "branch-2-0-stable".
> Sincerely,
>
> Luc.
Thanx a lot for your testing, and best regards, Michael.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Tramp and file-precious-flag.
2004-07-22 20:35 ` Michael Albinus
2004-07-23 1:12 ` Luc Teirlinck
@ 2004-07-24 3:02 ` Richard Stallman
1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2004-07-24 3:02 UTC (permalink / raw)
Cc: teirllm, emacs-devel
I will update the doc string of write-region. Thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-07-25 11:06 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-12 19:34 Tramp and file-precious-flag Luc Teirlinck
2004-07-18 19:25 ` Michael Albinus
2004-07-18 19:51 ` Luc Teirlinck
2004-07-22 20:35 ` Michael Albinus
2004-07-23 1:12 ` Luc Teirlinck
2004-07-23 8:00 ` Michael Albinus
2004-07-24 1:54 ` Luc Teirlinck
2004-07-24 18:49 ` Michael Albinus
2004-07-25 2:24 ` Luc Teirlinck
2004-07-25 11:06 ` Michael Albinus
2004-07-24 3:02 ` Richard Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.