*** /usr/local/share/emacs/20.5/lisp/comint.el Sun Jun 27 23:39:16 1999
--- comint.el Thu Jan 20 22:40:48 2000
***************
*** 7,12 ****
--- 7,15 ----
;; Maintainer: FSF
;; Keywords: processes
+ ;; Hacked by Alex Schroeder in order to support
+ ;; multi-line entries in history files.
+
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
***************
*** 268,273 ****
--- 271,279 ----
(defvar comint-input-ring-size 32
"Size of input history ring.")
+ (defvar comint-input-ring-separator "\n"
+ "Separator between commands in the history file.")
+
(defcustom comint-process-echoes nil
"*If non-nil, assume that the subprocess echoes any input.
If so, delete one copy of the input so that only one copy eventually
***************
*** 744,751 ****
This function is useful for major mode commands and mode hooks.
! The structure of the history file should be one input command per line,
! with the most recent command last.
See also `comint-input-ignoredups' and `comint-write-input-ring'."
(cond ((or (null comint-input-ring-file-name)
(equal comint-input-ring-file-name ""))
--- 750,758 ----
This function is useful for major mode commands and mode hooks.
! The commands stored in the history file are separated by the
! `comint-input-ring-separator'. The most recent command comes last.
!
See also `comint-input-ignoredups' and `comint-write-input-ring'."
(cond ((or (null comint-input-ring-file-name)
(equal comint-input-ring-file-name ""))
***************
*** 755,786 ****
(message "Cannot read history file %s"
comint-input-ring-file-name)))
(t
! (let ((history-buf (get-buffer-create " *temp*"))
! (file comint-input-ring-file-name)
! (count 0)
! (ring (make-ring comint-input-ring-size)))
! (unwind-protect
! (save-excursion
! (set-buffer history-buf)
! (widen)
! (erase-buffer)
! (insert-file-contents file)
! ;; Save restriction in case file is already visited...
! ;; Watch for those date stamps in history files!
! (goto-char (point-max))
(while (and (< count comint-input-ring-size)
! (re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
! nil t))
! (let ((history (buffer-substring (match-beginning 1)
! (match-end 1))))
! (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))))
! (kill-buffer history-buf))
! (setq comint-input-ring ring
! comint-input-ring-index nil)))))
(defun comint-write-input-ring ()
"Writes the buffer's `comint-input-ring' to a history file.
--- 762,793 ----
(message "Cannot read history file %s"
comint-input-ring-file-name)))
(t
! (let ((file comint-input-ring-file-name)
! (count 0)
! (ring (make-ring comint-input-ring-size)))
! (with-temp-buffer
! (insert-file-contents file)
! ;; Save restriction in case file is already visited...
! ;; Watch for those date stamps in history files!
! (goto-char (point-max))
! (while (and (< count comint-input-ring-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)))))
! (setq comint-input-ring ring
! comint-input-ring-index nil)))))
(defun comint-write-input-ring ()
"Writes the buffer's `comint-input-ring' to a history file.
***************
*** 798,817 ****
((not (file-writable-p comint-input-ring-file-name))
(message "Cannot write history file %s" comint-input-ring-file-name))
(t
! (let* ((history-buf (get-buffer-create " *Temp Input History*"))
! (ring comint-input-ring)
! (file comint-input-ring-file-name)
! (index (ring-length ring)))
! ;; Write it all out into a buffer first. Much faster, but messier,
! ;; than writing it one line at a time.
! (save-excursion
! (set-buffer history-buf)
! (erase-buffer)
! (while (> index 0)
! (setq index (1- index))
! (insert (ring-ref ring index) ?\n))
! (write-region (buffer-string) nil file nil 'no-message)
! (kill-buffer nil))))))
(defun comint-dynamic-list-input-ring ()
--- 805,820 ----
((not (file-writable-p comint-input-ring-file-name))
(message "Cannot write history file %s" comint-input-ring-file-name))
(t
! (let* ((ring comint-input-ring)
! (file comint-input-ring-file-name)
! (index (ring-length ring)))
! ;; Write it all out into a buffer first. Much faster, but messier,
! ;; than writing it one line at a time.
! (with-temp-buffer
! (while (> index 0)
! (setq index (1- index))
! (insert (ring-ref ring index) comint-input-ring-separator))
! (write-region (buffer-string) nil file nil 'no-message))))))
(defun comint-dynamic-list-input-ring ()
               (
geocities.com/kensanata)