Move OS constants to core/core.el

So it is universally available to all of Doom, rather than excluding
sessions that haven't called doom-initialize interactively.
This commit is contained in:
Henrik Lissner 2018-06-08 13:31:45 +02:00
parent bc2f8a0ec9
commit 81c465a545
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 47 additions and 48 deletions

View file

@ -1,23 +1,18 @@
;;; core-os.el -*- lexical-binding: t; -*- ;;; core-os.el -*- lexical-binding: t; -*-
(defconst IS-MAC (eq system-type 'darwin)) ;; clipboard
(defconst IS-LINUX (eq system-type 'gnu/linux)) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
(unless noninteractive
;; clipboard
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)
;; Use a shared clipboard ;; Use a shared clipboard
select-enable-clipboard t select-enable-clipboard t
select-enable-primary t) select-enable-primary t)
;; stop copying each visual state move to the clipboard: ;; stop copying each visual state move to the clipboard:
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on ;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
;; Most of this code grokked from: ;; Most of this code grokked from:
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro ;; http://stackoverflow.com/questions/15873346/elisp-rename-macro
(advice-add #'evil-visual-update-x-selection :override #'ignore) (advice-add #'evil-visual-update-x-selection :override #'ignore)
(cond (IS-MAC (cond (IS-MAC
(setq mac-command-modifier 'meta (setq mac-command-modifier 'meta
mac-option-modifier 'alt mac-option-modifier 'alt
;; sane trackpad/mouse scroll settings ;; sane trackpad/mouse scroll settings
@ -51,7 +46,7 @@
(IS-WINDOWS (IS-WINDOWS
(setq w32-get-true-file-attributes nil) ; fix file io slowdowns (setq w32-get-true-file-attributes nil) ; fix file io slowdowns
))) ))
(provide 'core-os) (provide 'core-os)
;;; core-os.el ends here ;;; core-os.el ends here

View file

@ -286,10 +286,10 @@ to least)."
(unless (or force-p noninteractive) (unless (or force-p noninteractive)
(doom//reload-package-autoloads)))) (doom//reload-package-autoloads))))
;; Initialize Doom core ;; Initialize Doom core
(require 'core-os)
(unless noninteractive (unless noninteractive
(add-hook! 'emacs-startup-hook (add-hook! 'emacs-startup-hook
#'(doom|post-init doom|display-benchmark)) #'(doom|post-init doom|display-benchmark))
(require 'core-os)
(require 'core-ui) (require 'core-ui)
(require 'core-editor) (require 'core-editor)
(require 'core-projects) (require 'core-projects)

View file

@ -16,6 +16,10 @@ line or use --debug-init to enable this.")
(eval-when-compile (not (version< emacs-version "26")))) (eval-when-compile (not (version< emacs-version "26"))))
(defconst EMACS27+ (defconst EMACS27+
(eval-when-compile (not (version< emacs-version "27")))) (eval-when-compile (not (version< emacs-version "27"))))
(defconst IS-MAC (eq system-type 'darwin))
(defconst IS-LINUX (eq system-type 'gnu/linux))
(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos)))
;; ;;
(defvar doom-emacs-dir (defvar doom-emacs-dir