diff options
| author | Gerd Moellmann | 2000-10-18 14:42:38 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-10-18 14:42:38 +0000 |
| commit | 3e8abfd398918f8dbbedbdd884dc52239a5a9ce4 (patch) | |
| tree | ac0200825ae14664711528abbff535e07fec5083 /lisp/comint.el | |
| parent | 9b5360aa71faa737e238a264f8e4ef1739efc672 (diff) | |
| download | emacs-3e8abfd398918f8dbbedbdd884dc52239a5a9ce4.tar.gz emacs-3e8abfd398918f8dbbedbdd884dc52239a5a9ce4.zip | |
(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.el | 31 |
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))))) |