]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug#5395: typing '#' in an empty C buffer throws "args out of range".
authorAlan Mackenzie <acm@muc.de>
Tue, 19 Jan 2010 22:10:19 +0000 (22:10 +0000)
committerAlan Mackenzie <acm@muc.de>
Tue, 19 Jan 2010 22:10:19 +0000 (22:10 +0000)
* progmodes/cc-defs.el: (c-set-cpp-delimiters, c-clear-cpp-delimiters):
Check for EOB playing the role of delimiter.

lisp/ChangeLog
lisp/progmodes/cc-defs.el

index f9e55700c105edbc8416bf4c7ae9fab286f3a792..4b34373f2d39d752ccaba7a3cedfb18050d03ade 100644 (file)
@@ -1,3 +1,10 @@
+2010-01-19  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-defs.el: Fix bug#5395: typing '#' in an empty
+       buffer throws "args out of range".
+       (c-set-cpp-delimiters, c-clear-cpp-delimiters): Check for EOB
+       playing the role of delimiter.
+
 2010-01-18  Stephen Leake  <stephen_leake@member.fsf.org>
 
        * lisp/progmodes/ada-mode.el: Fix bug#5400.
index de0cd896b8e633dd5e935f48cad2c379583fa9d2..bb91dee6ce8b3a535f8a5ec9f45181e34f2d42ea 100644 (file)
@@ -1217,12 +1217,14 @@ been put there by c-put-char-property.  POINT remains unchanged."
   ;; This macro does a hidden buffer change.
   `(progn
      (c-put-char-property ,beg 'category 'c-cpp-delimiter)
-     (c-put-char-property ,end 'category 'c-cpp-delimiter)))
+     (if (< ,end (point-max))
+        (c-put-char-property ,end 'category 'c-cpp-delimiter))))
 (defmacro c-clear-cpp-delimiters (beg end)
   ;; This macro does a hidden buffer change.
   `(progn
      (c-clear-char-property ,beg 'category)
-     (c-clear-char-property ,end 'category)))
+     (if (< ,end (point-max))
+        (c-clear-char-property ,end 'category))))
 
 (defsubst c-comment-out-cpps ()
   ;; Render all preprocessor constructs syntactically commented out.