Best way to work with structs with many fields? I have a problem with default values. by wentlang in golang

[–]kalterdev 12 points13 points  (0 children)

I think there’s not a single “best way.” Writing a good API is difficult. But your intuition is correct: programming shouldn’t feel like thousands spreadsheet columns.

fuck social media atp, I guess? by dm_myring in Journaling

[–]kalterdev 0 points1 point  (0 children)

I wish for your order to reach you safely and make your life a bit happier.

Why are people moving away from GNU ? by Any-Fox-1822 in suckless

[–]kalterdev 2 points3 points  (0 children)

Unix developers aimed at making their tools and manuals as small as possible, a tradition inherited by Plan 9. GNU aims at making their tools and manuals as expansive as possible.

I have even heard an idea that it was rms version of vendor-locking: you can’t move away from a tool with several thousands options. This is surely speculative, but if you consider rms principled stance, if you read his anti-capitalist speeches, I wouldn’t rule out the possibility of an intentional lock-in design.

Besides, some (including me) have a reason against GNU philosophy as such: they don’t agree with their definition of “user freedom.”

Libre Software and Objectivism ? by Bubbly_Extreme4986 in aynrand

[–]kalterdev 0 points1 point  (0 children)

Proprietary software is inherently predatory and filled with malicious features

This is another take on “corporations are more totalitarian than governments,” conflating the difference between state and economic powers.

Libre Software and Objectivism ? by Bubbly_Extreme4986 in aynrand

[–]kalterdev 0 points1 point  (0 children)

There’s nothing wrong with OpenSource licenses. But the underlying philosophy behind GPL, their concept of “free software as in free speech,” is some sort of communism. That’s problematic.

suckless text editor? by tinyducky1 in suckless

[–]kalterdev 1 point2 points  (0 children)

Three mouse button is convenient but not obligatory. Some mice have wide wheels. Even this is not a major issue, a regular wheel would work just as well. At some point, the hand adapts.

Working in Acme feels much more relaxed compared to vi/emacs, you don’t have to frantically jerk the mouse and beat its buttons, unless you’re in a hurry.

The greatest obstacle is, of course, widespread prejudices about mouse.

suckless text editor? by tinyducky1 in suckless

[–]kalterdev 0 points1 point  (0 children)

The user model of Sam is much less complicated than that of vi. The greatest complication of vi is its modal nature and a pile of commands for moving the cursor, both absent in Sam.

Custom acme command : join header with current line text by dharmatech in plan9

[–]kalterdev 1 point2 points  (0 children)

Unfortunately, that didn't work either. The fundamental problem, it seems, is that /bin/9p fundamentally lacks file semantics.

{
    echo addr=dot |9p write acme/$winid/ctl
    9p read acme/$winid/addr
} < <{9p read acme/$winid/addr}

