summaryrefslogtreecommitdiff
path: root/lisp/term.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-01-20 17:36:12 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-01-20 17:36:12 -0500
commit8dabbfd6325ea5b11e67fa8358625669808312dd (patch)
tree079663dec17eea59c35ba92edaed0bbdb64f7751 /lisp/term.el
parent642f3c5c603d61aa0b47a614981f462669eec086 (diff)
downloademacs-8dabbfd6325ea5b11e67fa8358625669808312dd.tar.gz
Don't mess with *temp*.
* lisp/obsolete/spell.el: Move from textmodes/spell.el. (spell-string): * lisp/term.el (term-read-input-ring): * lisp/startup.el (display-startup-echo-area-message): * lisp/progmodes/antlr-mode.el (antlr-directory-dependencies): * lisp/gnus/message.el (message-mailer-swallows-blank-line): * lisp/comint.el (comint-read-input-ring): Use with-temp-buffer. * lisp/international/mule.el (ctext-pre-write-conversion): Don't hardcode point-min==1. * lisp/gnus/mm-util.el (mm-find-buffer-file-coding-system): Don't forget to kill the temp buffer.
Diffstat (limited to 'lisp/term.el')
-rw-r--r--lisp/term.el37
1 files changed, 16 insertions, 21 deletions
diff --git a/lisp/term.el b/lisp/term.el
index 2eb999b03db..0a8b35f5b40 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1537,29 +1537,24 @@ See also `term-input-ignoredups' and `term-write-input-ring'."
(message "Cannot read history file %s"
term-input-ring-file-name)))
(t
- (let ((history-buf (get-buffer-create " *temp*"))
- (file term-input-ring-file-name)
+ (let ((file term-input-ring-file-name)
(count 0)
(ring (make-ring term-input-ring-size)))
- (unwind-protect
- (with-current-buffer history-buf
- (widen)
- (erase-buffer)
- (insert-file-contents file)
- ;; Save restriction in case file is already visited...
- ;; Watch for those date stamps in history files!
- (goto-char (point-max))
- (while (and (< count term-input-ring-size)
- (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
- nil t))
- (let ((history (buffer-substring (match-beginning 1)
- (match-end 1))))
- (when (or (null term-input-ignoredups)
- (ring-empty-p ring)
- (not (string-equal (ring-ref ring 0) history)))
- (ring-insert-at-beginning ring history)))
- (setq count (1+ count))))
- (kill-buffer history-buf))
+ (with-temp-buffer
+ (insert-file-contents file)
+ ;; Save restriction in case file is already visited...
+ ;; Watch for those date stamps in history files!
+ (goto-char (point-max))
+ (while (and (< count term-input-ring-size)
+ (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
+ nil t))
+ (let ((history (buffer-substring (match-beginning 1)
+ (match-end 1))))
+ (when (or (null term-input-ignoredups)
+ (ring-empty-p ring)
+ (not (string-equal (ring-ref ring 0) history)))
+ (ring-insert-at-beginning ring history)))
+ (setq count (1+ count))))
(setq term-input-ring ring
term-input-ring-index nil)))))