ada-mode-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Ada mode 6.2.1: ada-indent-comment-col-0 no longer honored


From: SCHOEPFLIN Markus
Subject: RE: Ada mode 6.2.1: ada-indent-comment-col-0 no longer honored
Date: Tue, 19 Nov 2019 08:11:03 +0000

Resending to the list...

> From: Stephen Leake <address@hidden>
> > SCHOEPFLIN Markus <address@hidden> writes:
> 
> > In my .emacs I have " '(ada-indent-comment-col-0 t)",
> 
> I gather this is part of a "custom-set-variables" form.

Yes.

> ada-indent-comment-col-0 is buffer-local; does custom-set-variables
> handle that properly? (I tried reading the code in custom.el, and it's
> complicated; it seems to use set-default unless special conditions
> apply) It may be setting the value for the .emacs buffer only, or
> possibly only for the first ada-mode buffer created.
> 
> Try this instead in your .emacs:
> 
>     (set-default 'ada-indent-comment-col-0 t)
> 
> Also examine the value in the ada-mode buffer (M-x
> ada-indent-comment-col-0); is it t?

<CTRL>-h-v ada-indent-comment-col-0 gives:

---%<---
ada-indent-comment-col-0 is a variable defined in 'ada-indent-user-options.el'.
Its value is t
Original value was nil

  Automatically becomes buffer-local when set.
  This variable is safe as a file local variable if its value
  satisfies the predicate \u2018booleanp\u2019.

Documentation:
If non-nil, comments currently starting in column 0 are left in column 0.
Otherwise, they are indented with previous comments or code.

You can customize this variable.
--->%---

So the customization is applied correctly.

> 
> If that fixes the problem, then I should change all the buffer-local
> indent settings to be not custom variables. Keeping them custom makes
> them easier to discover.
> 
> If that doesn't fix the problem, something else is wrong.
> 
> You can look in the " *Ada_wisi_parse*" buffer (note the leading space
> in the name); the first line is the parse command sent to the background
> process, with lots of parameters for the indent settings. One of the
> values is either 0 or 1 for ada-indent-comment-col-0 nil or t. The line
> looks like either:
> 
> ;; parse 2 "ada_mode-options.ads" 1 918 918 1 1 33 0 0 0 -1 0 0 0 -1 -1 -1
> 15 917 3 2 0 0 -3 0 2 0 2 3 2 0 0
> ;; parse 2 "ada_mode-options.ads" 1 918 918 1 1 33 0 0 0 -1 0 0 0 -1 -1 -1
> 15 917 3 2 1 0 -3 0 2 0 2 3 2 0 0
> 
>    ada-indent-comment-col-0 ----------------------------------------------
> ------------^
> 
> (those lines will probably get messed up by the mail program).
> 
> Here the first line has nil, the second t. That should reflect the value
> in the buffer. (this line is built in the function
> wisi-process-parse--send-parse, which calls
> wisi-parse-format-language-options, which handles
> ada-indent-comment-col-0).

The line looks like this:

;; parse 2 "mms_env.adb" 1 6815 6815 1 1 184 0 0 0 -1 0 0 0 -1 -1 -1 15 6814 3 
2 1 0 -3 3 2 0 2 3 2 0 0

If I didn't mix up the columns, this means that the value of the option is 
correct.

> If that is correct, you've found a corner case in the indent algorithm;
> please post a reproducing source file.

Tried but failed. But then I noticed I can't even indent the most simple source 
file correctly (but it nevertheless works in principle for "real" source 
files). E.g.:

---%<---
procedure TEST is
X : INTEGER;
begin
X := 0;
end TEST;
--->%---

When I place the cursor at column 0 of line 2 (the declaration of X) and press 
<TAB>, I get the following output:

---%<---
;; parse 2 "test.adb" 1 56 56 1 1 6 0 0 0 -1 0 0 0 -1 -1 -1 15 55 3 2 1 0 -3 3 
2 0 2 3 2 0 0
(parse_error "test.adb:1:0: action raised exception CONSTRAINT_ERROR: 
wisi.adb:2120 range check failed")
;;> 
--->%---

When I place the cursor at the end of line 2 and press <TAB>, I get the 
following output, but nothing is indented.

---%<---
;; parse 1 "test.adb" 1 56 56 1 1 6 0 0 0 -1 0 0 0 -1 -1 -1 15 55 3 2 1 0 -3 3 
2 0 2 3 2 0 0
[8 56]
[2 11 14 1]
[2 23 29 2]
[2 43 43 0]
[2 50 53 1]
;;> 
--->%---

Seems like I have a more serious problem with Ada mode. Any idea where to start 
looking?

-- 
Markus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]