doomemacs/lisp
Tim Ruffing 2395228ff8 fix: Run hooks only after switch-to-buffer for server
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: 4a6de2419c
2025-09-11 23:30:01 -04:00
..
cli tweak(cli): download package archives by default 2025-08-30 13:40:06 +02:00
lib fix(cli): autoloads: type error parsing autoloads 2025-09-03 23:15:57 +02:00
.doommodule feat: add .doommodule files 2024-09-14 20:47:39 -04:00
demos.org refactor: deprecate appendq!, prependq!, & delq! macros 2025-03-25 14:16:56 -04:00
doom-cli.el refactor(cli): doom version: add -v/--verbose option 2025-06-25 17:36:59 +02:00
doom-compat.el fix(lib): major-mode-remap backport for Emacs <30 users 2025-08-31 14:40:31 +02:00
doom-editor.el refactor: remove workarounds for better-jumper 2025-08-30 00:49:00 +02:00
doom-elpaca.el refactor!: restructure Doom core 2024-11-03 01:52:28 -05:00
doom-keybinds.el refactor: deprecate appendq!, prependq!, & delq! macros 2025-03-25 14:16:56 -04:00
doom-lib.el docs(lib): revise various docstrings 2025-05-09 01:14:16 -04:00
doom-projects.el fix: init known projects before projectile-ensure-project 2025-03-30 16:10:23 -04:00
doom-start.el fix: clipboard issues on Windows + WSL 2025-03-26 07:55:36 -04:00
doom-straight.el fix(cli): opt out of snapshots on Windows/BSD systems 2025-09-09 23:45:30 -04:00
doom-ui.el fix: Run hooks only after switch-to-buffer for server 2025-09-11 23:30:01 -04:00
doom.el release(modules): 25.10.0-dev 2025-09-01 22:01:54 +02:00
init.el dev: replace .doomrc w/ .doom.el 2025-06-30 15:23:27 +02:00
packages.el bump: :doom 2025-09-02 00:31:09 +02:00