Mercurial > emacs
comparison lisp/subr.el @ 83038:30ccd595ccb0
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-98
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-99
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-100
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-101
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-102
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-78
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Wed, 18 Feb 2004 17:10:32 +0000 |
parents | 15b3e94eebd4 |
children | cf58c77ee000 |
comparison
equal
deleted
inserted
replaced
83037:03a73693678e | 83038:30ccd595ccb0 |
---|---|
208 (progn | 208 (progn |
209 (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil)) | 209 (if (> n 0) (setcdr (nthcdr (- (1- m) n) x) nil)) |
210 x)))) | 210 x)))) |
211 | 211 |
212 (defun delete-dups (list) | 212 (defun delete-dups (list) |
213 "Destructively return LIST, with `equal' duplicates removed. | 213 "Destructively remove `equal' duplicates from LIST. |
214 LIST must be a proper list. The value of LIST after a call to | 214 Store the result in LIST and return it. LIST must be a proper list. |
215 this function is undefined. Use \(setq LIST (delete-dups LIST)) | 215 Of several `equal' occurrences of an element in LIST, the first |
216 if you want to store the return value in LIST. Of several | 216 one is kept." |
217 `equal' occurrences of an element in LIST, the last one is kept." | |
218 (while (member (car list) (cdr list)) | |
219 (pop list)) | |
220 (let ((tail list)) | 217 (let ((tail list)) |
221 (while tail | 218 (while tail |
222 (while (member (cadr tail) (cddr tail)) | 219 (setcdr tail (delete (car tail) (cdr tail))) |
223 (setcdr tail (cddr tail))) | 220 (setq tail (cdr tail)))) |
224 (pop tail))) | |
225 list) | 221 list) |
226 | 222 |
227 (defun number-sequence (from &optional to inc) | 223 (defun number-sequence (from &optional to inc) |
228 "Return a sequence of numbers from FROM to TO (both inclusive) as a list. | 224 "Return a sequence of numbers from FROM to TO (both inclusive) as a list. |
229 INC is the increment used between numbers in the sequence and defaults to 1. | 225 INC is the increment used between numbers in the sequence and defaults to 1. |
1983 Value is nil if NUMth pair didn't match, or there were less than NUM pairs. | 1979 Value is nil if NUMth pair didn't match, or there were less than NUM pairs. |
1984 Zero means the entire text matched by the whole regexp or whole string. | 1980 Zero means the entire text matched by the whole regexp or whole string. |
1985 STRING should be given if the last search was by `string-match' on STRING." | 1981 STRING should be given if the last search was by `string-match' on STRING." |
1986 (if (match-beginning num) | 1982 (if (match-beginning num) |
1987 (if string | 1983 (if string |
1988 (let ((result | 1984 (substring-no-properties string (match-beginning num) |
1989 (substring string (match-beginning num) (match-end num)))) | 1985 (match-end num)) |
1990 (set-text-properties 0 (length result) nil result) | |
1991 result) | |
1992 (buffer-substring-no-properties (match-beginning num) | 1986 (buffer-substring-no-properties (match-beginning num) |
1993 (match-end num))))) | 1987 (match-end num))))) |
1994 | 1988 |
1995 (defun looking-back (regexp &optional limit) | 1989 (defun looking-back (regexp &optional limit) |
1996 "Return non-nil if text before point matches regular expression REGEXP. | 1990 "Return non-nil if text before point matches regular expression REGEXP. |