bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lisp-indent-defmethod is broken


From: Hannu Koivisto
Subject: lisp-indent-defmethod is broken
Date: 13 Nov 2001 20:36:10 +0200
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/20.7

Greetings,

Attempts to indent lines marked with quux-comments in examples
below using common-lisp-indent-function will result either to an
error or to an incorrect indentation due to problems in
lisp-indent-defmethod in cl-indent.el in Emacs 21.1.

Example 1:

(defmethod foo :before ((bar baz)
)) ; quux

Example 2:

(defmethod
    foo
    :before
((bar baz))) ; quux

A fixed version of lisp-indent-defmethod is provided below.

(eval-when-compile (require 'cl))

(defun lisp-indent-defmethod (path state indent-point sexp-column
                              normal-indent)
  "Indentation function defmethod."
  (lisp-indent-259 (if (and (>= (first path) 3)
                            (null (rest path))
                            (save-excursion (goto-char (elt state 1))
                                            (forward-char 1)
                                            (forward-sexp 3)
                                            (backward-sexp)
                                            (looking-at ":")))
                       '(4 4 (&whole 4 &rest 4) &body)
                     (get 'defun 'common-lisp-indent-function))
                   path state indent-point sexp-column normal-indent))

-- 
Hannu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]