From b9618fb0afc13408b38ab97feb163e437d47d161 Mon Sep 17 00:00:00 2001 From: Marc Pohling Date: Thu, 19 Dec 2019 12:41:08 +0100 Subject: [PATCH] replaced all me/whoami references with bool variable checks --- init.org | 132 +++++++++++++++++++++++++------------------------------ 1 file changed, 59 insertions(+), 73 deletions(-) diff --git a/init.org b/init.org index 02f933a..7f2df0f 100644 --- a/init.org +++ b/init.org @@ -91,76 +91,63 @@ (setq *home_desktop* (string-equal (system-name) "marc") ,*home_laptop* (string-equal (system-name) "laptop") ,*work_local* (string-equal (system-name) "PMPCNEU08") - ,*work_remote* (string-equal (system-name) "PMTS01")) - - -(defvar me/whoami - (if (string-equal (system-name) "PMTS01") - "work_remote" - (if (string-equal (system-name) "laptop") - "home_laptop" - (if (string-equal (system-name) "PMPCNEU08") - "work_local" - "home_desktop")))) -#+END_SRC - -#+BEGIN_SRC emacs-lisp - (defvar MY--PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/")) - (defvar MY--PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/")) - (pcase me/whoami - ("home" - (progn - (defvar MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/")) - (defvar MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/")) - (defvar MY--PATH_ORG_JOURNAl (expand-file-name "~/Archiv/Organisieren/Journal/")))) - ("home_laptop" - (progn - (defvar MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/")) - (defvar MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/")) - (defvar MY--PATH_ORG_JOURNAL (expand-file-name "~/Archiv/Organisieren/Journal/")))) - ("work_remote" - (progn - (defvar MY--PATH_ORG_FILES "p:/Eigene Dateien/Notizen/") - (defvar MY--PATH_ORG_FILES_MOBILE "p:/Eigene Dateien/Notizen/") - (defvar MY--PATH_ORG_JOURNAL "p:/Eigene Dateien/Notizen/") - (defvar MY--PATH_START "p:/Eigene Dateien/Notizen/")))) - - (setq bookmark-default-file (concat MY--PATH_USER_LOCAL "bookmarks")) - (setq recentf-save-file (concat MY--PATH_USER_LOCAL "recentf")) - (setq custom-file (concat MY--PATH_USER_LOCAL "custom.el")) ;; don't spam init.e with saved customization settings - (setq abbrev-file-name (concat MY--PATH_USER_GLOBAL "abbrev_defs")) - (setq backup-directory-alist `((".*" . ,temporary-file-directory))) - (setq auto-save-file-name-transforms `((".*" ,temporary-file-directory))) - (setq save-abbrevs 'silently) ;; don't bother me with asking for abbrev saving - (setq-default create-lockfiles nil) ;; disable lock files, can cause trouble in e.g. lsp-mode - (defalias 'yes-or-no-p 'y-or-n-p) ;; answer with y and n - (setq custom-safe-themes t) ;; don't ask me if I want to load a theme - (setq sentence-end-double-space nil) ;; don't coun two spaces after a period as the end of a sentence. - (delete-selection-mode t) ;; delete selected region when typing - (save-place-mode 1) ;; saves position in file when it's closed - (setq save-place-forget-unreadable-files nil) ;; checks if file is readable before saving position - - (setq locale-coding-system 'utf-8) - (set-terminal-coding-system 'utf-8) - (set-keyboard-coding-system 'utf-8) - (set-selection-coding-system 'utf-8) - (if (eq system-type 'windows-nt) - (prefer-coding-system 'utf-8-dos) - (prefer-coding-system 'utf-8)) - (blink-cursor-mode -1) ;; turn off blinking cursor - (show-paren-mode t) ;; show other part of brackets - (column-number-mode t) - (setq uniquify-buffer-name-style 'forward) - (setq-default indent-tabs-mode nil) ;; avoid tabs in place of multiple spaces (they look bad in tex) - (setq-default indicate-empty-lines t) ;; show empty lines - (setq scroll-margin 5 ;; smooth scrolling - scroll-conservatively 10000 - scroll-preserve-screen-position 1 - scroll-step 1) - (global-hl-line-mode t) ;; highlight current line - (menu-bar-mode 0) ;; disable menu bar - (tool-bar-mode 0) ;; disable tool bar - (scroll-bar-mode 0) ;; disable scroll bar + ,*work_remote* (string-equal (system-name) "PMTS01") + ,*linux* (string-equal system-type 'gnu/linux) + ,*windows* (string-equal system-type 'windows-nt)) +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(defvar MY--PATH_USER_LOCAL (expand-file-name "~/.emacs.d/user-local/")) +(defvar MY--PATH_USER_GLOBAL (expand-file-name "~/.emacs.d/user-global/")) + +(when *linux* + (defvar MY--PATH_ORG_FILES (expand-file-name "~/Archiv/Organisieren/")) + (defvar MY--PATH_ORG_FILES_MOBILE (expand-file-name "~/Archiv/Organisieren/mobile/")) + (defvar MY--PATH_ORG_JOURNAl (expand-file-name "~/Archiv/Organisieren/Journal/"))) +(when *work_remote* +;; (progn + (defvar MY--PATH_ORG_FILES "p:/Eigene Dateien/Notizen/") + (defvar MY--PATH_ORG_FILES_MOBILE "p:/Eigene Dateien/Notizen/") + (defvar MY--PATH_ORG_JOURNAL "p:/Eigene Dateien/Notizen/") + (defvar MY--PATH_START "p:/Eigene Dateien/Notizen/")) + +(setq bookmark-default-file (concat MY--PATH_USER_LOCAL "bookmarks")) +(setq recentf-save-file (concat MY--PATH_USER_LOCAL "recentf")) +(setq custom-file (concat MY--PATH_USER_LOCAL "custom.el")) ;; don't spam init.e with saved customization settings +(setq abbrev-file-name (concat MY--PATH_USER_GLOBAL "abbrev_defs")) +(setq backup-directory-alist `((".*" . ,temporary-file-directory))) +(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory))) +(setq save-abbrevs 'silently) ;; don't bother me with asking for abbrev saving +(setq-default create-lockfiles nil) ;; disable lock files, can cause trouble in e.g. lsp-mode +(defalias 'yes-or-no-p 'y-or-n-p) ;; answer with y and n +(setq custom-safe-themes t) ;; don't ask me if I want to load a theme +(setq sentence-end-double-space nil) ;; don't coun two spaces after a period as the end of a sentence. +(delete-selection-mode t) ;; delete selected region when typing +(save-place-mode 1) ;; saves position in file when it's closed +(setq save-place-forget-unreadable-files nil) ;; checks if file is readable before saving position + +(setq locale-coding-system 'utf-8) +(set-terminal-coding-system 'utf-8) +(set-keyboard-coding-system 'utf-8) +(set-selection-coding-system 'utf-8) +(if *windows* + (prefer-coding-system 'utf-8-dos) + (prefer-coding-system 'utf-8)) + +(blink-cursor-mode -1) ;; turn off blinking cursor +(show-paren-mode t) ;; show other part of brackets +(column-number-mode t) +(setq uniquify-buffer-name-style 'forward) +(setq-default indent-tabs-mode nil) ;; avoid tabs in place of multiple spaces (they look bad in tex) +(setq-default indicate-empty-lines t) ;; show empty lines +(setq scroll-margin 5 ;; smooth scrolling + scroll-conservatively 10000 + scroll-preserve-screen-position 1 + scroll-step 1) +(global-hl-line-mode t) ;; highlight current line +(menu-bar-mode 0) ;; disable menu bar +(tool-bar-mode 0) ;; disable tool bar +(scroll-bar-mode 0) ;; disable scroll bar #+END_SRC Some windows specific stuff @@ -509,8 +496,7 @@ Currently it causes some debugger errors "not a standard org time string", so it :END: Custom keywords, depending on environment #+BEGIN_SRC emacs-lisp -(pcase me/whoami - ("work_remote") +(when *work_remote* (setq org-todo-keywords '((sequence "OPEN" "TODO" "UNCLEAR" "|" "DONE" "IMPOSSIBLE")))) #+END_SRC @@ -584,7 +570,7 @@ Vorerst deaktiviert, Nutzen evtl. nicht vorhanden [[https://github.com/bastibe/org-journal][Source]] #+BEGIN_SRC emacs-lisp -(unless (string-equal me/whoami "work-remote") +(when *linux* (use-package org-journal :ensure t :defer t