Subject: bug#1012 closed by martin rudalics <[email-masked]> (Re: bug#1012: calculate-lisp-indent)

From: [email-masked] (Emacs bug Tracking System)

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#1012: calculate-lisp-indent

It has been closed by martin rudalics <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact martin rudalics <[email-masked]> by
replying to this email.

-- 
1012: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1012
Emacs Bug Tracking System
Contact [email-masked] with problems
>From [email-masked] Wed Sep 24 01:23:21 2008
Date: Wed, 24 Sep 2008 10:16:33 +0200
From: martin rudalics <[email-masked]>
To: [email-masked]
CC: Markus Sauermann <[email-masked]>
Subject: Re: bug#1012: calculate-lisp-indent

Fixed as:

2008-09-23  Markus Sauermann <[email-masked]>  (tiny change)

	* emacs-lisp/emacslisp-mode.el (calculate-lisp-indent): Fix
	indentation problem with keyword symbols when a list starts with
	,@ or spaces.  (Bug#1012)

Thanks for the patch, martin

>From [email-masked] Sun Sep 21 10:37:37 2008
Date: Sun, 21 Sep 2008 19:37:20 +0200
From: Markus Sauermann <[email-masked]>
To: [email-masked]
Subject: calculate-lisp-indent

This is a multi-part message in MIME format.
--------------070203090003050805040103
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

Hello,

I found a bug concerning the function calculate-lisp-indent in lisp-mode.el.
It is triggered in the following scenarios (-!- marks the point):

---begin scenario 1 buffer *scratch*---
(,@foo
 :bar)-!-
---end scenario 1 buffer *scratch*---

---begin scenario 2 buffer *scratch*---
( foo
 :bar)-!-
---end scenario 2 buffer *scratch*---

Using <tab> (bound to the function lisp-indent-line) triggers the
following error in both scenarios:

---begin error---
forward-sexp: Scan error: "Containing expression ends prematurely", 192, 192
---end error---

I traced this bug to the function calculate-lisp-indent.

As far as I understand the code, the characters ",@" in scenario 1 and
the spaces in scenario 2 are not treated correctly.

In this E-Mail I included a patch, that solves the problems for me, and
was created with the command

mhoram@revelstone:~/emacs/trunk/emacs/lisp$ cvs diff -c >
~/emacs-bugreport.txt

The patch works for scenario 1 by an additional call of the
(backward-prefix-chars) function, which sets point back to the beginning
of ",@".
For scenario 2 the addition of "\\|([ \t]+" solves the problem, by not
entering the while-loop (and thus calling the function (forward-sexp
-1)), if there are only spaces between the "(" and the first object.

Regards,
Markus Sauermann

In GNU Emacs 22.3.1 (i386-mingw-nt6.0.6001)
 of 2008-09-06 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 6.0.6001
configured using `configure --with-gcc (3.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: DEU
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  encoded-kbd-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<help-echo> <help-echo> <help-echo> <help-echo> q (
, @ f o o <return> <tab> : b a r ) <tab> M-x r e p
o r t <tab> <return>

Recent messages:
("D:\\Uninstalled\\emacs-22.3\\bin\\emacs.exe" "-q")
Loading encoded-kb...done
For information about GNU Emacs and the GNU system, type C-h C-a.
forward-sexp: Scan error: "Containing expression ends prematurely", 192, 192
Loading emacsbug...
Loading regexp-opt...done
Loading emacsbug...done

-- 
Markus Sauermann      E-Mail: [email-masked]
Clemensstr. 55 Rgb.   Web: http://www.sauermann-consulting.de
80803 M�nchen         Tel: 089/337707, 0179/9879005, Fax: 089/38476434

--------------070203090003050805040103
Content-Type: text/plain;
 name="emacs-bugreport.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="emacs-bugreport.txt"

Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.14493
diff -c -r1.14493 ChangeLog
*** ChangeLog	20 Sep 2008 22:09:39 -0000	1.14493
--- ChangeLog	21 Sep 2008 17:08:59 -0000
***************
*** 1,3 ****
--- 1,9 ----
+ 2008-09-21  Markus Sauermann <[email-masked]>
+ 
+ 	* emacs-lisp/lisp-mode.el (calculate-lisp-indent):
+ 	Fix indentation problem with keyword symbols when a list starts
+ 	with ,@ or spaces.
+ 
  2008-09-20  Vincent Belaïche  <[email-masked]>
  
  	* calc/calc-vec.el (calcFunc-venum): Properly handle intervals.
Index: emacs-lisp/lisp-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/lisp-mode.el,v
retrieving revision 1.226
diff -c -r1.226 lisp-mode.el
*** emacs-lisp/lisp-mode.el	20 Sep 2008 21:54:44 -0000	1.226
--- emacs-lisp/lisp-mode.el	21 Sep 2008 17:09:04 -0000
***************
*** 1027,1033 ****
                       ;; 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)
--- 1027,1034 ----
                       ;; where it begins, so find that one, instead.
                       (save-excursion
                         (goto-char calculate-lisp-indent-last-sexp)
!                        (backward-prefix-chars)
!                        (while (and (not (looking-back "^[ \t]*\\|([ \t]+"))
                                     (or (not containing-sexp)
                                         (< (1+ containing-sexp) (point))))
                           (forward-sexp -1)

--------------070203090003050805040103--