Mercurial > emacs
comparison lisp/subr.el @ 90399:a5812696f7bf unicode-pre-font-backend
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 274-284)
- Update from CVS
- Update etc/MORE.STUFF.
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 101)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-62
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 17 May 2006 07:46:49 +0000 |
parents | 146cd8369025 a561e5346aa8 |
children | a8190f7e546e |
comparison
equal
deleted
inserted
replaced
90398:1f8d5cd37cf0 | 90399:a5812696f7bf |
---|---|
1121 (ob (gethash b ordering))) | 1121 (ob (gethash b ordering))) |
1122 (if (and oa ob) | 1122 (if (and oa ob) |
1123 (< oa ob) | 1123 (< oa ob) |
1124 oa))))))) | 1124 oa))))))) |
1125 | 1125 |
1126 (defun add-to-history (history-var newelt &optional maxelt) | 1126 (defun add-to-history (history-var newelt &optional maxelt keep-all) |
1127 "Add NEWELT to the history list stored in the variable HISTORY-VAR. | 1127 "Add NEWELT to the history list stored in the variable HISTORY-VAR. |
1128 Return the new history list. | 1128 Return the new history list. |
1129 If MAXELT is non-nil, it specifies the maximum length of the history. | 1129 If MAXELT is non-nil, it specifies the maximum length of the history. |
1130 Otherwise, the maximum history length is the value of the `history-length' | 1130 Otherwise, the maximum history length is the value of the `history-length' |
1131 property on symbol HISTORY-VAR, if set, or the value of the `history-length' | 1131 property on symbol HISTORY-VAR, if set, or the value of the `history-length' |
1132 variable. | 1132 variable. |
1133 Remove duplicates of NEWELT unless `history-delete-duplicates' is nil." | 1133 Remove duplicates of NEWELT if `history-delete-duplicates' is non-nil. |
1134 If optional fourth arg KEEP-ALL is non-nil, add NEWELT to history even | |
1135 if it is empty or a duplicate." | |
1134 (unless maxelt | 1136 (unless maxelt |
1135 (setq maxelt (or (get history-var 'history-length) | 1137 (setq maxelt (or (get history-var 'history-length) |
1136 history-length))) | 1138 history-length))) |
1137 (let ((history (symbol-value history-var)) | 1139 (let ((history (symbol-value history-var)) |
1138 tail) | 1140 tail) |
1139 (if history-delete-duplicates | 1141 (when (and (listp history) |
1140 (setq history (delete newelt history))) | 1142 (or keep-all |
1141 (setq history (cons newelt history)) | 1143 (not (stringp newelt)) |
1142 (when (integerp maxelt) | 1144 (> (length newelt) 0)) |
1143 (if (= 0 maxelt) | 1145 (or keep-all |
1144 (setq history nil) | 1146 (not (equal (car history) newelt)))) |
1145 (setq tail (nthcdr (1- maxelt) history)) | 1147 (if history-delete-duplicates |
1146 (when (consp tail) | 1148 (delete newelt history)) |
1147 (setcdr tail nil)))) | 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))))) | |
1148 (set history-var history))) | 1156 (set history-var history))) |
1149 | 1157 |
1150 | 1158 |
1151 ;;;; Mode hooks. | 1159 ;;;; Mode hooks. |
1152 | 1160 |