Commit 0a1d11adfeed

Vincent Demeester <vincent@sbr.pm>
2020-03-10 21:01:29
init.el fully ported ๐Ÿ‘ผ
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 6fbb88f
config/00-paths.el โ†’ config/00-environments.el
@@ -8,3 +8,6 @@
           "GOPATH"             ; Golang path
           ))
   (exec-path-from-shell-initialize))
+
+(setenv "PAGER" "cat")
+(setenv "TERM" "xterm-256color")
config/setup-browser.el
@@ -1,60 +0,0 @@
-;;; -*- lexical-binding: t; -*-
-(use-package shr
-  :commands (eww
-             eww-browse-url)
-  :config
-  (setq shr-use-fonts nil
-        shr-use-colors nil
-        shr-max-image-proportion 0.2
-        shr-width (current-fill-column)
-        browse-url-browser-function 'browse-url-generic))
-
-(use-package shr-tag-pre-highlight
-  :after shr
-  :config
-  (add-to-list 'shr-external-rendering-functions
-               '(pre . shr-tag-pre-highlight))
-  (when (version< emacs-version "26")
-    (with-eval-after-load 'eww
-      (advice-add 'eww-display-html :around
-                  'eww-display-html--override-shr-external-rendering-functions))))
-
-(use-package eww
-  :defer t
-  :init
-  (setq browse-url-browser-function
-        '((".*google.*maps.*" . browse-url-generic)
-          ;; Github goes to firefox, but not gist
-          ("http.*\/\/github.com" . browse-url-generic)
-          ("http.*\/\/github.io" . browse-url-generic)
-          ("http.*\/\/gitlab.com" . browse-url-generic)
-          ("http.*\/\/gitlab.io" . browse-url-generic)
-          ("groups.google.com" . browse-url-generic)
-          ("docs.google.com" . browse-url-generic)
-          ("melpa.org" . browse-url-generic)
-          ("build.*\.elastic.co" . browse-url-generic)
-          (".*-ci\.elastic.co" . browse-url-generic)
-          ("internal-ci\.elastic\.co" . browse-url-generic)
-          ("zendesk\.com" . browse-url-generic)
-          ("salesforce\.com" . browse-url-generic)
-          ("stackoverflow\.com" . browse-url-generic)
-          ("apache\.org\/jira" . browse-url-generic)
-          ("thepoachedegg\.net" . browse-url-generic)
-          ("zoom.us" . browse-url-generic)
-          ("blujeans.com" . browse-url-generic)
-          ("t.co" . browse-url-generic)
-          ("twitter.com" . browse-url-generic)
-          ("\/\/a.co" . browse-url-generic)
-          ("youtube.com" . browse-url-generic)
-          ("amazon.com" . browse-url-generic)
-          ("slideshare.net" . browse-url-generic)
-          ("." . browse-url-generic)))
-  (setq shr-external-browser 'browse-url-generic)
-  (setq browse-url-generic-program (executable-find "firefox"))
-  (add-hook 'eww-mode-hook #'toggle-word-wrap)
-  (add-hook 'eww-mode-hook #'visual-line-mode)
-  :config
-  (define-key eww-mode-map "o" 'eww)
-  (define-key eww-mode-map "O" 'eww-browse-with-external-browser))
-
-(provide 'setup-browser)
config/setup-notmuch.el
@@ -1,3 +1,4 @@
+(setenv "NOTMUCH_CONFIG" (expand-file-name ".config/notmuch/notmuchrc" (getenv "HOME")))
 (use-package notmuch
   :defer t
   :bind ("<f6>" . notmuch)
config/setup-vcs.el
@@ -49,7 +49,7 @@
 
   ;; Free C-c C-w for Eyebrowse
   (unbind-key "C-c C-w" git-commit-mode-map)  )
-
+(put 'magit-diff-edit-hunk-commit 'disabled nil)
 (use-package magit-repos
   :after magit
   :commands magit-list-repositories
emacs.org
@@ -273,6 +273,13 @@
       inhibit-startup-screen t)
 #+end_src
 
+Let's also use =y= or =n= instead of =yes= and =no= when exiting Emacs.
+
+#+begin_src emacs-lisp :tangle init.el
+(setq confirm-kill-emacs #'y-or-n-p)
+#+end_src
+
+
 One last piece to the puzzle is the default mode. Setting it to fundamental-mode means we
 won't load any /heavy/ mode at startup (like =org-mode=). We also want this scratch buffer
 to be empty, so let's set it as well
@@ -402,6 +409,24 @@
   (load vde/custom-file 'no-error 'no-message))
 #+end_src
 
+*** Remove built-in =org-mode=
+:PROPERTIES:
+:CUSTOM_ID: h:9462c0d7-03be-4231-8f22-ce1a04be32b1
+:END:
+
+I want to make sure I am using the installed version of =orgmode= (from my org
+configuration) instead of the built-in one. To do that safely, let's remove the built-in
+version out of the load path.
+
+#+begin_src emacs-lisp :tangle init.el
+(require 'cl-seq)
+(setq load-path
+      (cl-remove-if
+       (lambda (x)
+         (string-match-p "org$" x))
+       load-path))
+#+end_src
+
 *** Loading configuration files
 :PROPERTIES:
 :CUSTOM_ID: h:d6aebc56-aadb-4b01-8404-bb922d12f8a8
@@ -483,27 +508,40 @@
     (load-file (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el"))))
 #+end_src
 
-*** Remove built-in =org-mode=
+*** Pinentry
 :PROPERTIES:
-:CUSTOM_ID: h:9462c0d7-03be-4231-8f22-ce1a04be32b1
+:CUSTOM_ID: h:1f016a1a-f4ef-4ef0-be01-1fd68ca0d951
 :END:
 
-I want to make sure I am using the installed version of =orgmode= (from my org
-configuration) instead of the built-in one. To do that safely, let's remove the built-in
-version out of the load path.
+#+begin_src emacs-lisp :tangle init.el
+(use-package pinentry
+  :config
+  (setenv "INSIDE_EMACS" (format "%s,comint" emacs-version))
+  (pinentry-start))
+#+end_src
+
+*** Counting the time of loading
+:PROPERTIES:
+:CUSTOM_ID: h:2b645e95-6776-4f5b-a318-e5a915943881
+:END:
 
 #+begin_src emacs-lisp :tangle init.el
-(require 'cl-seq)
-(setq load-path
-      (cl-remove-if
-       (lambda (x)
-         (string-match-p "org$" x))
-       load-path))
+(let ((elapsed (float-time (time-subtract (current-time)
+                                          emacs-start-time))))
+  (message "Loading %s...done (%.3fs)" load-file-name elapsed))
+
+(add-hook 'after-init-hook
+          `(lambda ()
+             (let ((elapsed
+                    (float-time
+                     (time-subtract (current-time) emacs-start-time))))
+               (message "Loading %s...done (%.3fs) [after-init]"
+                        ,load-file-name elapsed))) t)
 #+end_src
 
 ** ~PATH~'s customization
 :PROPERTIES:
-:header-args: :tangle config/00-paths.el
+:header-args: :tangle config/00-environments.el
 :CUSTOM_ID: h:2a72b00e-ea97-4a3b-a70c-cbbe648df428
 :END:
 
@@ -532,8 +570,12 @@
           "GOPATH"             ; Golang path
           ))
   (exec-path-from-shell-initialize))
+
+(setenv "PAGER" "cat")
+(setenv "TERM" "xterm-256color")
 #+end_src
 
+
 ** Keep emacs clean
 :PROPERTIES:
 :header-args: :tangle config/00-clean.el
@@ -1855,56 +1897,6 @@
 
 These are the initial configuration files to be imported in this file slowly but surely.
 
-*** ~init.el~
-:PROPERTIES:
-:CUSTOM_ID: h:443b5480-2b61-4653-afa2-3c8da9169353
-:END:
-
-#+begin_src emacs-lisp :tangle init.el
-(setenv "PAGER" "cat")
-(setenv "TERM" "xterm-256color")
-(setenv "NOTMUCH_CONFIG" (expand-file-name ".config/notmuch/notmuchrc" (getenv "HOME")))
-
-(use-package pinentry
-  :config
-  (setenv "INSIDE_EMACS" (format "%s,comint" emacs-version))
-  (pinentry-start))
-
-;; Confirm before quitting Emacs
-(setq confirm-kill-emacs #'y-or-n-p)
-
-;; C-up/down onn console
-(when (not window-system)
-  (define-key function-key-map "\eO1;5A"    [C-up])
-  (define-key function-key-map "\eO1;5B"  [C-down])
-  (define-key function-key-map "\eO1;5C" [C-right])
-  (define-key function-key-map "\eO1;5D"  [C-left])
-  )
-
-(let ((elapsed (float-time (time-subtract (current-time)
-                                          emacs-start-time))))
-  (message "Loading %s...done (%.3fs)" load-file-name elapsed))
-
-(add-hook 'after-init-hook
-          `(lambda ()
-             (let ((elapsed
-                    (float-time
-                     (time-subtract (current-time) emacs-start-time))))
-               (message "Loading %s...done (%.3fs) [after-init]"
-                        ,load-file-name elapsed))) t)
-
-(put 'narrow-to-page 'disabled nil)
-(put 'narrow-to-region 'disabled nil)
-
-(put 'magit-diff-edit-hunk-commit 'disabled nil)
-;; Local Variables:
-;; coding: utf-8
-;; indent-tabs-mode: nil
-;; End:
-;;; Finalization
-;;; init.el ends here
-#+end_src
-
 *** ~setup-buffers.el~
 :PROPERTIES:
 :CUSTOM_ID: h:98200f45-7379-42e7-be0d-7db52cd950c8
@@ -3380,6 +3372,7 @@
 :END:
 
 #+begin_src emacs-lisp :tangle config/setup-notmuch.el
+(setenv "NOTMUCH_CONFIG" (expand-file-name ".config/notmuch/notmuchrc" (getenv "HOME")))
 (use-package notmuch
   :defer t
   :bind ("<f6>" . notmuch)
@@ -4343,7 +4336,7 @@
 
   ;; Free C-c C-w for Eyebrowse
   (unbind-key "C-c C-w" git-commit-mode-map)  )
-
+(put 'magit-diff-edit-hunk-commit 'disabled nil)
 (use-package magit-repos
   :after magit
   :commands magit-list-repositories
init.el
@@ -15,6 +15,8 @@
 (setq inhibit-startup-message t
       inhibit-startup-screen t)
 
+(setq confirm-kill-emacs #'y-or-n-p)
+
 (setq initial-major-mode 'fundamental-mode
       initial-scratch-message nil)
 
@@ -91,6 +93,13 @@
 
   (load vde/custom-file 'no-error 'no-message))
 
+(require 'cl-seq)
+(setq load-path
+      (cl-remove-if
+       (lambda (x)
+         (string-match-p "org$" x))
+       load-path))
+
 (defun vde/el-load-dir (dir)
   "Load el files from the given folder"
   (let ((files (directory-files dir nil "\.el$")))
@@ -140,33 +149,11 @@
 (if (file-exists-p (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el")))
     (load-file (downcase (concat user-emacs-directory "/hosts/" (vde/short-hostname) ".el"))))
 
-(require 'cl-seq)
-(setq load-path
-      (cl-remove-if
-       (lambda (x)
-         (string-match-p "org$" x))
-       load-path))
-
-(setenv "PAGER" "cat")
-(setenv "TERM" "xterm-256color")
-(setenv "NOTMUCH_CONFIG" (expand-file-name ".config/notmuch/notmuchrc" (getenv "HOME")))
-
 (use-package pinentry
   :config
   (setenv "INSIDE_EMACS" (format "%s,comint" emacs-version))
   (pinentry-start))
 
-;; Confirm before quitting Emacs
-(setq confirm-kill-emacs #'y-or-n-p)
-
-;; C-up/down onn console
-(when (not window-system)
-  (define-key function-key-map "\eO1;5A"    [C-up])
-  (define-key function-key-map "\eO1;5B"  [C-down])
-  (define-key function-key-map "\eO1;5C" [C-right])
-  (define-key function-key-map "\eO1;5D"  [C-left])
-  )
-
 (let ((elapsed (float-time (time-subtract (current-time)
                                           emacs-start-time))))
   (message "Loading %s...done (%.3fs)" load-file-name elapsed))
@@ -178,14 +165,3 @@
                      (time-subtract (current-time) emacs-start-time))))
                (message "Loading %s...done (%.3fs) [after-init]"
                         ,load-file-name elapsed))) t)
-
-(put 'narrow-to-page 'disabled nil)
-(put 'narrow-to-region 'disabled nil)
-
-(put 'magit-diff-edit-hunk-commit 'disabled nil)
-;; Local Variables:
-;; coding: utf-8
-;; indent-tabs-mode: nil
-;; End:
-;;; Finalization
-;;; init.el ends here