Update 2018/10/28

This commit is contained in:
2018-10-23 08:07:35 -07:00
parent 980cd34342
commit c4cba4277a
2 changed files with 133 additions and 22 deletions

3
.emacs
View File

@@ -1,9 +1,10 @@
;; Load all of my config from the org file init.org
;; (package-initialize)
(package-initialize)
(require 'org)
(org-babel-load-file
(expand-file-name "init.org"
user-emacs-directory))
(put 'downcase-region 'disabled nil)

View File

@@ -18,7 +18,8 @@ Setup use-package and configure it to always install missing packages.
(setq use-package-always-ensure t)
#+END_SRC
Ensure that emacs doesn't add a custom file which will add configuration that isn't in described this file.
Ensure that emacs doesn't add a custom file which will add
configuration that isn't in described this file.
#+BEGIN_SRC emacs-lisp
(setq custom-file "/dev/null")
@@ -27,6 +28,7 @@ Ensure that emacs doesn't add a custom file which will add configuration that is
Configure some startup parameters.
#+BEGIN_SRC emacs-lisp
(set-background-color "#000000")
(line-number-mode t)
(column-number-mode t)
(setq inhibit-splash-screen t)
@@ -36,23 +38,30 @@ Configure some startup parameters.
(savehist-mode t)
#+END_SRC
Winner-mode keeps a history of window configurations. Handy when magit decides to blow away, or I hit the wrong key and blow away my windows.
On ChromeOS, M-DEL is mapped to <deletechar>, so remap fix up.
#+BEGIN_SRC emacs-lisp
(winner-mode 1)
;; TODO: Figure out how to make this conditional on ChromeOS
(global-set-key (kbd "<deletechar>") 'backward-kill-word)'
#+END_SRC
Winner-mode keeps a history of window configurations. Handy when magit
decides to blow away, or I hit the wrong key and blow away my windows.
#+BEGIN_SRC emacs-lisp
;(global-hl-line-mode 1)
;(set-face-attribute 'default nil :background "gray15")
;(set-face-attribute 'hl-line nil :foreground nil :background "#0c0c0c")
;(set-face-background hl-line-face "#0c0c0c")
;(set-face-foreground hl-line-face nil)
(winner-mode t)
#+END_SRC
By default, if you a region selected and hit "backspace" it does not
actually delete the region, which is weird to me. This changes that
behavior.
#+BEGIN_SRC emacs-lisp
(setq delete-active-region t)
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package org-journal
:config (setq org-journal-dir "~/notes/journal/")
:bind (("C-c C-j" . org-journal-new-entry)))
#+END_SRC
@@ -67,7 +76,8 @@ Winner-mode keeps a history of window configurations. Handy when magit decides t
#+END_SRC
Install magit, and explicitly call out with-editor as well, even though its a requirement for magit.
Install magit, and explicitly call out with-editor as well, even
though its a requirement for magit.
#+BEGIN_SRC emacs-lisp
(use-package magit)
@@ -77,18 +87,43 @@ Install magit, and explicitly call out with-editor as well, even though its a re
Multi-term is useful for having multiple terminal buffers.
#+BEGIN_SRC emacs-lisp
(use-package multi-term)
(use-package multi-term
:config
(add-hook 'term-mode-hook
(lambda ()
(dolist
(bind
'(("C-<backspace>" . term-send-backward-kill-word)
("C-<delete>" . term-send-forward-kill-word)
("C-<left>" . term-send-backward-word)
("C-<right>" . term-send-forward-word)
("C-c C-j" . term-line-mode)
("C-c C-k" . term-char-mode)
("C-r" . term-send-reverse-search-history)
("C-v" . scroll-up)
("C-y" . term-paste)
("C-z" . term-stop-subjob)
("C-p" . term-send-prior)
("C-n" . term-send-next)
("M-p" . scroll-up-line)
("M-n" . scroll-down-line)
("M-DEL" . term-send-backward-kill-word)
("M-d" . term-send-forward-kill-word)
("M-r" . isearch-backward)
("M-s" . term-send-forward-kill-word)))
(add-to-list 'term-bind-key-alist bind)))))
#+END_SRC
Eyebrowse is a package for managing multiple simultaneous window configurations.
Eyebrowse is a package for managing multiple simultaneous window
configurations.
#+BEGIN_SRC emacs-lisp
(use-package eyebrowse
:config (eyebrowse-mode t))
#+END_SRC
Install helm, a completion framework, and install its functions over some of the usual emacs keybinds.
Install helm, a completion framework, and install its functions over
some of the usual emacs keybinds.
#+BEGIN_SRC emacs-lisp
(use-package helm
@@ -107,7 +142,8 @@ Install projectile for managing buffers within projects.
:config (projectile-mode))
#+END_SRC
Install ggtags. It requires that the "gtags" executable be in the users PATH, and is installable on Ubuntu as "global".
Install ggtags. It requires that the "gtags" executable be in the
users PATH, and is installable on Ubuntu as "global".
#+BEGIN_SRC emacs-lisp
(use-package ggtags)
@@ -128,14 +164,16 @@ Add helm-swoop for searching across multiple buffers.
(use-package helm-swoop)
#+END_SRC
Use ws-butler to automatically clean up any trailing whitespace I leave behind. Other lines are left untouched.
Use ws-butler to automatically clean up any trailing whitespace I
leave behind. Other lines are left untouched.
#+BEGIN_SRC emacs-lisp
(use-package ws-butler
:config (ws-butler-global-mode t))
#+END_SRC
Scroll buffers so that the cursor doesn't get too close to the top or bottom of the window.
Scroll buffers so that the cursor doesn't get too close to the top or
bottom of the window.
#+BEGIN_SRC emacs-lisp
(use-package smooth-scrolling
@@ -169,16 +207,21 @@ Disable the mouse too. I don't really need it.
(setq aw-scope 'frame)))
#+END_SRC
C-mode configurations. Set tab width to 4, since that's what I'm used to.
C-mode configurations. Set tab width to 4, since that's what I'm used
to.
#+BEGIN_SRC emacs-lisp
(setq c-default-style "linux" c-basic-offset 4)
(setq-default c-basic-offset 4
tab-width 4
indent-tabs-mode t)
indent-tabs-mode nil)
(add-hook 'c-mode-hook (lambda ()
(setq c-hungry-delete-key t)))
#+END_SRC
Add the ability to toggle a buffer as dedicated to its window, to prevent other buffers from popping into that window. This comes from [[https://emacs.stackexchange.com/questions/2189][StackOverflow]].
Add the ability to toggle a buffer as dedicated to its window, to
prevent other buffers from popping into that window. This comes from
[[https://emacs.stackexchange.com/questions/2189][StackOverflow]].
#+BEGIN_SRC emacs-lisp
(defun toggle-window-dedicated ()
@@ -208,3 +251,70 @@ Configure desktop-save mode to restore lost state on emacs exit.
(add-to-list 'desktop-modes-not-to-save 'dired-mode)
(add-to-list 'desktop-modes-not-to-save 'term-mode)
#+END_SRC
I use replace-string enough to deserve it's own binding.
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c r") 'replace-string)
#+END_SRC
Cycling forward or backward one buffer is handy when using slighty
more buffers than windows, but helm buffers (and others) can really
add a lot of unhelpful buffers. Instead, filter out "boring" buffers.
Boring buffers can still be found via helm/ibuffer.
#+BEGIN_SRC emacs-lisp
(defun buffer-is-boring (buffer)
(or
(string-match-p "^\*" (buffer-name buffer))
(string-match-p "^magit" (buffer-name buffer))))
(defun buffer-iterate (iter-fun)
(let ((bread-crumb (buffer-name)))
(funcall iter-fun)
(while
(and
(buffer-is-boring (current-buffer))
(not (equal bread-crumb (buffer-name))))
(funcall iter-fun))))
(defun my-next-buffer ()
(interactive)
(buffer-iterate 'next-buffer))
(defun my-previous-buffer ()
(interactive)
(buffer-iterate 'previous-buffer))
(global-set-key [remap next-buffer] 'my-next-buffer)
(global-set-key [remap previous-buffer] 'my-previous-buffer)
#+END_SRC
#+BEGIN_SRC emacs-lisp
;; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package clang-format
:commands clang-format clang-format-buffer clang-format-region
#+END_SRC
#+BEGIN_SRC emacs-lisp
(add-to-list 'auto-mode-alist '("\\.ino\\'" . c++-mode))
#+END_SRC