Created
March 6, 2017 10:12
-
-
Save mbacou/018a5623ab3eb0800957c3cf16f632c9 to your computer and use it in GitHub Desktop.
Emacs init file (Ubuntu 16.10)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Load themes | |
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/") | |
(custom-set-variables | |
;; custom-set-variables was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(blink-cursor-mode nil) | |
'(c-ignore-auto-fill (quote (cpp))) | |
'(column-number-mode t) | |
'(comint-move-point-for-output t) | |
'(comint-scroll-to-bottom-on-input t) | |
'(comint-scroll-to-bottom-on-output t) | |
'(comment-auto-fill-only-comments t) | |
'(compilation-scroll-output (quote first-error)) | |
'(cua-auto-tabify-rectangles nil) | |
'(cua-enable-cua-keys t) | |
'(cua-highlight-region-shift-only t) | |
'(cua-keep-region-after-copy t) | |
'(cua-mode t nil (cua-base)) | |
'(cua-normal-cursor-color "black") | |
'(cursor-in-non-selected-windows nil) | |
'(cursor-type (quote bar)) | |
'(custom-enabled-themes (quote (mbacou))) | |
'(custom-safe-themes | |
(quote | |
("28d8203608d7520b453e0808e28a2d89f5616b759b4856e8069d527a2a9ea799" default mbacou))) | |
'(default-frame-alist (quote ((width . 90) (height . 48)))) | |
'(delete-selection-mode t) | |
'(desktop-save-mode nil) | |
'(ess-R-font-lock-keywords | |
(quote | |
((ess-R-fl-keyword:modifiers . t) | |
(ess-R-fl-keyword:fun-defs . t) | |
(ess-R-fl-keyword:keywords . t) | |
(ess-R-fl-keyword:assign-ops . t) | |
(ess-R-fl-keyword:constants . t) | |
(ess-fl-keyword:fun-calls . t) | |
(ess-fl-keyword:numbers . t) | |
(ess-fl-keyword:operators . t) | |
(ess-fl-keyword:delimiters . t) | |
(ess-fl-keyword:= . t) | |
(ess-R-fl-keyword:F&T . t) | |
(ess-R-fl-keyword:%op% . t)))) | |
'(fancy-splash-image nil) | |
'(fci-dash-pattern 0.5) | |
'(fci-rule-color "light blue") | |
'(fci-rule-use-dashes t) | |
'(fill-column 86) | |
'(frame-title-format "%b" t) | |
'(fringe-mode 18 nil (fringe)) | |
'(global-font-lock-mode t) | |
'(global-hl-line-mode t) | |
'(global-visual-line-mode nil) | |
'(hl-paren-background-colors (quote ("#2492db" "#95a5a6" nil))) | |
'(hl-paren-colors (quote ("#ecf0f1" "#ecf0f1" "#c0392b"))) | |
'(indent-tabs-mode nil) | |
'(inhibit-startup-screen t) | |
'(initial-frame-alist nil) | |
'(initial-major-mode (quote org-mode)) | |
'(initial-scratch-message nil) | |
'(ispell-dictionary "english") | |
'(ispell-program-name "aspell") | |
'(line-spacing 0) | |
'(linum-format " %6d ") | |
'(main-line-color1 "#222232") | |
'(main-line-color2 "#333343") | |
'(make-backup-files nil) | |
'(make-cursor-line-fully-visible t) | |
'(minibuffer-frame-alist nil) | |
'(mouse-drag-copy-region nil) | |
'(mouse-wheel-progressive-speed t) | |
'(mouse-wheel-scroll-amount (quote (1 ((shift) . 3)))) | |
'(package-selected-packages | |
(quote | |
(virtualenvwrapper csv-mode cypher-mode dired-single ebib ess-R-data-view htmlize json-mode multi-web-mode org-ref ox-tufte ox-twbs polymode))) | |
'(powerline-color1 "#222232") | |
'(powerline-color2 "#333343") | |
'(recentf-menu-before nil) | |
'(recentf-mode t) | |
'(scroll-bar-mode nil) | |
'(scroll-conservatively most-positive-fixnum) | |
'(scroll-step 1) | |
'(select-active-regions t) | |
'(select-enable-clipboard t) | |
'(show-paren-mode t) | |
'(size-indication-mode t) | |
'(sml/active-background-color "#34495e") | |
'(sml/active-foreground-color "#ecf0f1") | |
'(sml/inactive-background-color "#dfe4ea") | |
'(sml/inactive-foreground-color "#34495e") | |
'(sql-font-lock-buffers (quote all)) | |
'(tab-width 4) | |
'(tool-bar-mode nil) | |
'(tooltip-mode nil) | |
'(tramp-default-method "sshx") | |
'(transient-mark-mode nil) | |
'(vc-annotate-background nil) | |
'(vc-annotate-very-old-color nil) | |
'(visible-bell t) | |
'(visible-cursor nil) | |
'(visual-line-mode nil t)) | |
(custom-set-faces | |
;; custom-set-faces was added by Custom. | |
;; If you edit it by hand, you could mess it up, so be careful. | |
;; Your init file should contain only one such instance. | |
;; If there is more than one, they won't work right. | |
'(default ((t (:height 72 :family "M+ 1mn" :foundry "M+ " :slant normal :weight normal :width normal))))) | |
;; Add MELPA and other source repos | |
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
("melpa" . "http://melpa.milkbox.net/packages/"))) | |
(package-initialize) | |
;; Helm | |
(require 'helm-config) | |
;; Python | |
;; uses default location at ~/.virtualenvs | |
;; the environment variable `WORKON_HOME` points to the right place | |
(setq | |
tab-width 4 | |
python-indent-offset 4 | |
) | |
(require 'virtualenvwrapper) | |
(venv-initialize-interactive-shells) | |
;;(venv-initialize-eshell) | |
;; Octave | |
(autoload 'octave-mode "octave-mod" nil t) | |
(setq auto-mode-alist | |
(cons '("\\.m$" . octave-mode) auto-mode-alist)) | |
(add-hook 'octave-mode-hook | |
(lambda () | |
(abbrev-mode 1) | |
(auto-fill-mode 1) | |
(if (eq window-system 'x) | |
(font-lock-mode 1)))) | |
;; Add git support | |
(setq vc-handled-backends (quote (Git))) | |
;; ESS customization | |
(setq | |
ess-language "R" | |
;; ess-eval-visibly-p nil | |
ess-offset-arguments 'prev-line | |
ess-local-process-name "R Local" | |
ess-use-auto-complete t) | |
(require 'ess-site) | |
;;(require 'ess-eldoc) | |
(autoload 'R-mode "ess-site.el" "ESS" t) | |
(autoload 'ess-rdired "ess-rdired" "R workspace" t) | |
(add-to-list 'auto-mode-alist '("\\.R$" . R-mode)) | |
(add-hook 'ess-mode-hook 'turn-on-auto-fill) | |
(add-hook 'inferior-ess-mode-hook 'turn-on-auto-fill) | |
(add-hook 'ess-mode-hook 'visual-line-mode nil) | |
(add-hook 'inferior-ess-mode-hook 'visual-line-mode nil) | |
(defun myindent-ess-hook () (setq ess-indent-offset 2)) | |
(add-hook 'ess-mode-hook 'myindent-ess-hook) | |
(add-hook 'ess-mode-hook (lambda () (ess-set-style 'RStudio))) | |
(define-key ess-mode-map "\C-c\C-v" 'ess-R-object-popup) | |
;; Markdown and R modes | |
(require 'poly-R) | |
(require 'poly-markdown) | |
(add-to-list 'auto-mode-alist '("\\.md" . markdown-mode)) | |
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode)) | |
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode)) | |
;; Get Stata to work too | |
;;(require 'ado-mode) | |
;; TeX and AucTeX configuration | |
(setq tex-PDF-mode t | |
tex-auto-save t | |
tex-parse-self t) | |
(add-hook 'LaTeX-mode-hook 'aspell-mode) | |
(add-hook 'LaTeX-mode-hook 'visual-line-mode t) | |
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode) | |
;; Org configuration | |
(setq org-export-backends (quote (beamer html latex odt)) | |
org-directory "~/Google Drive/.org" | |
org-default-notes-file "~/Google Drive/.org/0000-Notebook.org" | |
org-attach-directory "~/Google Drive/.org/assets" | |
;; org-agenda-files (file-expand-wildcards "~/Google Drive/.org/*Notebook.org") | |
org-agenda-files (quote ("~/Google Drive/.org/0000-Notebook.org" | |
"~/Google Drive/.org/2016-Notebook.org" | |
"~/Google Drive/.org/2017-Notebook.org")) | |
org-agenda-compact-blocks t | |
org-agenda-dim-blocked-task(package-initialize)s nil | |
org-agenda-default-appointment-duration 30 | |
org-agenda-exporter-settings '( | |
(ps-number-of-columns 2) | |
(ps-landscape-mode t) | |
(org-agenda-add-entry-text-maxlines 0) | |
(htmlize-output-type 'css)) | |
org-agenda-window-setup 'current-window | |
org-agenda-todo-ignore-deadlines t | |
org-agenda-todo-ignore-scheduled t | |
org-agenda-todo-ignore-with-date t | |
org-icalendar-include-todo t | |
org-icalendar-with-timestamps t | |
org-icalendar-combined-agenda-file "~/Google Drive/.org/calendar.ics" | |
org-babel-R-command "R --slave --no-save" | |
org-time-stamp-rounding-minutes 15 | |
org-confirm-babel-evaluate nil | |
org-cycle-separator-lines 0 | |
org-CUA-compatible t | |
org-deadline-warning-days 150 | |
org-descriptive-links nil | |
org-export-allow-BIND t | |
org-replace-disputed-keys nil | |
org-footnote-define-inline +1 | |
org-footnote-auto-label 'random | |
org-footnote-auto-adjust nil | |
org-html-doctype "html5" | |
org-html-html5-fancy t | |
;; Fancy HTML output | |
;; org-html-head-include-default-style nil | |
;; org-html-head " | |
;; <link rel='stylesheet' type='text/css' href='http://mbacou.com/ox-html/readtheorg.css'/> | |
;; <script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> | |
;; <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js'></script> | |
;; <script type='text/javascript' src='http://mbacou.com/ox-html//readtheorg.js'></script>" | |
;; org-html-postamble "<address><label>Author</label><br />%a - %d</address> | |
;; <p><a href='http://harvestchoice.org/'><img src='http://mbacou.com/ox-html/hc-logo.png' /></a></p>" | |
org-export-latex-listings 'listings | |
org-export-latex-listings t | |
org-insert-heading-respect-content t | |
org-latex-tables-booktabs t | |
org-list-allow-alphabetical t | |
org-list-indent-offset 2 | |
org-log-done 'date | |
org-loop-over-headlines-in-active-region t | |
org-modules (quote (org-bibtex)) | |
org-read-date-prefer-future nil | |
org-reverse-note-order nil | |
org-src-fontify-natively t | |
org-src-tab-acts-natively t | |
org-src-window-setup 'current-window | |
org-support-shift-select t | |
org-tags-column -83 | |
org-timeline-show-empty-dates nil | |
org-list-demote-modify-bullet '(("+" . "-") ("-" . "+") ("1." . "A.") ("A." . "1.")) | |
org-latex-to-pdf-process | |
;; for multiple passes | |
'("pdflatex -interaction nonstopmode %f" "pdflatex -interaction nonstopmode %f") | |
org-todo-keywords | |
'((type "MEET(m)" "|") | |
(sequence "TODO(t)" "ACTIVE(a)" "HOLD(h)" "|" "DONE(d)") | |
(sequence "|" "CANCELLED(c)") | |
(sequence "TOREAD(r)" "|" "READ(R)") | |
(sequence "TOWRITE(w)" "|" "WROTE(W)")) | |
org-todo-keyword-faces | |
'(("MEET" . font-lock-variable-name-face) ("ACTIVE" . org-todo) | |
("TODO" . org-todo) ("HOLD" . font-lock-string-face) ("CANCELED" . org-warning) | |
("DONE" . org-done) | |
("TOWRITE" . font-lock-type-face) ("WROTE" . org-done) | |
("TOREAD" . font-lock-type-face) ("READ" . org-done))) | |
(setq org-structure-template-alist | |
'(("s" "#+begin_src ?\n\n#+end_src" "<src lang=\"?\">\n\n</src>") | |
("e" "#+begin_example\n?\n#+end_example" "<example>\n?\n</example>") | |
("q" "#+begin_quote\n?\n#+end_quote" "<quote>\n?\n</quote>") | |
("l" "#+begin_latex\n?\n#+end_latex" "<literal style=\"latex\">\n?\n</literal>") | |
("L" "#+latex: " "<literal style=\"latex\">?</literal>") | |
("h" "#+begin_html\n?\n#+end_html" "<literal style=\"html\">\n?\n</literal>") | |
("H" "#+html: " "<literal style=\"html\">?</literal>") | |
("i" "#+index: ?" "#+index: ?") | |
("I" "#+include %file ?" "<include file=%file markup=\"?\">"))) | |
;; see org-ref for use of these variables | |
(setq org-ref-bibliography-notes "~/Google Drive/Library/notes.org" | |
org-ref-default-bibliography '("~/Google Drive/Library/global.bib") | |
org-ref-pdf-directory "~/Google Drive/Library/files") | |
(setq bibtex-completion-bibliography "~/Google Drive/Library/global.bib" | |
bibtex-completion-library-path "~/Google Drive/Library/files" | |
bibtex-completion-pdf-open-function 'org-open-file | |
bibtex-completion-notes-path "~/Google Drive/Library/notes") | |
;; Load Org | |
(require 'htmlize) | |
(provide 'org-capture) | |
(require 'ox-latex) | |
(provide 'ox-html) | |
(require 'org-ref) | |
(require 'doi-utils) | |
(require 'org-ref-pdf) | |
(require 'org-ref-url-utils) | |
(require 'org-ref-bibtex) | |
(require 'org-protocol) ;; to save snippets from Chrome | |
(org-defkey org-mode-map "\C-cs" 'org-table-sort-lines) | |
(org-defkey org-mode-map "\C-ct" 'org-table-transpose-table-at-point) | |
(org-defkey org-mode-map "\C-cc" 'org-table-current-column) | |
(org-defkey org-mode-map "\C-a" 'mark-whole-buffer) | |
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode)) | |
(add-hook 'text-mode-hook 'visual-line-mode t) | |
(add-hook 'org-mode-hook 'visual-line-mode t) | |
(add-hook 'orgtbl-mode-hook 'truncate-lines t) | |
(add-hook 'text-mode-hook 'show-paren-mode nil) | |
(add-hook 'org-mode-hook 'show-paren-mode nil) | |
(add-hook 'text-mode-hook 'electric-pair-mode nil) | |
(add-hook 'org-mode-hook 'electric-pair-mode nil) | |
(org-babel-do-load-languages | |
'org-babel-load-languages | |
'((emacs-lisp . t) (sh . t) (R . t) (python . t) (js . t) (css . t) (sql . t))) | |
;; Capture templates for TODO tasks, Notes, appointments, meetings, and org-protocol | |
(setq org-capture-templates '( | |
("t" "todo" entry | |
(file+headline "~/Google Drive/.org/0000-Notebook.org" "Unfiled Tasks") | |
"* TODO %? \nCREATED: %u\n") | |
("j" "journal" entry | |
(file+datetree "~/Google Drive/.org/0000-Notebook.org") | |
"* %? \nCREATED: %u\n") | |
("m" "meeting" entry | |
(file+headline "~/.Google Drive/org/0000-Notebook.org" "Meetings") | |
"* MEET %^t %?") | |
;; Capture template for Chrome | |
("p" "Protocol" entry | |
(file+headline "~/Google Drive/.org/0000-Notebook.org" "Notes") | |
"* TOREAD %^{Title} \nCREATED: %u \nSOURCE: %c \n#+begin_quote \n%i \n#+end_quote \n%?") | |
("L" "Protocol Link" entry | |
(file+headline "~/Google Drive/.org/0000-Notebook.org" "Notes") | |
"* TOREAD %^{Title} \nCREATED: %u \nSOURCE: [[%:link][%:description]] \n%?"))) | |
(setq org-refile-targets '((nil :maxlevel . 2) | |
(org-agenda-files :maxlevel . 2))) | |
;; Custom agenda command definitions | |
(setq org-agenda-custom-commands | |
'(("." "Status" | |
((tags "TODO=\"MEET\"+TIMESTAMP>=\"<-3m>\"" | |
((org-agenda-overriding-header "Past 3 Month Agenda\nMeetings, Calls, Events Attended") | |
(org-agenda-time-grid t) | |
(org-agenda-sorting-strategy '(time-down category-up)))) | |
(tags "TODO=\"WROTE\"+CLOSED>=\"<-6m>\"" | |
((org-agenda-overriding-header "\nPublished") | |
(org-agenda-sorting-strategy '(time-down category-up)))) | |
(tags "TODO=\"READ\"+CLOSED>=\"<-6m>\"" | |
((org-agenda-overriding-header "\nReviewed") | |
(org-agenda-sorting-strategy '(time-down category-up)))) | |
(tags "TODO=\"DONE\"+CLOSED>=\"<-3m>\"" | |
((org-agenda-overriding-header "\nDone, Too") | |
(org-agenda-sorting-strategy '(time-down category-up))))) | |
nil | |
("~/Google Drive/.org/status.html")) | |
("y" "Yearly Report" | |
((tags "TODO=\"MEET\"+TIMESTAMP>=\"<-12m>\"" | |
((org-agenda-overriding-header "Past 12 Month Agenda\nMeetings, Calls, Events Attended") | |
(org-agenda-time-grid t) | |
(org-agenda-sorting-strategy '(time-down category-up)))) | |
(tags "TODO=\"WROTE\"+CLOSED>=\"<-12m>\"" | |
((org-agenda-overriding-header "\nPublished") | |
(org-agenda-sorting-strategy '(time-down category-up)))) | |
(tags "TODO=\"READ\"+CLOSED>=\"<-12m>\"" | |
((org-agenda-overriding-header "\nReviewed") | |
(org-agenda-sorting-strategy '(time-down category-up)))) | |
(tags "TODO=\"DONE\"+CLOSED>=\"<-12m>\"" | |
((org-agenda-overriding-header "\nDone, Too") | |
(org-agenda-sorting-strategy '(time-down category-up))))) | |
nil | |
("~/Google Drive/.org/report.html")) | |
("r" "References" | |
((tags "TODO=\"TOREAD\"+TIMESTAMP>=\"<-12m>\"" | |
((org-agenda-overriding-header "\nNot Yet Reviewed") | |
(org-agenda-sorting-strategy '(tag-up time-down)))) | |
(tags "TODO=\"READ\"+TIMESTAMP>=\"<-12m>\"" | |
((org-agenda-overriding-header "\nAnnotated") | |
(org-agenda-sorting-strategy '(tag-up time-down))))) | |
nil | |
("~/Google Drive/.org/references.html")) | |
(" " "Agenda" | |
((agenda "" | |
((org-agenda-span 28) | |
(org-agenda-start-day "-14d") | |
(org-deadline-warning-days 365) | |
(org-agenda-start-on-weekday 0) | |
(org-agenda-overriding-header "Weekly Agenda"))) | |
(tags-todo "refile" | |
((org-agenda-overriding-header "\nEntries to Refile"))) | |
(todo "ACTIVE" | |
((org-agenda-overriding-header "\nActive Tasks") | |
(org-agenda-entry-types nil) | |
(org-agenda-sorting-strategy '(priority-up category-up)))) | |
(todo "TOWRITE" | |
((org-agenda-overriding-header "\nThings to Write") | |
(org-agenda-entry-types nil) | |
(org-agenda-sorting-strategy '(priority-up category-up)))) | |
(todo "TOREAD" | |
((org-agenda-overriding-header "\nThings to Read") | |
(org-agenda-entry-types nil) | |
(org-agenda-sorting-strategy '(priority-up category-up)))) | |
(todo "HOLD" | |
((org-agenda-overriding-header "\nThings for Later") | |
(org-agenda-entry-types nil) | |
(org-agenda-sorting-strategy '(category-up)))) | |
nil | |
("~/Google Drive/.org/agenda.html"))))) | |
;; E-mail account configuration | |
(setq user-full-name "Bacou, Melanie" | |
user-mail-address "[email protected]" | |
message-signature | |
(concat | |
"--\n" | |
"Melanie BACOU\n" | |
"E-mail [email protected]\n" | |
"Visit http://harvestchoice.org/\n") | |
mm-discouraged-alternatives '("text/html" "text/richtext") | |
message-generate-headers-first t | |
message-kill-buffer-on-exit t | |
imap-ssl-program "openssl s_client -ssl3 -quiet -connect %s:%p") | |
(setq message-send-mail-function 'smtpmail-send-it | |
smtpmail-default-smtp-server "mail.mbacou.com" | |
smtpmail-smtp-server "mail.mbacou.com" | |
smtpmail-smtp-service 465 | |
smtpmail-local-domain "mbacou.com") | |
;; CSV | |
(add-to-list 'auto-mode-alist '("\\.[Cc][Ss][Vv]\\'" . csv-mode)) | |
(autoload 'csv-mode "csv-mode" | |
"Major mode for editing comma-separated value files." t) | |
(setq csv-align-style (quote auto)) | |
(add-hook 'csv-mode-hook 'visual-line-mode 0) | |
;; Toggle case | |
(defun toggle-letter-case () | |
"Toggle the letter case of current word or text selection. | |
Toggles between: all lower, Init Caps, ALL CAPS." | |
(interactive) | |
(let (p1 p2 (deactivate-mark nil) (case-fold-search nil)) | |
(if (region-active-p) | |
(setq p1 (region-beginning) p2 (region-end)) | |
(let ((bds (bounds-of-thing-at-point 'word) ) ) | |
(setq p1 (car bds) p2 (cdr bds)) ) ) | |
(when (not (eq last-command this-command)) | |
(save-excursion | |
(goto-char p1) | |
(cond | |
((looking-at "[[:lower:]][[:lower:]]") (put this-command 'state "all lower")) | |
((looking-at "[[:upper:]][[:upper:]]") (put this-command 'state "all caps") ) | |
((looking-at "[[:upper:]][[:lower:]]") (put this-command 'state "init caps") ) | |
((looking-at "[[:lower:]]") (put this-command 'state "all lower")) | |
((looking-at "[[:upper:]]") (put this-command 'state "all caps") ) | |
(t (put this-command 'state "all lower") ) ) ) ) | |
(cond | |
((string= "all lower" (get this-command 'state)) | |
(upcase-initials-region p1 p2) (put this-command 'state "init caps")) | |
((string= "init caps" (get this-command 'state)) | |
(upcase-region p1 p2) (put this-command 'state "all caps")) | |
((string= "all caps" (get this-command 'state)) | |
(downcase-region p1 p2) (put this-command 'state "all lower")) ) | |
)) | |
;; New empty buffer | |
(defun xah-new-empty-buffer () | |
"Open a new empty buffer." | |
(interactive) | |
(let ((buf (generate-new-buffer "untitled"))) | |
(switch-to-buffer buf) | |
(funcall (and initial-major-mode)) | |
(setq buffer-offer-save t))) | |
;; Export using Rmarkdown | |
(defun ess-rmarkdown () | |
"Compile R markdown (.Rmd). Should work for any output type." | |
(interactive) | |
; Check if attached R-session | |
(condition-case nil | |
(ess-get-process) | |
(error | |
(ess-switch-process))) | |
(let* ((rmd-buf (current-buffer))) | |
(save-excursion | |
(let* ((sprocess (ess-get-process ess-current-process-name)) | |
(sbuffer (process-buffer sprocess)) | |
(buf-coding (symbol-name buffer-file-coding-system)) | |
(R-cmd | |
(format "library(rmarkdown); rmarkdown::render(\"%s\")" | |
buffer-file-name))) | |
(message "Running rmarkdown on %s" buffer-file-name) | |
(ess-execute R-cmd 'buffer nil nil) | |
(switch-to-buffer rmd-buf) | |
(ess-show-buffer (buffer-name sbuffer) nil))))) | |
;; Unfill region | |
(defun unfill-region (beg end) | |
"Unfill the region, joining text paragraphs into a single | |
logical line. This is useful, e.g., for use with `visual-line-mode'." | |
(interactive "*r") | |
(let ((fill-column (point-max))) (fill-region beg end))) | |
;; Global keyboard shortcuts | |
(global-set-key (kbd "M-x") 'helm-M-x) | |
(global-unset-key (kbd "C-o")) | |
(global-set-key (kbd "C-o") 'find-file) | |
(global-unset-key (kbd "C-n")) | |
(global-set-key (kbd "C-n") 'xah-new-empty-buffer) | |
(global-unset-key (kbd "C-w")) | |
(global-set-key (kbd "C-w") 'kill-this-buffer) | |
(global-unset-key (kbd "C-s")) | |
(global-set-key (kbd "C-s") 'save-buffer) | |
(global-unset-key (kbd "C-f")) | |
(global-set-key (kbd "C-f") 'isearch-forward) | |
(global-unset-key (kbd "M-/")) | |
(global-set-key (kbd "M-/") 'toggle-letter-case) | |
(global-set-key (kbd "M-q") 'unfill-region) | |
(global-unset-key (kbd "C-d")) | |
(global-set-key (kbd "C-d") 'kill-whole-line) | |
(global-set-key (kbd "C-<prior>") 'next-buffer) | |
(global-set-key (kbd "C-<next>") 'previous-buffer) | |
(global-set-key (kbd "<f2>") 'toggle-truncate-lines) | |
(global-set-key (kbd "<f5>") 'org-capture) | |
(global-set-key (kbd "<f6>") 'org-agenda) | |
(global-set-key (kbd "<f8>") 'toggle-menu-bar-mode-from-frame) | |
(global-set-key (kbd "<f12>") 'kill-buffer-and-window) | |
(global-set-key (kbd "C-;") 'comment-or-uncomment-region) | |
(autoload 'session-jump-to-last-change "session") | |
(global-set-key (kbd "C-.") 'session-jump-to-last-change) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Special LaTeX classes for ox-latex | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(add-to-list 'org-latex-classes | |
'("org-article" " | |
\\documentclass{org-article} | |
\\usepackage{booktabs, ctable, tabu, longtable, rotating, caption, lscape} | |
[NO-DEFAULT-PACKAGES] | |
[PACKAGES] | |
[EXTRA]" | |
("\\section{%s}" . "\\section*{%s}") | |
("\\subsection{%s}" . "\\subsection*{%s}") | |
("\\subsubsection{%s}" . "\\subsubsection*{%s}") | |
("\\paragraph{%s}" . "\\paragraph*{%s}") | |
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) | |
(add-to-list 'org-latex-classes | |
'("mel-article" | |
"\\documentclass[9pt,letterpaper]{article} | |
\\usepackage[T1]{fontenc} | |
\\usepackage[top=0.8in, bottom=0.8in, left=1.2in, right=1.2in, includefoot]{geometry} | |
\\usepackage{DejaVuSerifCondensed} | |
\\usepackage{amsfonts, mathtools, fixltx2e, microtype} | |
\\usepackage{listings, float, fancyvrb, graphicx} | |
\\usepackage{booktabs, ctable, tabu, longtable, rotating, caption, threeparttable} | |
\\usepackage{parskip, fancyhdr, lastpage, sectsty, setspace, titlesec, lscape} | |
\\usepackage{epstopdf} | |
\\usepackage[section]{placeins} | |
\\lstset{breaklines=true} | |
\\allsectionsfont{\\sffamily} | |
\\titlespacing{\\paragraph}{0pt}{-0.8em}{1em} | |
\\setlength{\\parskip}{0.5em} | |
\\setlength{\\emergencystretch}{3em} | |
\\setlength{\\footskip}{0.8in} | |
\\setlength{\\skip\\footins}{0.6in} | |
\\setlength{\\arrayrulewidth}{0.1pt} | |
\\setstretch{1.3} | |
\\captionsetup{belowskip=1em} | |
\\pagestyle{fancy} | |
\\fancyhead{} | |
\\fancyfoot{} | |
\\renewcommand{\\headrulewidth}{0pt} | |
\\renewcommand{\\footrulewidth}{0pt} | |
\\lfoot{\\sffamily{Updated on \\today}} | |
\\rfoot{\\sffamily\\thepage/\\pageref{LastPage}} | |
\\def\\labelitemi{-} | |
\\def\\labelitemii{\\circ} | |
\\def\\labelitemiii{\\textasteriskcentered} | |
\\DeclareMathSizes{11}{11}{10}{10} | |
\\makeatletter\\AtBeginDocument{% | |
\\renewcommand{\\@listi} | |
{\\setlength{\\labelwidth}{4em}} | |
}\\makeatother | |
\\makeatletter | |
\\def\\@floatboxreset{\\reset@font\\footnotesize\\@setminipage}\\makeatother | |
\\newsavebox{\\mybox} | |
\\setkeys{Gin}{width=5in} | |
\\newenvironment{tabularfit}{\\begin{lrbox}{\\mybox}} | |
{\\end{lrbox}% | |
\\setbox0\\hbox{\\usebox\\mybox}% | |
\\ifdim\\wd0<\\linewidth | |
\\usebox\\mybox% | |
\\else | |
\\resizebox{\\linewidth}{!}{\\usebox\\mybox}% | |
\\fi | |
} | |
\\usepackage[unicode=true]{hyperref} | |
\\hypersetup{breaklinks=true,bookmarks=true,colorlinks=true,urlcolor=blue,linkcolor=blue,pdfborder={0 0 0}} | |
\\VerbatimFootnotes | |
\\usepackage[normalem]{ulem} | |
\\pdfstringdefDisableCommands{\\renewcommand{\\sout}{}} | |
\\lstset{language=R, basicstyle=\\footnotesize\\ttfamily, frame=tb, columns=flexible, showstringspaces=false, breaklines=true, breakatwhitespace=true, numbers=left, numberstyle=\\tiny} | |
[NO-DEFAULT-PACKAGES] | |
[NO-PACKAGES]" | |
("\\section{%s}" . "\\section*{%s}") | |
("\\subsection{%s}" . "\\subsection*{%s}") | |
("\\subsubsection{%s}" . "\\subsubsection*{%s}") | |
("\\subsubsubsection{%s}" . "\\subsubsubsection*{%s}") | |
("\\subsubsubsubsection{%s}" . "\\subsubsubsubsection*{%s}") | |
("\\paragraph{%s}" . "\\paragraph*{%s}") | |
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment