From: Volkan YAZICI <volkan.yazici@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Common Lisp DEF Macro Indentation
Date: Wed, 16 Jul 2008 12:07:05 -0700 (PDT) [thread overview]
Message-ID: <f8bfa4ea-2923-467e-afb5-34c9b745cea6@k37g2000hsf.googlegroups.com> (raw)
In-Reply-To: fc6766eb-954a-404d-a23c-37716e307063@m73g2000hsh.googlegroups.com
On Jul 14, 4:03 pm, Volkan YAZICI <volkan.yaz...@gmail.com> wrote:
> ...
> What might be causing the problem? Are there any mistakes with forms I
> supplied to LISP-INDENT-259? Any kind of help will be appreciated.
Here goes the fixed version:
(require 'cl)
(defmacro concatenate-def-types-for-regexp (&rest symbols)
(with-output-to-string
(princ "(?\\(")
(let (not-first)
(while symbols
(if not-first
(princ "\\|")
(setq not-first t))
(princ (pop symbols))))
(princ "\\)")))
(defcustom lisp-indent-def-function-regexp
(concatenate-def-types-for-regexp
function macro compiler-macro method generic type print-object
class
condition)
"Definer types will be indented like a function definition form."
:type 'string
:group 'lisp-indent)
(defcustom lisp-indent-def-variable-regexp
(concatenate-def-types-for-regexp
variable constant load-time-constant special-variable symbol-macro
struct)
"Definer types will be indented like a variable definition form."
:type 'string
:group 'lisp-indent)
(defcustom lisp-indent-def-setf-regexp
(concatenate-def-types-for-regexp setf)
"Definer types will be indented like a setf definition form."
:type 'string
:group 'lisp-indent)
(defmacro with-position-at-def-type (position &rest body)
`(save-excursion
(goto-char ,position)
(forward-char)
(forward-sexp 1)
(while (forward-comment 1))
,@body))
(defun lisp-indent-def (path state indent-point sexp-column normal-
indent)
(lisp-indent-259
(with-position-at-def-type (elt state 1)
(cond ((looking-at lisp-indent-def-function-regexp)
'(4 4 &lambda &body))
((looking-at lisp-indent-def-variable-regexp)
'(4 4 &body))
((looking-at lisp-indent-def-setf-regexp)
'(4 4 &lambda &body))
(t
'(&body))))
path state indent-point sexp-column normal-indent))
(put 'def 'common-lisp-indent-function 'lisp-indent-def)
Pay attention that, in LISP-INDENT-DEF, if we couldn't find an
appropriate known definer type, we pass '(&body) to LISP-INDENT-259.
(Also fixed indentation routines in demacs too.)
Regards.
prev parent reply other threads:[~2008-07-16 19:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 13:03 Common Lisp DEF Macro Indentation Volkan YAZICI
2008-07-16 19:07 ` Volkan YAZICI [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8bfa4ea-2923-467e-afb5-34c9b745cea6@k37g2000hsf.googlegroups.com \
--to=volkan.yazici@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.