aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/term.el
diff options
context:
space:
mode:
authorStefan Monnier2011-01-20 17:36:12 -0500
committerStefan Monnier2011-01-20 17:36:12 -0500
commit8dabbfd6325ea5b11e67fa8358625669808312dd (patch)
tree079663dec17eea59c35ba92edaed0bbdb64f7751 /lisp/term.el
parent642f3c5c603d61aa0b47a614981f462669eec086 (diff)
downloademacs-8dabbfd6325ea5b11e67fa8358625669808312dd.tar.gz
emacs-8dabbfd6325ea5b11e67fa8358625669808312dd.zip
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'."
1537 (message "Cannot read history file %s" 1537 (message "Cannot read history file %s"
1538 term-input-ring-file-name))) 1538 term-input-ring-file-name)))
1539 (t 1539 (t
1540 (let ((history-buf (get-buffer-create " *temp*")) 1540 (let ((file term-input-ring-file-name)
1541 (file term-input-ring-file-name)
1542 (count 0) 1541 (count 0)
1543 (ring (make-ring term-input-ring-size))) 1542 (ring (make-ring term-input-ring-size)))
1544 (unwind-protect 1543 (with-temp-buffer
1545 (with-current-buffer history-buf 1544 (insert-file-contents file)
1546 (widen) 1545 ;; Save restriction in case file is already visited...
1547 (erase-buffer) 1546 ;; Watch for those date stamps in history files!
1548 (insert-file-contents file) 1547 (goto-char (point-max))
1549 ;; Save restriction in case file is already visited... 1548 (while (and (< count term-input-ring-size)
1550 ;; Watch for those date stamps in history files! 1549 (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
1551 (goto-char (point-max)) 1550 nil t))
1552 (while (and (< count term-input-ring-size) 1551 (let ((history (buffer-substring (match-beginning 1)
1553 (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$" 1552 (match-end 1))))
1554 nil t)) 1553 (when (or (null term-input-ignoredups)
1555 (let ((history (buffer-substring (match-beginning 1) 1554 (ring-empty-p ring)
1556 (match-end 1)))) 1555 (not (string-equal (ring-ref ring 0) history)))
1557 (when (or (null term-input-ignoredups) 1556 (ring-insert-at-beginning ring history)))
1558 (ring-empty-p ring) 1557 (setq count (1+ count))))
1559 (not (string-equal (ring-ref ring 0) history)))
1560 (ring-insert-at-beginning ring history)))
1561 (setq count (1+ count))))
1562 (kill-buffer history-buf))
1563 (setq term-input-ring ring 1558 (setq term-input-ring ring
1564 term-input-ring-index nil))))) 1559 term-input-ring-index nil)))))
1565 1560