About

These are some customizations I've made to Emacs that other people might benefit from. They're small groups of settings or single functions and as such don't warrant making into packages.

Open File Browser

Just as the docstring says, the following function opens the current buffer's parent directory in Dolphin.

(defun browse-file-directory () (interactive)
  "Open the current file's directory in the dolphin file browser."
  (start-process "browse-dir" nil "dolphin" "."))

Open Init File

Function and shortcut to open the emacs init file. Put it at the top of your init file. This way it will still be evaluated when you mess up the init file, so you can use it to quickly open the file and correct the error.

(defun edit-user-init-file () (interactive) (find-file user-init-file))
(global-set-key (kbd "<f7>") 'edit-user-init-file)

Managing Multiple SLIME REPLs

When you run a command like slime-eval-defun the expression gets sent to the "default" connection (basically the most recently created REPL/Lisp process). So working with multiple REPLs at the same time is a bit of a pain. You can change the default connection with slime-list-connections, but this is a chore to do every time you switch between the REPLs. This function will assign the buffer to use the default connection at the time of calling the function. This way creating new REPLs or changing the default connection won't change which connection the buffer uses. See the SLIME documentation for more details.

tab-bar Cosmetics

These are purely visual changes to make tab-bar look a bit nicer. Final result:

;; Add spaces around tab titles to make them less cluttered
(defun custom-tab-bar-name () (concat "   " (tab-bar-tab-name-current) "   "))

This also requires you to customize tab-bar-tab-name-function to custom-tab-bar-name.

Customize tab-bar-show to 1 so it only shows tabs when there is more than one of them.

Face customizations:

  • tab-bar: background "gray30"
  • tab-bar-tab: background "gray95", foreground "black", box: (line-width 3, color "gray95")
  • tab-bar-tab-inactive: background "gray15", foreground "white", box: (line-width 3, color "gray15")

Also set tab-bar-show to 1 so you only see the tab bar if there is only one tab.