Martin Stjernholm | 3 Jul 2003 17:20
Picon
Picon
Picon
Favicon

Re: CC-mode conflict with lucid.el

Masayuki Ataka <ataka <at> milk.freemail.ne.jp> wrote:

> cc-engine.el and lucid.el conflicts.
> 
> [TRIGER]
> (0) $ emacs -q
> (1) (require 'lucid) at first.
> (2) Open C file and write struct out of function.
> --- test.c ---
> struct a {
> -!-
> --------------
> (3) Hit TAB for indentation at the place of -!-.
> (4) ERORR: Args out of range
> 
> 
> [BACKTRACE]
> Debugger entered--Lisp error: (args-out-of-range 1 12)
>   parse-partial-sexp(1 12 nil nil (0 nil nil nil nil nil 0 nil nil nil))
>   syntax-ppss(12)
>   buffer-syntactic-context()
>   c-in-literal(12)
>   c-guess-basic-syntax()
>   c-indent-line()
>   #[nil "Â>ƒ)C ��x� � )iÆ Xƒ\"Ç	!‚'G	!))‡ ‡"
[indent-line-function column (indent-relative indent-relative-maybe) beginning-of-line "\n 	"
nil current-indentation indent-line-to] 2 680988 nil]()
>   c-indent-command(1)
>   call-interactively(c-indent-command)
> 
(Continue reading)

Richard Stallman | 4 Jul 2003 22:36
Picon
Picon

Re: CC-mode conflict with lucid.el

    I regard this as a bug in lucid.el. If the function exists then CC
    Mode only uses it under the assumption that it works like in XEmacs,
    not that CC Mode runs in XEmacs. The lucid package also defines it
    with the goal that it should work as in XEmacs, which apparently isn't
    the case.

Could you possibly fix buffer-syntactic-context to work as in XEmacs?
That is the intention, but I don't know where the discrepancy is.

    > (I can't follow why the function parse-partial-sexp returns error!)

    Haven't investigated that, but it looks like a problem in syntax-ppss
    in syntax.el.

Stefan Monnier has worked on that--he can probably help here

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01

Stefan Monnier | 4 Jul 2003 02:55
Picon
Favicon

Re: CC-mode conflict with lucid.el

> > File lucid.el defines function buffer-syntactic-context for XEmacs
> > compatibility.  c-engine.el defines alias for function c-in-literal if
> > the function buffer-syntactic-context is available.
> > I think cc-engine.el should not use buffer-syntactic-context in order to
> > check out XEmacs, if they wanted to.
> 
> I regard this as a bug in lucid.el.

That sounds right.  Note that lucid.el introduces lots of opportunities
for such problems so it should generally be avoided.  The function
buffer-syntactic-context should simply be commented out from lucid.el.
I added it for no good reason (other than the fact that I had written
it and felt like I might as well install it there, which was obviously
a mistake).
If someone could do that for me, that'd be great.

> If the buffer-syntactic-context replacement worked, it's even possible
> that it improves the speed in CC Mode since the Emacs counterpart
> syntax-ppss is not yet used everywhere where it could do good.

I guess the problem is that the buffer is narrowed when syntax-ppss
is called.  We should probably fix syntax-ppss to widen when needed.

> I also see that the lucid.el version doesn't return 'block-comment
> like the XEmacs original. That ought to be fixed too.

IIRC, the problem is that it's poorly defined: the doc says it returns
block-comments for line-terminated comments, but the implementation
returns block-comments for "style b comments".  The two are orthogonal.
I think it's pretty easy to adjust buffer-syntactic-context to emulate
(Continue reading)

Richard Stallman | 6 Jul 2003 00:25
Picon
Picon

Re: CC-mode conflict with lucid.el

      The function
    buffer-syntactic-context should simply be commented out from lucid.el.

Why do you think so?  Isn't it useful to offer compatibility for that
function?

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01

Stefan Monnier | 6 Jul 2003 18:37
Picon
Favicon

Re: CC-mode conflict with lucid.el

>       The function
>     buffer-syntactic-context should simply be commented out from lucid.el.
> 
> Why do you think so?  Isn't it useful to offer compatibility for that
> function?

lucid.el should generally be avoided, and syntax-ppss is better.
Furthermore, I don't know of any package that needs buffer-syntactic-context
to be functional.

	Stefan

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01

Stefan Monnier | 6 Jul 2003 18:37
Picon
Favicon

Re: CC-mode conflict with lucid.el

>       The function
>     buffer-syntactic-context should simply be commented out from lucid.el.
> 
> Why do you think so?  Isn't it useful to offer compatibility for that
> function?

lucid.el should generally be avoided, and syntax-ppss is better.
Furthermore, I don't know of any package that needs buffer-syntactic-context
to be functional.

	Stefan
Richard Stallman | 7 Jul 2003 05:39
Picon
Picon

Re: CC-mode conflict with lucid.el

    > Why do you think so?  Isn't it useful to offer compatibility for that
    > function?

    lucid.el should generally be avoided, 

Why so?

					  and syntax-ppss is better.

That's good.  But why don't we want to provide compatibility
for buffer-syntactic-context?

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01

Stefan Monnier | 7 Jul 2003 16:14
Picon
Favicon

Re: CC-mode conflict with lucid.el

>     > Why do you think so?  Isn't it useful to offer compatibility for that
>     > function?
>     lucid.el should generally be avoided,
> Why so?

Because it provides only partial compatibility and tends to
confuse packages that use fboundp and then assume that they
run under XEmacs because the XEmacs-only function exists.
Also many of the compatibility functions provided are not 100% compatible
(buffer-syntactic-context being an obvious example, but many/most other
functions as well).

> 					  and syntax-ppss is better.
> That's good.  But why don't we want to provide compatibility
> for buffer-syntactic-context?

Because it's not necessary.

	Stefan

-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01

Richard Stallman | 8 Jul 2003 22:01
Picon
Picon

Re: CC-mode conflict with lucid.el

    Also many of the compatibility functions provided are not 100% compatible
    (buffer-syntactic-context being an obvious example, but many/most other
    functions as well).

Why not make them more compatible, then?  That seems like a useful
thing to do.

-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps

Richard Stallman | 4 Jul 2003 22:36
Picon
Picon

Re: CC-mode conflict with lucid.el

    I regard this as a bug in lucid.el. If the function exists then CC
    Mode only uses it under the assumption that it works like in XEmacs,
    not that CC Mode runs in XEmacs. The lucid package also defines it
    with the goal that it should work as in XEmacs, which apparently isn't
    the case.

Could you possibly fix buffer-syntactic-context to work as in XEmacs?
That is the intention, but I don't know where the discrepancy is.

    > (I can't follow why the function parse-partial-sexp returns error!)

    Haven't investigated that, but it looks like a problem in syntax-ppss
    in syntax.el.

Stefan Monnier has worked on that--he can probably help here

Gmane