Guest User

dot_emacs_file

a guest
Sep 11th, 2017
556
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  (custom-set-variables
  2.  ;; custom-set-variables was added by Custom.
  3.  ;; If you edit it by hand, you could mess it up, so be careful.
  4.  ;; Your init file should contain only one such instance.
  5.  ;; If there is more than one, they won't work right.
  6.  '(ansi-color-names-vector
  7.    ["#2e3436" "#a40000" "#4e9a06" "#c4a000" "#204a87" "#5c3566" "#729fcf" "#eeeeec"])
  8.  '(custom-enabled-themes (quote (tsdh-dark)))
  9.  '(custom-safe-themes
  10.    (quote
  11.     ("4e753673a37c71b07e3026be75dc6af3efbac5ce335f3707b7d6a110ecb636a3" default)))
  12.  '(org-agenda-files
  13.    (quote
  14.     ("c:/Users/nd04805/Documents/99_EMACS/work/list.org"
  15.      "c:/Users/nd04805/Documents/99_EMACS/work/temp.org"
  16.      "c:/Users/nd04805/Documents/99_EMACS/work/t2.org"
  17.      "c:/Users/nd04805/Documents/99_EMACS/work/t1.org"
  18.      "c:/Users/nd04805/AppData/Roaming/org/gtd.org"))))
  19. ;; Adding MELPA packages to the Emacs
  20. (when (>= emacs-major-version 24)
  21.   (require 'package)
  22.   (add-to-list
  23.    'package-archives
  24.    '("melpa" . "http://melpa.org/packages/")
  25.    t)
  26.   (require 'package)
  27. (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
  28.   (package-initialize))
  29. ;; Start Emacs window maximized
  30. (add-to-list 'default-frame-alist '(fullscreen . maximized))
  31. ;;Enabling Ido mode to do things interactively
  32.     (require 'ido)
  33.     (ido-mode t)
  34.  
  35. (custom-set-faces
  36.  ;; custom-set-faces was added by Custom.
  37.  ;; If you edit it by hand, you could mess it up, so be careful.
  38.  ;; Your init file should contain only one such instance.
  39.  ;; If there is more than one, they won't work right.
  40.  )
  41. ;; This is for org-mode agenda view activation
  42.  (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  43.  ;; This is for key bindings to invoke agenda mode (see line-2)
  44.  (global-set-key "\C-cl" 'org-store-link)
  45.  (global-set-key "\C-ca" 'org-agenda)
  46.  (global-set-key "\C-cc" 'org-capture)
  47. (global-set-key "\C-cb" 'org-iswitchb)
  48.  
  49.  
  50. (add-to-list 'load-path "C:\\Users\\nd04805\\Documents\\99_EMACS\\work\\PPT")
  51. (require 'ox-reveal)
  52. (setq org-reveal-root "file:///C:\\Users\\nd04805\\Documents\\99_EMACS\\work\\PPT\\reveal.js")
  53.  
  54. ;; This will silence the annoying audio bell
  55. (setq visible-bell t)
  56. ;; Uncomment the code below just in case if you want to do away with the visible flash as well
  57. ;;(setq ring-bell-function 'ignore)
  58.  
  59. ;; Remove the emphasis signs like * for BOLD and / for Italics etc
  60. (setq org-hide-emphasis-markers nil)
  61.  
  62. ;; Display the org clock sum in terms of hours and not in units of days
  63. (setq org-time-clocksum-format (quote (:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)))
  64.  
  65. ;; Change font and font size
  66. ;; (set-frame-font "Consolas 12" t)
  67. (add-to-list 'default-frame-alist
  68.           '(font . "Consolas 14"))
  69.          ;; '(font . "Inconsolata 14"))
  70.  
  71. ;; switch to buffer list along with focus (no need to press C-x o after C-x C-b)
  72. (global-set-key (kbd "C-x C-b") 'ibuffer)
  73.  
  74. (setq make-backup-files nil) ; stop creating backup~ files
  75. (setq auto-save-default nil) ; stop creating #autosave# files
  76.  
  77. ;; Swiper for search
  78. (global-set-key "\C-s" 'swiper)
  79.  
  80. ;; Browse kill ring
  81.        (global-set-key "\C-cy" '(lambda ()
  82.                                  (interactive)
  83.                                  (popup-menu 'yank-menu)))
  84. ;; Kill the current buffer - rather than providing a list of buffer options to kill
  85. ;; Review the below code. In the buffers list (iBuffer) - unable to mark several buffers
  86. ;; After marking the first buffer - Emacs prompts for confirmation - Update from reddit
  87. ;; (global-set-key "\C-xk" 'kill-this-buffer)
  88.  
  89. ;; Typing of Emacs - a game to improve typing speed
  90.      (add-to-list 'load-path "C:\\Users\\nd04805\\AppData\\Roaming\\.emacs.d")
  91.      (autoload 'typing-of-emacs "typing" "The Typing Of Emacs, a game." t)
  92. (put 'upcase-region 'disabled nil)
  93. (put 'downcase-region 'disabled nil)
  94.  
  95. ;; Keep a recent list of opened files in emacs
  96. (require 'recentf)
  97. (setq recentf-max-saved-items 200
  98.       recentf-max-menu-items 15)
  99. (recentf-mode +1)
  100. ;;
  101. ;; Use ido mode to display the list of recent files
  102. (defun recentf-ido-find-file ()
  103.   "Find a recent file using ido."
  104.   (interactive)
  105.   (let ((file (ido-completing-read "Choose recent file: " recentf-list nil t)))
  106.     (when file
  107.       (find-file file))))
  108.  
  109. ;; Keybinding for the recent-ido-find-file function
  110. (global-set-key (kbd "C-c f") 'recentf-ido-find-file)
  111.  
  112. ;; Making org-mode not open the MS office files as ZIP archives
  113. (setq org-file-apps
  114.      
  115.       '(("\\.docx\\'" . default)
  116.     ("\\.xlsx\\'" . default)
  117.     ("\\.pptx\\'" . default)
  118.         (auto-mode . emacs)))
  119. ;; Tabbar ruler - enables tabbar
  120.   (setq tabbar-ruler-global-tabbar t) ; If you want tabbar
  121.   (setq tabbar-ruler-global-ruler t) ; if you want a global ruler
  122. ;;  (setq tabbar-ruler-popup-menu t) ; If you want a popup menu.
  123. ;;  (setq tabbar-ruler-popup-toolbar t) ; If you want a popup toolbar
  124. ;;  (setq tabbar-ruler-popup-scrollbar t) ; If you want to only show the
  125.                                         ; scroll bar when your mouse is moving.
  126.   (require 'tabbar-ruler)
  127.  
  128. ;; Enable markdown mode when exporting
  129.   (require 'ox-md)
  130.  
  131. ;; location to capture templates and org-capture key definition
  132.      (setq org-default-notes-file (concat org-directory "/notes.org"))
  133.      (define-key global-map "\C-cc" 'org-capture)
  134.  
  135. ;; Template configuration for ToDo list and Journal
  136.      (setq org-capture-templates
  137.       '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
  138.              "* TODO %?\n  %i\n  %a")
  139.         ("j" "Journal" entry (file+datetree "~/org/journal.org")
  140.              "* %?\nEntered on %U\n  %i\n  %a")))
  141.  
  142. ;; Enable hydra
  143.   (require 'hydra)
  144.  
  145. ;; Hydra window moving
  146. (global-set-key (kbd "C-M-o")
  147.  (defhydra hydra-window ()
  148.    "
  149. Movement^^        ^Split^         ^Switch^      ^Resize^
  150. ----------------------------------------------------------------
  151. _h_ ←         _v_ertical      _b_uffer        _q_ X←
  152. _j_ ↓         _x_ horizontal  _f_ind files    _w_ X↓
  153. _k_ ↑         _z_ undo        _a_ce 1     _e_ X↑
  154. _l_ →         _Z_ reset       _s_wap      _r_ X→
  155. _F_ollow        _D_lt Other     _S_ave      max_i_mize
  156. _SPC_ cancel    _o_nly this     _d_elete       
  157. "
  158.    ("h" windmove-left )
  159.    ("j" windmove-down )
  160.    ("k" windmove-up )
  161.    ("l" windmove-right )
  162.    ("q" hydra-move-splitter-left)
  163.    ("w" hydra-move-splitter-down)
  164.    ("e" hydra-move-splitter-up)
  165.    ("r" hydra-move-splitter-right)
  166.    ("b" helm-mini)
  167.    ("f" helm-find-files)
  168.    ("F" follow-mode)
  169.    ("a" (lambda ()
  170.           (interactive)
  171.           (ace-window 1)
  172.           (add-hook 'ace-window-end-once-hook
  173.                     'hydra-window/body))
  174.        )
  175.    ("v" (lambda ()
  176.           (interactive)
  177.           (split-window-right)
  178.           (windmove-right))
  179.        )
  180.    ("x" (lambda ()
  181.           (interactive)
  182.           (split-window-below)
  183.           (windmove-down))
  184.        )
  185.    ("s" (lambda ()
  186.           (interactive)
  187.           (ace-window 4)
  188.           (add-hook 'ace-window-end-once-hook
  189.                     'hydra-window/body)))
  190.    ("S" save-buffer)
  191.    ("d" delete-window)
  192.    ("D" (lambda ()
  193.           (interactive)
  194.           (ace-window 16)
  195.           (add-hook 'ace-window-end-once-hook
  196.                     'hydra-window/body))
  197.        )
  198.    ("o" delete-other-windows)
  199.    ("i" ace-maximize-window)
  200.    ("z" (progn
  201.           (winner-undo)
  202.           (setq this-command 'winner-undo))
  203.    )
  204.    ("Z" winner-redo)
  205.    ("SPC" nil)
  206.    ))
  207.  
  208. ;;* Helpers
  209. (require 'windmove)
  210.  
  211. (defun hydra-move-splitter-left (arg)
  212.   "Move window splitter left."
  213.   (interactive "p")
  214.   (if (let ((windmove-wrap-around))
  215.         (windmove-find-other-window 'right))
  216.       (shrink-window-horizontally arg)
  217.     (enlarge-window-horizontally arg)))
  218.  
  219. (defun hydra-move-splitter-right (arg)
  220.   "Move window splitter right."
  221.   (interactive "p")
  222.   (if (let ((windmove-wrap-around))
  223.         (windmove-find-other-window 'right))
  224.       (enlarge-window-horizontally arg)
  225.     (shrink-window-horizontally arg)))
  226.  
  227. (defun hydra-move-splitter-up (arg)
  228.   "Move window splitter up."
  229.   (interactive "p")
  230.   (if (let ((windmove-wrap-around))
  231.         (windmove-find-other-window 'up))
  232.       (enlarge-window arg)
  233.     (shrink-window arg)))
  234.  
  235. (defun hydra-move-splitter-down (arg)
  236.   "Move window splitter down."
  237.   (interactive "p")
  238.   (if (let ((windmove-wrap-around))
  239.         (windmove-find-other-window 'up))
  240.       (shrink-window arg)
  241.     (enlarge-window arg)))
  242.  
  243. ;; Helm package
  244.  
  245. (require 'helm-config)
  246. (put 'dired-find-alternate-file 'disabled nil)
  247.  
  248. ;; Enable org speed keys
  249. (setq org-use-speed-commands t)
  250.    
  251. ;; Force for 4 space tabs over 8 space tabs
  252. (setq-default indent-tabs-mode nil)
  253. (setq-default tab-width 4)
  254. (setq indent-line-function 'insert-tab)
  255.  
  256. ;; The following line was added by Emacs itself
  257. ;; when I tried to use the narrowing function
  258. (put 'narrow-to-region 'disabled nil)
  259.  
  260. ;; Setting to support UTF-8 character support in files
  261. (set-language-environment "UTF-8")
  262. (set-default-coding-systems 'utf-8)
RAW Paste Data