;;; em-hist.el --- history list management
-;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;;; Code:
-(eval-when-compile
- (require 'cl))
+(eval-when-compile (require 'cl-lib))
(require 'ring)
(require 'esh-opt)
(require 'eshell)
;;;###autoload
-(eshell-defgroup eshell-hist nil
+(progn
+(defgroup eshell-hist nil
"This module provides command history management."
:tag "History list management"
- :group 'eshell-module)
+ :group 'eshell-module))
;;; 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."
- :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."
- :type 'integer
+ :type '(choice (const :tag "Use HISTSIZE" nil)
+ integer)
:group 'eshell-hist)
(defcustom eshell-hist-ignoredups nil
(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
(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 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)
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))))