changeset 32623:69b2744032ce

(comint-read-input-ring): Bugfix such that the first and the last entry of the input ring file are not lost.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 18 Oct 2000 14:42:38 +0000
parents 1025b13bfe71
children cc6228b81571
files lisp/comint.el
diffstat 1 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/comint.el	Wed Oct 18 14:38:55 2000 +0000
+++ b/lisp/comint.el	Wed Oct 18 14:42:38 2000 +0000
@@ -838,22 +838,21 @@
 		 ;; Save restriction in case file is already visited...
 		 ;; Watch for those date stamps in history files!
 		 (goto-char (point-max))
-		 (while (and (< count size)
-			     (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
-						 nil t))
-	       (let (start end history)
-		 (while (and (< count comint-input-ring-size)
-			     (re-search-backward comint-input-ring-separator nil t)
-			     (setq end (match-beginning 0))
-			     (re-search-backward comint-input-ring-separator nil t)
-			     (setq start (match-end 0))
-			     (setq history (buffer-substring start end))
-			     (goto-char start))
-		   (if (or (null comint-input-ignoredups)
-			   (ring-empty-p ring)
-			   (not (string-equal (ring-ref ring 0) history)))
-		       (ring-insert-at-beginning ring history)))
-		 (setq count (1+ count)))))
+		 (let (start end history)
+		   (while (and (< count comint-input-ring-size)
+			       (re-search-backward comint-input-ring-separator nil t)
+			       (setq end (match-beginning 0)))
+		     (if (re-search-backward comint-input-ring-separator nil t)
+			 (setq start (match-end 0))
+		       (setq start (point-min)))
+		     (setq history (buffer-substring start end))
+		     (goto-char start)
+		     (if (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))
 	   (setq comint-input-ring ring
 		 comint-input-ring-index nil)))))