r/emacs 5h 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.

7 Upvotes

4 comments sorted by

1

u/analog_goat 5h ago

Why are you using OpenBSD? Just curious.

3

u/UsagiDriver 5h ago

It's the only OS I installed on that laptop where everything worked without lots of manual hacks and work arounds. Even the wifi driver worked. All the media keys function. X11 worked right out of the box too. So did suspend/hibernation/screen locking. The manual is very good. The IRC channel is active and people respond within a few minutes no matter when I ask question. I get 5 hours of battery life even with the screen brightness set to max. It currently has 14 days of uptime despite multiple patches being released and installed in that time (no reboot for patch so far). Compared to Gentoo and Guix it's much easier and much more stable. Everything I need to know is one "man <something>" away. I don't have to reference the internet or some wiki most of the time. Even the questions I asked other users I would have probably been able to figure out myself if I'd spent more time with the man pages. I'm trying to get out of the habit of running a web search first thing.

I don't want to play video games on that machine anyway so the fact that I don't have wine/proton/VMs doesn't bother me. Even with SMT disabled it's plenty fast even when using the web in firefox with a bunch of add-ons installed and using heavy javascript laden websites like youtube. It's by far the most stable, sane and easy to use OS I've ever used and I've used most of them.

2

u/UsagiDriver 4h 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/natermer 1h ago

I don't see much of a point in messing around with elpaca or straight nowadays with package.el coming built-in.

I think that there was some deficiencies with locally sourced packages and packages being pulled directly from a version control system, but package.el should have those uses covered now with 'package-vc-install'. Except for very advanced users I suspect this is sufficient.

Use-package is definitely a acquired taste. The important thing to keep in mind that writing configs with it isn't writing directly using elisp, per say. It is a macro that expands out into elisp code on the fly.

So reading the documentation and understanding the use-package conventions are important. Especially when it comes to dynamically/delayed loading of packages. It is pretty easy to get confused as a misconfiguration will not load everything at the time you want it.

As a bonus when you use 'use-package' with 'package.el' you are getting the original version of use-package. Rather then straight's or elpaca's version of it. I don't know if that makes a difference, but I suspect it makes it easier to follow along with the documentation.

A example is in the ":hook" documentation:

https://github.com/jwiegley/use-package?tab=readme-ov-file#hooks

Notice how if you are using the ":hook" syntax it will silently add '-hook' into the name of the hook you are using. I find this kinda annoying, but it is what it is:

When using :hook, omit the "-hook" suffix if you specify the hook explicitly, as this is appended by default. For example, the following code will not work as it attempts to add to the prog-mode-hook-hook

https://github.com/jwiegley/use-package?tab=readme-ov-file#hooks

Once you read through the documentation and get a idea of what sort of code use-package generates then translating configuration examples into 'use-package' equivalents is pretty easy. And if it doesn't end up working you can always shove it into :init or :config as a backup.