changeset 58009:07de2e31fd49

(syntax-after): Return the syntax letter, not the raw code.
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Nov 2004 04:10:38 +0000
parents df086ccddd21
children 0a98ca85a5c6
files lisp/subr.el
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sun Nov 07 04:09:31 2004 +0000
+++ b/lisp/subr.el	Sun Nov 07 04:10:38 2004 +0000
@@ -2209,12 +2209,20 @@
     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'.