Indent code

This commit is contained in:
Marcus Kammer 2020-06-22 15:23:52 +02:00
parent a79d731f32
commit 1f71316b34

330
init.el
View file

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