[-] some@programming.dev 2 points 22 hours ago

I am very rarely working in other people's stuff because I am too rudimentary but of course I try to follow their rules when I do.

For my own purposes, I would do it in one of the below ways. I made the case more complicated by changing the lengths. I mostly choose consistent levels of indentation using tabs over per-character alignment but not always.

[--] = tab, ~ = single space (and double space = double space in front of comments for legibility here)

function() {
[--]var = 1
[--]another_var = 2
[--]indented(arg, arg2, arg3)
[--]indentedTwo(arg, 
[--]~~~~~~~~~~~~arg2,
[--]~~~~~~~~~~~~arg3)  #: aligned by spaces to match specific charecter length
[--]indentedThree(
[--]~~~~~~~~~~~~arg,
[--]~~~~~~~~~~~~arg2)  #: aligned by space to arbitrary charecter length, same as the previous
[--]indented4(
[--][--]arg,
[--][--]arg2)  #: aligned by tabstop by level
[--][--]~~~~~  #: this would be my preference overall if I had to chose
[--][--]~~~~~  #: (which so far I haven't)
}

Kate has a great feature called "insert smart newline" which I shortcut to shift+enter. If you are typing for example on the penultimate line above and "insert smart newline" it'll automatically fill the line with [--][--]~~~~~ #: and put the cursor at the end. This feature really enables a lot of these habits for better or worse.

When I write output to terminal I really like being able to use tabs to modify the length of tabs according to what is the content. Sometimes I wish I could set tabs in my editor (like a word processor), it would make things simpler. But then there's portability issues for non standard features like that so.

[-] some@programming.dev 3 points 2 days ago

Thanks! Searching for this led me to this extremely charming website where in addition to robust folding, the author argues in favor of proportional width fonts and tabstops (not spaces) in coding. Unconventional. It's nice to know someone who processes text in a similar way to me can be a successful programmer. Even if they had to write their own tools. https://tibleiz.net/code-browser/elastic-tabstops.html

[-] some@programming.dev 2 points 2 days ago

It makes sense it's a Vim thing since it's used in kitty config. When I search for marker based folding as someone else said it's called above, almost everything I get is for Vim. It's always confused me why gui-based text editors seem to not have a lot of visually-based features like this compared to terminal-based editors. I guess it's harder to create a system for user customization in a GUI application.

At least Kate has some support. Now that I know what it's called I will look into what else is available there.

[-] some@programming.dev 1 points 2 days ago

I am probably a bit over the top with this tbh. I put everything in functions, even single-use activities like declaring initial variables at the beginning. I just do it to enable the code folding. Even though everything I do is small time and I'm sure it's not excessively burdensome on the system, it seems wasteful to me to have the computer hold a the function in memory when it's never going to get used again. So I was thinking this might be more efficient in such cases.

23

I noticed that the developer of kitty terminal uses this style of comments I have rarely if ever seen elsewhere:

outside
#: section {{{
inside
#: }}}

Kate text editor recognize sections for purposes of highlighting, folding etc. It's really nice for me because I sometimes I have a difficult time navigating large text files. And it lets you nest them.

  • what is this called?
  • are there other ways to do it?
  • is it standard among text editors? I believe Kovid the dev for kitty is a vim guy so presumably there is support there also.
  • why don't more people use it? are there problems?

Screenshot that shows the code folding.

  • Cursor is at the end of line 7 so the whole section line 7-22 is highlighted
  • lines 12-16 are folded in a 3rd level comment
  • I also included tab indents just to make it easier to see what's going on (Kate treats it the same way regardless of indents)
  • Highlighting/Mode > Scripts > Bash

I also like his style of distinguishing between narrative comments (starting with #:) and commented-out code (starting with #). Although in my example, Kate doesn't treat them differently. Is there a term for this? Any conventions, support etc?

plain text used for screenshot


#: Comment level 1 {{{
	#: Comment level 2 {{{
		#: configure something
		key value
	#: }}}
	#: Another Comment level 2 {{{
		#: Comment level 3 {{{
			#: Helpful explanatory comment
			file location
		#: }}}
		#: Comment level 3 with hidden text {{{
			you_cant see_this
			hidden_emoji "๐Ÿ‘๏ธ"
			hidden_emoji2 " ๐Ÿ‘๏ธ"
			hidden_emoji3 "   ๐Ÿ‘๏ธ"
		#: }}}
		#: let's set some things up
		# setting yes
		# other_setting no
		different_setting maybe
	#: }}}
	# regular comment
#: }}}

# regular comment outside anything


For a real world example, see sample kitty.conf file provided on project website.

[-] some@programming.dev 3 points 3 months ago

Itโ€™s not really something developers want to think about very much so they often just use the default.

Do you think it was intentional ideological decision by the Rust developers or some other contributors/interests to make permissive the default? Or a random decision that has ended up being consequential because of the popularity of Rust?

I have noticed for a long time that github promotes MIT license. It lets you use any, of course, but puts a real positive shine on MIT. My perception is that this is a purposeful intervention by MS into FLOSS to promote MIT.

[-] some@programming.dev 3 points 3 months ago

Yes you are correct I mis-used the term. I mean copyleft. So I fixed the post. :)

[-] some@programming.dev 7 points 3 months ago

soo you are saying people are tricked into it?

48
submitted 3 months ago* (last edited 3 months ago) by some@programming.dev to c/opensource@lemmy.ml

I often see Rust mentioned at the same time as MIT-type licenses.

Is it just a cultural thing that people who write Rust dislike ~~Libre~~ copyleft licenses? Or is it baked in to the language somehow?

Edit: It has been pointed out that I meant to say "copyleft", not "libre", so edited the title and body likewise.

[-] some@programming.dev 3 points 3 months ago

Over the years, forums did not really get smaller, so much as the rest of the internet just got bigger.

[-] some@programming.dev 2 points 3 months ago

I assume they are just harvesting email addresses unless a very small site

[-] some@programming.dev 10 points 3 months ago

There are so many niche forums.

Here's one I found a while ago when I was looking at repairing an old electric fan I found: Antique Fan Collector's Forum.

In the way that people would always add "reddit" to their searches, try just adding "forum".

[-] some@programming.dev 3 points 3 months ago

mumble is already the name of FLOSS voip software so they're probably better off with the existing name. Which I don't love on first glance but there's probably some rationale for it.

[-] some@programming.dev 2 points 3 months ago

Is there any specific reason to keep the docs in the wiki section? Vs markdown documents right in the wiki itself?

For my self I like to document in the code itself. It has one major benefit which is: I always know where the information is to be found. But there are some problems with it such as

  • creates conflicts when merging changes from another repo or branch

  • it makes the git history a lot messier because you have some commits on functional code and some on comments, all mixed up in a single document. I know with fancier git this could be tidier but I can't reliably work at such a high skill level

  • comments are not subject to syntax formatting so harder to read

  • source document itself becomes too long to read and hard to understand

  • extremely contextual to my skills and challenges at the time when I wrote the code; not what I will need to know in the future and not what others need to know

So not always the way to go.

31
submitted 3 months ago by some@programming.dev to c/opensource@lemmy.ml

I'm a FLOSS/linux enthusiast. Over the years I have learned some scripting, and can get around in git. Occasionally I fork someone else's project to suit it to myself. Shell scripts, webapps, browser extensions etc. The kind of thing you can work in the source of without actual programming knowledge by just looking at text files.

Recently I modified a C program to have more legible/useful (to me) terminal output. I gave it a slightly different name and for compatibility have both versions running on my system. For my use-case it is a huge improvement over the original so I want to have it publicly available where I can install it from any system. And to share in case anyone else would enjoy it.

I don't think my changes would be appreciated by the original maintainer. For one thing, no changes have been made to the code in >10 years. The dev is still active so I guess the program is considered complete. For another, my changes are breaking and specifically disrupt the "linux philosophy" aspect of the program. I think having both version co-exist is the best way.

  • I don't want to confuse anyone who is trying to find the repo of the original program.
    • The original is hosted on github whereas I use codeberg; so the "forked from" relationship is not as clear as if I stayed on github
  • I ?do? want to update documentation such as README in the repo to describe my changes and relationship to the original
  • I ?do? want to update and --help/man in the terminal to reflect the fork's name and possibly clarify how it works
  • Should I make some sort of courtesy PR or repo issue offering my changes even though I think it would be (even should be) rejected/ignored? It seems kind of time wasting.
  • In the case where the original upstream was being updated, how do I integrate those with my changes? I've had some luck so far with doing my best to guess about the git process, I think using branch, sync, merge. But I couldn't tell you more than that. Any insight on how this is supposed to go? I have spent lots of time wading through git's documentation but still find the main ideas kind of confusing.
  • Anything else to consider?

Since I'm just dabbling, I try to stay away from more complicated workflows, or those which require specific system set up, when possible. My experience is that when I come back to it in a few months, a year or two years, I will have forgotten a lot; it might be a different system environment. I need to be able to re-learn everything at a later time. Simple solutions that are widely-compatible, and do not rely on my memory are preferred.

I don't mind doing a bit more work than is strictly required to learn about the FLOSS process. I've done it a few times before and it is useful to me to understand things.

view more: next โ€บ

some

joined 4 months ago