Skip to content

Instantly share code, notes, and snippets.

@mbacou
Created August 17, 2017 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbacou/a7a6fed9f0311112dda84eb2cfd72343 to your computer and use it in GitHub Desktop.
Save mbacou/a7a6fed9f0311112dda84eb2cfd72343 to your computer and use it in GitHub Desktop.
Standard emacs configuration on Ubuntu 16.04 cloud server
;; 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.
'(ansi-color-faces-vector
[default bold shadow italic underline bold bold-italic bold])
'(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-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
(default)))
'(delete-selection-mode t)
'(desktop-save-mode nil)
'(fancy-splash-image nil)
'(fci-dash-pattern 0.5)
'(fci-rule-color "light blue")
'(fci-rule-use-dashes t)
'(fill-column 86)
'(fringe-mode 18 nil (fringe))
'(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.33)
'(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-wheel-follow-mouse nil)
'(mouse-wheel-progressive-speed nil)
'(mouse-wheel-scroll-amount (quote (4 ((shift) . 8))))
'(package-selected-packages
(quote
(smex org table sql-indent pcsv json-mode htmlize gh f dired-single csv-mode color-theme auto-complete async)))
'(powerline-color1 "#222232")
'(powerline-color2 "#333343")
'(recentf-menu-before nil)
'(recentf-mode t)
'(scroll-bar-mode nil)
'(scroll-conservatively 10000)
'(shell-file-name "bash")
'(shift-select-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)
'(tooltip-mode nil)
'(tramp-default-method "sshx")
'(vc-annotate-background nil)
'(vc-annotate-color-map
(quote
((20 . "#f36c60")
(40 . "#ff9800")
(60 . "#fff59d")
(80 . "#8bc34a")
(100 . "#81d4fa")
(120 . "#4dd0e1")
(140 . "#b39ddb")
(160 . "#f36c60")
(180 . "#ff9800")
(200 . "#fff59d")
(220 . "#8bc34a")
(240 . "#81d4fa")
(260 . "#4dd0e1")
(280 . "#b39ddb")
(300 . "#f36c60")
(320 . "#ff9800")
(340 . "#fff59d")
(360 . "#8bc34a"))))
'(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.
)
;; Add MELPA and other source repos
(package-initialize)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
;; Add git support
(setq vc-handled-backends (quote (Git)))
;; 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))
org-agenda-compact-blocks t
org-agenda-dim-blocked-tasks nil
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-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
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-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
'("pdflatex -interaction nonstopmode %f"
"pdflatex -interaction nonstopmode %f") ;; for multiple passes
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=\"?\">")))
;; Load Org
(provide 'org-capture)
(provide 'ox-html)
(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)
(org-babel-do-load-languages 'org-babel-load-languages
'((emacs-lisp . t) (sh . t) (R . t) (python . t) (js . t) (css . t) (sql . t)))
;; E-mail account configuration
(setq user-full-name "Bacou, Melanie"
user-mail-address "mel@mbacou.com"
message-signature
(concat
"--\n"
"Melanie BACOU\n"
"E-mail mel@mbacou.com\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)))
;; 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-unset-key (kbd "C-a"))
(global-set-key (kbd "C-a") 'mark-whole-buffer)
(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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment