diff --git a/init.el b/init.el index 4b49484f..643cfff8 100755 --- a/init.el +++ b/init.el @@ -5,196 +5,192 @@ (server-start)) ;; PACKAGE - (require 'package) - (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) - (not (gnutls-available-p)))) - (proto (if no-ssl "http" "https"))) - (when no-ssl - (warn "\ - Your version of Emacs does not support SSL connections, - which is unsafe because it allows man-in-the-middle attacks. - There are two things you can do about this warning: - 1. Install an Emacs version that does support SSL and be safe. - 2. Remove this warning from your init file so you won't see it again.")) - ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired - (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) - ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) - (when (< emacs-major-version 24) - ;; For important compatibility libraries like cl-lib - (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) - (package-initialize) +(require 'package) +(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos)) + (not (gnutls-available-p)))) + (proto (if no-ssl "http" "https"))) + (when no-ssl + (warn "\ +Your version of Emacs does not support SSL connections, +which is unsafe because it allows man-in-the-middle attacks. +There are two things you can do about this warning: +1. Install an Emacs version that does support SSL and be safe. +2. Remove this warning from your init file so you won't see it again.")) + ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired + (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t) + ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t) + (when (< emacs-major-version 24) + ;; For important compatibility libraries like cl-lib + (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/"))))) +(package-initialize) ;; OS SETTINGS - (when (eq system-type 'gnu/linux) - (setq custom-file "~/.emacs.d/bundle/custom_gnu.el")) +(when (eq system-type 'gnu/linux) +(setq custom-file "~/.emacs.d/bundle/custom_gnu.el")) - (when (eq system-type 'windows-nt) - (setq custom-file "~/.emacs.d/bundle/custom_win32.el") - (add-to-list 'load-path (expand-file-name "~/AppData/Roaming/__secrets")) - (cd "~/opt") - (when (string= (system-name) "EVG02667NB") - (setq custom-file "~/.emacs.d/bundle/custom_win32_EVG02667NB.el")) - (when (string= (system-name) "XPS-8930"))) +(when (eq system-type 'windows-nt) +(setq custom-file "~/.emacs.d/bundle/custom_win32.el") +(add-to-list 'load-path (expand-file-name "~/AppData/Roaming/__secrets")) +(cd "~/opt") +(when (string= (system-name) "EVG02667NB") + (setq custom-file "~/.emacs.d/bundle/custom_win32_EVG02667NB.el")) +(when (string= (system-name) "XPS-8930"))) ;; CUSTOM_FILE - (load custom-file :noerror) +(load custom-file :noerror) ;; DISPLAY SETTINGS - ;; General userinterface and appearance - (global-font-lock-mode t) ; Color enabled - (global-prettify-symbols-mode t) ; Prettify symbols - (global-hl-line-mode 1) ; Highlight cursor line - (global-whitespace-mode -1) ; Show whitespace globally - (show-paren-mode 1) ; Visual matching parens - (global-display-line-numbers-mode -1) ; Display line numbers - ;; Mode line specific - (column-number-mode 1) ; Display column number in the mode line - (size-indication-mode -1) ; Display buffer size in the mode line - (line-number-mode 1) ; Display line number in the mode line - (display-battery-mode -1) ; Display battery status in the mode line - (display-time-mode 1) ; Display time in the mode line +;; General userinterface and appearance +(global-font-lock-mode t) ; Color enabled +(global-prettify-symbols-mode t) ; Prettify symbols +(global-hl-line-mode 1) ; Highlight cursor line +(global-whitespace-mode -1) ; Show whitespace globally +(show-paren-mode 1) ; Visual matching parens +(global-display-line-numbers-mode -1) ; Display line numbers +;; Mode line specific +(column-number-mode 1) ; Display column number in the mode line +(size-indication-mode -1) ; Display buffer size in the mode line +(line-number-mode 1) ; Display line number in the mode line +(display-battery-mode -1) ; Display battery status in the mode line +(display-time-mode 1) ; Display time in the mode line - (load-theme 'nord t) +(load-theme 'nord t) ;; GLOBAL KEYS - (global-set-key (kbd "C-c l") 'org-store-link) - (global-set-key (kbd "C-c a") 'org-agenda) - (global-set-key (kbd "C-c c") 'org-capture) - (global-set-key (kbd "C-c b") 'org-switchb) - ;; (global-set-key (kbd "C-c C-x m") 'org-pomodoro) - (global-set-key (kbd "C-x g") 'magit-status) - (global-set-key (kbd "C-x M-g") 'magit-dispatch) - (global-set-key (kbd "M-i") 'imenu) - (global-set-key (kbd "C-c n") 'newsticker-start) - (global-set-key (kbd "M-o") 'ace-window) +(global-set-key (kbd "C-c l") 'org-store-link) +(global-set-key (kbd "C-c a") 'org-agenda) +(global-set-key (kbd "C-c c") 'org-capture) +(global-set-key (kbd "C-c b") 'org-switchb) +;; (global-set-key (kbd "C-c C-x m") 'org-pomodoro) +(global-set-key (kbd "C-x g") 'magit-status) +(global-set-key (kbd "C-x M-g") 'magit-dispatch) +(global-set-key (kbd "M-i") 'imenu) +(global-set-key (kbd "C-c n") 'newsticker-start) +(global-set-key (kbd "M-o") 'ace-window) ;; UTF-8 FTW - (prefer-coding-system 'utf-8) - (set-default-coding-systems 'utf-8) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) - (setq default-buffer-file-coding-system 'utf-8) - (defalias 'yes-or-no-p 'y-or-n-p) +(prefer-coding-system 'utf-8) +(set-default-coding-systems 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(setq default-buffer-file-coding-system 'utf-8) +(defalias 'yes-or-no-p 'y-or-n-p) ;; PACKAGES - (ivy-mode 1) +(ivy-mode 1) - (use-package elpy - :ensure t - :init - (elpy-enable)) +(use-package elpy + :ensure t + :init + (elpy-enable)) - (use-package js2-mode - :ensure t - :interpreter (("node" . js2-mode)) - :bind (:map js2-mode-map ("C-c C-p" . js2-print-json-path)) - :mode "\\.\\(js\\|json\\)$" - :config - (add-hook 'js-mode-hook 'js2-minor-mode) - (setq js2-basic-offset 2 - js2-highlight-level 3 - js2-mode-show-parse-errors nil - js2-mode-show-strict-warnings nil)) +(use-package js2-mode + :ensure t + :interpreter (("node" . js2-mode)) + :bind (:map js2-mode-map ("C-c C-p" . js2-print-json-path)) + :mode "\\.\\(js\\|json\\)$" + :config + (add-hook 'js-mode-hook 'js2-minor-mode) + (setq js2-basic-offset 2 + js2-highlight-level 3 + js2-mode-show-parse-errors nil + js2-mode-show-strict-warnings nil)) - (use-package web-mode - :ensure t - :mode "\\.html?\\'" - :init - (dolist (hook '(emmet-mode ac-emmet-html-setup ac-emmet-css-setup)) - (add-hook 'web-mode-hook hook)) - :config - (setq web-mode-markup-indent-offset 2 - web-mode-css-indent-offset 2 - web-mode-code-indent-offset 2 - web-mode-enable-auto-pairing nil - web-mode-enable-auto-closing t - web-mode-enable-current-element-highlight t - web-mode-enable-current-column-highlight t - web-mode-ac-sources-alist - '(("css" . (ac-source-css-property ac-source-emmet-css-snippets)) - ("html" . (ac-source-emmet-html-aliases - ac-source-emmet-html-snippets)))) - (add-hook 'web-mode-before-auto-complete-hooks - '(lambda () - (let ((web-mode-cur-language (web-mode-language-at-pos))) - (if (string= web-mode-cur-language "css") - (setq emmet-use-css-transform t) - (setq emmet-use-css-transform nil))))) - (defun zakame/sp-web-mode-code-context-p (id action context) - "Set smartparens context when in web-mode." - (and (eq action 'insert) - (not (or (get-text-property (point) 'part-side) - (get-text-property (point) 'block-side))))) - (sp-local-pair 'web-mode "<" nil :when '(zakame/sp-web-mode-code-context-p))) +(use-package web-mode + :ensure t + :mode "\\.html?\\'" + :init + (dolist (hook '(emmet-mode ac-emmet-html-setup ac-emmet-css-setup)) + (add-hook 'web-mode-hook hook)) + :config + (setq web-mode-markup-indent-offset 2 + web-mode-css-indent-offset 2 + web-mode-code-indent-offset 2 + web-mode-enable-auto-pairing nil + web-mode-enable-auto-closing t + web-mode-enable-current-element-highlight t + web-mode-enable-current-column-highlight t + web-mode-ac-sources-alist + '(("css" . (ac-source-css-property ac-source-emmet-css-snippets)) + ("html" . (ac-source-emmet-html-aliases + ac-source-emmet-html-snippets)))) + (add-hook 'web-mode-before-auto-complete-hooks + '(lambda () + (let ((web-mode-cur-language (web-mode-language-at-pos))) + (if (string= web-mode-cur-language "css") + (setq emmet-use-css-transform t) + (setq emmet-use-css-transform nil))))) + (defun zakame/sp-web-mode-code-context-p (id action context) + "Set smartparens context when in web-mode." + (and (eq action 'insert) + (not (or (get-text-property (point) 'part-side) + (get-text-property (point) 'block-side))))) + (sp-local-pair 'web-mode "<" nil :when '(zakame/sp-web-mode-code-context-p))) - (use-package slime - :ensure t - :config (setq inferior-lisp-program (executable-find "sbcl"))) +(use-package slime + :ensure t + :config (setq inferior-lisp-program (executable-find "sbcl"))) ;; ORG_MODE SETTINGS - (setq org-agenda-dim-blocked-tasks nil - org-agenda-inhibit-startup nil - org-babel-load-languages (quote - ((js . t) - (gnuplot . t) - (emacs-lisp . t) - (python . t) - (sqlite . t) - (lisp . t) - (shell . t) - (css . t) - (calc . t) - (plantuml . t) - (dot . t))) - org-babel-shell-names (quote ("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")) - org-clock-persist t - org-confirm-babel-evaluate nil - org-html-doctype "html5" - org-html-html5-fancy t - org-log-done (quote time) - org-startup-folded t - org-startup-truncated nil - org-todo-keywords (quote ((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) - org-use-property-inheritance nil) - (org-clock-persistence-insinuate) +(setq org-agenda-dim-blocked-tasks nil + org-agenda-inhibit-startup nil + org-babel-load-languages (quote + ((js . t) + (gnuplot . t) + (emacs-lisp . t) + (python . t) + (sqlite . t) + (lisp . t) + (shell . t) + (css . t) + (calc . t) + (plantuml . t) + (dot . t))) + org-babel-shell-names (quote ("sh" "bash" "csh" "ash" "dash" "ksh" "mksh" "posh")) + org-clock-persist t + org-confirm-babel-evaluate nil + org-html-doctype "html5" + org-html-html5-fancy t + org-log-done (quote time) + org-startup-folded t + org-startup-truncated nil + org-todo-keywords (quote ((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) + org-use-property-inheritance nil) +(org-clock-persistence-insinuate) ;; HOOKS - (add-hook 'diary-display-hook 'fancy-diary-display) - (add-hook 'today-visible-calendar-hook 'calendar-mark-today) - (add-hook 'write-file-hooks 'delete-trailing-whitespace) - (add-hook 'org-mode-hook 'turn-on-auto-fill) - (add-hook 'rst-mode-hook 'turn-on-orgstruct) - (add-hook 'newsticker-mode-hook 'imenu-add-menubar-index) - (add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode)) +(add-hook 'diary-display-hook 'fancy-diary-display) +(add-hook 'today-visible-calendar-hook 'calendar-mark-today) +(add-hook 'write-file-hooks 'delete-trailing-whitespace) +(add-hook 'org-mode-hook 'turn-on-auto-fill) +(add-hook 'rst-mode-hook 'turn-on-orgstruct) +(add-hook 'newsticker-mode-hook 'imenu-add-menubar-index) +(add-to-list 'auto-mode-alist '("\\.tmpl\\'" . web-mode)) ;; DIARY - (setq cal-html-directory "~/Documents/Diary" - view-diary-entries-initially t - mark-diary-entries-in-calendar t - number-of-diary-entries 7 - calendar-date-style (quote iso) - calendar-week-start-day 1) - (setq calendar-intermonth-text - (quote - (propertize - (format "%2d" - (car - (calendar-iso-from-absolute - (calendar-absolute-from-gregorian - (list month day year))))) - (quote font-lock-face) - (quote font-lock-function-name-face)))) - (when (string= (system-name) "EVG02667NB") - (unless (file-directory-p (expand-file-name "~/Documents")) - (let ((docs-path (getenv "DOCS_PATH"))) - (setq cal-html-directory (concat docs-path "\\Diary") - diary-file (concat docs-path "\\Diary\\diary") - timeclock-file (concat docs-path "\\Diary\\timelog"))))) - (provide 'calendar-settings) +(setq cal-html-directory "~/Documents/Diary" + view-diary-entries-initially t + mark-diary-entries-in-calendar t + number-of-diary-entries 7 + calendar-date-style (quote iso) + calendar-week-start-day 1) +(setq calendar-intermonth-text + (quote + (propertize + (format "%2d" + (car + (calendar-iso-from-absolute + (calendar-absolute-from-gregorian + (list month day year))))) + (quote font-lock-face) + (quote font-lock-function-name-face)))) +(when (string= (system-name) "EVG02667NB") + (unless (file-directory-p (expand-file-name "~/Documents")) + (let ((docs-path (getenv "DOCS_PATH"))) + (setq cal-html-directory (concat docs-path "\\Diary") + diary-file (concat docs-path "\\Diary\\diary") + timeclock-file (concat docs-path "\\Diary\\timelog"))))) +(provide 'calendar-settings) -;; Local Variables: -;; mode: emacs-lisp -;; coding: utf-8 -;; fill-column: 79 -;; End: +(put 'narrow-to-region 'disabled nil)