unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1012: calculate-lisp-indent
@ 2008-09-21 17:37 Markus Sauermann
  0 siblings, 0 replies; 7+ messages in thread
From: Markus Sauermann @ 2008-09-21 17:37 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2912 bytes --]

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: info@sauermann-consulting.de
Clemensstr. 55 Rgb.   Web: http://www.sauermann-consulting.de
80803 München         Tel: 089/337707, 0179/9879005, Fax: 089/38476434


[-- Attachment #2: emacs-bugreport.txt --]
[-- Type: text/plain, Size: 2011 bytes --]

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 <markus@sauermann-consulting.de>
+ 
+ 	* 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  <vincent.b.1@hotmail.fr>
  
  	* 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)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#1012: calculate-lisp-indent
@ 2008-09-23  7:07 martin rudalics
  2015-12-30  1:19 ` Andrew Hyatt
  0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics @ 2008-09-23  7:07 UTC (permalink / raw)
  To: 1012; +Cc: Markus Sauermann

 > 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.

Thank you, applied.

martin






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#1012: calculate-lisp-indent
  2008-09-23  7:07 bug#1012: calculate-lisp-indent martin rudalics
@ 2015-12-30  1:19 ` Andrew Hyatt
  2015-12-30  7:27   ` martin rudalics
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Hyatt @ 2015-12-30  1:19 UTC (permalink / raw)
  To: martin rudalics; +Cc: 1012, Markus Sauermann


martin rudalics <rudalics@gmx.at> writes:

>> 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.
>
> Thank you, applied.
>
> martin

This bug is still marked open, but I can't reproduce either of the
reported issues against Emacs 25. Can either of you still reproduce the
issue? If not, I'll close the bug.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#1012: calculate-lisp-indent
  2015-12-30  1:19 ` Andrew Hyatt
@ 2015-12-30  7:27   ` martin rudalics
  2015-12-30 10:58     ` Markus Sauermann
  0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics @ 2015-12-30  7:27 UTC (permalink / raw)
  To: Andrew Hyatt; +Cc: 1012, Markus Sauermann

 > This bug is still marked open, but I can't reproduce either of the
 > reported issues against Emacs 25. Can either of you still reproduce the
 > issue?

Did you look into the snippets from Example 2 and Example 3 in the
follow-up message?  All issues reported by Markus still apply, at least
here.  Unfortunately, I rarely indent constant symbols, so someone else
would have had to chime in.  But I suppose nobody really cared.

Note also that the second patch is probably too large to qualify as a
tiny change and I have no idea whether Markus is still around to do the
paperwork.

martin





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#1012: calculate-lisp-indent
  2015-12-30  7:27   ` martin rudalics
@ 2015-12-30 10:58     ` Markus Sauermann
  2015-12-30 11:20       ` martin rudalics
  2016-01-02 21:34       ` Andrew Hyatt
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Sauermann @ 2015-12-30 10:58 UTC (permalink / raw)
  To: martin rudalics; +Cc: 1012

Hi,

Am 30.12.2015 um 08:27 schrieb martin rudalics:
> Did you look into the snippets from Example 2 and Example 3 in the
> follow-up message?  All issues reported by Markus still apply, at least
> here.  Unfortunately, I rarely indent constant symbols, so someone else
> would have had to chime in.  But I suppose nobody really cared.
> 
> Note also that the second patch is probably too large to qualify as a
> tiny change and I have no idea whether Markus is still around to do the
> paperwork.

still around and still using emacs, but I haven't experienced this issue
during the last 7 years. So I am not very inclined to review my old
patches. Sorry.

Best wishes
Markus





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#1012: calculate-lisp-indent
  2015-12-30 10:58     ` Markus Sauermann
@ 2015-12-30 11:20       ` martin rudalics
  2016-01-02 21:34       ` Andrew Hyatt
  1 sibling, 0 replies; 7+ messages in thread
From: martin rudalics @ 2015-12-30 11:20 UTC (permalink / raw)
  To: Markus Sauermann; +Cc: 1012-done

 > still around and still using emacs,

That's nice to hear.

 > but I haven't experienced this issue
 > during the last 7 years. So I am not very inclined to review my old
 > patches. Sorry.

I close the bug then.  Whenever you feel an urge to work on this again,
please reopen it.

Thanks, martin





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#1012: calculate-lisp-indent
  2015-12-30 10:58     ` Markus Sauermann
  2015-12-30 11:20       ` martin rudalics
@ 2016-01-02 21:34       ` Andrew Hyatt
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Hyatt @ 2016-01-02 21:34 UTC (permalink / raw)
  To: Markus Sauermann; +Cc: 1012


Markus Sauermann <markus@sauermann-consulting.de> writes:

> Hi,
>
> Am 30.12.2015 um 08:27 schrieb martin rudalics:
>> Did you look into the snippets from Example 2 and Example 3 in the
>> follow-up message?  All issues reported by Markus still apply, at least
>> here.  Unfortunately, I rarely indent constant symbols, so someone else
>> would have had to chime in.  But I suppose nobody really cared.
>> 
>> Note also that the second patch is probably too large to qualify as a
>> tiny change and I have no idea whether Markus is still around to do the
>> paperwork.
>
> still around and still using emacs, but I haven't experienced this issue
> during the last 7 years. So I am not very inclined to review my old
> patches. Sorry.
>
> Best wishes
> Markus

Thanks for the update.  Martin, the original bug was fairly serious - an
error while trying to indent.  Unless I misunderstand, the followup
issues reported were issues of not indenting "properly", which are much
less serious.  Also, I'm not clear as to what should be a bug here - is
there some documentation on how the lisp indenting should work, so that
we know how things should ideally indent?

In any case, the original bug seems to be fixed.  Martin, if you have
issues with lisp indenting style, it probably would be best to create a
separate bug on it.  I'll mark this one as fixed in the meantime.
Thanks, everyone!





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-01-02 21:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23  7:07 bug#1012: calculate-lisp-indent martin rudalics
2015-12-30  1:19 ` Andrew Hyatt
2015-12-30  7:27   ` martin rudalics
2015-12-30 10:58     ` Markus Sauermann
2015-12-30 11:20       ` martin rudalics
2016-01-02 21:34       ` Andrew Hyatt
  -- strict thread matches above, loose matches on Subject: below --
2008-09-21 17:37 Markus Sauermann

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).