From: "Zoltan Kemenczy" <kemenczy@rogers.com>
Cc: rms@gnu.org, monnier@cs.yale.edu, emacs-devel@gnu.org
Subject: Re: [kemenczy@rogers.com: cc-engine:c-guess-basic-syntax related problem in latest CVS]
Date: Wed, 9 Jul 2003 22:08:16 -0400 [thread overview]
Message-ID: <000501c34688$20902500$0701a8c0@rim.net> (raw)
In-Reply-To: 5b1xx0tx2l.fsf@lister.roxen.com
Getting syntax information on write-protected C++ buffers does work now...
(however, visiting a .java file now doesn't load java-mode?? :-( . (don't
have time to look into the cc-mode autoloads) But after loading java-mode,
the syntactic information is returned correctly).
Regarding syntactic info 'predicates':
In gud-find-class certain lookups are performed a couple of times per
syntactic context as the information is parsed backward in the file looking
for any nested classes ('inclass syntactic elements). Two "predicates"
(there must be a better term for "getAttribute" type methods?) I found
useful to define (inside gud-find-class as local symbols) are:
(fset 'syntax-symbol (lambda (x) (car (car x)))) ; symbol of first
syntactic element
(fset 'syntax-point (lambda (x) (car (cdr (car x))))) ; point (integer) of
first syntactic element
If feeling pedantic, one could also define an iterator:
(fset 'syntax-remaining (lambda (x) (cdr x)))
to make reading code easier (a bit).
I did look through cc-engine to see if anything like the above existed...
It's just
common sense to have such predicates with the "objects", so if you agree,
redesign/name them for cc-engine, and I'll patch gud-jdb accordingly...
Regards, Zoltan
----- Original Message -----
From: "Martin Stjernholm" <mast@lysator.liu.se>
To: "Zoltan Kemenczy" <kemenczy@rogers.com>
Cc: <bug-cc-mode@gnu.org>; <emacs-devel@gnu.org>; <monnier@cs.yale.edu>;
<rms@gnu.org>
Sent: Tuesday, July 08, 2003 7:31 PM
Subject: Re: [kemenczy@rogers.com: cc-engine:c-guess-basic-syntax related
problem in latest CVS]
> > From: "Zoltan Kemenczy" <kemenczy@rogers.com>
> > Subject: cc-engine:c-guess-basic-syntax related problem in latest CVS
> > To: <emacs-devel@gnu.org>
> > Date: Tue Jul 8 04:11:46 2003 +0200
> >
> > Try S-M-; (c-guess-basic-syntax) at different points within a buffer
> > visiting a C source file that is *write-protected*... - I get a "Buffer
is
> > read-only: #<buffer foo.c>" message in many places. If the buffer is
made
> > writeable, the syntactic information is returned...
>
> This has to do with functions that make "hidden buffer changes", i.e.
> change text properties for internal purposes. See the blurb on that
> near the top of cc-engine.el. c-guess-basic-syntax is a function that
> could do such hidden buffer changes, but I've now wrapped it so that
> it can be called in read only mode again.
>
> > A related question (that started all this) is that the point value of
the
> > syntactic information is now returned as '(syntax-symbol point-integer)
list
> > (it used to be a cons cell: '(symbol . point-integer)). This breaks my
> > gud-find-class function inside gud.el. I fixed that function (to use
more
> > maintainable predicate functions on the syntactic info as opposed to the
> > (car (cdr...)), but before I submit the patch, I'd like to ask if this
> > change to the '(syntax-symbol point-integer) is there to stay...
>
> It is. I had to do that change to be able to extend syntactic
> information. There's a note about it in NEWS (which I've extended a
> bit now).
>
> I think such predicate functions belong in CC Mode. How did you design
> them?
next prev parent reply other threads:[~2003-07-10 2:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E19ZyfW-0006ae-4m@fencepost.gnu.org>
2003-07-08 23:31 ` [kemenczy@rogers.com: cc-engine:c-guess-basic-syntax related problem in latest CVS] Martin Stjernholm
2003-07-10 2:08 ` Zoltan Kemenczy [this message]
2003-07-16 21:13 ` Martin Stjernholm
2003-09-14 0:07 ` gud.el - jdb support update to work with updated cc-mode Zoltan Kemenczy
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='000501c34688$20902500$0701a8c0@rim.net' \
--to=kemenczy@rogers.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@cs.yale.edu \
--cc=rms@gnu.org \
--cc=zoltan@ieee.org \
/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).