]> code.delx.au - gnu-emacs/blobdiff - lisp/subr.el
(gdb-flush-pending-output): New variable.
[gnu-emacs] / lisp / subr.el
index faf9e6c2f1301d0ca7dc95fc6c13e92f19f45f61..b40c64c63eb506432a36f9cabe5005059726df4c 100644 (file)
@@ -484,6 +484,24 @@ The order of bindings in a keymap matters when it is used as a menu."
            (setq inserted t)))
       (setq tail (cdr tail)))))
 
+(defun map-keymap-internal (function keymap &optional sort-first)
+  "Implement `map-keymap' with sorting.
+Don't call this function; it is for internal use only."
+  (if sort-first
+      (let (list)
+       (map-keymap (lambda (a b) (push (cons a b) list))
+                   keymap)
+       (setq list (sort list
+                        (lambda (a b)
+                          (setq a (car a) b (car b))
+                          (if (integerp a)
+                              (if (integerp b) (< a b)
+                                t)
+                            (if (integerp b) t
+                              (string< a b))))))
+       (dolist (p list)
+         (funcall function (car p) (cdr p))))
+    (map-keymap function keymap)))
 
 (defmacro kbd (keys)
   "Convert KEYS to the internal Emacs key representation.
@@ -2209,20 +2227,12 @@ from `standard-syntax-table' otherwise."
     table))
 
 (defun syntax-after (pos)
-  "Return the syntax of the char after POS.
-The value is either a syntax character (a character that designates
-a syntax in `modify-syntax-entry'), or a cons cell
-of the form (CODE . MATCH), where CODE is the syntax character
-and MATCH is the matching parenthesis."
+  "Return the raw syntax of the char after POS."
   (unless (or (< pos (point-min)) (>= pos (point-max)))
-    (let* ((st (if parse-sexp-lookup-properties
-                  (get-char-property pos 'syntax-table)))
-          (value
-           (if (consp st) st
-             (aref (or st (syntax-table)) (char-after pos))))
-          (code (if (consp value) (car value) value)))
-      (setq code (aref "-.w_()'\"$\\/<>@!|" code))
-      (if (consp value) (cons code (cdr value)) code))))
+    (let ((st (if parse-sexp-lookup-properties
+                 (get-char-property pos 'syntax-table))))
+      (if (consp st) st
+       (aref (or st (syntax-table)) (char-after pos))))))
 
 (defun add-to-invisibility-spec (arg)
   "Add elements to `buffer-invisibility-spec'.