]> git.eshelyaron.com Git - emacs.git/commitdiff
(syntax-after): Return the syntax letter, not the raw code.
authorRichard M. Stallman <rms@gnu.org>
Sun, 7 Nov 2004 04:10:38 +0000 (04:10 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 7 Nov 2004 04:10:38 +0000 (04:10 +0000)
lisp/subr.el

index d84aebceba44d3bb49c74900c754fce220416dca..faf9e6c2f1301d0ca7dc95fc6c13e92f19f45f61 100644 (file)
@@ -2209,12 +2209,20 @@ from `standard-syntax-table' otherwise."
     table))
 
 (defun syntax-after (pos)
-  "Return the syntax of the char 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."
   (unless (or (< pos (point-min)) (>= pos (point-max)))
-    (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))))))
+    (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))))
 
 (defun add-to-invisibility-spec (arg)
   "Add elements to `buffer-invisibility-spec'.