From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Madhu Newsgroups: gmane.emacs.devel Subject: lisp/emacs-lisp/cl-indent.el: prog indentation context Date: Sun, 27 Mar 2016 15:07:46 +0530 (IST) Message-ID: <20160327.150746.247564920.enometh@meer.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1459084126 30606 80.91.229.3 (27 Mar 2016 13:08:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Mar 2016 13:08:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 27 15:08:37 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1akAQm-0008I4-06 for ged-emacs-devel@m.gmane.org; Sun, 27 Mar 2016 15:08:36 +0200 Original-Received: from localhost ([::1]:35927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akAQl-0005pT-1i for ged-emacs-devel@m.gmane.org; Sun, 27 Mar 2016 09:08:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ak8AE-00045h-Tx for emacs-devel@gnu.org; Sun, 27 Mar 2016 06:43:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ak8AA-0005hS-Ri for emacs-devel@gnu.org; Sun, 27 Mar 2016 06:43:22 -0400 Original-Received: from smtp7.hungerhost.com ([64.64.27.93]:38648) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ak8AA-0005gz-Lx for emacs-devel@gnu.org; Sun, 27 Mar 2016 06:43:18 -0400 Original-Received: from [117.193.63.251] (port=48280 helo=localhost) by vps7.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.86_1) (envelope-from ) id 1ak78y-0005sQ-TG for emacs-devel@gnu.org; Sun, 27 Mar 2016 05:38:01 -0400 X-Mailer: Mew version 6.7 on Emacs 25.1.50 / Mule 6.0 (HANACHIRUSATO) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps7.hungerhost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - meer.net X-Get-Message-Sender-Via: vps7.hungerhost.com: authenticated_id: enometh@secure.meer.net X-Authenticated-Sender: vps7.hungerhost.com: enometh@secure.meer.net X-Source: X-Source-Args: X-Source-Dir: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 64.64.27.93 X-Mailman-Approved-At: Sun, 27 Mar 2016 09:08:21 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:202286 Archived-At: * lisp/emacs-lisp/cl-indent.el (lisp-indent-259): handle (&rest function) specs correctly. The appended patch kludges a bug that has existed forever, wherein prog forms were never indented correctly. (cf. final comment on prog in that file) (get 'prog 'common-lisp-indent-function) ;; => (&lambda &rest lisp-indent-tagbody) However lisp-indent-259 does not handle the &rest spec as expected: in the following example, it indents the 3rd element of the prog sexp with lisp-indent-tagbody, and the remaining elements (the tail) with normal-indent. ;; -*- Mode: Lisp; lisp-indent-function: common-lisp-indent-function; -*- ;; ..., so we get: (prog () nil (foo bar) nil (barf)) ;; instead of the expected: (prog () nil (foo bar) nil (barf)) This fix makes sure that if the item after `&rest' in the indentation spec is a symbol (indicating a function to be called), then we dont handle the tail as above (i.e. as normal-indent), but instead end up using the indicated function---Madhu --- a/lisp/emacs-lisp/cl-indent.el +++ b/lisp/emacs-lisp/cl-indent.el @@ -608,7 +608,9 @@ lisp-indent-259 normal-indent))) ((eq tem '&rest) ;; this pattern holds for all remaining forms - (setq tail (> n 0) + (setq tail (and (> n 0) + (not (and (symbolp (cadr method)) + (null (cddr method))))) n 0 method (cdr method))) ((> n 0)