diff lisp/comint.el @ 112389:75fb060ecbc3

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.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 20 Jan 2011 17:36:12 -0500
parents 61f7601898b1
children 9f7614f1a892
line wrap: on
line diff
--- a/lisp/comint.el	Thu Jan 20 16:57:15 2011 -0500
+++ b/lisp/comint.el	Thu Jan 20 17:36:12 2011 -0500
@@ -918,41 +918,36 @@
 	     (message "Cannot read history file %s"
 		      comint-input-ring-file-name)))
 	(t
-	 (let* ((history-buf (get-buffer-create " *temp*"))
-		(file comint-input-ring-file-name)
+	 (let* ((file comint-input-ring-file-name)
 		(count 0)
 		(size comint-input-ring-size)
 		(ring (make-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))
-		 (let (start end history)
-		   (while (and (< count size)
-			       (re-search-backward comint-input-ring-separator
-                                                   nil t)
-			       (setq end (match-beginning 0)))
-		     (setq start
-                           (if (re-search-backward comint-input-ring-separator
-                                                   nil t)
-                               (match-end 0)
-                             (point-min)))
-		     (setq history (buffer-substring start end))
-		     (goto-char start)
-		     (if (and (not (string-match comint-input-history-ignore
-                                                 history))
-			      (or (null comint-input-ignoredups)
-				  (ring-empty-p ring)
-				  (not (string-equal (ring-ref ring 0)
-                                                     history))))
-			 (progn
-			   (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))
+             (let (start end history)
+               (while (and (< count size)
+                           (re-search-backward comint-input-ring-separator
+                                               nil t)
+                           (setq end (match-beginning 0)))
+                 (setq start
+                       (if (re-search-backward comint-input-ring-separator
+                                               nil t)
+                           (match-end 0)
+                         (point-min)))
+                 (setq history (buffer-substring start end))
+                 (goto-char start)
+                 (if (and (not (string-match comint-input-history-ignore
+                                             history))
+                          (or (null comint-input-ignoredups)
+                              (ring-empty-p ring)
+                              (not (string-equal (ring-ref ring 0)
+                                                 history))))
+                     (progn
+                       (ring-insert-at-beginning ring history)
+                       (setq count (1+ count)))))))
 	   (setq comint-input-ring ring
 		 comint-input-ring-index nil)))))