aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-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'."
838 ;; Save restriction in case file is already visited... 838 ;; Save restriction in case file is already visited...
839 ;; Watch for those date stamps in history files! 839 ;; Watch for those date stamps in history files!
840 (goto-char (point-max)) 840 (goto-char (point-max))
841 (while (and (< count size) 841 (let (start end history)
842 (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$" 842 (while (and (< count comint-input-ring-size)
843 nil t)) 843 (re-search-backward comint-input-ring-separator nil t)
844 (let (start end history) 844 (setq end (match-beginning 0)))
845 (while (and (< count comint-input-ring-size) 845 (if (re-search-backward comint-input-ring-separator nil t)
846 (re-search-backward comint-input-ring-separator nil t) 846 (setq start (match-end 0))
847 (setq end (match-beginning 0)) 847 (setq start (point-min)))
848 (re-search-backward comint-input-ring-separator nil t) 848 (setq history (buffer-substring start end))
849 (setq start (match-end 0)) 849 (goto-char start)
850 (setq history (buffer-substring start end)) 850 (if (or (null comint-input-ignoredups)
851 (goto-char start)) 851 (ring-empty-p ring)
852 (if (or (null comint-input-ignoredups) 852 (not (string-equal (ring-ref ring 0) history)))
853 (ring-empty-p ring) 853 (progn
854 (not (string-equal (ring-ref ring 0) history))) 854 (ring-insert-at-beginning ring history)
855 (ring-insert-at-beginning ring history))) 855 (setq count (1+ count)))))))
856 (setq count (1+ count)))))
857 (kill-buffer history-buf)) 856 (kill-buffer history-buf))
858 (setq comint-input-ring ring 857 (setq comint-input-ring ring
859 comint-input-ring-index nil))))) 858 comint-input-ring-index nil)))))