Re: [dev] [st] Home key does not work in yash

2024-08-08 Thread Randy Palamar
Страхиња Радић  wrote:
> Дана 24/08/08 03:24PM, Roberto E. Vargas Caballero написа:
> > In fact,  the correct thing to do is not modifying TERM.
> > St defines the correct value for the TERM variable, and
> > you can change that value in the config.h file, based in
> > your preferences.
> 
> st sets the default, but setting TERM overrides that and allows for
> some flexibility. But the testing has shown that TERM is irrelevant for
> this issue. Even with the OP's settings, Backspace in st+yash is
> working without issues here. The only difference with different values
> for TERM seems to be whether yash outputs the cwd or not. With some
> choices for TERM, cwd isn't output near the bottom of the terminal
> window by yash's example prompt.
> 

How exactly are you invoking yash? On my Gentoo box invoking
`TERM=linux-s yash` from ksh running inside st and pressing HOME
leads to yash echoing back `ESC[H` (here ESC == \x1b). Simply
invoking `yash` causes HOME to behave as expected.

- Randy

-- 
https://rnpnr.xyz/
GPG Fingerprint: B8F0 CF4C B6E9 415C 1B27 A8C4 C8D2 F782 86DF 2DC5


signature.asc
Description: PGP signature


Re: [dev] [st] Home key does not work in yash

2024-08-02 Thread Randy Palamar
luons...@autistici.org wrote:
> export TERM=3D'linux-s'

Try leaving TERM="st-256color" and report the results. Terminal
programs (such as a shell) behave very differently depending on
what the value of TERM is. As a user you shouldn't really be
modifying that value unless you are developing/testing a terminal
emulator and know exactly what it controls.

- Randy

-- 
https://rnpnr.xyz/
GPG Fingerprint: B8F0 CF4C B6E9 415C 1B27 A8C4 C8D2 F782 86DF 2DC5


signature.asc
Description: PGP signature


Re: [dev] alternatives to C: Ada, Rust, Pascal

2024-06-21 Thread Randy Palamar
NRK  wrote:
> Below are two of the most impactful changes. I was going to elaborate on
> these but it was getting *really* long very quickly so I've kept it to a
> brief overview followed by a real-world project that demonstrates these
> techniques.

I completely agree. Since trying sized strings/fat pointers and
learning about Arenas I have used them in every project I have
written. Both of these techniques lead to faster code with fewer
bugs and usually in less total lines.

> (Do note that this "style" of C programming quite different to the
> suckless one, so I wouldn't be surprised if it generates some
> "backlash".)

In my view the suckless "style" on the aforementioned page is
entirely dogma and should be ignored. To me the only thing that
matters is writing code which minimizes the amount of end user
time waste (both in terms of runtime and lost time to bugs/poor
usability). As far as I can tell not a single item in the suckless
"style" serves towards meeting this goal.

> Region based memory management
> --
> [...]
> You can make many of them and then discard them all in one call.
> 

Why even bother with making a call? Usually I partition my Arenas
at startup into permanent and temporary parts. The temporary part
gets passed around on the stack and is thus reset when the scope
exits. For example a "frame allocator":

Arena frame_storage = new_arena(size); /* or from the bulk arena at startup */
while (!ctx->window_should_close) {
do_work(ctx, frame_storage);
/* any allocations made in frame_storage are discarded
 * when the loop restarts */
}

In this way it is completely free* (I'm sure you know this NRK).
Of course this involves passing structs around by value which I'm
sure is not suckless approved but it makes literally no difference
to the CPU unless the struct's size is very big (Arenas can be
done in 16 bytes which is small compared to the 64 byte vector
registers on newish CPUs).

* May involve a stack pointer move if for whatever reason
  frame_storage was not passed in through a register.

- Randy

-- 
https://rnpnr.xyz/
GPG Fingerprint: B8F0 CF4C B6E9 415C 1B27 A8C4 C8D2 F782 86DF 2DC5


signature.asc
Description: PGP signature


Re: [dev] [sbase] Defining scope of sbase and ubase

