Switch to recommended form of GPLv3 permissions notice.
[bpt/emacs.git] / lisp / eshell / em-hist.el
index f4bfea7..bc50ced 100644 (file)
@@ -1,15 +1,16 @@
 ;;; em-hist.el --- history list management
 
-;; Copyright (C) 1999, 2000, 2004 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
-
-(provide 'em-hist)
-
-(eval-when-compile (require 'esh-maint))
-(require 'eshell)
-
-(defgroup eshell-hist nil
-  "This module provides command history management."
-  :tag "History list management"
-  :group 'eshell-module)
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 (require 'ring)
 (require 'esh-opt)
 (require 'em-pred)
+(require 'eshell)
+
+(defgroup eshell-hist nil
+  "This module provides command history management."
+  :tag "History list management"
+  :group 'eshell-module)
 
 ;;; User Variables:
 
@@ -204,6 +199,8 @@ element, regardless of any text on the command line.  In that case,
   (define-key eshell-isearch-map [(control ?c)] 'eshell-isearch-cancel-map)
   (define-key eshell-isearch-cancel-map [(control ?c)] 'eshell-isearch-cancel))
 
+(defvar eshell-rebind-keys-alist)
+
 ;;; Functions:
 
 (defun eshell-hist-initialize ()
@@ -217,10 +214,10 @@ element, regardless of any text on the command line.  In that case,
 
   (if (and (eshell-using-module 'eshell-rebind)
           (not eshell-non-interactive-p))
-      (let ((rebind-alist (symbol-value 'eshell-rebind-keys-alist)))
+      (let ((rebind-alist eshell-rebind-keys-alist))
        (make-local-variable 'eshell-rebind-keys-alist)
-       (set 'eshell-rebind-keys-alist
-            (append rebind-alist eshell-hist-rebind-keys-alist))
+       (seteshell-rebind-keys-alist
+             (append rebind-alist eshell-hist-rebind-keys-alist))
        (set (make-local-variable 'search-invisible) t)
        (set (make-local-variable 'search-exit-option) t)
        (add-hook 'isearch-mode-hook
@@ -504,7 +501,7 @@ See also `eshell-read-history'."
        ;; Change "completion" to "history reference"
        ;; to make the display accurate.
        (with-output-to-temp-buffer history-buffer
-         (display-completion-list history)
+         (display-completion-list history prefix)
          (set-buffer history-buffer)
          (forward-line 3)
          (while (search-backward "completion" nil 'move)
@@ -840,7 +837,7 @@ If N is negative, find the next or Nth next match."
       (unless (minibuffer-window-active-p (selected-window))
        (message "History item: %d" (- (ring-length eshell-history-ring) pos)))
        ;; Can't use kill-region as it sets this-command
-      (delete-region (save-excursion (eshell-bol) (point)) (point))
+      (delete-region eshell-last-output-end (point))
       (insert-and-inherit (eshell-get-history pos)))))
 
 (defun eshell-next-matching-input (regexp arg)
@@ -985,5 +982,7 @@ If N is negative, search backwards for the -Nth previous match."
   (isearch-done)
   (eshell-send-input))
 
-;;; arch-tag: 1a847333-f864-4b96-9acd-b549d620b6c6
+(provide 'em-hist)
+
+;; arch-tag: 1a847333-f864-4b96-9acd-b549d620b6c6
 ;;; em-hist.el ends here