Show
Ignore:
Timestamp:
05/18/06 16:19:18 (3 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/subr.el

    r4079 r4085  
    11241124                              oa))))))) 
    11251125 
    1126 (defun add-to-history (history-var newelt &optional maxelt
     1126(defun add-to-history (history-var newelt &optional maxelt keep-all
    11271127  "Add NEWELT to the history list stored in the variable HISTORY-VAR. 
    11281128Return the new history list. 
     
    11311131property on symbol HISTORY-VAR, if set, or the value of the `history-length' 
    11321132variable. 
    1133 Remove duplicates of NEWELT unless `history-delete-duplicates' is nil." 
     1133Remove duplicates of NEWELT if `history-delete-duplicates' is non-nil. 
     1134If optional fourth arg KEEP-ALL is non-nil, add NEWELT to history even 
     1135if it is empty or a duplicate." 
    11341136  (unless maxelt 
    11351137    (setq maxelt (or (get history-var 'history-length) 
     
    11371139  (let ((history (symbol-value history-var)) 
    11381140        tail) 
    1139     (if history-delete-duplicates 
    1140         (setq history (delete newelt history))) 
    1141     (setq history (cons newelt history)) 
    1142     (when (integerp maxelt) 
    1143       (if (= 0 maxelt) 
    1144           (setq history nil) 
    1145         (setq tail (nthcdr (1- maxelt) history)) 
    1146         (when (consp tail) 
    1147           (setcdr tail nil)))) 
     1141    (when (and (listp history) 
     1142               (or keep-all 
     1143                   (not (stringp newelt)) 
     1144                   (> (length newelt) 0)) 
     1145               (or keep-all 
     1146                   (not (equal (car history) newelt)))) 
     1147      (if history-delete-duplicates 
     1148          (delete newelt history)) 
     1149      (setq history (cons newelt history)) 
     1150      (when (integerp maxelt) 
     1151        (if (= 0 maxelt) 
     1152            (setq history nil) 
     1153          (setq tail (nthcdr (1- maxelt) history)) 
     1154          (when (consp tail) 
     1155            (setcdr tail nil))))) 
    11481156    (set history-var history))) 
    11491157