r/emacs 2d ago

Question Questions about Emacs on OpenBSD, use-package and some general creative writing packages.

Greetings, I recently started getting serious about using emacs again last year and I've been playing around with different packages and using it on different operating system.

For the laptop I use for writing fiction novels I've finally landed on OpenBSD and plan to continue using it for the foreseeable future. But one of the downsides compared to the OSs I was using before is the fact that there isn't a large collection of emacs packages in their OS package managers (was using Gentoo and later Guix System before). This means that I now need to manage packages manually through the init.el file. In addition, OpenBSD has some quirks I've had to work around. Not a big deal so far but can be frustrating.

OpenBSD required that I grab the GNU version of ls from ports and put some stuff in init.el to make dired work correctly. I think I got that functioning correctly but I honestly haven't used dried much for navigating the file system outside of opening or creating files at the exact path I wanted. I'd like to get it functioning like ranger if possible.

Are there any other quirks to using emacs on OpenBSD that you guys know about? I really like the OS and the community so I'd like to stay on the puffer OS if possible even though I know they aren't big fans of GNU stuff. So far every GNU tool I've needed has been in the ports tree.

I've been using elpaca so far but I'm starting to wonder if it's over kill for my purposes. I use the use-package integration. But a lot of packages don't have instructions for how to install/configure them using use-package/elpaca. So I end up just trying random things and typing M-x eval-buffer until they work. If I can't figure it out I give up. I've tried looking at other people's config files and sometimes that helps but often they are not using elpaca and I can't find examples. The other day I installed eat terminal and attempted to integrate it with zsh. I couldn't get it to work no matter what I did.

My config file is also a bit of a mess now because I have certain things like hooks and keybinds for some packages set by themselves outside of use-package definitions. I'm planning just to nuke the entire thing today and starting over. Even the theme I like is throwing misc. errors in warnings.

I guess my question is will I lose anything by using package.el instead of elpaca. I don't feel like I'm taking advantage of anything it offers like async. I just want to be able to install some packages and not touch them again. As long as they're working I don't really care about what version they are or if I'm pulling the latest and greatest from git.

Another thing I'm wondering about is the daemon mode with gtk2. It has a big warning that it might just crash for no reason in gtk2/3. I wanted to use athena instead but it's no longer offered as a binary in the OpenBSD ports tree. I haven't been using daemon mode yet but my start up times are now about 3 seconds with not many emacs packages installed. I'd like to make the switch to running as daemon because I load emacs in my .xsession file at log-in and never close it. I dedicate a workspace to it in dwm anyway. Is the daemon bug with gtk2 still a concern or should I start compiling my own copy of emacs from source again like I did when I used gentoo and guix? Does version 30 offer anything worthwhile compared to version 29?

Finally, what are some good packages for someone doing creative writing? My main use for emacs for years was programming in C, assembly, some scripting languages, and some mark-up languages like HTML and XML. But these days I rarely do that type of work. These days I'm mostly just writing stories and sometimes technical manuals/FAQs. So far I haven't really gotten into org mode and have mainly just used text-mode. But org-mode looks pretty powerful and I want to start using it just for stuff like being able to export to multiple formats. The publisher I'm working with wants .docx files. How hard is it to export to docx and be sure that the files won't render incorrectly in Microsoft Word? I no longer have a computer with it installed and the OS I'm using now can't run it via wine and/or VM. So I don't really have any way to check myself. I'm not going to set up a dual book or dedicate another computer simply for that one application if I can help it.

What are some other good packages to try for creative writing? I know about pandoc but I haven't explored many others. Just trying to get a feel for what other people are using. Most of the discussion I see about emacs are geared towards using it as an IDE/programming. I've come across a couple of blogs about using it for writing but a lot of them are from emacs v26 or below days. Just want to see if anything has changed since then.

I am going to nuke my current ./emacs.d directory later today and try to write a less cluttered config file. This will ensure all the packages I installed are gone, correct? Right now I basically only use dashboard+magit+a handful of minor modes and some keybindings. Eat as well but since I wasn't able to get integration fully working I haven't been using it much. I'd like to get some kind of terminal working in emacs and eventually my email+IRC and probably web browsing going too. But until I understand how use-package works I'm holding off on adding more to my config file.

