This is a tangled user-init and user-config file for spacemacs. Place the
following code in your ~/.spacemacs.d/init.el
file.
(defun dotspacemacs/user-init ()
;; tangle without actually loading org
(let ((src (concat dotspacemacs-directory "spacemacs.org"))
(ui (concat dotspacemacs-directory "user-init.el"))
(uc (concat dotspacemacs-directory "user-config.el")))
(when (or (file-newer-than-file-p src ui) (file-newer-than-file-p src uc))
(call-process
(concat invocation-directory invocation-name)
nil nil t
"-q" "--batch" "--eval" "(require 'ob-tangle)"
"--eval" (format "(org-babel-tangle-file \"%s\")" src)))
(load-file ui)))
(defun dotspacemacs/user-config ()
(load-file (concat dotspacemacs-directory "user-config.el")))
To add configuration options before Spacemacs loads, insert the following kind of src block in your spacemacs.org file
Alternatively, if the block should be loaded after Spacemacs loads, insert the following test block
To help with creation of your text blocks, there are two snippets defined in the
local snippet directory ~/.spacemacs.d/snippets/org-mode/
folder.
To tangle to the user-init
file, type ui
, alternatively uc
to tangle the user-config
file.
Create binding to spacemacs.org file
(defun spacemacs/find-config-file ()
(interactive)
(find-file (concat dotspacemacs-directory "/spacemacs.org")))
(spacemacs/set-leader-keys "fec" 'spacemacs/find-config-file)
;; Auto generated user initialization from tangled spacemacs.org
;; Set some sane defaults
(setq-default
indent-tabs-mode 't
tab-width 8
)
;; (defun no-junk-please-were-unixish ()
;; (let ((coding-str (symbol-name buffer-file-coding-system)))
;; (when (string-match "-\\(?:dos\\|mac\\)$" coding-str)
;; (set-buffer-file-coding-system 'unix))))
;; (add-hook 'find-file-hooks 'no-junk-please-were-unixish)
;; Default settings
(spacemacs/toggle-spelling-checking-off)
(setq
powerline-default-separator 'nil
browse-url-generic-program "chrome-browser"
;; http://ergoemacs.org/emacs/emacs_set_default_browser.html
browse-url-browser-function 'browse-url-chrome
)
(defun helm-browse-url (url &rest args)
(helm-generic-browser url "google-chrome"))
(with-eval-after-load 'auto-completion
(setq
auto-completion-enable-help-tooltip t
auto-completion-enable-snippets-in-popup t
)
)
(with-eval-after-load 'c-c++
c-default-style "linux"
)
(with-eval-after-load 'cscope
(define-key evil-normal-state-map (kbd "C-t") 'helm-cscope-pop-mark)
)
(with-eval-after-load 'evil
(define-key evil-insert-state-map (kbd "TAB") 'tab-to-tab-stop)
)
(with-eval-after-load 'magit
(global-git-commit-mode t)
(setq
;; https://magit.vc/manual/magit/Performance.html
magit-revision-insert-related-refs nil
magit-refresh-status-buffer 't
magit-commit-show-diff nil
magit-revert-buffers 1
magit-default-tracking-name-function 'magit-default-tracking-name-branch-only
magit-log-section-arguments (list "-n50" "--decorate")
magit-log-cutoff-length 50
magit-revision-insert-related-refs nil
magit-repository-directories '(("~/Code/" . 2))
)
(setq-default
git-magit-status-fullscreen 't
)
(remove-hook 'magit-refs-sections-hook 'magit-insert-tags)
)
;; (with-eval-after-load 'git-link
;; ;; Git link Linux kernel
;; (defun git-link-linux (hostname dirname filename branch commit start end)
;; (format "https://elixir.bootlin.com/linux/latest/source/%s"
;; (concat filename
;; (when start
;; (concat "#L" (format "%s" start))))))
;; '(progn
;; ;; Example parameter for:
;; ;; hostname: git.kernel.org
;; ;; dirname: pub/scm/linux/kernel/git/torvalds/linux
;; ;; filename: kernel/sched/pelt.c
;; ;; branch: lkml/utilclamp_v11_debug
;; ;; commit: a82eb017568a894b299341eb641fdd0f7ebbde91
;; ;; start: 81
;; ;; end: nil
;; (add-to-list 'git-link-remote-alist
;; '("git\\.kernel\\.org" git-link-linux))
;; ; (add-to-list 'git-link-commit-remote-alist
;; ; '("git\\.kernel\\.org" git-link-commit-linux))
;; )
;; )
(with-eval-after-load 'paradox
(setq
paradox-github-token 'bbf1492c1c91e67c1f672ed2fa755b3662574d65
)
)
(with-eval-after-load 'go
;; The get a working installation and spacemacs integration:
;; 1. ensure to have the most recent version of go installed, usually under:
;; /usr/local/go
;; by following the installation instructions from, e.g.:
;; https://golang.org/doc/install?download=go1.12.6.linux-amd64.tar.gz
;;
;; 2. symlink under a standard path to ensure spacemacs finds it
;; $ sudo ln -s /usr/local/go/bin/go /usr/bin/go
;;
;; 3. open the go layer do (SPC h l RET go RET) and install all the required tools
;; check they are all installed under the go workspace (~/go/bin)
;;
;; 4. for company-go autocompletion to work: make sure you have only one
;; gocode binary, with:
;; $ which -a gocode
;; and that's the most updated version installed in your GOPATH, i.e.
;; $ go get -u github.com/nsf/gocode
;;
;; The following two paths are to ensure we look at the most recently insalled
;; versions:
(add-to-list 'exec-path "/home/derkling/go/bin/")
(add-to-list 'exec-path "/usr/local/go/bin")
(setq
go-use-golangci-lint t
godoc-at-point-function 'godoc-gogetdoc
;; set this to nil if you’re using .editorconfig in your project
go-tab-width 4
;; Force formatting every time we save
;; NOTE: this could lead to unused imports to be removed
go-format-before-save t
gofmt-command "goimports"
)
)
(with-eval-after-load 'gtags
(setq
gtags-enable-by-default t
)
)
(with-eval-after-load 'helm
(setq
helm-M-x-fuzzy-match 't
helm-position 'bottom
helm-enable-auto-resize t
)
)
(with-eval-after-load 'helm
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
)
(with-eval-after-load 'mu4e
;; General user info
(setq
user-full-name "Patrick Bellasi"
user-mail-address "patrick.bellasi@arm.com"
mu4e-reply-to-address "patrick.bellasi@arm.com"
mu4e-user-mail-address-list '(
"derkling@gmail.com"
"patrick.bellasi@gmail.com"
"patrick.bellasi@arm.com"
)
;; mu4e-compose-complete-only-personal t
;; mu4e-compose-complete-only-after "2014-06-23"
;; mu4e-compose-complete-ingore-address-regext "no-?reply"
)
)
(with-eval-after-load 'mu4e
(setq
mu4e-maildir (expand-file-name "~/Mail/Work") ;; top level maildir, cannot be a link
mu4e-sent-folder "/Sent Items" ;; folder for sent messages
mu4e-drafts-folder "/Drafts" ;; unfinished messages
mu4e-trash-folder "/Deleted Items" ;; trashed messages
mu4e-refile-folder "/Archive" ;; saved messages
)
)
(with-eval-after-load 'mu4e
(setq
mu4e-maildir-shortcuts '(("/INBOX" . ?i)
("/Sent Items" . ?s)
("/Archive" . ?a)
("/Deleted Items" . ?t)
("/Drafts" . ?d))
)
(add-to-list 'mu4e-bookmarks
(make-mu4e-bookmark
:name "LKML (last 2h)"
:query "date:2h..now"
:key ?k)
t)
)
(with-eval-after-load 'mu4e
(setq
mu4e-get-mail-command "mbsync work"
mu4e-html2text-command "w3m -T text/html"
mu4e-update-interval 120
mu4e-headers-auto-update t
)
)
(with-eval-after-load 'mu4e
(setq
mu4e-index-cleanup nil ;; don't do a full cleanup check
mu4e-index-lazy-check t ;; don't consider up-to-date dirs
)
)
(with-eval-after-load 'mu4e
(setq
message-signature-file (expand-file-name "~/dotfiles/spacemacs/mu4e/signature")
mu4e-attachment-dir "/tmp"
mu4e-compose-signature-auto-include t
mu4e-headers-date-format "%e-%b"
mu4e-headers-include-related t
mu4e-headers-time-format "%k:%M"
mu4e-headers-skip-duplicates t
mu4e-headers-visible-lines 10
mu4e-view-auto-mark-as-read nil
mu4e-headers-fields '(
(:flags . 6)
(:human-date . 12)
(:from . 24)
(:subject))
mu4e-view-fields '(:subject :from :to :cc :date
:tags :attachments
:signature :decryption
:mailing-list :message-id)
)
)
(with-eval-after-load 'mu4e
(add-to-list 'mu4e-view-actions
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
;; ;; show images
;; (setq mu4e-show-images t)
;; ;; use imagemagick, if available
;; (when (fboundp 'imagemagick-register-types)
;; (imagemagick-register-types))
)
(with-eval-after-load 'mu4e
(setq
message-send-mail-function 'smtpmail-send-it
smtpmail-starttls-credentials '(("foss.arm.com" 587 nil nil))
smtpmail-default-smtp-server "foss.arm.com"
smtpmail-smtp-server "foss.arm.com"
smtpmail-smtp-service 587
smtpmail-debug-info t
)
)
(with-eval-after-load 'mu4e
(setq
message-citation-line-function 'message-insert-formatted-citation-line
message-citation-line-format "On %a, %b %d, %Y at %T %z, %f wrote...\n"
message-signature-file (expand-file-name "~/dotfiles/emacs/mu4e/signature")
mu4e-compose-signature-auto-include t
;; What do to for sent messages:
;; - sent : copy into "Sent Items"
;; - delete : don't save message to Sent Messages, IMAP takes care of this
mu4e-sent-messages-behavior 'sent
)
)
(with-eval-after-load 'mu4e
; Spell checking
(add-hook 'mu4e-compose-mode-hook
(defun my-do-compose-stuff ()
"My settings for message composition."
(set-fill-column 72)
(flyspell-mode))
)
)
(with-eval-after-load 'mu4e
(define-key 'mu4e-headers-mode-map (kbd "TAB") 'mu4e-headers-toggle-thread-folding)
)
(with-eval-after-load 'neotree
(setq
neo-theme 'nerd
)
)
(with-eval-after-load 'org
;; To get Org v9 working, these fixes could be required:
;;
;; - https://emacs.stackexchange.com/questions/32001/org-babel-9-spacemacs-unable-to-evaluate-org-babel-src-blocks
;;
;; cd .emacs.d/elpa/
;; # I suggest to run this without "delete" first.
;; find org* -name "*.elc" -delete
;;
;; - https://emacs.stackexchange.com/questions/37692/how-to-fix-symbols-function-definition-is-void-org-babel-get-header
;;
;; replace (sh . t) by (shell . t) in your call of org-babel-do-load-languages
(org-babel-do-load-languages 'org-babel-load-languages
(append org-babel-load-languages
'((shell . t)
(python . t)
(C . t))))
(setq
org-enable-sticky-header t
org-projectile-file "TODOs.org"
org-want-todo-bindings t
org-clock-into-drawer "CLOCKING"
org-default-notes-file (concat org-directory "/Notes.org")
)
;; (setq-default
;; dotspacemacs-configuration-layers '((org :variables org-projectile-file "TODOs.org"))
;; )
)
(with-eval-after-load 'org-agenda
(require 'org-projectile)
(mapcar '(lambda (file)
(when (file-exists-p file)
(push file org-agenda-files)))
(org-projectile-todo-files))
)
(with-eval-after-load 'shell
(setq
shell-default-shell 'ansi-term
shell-default-term-shell "/bin/zsh"
shell-default-height 30
shell-default-position 'bottom
)
)
(with-eval-after-load 'spell-checking
spell-checking-enable-by-default nil
enable-flyspell-auto-completion t
)