Skip to content

Instantly share code, notes, and snippets.

@adimanea
Created May 5, 2017 04:03
Show Gist options
  • Save adimanea/4e54502b8867c5aeea233b10a00814f4 to your computer and use it in GitHub Desktop.
Save adimanea/4e54502b8867c5aeea233b10a00814f4 to your computer and use it in GitHub Desktop.
My Emacs init
(setq user-full-name "Adrian Manea")
(setq user-mail-address "adrianmanea@fastmail.fm")
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.milkbox.net/packages/"))
(package-initialize)
(server-start) ;; for emacsclient = $EDITOR = ec in terminal
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===GLOBAL & INTERFACE TWEAKS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-frame-font "MonacoBSemi 11")
(tool-bar-mode -1)
(scroll-bar-mode -1)
(when (window-system)
(set-frame-size (selected-frame) 90 60))
;; (when (memq window-system '(mac ns)) ;; for bash shell as in macOS
;; (exec-path-from-shell-initialize))
(global-hl-line-mode t)
(global-font-lock-mode t)
(blink-cursor-mode 0)
(column-number-mode)
(auto-fill-mode 0)
(delete-selection-mode 1)
;; make the fringe stand out from the background
;;(setq solarized-distinct-fringe-background t)
;; don't use italic in solarized
(setq solarized-italic nil)
;; solarized use less bold
(setq solarized-use-less-bold t)
(ivy-mode 1)
(setq-default indicate-empty-lines t)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil) ;; convert tabs to spaces
(save-place-mode)
(set-face-italic-p 'italic nil)
(setq default-abbrev-mode t)
;;(fringe-mode '(10 . 10))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===PACKAGE & PATH CALL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; org-index
(load "/Users/adi/.emacs.d/3rd-party/org-index")
(require 'yasnippet)
(yas-global-mode 1)
(setq yas-indent-line 'auto)
(require 'auto-complete)
(require 'company)
;; (use-package which-key
;; :ensure t
;; :config
;; (which-key-mode))
(use-package all-the-icons)
(require 'all-the-icons-dired)
;; MultiMarkdown minor mode
(load "/Users/adi/.emacs.d/elpa/mmd-mode-master/mmd-mode")
(use-package mmd-mode)
(require 'recentf)
(setq recentf-max-saved-items 200
recentf-max-menu-items 15)
(recentf-mode)
(use-package undo-tree
:diminish undo-tree-mode
:config
(progn
(global-undo-tree-mode)
(setq undo-tree-visualizer-timestamps t)
(setq undo-tree-visualizer-diff t)))
(load "/Users/adi/.emacs.d/show-point-mode")
(require 'show-point-mode)
(show-point-mode t)
(load "/Users/adi/.emacs.d/elpa/pdftools")
(add-to-list 'load-path "/usr/local/Cellar/maxima/5.38.1/share/maxima/5.38.1/emacs")
(autoload 'maxima-mode "maxima" "Maxima mode" t)
(autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima" "Maxima interaction" t)
(autoload 'imath-mode "imath" "Imath mode for math formula input" t)
(setq imaxima-use-maxima-mode-flag t)
(add-to-list 'auto-mode-alist '("\\.ma[cx]" . maxima-mode))
(setq inferior-lisp-program "clisp")
;;(add-to-list 'exec-path "/usr/local/bin")
(defvar inferior-lisp-buffer "*inferior-lisp*")
(setq inferior-lisp-buffer "*inferior-lisp*")
(require 'paren)
(show-paren-mode 1)
;; (setenv "ESHELL" (expand-file-name "/bin/zsh"))
;;(setenv "SHELL" "/bin/tcsh") ;; "/usr/local/bin/zsh")
(require 'multiple-cursors)
(load "/Users/adi/.emacs.d/csh-mode")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===GLOBAL KEYBINDINGS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(if (not (display-graphic-p))
(global-set-key (kbd "C-,") 'move-beginning-of-line))
(global-set-key (kbd "C-M-ă") 'mark-sexp)
(global-set-key (kbd "M-“") (lambda () (interactive) (insert "~")))
(global-set-key (kbd "M-„") (lambda () (interactive) (insert "`")))
(global-set-key (kbd "C-c j") 'avy-goto-char)
(global-set-key (kbd "C-ă") 'company-complete)
;; (global-set-key (kbd "C-c ins") 'my-insert-file-name)
(global-set-key (kbd "C-c fi") 'auto-fill-mode)
(global-set-key (kbd "C-c fly") 'flyspell-mode)
(global-set-key (kbd "C-c r n") 'rename-file-and-buffer) ;; keybinding for rename
(global-set-key (kbd "C-c m") 'markdown-preview-file)
(global-set-key (kbd "C-c r e c") 'recentf-open-files) ;; for recent file list
(global-set-key (kbd "C-c C-m e") 'mc/edit-lines)
(global-set-key (kbd "C-ș") 'mc/mark-next-like-this)
(global-set-key (kbd "C-ț") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-â") 'mc/mark-all-like-this)
(global-set-key (kbd "C-c l o c") 'counsel-locate)
(define-key key-translation-map (kbd "s-c") (kbd "C-a"))
;;(global-set-key (kbd "C-a") 'move-beginning-of-line)
(global-set-key (kbd "C-w") 'kill-region) ;; cut selection
(global-unset-key (kbd "C-\\"))
(global-unset-key (kbd "C-z")) ;; for minimize
(global-unset-key (kbd "C-x C-z")) ;; for minimize
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key "\M-\S-X" 'counsel-command-history)
(global-unset-key (kbd "C-;"))
(global-unset-key (kbd "C-q")) ;; quoted-insert
(global-set-key (kbd "C-q") 'xah-unfill-paragraph)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===MODE HOOKS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
(add-hook 'dired-by-name-mode-hook 'all-the-icons-dired-mode)
(add-hook 'image-mode-hook 'imagex-global-sticky-mode)
(add-hook 'prog-mode-hook
(lambda ()
;; (rainbow-delimiters-mode)
(flyspell-prog-mode)))
(add-hook 'org-mode-hook
(lambda ()
(visual-fill-column-mode t)
(define-key org-mode-map "\C-a" 'move-beginning-of-line)
;; (define-key org-mode-map (kbd "RET") 'newline-and-indent)
;; (define-key org-mode-map [ret] 'newline-and-indent)
;; (define-key org-mode-map <return> 'newline-and-indent)
(define-key org-mode-map "\C-e" 'move-end-of-line)
(define-key org-mode-map (kbd "C-c w") 'org-where-am-i)
(define-key org-mode-map (kbd "M-TAB") nil)
(define-key org-mode-map (kbd "C-m") nil) ;; it is equiv to RET, so we don't need it
;; (auto-fill-mode)
(flyspell-mode 1)
(flyspell-prog-mode)
;; (pandoc-mode)
;; (rainbow-delimiters-mode)
(define-key org-mode-map (kbd "C-\\") 'org-toggle-pretty-entities)
(define-key org-mode-map (kbd "C-,") nil)))
(add-hook 'markdown-mode-hook
(lambda ()
(turn-on-orgtbl)))
;;(pandoc-mode)))
(add-hook 'haskell-mode-hook 'intero-mode)
(add-hook 'flyspell-mode-hook
(lambda ()
(define-key flyspell-mode-map (kbd "C-c er") 'fd-switch-dictionary)
(define-key flyspell-mode-map (kbd "C-M-i") nil)
(define-key flyspell-mode-map (kbd "M-TAB") nil)
(define-key flyspell-mode-map (kbd "C-;") 'flyspell-correct-previous-word-generic)
(define-key flyspell-mode-map (kbd "C-,") nil)))
(eval-after-load 'company
'(progn
(define-key company-active-map (kbd "TAB") nil) ;;'company-complete-common-or-cycle)
(define-key company-active-map (kbd "<tab>") nil) ;;'company-complete-common-or-cycle)
(define-key company-active-map [tab] nil) ;; 'company-complete-common-or-cycle)
(define-key company-active-map (kbd "C-p") 'company-select-previous)
(define-key company-active-map (kbd "C-n")'company-select-next)
(define-key company-active-map (kbd "SPC") nil)
(define-key company-active-map (kbd "C-SPC") nil)))
(defun autocompany ()
(interactive)
(setq-local company-auto-complete t)
(setq-local company-idle-delay 0)
(setq-local company-tooltip-idle-delay 0))
(add-hook 'LaTeX-mode-hook
(lambda ()
;; (autocompany)
;; (pandoc-mode)
(flyspell-mode)
(reftex-mode)))
(add-hook 'auto-complete-mode-hook
(lambda ()
(define-key ac-menu-map "\C-n" 'ac-next)
(define-key ac-menu-map "\C-p" 'ac-previous)))
(add-hook 'python-mode-hook
(lambda ()
(elpy-mode 1)))
(add-hook 'slime-mode-hook 'set-up-slime-ac)
(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'slime-repl-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===MANUAL CUSTOM SET VARIABLES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq ac-use-menu-map t)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(setq-default line-spacing 2)
(set-face-italic 'font-lock-comment-face nil)
;; Use spotlight index for M-x locate
(setq locate-command "mdfind")
(setq company-dabbrev-downcase nil) ;; make company-complete care about case
(setq company-dabbrev-ignore-case nil) ; default is keep-prefix
(setq neo-theme (if (display-graphic-p) 'icons 'arrow))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===CUSTOM SET VARIABLES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(TeX-source-correlate-method (quote synctex))
'(TeX-source-correlate-mode t)
'(TeX-source-correlate-start-server t)
'(ac-auto-show-menu t)
'(ac-auto-start nil)
'(ac-ignore-case nil)
'(ac-menu-height 5)
'(airline-display-directory nil)
'(ansi-term-color-vector
[unspecified "#1d1f21" "#cc6666" "#b5bd68" "#f0c674" "#81a2be" "#b294bb" "#81a2be" "#c5c8c6"])
'(avy-case-fold-search nil)
'(backup-directory-alist (quote ((".*" . "/Users/adi/.emacs.d/backups"))))
'(company-auto-complete nil)
'(company-idle-delay nil)
'(company-minimum-prefix-length 1)
'(company-show-numbers t)
'(company-tooltip-idle-delay nil)
'(compilation-message-face (quote default))
'(completion-styles (quote (basic partial-completion emacs22 initials)))
'(counsel-locate-cmd (quote counsel-locate-cmd-mdfind))
'(custom-enabled-themes (quote (base16-nova)))
'(custom-safe-themes
(quote
("4e20e41dcd0805a3b93e0606304dbbb9c6080fdd15297c681ed4e186f7f21978" "ce0553a12847992bc76d28735574aa0c803392e196fb013120ab874054dac646" "3979f247316d956278fac5c684baf2b64e3a52f24ce0859857910a107c4dbb08" "272fb2be6a7be1dcbd7f545dd35572f3345c4239057678d932a7895852224a38" "f247e0d19ce8b8087b1caba3c9e87ba8fe676a35afe6afbe4e1d54aa7bcb131e" "78c1c89192e172436dbf892bd90562bc89e2cc3811b5f9506226e735a953a9c6" "760ce657e710a77bcf6df51d97e51aae2ee7db1fba21bbad07aab0fa0f42f834" default)))
'(electric-indent-mode nil)
'(enable-completion nil)
'(fci-rule-color "#073642")
'(fill-column 90)
'(flyspell-issue-message-flag nil)
'(font-latex-fontify-script nil)
'(font-latex-fontify-sectioning 1)
'(frame-background-mode (quote dark))
'(frame-resize-pixelwise t)
'(global-auto-complete-mode nil)
'(global-company-mode t)
'(global-hl-line-mode t)
'(global-undo-tree-mode t)
'(global-visual-fill-column-mode t)
'(global-visual-line-mode t)
'(gnus-completion-styles (quote (substring basic partial-completion emacs22)))
;; '(highlight-symbol-colors
;; (--map
;; (solarized-color-blend it "#fdf6e3" 0.25)
;; (quote
;; ("#b58900" "#2aa198" "#dc322f" "#6c71c4" "#859900" "#cb4b16" "#268bd2"))))
;; '(highlight-symbol-foreground-color "#586e75")
;; '(highlight-tail-colors
;; (quote
;; (("#eee8d5" . 0)
;; ("#B4C342" . 20)
;; ("#69CABF" . 30)
;; ("#69B7F0" . 50)
;; ("#DEB542" . 60)
;; ("#F2804F" . 70)
;; ("#F771AC" . 85)
;; ("#eee8d5" . 100))))
;; '(hl-bg-colors
;; (quote
;; ("#DEB542" "#F2804F" "#FF6E64" "#F771AC" "#9EA0E5" "#69B7F0" "#69CABF" "#B4C342")))
;; '(hl-fg-colors
;; (quote
;; ("#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3" "#fdf6e3")))
;; '(hl-paren-background-colors (quote ("#2492db" "#95a5a6" nil)))
;; '(hl-paren-colors
;; (quote
;; ("#B9F" "#B8D" "#B7B" "#B69" "#B57" "#B45" "#B33" "#B11")))
;; '(hl-sexp-background-color "#1c1f26")
'(imagex-global-sticky-mode t)
'(inferior-lisp-program "/usr/local/bin/clisp" t)
'(inhibit-startup-screen t)
'(initial-frame-alist (quote ((vertical-scroll-bars))))
'(ispell-alternate-dictionary nil)
'(ispell-dictionary "english")
'(ispell-local-dictionary nil)
'(ispell-program-name "/usr/local/bin/aspell")
'(line-number-mode t)
'(linum-format " %5i ")
'(magit-diff-use-overlays nil)
'(modelinepos-column-limit 80)
'(next-screen-context-lines 20)
;; '(nrepl-message-colors
;; (quote
;; ("#dc322f" "#cb4b16" "#b58900" "#546E00" "#B4C342" "#00629D" "#2aa198" "#d33682" "#6c71c4")))
'(ns-alternate-modifier (quote meta))
'(ns-antialias-text t)
'(ns-command-modifier (quote super))
'(ns-function-modifier (quote none))
'(ns-right-alternate-modifier (quote none))
'(org-export-backends (quote (html icalendar latex md odt)))
'(org-export-default-language "en")
'(org-export-preserve-breaks t)
'(org-fontify-quote-and-verse-blocks t)
'(org-indent-indentation-per-level 0)
'(org-index-id "1AF982C8-126C-4F74-B293-BD8AF7DA1AA5")
'(org-list-indent-offset 2)
'(org-modules
(quote
(org-bbdb org-bibtex org-ctags org-docview org-gnus org-info org-irc org-mhe org-rmail org-w3m)))
'(org-odt-convert-process "unoconv")
'(org-odt-convert-processes (quote (("unoconv" "unoconv -f %f -o %d %i"))))
'(org-preview-latex-default-process (quote imagemagick))
'(org-src-fontify-natively t)
'(org-startup-folded (quote showeverything))
'(package-enable-at-startup nil)
'(package-selected-packages
(quote
(arjen-grey-theme moe-theme ample-theme warm-night-theme vimrc-mode company-shell flymake-shell labburn-theme base16-theme visual-fill-column spacemacs-theme nord-theme doom-themes rainbow-delimiters circe circe-notifications org-pdfview counsel counsel-osx-app counsel-projectile flyspell-correct-ivy ivy-bibtex ivy-erlang-complete ivy-gitlab ivy-historian ivy-hydra ivy-pages ivy-rich ivy-todo swiper smooth-scrolling boxquote reveal-in-osx-finder htmlize ob-browser ob-http ob-ipython ob-php ob-prolog ob-sagemath ob-translate ox-epub ox-gfm ox-pandoc ox-rst markdown-mode+ magithub gist flycheck-haskell haskell-mode haskell-snippets intero flymake-haskell-multi org-babel-eval-in-repl avy avy-flycheck avy-menu avy-zap common-lisp-snippets lisp-extra-font-lock flylisp sr-speedbar sage-shell-mode neotree typo leuven-theme which-key modeline-posn wide-column gnuplot-mode gnuplot image+ dic-lookup-w3m w3m atom-one-dark-theme zenburn-theme company-bibtex org browse-kill-ring wrap-region all-the-icons-dired all-the-icons magit use-package undo-tree ac-slime wc-mode pandoc-mode rainbow-mode multiple-cursors color-theme-sanityinc-solarized color-theme-sanityinc-tomorrow material-theme markdown-toc org-edit-latex projectile smartparens pdf-tools exec-path-from-shell elpy flycheck-pyflakes py-autopep8 latex-preview-pane flyspell-correct-popup ac-ispell flyspell-popup flyspell-correct auto-package-update ac-html ac-math ace-mc ace-popup-menu auctex-latexmk auto-complete-auctex auto-complete nyan-mode yasnippet markdown-mode auctex nlinum solarized-theme)))
;; '(pdf-view-midnight-colors (quote ("#DCDCCC" . "#383838")))
;; '(pos-tip-background-color "#eee8d5" t)
;; '(pos-tip-foreground-color "#586e75" t)
'(ps-build-face-reference nil)
'(ps-header-font-family (quote Courier))
'(ps-header-line-pad 5)
'(ps-header-lines 3)
'(ps-header-offset 0)
'(ps-header-title-font-size (quote (10 . 12)))
'(ps-left-header (quote (ps-get-buffer-name)))
'(ps-paper-type (quote a4))
'(ps-print-header-frame nil)
'(ps-top-margin 20)
'(python-indent-trigger-commands
(quote
(indent-for-tab-command yas-expand yas/expand newline-and-indent)))
'(python-shell-exec-path (quote ("/usr/local/bin/")))
'(python-shell-extra-pythonpaths (quote ("/usr/local/bin/")))
'(python-shell-interpreter "python3")
'(rainbow-identifiers-choose-face-function (quote rainbow-identifiers-cie-l*a*b*-choose-face) t)
'(rainbow-identifiers-cie-l*a*b*-color-count 1024 t)
'(rainbow-identifiers-cie-l*a*b*-lightness 80 t)
'(rainbow-identifiers-cie-l*a*b*-saturation 25 t)
'(ring-bell-function (quote ignore))
'(send-mail-function (quote smtpmail-send-it))
;; '(smartrep-mode-line-active-bg (solarized-color-blend "#859900" "#eee8d5" 0.2))
'(smooth-scroll-margin 1)
'(smooth-scrolling-mode t)
'(solarized-use-variable-pitch nil)
;; '(term-default-bg-color "#fdf6e3")
;; '(term-default-fg-color "#657b83")
'(tramp-auto-save-directory "/Users/adi/.emacs.d/auto-save-list")
'(uniquify-buffer-name-style (quote post-forward) nil (uniquify))
'(vc-annotate-background nil)
'(vc-annotate-background-mode nil)
;; '(vc-annotate-color-map
;; (quote
;; ((20 . "#dc322f")
;; (40 . "#c85d17")
;; (60 . "#be730b")
;; (80 . "#b58900")
;; (100 . "#a58e00")
;; (120 . "#9d9100")
;; (140 . "#959300")
;; (160 . "#8d9600")
;; (180 . "#859900")
;; (200 . "#669b32")
;; (220 . "#579d4c")
;; (240 . "#489e65")
;; (260 . "#399f7e")
;; (280 . "#2aa198")
;; (300 . "#2898af")
;; (320 . "#2793ba")
;; (340 . "#268fc6")
;; (360 . "#268bd2"))))
'(vc-annotate-very-old-color nil)
'(visible-bell nil)
'(w3m-home-page "http://www.duckduckgo.com")
'(w3m-search-default-engine "duckduckgo")
'(w3m-search-engine-alist
(quote
(("duckduckgo" "https://duckduckgo.com/lite/?q=%s&kp=1" utf-8))))
;; '(weechat-color-list
;; (quote
;; (unspecified "#fdf6e3" "#eee8d5" "#990A1B" "#dc322f" "#546E00" "#859900" "#7B6000" "#b58900" "#00629D" "#268bd2" "#93115C" "#d33682" "#00736F" "#2aa198" "#657b83" "#839496")))
;; '(xterm-color-names
;; ["#eee8d5" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#073642"])
;; '(xterm-color-names-bright
;; ["#fdf6e3" "#cb4b16" "#93a1a1" "#839496" "#657b83" "#6c71c4" "#586e75" "#002b36"])
'(yas-global-mode t))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===CUSTOM SET FACES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(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.
'(bold-italic ((t (:weight bold))))
'(custom-button ((t (:box (:line-width 2 :style released-button)))))
'(custom-button-mouse ((t (:box (:line-width 2 :style released-button)))))
'(custom-button-pressed ((t (:box (:line-width 2 :style pressed-button)))))
'(custom-group-tag ((t (:inherit custom-face-tag :height 1.2))))
'(custom-group-tag-1 ((t (:inherit custom-group-tag))))
'(font-latex-italic-face ((t (:slant normal))))
'(font-latex-script-char-face ((t nil)))
'(font-latex-sectioning-0-face ((t (:inherit font-latex-sectioning-5-face :height 1.3))))
'(font-latex-sectioning-1-face ((t (:inherit font-latex-sectioning-5-face :height 1.3))))
'(font-latex-sectioning-2-face ((t (:inherit font-latex-sectioning-5-face :height 1.2))))
'(font-latex-sectioning-3-face ((t (:inherit font-latex-sectioning-5-face :height 1.1))))
'(font-latex-sectioning-4-face ((t (:inherit font-latex-sectioning-5-face :height 1.0))))
'(font-latex-slide-title-face ((t (:inherit (default font-lock-type-face) :weight bold :height 1.3))))
'(font-latex-subscript-face ((t (:height 1))))
'(font-latex-superscript-face ((t (:height 1))))
'(italic ((t (:inherit default))))
'(modelinepos-column-warning ((t (:inherit modelinepos-region))))
'(org-agenda-calendar-sexp ((t (:foreground "#839496" :slant normal))))
'(org-verse ((t nil))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===CUSTOM FUNCTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ===SPELLCHECK & AUTOCORRECT
(defun endless/simple-get-word ()
(car-safe (save-excursion (ispell-get-word nil))))
(defun endless/ispell-word-then-abbrev (p)
"Call `ispell-word', then create an abbrev for it.
With prefix P, create local abbrev. Otherwise it will
be global.
If there's nothing wrong with the word at point, keep
looking for a typo until the beginning of buffer. You can
skip typos you don't want to fix with `SPC', and you can
abort completely with `C-g'."
(interactive "P")
(let (bef aft)
(save-excursion
(while (if (setq bef (endless/simple-get-word))
;; Word was corrected or used quit.
(if (ispell-word nil 'quiet)
nil ; End the loop.
;; Also end if we reach `bob'.
(not (bobp)))
;; If there's no word at point, keep looking
;; until `bob'.
(not (bobp)))
(backward-word)
(backward-char))
(setq aft (endless/simple-get-word)))
(if (and aft bef (not (equal aft bef)))
(let ((aft (downcase aft))
(bef (downcase bef)))
(define-abbrev
(if p local-abbrev-table global-abbrev-table)
bef aft)
(message "\"%s\" now expands to \"%s\" %sally"
bef aft (if p "loc" "glob")))
(user-error "No typo at or before point"))))
(setq save-abbrevs 'silently)
;; ===DICTIONARY SWITCH
(defun fd-switch-dictionary()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "english") "romanian-classic" "english")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))
;; ===INSERT FILENAME
(defun my-insert-file-name (filename &optional args)
"Insert name of file FILENAME into buffer after point.
Prefixed with \\[universal-argument], expand the file name to
its fully canocalized path. See `expand-file-name'.
Prefixed with \\[negative-argument], use relative path to file
name from current directory, `default-directory'. See
`file-relative-name'.
The default with no prefix is to insert the file name exactly as
it appears in the minibuffer prompt."
;; Based on insert-file in Emacs -- ashawley 20080926
(interactive "*fInsert file name: \nP")
(cond ((eq '- args)
(insert (file-relative-name filename)))
((not (null args))
(insert (expand-file-name filename)))
(t
(insert filename))))
;; ===WHERE AM I?
(defun org-where-am-i ()
"Returns a string of headers indicating where point is in the current tree."
(interactive)
(let (headers)
(save-excursion
(while (condition-case nil
(progn
(push (nth 4 (org-heading-components)) headers)
(outline-up-heading 1))
(error nil))))
(message (mapconcat #'identity headers " > "))))
;; ===RENAME FILE AND BUFFER
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(progn
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))
;; ===AucTeX SETTINGS
(setq TeX-PDF-mode t)
(setq TeX-fold-mode 1)
(add-hook 'LaTeX-mode-hook
(lambda ()
(push
'("latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
:help "Run latexmk on file")
TeX-command-list)))
(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "latexmk")))
(setq TeX-view-program-selection '((output-pdf "PDF Viewer")))
(setq TeX-view-program-list
'(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b")))
(getenv "PATH")
(setenv "PATH"
(concat
"/Library/TeX/texbin" ":" "usr/local/bin" ":"
(getenv "PATH")))
(setq debug-on-error t)
(setq LaTeX-includegraphics-read-file 'LaTeX-includegraphics-read-file-relative)
;; ===PREVIEW MARKDOWN IN MARKED
(defun markdown-preview-file ()
"run Marked on the current file and revert the buffer"
(interactive)
(shell-command
(format "open -a /Applications/Marked\\ 2.app %s"
(shell-quote-argument (buffer-file-name)))))
;; ===UNFILL REGION AND PARAGRAPH
(defun xah-unfill-paragraph ()
"Replace newline chars in current paragraph by single spaces.
This command does the inverse of `fill-paragraph'.
URL `http://ergoemacs.org/emacs/emacs_unfill-paragraph.html'
Version 2016-07-13"
(interactive)
(let ((fill-column most-positive-fixnum))
(fill-paragraph)))
(defun xah-unfill-region (start end)
"Replace newline chars in region by single spaces.
This command does the inverse of `fill-region'.
URL `http://ergoemacs.org/emacs/emacs_unfill-paragraph.html'
Version 2016-07-13"
(interactive "r")
(let ((fill-column most-positive-fixnum))
(fill-region start end)))
;; ===UNSET MAC SPECIFIC SHORTCUTS
;; from Emacs.app/Contents/Resources/lisp/term/ns-win.el.gz
(global-unset-key [?\s-,])
(global-unset-key [?\s-'])
(global-unset-key [?\s-`])
(global-unset-key [?\s-~])
(global-unset-key [?\s--])
(global-unset-key [?\s-:])
(global-unset-key [?\s-?])
(global-unset-key [?\s-^])
(global-unset-key [?\s-&])
(global-unset-key [?\s-C])
(global-unset-key [?\s-D])
(global-unset-key [?\s-E])
(global-unset-key [?\s-L])
(global-unset-key [?\s-M])
(global-unset-key [?\s-S])
(global-unset-key [?\s-a])
(global-unset-key [?\s-c])
(global-unset-key [?\s-d])
(global-unset-key [?\s-e])
(global-unset-key [?\s-f])
(global-unset-key [?\s-g])
(global-unset-key [?\s-h])
(global-unset-key [?\s-H])
(global-unset-key [?\s-j])
(global-unset-key [?\s-k])
(global-unset-key [?\s-l])
(global-unset-key [?\s-m])
(global-unset-key [?\s-n])
(global-unset-key [?\s-o])
(global-unset-key [?\s-p])
(global-unset-key [?\s-q])
(global-unset-key [?\s-s])
(global-unset-key [?\s-t])
(global-unset-key [?\s-u])
(global-unset-key [?\s-v])
(global-unset-key [?\s-w])
(global-unset-key [?\s-x])
(global-unset-key [?\s-y])
(global-unset-key [?\s-z])
(global-unset-key [?\s-|])
(global-unset-key [s-kp-bar])
;; (as in Terminal.app)
(global-unset-key [s-right])
(global-unset-key [s-left])
(global-unset-key [home])
(global-unset-key [end])
(global-unset-key [kp-home])
(global-unset-key [kp-end])
(global-unset-key [kp-prior])
(global-unset-key [kp-next])
;; Allow shift-clicks to work similarly to under Nextstep.
(global-unset-key [S-mouse-1])
(global-unset-key [S-down-mouse-1])
;; Special Nextstep-generated events are converted to function keys. Here
;; are the bindings for them. Note, these keys are actually declared in
;; x-setup-function-keys in common-win.
(global-unset-key [ns-power-off])
(global-unset-key [ns-open-file])
(global-unset-key [ns-open-temp-file])
(global-unset-key [ns-change-font])
(global-unset-key [ns-open-file-line])
(global-unset-key [ns-spi-service-call])
(global-unset-key [ns-new-frame])
(global-unset-key [ns-toggle-toolbar])
(global-unset-key [ns-show-prefs])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment