-
Launch Emacs quicker
- How?
- Start Emacs server first (if not already running), then launch
emacsclient
- Start Emacs server first (if not already running), then launch
- How?
-
Launch different Emacs servers in different sessions
- Ex: different servers for different
tmuxsessions and GUI mode. - Why?
- We can work on one git repository in one
tmuxsession by isolating opened buffers and tags tables (visit-tags-table).
- We can work on one git repository in one
- Ex: different servers for different
Use the qe command to replace emacs -nw:
$ qe
$ qe [files-to-edit]Use the qew command to replace emacs (GUI mode):
$ qew
$ qew [files-to-edit]If you want to kill the background server process to save memory,
M-x kill-emacs to kill all the clients and the server in the current
session. But the startup latency will increase next time when you run qe/qew again.
C-h v server-name(the currrent Emacs server/socket name)
If you want to run multiple qe in tmux to look like a tab-like UI,
add this to .emacs:
(defun inside-tmux-p ()
"Return non-nil if Emacs is running inside a tmux session."
(getenv "TMUX"))
(defun my-truncate-string (string max-length)
(if (<= (length string) max-length)
string
(concat (substring string 0 max-length) "..")))
(defun update-tmux-title ()
"Update tmux window name to the current Emacs buffer's name."
(when (inside-tmux-p)
(let ((filename (or (buffer-file-name) (buffer-name))))
(call-process-shell-command (concat "tmux rename-window " "'e:" (my-truncate-string (file-name-nondirectory filename) 15) "'")))))
(add-hook 'window-configuration-change-hook 'update-tmux-title)- Recommended to use Homebrew to install Emacs with both GUI and terminal support:
$ brew install --cask emacs- Homebrew may register Emacs server in the background with
LaunchServicesof Mac OS:
# Check
$ brew services list
# Stop it if you want
$ brew services stop emacs