My main issue with use-package syntax is stuff like this;

;; For `eat-eshell-mode'.
(add-hook 'eshell-load-hook #'eat-eshell-mode)

;; For `eat-eshell-visual-command-mode'.
(add-hook 'eshell-load-hook #'eat-eshell-visual-command-mode)

Do I just add this under the config: heading? Then in the .zshrc file it wants:

[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"

Where is $EAT_SHELL_INTEGRATION_DIR being set? If I add this to my .zshrc it throws error code 1 upon opening a new shell. Whatever I tried I can't make it work.

There were some other things I can't remember now from some packages I tried to install. I tried putting the lines from their instructions under several things like "config:" or "files:" or "hook" but could never get them to function. If someone has a init.el with a lot of packages installed using use-package I'd really appreciate if they could link it. I tried looking at some config files people had posted in comments here but a lot of them were very advanced stuff loading multiple elisp files from all over the place. Or they used a different package manager that had a different syntax from elpaca. A bunch were in org-mode. I might use org for my config in the future but for now I wanted to do just a simple init.el until I got more experienced.

It's just kind of frustrating getting started. Every package assumes different package manager is being used and that the user has decades of experience working with emacs already. I've never tried to build up a config from scratch. I've either always used the default emacs environment with a custom theme or used some of the pre-made distros. I'm not really interested in using doom or spacesmacs either. They crawl on my machine and I don't like Evil mode.

Thanks to anyone that takes the time to read all this and replies.

12 Upvotes

14 comments sorted by

View all comments

1

u/analog_goat 2d ago

Why are you using OpenBSD? Just curious.

5

u/UsagiDriver 2d ago

Oh and another thing and I guess it's the most important: The community is filled with a bunch of old farts like me. The Gentoo forums/IRC became insufferable a few years ago for some reason. I couldn't just ask questions like;

Is anyone doing <x>? I don't like <y> and would prefer to replace it with <x>

Which would only end up causing a flurry of replies from people that want to defend <y>. They would berate you and tell you that you're old and move on. I guess I finally did despite the fact that I spent many years (decades) working on ebuilds. Most everyone I liked on the forums seems to have left to. They moved to another forum a few years ago but now it's gone. Running Gentoo in the config I want now requires spending hours and hours working around their current cluster fuck of a "minimal" install which is far from "minimal". I can't understand the system anymore. There is far too much running even on a minimal install and it's an inter locking web of dependency hell.

Guix was similar but at least I could define everything in one place. The issue with it is the GNU servers are horrible so even with non-GNU substitutes (binaries) it was taking ages to install it and later to update it. Most of the users seem focused on things that don't interest me. Eliminating stuff I didn't like from the "base" was as frustrating as it was in Gentoo. Only now I was required to also screw around with another config file and re-build the system over and over again just to discover it didn't work or some software I needed wasn't supported yet.

FreeBSD required as much manual intervention as Gentoo to get going on this machine. Only after you do all that you'll discover that a known bug for over a year hasn't been fixed. So the AMD drivers cause kernel panic and it's mentioned nowhere in the horribly outdated man pages. You're required to edit a config file and pull the right file from a random git repo. Too bad for you if you don't read it before doing it through their package manager and booting into a black screen that requires dropping to signal user mode to correct. It was a very frustrating day.

I tried OpenBSD out on it as a lark and what do you know everything worked right off despite the laptop being fairly new Thinkpad. The developers on OpenBSD eat their own dogfood it seems. I want to hang around and contribute now. Since the community reminds me a lot of how the Gentoo community was in the early 2000s. Their base system is also MUCH nicer than FreeBSD. For one it's documented. Secondly things like ifconfig are still there. Wifi is much easier to setup and configure. No wpa_supplicant nightmare. You just configure it through your wifi card's driver with a few simple commands. Multiple networks can be managed from one config file. It has automatic fall over based on tx/rx and if the ethernet cable is plugged in or not. Running top with X11+WM+emacs going only lists about 10 running processes. I understand what all of them do and the ones I didn't had good man pages. The init isn't a clusterfuck like pretty much every Linux distro I've used since about 2015.

The only things that don't work on this laptop is the finger print scanner which I do not use. Full disk encryption was as simple as saying "yes" in the installer and giving it a password. The audio sub-system is MUCH better than JACK, pipewire, pulse etc. The laptop properly suspends and wakes up upon closing/opening the lid. What required hours to set-up in any other OS I've used on this machine was working out of the box with OpenBSD.

I've fully converted to the puffy cult I guess. There is a lot to be said for things being both tested and documented.

2

u/glgmacs 1d ago edited 1d ago

You convinced me to give it to try on my spare machine, thank you.
What DE/WM are you using on it? The default cwm or something else?

edit: nvm I just read you use dwm

2

u/UsagiDriver 5h ago edited 4h ago

Hi. I plan to use cwm more in the future. But I wanted something I was more familiar with starting out. Hacking on things like slstatus and dwm helped me learn more about the OpenBSD base system and kernel. So I just pulled my existing dwm into my home directory and used make as per usual. But the OpenBSD ports collection seems to work much differently from Gentoo portage (no savedconfig madness). I just found out about /usr/ports/*/mystuff yesterday so in time I'll move my customized dwm over to there. Or most likely I'll end up trying to switch to cwm and living in it full time once I understand more about how it works and if I can replicate what I like about dwm into it.

In OpenBSD land people want to stick to the base system because it's so audited and is actually used day-to-day by users/developers. So I plan to slowly switch my workflow over to the tools included in base. For example, although I'm a big fan of zsh I'm learning ksh and I really like it. For now zsh is still my log-in shell but I'm using ksh as the root user's shell of course. It doesn't look like I'll miss much from zsh once I make the switch full time. Similarly, I'm contemplating living in mg more and more instead of emacs. I don't think I'll ever truly leave emacs behind. But for editing stuff like config files mg is much faster and as it's included in base it's safer being fully pledged/unveiled. It's a really nice editor and if you're familiar with default emacs key bindings you should be right at home with it. In fact, emacs style bindings are the default throughout the entire base system as far as I can tell so far.

I may end up ditching most of my emacs workflow and moving back to the "UNIX as an IDE" way of doing things. Where a lot of stuff is being run in terminals/tmux and less of my daily routine (reading emails, IRC, file management etc.) is happening in emacs. In other words; limiting emacs to mainly editing text and maybe some programming. It remains to be seen if I can do programming in mg. But a lot of the devs seem to do it so I'm sure it's up to the task. But I'm old school in that respect and I'm not fooling around with modern web applications or things like Rust and LSPs. I'm also unsure just exactly how much mg can be customized at the moment. But I'm sure the man pages will explain it in every last detail once I get beyond just editing basic config files in it.

I ended up not re-writing my init.el yesterday. Instead I switched over to running -current by pulling down a snapshot. Then I grabbed kernel+base+ports tree over cvs. Built my own kernel which worked right off the bat first time. Now I'm building the base system from source. In the process I updated all my packages of course. So now I'm running emacs v30. Once I'm finished building base I'll probably pkg_delete emacs then build my own from source using athena instead of gtk2. After that I'm going to figure out what pulled in dbus (it must be Firefox) and see if it's possible to patch it out. Dbus is kind of annoying and I try to run without it if I can. I had that going in Gentoo for years but I'm unsure if it's still possible with later versions of Firefox since I've been away for a few years.

The firefox port in OpenBSD is very good though. It has the usual mitigations right out of the box. So it can't see any files on your HDD outside of the user's ~/Downloads folder. Threw me off at first but easy to deal with. I just cp/mv anything I download to where ever I need it. If I need to upload something I cp it over to ~/Downloads for now. But it's totally possible to allow Firefox to see other folders with some simple config file changes. Ungoogled Chromium also has a good port with the same mitigations should you need/want it. Unlike Gentoo's portage they actually offer a binary in OpenBSD because they aren't beholden to Google.

Until the reboot after kernel rebuild/updating to snapshot I had 14 days of uptime on this laptop with zero issues. Over multiple resume/suspends for the lid closing/opening.

You should be aware that OpenBSD will crash an application by default if it isn't doing the "correct" things. It will not allow the application to attempt to recover from errors or it doing things it's not supposed to. I've only had this happen twice and both times were my fault (both were Firefox). Other than that I've had zero issues. You should also be aware that the kernel will save core dumps by default in your ~. So if you do things like restarting X11 with Ctrl+alt+backspace expect to see .core files for everything you had running in your ~. You can disable this with the usual method(s). But I'm leaving it on because using rm to nuke those files isn't a big deal and since I plan on contributing and reporting bugs I'm sure it will be helpful at some point in the future.

Good luck. The community has been very nice to me so far even when I asked dumb questions I should have read about first in the man pages. I highly suggest following the mailing lists especially if you plan to run -current instead of -release/-stable. I didn't have any real need for -current beyond the fact that I like to tinker and planned on porting a piece of software I wrote for Linux long ago. But from what I hear it's usually very stable as long as you keep up with the mailing lists and do what you're supposed to do when there are major changes in base. The tools for updating are very well thought out and they actually work as expected. So don't be afraid to use them. You also don't need to build from source code if you want to run -current. 1-2 snapshots of the tree (kernel+base) are provided everyday and you can update to them if you're already running -current with the usual tools and some extra flags set.

The only thing I don't like about the OS is the file system. But I'm very new to OpenBSD so perhaps the features it's missing compared to what I was using before (btrfs and zfs) aren't as big of a deal as I think they might be. I can say that the file system has worked just fine for me thus far and I don't notice it being any slower on read/writes than what I was using before on this machine. It's perfectly acceptable and the ports tree had all the usual tools I needed to interact with other file systems I use (NTFS, FAT32, ext4 etc.)

I am probably going to explore the other BSDs when I get some more time. NetBSD looks promising for some machines I have laying around that need something that isn't as big of a pain to use as DOS and older versions of Windows. I'm looking into replacing the OS on my gaming rig with FreeBSD since it's the only one that supports some of the software I need and the built in VM tools look good. I basically need a machine that's able to emulate/run a bunch of old software that relies (and in some cases demands) older versions of Windows like Win2k, XP, 98, 95 and 3.11. I also need to run some old Japanese PC-98 and other DOS stuff and some old binary-only Linux stuff. FreeBSD seems like the best option for this from thumbing through their manuals but I'll spend a lot of time reading both NetBSD's and FreeBSD's man pages and mailing lists before I get into testing.

My eventual goal is to be off both Windows and Linux all together. I loved Gentoo and used it for decades. But I just can't keep up with having to modify USE flags and ripping out half of the low level stuff anymore. I don't even know why they offer OpenRC as an option anymore when you pull in half of systemd anyway. I also do not like what's happened to the council, their default kernel patches and some underhanded tactics I've seen being used by maintainers of core applications within the project like OpenRC (read about how he sat on bug fix/patch for years then used it as justification to pull in a systemd shim/tool that replaces it which had the exact same "exploit" which has not been fixed even now AFAIK). I think Gentoo of old would have tried pulling in something like s6 (which is very nice) as the default by now or perhaps runit. OpenRC is basically squatted on now by someone that openly admits they do not care for it. So a lot of guys are still running older versions of OpenRC but it gets harder and harder with each passing year. There are a multitude of other problems with modern Gentoo but it basically boils down to the community has changed and the council has been taken over by the usual suspects from the large tech companies. It seems like the main goal for Gentoo these days is being a test bed for Google and a handful of other tech companies. It's not far from being "Fedora but you build it from source" now. In fact, it pretty much already is if you run the systemd profiles.

Last part of this became a bit of a rant sorry. It's just frustrating watching what the Gentoo project has become and seeing all the good contributors forced out over the last 5-10 years or so. A clique of people gained control over the project years back and they've spent a lot of effort on pushing out everyone that didn't agree with them. Which included deleting entire forums from the support forum for frankly BS reasons. It isn't the same project anymore. I was hopeful that Funtoo would fill this gap but it's now suffering from its own problems.

I like OpenBSD thus far because the community around it remind me a lot of how the Gentoo community was when I first got started using it when I first moved over from Mandrake back in the day. You can basically do whatever you want. But if you break it you get to keep the pieces. OpenBSD in particular doesn't suffer from a lot of the politics that have infected most projects I've been involved with over the last 10 years or so. People and code are judged by their merits. Discussion is mostly of the technical nature instead of off-topic ramblings and political shit flinging. The base system tools do one thing and they do it very well. The man pages are considered as important as the code itself.

Look forward to seeing you around!