WEBVTT

NOTE Introduction

00:00:11.563 --> 00:00:18.365
Hello, this is a talk about prefix tab groups

00:00:18.506 --> 00:00:22.647
and the subtitle for this talk is:

00:00:23.027 --> 00:00:26.669
A way to write a symex as a block

00:00:26.769 --> 00:00:30.000
of prefixed lines.

00:00:30.149 --> 00:00:35.334
I'm Marco, gaa in the #emacsconf channel,

00:00:35.374 --> 00:00:36.375
if you have any questions.

00:00:37.316 --> 00:00:41.419
And there is also a webpage for this project.

00:00:43.041 --> 00:00:48.665
It's on https://gitlab.com/marcowahl/prefix-tab-groups.

00:00:49.927 --> 00:00:52.229
And the content of this talk is...

00:00:54.050 --> 00:00:57.472
Number one, introduction to the prefix tab groups.

00:00:58.513 --> 00:01:05.897
Second, use Emacs tools or Emacs with the prefix

00:01:05.957 --> 00:01:06.598
tab groups.

00:01:07.018 --> 00:01:11.300
And third, Lisp and prefix tab groups.

00:01:12.221 --> 00:01:13.902
So let's start.

NOTE Ignition

00:01:16.550 --> 00:01:20.432
I'll talk about the evolution and this is also an

00:01:20.912 --> 00:01:23.673
introduction to the prefix tab groups.

00:01:24.694 --> 00:01:26.374
So the ignition was like this.

00:01:27.995 --> 00:01:31.597
"Grouping with parens is enough."

00:01:32.477 --> 00:01:41.241
Somewhere, somewhen in the internet, in a

00:01:41.281 --> 00:01:43.222
discussion about text structuring,

00:01:44.357 --> 00:01:47.218
And somehow this resonated with me.

00:01:47.958 --> 00:01:52.820
So I tried, but using literal parens, opening

00:01:52.880 --> 00:01:54.461
and closing parens for grouping?

00:01:55.121 --> 00:01:55.841
No.

00:01:56.821 --> 00:02:00.863
Not for me, because I want opening and closing

00:02:00.963 --> 00:02:02.584
parens in my texts.

00:02:03.624 --> 00:02:06.025
And something nicer visually.

00:02:07.565 --> 00:02:11.307
And then the idea was to use a prefix for

00:02:11.627 --> 00:02:12.127
grouping.

00:02:14.792 --> 00:02:21.518
So the beginning was, generation 1, G1, was to

00:02:21.658 --> 00:02:28.023
use purely tab, the tab character, as prefix for

00:02:28.063 --> 00:02:32.567
grouping and consecutive lines with the same

00:02:32.607 --> 00:02:34.228
prefix define a group.

00:02:35.369 --> 00:02:36.630
That's the simple idea.

00:02:38.271 --> 00:02:41.074
And I want to give an example

00:02:42.833 --> 00:02:45.196
how to define groups like that.

00:02:45.896 --> 00:02:46.717
A little demo.

00:02:48.219 --> 00:02:52.483
And in particular, it shall show how to deal with

00:02:52.804 --> 00:02:54.145
sibling groups.

00:02:55.206 --> 00:03:02.194
So let's dive into the extra buffer.

NOTE Demo

00:03:03.135 --> 00:03:09.318
So let's say you have elements A and B, or lines

00:03:09.578 --> 00:03:13.380
with characters A and B, and you want to make a

00:03:13.440 --> 00:03:14.620
group out of it.

00:03:15.120 --> 00:03:18.342
Then with generation one, it would be just put a

00:03:18.782 --> 00:03:24.145
tab in front of each line and the consecutive

00:03:24.245 --> 00:03:29.230
lines here would define the first group.

00:03:29.951 --> 00:03:35.333
Then you could leave the next line blank.

00:03:35.773 --> 00:03:45.536
And define another group in the fourth line, here with element C.

