GNU's Not Unix

Org Mode

I use emacs org-mode at work for managing voicemails and tasks, and at home for cataloging recipes.

I have a script set up in my file that generates a PDF with all of the recipes, uses that to produce a bifold booklet with pdfbook2, and exports to HTML before uploading everything to this page.

      #+BEGIN_SRC elisp
      (setq org-html-self-link-headlines 1) (setq html-head-include-scripts nil) (org-latex-export-to-pdf) (org-html-export-to-html) (shell-command-to-string "pdfbook2 recipes.pdf -b 10 -t 10 -o 10 -i 10 -n -p letterpaper") (shell-command-to-string "scp recipes.html recipes.pdf recipes-book.pdf webserver:/var/www/html/recipes/")

The script is executed by placing your cursor over the line in emacs, and pressing C-c C-c to evaluate it. You need LaTeX packages installed to generate the PDFs, and you need access to whatever server it is uploaded to.

Emacs open and editing my cookbook in org mode. Using emacs.

My Emacs Config

Here is my emacs config file. I try to keep the keybindings as close to stock as possible, so it's easier to switch between multiple systems.

   ["#2d3743" "#ff4242" "#74af68" "#dbdb95" "#34cae2" "#008b8b" "#00ede1" "#e1e1e0"])
 '(custom-enabled-themes '(wombat))
 '(inhibit-startup-screen t)
   '(csv-mode company telega org-chef clippy org-noter weechat md4rd auctex auto-complete magit org-send-ebook ereader org-bullets nov jdee ## pdf-tools))
 '(show-paren-mode t)
 '(tool-bar-mode nil)
;; '(xterm-mouse-mode t))

 '(default ((t (:family "ComicMono" :foundry "unknown" :slant normal :weight normal :height 120 :width normal))))
 '(variable-pitch ((t (:height 120 :family "ComicMono")))))

(set-face-attribute 'mode-line nil  :height 120)
(set-face-attribute 'mode-line-inactive nil  :height 120)

(defun bury-compile-buffer-if-successful (buffer string)
  "Bury a compilation buffer if succeeded without warnings "
 (when (and
	(buffer-live-p buffer)
         (string-match "compilation" (buffer-name buffer))
         (string-match "finished" string)
          (with-current-buffer buffer
            (goto-char (point-min))
            (search-forward "warning" nil t))))
   (run-with-timer 1 nil
                    (lambda (buf)
                      (bury-buffer buf)
                      (switch-to-prev-buffer (get-buffer-window buf) 'kill))
(add-hook 'compilation-finish-functions 'bury-compile-buffer-if-successful)

(setq compilation-exit-message-function 'compilation-exit-autoclose)

;; LaTeX stuff
(setq TeX-PDF-mode t)
(add-hook 'LaTeX-mode-hook (lambda ()
                             (TeX-fold-mode 1)))
(add-hook 'LaTeX-mode-hook 'TeX-fold-buffer t)

;; Always highlight pairs of parantheses
(show-paren-mode 1)

;; Middle mouse to paste from system keyboard
;; (global-set-key (kbd "") 'x-clipboard-yank)

;; Disable titlebar and scrollbar
(toggle-scroll-bar -1) 
(tool-bar-mode -1)

;; Use pdf-tools to open PDF files
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
      TeX-source-correlate-start-server t)

;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook

;; Split vertically by default
(setq split-width-threshold 1 )

;; Terminal emulator enhancements
(when (require 'multi-term nil t)
  (global-set-key (kbd "") 'multi-term)
  (global-set-key (kbd "") 'multi-term-next)
  (global-set-key (kbd "") 'multi-term-prev)
  (setq multi-term-buffer-name "term"
        multi-term-program "/bin/bash"))

(when (require 'term nil t) ; only if term can be loaded..
  (setq term-bind-key-alist
        (list (cons "C-c C-c" 'term-interrupt-subjob)
              (cons "C-p" 'previous-line)
              (cons "C-n" 'next-line)
              (cons "M-f" 'term-send-forward-word)
              (cons "M-b" 'term-send-backward-word)
              (cons "C-c C-j" 'term-line-mode)
              (cons "C-c C-k" 'term-char-mode)
              (cons "M-DEL" 'term-send-backward-kill-word)
              (cons "M-d" 'term-send-forward-kill-word)
              (cons "" 'term-send-backward-word)
              (cons "" 'term-send-forward-word)
              (cons "C-r" 'term-send-reverse-search-history)
              (cons "M-p" 'term-send-raw-meta)
              (cons "M-y" 'term-send-raw-meta)
              (cons "C-y" 'term-send-raw))))

;; Window names
(setq frame-title-format "emacs@thinkpad: %b")

;; Copy and paste
(setq x-select-enable-clipboard t)

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . ""))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "")))
(package-initialize) ;; You might already have this line

(defun sudo-edit (&optional arg)
  "Edit currently visited file as root.

With a prefix ARG prompt for a file to visit.
Will also prompt for a file to visit if current
buffer is not visiting a file."
  (interactive "P")
  (if (or arg (not buffer-file-name))
      (find-file (concat "/sudo:root@localhost:"
                         (ido-read-file-name "Find file(as root): ")))
    (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))

(global-set-key (kbd "C-x C-r") 'sudo-edit)

;; (split-window-right)
(setq split-height-threshold nil)
(setq split-width-threshold 160)

(setq column-number-mode 1)

;; shuffle lines

(defun my-randomize-region (beg end)
  "Randomize lines in region from BEG to END."
  (interactive "*r")
  (let ((lines (split-string
		(delete-and-extract-region beg end) "\n")))
    (when (string-equal "" (car (last lines 1)))
      (setq lines (butlast lines 1)))
    (apply 'insert
	   (mapcar 'cdr
		   (sort (mapcar (lambda (x) (cons (random) (concat x "\n"))) lines)
			 (lambda (a b) (< (car a) (car b))))))))

(electric-pair-mode 1)
;; (setq global-linum-mode t)
;; (global-linum-mode t)
(setq ring-bell-function 'ignore)
(setq password-cache-expiry nil)

(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
(setq org-startup-truncated nil)
(add-hook 'org-mode-hook #'toggle-word-wrap)
(find-file "~/Documents/todo/")
;; (magit-status)

(setq browse-url-browser-function 'browse-url-generic
      browse-url-generic-program "quantum")

;; revert pdf-view after compilation
(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)

(display-battery-mode 1)
About Emacs page An emacs mug filled with hot tea. Freshmeat Newsletter