Programming thread

  • 🔧 Actively working on site again.
What is everyone's favorite text editor? I just want to read what people been using and what makes their editor great because I'm thinking switching my current one (and I don't even know if the Vim vs Emacs debate is still even talked about).
 
  • Like
Reactions: y a t s
What is everyone's favorite text editor? I just want to read what people been using and what makes their editor great because I'm thinking switching my current one (and I don't even know if the Vim vs Emacs debate is still even talked about).
Doom Emacs. It's a distro built on top of Emacs with a lot of nice QoL stuff, and a great starting point for a config). It functions identically to vim when it comes to editing, but you also get all of the power of Emacs OS. I can't program without vim keybindings; it breaks my brain and slows me down a lot if I don't have them. Vimscript is okay for configuration, but I greatly prefer using elisp to do so. It's easy to write up a quick function with elisp for some common task and then just call it with M-x (with Doom Emacs, you can just do the spacebar twice to do an M-x) or bind it to the spacebar menu's keymap. And I just like LISP.

With an LSP and a completion backend, you can easily get error checking and smart completion for pretty much any language, comparable to that of premium IDEs. Plus, Emacs isn't a fucking electron app like nearly every other modern text editor.

I like Emacs' Magit package, which lets me really conveniently manage a project's git repo using some quick keybinds. Magit has very nice diffing features that leverage Emacs' excellent ediff tool. I really like how it shows diffs on its commit screen.

Emacs is very powerful.
 
Last edited:
What is everyone's favorite text editor? I just want to read what people been using and what makes their editor great because I'm thinking switching my current one (and I don't even know if the Vim vs Emacs debate is still even talked about).
It depends on how autistic you want things to be. I like Kate, it's comfy.

What's your current editor?
 
What is everyone's favorite text editor? I just want to read what people been using and what makes their editor great because I'm thinking switching my current one (and I don't even know if the Vim vs Emacs debate is still even talked about).
Neovim. Kickstart is an easy way to get it configured with things you'd expect from more IDE-like editors.
 
I was watching an episode the The IT Crowd recently and I wanted to ask about this part:
Hello, IT? Yuh-huh? Have you tried forcing an unexpected reboot? [...] You see, the driver hooks a function by patching the system call table, so it's not safe to unload it unless another thread's about to jump in there and do its stuff, and you don't want to end up in the middle of invalid memory. [chuckles] ...Hello?
I thought it was gibberish when I first heard it, but then I read that he's actually describing a common problem with Windows drivers (at least at the time). Unfortunately, I couldn't find any more details. What's he actually saying here?
 
I was watching an episode the The IT Crowd recently and I wanted to ask about this part:

I thought it was gibberish when I first heard it, but then I read that he's actually describing a common problem with Windows drivers (at least at the time). Unfortunately, I couldn't find any more details. What's he actually saying here?
I used to mess around a lot with Win32 APIs and system internals. This sounds like system call hooking using the SSDT (System Service Descriptor Table) to overwrite the function pointer associated with a particular system call with a pointer to a hook/wrapper function. This was commonly used for drivers, which run in kernel mode, to hook necessary calls. It was also commonly used in rootkits to do similar things but for malicious purposes. Reverse engineering some rootkits is how I first learned about this. Note that SSDT hooking is easy to detect, so most modern rootkits are much sneakier.

If you still have a pointer to memory you freed/unloaded (a dangling pointer), you're accessing a memory region that could get allocated to some other program and overwritten. This is called a use-after-free, and they are a common bug when working with multi-threaded applications. UAFs are a big problem, since you no longer have any guarantees as to the structure or content of that memory. UAFs can be used to control memory another program accesses after it was freed and possibly run arbitrary code.
 
Last edited:
This was commonly used for drivers, which run in kernel mode, to hook necessary calls.
Thank you for providing the names of concepts along with your explanation. I understand and I also have a rabbit hole to follow now. Just to make sure I got it: I tried my hand at GBA romhacking a long time ago. The short version is that I put my code in the ROM and found a table of pointers to the original code. I just switched out one of the entries to point to my code. I'm guessing this is a similar concept?
 
Thank you for providing the names of concepts along with your explanation. I understand and I also have a rabbit hole to follow now. Just to make sure I got it: I tried my hand at GBA romhacking a long time ago. The short version is that I put my code in the ROM and found a table of pointers to the original code. I just switched out one of the entries to point to my code. I'm guessing this is a similar concept?
Sounds like it. Linkers use address tables like these to resolve function calls between objects. They're very very common.
It's all just function pointers, one way or another.
 
Thank you for providing the names of concepts along with your explanation. I understand and I also have a rabbit hole to follow now. Just to make sure I got it: I tried my hand at GBA romhacking a long time ago. The short version is that I put my code in the ROM and found a table of pointers to the original code. I just switched out one of the entries to point to my code. I'm guessing this is a similar concept?
For a more stable and predictable version of this type of exploit in windows you may want to research "dll injection". That's a cool rabbithole to go down, you learn about what .exe files really are in that one.
 
It depends on how autistic you want things to be. I like Kate, it's comfy.

What's your current editor?
I know people are going to laugh when I mention this, I use Notepad++ because it was just convenient sitting on my computer when I first downloaded it years ago, back where I was naïve about any other editors. I was focusing on other IDEs like Visual Code for programming and Brackets for web design so I didn't considered switching until I had to write LaTeX and wish to program on the same editor.
 
I know people are going to laugh when I mention this, I use Notepad++ because it was just convenient sitting on my computer when I first downloaded it years ago, back where I was naïve about any other editors. I was focusing on other IDEs like Visual Code for programming and Brackets for web design so I didn't considered switching until I had to write LaTeX and wish to program on the same editor.
Notepad++ from 2010 on was usually standardly available at large scale enterprises running windows machines. A lot of people preferred it over eclipse for small edits like properties files. It really was the best editor for windows until sublime hit the block.
 
what makes their editor great
Forgot this part of your question (shurely any mention of Neovim is enough to get people to switch!?).

I really like Vim's modal editing and its key bindings ("motions"). eg, ciwlol will replace the word under the cursor with lol (change, inside, word, "lol"); fn will move the cursor onto the next n in the line (find, "n").

For several years I used VSCode with the VSCodeVim extension, but eventually became frustrated with the input delay compared to using vim in the terminal. vscode-neovim is somewhat faster (it uses neovim as a backend instead of re-implementing vim features in the extension in JavaScript), but I kept hitting rough edges where I'd try to do something that works fine in vim, but doesn't have an equivalent in VSCode. For example, :h text-objects will show the vim help for text objects (and the vim documentation is excellent), but vscode-neovim used to just open up a terminal pane and dump out the text of the whole containing help file (I just checked and it's far better now).

This is what caused me to switch: fast editing and access to all the vim motions/functions without hitting the mismatch between vim world and VSCode world.

What got me hooked were the things that Kickstart helps you set up, particularly telescope (a fuzzy finder over basically anything you'd want: files, language symbols, help page sections, diagnostics, commands, etc) and helpful affordances that ease the transition to using a non-GUI editor (you can't just look for things in the menus!) such as whichkey (shows what actions are available as you type each key of a keybinding).

And what's got me to stay is your classic vim stuff — you don't need (and shouldn't try) to learn everything at once, but as you use the editor you pick up more and more of the tools and think "oh that's nice". For instance, vim's default regexes are somewhat frustrating as they need more backslash escapes than you'd expect, but then you learn about the "magic" and "very magic" options.

If you're at all vim-curious I'd recommend just jumping in and starting the vim tutor (:Tutor), then Drew Neil's free Vimcasts and his book Practical Vim. Even if you decide that using vim-the-program is not for you, you might decide you like the editing style, and many editors have a "vim mode".
 
Last edited:
What is everyone's favorite text editor? I just want to read what people been using and what makes their editor great because I'm thinking switching my current one (and I don't even know if the Vim vs Emacs debate is still even talked about).
GNUmacs.

But not for any particularly profound reasons. It has a package manager with a pretty broad selection of editing modes for basically any language. There's easily googlable fixes for anything I need. (I hate tabs so I have it set to delete tabs in most files upon saving.)

I'm actually a big lisp nerd, but emacs lisp is dogshit and really shouldn't be considered an example of the language, so I don't really even have the bonus of fucking around with the language to enhance my editing environment.

I pretty much just use it as a slightly fancier plain text editor, and then do everything else in a grid of terminals next to it.

Now an emacs like editor (maybe with better GUI support) with scheme as the embedded language would be tits. But I've got too many projects to work on as is.
 
Now an emacs like editor (maybe with better GUI support) with scheme as the embedded language would be tits. But I've got too many projects to work on as is.
Getting Guile into Emacs has been a longstanding project, but at the current rate it's scheduled to finish about ten years after Hurd becomes mainstream. And to think that all these Elisp horrors exist purely because Stallman had an irrational hateboner against Common Lisp.
 
Been starting making games with Godot. Currently going through a book. Not a huge fan of gdscript, even though its very simple. Anyone have any experience with the Rust bindings in Godot? Whats the best workflow when working with scripts outside the main godot interface? Just edit scripts in an ide and save them?
 
  • Feels
Reactions: Whatevermancer
Been starting making games with Godot. Currently going through a book. Not a huge fan of gdscript, even though its very simple. Anyone have any experience with the Rust bindings in Godot? Whats the best workflow when working with scripts outside the main godot interface? Just edit scripts in an ide and save them?
You might as well use bevy if you wanna use rust. I gave up and just used their editor though I would have rather used vim.
I cannot understand the appeal of neovim
It is vim but with a better plugin ecosystem and built-in LSP client functionality. It was pretty easy to switch to last year as a long-time vim user. You also get to not use vimscript, which is nice.
 
eg, ciwlol will replace the word under the cursor with lol (change, inside, word, "lol"); fn will move the cursor onto the next n in the line (find, "n").
These motions and operators are what make vi and its successors so great (especially the ] and } motions and their reverse counterparts}. You never have to move your fingers away from the main typing keys. Whenever I hear someone say he uses nano, I always think to myself "Man, this guy must love arrow keys." I would sooner shit in my own hand and clap than edit a big .conf file with it lol.

Just a heads up, you don't need the i in the motion. Unless neovim changed something, cwlol works all the same. Though doing cawlol for append moves it ahead to the next non-whitespace character using a pattern like s/\s*(.)/\1 (similar to the W and E motions, but this includes the trailing space).

I highly suggest anyone reading to install vim and give vimtutor a quick try; it's a command that you can run from your shell or do :Tutor if you're using neovim as suggested above. The tutor is a simple informative text file with simple try it yourself mini lessons where it gets you to edit placeholder text with concepts it teaches. Even spending 5 minutes on the first few lessons is worth trying; there's nothing to lose. Vi's HJKL navigation style appears all over the place and is very handy once you get the hang of it.

Now an emacs like editor (maybe with better GUI support) with scheme as the embedded language would be tits. But I've got too many projects to work on as is.
Maybe a layer over top of elisp? It pretty much all gets compiled in advance anyway.
 
Last edited:
  • Thunk-Provoking
  • Like
Reactions: Marvin and Geranium
Back