00:03:46.648 --> 00:03:50.831
I can visualize the tabs for clarity.

00:04:00.000 --> 00:04:03.000
You see here an underscore for each tab.

00:04:07.577 --> 00:04:11.419
To make the tabs visible more easily or visible

00:04:11.700 --> 00:04:12.060
at all.

00:04:12.420 --> 00:04:14.661
So and here we have the situation we have the

00:04:14.721 --> 00:04:16.523
first group here with A and B.

00:04:17.567 --> 00:04:19.689
And then the second group, the sibling group with

00:04:19.769 --> 00:04:20.449
a C here.

00:04:21.409 --> 00:04:25.691
And you could combine these groups into one group

00:04:26.051 --> 00:04:29.612
if you would make out of this blank line, a line

00:04:29.712 --> 00:04:31.733
with just a tab.

00:04:32.833 --> 00:04:37.855
So then these four lines would be one group.

00:04:38.736 --> 00:04:43.597
So this means...let's go back to the slide.

00:04:55.938 --> 00:05:04.201
Okay, let's go back to the slide and remember

00:05:04.742 --> 00:05:09.684
that trailing whitespace matters with this notation.

00:05:11.585 --> 00:05:18.887
Alright, let's go on to see the evolution.

NOTE Progress

00:05:20.973 --> 00:05:26.437
We have seen generation 1 tab only use.  Is okay

00:05:26.637 --> 00:05:31.200
for me, but these extra lines to group siblings

00:05:31.780 --> 00:05:35.462
is a but.

00:05:35.703 --> 00:05:42.407
Generation 2 emerged and I used an extra character,

00:05:43.805 --> 00:05:46.366
concretely, shift-in (ASCII 15)

00:05:47.486 --> 00:05:52.587
--visualized like this in Emacs normally--

00:05:52.667 --> 00:05:55.348
as group opener.

00:05:55.668 --> 00:06:00.309
And further, I changed the appearance of this

00:06:00.749 --> 00:06:03.390
shift-in character to dot-tab in Emacs.

00:06:04.230 --> 00:06:06.070
And the result was quite nice.

00:06:06.230 --> 00:06:11.632
No more need of these extra blank lines to

00:06:11.692 --> 00:06:13.072
separate siblings.

00:06:14.673 --> 00:06:20.036
But the shift-in character remained alien

00:06:20.037 --> 00:06:20.758
all the time.

00:06:21.238 --> 00:06:25.461
For example, if you want to email a file with

00:06:25.701 --> 00:06:30.525
these characters in it, this might irritate the

00:06:30.565 --> 00:06:31.126
receiver.

NOTE Generation 3

00:06:31.846 --> 00:06:37.851
So generation 3 came up and it was just a little

00:06:37.891 --> 00:06:38.251
step.

00:06:38.551 --> 00:06:42.775
It was the idea to literally use the dot-tab as

00:06:43.075 --> 00:06:44.356
opener directly.

00:06:45.236 --> 00:06:47.578
And this is quite okay.

00:06:47.879 --> 00:06:49.920
This is what I use now.

00:06:50.220 --> 00:06:54.504
And it also opens the door to group categories.

00:06:55.365 --> 00:07:00.834
So you can not just use the dot character in the

00:07:00.914 --> 00:07:03.318
opener, but you can use any character.

00:07:04.300 --> 00:07:07.365
And we will see examples later.

NOTE Intermediate consolidation

00:07:09.951 --> 00:07:12.793
All right, this has been the main part of the

00:07:12.853 --> 00:07:15.956
talk and let's consolidate, intermediate

00:07:15.996 --> 00:07:16.977
consolidation.

00:07:17.057 --> 00:07:20.820
You know prefix tab groups now and the format is

00:07:20.980 --> 00:07:22.061
independent of Emacs.

00:07:22.081 --> 00:07:23.822
You could use any editor.

00:07:24.643 --> 00:07:27.545
I use generation 3 and occasionally still

