Subject: Re: bug#26619: 26.0.50; Wrong indentation in emacs-lisp-mode

From: Michael Heerdegen <[email-masked]>
Date: Thu, 27 Apr 2017 13:52:15 +0200

[email-masked] writes:

> Um, right, I didn't test that patch properly, it doesn't work at all.
> Here's a fix for it, cumulative diff also attached.

Thanks.

Here is a recipe of a problem with that new patch: I have this code:

#+begin_src emacs-lisp
(defun el-search--split (matcher1 matcher2 list)
  "Helper for the \"append\" pattern type.

When a splitting of LIST into two lists L1, L2 exist so that Li
is matched by MATCHERi, return (L1 L2) for such Li, else return
nil."
  (let ((try-match (lambda (list1 list2)
                     (when (and (el-search--match-p matcher1 list1)
                                (el-search--match-p matcher2 list2))
                       (list list1 list2))))
        (list1 list) (list2 '()) (match nil))
    ;; don't use recursion, this could hit `max-lisp-eval-depth'
    (while (and (not (setq match (funcall try-match list1 list2)))
                (consp list1))
      (let ((last-list1 (last list1)))
        (if-let ((cdr-last-list1 (cdr last-list1)))
            ;; list1 is a dotted list.  Then list2 must be empty.
            (progn (setcdr last-list1 nil)
                   (setq list2 cdr-last-list1))
          (setq list1 (butlast list1 1)
                list2 (cons (car last-list1) list2)))))
    match))
#+end_src

I mark the region between the forth line of the defun's body, with point
at the open paren of "(list list1 list2)", and the end of the defun.
Hitting C-M-\ results in all but the first line of the region given an
indentation of zero.

TIA,

Michael.