--=-=-=
Guys,
if your Lisp hacking these days contains bunches of #/doThis:withThat:
and ccl::slet and whatnot, you might be interested in this little
addition to XEmacs' Common Lisp indentation function. I have no idea if
this would work in GNU Emacs at all.
--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: inline; filename=cl-indent-rc.el
Content-Transfer-Encoding: quoted-printable
Content-Description: common-lisp-indent-function addition
;;; cl-indent-rc.el --- cl-indent additions
;; Copyright (C) 2008 Didier Verna
;; Author: Didier Verna <······@lrde.epita.fr>
;; Maintainer: Didier Verna <······@lrde.epita.fr>
;; Created: Sun Jun 29 21:01:44 2008
;; Last Revision: Sun Jun 29 21:01:44 2008
;; Keywords: extensions, lisp
;; This file is part of This program.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
;;; Commentary:
;; Contents management by FCM version 0.1.
;;; Code:
(defadvice common-lisp-indent-function (before ccl-objc-bridge activate)
"Improve indentation scheme of the CCL Objective-C bridge.
Currently, this does the following:
- All (#/doThis:withThat: ...) forms are indented as per a
lisp-indent-function property of 1. This effectively treats the first argum=
ent
(an object or a class) as special. The indentation you get is:
(#/function arg1 instead of: (#/function arg1
arg2 ...) arg2 ...)"
(let ((containing-form-start (elt state 1)))
(save-excursion
(goto-char containing-form-start)
(forward-char 1)
(cond ((looking-at "#/\\(\\w\\|:\\)*:")
;; We're looking at a (#/doThis:withThat: ...) form. In its holy
;; brokenness, common-lisp-indent-function with the help of
;; parse-partial-sexp will consider that the function name in
;; this form is "/functioncall:". Our trick here is to
;; dynamically put a lisp-indent-function property of 1 on this
;; symbol, so that the subsequent (original) indenting function
;; will handle it.
(let* ((beg (progn (forward-char 1) (point)))
(sym (progn
(forward-sexp 1)
(intern (downcase (buffer-substring beg
(point)))))))
(put sym 'common-lisp-indent-function 1)))))))
(put 'slet 'common-lisp-indent-function '((&whole 4 &rest (&whole 1 1 2)) &=
body))
(put 'slet* 'common-lisp-indent-function '((&whole 4 &rest (&whole 1 1 2)) =
&body))
;;; cl-indent-rc.el ends here
--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
--
5th European Lisp Workshop at ECOOP 2008, July 7: http://elw.bknr.net/2008/
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (0)1 44 08 01 85
94276 Le Kremlin-Bic�tre, France Fax.+33 (0)1 53 14 59 22 ······@xemacs.org
--=-=-=--
I wrote:
> Guys,
>
> if your Lisp hacking these days contains bunches of #/doThis:withThat:
> and ccl::slet and whatnot, you might be interested in this little
> addition to XEmacs' Common Lisp indentation function. I have no idea if
> this would work in GNU Emacs at all.
A more detailed rationale here:
http://www.lrde.epita.fr/~didier/sciblog/index.php?entry=entry080701-150716
--
5th European Lisp Workshop at ECOOP 2008, July 7: http://elw.bknr.net/2008/
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (0)1 44 08 01 85
94276 Le Kremlin-Bic�tre, France Fax.+33 (0)1 53 14 59 22 ······@xemacs.org