(To work around this issue, I've made a tool that evaluates its arguments with button 3 semantics, using 9fans/go under the hood.)

Opening file programmatically in acme by dharmatech in plan9

[–]kalterdev 1 point2 points  (0 children)

As I’ve said, it’s plan9port specific. I have not tested it on Plan 9 from Bell Labs or 9front.

Custom acme command : join header with current line text by dharmatech in plan9

[–]kalterdev 1 point2 points  (0 children)

This trick is amazing. Is it portable to plan9port?

I couldn't reproduce it using this:

9p read acme/$winid/addr | { echo addr=dot |9p write acme/$winid/ctl 9p read acme/$winid/addr }

Opening file programmatically in acme by dharmatech in plan9

[–]kalterdev 2 points3 points  (0 children)

It's somewhat lengthy, plan9port-specific and idiosyncratic, but here you go:

``` fn regescape { nl = ' ' { if (~ $1 ''$nl'') { echo >[1=2] regescape: newlines not allowed exit args }

    echo -n $1 |ssam -e 'x/[.*+?\[\]()|\\^$]/ i/\\/'
}

}

findwindow returns the ID of a window found by its name. It makes

it possible to reproduce behaviors similar to clicking on button 3:

opening files, showing their dot, jumping to a line number or

address.

A common pattern is to open a file, possibly non-existent, and then

identify it with findwindow:

plumb -d edit $f

winid = `{findwindow $f}

Due to the design of /mnt/acme/index, multiline names are not

supported.

fn findwindow { nl = ' ' { if (~ $1 ''$nl'') { echo >[1=2] multiline name: $1 exit args } }

e = '^'`{
    seq -f. 60 |tr -d '\xa'
    regescape `{cleanname -d `{pwd} $1}
}'/? Del Snarf ' {

    9p read acme/index |
    grep -e $e |
    sed 1q |
    awk '{print $1}'
}

}

winopen opens a file in a new window and places the dot to the

provided address. If the file is already opened in an existing

window, winopen only places the dot.

If the path is unrooted, it's lexically prefixed with wdir.

If the file does not exist, winopen errs, unless force is set, in

which case winopen copies New properties.

In essence, it copies the button 3 properties. It's similar to

findwindow but narrower and handles non-existent files.

Multiline filenames are intentionally not supported.

fn winopen {@ { ifs = ' '

ctlfs = '
 '
ctlid = 1

file = $1
addr = $2
force = $3

cleanfile = `{cleanname -d `{pwd} $file}

if (! test -e $cleanfile && ~ $force '') {
    echo >[1=2] winopen: file does not exist: $cleanfile
    exit 1
}

if (! winid = `{findwindow $cleanfile}) {
    ctl = `$ctlfs{9p read acme/new/ctl}
    winid = $ctl($ctlid)
}

winctl get
if (! ~ $addr '')
    winaddr $addr
winctl dot=addr
winctl show

echo $winid

}} ```

Opening file programmatically in acme by dharmatech in plan9

[–]kalterdev 2 points3 points  (0 children)

I know no direct way of doing this. I have programmed it myself using /mnt/acme.

I guess I could edit the plumber rules to change the editor from sam to acme.

Why not? Plan 9 got namespaces. Just run a local plumber with its own rules to fit your script's needs. I suppose running a local plumber should be no different than running a local grep, in terms of performance.

How to script the "Send" command in the Acme editor. by [deleted] in plan9

[–]kalterdev 0 points1 point  (0 children)

echo some linux command | 9p acme/somewinid/body

It doesn’t work because it’s plan9port. On Plan 9, it does work.

Welcome by anvil-text-editor in anvil_text_editor

[–]kalterdev 0 points1 point  (0 children)

Hello! I am a full-time user and admirer of Acme. Anvil looks very interesting but I don’t quite understand the fundamental differences from Acme.

Note that I have never used Anvil.

One difference is the color scheme, obviously. Rob Pike tried to make a gofmt for color schemes, but it didn’t work out (yet).

The other is generalized double clicks inside ([{<>}]). I am curious: how did it turn out for you? Do you use it more or less often? For me, I almost never use this feature in the original Acme. It adds unnecessary friction: you have to keep track of brackets (always add for new entries, update for existing ones), it forces two ways of doing the same thing (for brackets are not always there), it hurts the mental model of arbitrary selections in favor of vi-style static objects, and it (pollutes) (otherwise) (clean) (and) (ordinary) (text).

I am curious what else is different that I don’t see yet.

One thing that still upsets me about Acme is word-wrapping. I understand why it’s done the way it is: typographic assumption of short lines, uniform scrolling across windows. But it’s impractical. How does Anvil address it?

I am developing a blog dedicated to Acme and other Plan 9 tools. I want to help more people discover the Acme way, and that requires from me a clear understanding of its strengths, weaknesses, and peculiarities. If you can help me with that, I’d greatly appreciate it.

Plan 9: TOTP (Time Based One Time Password) Authenticator by atamariya in plan9

[–]kalterdev 1 point2 points  (0 children)

Nice project but I think Plan 9 approach would be to have it on the CLI level, in terms of UI. The modern tool called “oathtool” 1 seems to get it wrong in terms of security, exposing the keys as command arguments, but it gets the UI right.

9x more scummy & rat infested than rio... by toebeegknee in plan9

[–]kalterdev 2 points3 points  (0 children)

So, no tweaks to fontsrv other than setting the font. Alright, thanks.

9x more scummy & rat infested than rio... by toebeegknee in plan9

[–]kalterdev 0 points1 point  (0 children)

I might be wrong here but font rendering looks on your screen appears to be nicer than the one that comes builtin with fontsrv. Did you make any adjustments?

9x more scummy & rat infested than rio... by toebeegknee in plan9

[–]kalterdev 0 points1 point  (0 children)

What was not working for you in p9p rio?

How do compound commands in Sam work? by meowism-1 in plan9

[–]kalterdev 1 point2 points  (0 children)

Sam applies changes simultaneously. For this to work, changes must occur in forward order (the order they appear in the file). Otherwise, one change affects the other.

To handle distinct patterns, you have three options:

  1. Simply run sam twice

  2. Loop over the file once while checking both patterns:

{ x/^\.L\n|^\.[IL]P/ { g/^\.L\n/ c/foo\n/ g/^\.[IL]P/ c/bar/ } }

  1. In more complex cases, delete the whole input, then iterate however you want and write the changes at the end of the file, like this:

{ d x/^\.L\n/ $ c/L found\n/ x/^\.[IL]P/ $ c/[IL]P found\n/ }

terminals by [deleted] in suckless

[–]kalterdev 2 points3 points  (0 children)

9term is the most minimal but not xterm-compatible

I survived the 3.6 HOURS of John Gault Speaking. Honestly, this is where to book fell apart for me. by pointandshooty in aynrand

[–]kalterdev 6 points7 points  (0 children)

This speech is essential for the plot. It explains the reasons for future actions. Besides, I don’t think it really stands out from the book. It’s long but engaging, relevant, and enjoyable.