]> code.delx.au - gnu-emacs/blobdiff - lisp/eshell/em-hist.el
Fix previous rmail-output-read-file-name change
[gnu-emacs] / lisp / eshell / em-hist.el
index 993e9d63a94a8b7cd30178ce349819bfb652ac98..64a7ad94c5318f4bde0d83056521e19239972cdb 100644 (file)
@@ -1,6 +1,6 @@
 ;;; em-hist.el --- history list management
 
 ;;; em-hist.el --- history list management
 
-;; Copyright (C) 1999-2011  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012  Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
@@ -54,8 +54,7 @@
 
 ;;; Code:
 
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'ring)
 (require 'esh-opt)
 
 (require 'ring)
 (require 'esh-opt)
 (require 'eshell)
 
 ;;;###autoload
 (require 'eshell)
 
 ;;;###autoload
-(eshell-defgroup eshell-hist nil
+(progn
+(defgroup eshell-hist nil
   "This module provides command history management."
   :tag "History list management"
   "This module provides command history management."
   :tag "History list management"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
 
 ;;; User Variables:
 
   "If non-nil, name of the file to read/write input history.
 See also `eshell-read-history' and `eshell-write-history'.
 If it is nil, Eshell will use the value of HISTFILE."
   "If non-nil, name of the file to read/write input history.
 See also `eshell-read-history' and `eshell-write-history'.
 If it is nil, Eshell will use the value of HISTFILE."
-  :type 'file
+  :type '(choice (const :tag "Use HISTFILE" nil)
+                file)
   :group 'eshell-hist)
 
 (defcustom eshell-history-size 128
   "Size of the input history ring.  If nil, use envvar HISTSIZE."
   :group 'eshell-hist)
 
 (defcustom eshell-history-size 128
   "Size of the input history ring.  If nil, use envvar HISTSIZE."
-  :type 'integer
+  :type '(choice (const :tag "Use HISTSIZE" nil)
+                integer)
   :group 'eshell-hist)
 
 (defcustom eshell-hist-ignoredups nil
   :group 'eshell-hist)
 
 (defcustom eshell-hist-ignoredups nil
@@ -261,7 +263,13 @@ element, regardless of any text on the command line.  In that case,
 
   (make-local-variable 'eshell-history-size)
   (or eshell-history-size
 
   (make-local-variable 'eshell-history-size)
   (or eshell-history-size
-      (setq eshell-history-size (getenv "HISTSIZE")))
+      (let ((hsize (getenv "HISTSIZE")))
+        (setq eshell-history-size
+             (if (and (stringp hsize)
+                      (integerp (setq hsize (string-to-number hsize)))
+                      (> hsize 0))
+                 hsize
+               128))))
 
   (make-local-variable 'eshell-history-file-name)
   (or eshell-history-file-name
 
   (make-local-variable 'eshell-history-file-name)
   (or eshell-history-file-name
@@ -551,8 +559,8 @@ See also `eshell-read-history'."
          (forward-char))
        (setq posb (cdr posb)
              pose (cdr pose))
          (forward-char))
        (setq posb (cdr posb)
              pose (cdr pose))
-       (assert (= (length posb) (length args)))
-       (assert (<= (length posb) (length pose))))
+       (cl-assert (= (length posb) (length args)))
+       (cl-assert (<= (length posb) (length pose))))
       (setq hist (buffer-substring-no-properties begin end))
       (let ((b posb) (e pose))
        (while b
       (setq hist (buffer-substring-no-properties begin end))
       (let ((b posb) (e pose))
        (while b
@@ -562,7 +570,7 @@ See also `eshell-read-history'."
          (setq b (cdr b)
                e (cdr e))))
       (setq textargs (cdr textargs))
          (setq b (cdr b)
                e (cdr e))))
       (setq textargs (cdr textargs))
-      (assert (= (length textargs) (length args)))
+      (cl-assert (= (length textargs) (length args)))
       (list textargs posb pose))))
 
 (defun eshell-expand-history-references (beg end)
       (list textargs posb pose))))
 
 (defun eshell-expand-history-references (beg end)
@@ -609,7 +617,7 @@ See also `eshell-read-history'."
                                           history))))
                 (setq index (1- index)))
               (let ((fhist (list t)))
                                           history))))
                 (setq index (1- index)))
               (let ((fhist (list t)))
-                ;; uniqify the list, but preserve the order
+                ;; uniquify the list, but preserve the order
                 (while history
                   (unless (member (car history) fhist)
                     (nconc fhist (list (car history))))
                 (while history
                   (unless (member (car history) fhist)
                     (nconc fhist (list (car history))))