`sudo systemctl suspend` wasn't working because it required a secure password
prompt to read the user's password for `sudo`. The recommended way to call
`shell-command` with a `sudo` command (from what I read online) is to set
`default-directory` to `/sudo::` before calling `shell-command`. This works just
fine, so I refactored the function, `window-manager-logout`.
When `keybindings` requires `window-manager`, the `evil-want-integration`
warning emerges. If I remove the `evil` dependency from `window-manager`, it
resolves the issue.
I was tired of using `arandr` to manually configure my monitor positions, so I
encoded the settings in Elisp in the `display.el` module.
TL;DR:
- Drop support for `position` kwarg in `display-register` macro
- Support `coords` kwarg in `display-register`.
- `defconst` the `xrandr` arguments and command in `display-register`.
- Define `display-arrangement` macro that consumes the `xrandr` arguments that
`display-register` defines to create an interactive function,
`display-arrange-<NAME>`, which -- when invoked -- runs one xrandr command to
configure a display "arrangement".
Why didn't I configure this earlier? For years, my workflow involved checking a
buffer's major mode and then extending that major-mode's hook. Confusingly (to
me), the `major-mode` for `COMMIT_EDITMSG` is `text-mode`, and I didn't want to
disable `company-mode` for *all* `text-mode` buffers, which is what the
following would have done:
```elisp
(add-hook 'text-mode-hook (lambda () (company-mode -1))
```
Thankfully I recently invested some time into learning more about Emacs's
offline help system, `Info-mode`, so -- putting that knowledge to work -- I ran
`info-apropos` and searched "magit commit". After ~5 minutes of reading I knew
the recommended way of configuring this was to modify `git-commit-setup-hook`.
How validating!
I want to couple my EXWM workspaces with monitors. E.g. - I'd like my "Chatter"
workspace to prefer my `4k-vertical`. This change supports that.
I also did a small amount of formatting, which I don't think belongs in a
separate commit.
My newly minted macro for defining monitors introduced two bugs:
1. Laptop defined its position in terms of 4k-horizontal and 4k-horizontal
defined its position in terms of laptop, I introduced a circular dependency.
2. The identifier, `laptop-monitor`, which `window-manager.el` depends on, is
now defined as `laptop`.
A friendly reminder to myself to always test new Emacs builds to make sure that
everything can initialize properly. This is something that my CI should be
automating, but ever since I moved flats, I lost my CI and need to restore it.
This is another reminder to drop into a TTY when Emacs fails to initialize, run
`nix-env --rollback`, then attempt to restart X. But this time, debugging this
entirely from a TTY wasn't so disappointing.
I recently acquired a new monitor, which I'm orienting vertically for logs,
chats, etc. As such I needed to add more functions, KBDs to wrangle the
setup. To DRY up my code, I define a macro, `display-register`, as a DSL for
supporting new monitors. This:
- defines two functions for enabling and disabling the displays
- defines a constant, `display-<name>`
It's basically just a wrapper around `xrandr`, and that's good enough for now.
My modeline was displaying the local time (not UTC time) and appending the UTC
timezone offset, which was confusing me.
When it was `00:03` in London, my modeline would read `00:03+01`. One way of
interpreting this is that it's `00:03` in London and the `+01` is a reminder
that I'm one hour ahead of UTC. However, I was reading it as though it was
`00:03` UTC and thus `01:03` in London.
I had to set `display-time-string-forms` instead of `display-time-string` to
pass the `t` argument to the `ZONE` parameter to indicate that I'd prefer to use
UTC time and not local time when expanding the variables.
My custom language settings conflict with Google-Emacs's language settings, and
I'm not interested in finding a more harmonious solution. For now, I'm dropping
my settings altogether in favor of Google-Emacs's settings.
I was previously relying on the variable `server-process` being set, but this
only resulted in false-negatives and broken initializations. This should make my
Emacs initialization more stable.
In the past I used `defconst` in many of my Elisp libraries where I should've
used something like:
```elisp
;; some/path/to/some-lib.el
(defgroup some-lib nil)
(defcustom some-lib-setting nil
:group 'some-lib)
```
When I encounter code that I should've structured this way, I'm cleaning it up
to prefer this more idiomatic pattern.
While attempting to debug why pressing `C-s-s` from an X-window screenshots my
entire screen, I switched from `call-process` to `make-process`, which is
async.
I still haven't debugged the original issue, but I think this is an improvement
regardless.