diff --git a/README.org b/README.org index 3589fe9..59a48f3 100644 --- a/README.org +++ b/README.org @@ -16,8 +16,7 @@ State that we will need package support and define a macro for adding package re ;; add to the package repos (append-to-list package-archives - '(("melpa" . "http://melpa.org/packages/") - ("org-elpa" . "https://orgmode.org/elpa/"))) + '(("melpa" . "http://melpa.org/packages/"))) (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) @@ -28,7 +27,7 @@ State that we will need package support and define a macro for adding package re (use-package gnu-elpa-keyring-update) #+END_SRC -* Fix defaults +* Fix Defaults ** Hide UI elements Remove all those UI elements. They do not look good and waste space. #+BEGIN_SRC emacs-lisp @@ -39,13 +38,13 @@ Remove all those UI elements. They do not look good and waste space. (fringe-mode -1) #+END_SRC ** Disable file backups -Emacs, loves to clutter directories with backup files. +Emacs sure loves to clutter directories with backup files. #+BEGIN_SRC emacs-lisp (setq make-backup-files nil) (setq auto-save-default nil) (setq create-lockfiles nil) #+END_SRC -** Other settings +** Other Settings #+begin_src emacs-lisp ;; The default encoding should be utf-8 everywhere (prefer-coding-system 'utf-8) @@ -107,7 +106,7 @@ Unbind useless keys. (unbind-key "C-x C-d") ;; list-directory is utterly useless given the existence of dired (unbind-key "C-x C-r") ;; as is find-file-read-only #+END_SRC -* Useful functions +* Useful Functions ** Edit the config file A simple funtion to open this file for quick editing. #+BEGIN_SRC emacs-lisp @@ -142,29 +141,45 @@ Reindet the whole buffer with ~F12~ #+END_SRC ** Quick buffer switching #+BEGIN_SRC emacs-lisp - (defun switch-to-previous-buffer () - "Switch to previously open buffer. Repeated invocations toggle between the two most recently open buffers." - (interactive) - (switch-to-buffer (other-buffer (current-buffer) 1))) + (defun switch-to-previous-buffer () + "Switch to previously open buffer.Repeated invocations toggle between the two most recently open buffers." + (interactive) + (switch-to-buffer (other-buffer (current-buffer) 1))) +#+END_SRC +** Quickly open the links file +The link dump is the file to throw all links for later reading in. +#+BEGIN_SRC emacs-lisp + (defvar lux/link-dump "") + (defun lux/open-link-dump () + (interactive) + (find-file lux/link-dump)) #+END_SRC * Theming Apply a nice looking theme. #+BEGIN_SRC emacs-lisp ;; Light Theme (use-package modus-operandi-theme) - (load-theme 'modus-operandi t) ;; Syntax highlighing (setq modus-operandi-theme-faint-syntax t) - (setq modus-operandi-theme-org-blocks "greyscale") + (load-theme 'modus-operandi t) +#+END_SRC +Set up the default frame look. +#+begin_src emacs-lisp (setq default-frame-alist (append (list '(width . 90) '(height . 50) '(vertical-scroll-bars . nil) - '(internal-border-width . 10) - '(font . "Roboto Mono Light 10")))) -#+END_SRC + '(internal-border-width . 5)))) +#+end_src + +Configure the Fonts +#+begin_src emacs-lisp + (set-face-attribute 'default nil :font "Roboto Mono-11") + (set-face-attribute 'fixed-pitch nil :font "Roboto Mono-11") + (set-face-attribute 'variable-pitch nil :font "Roboto-11") +#+end_src Use a nice looking modeline package #+BEGIN_SRC emacs-lisp @@ -281,45 +296,23 @@ Don't prompt to save unmodified buffers on exit. #+END_SRC * Org Mode -** Define important files -*** The Link Dump -I use a single file to dump all links I plan on viewing later. -#+BEGIN_SRC emacs-lisp - (defvar link-dump "") - - (defun open-link-dump () - (interactive) - (find-file link-dump)) -#+END_SRC -** Configure org-mode This is the main configuration for the infamous org-mode. The most important parts are configuring key bindings to quickly access the files we have defined above. #+BEGIN_SRC emacs-lisp (use-package org ;; Always get this from the GNU archive. - :pin gnu :bind (("C-c o c" . org-capture) - ("C-c o l" . open-link-dump) + ("C-c o l" . lux/open-link-dump) ("C-c o s" . org-store-link) ("C-c o a" . org-agenda) :map org-mode-map ("M-s-" . org-insert-todo-heading) ("M-" . org-insert-heading-respect-content) - ("C-c c" . org-mode-insert-code) ("C-c a s" . org-emphasize) - ("C-c a r" . org-ref) - ("C-c a e" . outline-show-all) - ("C-c a t" . unindent-by-four) ("C-c -" . org-edit-special)) :hook ((org-mode . visual-line-mode) - (org-mode . variable-pitch-mode) (org-mode . org-indent-mode)) :config - (let ((todo-path (expand-file-name "~/Notes/todo.org"))) - (when (file-exists-p todo-path) - (setq org-agenda-files (list todo-path) - org-default-notes-file todo-path))) - (setq org-footnote-section "" org-startup-with-inline-images t org-pretty-entities t @@ -331,120 +324,32 @@ The most important parts are configuring key bindings to quickly access the file org-display-inline-images t org-hide-emphasis-markers t ) - (setcar (nthcdr 4 org-emphasis-regexp-components) 4) - - (defun org-mode-insert-code () - (interactive) - (org-emphasize ?~))) + (setcar (nthcdr 4 org-emphasis-regexp-components) 4)) #+END_SRC -** Set default archive location +** Archive Location When archiving items in org files, the default ist to crate a separate file named ~.org_archive~. This clutters up my notes folder quite a bit, as I use a lot of separate files with thier respective archives. All archives should be stored in a single ~.archive~ file per directory. #+BEGIN_SRC emacs-lisp (setq org-archive-location "./.archive::* From %s") #+END_SRC -** Beautify org-mode -*** Icons -#+BEGIN_SRC emacs-lisp - (use-package org-bullets - :init (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))) - (setq org-bullets-bullet-list '("◉" "○" "◆" "✿" "✚" "▶")) +** Export Location +This snippet will create a sub dir for exports from org-mode. +[[https://stackoverflow.com/questions/9559753/emacs-org-mode-export-to-another-directory][See the Stackoverflow question]] + +#+BEGIN_SRC emacs-lisp + (defun org-export-output-file-name-modified (orig-fun extension &optional subtreep pub-dir) + (unless pub-dir + (setq pub-dir "Exports") + (unless (file-directory-p pub-dir) + (make-directory pub-dir))) + (apply orig-fun extension subtreep pub-dir nil)) + (advice-add 'org-export-output-file-name :around #'org-export-output-file-name-modified) #+END_SRC -Ellipsis icon: -#+BEGIN_SRC emacs-lisp - (setq org-ellipsis "▾") -#+END_SRC - -Nice Icons for lists: -#+BEGIN_SRC emacs-lisp - (add-hook 'org-mode-hook - (lambda () - "Beautify Org Checkbox Symbol" - (push '("[ ]" . "☐") prettify-symbols-alist) - (push '("[X]" . "☑" ) prettify-symbols-alist) - (push '("[-]" . "❍" ) prettify-symbols-alist) - (prettify-symbols-mode))) -#+END_SRC - -We also want them in exported HTML files -#+BEGIN_SRC emacs-lisp - (setq org-html-checkbox-type 'html) -#+END_SRC - -*** Strike out done ckeckbox items -#+BEGIN_SRC emacs-lisp - (defface org-checkbox-done-text - '((t (:foreground "#71696A" :strike-through t))) - "Face for the text part of a checked org-mode checkbox.") - - (font-lock-add-keywords - 'org-mode - `(("^[ \t]*\\(?:[-+*]\\|[0-9]+[).]\\)[ \t]+\\(\\(?:\\[@\\(?:start:\\)?[0-9]+\\][ \t]*\\)?\\[\\(?:X\\|\\([0-9]+\\)/\\2\\)\\][^\n]*\n\\)" - 1 'org-checkbox-done-text prepend)) - 'append) -#+END_SRC - -*** Replace dash in bullet lists with unicode symbol -#+BEGIN_SRC emacs-lisp - (font-lock-add-keywords 'org-mode - '(("^ *\\([-]\\) " - (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) -#+END_SRC - -*** Prettier Timestamps in Exports -#+BEGIN_SRC emacs-lisp - (setq-default org-display-custom-times t) - (setq org-time-stamp-custom-formats - '("<%a %d.%m.%Y>" . "<%d.%m.%y %H:%M>")) -#+END_SRC -** Templates -*** Babel -Here we set custom templates to be used for structure expansion. -These are used when we type "<" folowed by the shortcut for a template and hit "TAB". -e.g. "" . "<%d.%m.%y %H:%M>")) #+END_SRC + +** Templates +*** Babel +Here we set custom templates to be used for structure expansion. +These are used when we type "<" folowed by the shortcut for a template and hit "TAB". +e.g. "