emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/eshell/em-hist.el


From: John Wiegley
Subject: [Emacs-diffs] Changes to emacs/lisp/eshell/em-hist.el
Date: Sat, 16 Feb 2002 02:11:05 -0500

Index: emacs/lisp/eshell/em-hist.el
diff -c emacs/lisp/eshell/em-hist.el:1.7 emacs/lisp/eshell/em-hist.el:1.8
*** emacs/lisp/eshell/em-hist.el:1.7    Sun Jul 15 15:53:53 2001
--- emacs/lisp/eshell/em-hist.el        Sat Feb 16 02:11:05 2002
***************
*** 216,222 ****
      (add-hook 'pcomplete-try-first-hook
              'eshell-complete-history-reference nil t))
  
!   (if (eshell-using-module 'eshell-rebind)
        (let ((rebind-alist (symbol-value 'eshell-rebind-keys-alist)))
        (make-local-variable 'eshell-rebind-keys-alist)
        (set 'eshell-rebind-keys-alist
--- 216,223 ----
      (add-hook 'pcomplete-try-first-hook
              'eshell-complete-history-reference nil t))
  
!   (if (and (eshell-using-module 'eshell-rebind)
!          (not eshell-non-interactive-p))
        (let ((rebind-alist (symbol-value 'eshell-rebind-keys-alist)))
        (make-local-variable 'eshell-rebind-keys-alist)
        (set 'eshell-rebind-keys-alist
***************
*** 270,278 ****
  
    (make-local-variable 'eshell-history-index)
    (make-local-variable 'eshell-save-history-index)
!   (make-local-variable 'eshell-history-ring)
!   (if eshell-history-file-name
!       (eshell-read-history nil t))
    (unless eshell-history-ring
      (setq eshell-history-ring (make-ring eshell-history-size)))
  
--- 271,286 ----
  
    (make-local-variable 'eshell-history-index)
    (make-local-variable 'eshell-save-history-index)
! 
!   (if (minibuffer-window-active-p (selected-window))
!       (set (make-local-variable 'eshell-ask-to-save-history) nil)
!     (set (make-local-variable 'eshell-history-ring) nil)
!     (if eshell-history-file-name
!       (eshell-read-history nil t))
! 
!     (make-local-hook 'eshell-exit-hook)
!     (add-hook 'eshell-exit-hook 'eshell-write-history nil t))
! 
    (unless eshell-history-ring
      (setq eshell-history-ring (make-ring eshell-history-size)))
  
***************
*** 360,381 ****
    "Get an input line from the history ring."
    (ring-ref (or ring eshell-history-ring) index))
  
! (defun eshell-add-to-history ()
!   "Add INPUT to the history ring.
! The input is entered into the input history ring, if the value of
  variable `eshell-input-filter' returns non-nil when called on the
  input."
    (when (> (1- eshell-last-input-end) eshell-last-input-start)
      (let ((input (buffer-substring eshell-last-input-start
                                   (1- eshell-last-input-end))))
!       (if (and (funcall eshell-input-filter input)
!              (or (null eshell-hist-ignoredups)
!                  (not (ring-p eshell-history-ring))
!                  (ring-empty-p eshell-history-ring)
!                  (not (string-equal (eshell-get-history 0) input))))
!         (eshell-put-history input))
!       (setq eshell-save-history-index eshell-history-index)
!       (setq eshell-history-index nil))))
  
  (defun eshell-read-history (&optional filename silent)
    "Sets the buffer's `eshell-history-ring' from a history file.
--- 368,407 ----
    "Get an input line from the history ring."
    (ring-ref (or ring eshell-history-ring) index))
  
! (defun eshell-add-input-to-history (input)
!   "Add the string INPUT to the history ring.
! Input is entered into the input history ring, if the value of
  variable `eshell-input-filter' returns non-nil when called on the
  input."
+   (if (and (funcall eshell-input-filter input)
+          (or (null eshell-hist-ignoredups)
+              (not (ring-p eshell-history-ring))
+              (ring-empty-p eshell-history-ring)
+              (not (string-equal (eshell-get-history 0) input))))
+       (eshell-put-history input))
+   (setq eshell-save-history-index eshell-history-index)
+   (setq eshell-history-index nil))
+ 
+ (defun eshell-add-command-to-history ()
+   "Add the command entered at `eshell-command's prompt to the history ring.
+ The command is added to the input history ring, if the value of
+ variable `eshell-input-filter' returns non-nil when called on the
+ command.
+ 
+ This function is supposed to be called from the minibuffer, presumably
+ as a minibuffer-exit-hook."
+   (eshell-add-input-to-history
+    (buffer-substring (minibuffer-prompt-end) (point-max))))
+ 
+ (defun eshell-add-to-history ()
+   "Add last Eshell command to the history ring.
+ The command is entered into the input history ring, if the value of
+ variable `eshell-input-filter' returns non-nil when called on the
+ command."
    (when (> (1- eshell-last-input-end) eshell-last-input-start)
      (let ((input (buffer-substring eshell-last-input-start
                                   (1- eshell-last-input-end))))
!       (eshell-add-input-to-history input))))
  
  (defun eshell-read-history (&optional filename silent)
    "Sets the buffer's `eshell-history-ring' from a history file.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]