bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16247: syntax-ppss returns incorrect state


From: Barry OReilly
Subject: bug#16247: syntax-ppss returns incorrect state
Date: Tue, 24 Dec 2013 18:00:58 -0500

Let /tmp/get-syntax.el :

  (defun get-syntax ()
    (interactive)
    (message "%s" (syntax-ppss (point))))

Run Emacs from trunk:

  ./src/emacs -Q lisp/progmodes/cc-engine.el --load /tmp/get-syntax.el

Insert this in Emacs:

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 973ed91..882c4f5 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -134,7 +134,7 @@
 ;;   cc-awk.el.
 
 ;;; Code:
-
+(
 (eval-when-compile
   (let ((load-path
         (if (and (boundp 'byte-compile-dest-file)

Go a couple lines down, | indicates point:

(
(eval-when-compile
|  (let ((load-path
        (if (and (boundp 'byte-compile-dest-file)

Execute M-x get-syntax and see:

  (2 5705 5706 nil nil nil 0 nil nil (5703 5705))

Looks ok. Move down in buffer, | indicates point:

;; Included in the mode line to indicate the active submodes.
;; (defvar c-submode-indicators nil)
;; (make-variable-buffer-local 'c-submode-indicators)
|
(defun c-calculate-state (arg prevstate)
  ;; Calculate the new state of PREVSTATE, t or nil, based on arg. If
  ;; arg is nil or zero, toggle the state. If arg is negative, turn
  ;; the state off, and if arg is positive, turn the state on
  (if (or (not arg)
      (zerop (setq arg (prefix-numeric-value arg))))
      (not prevstate)
    (> arg 0)))

M-x get-syntax:

  (0 nil 7000 nil nil nil 0 nil nil nil)

Expected the depth to be 1, not 0. For good measure, go back to the
same position of the first get-syntax call and do it again:

  (1 5705 5706 nil nil nil 0 nil nil (5705))

Why did the same buffer position change from depth 2 to depth 1, even
though the buffer didn't change between the get-syntax calls?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]