[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tabs and Spaces
From: |
Pascal J. Bourguignon |
Subject: |
Re: Tabs and Spaces |
Date: |
Wed, 27 May 2009 00:40:35 +0200 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) |
"Drew Adams" <drew.adams@oracle.com> writes:
>> Since it is unlikely that the built in emacs parsing /
>> indentation will be able to handle my modified syntax,...
>> For the longer term, I definitely want to work out how
>> to customise the indentation for my purposes.
>
> It's not hard, actually. It's just not well documented (IMO).
>
> See the Emacs manual, node `Lisp Indent'.
>
> Personally, I think the explanation given there is inadequate, and this (or
> more) should really be in the Elisp manual (you need some Lisp code to
> customize
> indentation of various Lisp sexps) - there is nothing in the Lisp manual about
> it. I've just filed a doc bug about this.
>
> After reading that node, `grep' the Lisp source code for places where it puts
> property `lisp-indent-function' on various function and macro symbols. Just
> copy
> what's done there. See also `C-h f lisp-indent-function', which describes the
> function that uses the symbol property.
Well sexp indenting is the easy special case.
I would advise rather to have a look at the pascal.el source (where
pascal-mode and pascal-indent-line are defined). This is probably
closer to what Chris would need to implement.
However, there is one thing that could be done cf. sexps, is to
implement the forward-sexp-function hook. This is a function that
should move the cursor forward (or backward depending on its argument)
over a number of "sexp" that is, of expressions in the current
language. So given a cursor before a BEGIN, it would have to move
after the matching END, and so on for all the kinds of brackets the
languages allows (for xml, it would have to move from before <tag> to
after </tag>). In the case of C++ however, there are a lot of
different brackets, so parsing and matching them is hard and
puzzling. (And what to do of x<a<b>> (vs. x<a<b> >)).
Anyways, with this hook implemented, a lot of existing functions and
commands will start to work meaningfully in these buffers, and the
generic indenting algorithm may be usable.
--
__Pascal Bourguignon__
- Re: Tabs and Spaces, (continued)
Re: Tabs and Spaces, B Smith-Mannschott, 2009/05/25
RE: Tabs and Spaces, Drew Adams, 2009/05/25
Message not available
Message not available
Re: Tabs and Spaces, Chris Gordon-Smith, 2009/05/26