this patch fixed the problem for me. thanks On Sat, Feb 8, 2014 at 10:51 PM, Alan Mackenzie wrote: > Hi, Glenn. > > On Sat, Feb 08, 2014 at 03:12:20PM -0500, Glenn Morris wrote: > > eg5cue@gmail.com wrote: > > > > this is a longstanding bug since 24.3(i don't tried older versions) > > > till now (the latest git version - github mirror), and is very > > > annoying. it happens when trying to comment out (a line/multiple > > > lines) except the first line from a C family file that: > > > > it's first line isn't empty or a comment. > > > isn't modified after it's opened. > > > > comment function: comment-dwim (M-;) > > > emacs args: emacs -Q > > > Thanks. For future reference, please do > > > M-x toggle-debug-on-error > > > and include the basktrace in the report: > > > Debugger entered--Lisp error: (args-out-of-range 1 2) > > remove-text-properties(# 2 (category nil)) > > c-invalidate-state-cache(17) > > c-before-change(17 17) > > comment-region-internal(17 45 "/* " " */" nil nil nil nil t) > > comment-region-default(16 46 nil) > > comment-region(16 46 nil) > > comment-or-uncomment-region(16 46 nil) > > comment-dwim(nil) > > call-interactively(comment-dwim nil nil) > > command-execute(comment-dwim) > > I think this is the same bug as #16585, which I've just posted a patch > for. Here is the patch again. After applying this patch, recompile > progmodes/cc-defs.el, then recompile progmodes/cc-engine.el. > > To the Original Poster: please try this out, and confirm it fixes the > bug. Thanks! > > > === modified file 'lisp/progmodes/cc-defs.el' > *** lisp/progmodes/cc-defs.el 2014-02-02 10:25:29 +0000 > --- lisp/progmodes/cc-defs.el 2014-02-08 22:21:01 +0000 > *************** > *** 1293,1302 **** > ;; suppressed. > `(unwind-protect > (c-save-buffer-state () > ! (c-clear-cpp-delimiters ,beg ,end) > ,`(c-with-cpps-commented-out ,@forms)) > (c-save-buffer-state () > ! (c-set-cpp-delimiters ,beg ,end)))) > > (defsubst c-intersect-lists (list alist) > ;; return the element of ALIST that matches the first element found > --- 1293,1306 ---- > ;; suppressed. > `(unwind-protect > (c-save-buffer-state () > ! (save-restriction > ! (widen) > ! (c-clear-cpp-delimiters ,beg ,end)) > ,`(c-with-cpps-commented-out ,@forms)) > (c-save-buffer-state () > ! (save-restriction > ! (widen) > ! (c-set-cpp-delimiters ,beg ,end))))) > > (defsubst c-intersect-lists (list alist) > ;; return the element of ALIST that matches the first element found > > > -- > Alan Mackenzie (Nuremberg, Germany). >