(M-16636): Moved into U-00023A8E; use `<-wrong*sources' instead of
[chise/xemacs-chise.git.1] / lisp / subr.el
index bbde00d..54cf7f1 100644 (file)
@@ -301,16 +301,24 @@ See also `add-hook', `add-local-hook', and `add-local-one-shot-hook'."
   (make-local-hook hook)
   (add-one-shot-hook hook function append t))
 
-(defun add-to-list (list-var element)
+(defun add-to-list (list-var element &optional append)
   "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
 The test for presence of ELEMENT is done with `equal'.
+If ELEMENT is added, it is added at the beginning of the list,
+unless the optional argument APPEND is non-nil, in which case
+ELEMENT is added at the end.
+
 If you want to use `add-to-list' on a variable that is not defined
 until a certain package is loaded, you should put the call to `add-to-list'
 into a hook function that will be run only after loading the package.
 `eval-after-load' provides one way to do this.  In some cases
 other hooks, such as major mode hooks, can do the job."
-  (or (member element (symbol-value list-var))
-      (set list-var (cons element (symbol-value list-var)))))
+  (if (member element (symbol-value list-var))
+      (symbol-value list-var)
+    (set list-var
+         (if append
+             (append (symbol-value list-var) (list element))
+           (cons element (symbol-value list-var))))))
 
 ;; XEmacs additions
 ;; called by Fkill_buffer()
@@ -380,12 +388,14 @@ Otherwise treat `\\' in NEWTEXT as special:
   (check-argument-type 'stringp str)
   (check-argument-type 'stringp newtext)
   (if (> (length str) 50)
-      (with-temp-buffer
-       (insert str)
-       (goto-char 1)
+      (let ((cfs case-fold-search))
+       (with-temp-buffer
+          (setq case-fold-search cfs)
+         (insert str)
+         (goto-char 1)
          (while (re-search-forward regexp nil t)
            (replace-match newtext t literal))
-         (buffer-string))
+         (buffer-string)))
   (let ((start 0) newstr)
     (while (string-match regexp str start)
       (setq newstr (replace-match newtext t literal str)
@@ -633,6 +643,9 @@ error
         malformed-property-list
       circular-list
         circular-property-list
+    invalid-regexp
+    specifier-syntax-error
+
 
   invalid-argument
     wrong-type-argument
@@ -640,28 +653,47 @@ error
     wrong-number-of-arguments
     invalid-function
     no-catch
+    undefined-keystroke-sequence
+    specifier-argument-error
 
   invalid-state
     void-function
     cyclic-function-indirection
     void-variable
     cyclic-variable-indirection
+    protected-field
+    invalid-byte-code
 
   invalid-operation
     invalid-change
       setting-constant
+      specifier-change-error
     editing-error
       beginning-of-buffer
       end-of-buffer
       buffer-read-only
     io-error
+      file-error
+        file-already-exists
+        file-locked
+        file-supersession
       end-of-file
+      coding-system-error
+      image-conversion-error
+      tooltalk-error
     arith-error
       range-error
       domain-error
       singularity-error
       overflow-error
       underflow-error
+    dialog-box-error
+    search-failed
+    selection-conversion-error
+
+  unimplemented
+
+  internal-error
 
 The five most common errors you will probably use or base your new
 errors off of are `syntax-error', `invalid-argument', `invalid-state',