help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

infinite loop while editing C code: emacs 23.2


From: Jim Diamond
Subject: infinite loop while editing C code: emacs 23.2
Date: Thu, 13 Jan 2011 21:00:08 -0400
User-agent: slrn/0.9.9p1 (Linux)

For many years I've been using "my own(*)" C mode, in which I have
(require 'cc-mode).
(And yes, some of you are going to say to just customize cc mode, but
I'd prefer not to do that.)

"Recently" ((*cough*) emacs 21 or 22, IIRC), a problem has cropped up.
I can repeatedly reproduce the problem as follows:
- fire up a new emacs,
- start editing a C program,
- and type

#d<space>sd(

it goes into an apparently infinite loop.

I have
    (define-abbrev zsd-c-mode-abbrev-table "#d"     "#define    "   nil)
so after typing
        #d<space>sd the line looks like
#define     sd
and when I type the '(' the '(' does not appear on the screen.

If, before I do this, I (setq debug-on-quit t), the Backtrace buffer shows

debugger entered--Lisp error: (quit)
  c-neutralize-CPP-line(2 16)
  c-extend-and-neutralize-syntax-in-CPP(15 16 0)
  c-after-change(15 16 0)

Looking at the code in cc-mode.el I'm at a bit of a loss at to what
the issue is.

Interestingly, this infinite loop does not happen all the time.  If,
after quitting with ^G, I finish that line and then continue to add
more similar #define lines, the other ones don't cause any problems.
(I can't say for certain whether or not in some other situation the
problem re-occurs.)


I also have the possibly-relevant code

(defvar zsd-c-mode-abbrev-table nil
    "Abbrev table in use in zsd-c-mode buffers."
)
(define-abbrev-table 'zsd-c-mode-abbrev-table ())
(define-abbrev zsd-c-mode-abbrev-table "#d"     "#define    "   nil)
(setq local-abbrev-table zsd-c-mode-abbrev-table)

(defvar zsd-c-mode-syntax-table nil
    "Syntax table in use in zsd-c-mode buffers."
)
(setq zsd-c-mode-syntax-table (make-syntax-table))
(c-populate-syntax-table zsd-c-mode-syntax-table)
(modify-syntax-entry ?# "w"  zsd-c-mode-syntax-table)
z(set-syntax-table zsd-c-mode-syntax-table)


I realize that without seeing my whole mode file, others are probably
shooting in the dark.  But having said that...

Any ideas?  Any suggestions on what I should do next to debug this
problem?  My C mode worked benevolently for many years, starting with
emacs 18.<something>; I should have chased this down when I first
noticed it, but I decided to quit procrastinating on this one today.

Thanks.
                                Jim

(*) In fact, it is a heavily-modified version of something I came
across when I first started using emacs.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]