From: Madhu <enometh@meer.net>
To: emacs-devel@gnu.org
Subject: lisp/emacs-lisp/cl-indent.el: prog indentation context
Date: Sun, 27 Mar 2016 15:07:46 +0530 (IST) [thread overview]
Message-ID: <20160327.150746.247564920.enometh@meer.net> (raw)
* 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)
reply other threads:[~2016-03-27 9:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20160327.150746.247564920.enometh@meer.net \
--to=enometh@meer.net \
--cc=emacs-devel@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.