* find-file-literally and save-buffer
@ 2007-03-26 11:59 Alfred M. Szmidt
2007-03-27 3:54 ` Chong Yidong
0 siblings, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2007-03-26 11:59 UTC (permalink / raw)
To: emacs-devel
Hey,
When you open a RMAIL (might occur with other modes as well) buffer
literally, and then try to save it, emacs just keeps asking if you
wish to save the file and visit it normally. Answering `yes' doesn't
do anything, it keeps asking the same question. Answering no will
just ask you if you want to discard the changes.
The message that one gets seems awfully long as well, 6 lines:
| The file %s is already visited normally,
| and you have edited the buffer. Now you have asked to visit it literally,
| meaning no coding system handling, format conversion, or local variables.
| Emacs can only visit a file in one way at a time.
|
| Do you want to save the file, and visit it literally instead?
To reproduce:
| emacs -Q
| M-x find-file-literally ~/RMAIL.empty RET
| C-u M-~ (not-modified t)
| C-x C-s (save-buffer)
Answering y at this point has no effect, though if you keep it pressed for a while you get this message in *Messages*
| vc-check-master-templates: Lisp nesting exeeds `max-lisp-eval-depth'
RMAIL.empty was created with:
| C-u M-x rmail ~/RMAIL.empty RET
| s (rmail-expunge-and-save)
There also seems to be no way to save the buffer, without visiting the
file normally.
Cheers.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-26 11:59 find-file-literally and save-buffer Alfred M. Szmidt
@ 2007-03-27 3:54 ` Chong Yidong
2007-03-27 4:07 ` Chong Yidong
0 siblings, 1 reply; 10+ messages in thread
From: Chong Yidong @ 2007-03-27 3:54 UTC (permalink / raw)
To: ams; +Cc: emacs-devel
"Alfred M. Szmidt" <ams@gnu.org> writes:
> To reproduce:
>
> | emacs -Q
> | M-x find-file-literally ~/RMAIL.empty RET
> | C-u M-~ (not-modified t)
> | C-x C-s (save-buffer)
>
> Answering y at this point has no effect
I can't seem to reproduce this... maybe it depends on a specific RMAIL
file that you're using?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-27 3:54 ` Chong Yidong
@ 2007-03-27 4:07 ` Chong Yidong
2007-03-27 9:47 ` Alfred M. Szmidt
2007-03-27 11:37 ` Alfred M. Szmidt
0 siblings, 2 replies; 10+ messages in thread
From: Chong Yidong @ 2007-03-27 4:07 UTC (permalink / raw)
To: ams; +Cc: emacs-devel
Chong Yidong <cyd@stupidchicken.com> writes:
> "Alfred M. Szmidt" <ams@gnu.org> writes:
>
>> To reproduce:
>>
>> | emacs -Q
>> | M-x find-file-literally ~/RMAIL.empty RET
>> | C-u M-~ (not-modified t)
>> | C-x C-s (save-buffer)
>>
>> Answering y at this point has no effect
>
> I can't seem to reproduce this...
I think I see what you mean a little more clearly, but I still don't
see the bug.
You didn't mention this in your original post, but you must already
have the file RMAIL.empty open in Rmail mode before doing
find-file-literally to see the warning prompt you mentioned.
For me, however, typing "y" at the prompt does have the desired effect
of opening RMAIL.empty literally. So the bug doesn't happen for me.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-27 4:07 ` Chong Yidong
@ 2007-03-27 9:47 ` Alfred M. Szmidt
2007-03-27 11:37 ` Alfred M. Szmidt
1 sibling, 0 replies; 10+ messages in thread
From: Alfred M. Szmidt @ 2007-03-27 9:47 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
>> To reproduce:
>>
>> | emacs -Q
>> | M-x find-file-literally ~/RMAIL.empty RET
>> | C-u M-~ (not-modified t)
>> | C-x C-s (save-buffer)
>>
>> Answering y at this point has no effect
>
> I can't seem to reproduce this...
I think I see what you mean a little more clearly, but I still don't
see the bug.
You didn't mention this in your original post, but you must already
have the file RMAIL.empty open in Rmail mode before doing
find-file-literally to see the warning prompt you mentioned.
I didn't need to have that, for me it occurs when I do exactly what I
noted above; and it always happens. I'll see if I can get a
backtrace.
For me, however, typing "y" at the prompt does have the desired effect
of opening RMAIL.empty literally. So the bug doesn't happen for me.
Strange.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-27 4:07 ` Chong Yidong
2007-03-27 9:47 ` Alfred M. Szmidt
@ 2007-03-27 11:37 ` Alfred M. Szmidt
2007-03-27 14:27 ` Chong Yidong
1 sibling, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2007-03-27 11:37 UTC (permalink / raw)
To: Chong Yidong; +Cc: emacs-devel
>> To reproduce:
>>
>> | emacs -Q
>> | M-x find-file-literally ~/RMAIL.empty RET
>> | C-u M-~ (not-modified t)
>> | C-x C-s (save-buffer)
>>
>> Answering y at this point has no effect
>
> I can't seem to reproduce this...
I tried this on two different systems, on running GNU/Linux and the
other running OpenBSD, and both exhibit the same behaviour for me. I
think this might be related to me having my home directory under
version control (using arch; this might be the reason why you couldn't
reproduce it.
find-file-noselect enters a recursive loop (I snipped the backtrace a
bit, since it was long), why I'm not sure. But I think it is because
vc-arch-file-source-p calls find-file-noselect, which in turn calls
vc-arch-file-source-p, and so on...
===File /ssh:trillian:~/bt==================================
Debugger entered--entering a function:
* ad-Orig-find-file-noselect("/home/ams/RMAIL.empty" nil nil nil)
(setq ad-return-value (ad-Orig-find-file-noselect filename nowarn rawfile wildcards))
(let ((trace-level ...) (trace-buffer ...)) (unless inhibit-trace (with-current-buffer trace-buffer nil ... ... ...)) (setq ad-return-value (ad-Orig-find-file-noselect filename nowarn rawfile wildcards)) (unless inhibit-trace (with-current-buffer trace-buffer nil ... ...)))
(let (ad-return-value) (let (... ...) (unless inhibit-trace ...) (setq ad-return-value ...) (unless inhibit-trace ...)) ad-return-value)
find-file-noselect("/home/ams/RMAIL.empty")
vc-arch-file-source-p("/home/ams/RMAIL.empty")
vc-arch-registered("/home/ams/RMAIL.empty")
apply(vc-arch-registered "/home/ams/RMAIL.empty")
vc-call-backend(Arch registered "/home/ams/RMAIL.empty")
#[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4](Arch)
mapcar(#[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4] (RCS CVS SVN SCCS Arch MCVS))
byte-code("Ã\bÄ\"\x19ÅÆ \x11\0 Ç=\x15\0\n\x18\0 \nB\")È\bÄÇ#É" [file backend vc-handled-backends vc-file-getprop vc-backend mapcar #[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4] none vc-file-setprop nil] 4)
vc-registered("/home/ams/RMAIL.empty")
vc-backend("/home/ams/RMAIL.empty")
vc-before-save()
basic-save-buffer()
save-buffer()
byte-code("ÆÇ\b!!\x10È\b!(\0 #\0ÉÊ\n\x1e\0ÆË\b!!\x1f\0\b\"\x02ÌÍ\b\"\vU\0\fU\0ÎÏ\b\"U\0ÎÐ\b\"U\0ÑÒÓÑ\x1c\x1dO\0Ô\b!S\0ÕÔ\r\"*Ö\b!\x1e@ÆË\b!!\x1eA×\x0eA!\x1eBØ\x0eB\x1eC\x0e@?
v\0Ù\b!\x1eD¥\0\x0eE\0\x0eF\0\bÚ\x0eD!\0ÛÜ\bÚ\x0eD!#\x0eG¡\0\n¥\0\x0eD\x16@\x0eHÚ\0Ý\x0eB8Ú\0\x0e@Ú\0\x0eEÚ\0Ý\x0eB8\x0eHVÚ\0Þßàá\b!Ý\x0eB8â¥#!Ú\0Ìã!\x0e@
\x02Ñ\x1eI\x0eE\x01ä\x0e@!\x01å\b!ÿ\0æ\x16IÛç\b\"\x01è\x0e@!D\x01\x0eJÑ\x1eK\x1eL&\x01Î\x0eL@\b\"\x1d\x01æ\x16K\x0eLA\x16L\x11\x01\x0eK*D\x01r\x0e@qÛé\b\"êæ\"Ûë\b\")\x01ìá\b!í\x0e@!d\x01ßè\x0e@!\\\x01î]\x01ïá\b!\"y\x01ßè\x0e@!p\x01ðq\x01ñá\b!í\x0e@!#!\x01r\x0e@qêæ\")r\x0e@qò\x0e\x1a!?\x1eM\x0eIË\x01\x0eM\x0eN=Ë\x01\x0eM\x0eO=Ë\x01\x0eEÇ\x01ßó\x0e\x1a\x0eM»\x01ô¼\x01õ#\x1ePÞ\x0eP!)Ë\x01\x0eM\x16O\x0eM\x16N)\x0eQ??\x0eR??=~\x02\x0eI~\x02\x0eSö=~\x02è I\x02Þß\x0eQø\x01÷ù\x01øá\b!\"!\x16\x02ù ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06~\x02Þß\x0eQ!\x02û\"\x02ü!!9\x02ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06~\x02Ì\x0eQC\x02ýD\x02þ!~\x02Þß\x0eQT\x02ÿW\x02T\0á\b!\"!q\x02ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06~\x02Ì\x0eQ{\x02ý|\x02þ!)\x0e@)\x02U\0\b!\x16@ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06-" [filename find-file-run-dired find-file-visit-truename wildcards find-file-wildcards files abbreviate-file-name expand-file-name file-directory-p run-hook-with-args-until-success find-directory-functions file-truename error "%s is a directory" string-match "\\`/:" "[[*?]" nil (file-expand-wildcards filename t) ((error ...)) find-file-noselect mapcar get-file-buffer file-attributes 10 find-buffer-visiting buffer-file-name message "%s and %s are the same file" 7 y-or-n-p format "File %s is large (%dMB), really open? " file-name-nondirectory 1048576 "Aborted" verify-visited-file-modtime file-exists-p t "File %s no longer exists!" buffer-modified-p "Reverting file %s..." revert-buffer "Reverting file %s...done" yes-or-no-p buffer-name "File %s changed on disk. Discard your edits? " "File %s changed on disk. Reread from disk? " "File %s changed on disk. Discard your edits in %s? " "File %s changed on disk. Reread from disk into %s? " ...] 8)
* ad-Orig-find-file-noselect("/home/ams/RMAIL.empty" nil nil nil)
(setq ad-return-value (ad-Orig-find-file-noselect filename nowarn rawfile wildcards))
(let ((trace-level ...) (trace-buffer ...)) (unless inhibit-trace (with-current-buffer trace-buffer nil ... ... ...)) (setq ad-return-value (ad-Orig-find-file-noselect filename nowarn rawfile wildcards)) (unless inhibit-trace (with-current-buffer trace-buffer nil ... ...)))
(let (ad-return-value) (let (... ...) (unless inhibit-trace ...) (setq ad-return-value ...) (unless inhibit-trace ...)) ad-return-value)
find-file-noselect("/home/ams/RMAIL.empty")
vc-arch-file-source-p("/home/ams/RMAIL.empty")
vc-arch-registered("/home/ams/RMAIL.empty")
apply(vc-arch-registered "/home/ams/RMAIL.empty")
vc-call-backend(Arch registered "/home/ams/RMAIL.empty")
#[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4](Arch)
mapcar(#[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4] (RCS CVS SVN SCCS Arch MCVS))
byte-code("Ã\bÄ\"\x19ÅÆ \x11\0 Ç=\x15\0\n\x18\0 \nB\")È\bÄÇ#É" [file backend vc-handled-backends vc-file-getprop vc-backend mapcar #[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4] none vc-file-setprop nil] 4)
vc-registered("/home/ams/RMAIL.empty")
vc-backend("/home/ams/RMAIL.empty")
vc-before-save()
basic-save-buffer()
save-buffer()
byte-code("ÆÇ\b!!\x10È\b!(\0 #\0ÉÊ\n\x1e\0ÆË\b!!\x1f\0\b\"\x02ÌÍ\b\"\vU\0\fU\0ÎÏ\b\"U\0ÎÐ\b\"U\0ÑÒÓÑ\x1c\x1dO\0Ô\b!S\0ÕÔ\r\"*Ö\b!\x1e@ÆË\b!!\x1eA×\x0eA!\x1eBØ\x0eB\x1eC\x0e@?
v\0Ù\b!\x1eD¥\0\x0eE\0\x0eF\0\bÚ\x0eD!\0ÛÜ\bÚ\x0eD!#\x0eG¡\0\n¥\0\x0eD\x16@\x0eHÚ\0Ý\x0eB8Ú\0\x0e@Ú\0\x0eEÚ\0Ý\x0eB8\x0eHVÚ\0Þßàá\b!Ý\x0eB8â¥#!Ú\0Ìã!\x0e@
\x02Ñ\x1eI\x0eE\x01ä\x0e@!\x01å\b!ÿ\0æ\x16IÛç\b\"\x01è\x0e@!D\x01\x0eJÑ\x1eK\x1eL&\x01Î\x0eL@\b\"\x1d\x01æ\x16K\x0eLA\x16L\x11\x01\x0eK*D\x01r\x0e@qÛé\b\"êæ\"Ûë\b\")\x01ìá\b!í\x0e@!d\x01ßè\x0e@!\\\x01î]\x01ïá\b!\"y\x01ßè\x0e@!p\x01ðq\x01ñá\b!í\x0e@!#!\x01r\x0e@qêæ\")r\x0e@qò\x0e\x1a!?\x1eM\x0eIË\x01\x0eM\x0eN=Ë\x01\x0eM\x0eO=Ë\x01\x0eEÇ\x01ßó\x0e\x1a\x0eM»\x01ô¼\x01õ#\x1ePÞ\x0eP!)Ë\x01\x0eM\x16O\x0eM\x16N)\x0eQ??\x0eR??=~\x02\x0eI~\x02\x0eSö=~\x02è I\x02Þß\x0eQø\x01÷ù\x01øá\b!\"!\x16\x02ù ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06~\x02Þß\x0eQ!\x02û\"\x02ü!!9\x02ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06~\x02Ì\x0eQC\x02ýD\x02þ!~\x02Þß\x0eQT\x02ÿW\x02T\0á\b!\"!q\x02ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06~\x02Ì\x0eQ{\x02ý|\x02þ!)\x0e@)\x02U\0\b!\x16@ú\x0e@\b\x0eE\x0eQ\x0eA\x0eC&\x06-" [filename find-file-run-dired find-file-visit-truename wildcards find-file-wildcards files abbreviate-file-name expand-file-name file-directory-p run-hook-with-args-until-success find-directory-functions file-truename error "%s is a directory" string-match "\\`/:" "[[*?]" nil (file-expand-wildcards filename t) ((error ...)) find-file-noselect mapcar get-file-buffer file-attributes 10 find-buffer-visiting buffer-file-name message "%s and %s are the same file" 7 y-or-n-p format "File %s is large (%dMB), really open? " file-name-nondirectory 1048576 "Aborted" verify-visited-file-modtime file-exists-p t "File %s no longer exists!" buffer-modified-p "Reverting file %s..." revert-buffer "Reverting file %s...done" yes-or-no-p buffer-name "File %s changed on disk. Discard your edits? " "File %s changed on disk. Reread from disk? " "File %s changed on disk. Discard your edits in %s? " "File %s changed on disk. Reread from disk into %s? " ...] 8)
* ad-Orig-find-file-noselect("/home/ams/RMAIL.empty" nil nil nil)
(setq ad-return-value (ad-Orig-find-file-noselect filename nowarn rawfile wildcards))
(let ((trace-level ...) (trace-buffer ...)) (unless inhibit-trace (with-current-buffer trace-buffer nil ... ... ...)) (setq ad-return-value (ad-Orig-find-file-noselect filename nowarn rawfile wildcards)) (unless inhibit-trace (with-current-buffer trace-buffer nil ... ...)))
(let (ad-return-value) (let (... ...) (unless inhibit-trace ...) (setq ad-return-value ...) (unless inhibit-trace ...)) ad-return-value)
find-file-noselect("/home/ams/RMAIL.empty")
vc-arch-file-source-p("/home/ams/RMAIL.empty")
vc-arch-registered("/home/ams/RMAIL.empty")
apply(vc-arch-registered "/home/ams/RMAIL.empty")
vc-call-backend(Arch registered "/home/ams/RMAIL.empty")
#[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4](Arch)
mapcar(#[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4] (RCS CVS SVN SCCS Arch MCVS))
byte-code("Ã\bÄ\"\x19ÅÆ \x11\0 Ç=\x15\0\n\x18\0 \nB\")È\bÄÇ#É" [file backend vc-handled-backends vc-file-getprop vc-backend mapcar #[(b) "Â\bà #
\x14\0Ä Å\b#
\x14\0ÆÇÈ\"" [b file vc-call-backend registered vc-file-setprop vc-backend throw found t] 4] none vc-file-setprop nil] 4)
vc-registered("/home/ams/RMAIL.empty")
vc-backend("/home/ams/RMAIL.empty")
vc-before-save()
basic-save-buffer()
save-buffer(1)
call-interactively(save-buffer)
============================================================
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-27 11:37 ` Alfred M. Szmidt
@ 2007-03-27 14:27 ` Chong Yidong
2007-03-27 18:56 ` Alfred M. Szmidt
2007-03-28 1:19 ` Stefan Monnier
0 siblings, 2 replies; 10+ messages in thread
From: Chong Yidong @ 2007-03-27 14:27 UTC (permalink / raw)
To: ams; +Cc: Stefan Monnier, emacs-devel
"Alfred M. Szmidt" <ams@gnu.org> writes:
> >> | emacs -Q
> >> | M-x find-file-literally ~/RMAIL.empty RET
> >> | C-u M-~ (not-modified t)
> >> | C-x C-s (save-buffer)
>
> I think this might be related to me having my home directory under
> version control ... I think it is because vc-arch-file-source-p
> calls find-file-noselect, which in turn calls vc-arch-file-source-p,
> and so on...
Probably the fix is for vc-arch-file-source-p to check if
get-file-buffer is nil; if so, it should perform insert-file-contents
on a temp buffer, instead of visiting the file directly.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-27 14:27 ` Chong Yidong
@ 2007-03-27 18:56 ` Alfred M. Szmidt
2007-03-28 1:19 ` Stefan Monnier
1 sibling, 0 replies; 10+ messages in thread
From: Alfred M. Szmidt @ 2007-03-27 18:56 UTC (permalink / raw)
To: Chong Yidong; +Cc: monnier, emacs-devel
> >> | emacs -Q
> >> | M-x find-file-literally ~/RMAIL.empty RET
> >> | C-u M-~ (not-modified t)
> >> | C-x C-s (save-buffer)
>
> I think this might be related to me having my home directory
> under version control ... I think it is because
> vc-arch-file-source-p calls find-file-noselect, which in turn
> calls vc-arch-file-source-p, and so on...
Probably the fix is for vc-arch-file-source-p to check if
get-file-buffer is nil; if so, it should perform
insert-file-contents on a temp buffer, instead of visiting the file
directly.
I tried changing the code in a similar fashion, but without the
get-file-buffer check, like this, but it didn't have the desrired
result, no question pops up if I wish to revisit the file normally.
Any ideas?
*** vc-arch.el 28 Jan 2007 21:10:40 +0100 1.23
--- vc-arch.el 27 Mar 2007 20:56:19 +0200
***************
*** 122,134 ****
(concat ".arch-ids/" (file-name-nondirectory file) ".id")
(file-name-directory file)))
;; Check the presence of a tagline.
! (with-current-buffer (find-file-noselect file)
! (save-excursion
! (goto-char (point-max))
! (or (re-search-backward vc-arch-tagline-re (- (point) 1000) t)
! (progn
! (goto-char (point-min))
! (re-search-forward vc-arch-tagline-re (+ (point) 1000) t)))))
;; FIXME: check =tagging-method to see whether untagged files might
;; be source or not.
(with-current-buffer
--- 122,135 ----
(concat ".arch-ids/" (file-name-nondirectory file) ".id")
(file-name-directory file)))
;; Check the presence of a tagline.
! (with-temp-buffer
! (insert-file-contents-literally file)
! (save-excursion
! (goto-char (point-max))
! (or (re-search-backward vc-arch-tagline-re (- (point) 1000) t)
! (progn
! (goto-char (point-min))
! (re-search-forward vc-arch-tagline-re (+ (point) 1000) t)))))
;; FIXME: check =tagging-method to see whether untagged files might
;; be source or not.
(with-current-buffer
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-27 14:27 ` Chong Yidong
2007-03-27 18:56 ` Alfred M. Szmidt
@ 2007-03-28 1:19 ` Stefan Monnier
2007-03-28 1:51 ` Alfred M. Szmidt
1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2007-03-28 1:19 UTC (permalink / raw)
To: Chong Yidong; +Cc: ams, emacs-devel
>> >> | emacs -Q
>> >> | M-x find-file-literally ~/RMAIL.empty RET
>> >> | C-u M-~ (not-modified t)
>> >> | C-x C-s (save-buffer)
>>
>> I think this might be related to me having my home directory under
>> version control ... I think it is because vc-arch-file-source-p
>> calls find-file-noselect, which in turn calls vc-arch-file-source-p,
>> and so on...
> Probably the fix is for vc-arch-file-source-p to check if
> get-file-buffer is nil; if so, it should perform insert-file-contents
> on a temp buffer, instead of visiting the file directly.
Sounds right,
I've just installed the patch below to address it,
Stefan
--- vc-arch.el 29 jan 2007 13:35:19 -0500 1.23
+++ vc-arch.el 27 mar 2007 21:15:35 -0400
@@ -109,6 +109,17 @@
(defconst vc-arch-tagline-re "^\\W*arch-tag:[ \t]*\\(.*[^ \t\n]\\)")
+(defmacro vc-with-current-file-buffer (file &rest body)
+ (declare (indent 2) (debug t))
+ `(let ((-kill-buf- nil)
+ (-file- ,file))
+ (with-current-buffer (or (find-buffer-visiting -file-)
+ (setq -kill-buf- (generate-new-buffer " temp")))
+ (if -kill-buf- (insert-file-contents -file-))
+ (unwind-protect
+ (progn ,@body)
+ (if -kill-buf- (kill-buffer -kill-buf-))))))
+
(defun vc-arch-file-source-p (file)
"Can return nil, `maybe' or a non-nil value.
Only the value `maybe' can be trusted :-(."
@@ -122,7 +133,7 @@
(concat ".arch-ids/" (file-name-nondirectory file) ".id")
(file-name-directory file)))
;; Check the presence of a tagline.
- (with-current-buffer (find-file-noselect file)
+ (vc-with-current-file-buffer file
(save-excursion
(goto-char (point-max))
(or (re-search-backward vc-arch-tagline-re (- (point) 1000) t)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-28 1:19 ` Stefan Monnier
@ 2007-03-28 1:51 ` Alfred M. Szmidt
2007-03-28 2:33 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Alfred M. Szmidt @ 2007-03-28 1:51 UTC (permalink / raw)
To: Stefan Monnier; +Cc: cyd, emacs-devel
>> >> | emacs -Q
>> >> | M-x find-file-literally ~/RMAIL.empty RET
>> >> | C-u M-~ (not-modified t)
>> >> | C-x C-s (save-buffer)
>>
>> I think this might be related to me having my home directory
>> under version control ... I think it is because
>> vc-arch-file-source-p calls find-file-noselect, which in turn
>> calls vc-arch-file-source-p, and so on...
> Probably the fix is for vc-arch-file-source-p to check if
> get-file-buffer is nil; if so, it should perform
> insert-file-contents on a temp buffer, instead of visiting the
> file directly.
Sounds right, I've just installed the patch below to address it,
This supresses the question about reverting the buffer to a normal
mode when saving a file after using find-file-literally, is that
intended?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: find-file-literally and save-buffer
2007-03-28 1:51 ` Alfred M. Szmidt
@ 2007-03-28 2:33 ` Stefan Monnier
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2007-03-28 2:33 UTC (permalink / raw)
To: ams; +Cc: cyd, emacs-devel
>>> >> | emacs -Q
>>> >> | M-x find-file-literally ~/RMAIL.empty RET
>>> >> | C-u M-~ (not-modified t)
>>> >> | C-x C-s (save-buffer)
>>>
>>> I think this might be related to me having my home directory
>>> under version control ... I think it is because
>>> vc-arch-file-source-p calls find-file-noselect, which in turn
>>> calls vc-arch-file-source-p, and so on...
>> Probably the fix is for vc-arch-file-source-p to check if
>> get-file-buffer is nil; if so, it should perform
>> insert-file-contents on a temp buffer, instead of visiting the
>> file directly.
> Sounds right, I've just installed the patch below to address it,
> This supresses the question about reverting the buffer to a normal
> mode when saving a file after using find-file-literally, is that
> intended?
No. But it's a separate/different bug, I believe.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-03-28 2:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-26 11:59 find-file-literally and save-buffer Alfred M. Szmidt
2007-03-27 3:54 ` Chong Yidong
2007-03-27 4:07 ` Chong Yidong
2007-03-27 9:47 ` Alfred M. Szmidt
2007-03-27 11:37 ` Alfred M. Szmidt
2007-03-27 14:27 ` Chong Yidong
2007-03-27 18:56 ` Alfred M. Szmidt
2007-03-28 1:19 ` Stefan Monnier
2007-03-28 1:51 ` Alfred M. Szmidt
2007-03-28 2:33 ` Stefan Monnier
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.