Indentation without slime:
(DEFMACRO DEFTRANSLATION (TABLE TEXT LANGUAGE TRANSLATION &REST LANGS-TRANS) `(PROGN (DEFVAR ,TABLE (MAKE-HASH-TABLE :TEST (FUNCTION EQUAL))) (SETF ,@(DO ((LT (CONS LANGUAGE (CONS TRANSLATION LANGS-TRANS))) (RESULT ,())) ((NULL LT) (NREVERSE RESULT)) (PUSH `(GETHASH (CONS ,TEXT ,(POP LT)) ,TABLE)) (LET ((TRANS (POP LT))) (IF (EQ TRANSLATION :IDEM) `,TEXT `,TRANSLATION))))) );;deftranslation
(DEFUN LOCALIZE (TABLE LANGUAGE TEXT) " RETURN: A version of the text in the given language. " (LET ((SYM (INTERN-SOFT TEXT TABLE))) (IF SYM (LET ((RESULT (GET SYM LANGUAGE))) (IF RESULT RESULT (LOCALIZE TABLE :EN TEXT))) TEXT)));;localize
Indentation with slime:
(DEFMACRO DEFTRANSLATION (TABLE TEXT LANGUAGE TRANSLATION &REST LANGS-TRANS) `(PROGN (DEFVAR ,TABLE (MAKE-HASH-TABLE :TEST (FUNCTION EQUAL))) (SETF ,@(DO ((LT (CONS LANGUAGE (CONS TRANSLATION LANGS-TRANS))) (RESULT ,())) ((NULL LT) (NREVERSE RESULT)) (PUSH `(GETHASH (CONS ,TEXT ,(POP LT)) ,TABLE)) (LET ((TRANS (POP LT))) (IF (EQ TRANSLATION :IDEM) `,TEXT `,TRANSLATION))))) );;DEFTRANSLATION
(DEFUN LOCALIZE (TABLE LANGUAGE TEXT) " RETURN: A version of the text in the given language. " (LET ((SYM (INTERN-SOFT TEXT TABLE))) (IF SYM (LET ((RESULT (GET SYM LANGUAGE))) (IF RESULT RESULT (LOCALIZE TABLE :EN TEXT))) TEXT)));;LOCALIZE
The slime-indentation of &REST is right, but all the rest is wrong. How could I disable it?
"Pascal J.Bourguignon" pjb@informatimago.com writes:
Indentation with slime:
(DEFMACRO DEFTRANSLATION (TABLE TEXT LANGUAGE TRANSLATION &REST LANGS-TRANS) `(PROGN (DEFVAR ,TABLE (MAKE-HASH-TABLE :TEST (FUNCTION EQUAL))) (SETF ,@(DO ((LT (CONS LANGUAGE (CONS TRANSLATION LANGS-TRANS))) (RESULT ,())) ((NULL LT) (NREVERSE RESULT)) (PUSH `(GETHASH (CONS ,TEXT ,(POP LT)) ,TABLE)) (LET ((TRANS (POP LT))) (IF (EQ TRANSLATION :IDEM) `,TEXT `,TRANSLATION))))) );;DEFTRANSLATION
(DEFUN LOCALIZE (TABLE LANGUAGE TEXT) " RETURN: A version of the text in the given language. " (LET ((SYM (INTERN-SOFT TEXT TABLE))) (IF SYM (LET ((RESULT (GET SYM LANGUAGE))) (IF RESULT RESULT (LOCALIZE TABLE :EN TEXT))) TEXT)));;LOCALIZE
The slime-indentation of &REST is right, but all the rest is wrong. How could I disable it?
As far as I can see, only the forms beginning with "`(progn" and ",@(do" are wrong.
Emacs thinks the backquoted list is some generic data and not code. In newer Emacsen have a variable lisp-backquote-indentation to control this. Setting it to t should give better results. But I think there a bug in common-lisp-indent-function, because I can't see any the reason why ",@(do" should ever be considered as data. I think I fixed that in the cl-inded.el file which is now included in SLIME. See the other message.
Helmut.