Reproducing the error is a little tricky,
so this is to clarify how the error can be reproduced.

- My test file is at location "D:/Downloads/erlang_test.erl".
- From there I import this file with "File->Import Files->Import Any 
File...".
- In Leo I get a new node "Imported Files" with the subnode "@auto 
D:/Downloads/erlang_test.erl".
- In the subnode, I change "@auto" to "@file". 
- Then I press Ctrl+S to save the outline.
- This creates the "undefined section" error.

If I recreate an "@file D:/Downloads/erlang_test2.erl"" node manually and 
copy and paste the Erlang code from the first node into the body of this 
node and then save the outline, the ERROR DOES NOT OCCUR.

So what is happening when "@auto" is changed to "@file"?


On Monday, September 16, 2024 at 11:05:29 PM UTC+2 [email protected] wrote:

> I tried out the directive and it worked as desired for the sample erlang 
> file.  I specified that the section delimiters would be "[[[...]]]":
>
> @section-delims [[[ ]]]
>
> Edward may think of this as a hack today (as opposed to 20  years ago) but 
> there are good precedents: SQL statements that declare functions need to 
> escape the delimiters if they are to emit a legal SQL statement. SQL has 
> syntax to temporarily change the delimiters so this can be done. One common 
> use is that a ";" by default terminates an SQL statement.  So if you want 
> your function to create but not run this statement:
>
> SELECT 1;
>
> as soon as the processor came to the ";' it would execute the current 
> statement, which is wrong because you are just defining it to be used 
> later.  So:
>
> DELIMITER // -- Parser now looks for "//" to end the current statement
> SELECT 1;  -- The ";" is part of the statement that will be executed later.
> DELIMITER ; -- Return parser behavior to process ";" as usual.
>
> (I've left out other details needed to make this complete function 
> definition, just to make the point).
>
> Here is what the saved erlang @file looks like with the changed section 
> delimiters:
>
> %@+leo-ver=5-thin
> %@+node:tom.20240916163919.1: * @file c:\temp\erlang_name_sections.er
> %@@language erlang
> %@@section-delims [[[ ]]]
>
> %% ErlangTest
>
> -module(erlang_test).
>
> colourize_image(Alpha, {R,G,B}) ->
>     << <<R:8,G:8,B:8,A:8>> || <<A:8,_:8,_:8>> <= Alpha >>.
> %@+[[[ interleave_rgb ]]]
> %@+node:tom.20240916164123.1: ** [[[ interleave_rgb ]]]
> interleave_rgb_and_alpha(RGB, Alpha) ->
>     list_to_binary(
>       lists:zipwith(fun({R, G, B}, A) ->
>     <<R, G, B, A>>
> end,
>     [{R,G,B} || <<R, G, B>> <= RGB],
>     [A || <<A>> <= Alpha])).
> %@-[[[ interleave_rgb ]]]
> %@-leo
>
> So Leo can happily create @file erlang files even when the contain what 
> look like named sections, and you can use named sections within such a 
> file.  Nice work, Edward!
> On Monday, September 16, 2024 at 4:37:49 PM UTC-4 Thomas Passin wrote:
>
>> I didn't phrase that right but it doesn't matter because I just tested 
>> and found that the section reference will be found anywhere in a line.  
>> This agrees with the initial posting. And the sample erlang file has some 
>> "<<...>>" structures that are the first non-whitespace characters in their 
>> lines anyway.
>>
>> On Monday, September 16, 2024 at 2:50:00 PM UTC-4 Thomas Passin wrote:
>>
>>> The section marker has to be at the very left of the current indentation 
>>> level, doesn't it?
>>>
>>> On Monday, September 16, 2024 at 2:33:31 PM UTC-4 [email protected] 
>>> wrote:
>>>
>>>> Doesn't that kind of defeat the whole purpose of having an outliner?
>>>>
>>>> Strings of the pattern `<<some_token>>` occur with some frequency in 
>>>> bash scripts as well, for example:
>>>>
>>>> ```
>>>> log=/path/to/logfile.log
>>>> sftp [email protected]<<EOF>>$log
>>>>   mget *.txt
>>>>   bye
>>>> EOF
>>>> ```
>>>>
>>>> I admit, I did test that above snippet earlier, and it worked without 
>>>> issue both as a @file and an @edit, so I'm not certain what exactly is 
>>>> triggering this issue.  But I do think it's worthwhile to figure it out.
>>>>
>>>> Jake
>>>>
>>>> On Mon, Sep 16, 2024 at 2:11 PM Edward K. Ream <[email protected]> 
>>>> wrote:
>>>>
>>>>> On Mon, Sep 16, 2024 at 12:34 PM 'rengel' via leo-editor <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> So basically that means you can't reliably use Leo's @file nodes for 
>>>>>> Elixir adn Erlang source code?
>>>>>>
>>>>>
>>>>> Yes, that's what I'm saying. @edit will usually be better than @asis.
>>>>>
>>>>> Edward
>>>>>
>>>>> -- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "leo-editor" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/leo-editor/CAMF8tS24H1Vei-AgxJXNj23qV_ODYtPGGvxw1T9es32-k7wNWA%40mail.gmail.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/leo-editor/CAMF8tS24H1Vei-AgxJXNj23qV_ODYtPGGvxw1T9es32-k7wNWA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e3a84a23-a951-46d2-bf5d-e5cac2c9fd4en%40googlegroups.com.

Reply via email to