[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] Re: [AUCTeX-diffs] Changes to reftex/lisp/reftex-base
From: |
Ralf Angeli |
Subject: |
Re: [AUCTeX-devel] Re: [AUCTeX-diffs] Changes to reftex/lisp/reftex-base.el, v |
Date: |
Sun, 22 Jul 2007 13:36:06 +0200 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) |
* David Kastrup (2007-07-22) writes:
> Probably, but it is still pointless not to just use with-temp-file
> which is there exactly for that purpose and is as far as I can see
> available in Emacs 21.4 and a moderately up to date XEmacs-21.4.
>
> Less code to maintain, less ways for things to go wrong.
I've now implemented it with `with-temp-file'. Here is a patch for the
Emacs 22 branch:
2007-07-22 Ralf Angeli <address@hidden>
* textmodes/reftex.el (reftex-access-parse-file): Do not risk
destroying an existing buffer.
--- reftex.el 22 Jul 2007 13:32:49 +0200 1.73.2.1
+++ reftex.el 22 Jul 2007 13:33:25 +0200
@@ -1331,10 +1331,8 @@
(put docstruct-symbol 'modified nil)
(save-excursion
(if (file-writable-p file)
- (progn
+ (with-temp-file file
(message "Writing parse file %s" (abbreviate-file-name file))
- (set-buffer (get-buffer-create file))
- (erase-buffer)
(insert (format ";; RefTeX parse info file\n"))
(insert (format ";; File: %s\n" master))
(insert (format ";; User: %s (%s)\n\n"
@@ -1357,9 +1355,7 @@
)
(t (print x))))
list))
- (insert "))\n\n")
- (write-region (point-min) (point-max) file nil 'silent)
- (kill-buffer (current-buffer)))
+ (insert "))\n\n"))
(error "Cannot write to file %s" file)))
t))))
--
Ralf