[slime-devel] Indentation question

Madhu enometh at meer.net
Wed Mar 30 16:22:55 UTC 2011


* Nikodemus Siivola: Wrote on Wed, 30 Mar 2011 16:08:46 +0300:

| I have a nasty habit of writing macros with multiple keyword clauses
| in them--like this:
|
| (deffoo foo (stuff)
|   (:bar (a b)
|     (cons a b))
|   (:zot (a b c)
|     (fii a b c))
|   (:default
|     42)
|   (:error
|     (crap)))
|
| which of course tend to indent terribly
|
| (deffoo foo (stuff)
|   (:bar (a b)
|         (cons a b))
|   (:zot (a b c)
|         (fii a b c))
|   (:default
|       42)
|   (:error
|    (crap)))

With Emacs you could try the appended Kludge (incomplete), which would
then indent it as:

(deffoo foo (stuff)
  (:bar (a b)
   (cons a b))
  (:zot (a b c)
   (fii a b c))
  (:default
   42)
  (:error
   (crap)))


--- cl-indent.el.orig	2011-01-28 21:36:00.000000000 +0530
+++ cl-indent.el	2011-03-30 21:33:07.000000000 +0530
@@ -253,6 +253,7 @@
               (setq tem (intern-soft function)
                     method (get tem 'common-lisp-indent-function))
               (cond ((and (null method)
+			  (not (string-match "^:" function))
                           (string-match ":[^:]+" function))
                      ;; The pleblisp package feature
                      (setq function (substring function
@@ -297,6 +298,7 @@
                    (setq method lisp-indent-defun-method)))
 
             (cond ((and (or (eq (char-after (1- containing-sexp)) ?\')
+			    (eq (char-after (1+ containing-sexp)) ?\:)
 			    (and (not lisp-backquote-indentation)
 				 (eq (char-after (1- containing-sexp)) ?\`)))
                         (not (eq (char-after (- containing-sexp 2)) ?\#)))





More information about the slime-devel mailing list