summaryrefslogtreecommitdiff
path: root/lisp/comint.el
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-10-18 14:42:38 +0000
committerGerd Moellmann <gerd@gnu.org>2000-10-18 14:42:38 +0000
commit3e8abfd398918f8dbbedbdd884dc52239a5a9ce4 (patch)
treeac0200825ae14664711528abbff535e07fec5083 /lisp/comint.el
parent9b5360aa71faa737e238a264f8e4ef1739efc672 (diff)
downloademacs-3e8abfd398918f8dbbedbdd884dc52239a5a9ce4.tar.gz
(comint-read-input-ring): Bugfix such that the first
and the last entry of the input ring file are not lost.
Diffstat (limited to 'lisp/comint.el')
-rw-r--r--lisp/comint.el31
1 files changed, 15 insertions, 16 deletions
diff --git a/lisp/comint.el b/lisp/comint.el
index 8edd77340ee..318e1566b0d 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -838,22 +838,21 @@ See also `comint-input-ignoredups' and `comint-write-input-ring'."
;; 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)))))