legacy-dotfiles/.emacs.d/init.org

2.9 KiB

Emacs init

Emacs init

Before doing anything else I should make sure that both the directories /usr/local/emacs/share/emacs/site-lisp and /usr/share/emacs/site-list are included in load-path, along with their subdirectories, but only if they haven't already been added and exist. Place them at the end of load-path so they don't mess up package precedence.

  (eval-and-compile
    (defun oni:path-init (dir)
      "Add DIR to `load-path' and all its subdirectories, unless
      DIR is already in `load-path'."
      (unless (or (member dir load-path) (not (file-exists-p dir)))
        (let ((default-directory dir))
          (add-to-list 'load-path dir t)
          (normal-top-level-add-subdirs-to-load-path))))
    (oni:path-init "/usr/share/emacs/site-lisp")
    (oni:path-init "/usr/local/emacs/share/emacs/site-lisp"))

Add my project /ryuslash/legacy-dotfiles/src/commit/5a1e9f2ea8ec2b7e625539ee2bd4006dce269eb2/.emacs.d/yoshi-theme to custom-theme-load-path and load it.

  (add-to-list 'custom-theme-load-path "~/projects/emacs/yoshi-theme/")
  (load-theme 'yoshi t)

Remove the menu-bar, tool-bar and scroll-bar from the UI since I don't use them at all.

  (menu-bar-mode -1)
  (scroll-bar-mode -1)
  (tool-bar-mode -1)

Add any other interesting paths to load-path and, if it exists, load the loaddefs.el file from these directories.

  (mapc #'(lambda (dir)
            (add-to-list 'load-path dir)
            (let ((loaddefs (concat dir "/loaddefs.el")))
              (when (file-exists-p loaddefs)
                (load loaddefs))))
        '("~/projects/emacs/mode-icons" "~/.emacs.d/site-lisp"
          "~/projects/emacs/pony-mode/src" "~/projects/emacs/php-mode"))

Don't ask yes or no, ask y or n, I've never had an accidental y so far.

  (defalias 'yes-or-no-p 'y-or-n-p)

Use ibuffer instead of the default list-buffers because it has many more features.

  (defalias 'list-buffers 'ibuffer)

Do the same with hippie-expand and dabbrev-expand.

  (defalias 'dabbrev-expand 'hippie-expand)

Don't show it when eldoc is running, I almost assume that it is whenever I'm working in a mode that supports it anyway. This should only execute once eldoc has been loaded.

  (eval-after-load "eldoc" '(diminish 'eldoc-mode))