From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: Tabs and Spaces Date: Wed, 27 May 2009 00:40:35 +0200 Organization: Informatimago Message-ID: <8763fn5vz0.fsf@galatea.local> References: <77vbbiF1jhhubU1@mid.individual.net> <780hs5F1jleh1U1@mid.individual.net> <87r5ycu0w6.fsf@galatea.local> <7835dsF1kbm4vU1@mid.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1243381250 6849 80.91.229.12 (26 May 2009 23:40:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 May 2009 23:40:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 27 01:40:46 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1M96GD-0003wh-IL for geh-help-gnu-emacs@m.gmane.org; Wed, 27 May 2009 01:40:45 +0200 Original-Received: from localhost ([127.0.0.1]:58057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M96GC-0005Sc-P1 for geh-help-gnu-emacs@m.gmane.org; Tue, 26 May 2009 19:40:44 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp16-1.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Cancel-Lock: sha1:MGRlMThlMGVkYzEyM2VkMWVkODE3N2E5MzY4MjFjOWJiOGZjZGZkMA== Original-Lines: 44 Original-NNTP-Posting-Date: 27 May 2009 00:40:36 MEST Original-NNTP-Posting-Host: 88.182.134.169 Original-X-Trace: 1243377636 news-1.free.fr 29480 88.182.134.169:58090 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:169519 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:64752 Archived-At: "Drew Adams" 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 to after ). 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> (vs. x >)). 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__