- Subject: [jed-users] Re: JED - coding in S-lang
- From: Morten Bo Johansen <mbj@xxxxxxxxx>
- Date: Mon, 13 Dec 2021 14:02:58 +0100
Duke Normandin <dukeofpurl@xxxxxxx> wrote:
> Still at it ..
>
> Learning S-lang using Jed as my editor.
>
> Having problems with Jed rendering { .. } brackets.
> I want to write the following:
>
> variable data = {{1}, 2, {{3,4}, 5}, {{{}}}, {{{6}}}, 7, 8, {}}
>
> But Jed insists that the very first bracket is starting a block o
> What I want is to write a list.
> Is there a solution to this formatting issue? TIA
All right, I think I get it: The problem is when writing the
second left brace, then a "c_insert_bra" is triggered.
You may circumvent that by first writing
variable data = ;
and then move the editing point before the semicolon and then
write the construct. The presence of the semicolon will prevent
triggering the newline and indentation.
I have a fix for it in the attachment. I don't think there
should be any adverse effects of that?
Btw, the integer argument to the 'what_char' function is not
documented. I attach a patch for this also.
Morten
--- src/jed/lib/cmode.sl 2021-03-17 20:55:02.941536730 +0100
+++ /usr/local/stow/jed/jed/lib/cmode.sl 2021-12-13 13:13:34.534866560 +0100
@@ -1259,7 +1259,7 @@
variable ch = what_char (-1);
pop_spot ();
- if (any (ch == [',', '[', '=', '+', '-', '*', '/', '(']))
+ if (any (ch == [',', '[', '=', '+', '-', '*', '/', '(', '{']))
{
insert_char ('{');
return;
--- /home/mojo/src/jed/doc/tm/rtl/info.tm 2021-03-17 20:55:02.931536728 +0100
+++ /home/mojo/info.tm 2021-12-13 13:55:57.491017730 +0100
@@ -68,14 +68,16 @@
\done
\function{what_char}
-\synopsis{Return the ASCII-value of the character at the current position}
-\usage{ULong_Type what_char ()}
+\synopsis{Return the ASCII-value of the character at the current or nth adjacent position}
+\usage{ULong_Type what_char (n)}
\description
- The \var{what_char} function returns the value of the character at the
- current position as an unsigned long value. If UTF-8 mode is active
- and the current character is part of an illegal byte sequence, then
- the function returns a negative value equal in magnitude to the
- value of the byte.
+ The \var{what_char} function returns the value of the character at
+ the current position as an unsigned long value. With argument 'n'
+ being a positive or negative integer, it returns the value of the
+ character 'n' positions to the left ('-n') or right of the current
+ postion. If UTF-8 mode is active and the current character is part
+ of an illegal byte sequence, then the function returns a negative
+ value equal in magnitude to the value of the byte.
\example
#v+
while (not (eolp ()))
[2021 date index]
[2021 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]