Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
7.4 KiB

преди 5 години
  1. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Define%20Default%20packages][Define Default packages:1]]
  2. (defvar abedra/packages '(ac-slime
  3. auto-complete
  4. autopair
  5. cider
  6. clojure-mode
  7. elpy
  8. f
  9. feature-mode
  10. flycheck
  11. graphviz-dot-mode
  12. htmlize
  13. magit
  14. markdown-mode
  15. org
  16. paredit
  17. powerline
  18. rvm
  19. smex
  20. solarized-theme
  21. web-mode
  22. writegood-mode
  23. yaml-mode)
  24. "Default packages")
  25. ;; Define Default packages:1 ends here
  26. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Install%20Default%20packages][Install Default packages:1]]
  27. (defun abedra/packages-installed-p ()
  28. (cl-loop for pkg in abedra/packages
  29. when (not (package-installed-p pkg)) do (cl-return nil)
  30. finally (cl-return t)))
  31. (unless (abedra/packages-installed-p)
  32. (message "%s" "Refreshing package database...")
  33. (package-refresh-contents)
  34. (dolist (pkg abedra/packages)
  35. (when (not (package-installed-p pkg))
  36. (package-install pkg))))
  37. ;; Install Default packages:1 ends here
  38. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Backup%20files][Backup files:1]]
  39. (setq make-backup-files nil)
  40. ;; Backup files:1 ends here
  41. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Yes%20and%20No][Yes and No:1]]
  42. (defalias 'yes-or-no-p 'y-or-n-p)
  43. ;; Yes and No:1 ends here
  44. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Misc][Misc:1]]
  45. (setq echo-keystrokes 0.1
  46. use-dialog-box nil
  47. visible-bell t)
  48. (show-paren-mode t)
  49. ;; Misc:1 ends here
  50. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*repos][repos:1]]
  51. (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
  52. ;; repos:1 ends here
  53. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*c++][c++:1]]
  54. (use-package ggtags
  55. :ensure t
  56. :config
  57. (add-hook 'c-mode-common-hook
  58. (lambda ()
  59. (when (derived-mode-p 'c-mode 'c++-mode 'java-mode)
  60. (ggtags-mode 1))))
  61. )
  62. ;; c++:1 ends here
  63. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Orgmode][Orgmode:1]]
  64. (global-set-key "\C-ca" 'org-agenda)
  65. (global-set-key "\C-cc" 'org-capture)
  66. ;;(add-hook 'after-init-hook 'org-agenda-list)
  67. ;;(delete-other-windows)
  68. (add-to-list 'org-modules "org-habit")
  69. ;; DOCUMENTS MINTED
  70. ;(require 'ox-latex)
  71. ;(add-to-list 'org-latex-packages-alist '("" "minted"))
  72. ;(setq org-latex-listings 'minted)
  73. ;(require 'org-latex)
  74. ;(setq org-export-latex-listings 'minted)
  75. ;(add-to-list 'org-export-latex-packages-alist '("" "minted"))
  76. ;; Minted
  77. ; (require 'ox-latex)
  78. ; (setq org-latex-listings 'minted)
  79. ;(setq org-latex-pdf-process
  80. ; '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
  81. ; "bibtex $(basename %b)"
  82. ; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
  83. ; "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
  84. ;; Babel src evaluator
  85. ;(setq debug-on-error t)
  86. ;(org-babel-do-load-languages
  87. ;'org-babel-load-languages
  88. ;'((python . t)))
  89. (setq org-agenda-files (list "~/Documents/org/todo.org"
  90. "~/Documents/org/i.org"
  91. "~/Documents/org/habits.org"
  92. "~/Documents/org/links.org"
  93. "~/Documents/org/school.org"))
  94. (setq org-agenda-start-on-weekday 1)
  95. (setq org-agenda-custom-commands
  96. '(("h" "Daily habits"
  97. ((agenda ""))
  98. ((org-agenda-show-log t)
  99. (org-agenda-ndays 7)
  100. (org-agenda-log-mode-items '(state))
  101. (org-agenda-skip-function '(org-agenda-skip-entry-if 'notregexp ":DAILY:"))))
  102. ;; other commands here
  103. ))
  104. (setq org-capture-templates
  105. '(("a" "Appointment" entry (file "~/Documents/org/i.org" )
  106. "* %^{Appointment:}%?\n\n%^T\n\n:PROPERTIES:\n\n:END:\n\n")
  107. ("l" "Link" entry (file+headline "~/Documents/org/links.org" "Links")
  108. "* %? %^L %^g \n%T" :prepend t)
  109. ("b" "Blog idea" entry (file+headline "~/Documents/org/i.org" "Blog Topics:")
  110. "* %?\n%T" :prepend t)
  111. ("t" "To Do Item" entry (file+headline "~/Documents/org/todo.org" "To Do")
  112. "* TODO %^{TODO:}\nSCHEDULED: %^t\nPROPERTIES:\n:CREATED: %u\n:END:\n%a\n" )
  113. ("m" "Meeting" entry (file "~/Documents/org/i.org")
  114. "* MEETING with %? :MEETING:\n%t" :clock-in t :clock-resume t)
  115. ("n" "Note" entry (file+headline "~/Documents/org/i.org" "Note space")
  116. "* %?\n%u" :prepend t)
  117. ("j" "Journal" entry (file+datetree "~/Documents/org/journal.org")
  118. "* %?\nEntered on %U\n %i\n %a")
  119. ("s" "Screencast" entry (file "~/Documents/org/screencastnotes.org")
  120. "* %?\n%i\n")
  121. ;; School templates
  122. ("T" "Test" entry (file+headline "~/Documents/org/school.org" "Testy")
  123. "* TEST [#A] %^{Test:}%?\n\tDEADLINE: %^t\n:PROPERTIES:\n:CREATED: %U\n:END:\n\n" :empty-lines 1)
  124. )) ;; end
  125. (setq org-log-done 'time)
  126. ;; Orgmode:1 ends here
  127. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Themes%20and%20modeline][Themes and modeline:1]]
  128. (use-package moe-theme
  129. :ensure t)
  130. (load-theme 'moe-dark t)
  131. ;; Themes and modeline:1 ends here
  132. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*Htmlize][Htmlize:1]]
  133. (use-package htmlize
  134. :ensure t)
  135. ;; Htmlize:1 ends here
  136. ;; [[file:~/dotfiles/emacs/.emacs.d/myinit.org::*yasnippet][yasnippet:1]]
  137. ;(global-set-key "\C-i" 'yas-expand)
  138. (setq yas-trigger-key "TAB")
  139. (setq yas-triggers-in-field t)
  140. ;;; use popup menu for yas-choose-value
  141. ;; trigger using TAB and disable auto-start
  142. ;(custom-set-variables
  143. ; '(ac-trigger-key "TAB")
  144. ; '(ac-auto-start nil)
  145. ; '(ac-use-menu-map t))
  146. ;(define-key ac-menu-map (kbd "<tab>") nil)
  147. ;(define-key ac-menu-map (kbd "<S-tab>") nil)
  148. (use-package validate
  149. :ensure t)
  150. (defmacro validate-setq (&rest svs)
  151. "Like `setq', but throw an error if validation fails.
  152. VALUE is validated against SYMBOL's custom type.
  153. \(fn [SYM VAL] ...)"
  154. (let ((out))
  155. (while svs
  156. (let ((symbol (pop svs))
  157. (value (if (not svs)
  158. (error "`validate-setq' takes an even number of arguments")
  159. (pop svs))))
  160. (push `(if (boundp ',symbol)
  161. (setq ,symbol (validate-value ,value (custom-variable-type ',symbol)))
  162. (user-error "Trying to validate a variable that's not defined yet: `%s'.\nYou need to require the package before validating"
  163. ',symbol))
  164. out)))
  165. `(progn ,@(reverse out))))
  166. (use-package yasnippet
  167. :ensure t
  168. :diminish yas-minor-mode
  169. :init (yas-global-mode t))
  170. ;; Autocomplete
  171. ;; Code-comprehension server
  172. (defun check-expansion ()
  173. (save-excursion
  174. (if (looking-at "\\_>") t
  175. (backward-char 1)
  176. (if (looking-at "\\.") t
  177. (backward-char 1)
  178. (if (looking-at "->") t nil)))))
  179. (defun do-yas-expand ()
  180. (let ((yas/fallback-behavior 'return-nil))
  181. (yas/expand)))
  182. (defun tab-indent-or-complete ()
  183. (interactive)
  184. (if (minibufferp)
  185. (minibuffer-complete)
  186. (if (or (not yas/minor-mode)
  187. (null (do-yas-expand)))
  188. (if (check-expansion)
  189. (company-complete-common)
  190. (indent-for-tab-command)))))
  191. (global-set-key [tab] 'tab-indent-or-complete)
  192. (use-package yasnippet-snippets
  193. :ensure t)
  194. ;; yasnippet:1 ends here