mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 10:31:23 -08:00
When a file is visited via `emacsclient`, server.el does the following
in this order:
- create a buffer `b` visiting the file
- run `(set-buffer b)`
- trigger `server-visit-hook`
- run `(switch-buffer b)`
- trigger `server-switch-hook`
Thus, the right hook for `doom-run-switch-buffer-hooks-h` is
`server-switch-hook` because the "switch buffer" hooks may assume that
the buffer has already been switched to.
This fixes an org error that occurs when running
emacsclient --create-file --no-wait foo.txt
while there's a frame containing an org-roam file. Without this commit,
the server will create a new frame and set the current buffer to
foo.txt. But the new frame will still display the (duplicated) window
for the org-roam file. Then `server-visit-hook` will be triggered and
eventually run `+org-roam-manage-backlinks-buffer-h`, which will try to
enable the org-roam backlinks buffer. But this will error because the
current buffer is not an org(-roam) buffer.
Amend:
|
||
|---|---|---|
| .. | ||
| cli | ||
| lib | ||
| .doommodule | ||
| demos.org | ||
| doom-cli.el | ||
| doom-compat.el | ||
| doom-editor.el | ||
| doom-elpaca.el | ||
| doom-keybinds.el | ||
| doom-lib.el | ||
| doom-projects.el | ||
| doom-start.el | ||
| doom-straight.el | ||
| doom-ui.el | ||
| doom.el | ||
| init.el | ||
| packages.el | ||