@ -1,3 +1,10 @@
* Benchmark
#+BEGIN_SRC emacs-lisp
(use-package benchmark-init
:ensure t
:config
(add-hook 'after-init-hook 'benchmark-init/deactivate))
#+END_SRC
* macros
* macros
** definteractive
** definteractive
Wrappers around functions and lambdas so I don't have to type
Wrappers around functions and lambdas so I don't have to type
@ -12,8 +19,8 @@ Wrappers around functions and lambdas so I don't have to type
`(lambda ,(car body) (interactive) ,@(cdr body)))
`(lambda ,(car body) (interactive) ,@(cdr body)))
#+END_SRC
#+END_SRC
** local-keybind
** local-keybind
Hide unecessary lambda when calling (local-set-key) for org-mode
Hide unecessary lambda when calling (local-set-key) for
functions
org-mode functions
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(defmacro local-keybind (key value)
(defmacro local-keybind (key value)
`(lambda () (local-set-key (kbd ,key) (quote ,value))))
`(lambda () (local-set-key (kbd ,key) (quote ,value))))
@ -36,6 +43,9 @@ Saves config.org if it's open then reloads the file.
;; I read somewhere that Company breaks things?
;; I read somewhere that Company breaks things?
(add-hook 'org-mode-hook 'company-mode)
(add-hook 'org-mode-hook 'company-mode)
;; Don't indent whole file with org-mode
(eval-after-load "org-mode" (local-set-key (kbd "s-i") nil))
#+END_SRC
#+END_SRC
** Snippets
** Snippets
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
@ -66,7 +76,7 @@ Saves config.org if it's open then reloads the file.
(add-hook 'org-mode-hook (local-keybind "C-c o l" manx/delete-org-link))
(add-hook 'org-mode-hook (local-keybind "C-c o l" manx/delete-org-link))
#+END_SRC
#+END_SRC
*** Inline Images
*** Inline Images
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(setq org-image-actual-width 150)
(setq org-image-actual-width 150)
(definteractive manx/org-insert-link ()
(definteractive manx/org-insert-link ()
@ -74,10 +84,10 @@ Saves config.org if it's open then reloads the file.
(org-redisplay-inline-images))
(org-redisplay-inline-images))
(add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link))
(add-hook 'org-mode-hook (local-keybind "C-c C-l" manx/org-insert-link))
#+END_SRC
#+END_SRC
* emacs gui
* emacs gui
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(tool-bar-mode -1)
1 (tool-bar-mode -1)
(menu-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(scroll-bar-mode -1)
(line-number-mode 1)
(line-number-mode 1)
@ -89,41 +99,41 @@ Saves config.org if it's open then reloads the file.
* functions
* functions
** text
** text
*** kill whole word
*** kill whole word
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(definteractive manx/kill-whole-word ()
(definteractive manx/kill-whole-word ()
(backward-word)
(backward-word)
(kill-word 1))
(kill-word 1))
(global-set-key (kbd "C-c k w") 'manx/kill-whole-word)
(global-set-key (kbd "C-c k w") 'manx/kill-whole-word)
#+END_SRC
#+END_SRC
*** kill whole line
*** kill whole line
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(definteractive manx/kill-whole-line()
(definteractive manx/kill-whole-line()
(move-beginning-of-line nil)
(move-beginning-of-line nil)
(kill-whole-line))
(kill-whole-line))
(global-set-key (kbd "C-c k l") 'manx/kill-whole-line)
(global-set-key (kbd "C-c k l") 'manx/kill-whole-line)
#+END_SRC
#+END_SRC
*** revert buffer
*** revert buffer
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-c r b") 'revert-buffer)
(global-set-key (kbd "C-c r b") 'revert-buffer)
#+END_SRC
#+END_SRC
*** Format whole file
*** Format whole file
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(definteractive manx/format-whole-buffer()
(definteractive manx/format-whole-buffer()
(save-excursion
(save-excursion
(indent-region (point-min) (point-max) nil)))
(indent-region (point-min) (point-max) nil)))
(global-set-key (kbd "s-i") 'manx/format-whole-buffer)
(global-set-key (kbd "s-i") 'manx/format-whole-buffer)
#+END_SRC
#+END_SRC
*** colour under cursor
*** colour under cursor
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(defun what-face (pos)
(defun what-face (pos)
(interactive "d")
(interactive "d")
(let ((face (or (get-char-property (pos) 'read-face-name)
(let ((face (or (get-char-property (pos) 'read-face-name)
(get-char-property (pos) 'face))))
(get-char-property (pos) 'face))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
(if face (message "Face: %s" face) (message "No face at %d" pos))))
#+END_SRC
#+END_SRC
** buffers
** buffers
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(global-set-key (kbd "C-x k") (lambdainteractive () (kill-buffer (current-buffer))))
(global-set-key (kbd "C-x k") (lambdainteractive () (kill-buffer (current-buffer))))
@ -131,7 +141,7 @@ Saves config.org if it's open then reloads the file.
#+END_SRC
#+END_SRC
** frames
** frames
*** transpose-frame
*** transpose-frame
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
;; This is only used here for now but we should still more it some
;; This is only used here for now but we should still more it some
;; time
;; time
(add-to-list 'load-path "~/.emacs.d/scripts/ ")
(add-to-list 'load-path "~/.emacs.d/scripts/ ")
@ -140,9 +150,9 @@ Saves config.org if it's open then reloads the file.
(global-set-key (kbd "C-c f t") 'transpose-frame)
(global-set-key (kbd "C-c f t") 'transpose-frame)
(global-set-key (kbd "C-c f i") 'flip-frame)
(global-set-key (kbd "C-c f i") 'flip-frame)
(global-set-key (kbd "C-c f o") 'flop-frame)
(global-set-key (kbd "C-c f o") 'flop-frame)
#+END_SRC
#+END_SRC
*** split and follow
*** split and follow
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(defmacro manx/split-and-follow (direction)
(defmacro manx/split-and-follow (direction)
`(progn
`(progn
,direction
,direction
@ -151,25 +161,31 @@ Saves config.org if it's open then reloads the file.
(global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below))))
(global-set-key (kbd "C-x 3") (lambdainteractive () (manx/split-and-follow (split-window-below))))
(global-set-key (kbd "C-x 2") (lambdainteractive () (manx/split-and-follow (split-window-horizontally))))
(global-set-key (kbd "C-x 2") (lambdainteractive () (manx/split-and-follow (split-window-horizontally))))
#+END_SRC
#+END_SRC
* use-package
* use-package
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(setq use-package-always-ensure t
(setq use-package-always-ensure t
use-package-verbose t)
use-package-verbose t)
#+END_SRC
#+END_SRC
** diminish
#+BEGIN_SRC emacs-lisp
(use-package diminish)
#+END_SRC
** keychain-environment
** keychain-environment
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package keychain-environment
(use-package keychain-environment
:bind ("C-c r e" . 'keychain-refresh-environment))
:bind ("C-c r e" . 'keychain-refresh-environment)
:init (keychain-refresh-environment))
#+END_SRC
#+END_SRC
** exwm
** exwm
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(unless (display-graphic-p)
(use-package exwm
(use-package exwm
:bind ("s-k" . 'exwm-workspace-delete)
:bind ("s-k" . 'exwm-workspace-delete)
:config
:config
(require 'exwm-config)
(require 'exwm-config)
(require 'exwm-systemtray)
(require 'exwm-systemtray)
(exwm-systemtray-enable))
(exwm-systemtray-enable) ))
#+END_SRC
#+END_SRC
** nginx
** nginx
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
@ -179,10 +195,6 @@ Saves config.org if it's open then reloads the file.
(nginx-indent-level 2)
(nginx-indent-level 2)
:config (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/ " . nginx-mode)))
:config (add-to-list 'auto-mode-alist '("/nginx/sites-\\(?:available\\|enabled\\)/ " . nginx-mode)))
#+END_SRC
#+END_SRC
** diminish
#+BEGIN_SRC emacs-lisp
(use-package diminish)
#+END_SRC
** company
** company
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package company
(use-package company
@ -194,17 +206,17 @@ Saves config.org if it's open then reloads the file.
(company-minimum-prefix-length 3)
(company-minimum-prefix-length 3)
:init (add-hook 'after-init-hook 'global-company-mode))
:init (add-hook 'after-init-hook 'global-company-mode))
#+END_SRC
#+END_SRC
** omnisharp
** c#
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package csharp-mode
(use-package csharp-mode
:defer t
:defer t
:config ((use-package omnisharp
:config
:config (add-hook 'csharp-mode-hook 'omnisharp-mode))))
(use-package omnisharp
:defer t
(eval-after-load 'company
:config
'(add-to-list 'company-backends 'company-omnisharp))
(add-hook 'csharp-mode-hook 'omnisharp-mode)
(add-to-list 'company-backends 'company-omnisharp)))
(add-hook 'csharp-mode #'company-mode)
#+END_SRC
#+END_SRC
** spaceline
** spaceline
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
@ -214,7 +226,6 @@ Saves config.org if it's open then reloads the file.
(setq powerline-default-seperator (quote arrow))
(setq powerline-default-seperator (quote arrow))
(spaceline-spacemacs-theme)
(spaceline-spacemacs-theme)
:config (spaceline-toggle-buffer-size-off))
:config (spaceline-toggle-buffer-size-off))
#+END_SRC
#+END_SRC
** dashboard
** dashboard
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
@ -260,50 +271,48 @@ Saves config.org if it's open then reloads the file.
:defer t
:defer t
:config (use-package alchemist))
:config (use-package alchemist))
#+END_SRC
#+END_SRC
** yasnippet
#+BEGIN_SRC emacs-lisp
(use-package yasnippet
:diminish 'yas-minor-mode
:hook ((html-mode
LaTeX-mode
emacs-lisp-mode
lisp-mode)
. yas-minor-mode)
:init
(use-package yasnippet-snippets)
(yas-reload-all))
#+END_SRC
** minor modes
** minor modes
*** hungry delete
*** hungry delete
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package hungry-delete
(use-package hungry-delete
:diminish 'hungry-delete-mode
:diminish 'hungry-delete-mode
:config (global-hungry-delete-mode 1))2
:config (global-hungry-delete-mode 1))
#+END_SRC
#+END_SRC
*** which key
*** which key
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package which-key
(use-package which-key
:diminish 'which-key-mode
:diminish 'which-key-mode
:config (which-key-mode))
:config (which-key-mode))
#+END_SRC
#+END_SRC
*** avy
*** avy
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package avy
(use-package avy
:bind ("M-s" . avy-goto-char))
:bind ("M-s" . avy-goto-char))
#+END_SRC
#+END_SRC
*** beacon
*** beacon
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package beacon
(use-package beacon
:diminish 'beacon-mode
:diminish 'beacon-mode
:config (beacon-mode 1))
:config (beacon-mode 1))
#+END_SRC
#+END_SRC
*** popup kill ring
*** popup kill ring
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(use-package popup-kill-ring
(use-package popup-kill-ring
:bind ("M-y" . popup-kill-ring))
:bind ("M-y" . popup-kill-ring))
#+END_SRC
#+END_SRC
*** yasnippet
#+BEGIN_SRC emacs-lisp
(use-package yasnippet
:diminish 'yas-minor-mode
:bind
:init
(use-package yasnippet-snippets)
(yas-reload-all))
#+END_SRC
**** enable for major modes
#+BEGIN_SRC emacs-lisp
(add-hook 'html-mode-hook 'yas-minor-mode)
(add-hook 'LaTeX-mode-hook 'yas-minor-mode)
(add-hook 'emacs-lisp-mode 'yas-minor-mode)
#+END_SRC
* ido
* ido
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(setq ido-enable-flex-matching t
(setq ido-enable-flex-matching t
@ -339,14 +348,14 @@ Saves config.org if it's open then reloads the file.
#+END_SRC
#+END_SRC
** terminal
** terminal
*** Make bash implicit terminal
*** Make bash implicit terminal
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(defvar my-term-shell "/bin/bash")
(defvar my-term-shell "/bin/bash")
(defadvice ansi-term (before force-bash)
(defadvice ansi-term (before force-bash)
(interactive (list my-term-shell)))
(interactive (list my-term-shell)))
(ad-activate 'ansi-term)
(ad-activate 'ansi-term)
(global-set-key (kbd "<s-return >") 'ansi-term)
(global-set-key (kbd "<s-return >") 'ansi-term)
#+END_SRC
#+END_SRC
** minor things
** minor things
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
(show-paren-mode 1)
(show-paren-mode 1)
@ -376,7 +385,7 @@ Saves config.org if it's open then reloads the file.
(defvaralias 'css-indent-offset 'tab-width)
(defvaralias 'css-indent-offset 'tab-width)
#+END_SRC
#+END_SRC
* auto-minor-mode
* auto-minor-mode
auto-mode-alist but for minor modes.
auto-mode-alist for minor modes.
For example, used with sensitive-mode to not create backups
For example, used with sensitive-mode to not create backups
(path/to/file~) when creating yasnippets
(path/to/file~) when creating yasnippets
@ -402,7 +411,7 @@ For example, used with sensitive-mode to not create backups
(funcall (cdar alist) 1))
(funcall (cdar alist) 1))
(setq alist (cdr alist))))))
(setq alist (cdr alist))))))
(add-hook 'find-file-hook #'enable-minor-mode-based-on-extension)
(add-hook 'find-file-hook#'enable-minor-mode-based-on-extension)
#+END_SRC
#+END_SRC
* sensitive-minor-mode
* sensitive-minor-mode
#+BEGIN_SRC emacs-lisp
#+BEGIN_SRC emacs-lisp
@ -413,24 +422,16 @@ For example, used with sensitive-mode to not create backups
With no argument, this command toggles the mode.
With no argument, this command toggles the mode.
Non-null prefix argument turns on the mode.
Non-null prefix argument turns on the mode.
Null prefix argument turns off the mode."
Null prefix argument turns off the mode."
;; The initial value.
nil ;; Initial
nil
"Sensitive" ;; Modeline
;; The indicator for the mode line.
nil ;; Bindings
" Sensitive"
;; The minor mode bindings.
nil
(if (symbol-value sensitive-minor-mode)
(if (symbol-value sensitive-minor-mode)
(progn
(progn
;; disable backups
(setq make-backup-files nil)
(set (make-local-variable 'backup-inhibited) t)
(auto-save-mode -1))
;; disable auto-save
(setq-local make-backup-files t)
(if auto-save-default
(auto-save-mode 1)))
(auto-save-mode -1)))
;resort to default value of backup-inhibited
(kill-local-variable 'backup-inhibited)
;resort to default auto save setting
(if auto-save-default
(auto-save-mode 1))))
;; Regexps of sensitive files.
;; Regexps of sensitive files.
(setq auto-minor-mode-alist
(setq auto-minor-mode-alist