;; Start gnuserv (server-start) (add-to-list 'load-path "~/elisp") (load-library "subdirs.el") ;; packages (require 'package) ;; You might already have this line (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (when (< emacs-major-version 24) ;; For important compatibility libraries like cl-lib (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) (package-initialize) ;; You might already have this line ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Beautifiers & commodities (global-font-lock-mode t) (transient-mark-mode t) (column-number-mode t) (mouse-wheel-mode t) (show-paren-mode t) (auto-compression-mode t) (savehist-mode 1) (tool-bar-mode 0) (require 'highlight-current-line) (highlight-current-line-on t) ;; Open unidentified files in text mode (setq default-major-mode 'text-mode) ;; Display clock (display-time) ;; NO sound (setq visible-bell t) ;; show the GNU splash screen (setq inhibit-startup-message nil) ;; Make all "yes or no" prompts show "y or n" instead (fset 'yes-or-no-p 'y-or-n-p) (setq fill-column 70) (setq text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify))) ;; New frame starts in home directory (add-hook 'after-make-frame-functions (lambda (frame) (cd "~") )) (cd "~") ;; dired lists dirs first (setq dired-listing-switches (concat dired-listing-switches " --group-directories-first")) ;; tabbar (require 'tabbar) (tabbar-mode) ;; Printing (setq ps-printer-name "samsung") ;; Icomplete (icomplete-mode 1) (autoload 'longlines-mode "longlines.el" "Minor mode for editing long lines." t) ;; horizontal window splitting (defun my-window-hsplit () (interactive) (let ((w (+ fill-column 5))) (if (> (window-width (selected-window)) 70) (split-window-horizontally w)))) (global-set-key (kbd "C-x 3") 'my-window-hsplit) ;; a couple of useful functions (defun insert-date () "Insert the current date in the ISO 8601 format" (interactive "*") (insert (format-time-string "%Y-%m-%d %T %z" (current-time)))) (defun unfill-paragraph () "Takes a multi-line paragraph and makes it into a single line of text." (interactive) (let ((fill-column (point-max))) (fill-paragraph nil))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Key bindings ;; Make control+pageup/down scroll the other buffer (global-set-key [C-S-next] 'scroll-other-window) (global-set-key [C-S-prior] 'scroll-other-window-down) ;; Cool home key (defun my-home-key () (interactive) (let ((f (current-column))) (beginning-of-line) (skip-chars-forward " \t") (if (= (current-column) f) (beginning-of-line)))) (global-set-key (kbd "") 'my-home-key) (global-set-key (kbd "C-a") 'my-home-key) (global-set-key (kbd "") 'end-of-line) (global-set-key (kbd "C-") 'beginning-of-buffer) (global-set-key (kbd "C-") 'end-of-buffer) (global-set-key (kbd "C-") 'other-window) (global-set-key (kbd "M-[") 'TeX-previous-error) (global-set-key (kbd "M-]") 'TeX-next-error) (global-set-key [f12] 'delete-other-windows) (setq compilation-ask-about-save nil) (setq compilation-scroll-output t) (setq compilation-window-height 8) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Packages configuration ;; Wanderlust (setq smtp-end-of-line "\n") (autoload 'wl "wl" nil t) (autoload 'wl-other-frame "wl" nil t) (autoload 'wl-user-agent-compose "wl-draft" nil t) (if (boundp 'mail-user-agent) (setq mail-user-agent 'wl-user-agent)) (if (fboundp 'define-mail-user-agent) (define-mail-user-agent 'wl-user-agent 'wl-user-agent-compose 'wl-draft-send 'wl-draft-kill 'mail-send-hook)) (if (boundp 'read-mail-command) (setq read-mail-command 'wl)) ;; AucTeX (load-library "auctex") (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t) (autoload 'flyspell-delay-command "flyspell" "Delay on command." t) (autoload 'tex-mode-flyspell-verify "flyspell" "" t) (add-hook 'LaTeX-mode-hook (lambda () (setq reftex-plug-into-AUCTeX t reftex-cite-format 'natbib reftex-isearch-minor-mode t ;; Inverse DVI Search TeX-source-correlate-method 'source-specials TeX-source-specials-view-start-server t) (TeX-source-specials-mode t) (setq tex-dvi-view-command "xdvi -s 7 -editor 'emacsclient -a emacs --no-wait +%l %f'") (setq LaTeX-command-style '(("" "%(PDF)%(latex) -file-line-error %S%(PDFout)"))) (flyspell-mode) (turn-on-reftex) (LaTeX-math-mode) (setq reftex-section-levels (append reftex-section-levels '(("todo" . -7) ("note" . -7)))))) ;; Markdown (autoload 'markdown-mode "markdown-mode" "Major mode for editing Markdown files" t) (add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode)) (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode)) (setq markdown-enable-math t) (add-hook 'markdown-mode-hook 'LaTeX-math-mode) (load "pandoc-mode") (add-hook 'markdown-mode-hook 'pandoc-mode) (add-hook 'pandoc-mode-hook 'pandoc-load-default-settings) (global-set-key (kbd "C-c p") 'pandoc-convert-to-pdf) (when window-system (define-key global-map [C-M-mouse-1] 'imenu)) ;;; Haskell (autoload 'run-haskell "inf-haskell" "" t) (setq haskell-program-name "stack ghci") (setq haskell-process-type 'stack-ghci) ;;; (setq haskell-mode-hook (lambda nil ;;; (ghc-init))) (setq haskell-mode-hook nil) (add-hook 'haskell-mode-hook 'haskell-indentation-mode) (add-hook 'haskell-mode-hook 'interactive-haskell-mode) ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent) (add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan) (eval-after-load 'flycheck '(add-hook 'flycheck-mode-hook #'flycheck-haskell-setup)) (setq flymake-start-syntax-check-on-find-file nil) ;; Tramp (setq tramp-default-method "ssh") ;; org-mode (setq org-log-done 'time) ;; i/aspell (setq ispell-program-name "aspell") (setq ispell-dictionary "british") (setq safe-local-variable-values '((ispell-local-dictionary . "british") (ispell-local-dictionary . "american") (ispell-local-dictionary . "francais") ))