unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: lenst@lysator.liu.se, emacs-devel@gnu.org
Subject: Re: Bug in lisp indentation
Date: Sat, 14 Jul 2007 22:46:39 +0200	[thread overview]
Message-ID: <87abtyems0.fsf@ambire.localdomain> (raw)
In-Reply-To: <jwv1wfan49q.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat\, 14 Jul 2007 16\:04\:18 -0400")

() Stefan Monnier <monnier@iro.umontreal.ca>
() Sat, 14 Jul 2007 16:04:18 -0400

   That's wrong when you have things like

          (sdfgsdg dfgsd
                   asfgasfg) (dfg)
        <TAB>sfgsfg

   You want something along the lines of

      (while (not (at-indentation-p)) (forward-sexp -1))

indeed.  i've reworked the adjustment to be more specific.
below is try #3.  it does not address the case above, however
it does not change the current behavior for it, either.

	* emacs-lisp/lisp-mode.el (calculate-lisp-indent):
	In the case of constant symbol alignment, consider the
	sexp actually at indentation to be the "last sexp".

thi


______________________________________________________
diff -c -r1.202 lisp-mode.el
*** lisp-mode.el	6 Jul 2007 17:26:29 -0000	1.202
--- lisp-mode.el	14 Jul 2007 20:38:40 -0000
***************
*** 930,935 ****
--- 930,945 ----
                         (goto-char indent-point)
                         (skip-chars-forward " \t")
                         (looking-at ":"))
+                      ;; The last sexp may not be the first sexp on the line
+                      ;; where it begins, so find that one, instead.
+                      (save-excursion
+                        (goto-char calculate-lisp-indent-last-sexp)
+                        (while (and (not (looking-back "^[ \t]*"))
+                                    (or (not containing-sexp)
+                                        (< (1+ containing-sexp) (point))))
+                          (forward-sexp -1)
+                          (backward-prefix-chars))
+                        (setq calculate-lisp-indent-last-sexp (point)))
                       (> calculate-lisp-indent-last-sexp
                          (save-excursion
                            (goto-char (1+ containing-sexp))

  reply	other threads:[~2007-07-14 20:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-14 18:00 [lenst@lysator.liu.se: Bug in lisp indentation] Richard Stallman
2007-07-14 19:53 ` Bug in lisp indentation Thien-Thi Nguyen
2007-07-14 20:04   ` Stefan Monnier
2007-07-14 20:46     ` Thien-Thi Nguyen [this message]
2007-07-15 14:43   ` Lennart Staflin
2007-07-15 17:23     ` Thien-Thi Nguyen
2007-07-16 14:04       ` Lennart Staflin
2007-07-16 14:59         ` Thien-Thi Nguyen
2007-07-14 20:06 ` Thien-Thi Nguyen
2007-07-16  1:49 ` Fwd: " Stefan Monnier
2007-07-17  3:34   ` Richard Stallman
2007-07-17  8:27     ` David Kastrup
2007-07-17 17:00       ` Stefan Monnier
2007-07-18  4:42       ` Richard Stallman
2007-07-18 18:49         ` Stefan Monnier
2007-07-20 13:42           ` Richard Stallman

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=87abtyems0.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=emacs-devel@gnu.org \
    --cc=lenst@lysator.liu.se \
    --cc=monnier@iro.umontreal.ca \
    /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).