[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
problem with c-indent-line-or-region
From: |
Greg Hill |
Subject: |
problem with c-indent-line-or-region |
Date: |
Wed, 3 Mar 2004 19:28:24 -0800 |
When I set up C indentation to leave the indentation of block
comments unchanged,
c-indent-line-or-region is sometimes broken by the presence of
parentheses within block comments.
With the files junk.c and bug.el shown below in my current
directory, I execute the command line shown below and get the debugger
output shown at the bottom.
The problem appears to depend on the behavior of the built-in
function forward-comment, which is called
from c-forward-comment, which is called
from c-backward-syntactic-ws.
If '(forward-comment (- (point-max))) is
executed when point is just after the comment-closing "*/",
point does not move. But if a space character is inserted in
front of the "(A)", then
'(forward-comment (- (point-max))) moves point to in front of
the "/*".
Inserting a space in front of the "(A)" also makes the
problem in c-indent-line-or-region go
away.
junk.c
--------------------
/*
(A)
1)
*/
void dummy ()
{
return;
}
bug.el
--------------------
(defun bugtest ()
(setq c-mode-hook nil)
(add-hook 'c-mode-hook
(function
(lambda ()
(setq
;;Problem depends in part on the line below
c-offsets-alist '((c . c-lineup-dont-change))
tab-width 2)
(c-set-style "gnu"
t))))
(find-file
"junk.c")
(mark-whole-buffer)
(setq debug-on-error t)
(c-indent-line-or-region))
command line
--------------------
emacs -q -l bug.el -f bugtest
debugger output
------------------------
Debugger entered--Lisp error:
(scan-error "Unbalanced parentheses" 13 1)
scan-lists(13 -1 1)
up-list(-1)
backward-up-list(1)
c-beginning-of-statement-1(1)
c-guess-basic-syntax()
c-indent-line(nil t)
c-indent-region(1 42)
c-indent-line-or-region()
bugtest()
command-line-1(("-l" "bug.el" "-f"
"bugtest"))
command-line()
normal-top-level()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- problem with c-indent-line-or-region,
Greg Hill <=