unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Greg Hill <ghill@synergymicro.com>
Subject: problem with c-indent-line-or-region
Date: Wed, 3 Mar 2004 19:28:24 -0800	[thread overview]
Message-ID: <p06002000bc6c014ad13f@[10.1.6.251]> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1833 bytes --]

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()

[-- Attachment #1.2: Type: text/html, Size: 4517 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
Bug-gnu-emacs mailing list
Bug-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs

                 reply	other threads:[~2004-03-04  3:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='p06002000bc6c014ad13f@[10.1.6.251]' \
    --to=ghill@synergymicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).