00:07:27.666 --> 00:07:32.550
generation 1 for writing notes, a journal, and

00:07:32.610 --> 00:07:35.172
also to code, for example, in my init.

00:07:36.533 --> 00:07:40.516
file init.el, pel, we will see later.

00:07:40.676 --> 00:07:43.758
This is then ptg-elisp.

00:07:44.039 --> 00:07:46.801
And I have also, for example, a mini task system.

00:07:46.881 --> 00:07:50.604
I use the openers backslash and x, backslash for

00:07:50.724 --> 00:07:55.568
an open task and x for a closed task.

00:07:56.248 --> 00:07:57.768
And of course it is also

00:07:57.769 --> 00:08:01.052
a presentation tool for EmacsConf.

NOTE prefix-tab-groups and tools in Emacs

00:08:01.953 --> 00:08:04.715
So now let's come to the tools.

00:08:07.350 --> 00:08:14.035
How Emacs can help with the ptg-world and one

00:08:14.436 --> 00:08:17.838
feature stands out, I think.

00:08:17.958 --> 00:08:20.580
That's the focus and I'll talk a little

00:08:20.620 --> 00:08:21.381
bit about that.

00:08:21.461 --> 00:08:24.822
Concentrate on a subgroup that is focused

00:08:24.823 --> 00:08:27.164
and there are many other tools

00:08:27.165 --> 00:08:31.288
and I'll give you some of them.

00:08:31.849 --> 00:08:32.909
I'll list some of them.

NOTE Focus

00:08:34.054 --> 00:08:38.138
So first let's focus on the focus.

00:08:39.899 --> 00:08:41.679
And how do you do it?

00:08:41.720 --> 00:08:42.740
How do you activate it?

00:08:43.301 --> 00:08:50.445
If you have a group that you want to focus to,

00:08:50.645 --> 00:08:54.268
you place the cursor in the prefix that defines

00:08:55.088 --> 00:08:56.549
that group of interest.

00:08:56.609 --> 00:08:57.870
So for example here.

00:08:58.713 --> 00:09:03.456
And then you call the command to focus and there

00:09:03.476 --> 00:09:05.797
will be focus on that group and the effect.

00:09:06.057 --> 00:09:07.718
And what is the focus actually?

00:09:08.278 --> 00:09:11.980
It blends out the lines above and below the group.

00:09:12.380 --> 00:09:15.862
And it also blends out the prefix.

00:09:16.903 --> 00:09:21.305
So there is command `ptg-edit-focus` for that.

00:09:21.986 --> 00:09:24.867
And it uses an extra buffer and the features are

00:09:27.070 --> 00:09:28.711
Edit and save.

00:09:31.433 --> 00:09:33.833
And you can always deepen the focus

00:09:33.834 --> 00:09:35.776
in the focus buffer.

00:09:36.456 --> 00:09:40.258
And you can always go one level up and go back to

00:09:40.298 --> 00:09:41.299
the original buffer.

00:09:41.799 --> 00:09:46.702
And to demonstrate, I will focus now here on the

00:09:46.742 --> 00:09:49.264
features subgroup right here.

00:09:50.829 --> 00:09:53.451
I activate the focus

00:09:53.452 --> 00:09:57.776
and you now have the focused view.

00:09:57.816 --> 00:10:03.442
You can go even deeper and up again and one level

00:10:03.582 --> 00:10:05.403
up and you can always go back

00:10:05.404 --> 00:10:07.586
to the original buffer.

00:10:07.646 --> 00:10:09.788
I use this focus all the time.

NOTE Further features in Emacs

00:10:11.077 --> 00:10:17.465
So let's see what we have also here in Emacs.

00:10:18.046 --> 00:10:20.269
`set-selective-display`.

00:10:21.951 --> 00:10:23.874
Let's have a look what this is.

00:10:23.914 --> 00:10:26.177
This is a very old feature of Emacs.

