unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: lenst@lysator.liu.se
Cc: emacs-devel@gnu.org
Subject: Re: Bug in lisp indentation
Date: Sat, 14 Jul 2007 21:53:18 +0200	[thread overview]
Message-ID: <87myxyep8x.fsf@ambire.localdomain> (raw)
In-Reply-To: <E1I9luf-0006vC-LO@fencepost.gnu.org> (Richard Stallman's message of "Sat\, 14 Jul 2007 14\:00\:13 -0400")

() Lennart Staflin <lenst@lysator.liu.se>
() Thu, 31 May 2007 11:44:46 +0200

   In lisp-mode the indentation of the following expression is wrong:

   (foo
   :bar :a12
   :sie sume )

   If I press TAB at the beginning of the last line I get:

   (foo
   :bar :a12
         :sie sume )

   I think this is wrong, the indentation should be as the first example.
   This was not the behaviour in emacs 21, neither is the beaviour of
   indent-region consistent with TAB.

does the following patch give good results?
here is a description of the change:

        * emacs-lisp/lisp-mode.el (calculate-lisp-indent): Use the
        last sexp that begins a line, instead of the truly last sexp.

can someone suggest a better implementation?

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 19:48:07 -0000
***************
*** 854,859 ****
--- 854,866 ----
                    (> (setq paren-depth (elt state 0)) 0))
          (setq retry nil)
          (setq calculate-lisp-indent-last-sexp (elt state 2))
+         ;; The last sexp may not be the first sexp on the line
+         ;; where it begins, so find that one, instead.
+         (when calculate-lisp-indent-last-sexp
+           (goto-char calculate-lisp-indent-last-sexp)
+           (beginning-of-line)
+           (skip-chars-forward " \t")
+           (setq calculate-lisp-indent-last-sexp (point)))
          (setq containing-sexp (elt state 1))
          ;; Position following last unclosed open.
          (goto-char (1+ containing-sexp))

  reply	other threads:[~2007-07-14 19:53 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 ` Thien-Thi Nguyen [this message]
2007-07-14 20:04   ` Bug in lisp indentation Stefan Monnier
2007-07-14 20:46     ` Thien-Thi Nguyen
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=87myxyep8x.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=emacs-devel@gnu.org \
    --cc=lenst@lysator.liu.se \
    /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).