]> code.delx.au - gnu-emacs/blobdiff - lisp/subr.el
(viet-encode-viscii-char): New function.
[gnu-emacs] / lisp / subr.el
index 014217edf896e27037341eb96c2436adcb8f182e..b80df9423f10101a346d86be3d3ec23d2b1e7b6e 100644 (file)
@@ -93,6 +93,18 @@ If N is bigger than the length of X, return X."
     (while (cdr x)
       (setq x (cdr x)))
     x))
+
+(defun assoc-default (el alist test default)
+  "Find object EL in a pseudo-alist ALIST.
+ALIST is a list of conses or objects.  Each element (or the element's
+car, if it. is a cons) is compared with EL by calling TEST.
+If TEST returns non-nil, the element matches;
+then `assoc-default' returns the cdr of the element (if it is a cons),
+or DEFAULT if the element is not a cons.
+If no element matches, the value is nil."
+  (dolist (rr alist)
+    (when (funcall test el (if (consp rr) (car rr) rr))
+      (return (if (consp rr) (cdr rr) default)))))
 \f
 ;;;; Keymap support.
 
@@ -603,7 +615,7 @@ function, it is changed to a list of functions."
          (and (local-variable-if-set-p hook)
               (not (memq t (symbol-value hook)))))
       ;; Alter the local value only.
-      (or (if (consp function)
+      (or (if (or (consp function) (compiled-function-p function))
              (member function (symbol-value hook))
            (memq function (symbol-value hook)))
          (set hook 
@@ -612,7 +624,7 @@ function, it is changed to a list of functions."
                 (cons function (symbol-value hook)))))
     ;; Alter the global value (which is also the only value,
     ;; if the hook doesn't have a local value).
-    (or (if (consp function)
+    (or (if (or (consp function) (compiled-function-p function))
            (member function (default-value hook))
          (memq function (default-value hook)))
        (set-default hook 
@@ -723,6 +735,8 @@ for numeric input."
   (let ((message-log-max nil) done (first t) (code 0) char)
     (while (not done)
       (let ((inhibit-quit first)
+           ;; Don't use input methods inside this function.
+           (input-method-function nil)
            ;; Don't let C-h get the help message--only help function keys.
            (help-char nil)
            (help-form