00:10:27.270 --> 00:10:31.073
It blends out lines having a certain indent.

00:10:32.294 --> 00:10:38.318
So this is good to get an overview and it fits

00:10:38.579 --> 00:10:41.501
quite nicely to the prefix tab groups.

00:10:43.689 --> 00:10:46.332
But on the other hand, to be honest, sometimes it

00:10:46.392 --> 00:10:48.334
feels a bit quirky.

00:10:48.454 --> 00:10:50.276
It has its quirks.

00:10:51.036 --> 00:10:53.919
If you work with it, you will notice.

00:10:54.500 --> 00:10:57.643
But actually it's good enough for me now.

00:10:58.564 --> 00:11:01.867
So I have no real need for something else.

00:11:04.669 --> 00:11:05.350
I use that.

00:11:05.950 --> 00:11:10.554
And then there is `x-stretch-cursor`.

00:11:10.634 --> 00:11:16.018
This gives this view of the tab as you can see it

00:11:16.058 --> 00:11:19.040
here in the cursor, the big cursor on the tab.

00:11:19.200 --> 00:11:23.704
And whitespace-mode maybe you know to display white

00:11:23.744 --> 00:11:25.946
space somehow readable.

00:11:26.726 --> 00:11:29.248
And you can play with tab width,

00:11:30.689 --> 00:11:34.612
make it bigger or smaller. And notice that return

00:11:34.672 --> 00:11:37.854
automatically inserts indent in the next line.

00:11:38.014 --> 00:11:42.397
`indent-tabs-mode` can be configured to make sure

00:11:42.457 --> 00:11:45.439
to use tabs if Emacs indents something.

00:11:46.608 --> 00:11:50.709
Back to indentation is quite nice. You can use

00:11:50.809 --> 00:11:54.331
it to go to the first non-whitespace character in

00:11:54.391 --> 00:11:54.751
a line.

00:11:55.291 --> 00:11:59.032
And if you have big lines, you can use the visual

00:11:59.092 --> 00:12:01.873
line mode and visual wrap prefix mode.

00:12:02.013 --> 00:12:07.775
You can really get beautiful views of long lines.

NOTE Further self-made tools

00:12:09.035 --> 00:12:13.557
So, okay, there are a few

00:12:15.118 --> 00:12:18.980
self-made tools which are quite naturally for the

00:12:19.120 --> 00:12:20.141
prefix tab groups.

00:12:20.221 --> 00:12:22.982
Jump to beginning end of a group, mark a group,

00:12:23.542 --> 00:12:27.524
create, decay a group, tabify, untabify a region.

00:12:28.085 --> 00:12:31.486
It's not a big deal but it's good to know that

00:12:31.566 --> 00:12:32.767
they are there.

NOTE prefix-tab-groups and Lisp

00:12:33.907 --> 00:12:39.429
So let's go to the Lisp part of this talk, Prefix

00:12:39.469 --> 00:12:40.789
Tab Groups and Lisp.

00:12:41.849 --> 00:12:47.111
And you can first notice Prefix Tab Groups as

00:12:47.151 --> 00:12:52.452
syntax for Lisp is quite natural since ptg is

00:12:52.712 --> 00:12:54.013
like symex.

00:12:54.133 --> 00:12:55.632
For example, if you have this

00:12:55.633 --> 00:12:57.274
Prefix Tab Group here,

00:12:58.606 --> 00:13:01.168
It's just a group with the elements a, b and it

00:13:01.228 --> 00:13:06.153
can be interpreted as the symex which is the list

00:13:06.233 --> 00:13:07.474
with a and b.

00:13:08.174 --> 00:13:14.500
And a somewhat more complicated example here have

00:13:15.100 --> 00:13:17.602
a group with two elements.

00:13:18.423 --> 00:13:21.126
First one is again a list so it's kind of

00:13:21.166 --> 00:13:25.490
recursive and in the next line you have this C

00:13:26.571 --> 00:13:31.175
element and this can then be interpreted as the

