Pin Emacs buffers to windows (for cscope)

Put this in your .emacs file: ;; Toggle window dedication (defun toggle-window-dedicated () “Toggle whether the current active window is dedicated or not” (interactive) (message (if (let (window (get-buffer-window (current-buffer))) (set-window-dedicated-p window (not (window-dedicated-p window)))) “Window ‘%s’ is dedicated” “Window ‘%s’ is normal”) (current-buffer))) Then bind it to some key – I use the Pause … Read more

Emacs: Tramp doesn’t work

If the account you’re connecting to uses some weird fancy shell prompt, then there is a good chance that this is what makes tramp trip. Log in as root, then enter PS1=”> ” (that’s a normal, standard shell (ZSH, BASH, younameit) prompt, one that tramp will understand) then switch to the user account, and launch … Read more

eval-after-load vs. mode hook

Code wrapped in eval-after-load will be executed only once, so it is typically used to perform one-time setup such as setting default global values and behaviour. An example might be setting up a default keymap for a particular mode. In eval-after-load code, there’s no notion of the “current buffer”. Mode hooks execute once for every … Read more

tech