add command move-end-of-line
[lice.git] / src / fns.lisp
blobea365729edcbdbc16a7a0004804f5d5207abbb8a
1 ;;; fns.lisp --- compatibility function from emacs
3 (in-package "LICE")
5 (defun concat (&rest strings)
6 "Concatenate all the arguments and make the result a string.
7 The result is a string whose elements are the elements of all the arguments.
8 Each argument must be a string."
9 (apply 'concatenate 'string strings))
11 (defun cdr-safe (object)
12 "Return the cdr of OBJECT if it is a cons cell, or else nil."
13 (when (consp object)
14 (cdr object)))
16 ;; XXX: get rid of this function and all callers
17 (defun assq (prop list)
18 "Return non-nil if key is `eq' to the car of an element of list.
19 The value is actually the first element of list whose car is key.
20 Elements of list that are not conses are ignored."
21 (assoc prop (remove-if 'listp list)))
23 (depricate substring subseq)
24 (defun substring (string from &optional (to (length string)))
25 "Return a substring of string, starting at index from and ending before to.
26 to may be nil or omitted; then the substring runs to the end of string.
27 from and to start at 0. If either is negative, it counts from the end.
29 This function allows vectors as well as strings."
30 (when (< from 0)
31 (setf from (max 0 (+ (length string) from))))
32 (when (< to 0)
33 (setf to (max 0 (+ (length string) to))))
34 (subseq string from to))
36 (depricate memq member)
37 (defun memq (elt list)
38 "Return non-nil if ELT is an element of LIST.
39 Comparison done with `eq'. The value is actually the tail of LIST
40 whose car is ELT."
41 (member elt list :test 'eq))
43 (depricate put (setf get))
44 (defun put (symbol propname value)
45 "Store SYMBOL's PROPNAME property with value VALUE.
46 It can be retrieved with `(get SYMBOL PROPNAME)'."
47 (setf (get symbol propname) value))
49 (defun featurep (feature &optional subfeature)
50 "Returns t if FEATURE is present in this Emacs.
52 Use this to conditionalize execution of lisp code based on the
53 presence or absence of Emacs or environment extensions.
54 Use `provide' to declare that a feature is available. This function
55 looks at the value of the variable `features'. The optional argument
56 SUBFEATURE can be used to check a specific subfeature of FEATURE."
57 (and (find feature *features*) t))