00:13:31.215 --> 00:13:32.556
symex here.

00:13:33.097 --> 00:13:35.739
So you have two elements the symex with the

00:13:35.799 --> 00:13:38.982
elements A and B and the element C.

00:13:42.018 --> 00:13:44.161
By the way, if you are interested in the term

00:13:44.461 --> 00:13:47.405
symex, where it comes from, it comes from here:

00:13:47.445 --> 00:13:56.135
github.com/drym-org/symex.el

00:13:57.037 --> 00:14:00.841
Might be worth a visit.

NOTE ptg-elisp

00:14:01.882 --> 00:14:06.044
So let's come to ptg-elisp.

00:14:06.144 --> 00:14:08.125
There is ptg-elisp now.

00:14:10.466 --> 00:14:14.868
And let's have a look.

00:14:16.168 --> 00:14:20.170
We want a function hello-emacsconf,

00:14:20.530 --> 00:14:23.691
write it in ptg-elisp.

00:14:25.510 --> 00:14:29.075
Let's focus on this function and I can show you.

00:14:32.559 --> 00:14:34.981
We will go through it line by line.

00:14:35.062 --> 00:14:39.907
First we define the function with a name and

00:14:41.955 --> 00:14:48.441
the second line here is just a prefix with

00:14:48.481 --> 00:14:53.585
nothing else and this stands for the empty list

00:14:53.826 --> 00:14:54.546
or nil.

00:14:57.309 --> 00:15:00.752
This is the ptg version of nil.

00:15:01.993 --> 00:15:04.355
And here we have some syntactic sugar.

00:15:04.775 --> 00:15:07.438
We have a group that starts with a double quote.

00:15:08.218 --> 00:15:12.001
And this is the documentation string, two lines,

00:15:12.121 --> 00:15:15.924
"message a hello, precisely say hello EmacsConf."

00:15:17.085 --> 00:15:19.846
And this is kind of syntax sugar.

00:15:21.087 --> 00:15:24.348
And next one is the call to interactive.

00:15:24.648 --> 00:15:27.510
And this is plain old elisp.

00:15:27.910 --> 00:15:32.732
And you can see that you are able to use plain

00:15:32.872 --> 00:15:35.213
old elisp also in ptg-elisp.

00:15:35.433 --> 00:15:39.935
Might be useful sometimes or give some safety.

00:15:40.735 --> 00:15:45.818
And again a little sugar thing: semicolon group,

00:15:45.878 --> 00:15:47.999
means this is a comment here.

00:15:49.560 --> 00:15:53.282
So: "note: this function is rather artificial" is the

00:15:53.843 --> 00:15:55.904
comment here, artificial comment.

00:15:57.345 --> 00:16:01.467
And here we have the actual call to the message

00:16:01.547 --> 00:16:07.711
function and we want it should give out the

00:16:07.751 --> 00:16:08.171
string.

00:16:09.972 --> 00:16:15.193
Let's evaluate this function and try it out.

00:16:15.613 --> 00:16:18.294
I evaluate this, I call this function and you can

00:16:18.334 --> 00:16:22.995
see in the mini-buffer at the bottom the expected

00:16:23.355 --> 00:16:23.835
message.

00:16:24.575 --> 00:16:31.237
So this is kind of proof that you can use

00:16:31.497 --> 00:16:32.837
ptg-elisp actually.

NOTE Source ptg.pel

00:16:34.237 --> 00:16:36.718
And now about the source code ptg.

00:16:38.777 --> 00:16:42.620
ptg.pel is the source and it is written in ptg-elisp.

00:16:43.040 --> 00:16:46.422
So ptg.pel, the source,

00:16:46.423 --> 00:16:49.425
is an example of ptg-elisp code.

00:16:50.186 --> 00:16:52.928
If you want to experiment, it might be a good

00:16:52.968 --> 00:16:53.689
start there.

