From: A Soare <alinsoar@voila.fr>
To: "Emacs Dev [emacs-devel]" <emacs-devel@gnu.org>
Cc: "Richard Stallman \[rms\]" <rms@gnu.org>
Subject: (no subject)
Date: Wed, 21 Feb 2007 23:31:52 +0100 (CET) [thread overview]
Message-ID: <22791079.78431172097112576.JavaMail.www@wwinf4104> (raw)
Here is the indentation rewriten, and taking into consideration all problems we have just talked about.
If there are some other new problems, please report.
Alin Soare
Index: emacs/lisp/emacs-lisp/lisp-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/lisp-mode.el,v
retrieving revision 1.199
diff -c -r1.199 lisp-mode.el
*** emacs/lisp/emacs-lisp/lisp-mode.el 17 Feb 2007 11:34:22 -0000 1.199
--- emacs/lisp/emacs-lisp/lisp-mode.el 21 Feb 2007 22:26:09 -0000
***************
*** 908,942 ****
(let ((normal-indent (current-column)))
(cond ((elt state 3)
;; Inside a string, don't change indentation.
! nil)
! ((save-excursion
! ;; test whether current line begins with a constant
! (goto-char indent-point)
! (skip-chars-forward " \t")
! (looking-at ":"))
! (let ((desired-indent
! (save-excursion
! (goto-char (1+ containing-sexp))
! (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
! (point)))
! (parse-sexp-ignore-comments t))
! ;; Align a constant symbol under the last constant symbol
! (goto-char calculate-lisp-indent-last-sexp)
! (while (> (point) desired-indent)
! (if (looking-at ":")
! (setq desired-indent (point))
! (backward-sexp 1))))
! (current-column))
((and (integerp lisp-indent-offset) containing-sexp)
;; Indent by constant offset
(goto-char containing-sexp)
(+ (current-column) lisp-indent-offset))
(desired-indent)
- ((and (boundp 'lisp-indent-function)
- lisp-indent-function
- (not retry))
- (or (funcall lisp-indent-function indent-point state)
- normal-indent))
(t
normal-indent))))))
--- 908,955 ----
(let ((normal-indent (current-column)))
(cond ((elt state 3)
;; Inside a string, don't change indentation.
! nil)
((and (integerp lisp-indent-offset) containing-sexp)
;; Indent by constant offset
(goto-char containing-sexp)
(+ (current-column) lisp-indent-offset))
+ ((save-excursion
+ ;; the car must be defined on the same line as the inner parenthesis.
+ ;; in this case calculate-lisp-indent-last-sexp is not nil.
+ (and containing-sexp
+ (goto-char (1+ containing-sexp))
+ (skip-chars-forward " \t")
+ (looking-at "\\sw\\|\\s_")))
+ (or
+ ;; try to align the parameters of a known function
+ (and (boundp 'lisp-indent-function)
+ lisp-indent-function
+ (not retry)
+ (funcall lisp-indent-function indent-point state))
+ ;; if not a standard function, try to align a constant-symbol
+ ;; under the last preceding constant symbol, if there is such one
+ ;; of the last 2 preceding symbols, in the previous uncommented
+ ;; line
+ (and (save-excursion
+ (goto-char indent-point)
+ (skip-chars-forward " \t")
+ (looking-at ":"))
+ (let ((parse-sexp-ignore-comments t)
+ indent)
+ (goto-char calculate-lisp-indent-last-sexp)
+ (if (looking-at ":")
+ (setq indent (current-column))
+ (when (and (> calculate-lisp-indent-last-sexp containing-sexp)
+ (< (save-excursion (beginning-of-line) (point))
+ (prog2 (backward-sexp) (point))))
+ (if (looking-at ":")
+ (setq indent (current-column)))))
+ indent))
+ ;; another symbols or constants not preceded by a constant
+ ;; as defined above.
+ normal-indent))
+ ;; in this case calculate-lisp-indent-last-sexp is nil
(desired-indent)
(t
normal-indent))))))
next reply other threads:[~2007-02-21 22:31 UTC|newest]
Thread overview: 111+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-21 22:31 A Soare [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-05-22 10:45 (No subject) slb zetrov
2020-05-22 19:25 ` Yuan Fu
2020-05-23 10:54 ` Michael Albinus
2016-12-28 7:34 [no subject] Chris Gregory
2010-10-16 4:59 (no subject) Richard Stallman
2010-10-16 6:08 ` Werner LEMBERG
2010-10-16 6:10 ` Werner LEMBERG
2010-10-18 6:26 ` Richard Stallman
2010-10-19 18:28 ` Glenn Morris
2010-09-30 8:02 Jambunathan K
2010-01-15 16:27 Drew Adams
2008-03-24 1:00 Xavier Maillard
2008-02-25 8:17 Herbert Euler
2007-04-18 20:21 A Soare
2007-04-19 16:03 ` Stefan Monnier
2007-03-21 11:04 A Soare
2006-12-21 6:55 Werner LEMBERG
2006-12-21 18:43 ` Kevin Rodgers
2006-12-28 14:17 ` Slawomir Nowaczyk
2006-09-02 18:08 Richard Stallman
2006-07-25 17:33 amcorreia
2006-06-26 12:54 amcorreia
2006-06-27 16:14 ` Richard Stallman
2006-06-02 3:14 Richard Stallman
2006-06-13 20:32 ` Chong Yidong
2006-03-07 23:39 Amir Bukhari
2005-10-28 12:20 Ahmadshah
2005-10-28 1:38 SHestbrooke
2005-10-22 11:30 Afrael
2005-10-02 2:11 Kajane
2005-09-25 9:42 Taneev
2005-09-15 9:32 Baron
2005-09-12 0:34 Stalina
2005-09-08 20:19 Alafir
2005-09-02 12:20 Alimgereiy
2005-08-31 10:14 David PONCE
2005-07-04 4:13 r.reichlin
2005-06-04 0:56 Luc Teirlinck
2005-05-31 19:49 uiuew_qqy
2005-05-21 5:00 Charity Donahue
2005-05-17 2:17 Kenichi Handa
2005-05-06 22:49 loot
2005-05-03 10:44 John Knottenbelt
[not found] <01c54b24$Blat.v2.4$0ddb2a20@zahav.net.il>
2005-04-28 11:00 ` Richard Stallman
2005-04-28 18:56 ` Eli Zaretskii
2005-04-29 10:14 ` Richard Stallman
2005-04-18 9:34 Felix Cohen
2005-04-17 22:15 jhigr
2005-04-11 20:55 weather
2005-03-02 2:26 Chong Yidong
2005-03-02 3:02 ` Luc Teirlinck
2005-01-16 16:55 Georgia Jaramillo
2005-01-16 1:10 vr
2005-01-08 0:06 tvpeq
2004-12-26 5:23 Hazel Whitaker
2004-12-21 10:40 Anna Nguyen
2004-12-08 6:49 Han Boetes
2004-12-08 13:17 ` Stefan Monnier
2004-12-08 13:31 ` Han Boetes
2004-12-03 13:33 Frank J. Hall
2004-12-02 17:43 perfect butts
2004-10-22 22:14 Luc Teirlinck
2004-10-22 1:45 Guerra
2004-10-20 5:35 Mcdermott
2004-10-14 19:23 Levi Miller
2004-10-14 19:23 Lilly Pryor
2004-10-14 19:23 Loretta Roe
2004-10-14 19:23 Isaiah Ham
2004-10-11 18:09 Eddy
2004-10-10 0:10 Drew Adams
2004-10-09 13:36 Becky Sorensen
2004-10-09 13:36 Dana Fisher
2004-10-09 13:36 Antoine Heard
2004-10-09 13:36 Tommie Bullock
2004-10-09 13:36 Carmen Hill
2004-10-08 15:19 May Dixon
2004-10-08 8:04 Geoffrey Spears
2004-10-03 22:36 Rogelio Lott
2004-10-01 21:32 Duane Dahl
2004-09-27 0:32 Luc Teirlinck
2004-09-27 14:53 ` Richard Stallman
2004-09-27 22:17 ` Luc Teirlinck
2004-08-06 10:59 Zane Cross
2004-05-27 11:34 Stephan Stahl
2004-05-14 4:42 Katrina Bliss
2004-05-04 6:54 Dhruva Krishnamurthy
2004-05-03 7:44 Nicole Delarosa
2004-04-17 16:03 Delores Bacon
2004-02-24 17:24 Alyson
2004-02-02 21:09 admail.direct
2004-02-01 5:52 Walden Teri
2004-01-31 0:56 Lutz Julianne
2003-11-17 2:05 Luc Teirlinck
2003-11-17 6:12 ` Jan D.
2003-09-18 22:40 george mbulu
[not found] <20030810000549.94627.qmail@web21310.mail.yahoo.com>
2003-08-11 12:53 ` Richard Stallman
2003-08-12 13:11 ` shuki_duv
2003-08-12 23:19 ` Miles Bader
[not found] ` <shuki_duv@yahoo.com>
2003-08-14 12:35 ` Thien-Thi Nguyen
2002-11-06 6:33 21.2.90 pretest, 21.3, 21.4 Eli Zaretskii
2002-11-06 12:40 ` Kim F. Storm
2002-11-07 8:08 ` (no subject) Kenichi Handa
2002-11-08 12:06 ` Richard Stallman
2002-09-09 15:53 Text mode menu wishlist Sacha Chua
2002-09-09 17:27 ` Alex Schroeder
2002-09-10 1:45 ` Sacha Chua
2002-09-10 7:41 ` Thien-Thi Nguyen
2002-09-10 7:48 ` Miles Bader
2002-09-10 8:35 ` (no subject) Thien-Thi Nguyen
2002-08-30 13:23 Dhruva Krishnamurthy
2002-08-10 17:16 Richard Stallman
2002-08-10 17:51 ` Simon Josefsson
2002-08-11 3:56 ` Richard Stallman
2002-07-25 3:29 Free Concert Tickets!
2002-05-02 19:37 laurent mpeti kabila
2002-02-23 16:11 ctext-pre-write-conversion barfs Tak Ota
2002-02-23 18:51 ` (no subject) Eli Zaretskii
2002-02-23 23:11 ` Tak Ota
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=22791079.78431172097112576.JavaMail.www@wwinf4104 \
--to=alinsoar@voila.fr \
--cc=emacs-devel@gnu.org \
--cc=rms@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).