[slime-devel] semantic indentation

Hello, I'm looking for a solution to my indentation problem. I have functions named like <:html, <:body, <package1:a-tag. I want them to be indented as '(&body) so that on the next line indentation is neat. For example, like this: (<:html :some-property "foo" (<:body ...)) I've read this, http://common-lisp.net/project/slime/doc/html/Semantic-indentation.html Is there a way to tell swank/slime indent all symbols in a package for instance (find-package '<) and indent all exported symbols as '(&body)? Thanks, evrim.

On Wed, Aug 01 2012, Evrim Ulu wrote:
Is there a way to tell swank/slime indent all symbols in a package for instance (find-package '<) and indent all exported symbols as '(&body)?
SLIME, actually common-lisp-indent-function, ignores the package qualifier of symbols when indenting. bar:foo and baz:foo are indented the same. Helmut

Hello, Ok, no problem, let's assume the symbol is interned on only a single package. I've modified symbol-indentation (symbol) function to return something else on some specific symbols. Yet, i cannot make the indentation work. My answer is probably there, yet I dont know which value to set: (put 'my-symbol 'common-lisp-indent-function ..??) http://www.gnu.org/software/emacs/manual/html_node/elisp/Indenting-Macros.ht... Thanks, evrim.

On Wed, Aug 01 2012, Evrim Ulu wrote:
Hello,
Ok, no problem, let's assume the symbol is interned on only a single package.
I've modified symbol-indentation (symbol) function to return something else on some specific symbols.
Yet, i cannot make the indentation work.
My answer is probably there, yet I dont know which value to set:
(put 'my-symbol 'common-lisp-indent-function ..??)
http://www.gnu.org/software/emacs/manual/html_node/elisp/Indenting-Macros.ht...
It seems that you want to indent like so (html :attr1 val1 :attr2 val2 (body ...)) I'm not aware of a standard indentation function that does that, but you can write your own. E.g.: (put 'html 'common-lisp-indent-function 'my-html-indent) (defun my-html-indent (path state indent-point sexp-column normal-indent) (let* ((pos (car path)) (start (elt state 1)) (attrs (my-html-indent-count-attributes start (point)))) (cond ((> pos attrs) (+ sexp-column 1)) (t normal-indent)))) (defun my-html-indent-count-attributes (start end) (save-excursion (goto-char start) (save-restriction (narrow-to-region (point) end) (down-list) (forward-sexp 1) (let ((count 0)) (while (progn (skip-chars-forward " \t\n") (looking-at "[^() \n]")) (incf count) (forward-sexp 1)) count))))
participants (2)
-
Evrim Ulu
-
Helmut Eller