00:16:54.549 --> 00:16:57.950
And there are some group openers in use.

00:16:59.170 --> 00:17:03.911
Typical Lisp symbols.

00:17:04.671 --> 00:17:13.233
So for comment(;), string("), and quote('), quasi-quote(`),

00:17:13.454 --> 00:17:14.714
and evaluation(,).

00:17:16.034 --> 00:17:22.396
And functionality is to transform a ptg-elisp

00:17:22.435 --> 00:17:23.435
file to elisp,

00:17:24.412 --> 00:17:28.414
and evaluate a group directly,

00:17:28.415 --> 00:17:29.536
as we have seen already.

00:17:30.036 --> 00:17:36.180
This is very similar to `eval-last-sexp` in elisp.

00:17:37.021 --> 00:17:40.282
Another example here: 6, 7 multiplied.

00:17:41.206 --> 00:17:48.968
Let's check if this is possible. You see I

00:17:49.048 --> 00:17:51.788
evaluated this and you see in the bottom line and

00:17:51.808 --> 00:17:55.129
the mini-buffer the result: 42.

00:17:55.789 --> 00:17:57.950
So the code is GPL3.

00:17:58.930 --> 00:18:04.671
So use, study, distribute, improve it if you like.

NOTE Related projects in the programming world

00:18:07.611 --> 00:18:11.452
Some related projects in the programming world

00:18:12.092 --> 00:18:17.113
are i-expressions from Egil Möller for Scheme.

00:18:17.253 --> 00:18:21.934
It's around for some time now and looks like it

00:18:22.014 --> 00:18:22.614
is final.

00:18:22.874 --> 00:18:25.674
Have a look at the Scheme page

00:18:25.675 --> 00:18:33.036
https://srfi.schemers.org/srfi-49

00:18:33.037 --> 00:18:34.057
if you are interested.

00:18:34.869 --> 00:18:37.672
And there are also the famous m-expressions from

00:18:37.712 --> 00:18:38.493
John McCarthy.

00:18:38.533 --> 00:18:42.877
They are in the making at least since 1965.

00:18:43.538 --> 00:18:45.840
Maybe there is some development.

00:18:47.441 --> 00:18:48.963
And also Python.

00:18:49.504 --> 00:18:53.307
I think Python is interesting because indent is

00:18:53.367 --> 00:18:56.129
meaningful for the behavior of the program in

00:18:56.189 --> 00:18:58.591
Python, as far as I understand.

00:18:59.051 --> 00:19:02.694
And this is opposed to indent is irrelevant for

00:19:02.714 --> 00:19:07.398
the behavior of the program, which can be seen in

00:19:07.478 --> 00:19:09.959
many program languages.

00:19:10.740 --> 00:19:14.383
Okay, so the end is near.

NOTE Summary

00:19:14.543 --> 00:19:16.865
Let's sum up and fade out.

00:19:18.569 --> 00:19:21.370
Again, the subtitle of the talk: A way to write

00:19:22.011 --> 00:19:26.313
symex as a block of prefixed lines.

00:19:27.033 --> 00:19:30.315
This is the core, I think, of this whole prefix

00:19:30.335 --> 00:19:31.155
tab group thing.

00:19:31.796 --> 00:19:34.917
And ptgs can be useful for writing text, in

00:19:34.957 --> 00:19:39.059
particular with support from Emacs, can be used

00:19:39.099 --> 00:19:39.960
for programming.

00:19:40.840 --> 00:19:50.242
Find code and info on https://gitlab.com/marcowahl/prefix-tab-groups

00:19:52.123 --> 00:19:59.064
In the Q&A I am gaa in the #emacsconf channel or

00:19:59.104 --> 00:20:00.705
whatever channel, we will see.

00:20:02.285 --> 00:20:07.026
So thank you for having me, for your time and for

00:20:07.266 --> 00:20:08.767
EmacsConf 2026 of course.

00:20:11.271 --> 00:20:11.762
Bye bye!
