X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4ffd0d6b569d252e4e807d4e9c9d6a5bd5b08640..7cef3569a3d872ea5be07a529b68910bf1d8b790:/lisp/eshell/em-hist.el diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 993e9d63a9..64a7ad94c5 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -1,6 +1,6 @@ ;;; 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 @@ -54,8 +54,7 @@ ;;; Code: -(eval-when-compile - (require 'cl)) +(eval-when-compile (require 'cl-lib)) (require 'ring) (require 'esh-opt) @@ -63,10 +62,11 @@ (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: @@ -90,12 +90,14 @@ "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 @@ -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 - (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 @@ -551,8 +559,8 @@ See also `eshell-read-history'." (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 @@ -562,7 +570,7 @@ See also `eshell-read-history'." (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) @@ -609,7 +617,7 @@ See also `eshell-read-history'." 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))))