2024-03-08 Thread Randy Palamar
Elie Le Vaillant  wrote:
> Another idea could be to have both in the same git repository,
> [...]

This would be my idea as well. It also wouldn't be that difficult
to let people pick and choose which sets of tools to include in the
final -box via config.mk or similar. I would stick with only the
high-level sets and leave the omission of individual tools up to
the "user" (I already do this because I prefer a few tools from
OpenBSD even when using Linux).

> Also I'm not sure whether we should keep the goal of being POSIX-compliant.

I also agree with this. POSIX, like everything designed by committees,
is full of bad and/or incomplete ideas. I think that having a set
of tools that isn't GNU/spaghetti but still supports some of the
good non-POSIX options (for example sponge, xargs -P, working tar,
etc.) would be nice to have.

- Randy

-- 
https://rnpnr.xyz/
GPG Fingerprint: B8F0 CF4C B6E9 415C 1B27 A8C4 C8D2 F782 86DF 2DC5


signature.asc
Description: PGP signature


Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-29 Thread Randy Palamar
> That is one of the jobs of the -p switch to mkdir. However, without -p,
> mkdir is not allowed to ignore failure like that.

Once I looked in more detail I realized that was the case so I didn't
send the patch. It was not how I previously thought about the -p
switch though.

> Plus I didn't know mkdir could fail with EISDIR. My manpage is not
> documenting that case.

It's probably legacy nonsense or from some obscure platform that I
noticed when checking other implementations [0].

- Randy

PS It seems I will need to switch my mailer because I don't think my
other patch fixing this issue made it through. Quentin's patches
supersede it though.

[0]: https://git.busybox.net/busybox/tree/libbb/make_directory.c#n99



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-28 Thread Randy Palamar
> scripts/mkproto: 15: cannot create /usr/local/share/man: Is a directory

Actually, looking at it again this is just a problem in the makefile.
scripts/mkproto has too many args. Though fixing that exposes a
separate issue with the way `find` is being invoked.

- Randy



Re: [dev] [Bug][sbase] make install borked since commit ddde8021

2023-10-28 Thread Randy Palamar
Hi,

> scripts/mkproto: 15: cannot create /usr/local/share/man: Is a directory

This is a problem with mkdir in sbase. It probably shouldn't error out
when mkdir(3p) fails and sets errno to EEXIST or EISDIR. I'll send a
patch to hackers@ soon.

- Randy



Re: [dev] sbm dmenu bookmarker

2023-08-01 Thread Randy Palamar
> How do you avoid duplicates

`grep -q "https://url.com"; $BOOKMARKS \
&& echo "https://url.com based,bloat" >> $BOOKMARKS`

> and edit existing booksmarks?

??? it's just a simple text file.

In all seriousness I like to keep the bookmarks grouped and easily
readable so I open the file in vis, insert the bookmark wherever,
and use the  operator to align the
comments/tags. But that's not really necessary.



Re: [dev] sbm dmenu bookmarker

2023-07-31 Thread Randy Palamar
Hi,

I think this script is way too complicated for what it does. I
do the following:

`grep -v -e '#' -e '^$' $BOOKMARKS | dmenu -i -l 20 | cut -f 1 -d ' '`

Then I pipe it to the clipboard or a plumber script depending
on what I want to do with it (bound to a keybind in dwm).

To add bookmarks I either use a text editor or just echo:

`echo "https://nsa.gov file sharing, hosting provider" >> $BOOKMARKS`

- Randy

On Sun, Jul 30, 2023 at 3:25 PM Spenser Truex  wrote:
>
> A friend of mine was impressed with how quickly I was spamming the most
> based and redpilled links from this script and wanted me to publish it.
>
> screenhots etc.
> https://equwal.com/posts/sbm
> the "code"
> https://github.com/equwal/sbm
>
> It's still rough around the edges, I'd like to be able to have some
> input validation (no duplicate links) and plumbing options (browse
> where? copy to what?).
>
> As it stands, it just copies to clipboard which is probably good enough.
> --
> CAEE B377 FC82 BAF9 102C  D22F C5CE D003 1AA8 E281
> Spenser Truexhttps://equwal.com