diff options
| author | Stefan Monnier | 2011-01-20 17:36:12 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-01-20 17:36:12 -0500 |
| commit | 8dabbfd6325ea5b11e67fa8358625669808312dd (patch) | |
| tree | 079663dec17eea59c35ba92edaed0bbdb64f7751 /lisp/comint.el | |
| parent | 642f3c5c603d61aa0b47a614981f462669eec086 (diff) | |
| download | emacs-8dabbfd6325ea5b11e67fa8358625669808312dd.tar.gz emacs-8dabbfd6325ea5b11e67fa8358625669808312dd.zip | |
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.
Diffstat (limited to 'lisp/comint.el')
| -rw-r--r-- | lisp/comint.el | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/lisp/comint.el b/lisp/comint.el index e45c8021273..da722002c20 100644 --- a/lisp/comint.el +++ b/lisp/comint.el | |||
| @@ -918,41 +918,36 @@ See also `comint-input-ignoredups' and `comint-write-input-ring'." | |||
| 918 | (message "Cannot read history file %s" | 918 | (message "Cannot read history file %s" |
| 919 | comint-input-ring-file-name))) | 919 | comint-input-ring-file-name))) |
| 920 | (t | 920 | (t |
| 921 | (let* ((history-buf (get-buffer-create " *temp*")) | 921 | (let* ((file comint-input-ring-file-name) |
| 922 | (file comint-input-ring-file-name) | ||
| 923 | (count 0) | 922 | (count 0) |
| 924 | (size comint-input-ring-size) | 923 | (size comint-input-ring-size) |
| 925 | (ring (make-ring size))) | 924 | (ring (make-ring size))) |
| 926 | (unwind-protect | 925 | (with-temp-buffer |
| 927 | (with-current-buffer history-buf | 926 | (insert-file-contents file) |
| 928 | (widen) | 927 | ;; Save restriction in case file is already visited... |
| 929 | (erase-buffer) | 928 | ;; Watch for those date stamps in history files! |
| 930 | (insert-file-contents file) | 929 | (goto-char (point-max)) |
| 931 | ;; Save restriction in case file is already visited... | 930 | (let (start end history) |
| 932 | ;; Watch for those date stamps in history files! | 931 | (while (and (< count size) |
| 933 | (goto-char (point-max)) | 932 | (re-search-backward comint-input-ring-separator |
| 934 | (let (start end history) | 933 | nil t) |
| 935 | (while (and (< count size) | 934 | (setq end (match-beginning 0))) |
| 936 | (re-search-backward comint-input-ring-separator | 935 | (setq start |
| 937 | nil t) | 936 | (if (re-search-backward comint-input-ring-separator |
| 938 | (setq end (match-beginning 0))) | 937 | nil t) |
| 939 | (setq start | 938 | (match-end 0) |
| 940 | (if (re-search-backward comint-input-ring-separator | 939 | (point-min))) |
| 941 | nil t) | 940 | (setq history (buffer-substring start end)) |
| 942 | (match-end 0) | 941 | (goto-char start) |
| 943 | (point-min))) | 942 | (if (and (not (string-match comint-input-history-ignore |
| 944 | (setq history (buffer-substring start end)) | 943 | history)) |
| 945 | (goto-char start) | 944 | (or (null comint-input-ignoredups) |
| 946 | (if (and (not (string-match comint-input-history-ignore | 945 | (ring-empty-p ring) |
| 947 | history)) | 946 | (not (string-equal (ring-ref ring 0) |
| 948 | (or (null comint-input-ignoredups) | 947 | history)))) |
| 949 | (ring-empty-p ring) | 948 | (progn |
| 950 | (not (string-equal (ring-ref ring 0) | 949 | (ring-insert-at-beginning ring history) |
| 951 | history)))) | 950 | (setq count (1+ count))))))) |
| 952 | (progn | ||
| 953 | (ring-insert-at-beginning ring history) | ||
| 954 | (setq count (1+ count))))))) | ||
| 955 | (kill-buffer history-buf)) | ||
| 956 | (setq comint-input-ring ring | 951 | (setq comint-input-ring ring |
| 957 | comint-input-ring-index nil))))) | 952 | comint-input-ring-index nil))))) |
| 958 | 953 | ||