]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Emacs bug #10463 - put `widen's around the critical spots.
authorAlan Mackenzie <acm@muc.de>
Wed, 11 Jan 2012 22:21:44 +0000 (22:21 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 11 Jan 2012 22:21:44 +0000 (22:21 +0000)
lisp/ChangeLog
lisp/progmodes/cc-engine.el

index 90a2070c87c20e0aa5b6e5cd5365a4ecd3c98218..4f81fdab8e4c585a4fce81af6ffd5a242b9be707 100644 (file)
@@ -1,3 +1,11 @@
+2012-01-11  Alan Mackenzie  <acm@muc.de>
+
+       Fix Emacs bug #10463 - put `widen's around the critical spots.
+
+        * progmodes/cc-engine.el (c-in-literal, c-literal-limits): put a
+       widen around each invocation of c-state-pp-to-literal.  Remove an
+       unused let variable.
+
 2012-01-11  Glenn Morris  <rgm@gnu.org>
 
        * dired-aux.el (dired-do-shell-command): Fix */? logic.  (Bug#6561)
index 392e5d1c37c8b5c58cebb4c3f1b96a2391baa0dd..2e0294341da6cdf2a157a41a80f0756bf7cf65dd 100644 (file)
@@ -4211,12 +4211,14 @@ The last point calculated is cached if the cache is enabled, i.e. if
 
 Note that this function might do hidden buffer changes.  See the
 comment at the start of cc-engine.el for more info."
-  (let* ((safe-place (c-state-safe-place (point)))
-        (lit (c-state-pp-to-literal safe-place (point))))
-    (or (cadr lit)
-       (and detect-cpp
-            (save-excursion (c-beginning-of-macro))
-            'pound))))
+  (save-restriction
+    (widen)
+    (let* ((safe-place (c-state-safe-place (point)))
+          (lit (c-state-pp-to-literal safe-place (point))))
+      (or (cadr lit)
+         (and detect-cpp
+              (save-excursion (c-beginning-of-macro))
+              'pound)))))
 
 (defun c-literal-limits (&optional lim near not-in-delimiter)
   "Return a cons of the beginning and end positions of the comment or
@@ -4236,9 +4238,10 @@ comment at the start of cc-engine.el for more info."
   (save-excursion
     (let* ((pos (point))
           (lim (or lim (c-state-safe-place pos)))
-          (pp-to-lit (c-state-pp-to-literal lim pos))
+          (pp-to-lit (save-restriction
+                       (widen)
+                       (c-state-pp-to-literal lim pos)))
           (state (car pp-to-lit))
-          (lit-type (cadr pp-to-lit))
           (lit-limits (car (cddr pp-to-lit))))
 
       (cond