After all that, I forgot how git works

master
trémeur 2 years ago
parent fbeb232c08
commit 651a1febca

1
.gitignore vendored

@ -1,5 +1,6 @@
auto-save-list/*
backups/*
config.el
elpa/*
emojis/*
*recentf

@ -1,472 +1 @@
;; It me
(setq user-mail-address "eheu48@gmail.com")
(setq user-full-name "Trémeur Karahés")
(setq calendar-latitude 54.59)
(setq calendar-longitude -5.88)
(setq calendar-location-name "Belfast")
;; do this now
(defun islin ()
"Return true if on linux"
(string-equal system-type "gnu/linux")
)
(defun iswin ()
"Return true if on windows"
(string-equal system-type "windows-nt")
)
(defun ismac ()
"Return true if on macos"
(string-equal system-type "darwin")
)
(defun atwork ()
"Return true if at work"
(string-equal user-login-name "3055822")
)
;; it's not 1986
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-language-environment 'utf-8)
(unless (iswin) (set-selection-coding-system 'utf-8))
(when (iswin) (set-selection-coding-system 'utf-16-le))
;; sonic arts
(setq ring-bell-function 'ignore)
(setq visible-bell t)
;; MELPA/use-package
(package-initialize)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/"))
(setq package-check-signature nil)
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package-ensure)
(setq use-package-always-ensure t)
;; Misc
(setq completion-ignore-case t)
(setq read-file-name-completion-ignore-case t)
(setq read-buffer-completion-ignore-case t)
(setq inhibit-startup-screen t)
(tool-bar-mode -1)
(setq backup-directory-alist '(("." . "~/.emacs.d/backups")))
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)
(defun package--save-selected-packages (&rest opt) nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)
(setq python-shell-interpreter "python3")
(when (islin)
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome"
))
(when (ismac)
(setq ns-alternate-modifier 'meta)
(setq ns-right-alternate-modifier 'none))
(when (iswin)
(setq default-directory "~/"))
(when (islin)
(use-package lastfm))
;; Be quiet
(setq ad-redefinition-action 'accept)
(setq python-indent-guess-indent-offset-verbose nil)
(setq byte-compile-warnings '(cl-functions))
;; Minor modes
(use-package bibtex
:mode ("\\.bib" . bibtex-mode)
:config
(setq bibtex-dialect 'biblatex))
(use-package dimmer
;; dims inactive buffers
:init
(dimmer-mode t)
:config
(setq dimmer-fraction 0.4))
(use-package doom-modeline
;; nice-looking modeline; new versions may be broken?
:init
(doom-modeline-mode 1)
:config
(setq doom-modeline-buffer-file-name-style 'buffer-name)
(setq doom-modeline-minor-modes t)
(setq doom-modeline-enable-word-count t)
(setq doom-modeline-continuous-word-count-modes '(markdown-mode gfm-mode))
(setq doom-modeline-buffer-encoding nil))
(electric-pair-mode 1)
;; automatic bracket/quote mark matching depending on mode
(use-package git-gutter
;; shows git diff in left margin
:config
(global-git-gutter-mode 1)
(set-face-foreground 'git-gutter:added "forest green")
(set-face-foreground 'git-gutter:modified "goldenrod")
(set-face-foreground 'git-gutter:deleted "brown")
(setq git-gutter:added-sign "+"
git-gutter:modified-sign "×"
git-gutter:deleted-sign "-"))
(use-package minions
;; lists minor modes in a menu
:config
(minions-mode))
(use-package paren
;; highlights matching bracket
:config
(show-paren-mode +1))
(use-package rainbow-mode
;; colours css colours (≥ emacs26)
:hook
(css-mode . rainbow-mode))
(use-package recentf
;; access recent files in a list
:config
(recentf-mode 1)
(setq recentf-max-menu-items 20)
(setq recentf-max-saved-items 20)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
(add-to-list 'recentf-exclude
(expand-file-name "~/.emacs.d/elpa/*"))
(add-to-list 'recentf-exclude
(expand-file-name "~/.emacs.d/bookmarks"))
(add-to-list 'recentf-exclude
(expand-file-name "~/Documents/drive/org/elfeed/*")))
(use-package typo
;; smart quotes
:custom
(typo-global-mode 1)
:init
(add-hook 'org-mode-hook 'typo-mode))
(use-package yasnippet
;; shortcuts for common file contents per mode
:config
(setq yas-snippet-dirs '("~/.emacs.d/snippets")))
(yas-global-mode 1)
;; Major modes
(when (islin)
(use-package calibredb
:defer t
:config
(setq calibredb-root-dir "~/Documents/drive/calibre/ebooks")
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
(setq calibredb-library-alist '(("~/Documents/drive/calibre/ebooks")
("~/Documents/drive/calibre/ffff")
("~/Documents/drive/calibre/ovely")))
(setq calibredb-sort-by 'author)
(setq calibredb-order 'asc))
(use-package nov
:init
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)))
(defun my-nov-font-setup ()
(face-remap-add-relative 'variable-pitch :family "Liberation Serif"
:height 2.0))
(add-hook 'nov-mode-hook 'my-nov-font-setup))
(unless (atwork)
(use-package deft
;; for searching journal files
:config
(setq deft-extensions '("org"))
(setq deft-directory "~/Documents/drive/org/journal")
(setq deft-ignore-file-regexp ".*[0-9][0-9][0-9][0-9]\.org") ;; lol
(setq deft-current-sort-method 'title)
(setq deft-recursive t)))
(use-package markdown-mode
:mode (("README\\.md\\'" . gfm-mode)
("\\.md\\'" . markdown-mode)
("\\.markdown\\'" . markdown-mode))
:init
(add-hook 'markdown-mode-hook 'auto-fill-mode)
(add-hook 'markdown-mode-hook 'typo-mode)
:config
(setq markdown-asymmetric-header t)
:custom
(markdown-header-scaling t)
:custom-face
(markdown-header-face ((t (:inherit (default font-lock-function-name-face) :weight bold)))))
(use-package neotree
;; show filetree
:init
(global-set-key [f8] 'neotree-toggle)
:config
(setq neo-theme (if (display-graphic-p) 'icons 'arrow)))
(use-package org-noter
;; interleave replacement
:config
(setq org-noter-property-doc-file "INTERLEAVE_PDF"
org-noter-property-note-location "INTERLEAVE_PAGE_NOTE"))
(unless (version< emacs-version "27")
(use-package org-sidebar
:bind ("C-c C-x s" . org-sidebar-tree)))
(unless (version< emacs-version "27")
(use-package org-wc
:bind ("C-c C-x w" . org-wc-display)))
(unless (iswin) (use-package pdf-tools
;; view pdfs
:config
(pdf-tools-install)
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
(add-hook 'pdf-view-mode-hook (lambda () (cua-mode 0)))
(setq pdf-view-resize-factor 1.1)))
(when (iswin) (use-package doc-view
:config
(setq doc-view-ghostscript-program "gswin32c")))
(use-package tex
;; the big boy
:ensure auctex
:mode ("\\.tex\\'" . latex-mode)
:init
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer)
:config
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq-default TeX-engine 'xetex)
(setq-default TeX-PDF-mode t)
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-source-correlate-start-server t))
;; org
(add-hook 'org-mode-hook 'org-indent-mode)
(add-hook 'org-mode-hook 'visual-line-mode)
(setq org-special-ctrl-a/e t)
(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")
(setq org-image-actual-width '(300))
(load-file "~/.emacs.d/agenda-common.el")
;; for agenda things used in both emacs and batch
(unless (version< emacs-version "27")
(use-package org-modern
:hook
(org-mode . org-modern-mode)))
(if (version< emacs-version "27")
(use-package org-bullets
;; makes bullets look nice
:custom
(org-bullets-bullet-list '(""))
(org-ellipsis "")
:hook (org-mode . org-bullets-mode)))
(unless (atwork)
(defun org-journal-file-header-func (time)
(concat "<" (format-time-string "%Y-%m-%d %a") ">\n\n"))
(use-package org-journal
:bind ("C-c j" . org-journal-new-entry)
:config
(setq org-journal-dir "~/Documents/drive/org/journal")
(setq org-journal-file-format "%Y/%m/%Y-%m-%d.org")
(setq org-journal-find-file 'find-file)
(setq org-journal-date-format "journal")
(setq org-journal-time-format "%H:%M\n")
(setq org-journal-file-header 'org-journal-file-header-func)))
(use-package org-agenda-property)
;; lets properties inherit
(unless (version< emacs-version "27")
(use-package org-contrib)
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines)))
(setq org-todo-keywords
'((sequence "TODO" "|" "DONE" "CANCELLED")))
(global-set-key (kbd "C-c a") 'org-agenda)
(setq calendar-week-start-day 1)
(setq org-agenda-start-on-weekday nil)
(unless (atwork)
(setq org-agenda-files (list "~/Documents/drive/org/calendar"
"~/Documents/drive/org/period.org"
"~/Documents/drive/org/habit.org")))
(when (atwork)
(setq org-agenda-files (list "~/Documents/drive/org/calendar"
"~/Documents/drive/org/period.org"
"~/Documents/drive/org/acwri.org")))
(setq org-agenda-prefix-format
'((todo . "%-2c %b")
(tags . "%-2c %b")
(agenda . "%-2c %?-12t%?-12s")))
(setq org-use-property-inheritance (quote ("LOCATION")))
(setq org-agenda-todo-ignore-scheduled t)
(setq org-agenda-todo-ignore-deadlines t)
(setq org-agenda-format-date (lambda (date) (concat "\n"
(make-string (window-width) 9472)
"\n"
(org-agenda-format-date-aligned date))))
(add-to-list 'org-modules 'org-habit t)
(setq org-habit-show-all-today t)
(setq org-export-headline-levels 6)
(setq org-html-head-include-default-style nil)
(setq org-html-head "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://tre.praze.net/fic/fic.css\" />")
;; Elfeed
(use-package elfeed-org
:config
(elfeed-org)
(setq rmh-elfeed-org-files (list "~/Documents/drive/org/feeds.org")))
(defun elfeed-load-db-and-open ()
"Wrapper to load the elfeed db from disk before opening"
(interactive)
(elfeed-db-load)
(elfeed)
(elfeed-search-update--force)
(elfeed-update))
(global-set-key (kbd "C-x w") 'elfeed-load-db-and-open)
(defalias 'elfeed-toggle-star
(elfeed-expose #'elfeed-search-toggle-all 'star))
(eval-after-load 'elfeed-search
'(define-key elfeed-search-mode-map (kbd "m") 'elfeed-toggle-star))
(defun elfeed-save-db-and-bury ()
"Wrapper to save the elfeed db to disk before burying buffer"
(interactive)
(elfeed-db-save)
(quit-window))
(defun elfeed-search-format-date (date)
(format-time-string "%Y-%m-%d %H:%M" (seconds-to-time date)))
(use-package elfeed
:bind (:map elfeed-search-mode-map
("q" . elfeed-save-db-and-bury))
:custom
(elfeed-sort-order 'ascending)
(elfeed-db-directory "~/Documents/drive/org/elfeed"))
(add-hook 'elfeed-new-entry-hook
(elfeed-make-tagger :before "6 months ago"
:remove 'unread))
;; Email
(when (islin)
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e") ;; this is broken in emacs28
(load-file "~/.emacs.d/mail.el")
(require 'mu4e) ;; this uses cl … hopefully will be updated in a later emacs version?
(setq send-mail-function 'smtpmail-send-it))
;; Aesthetics
(use-package all-the-icons
;; shows nice icons in modeline + neotree
:config
(unless (iswin)
(when (not (member "all-the-icons" (font-family-list)))
(all-the-icons-install-fonts t)))); need to install fonts manually on windows
(use-package emojify
;; emoji support
:init
(add-hook 'after-init-hook #'global-emojify-mode))
(use-package hl-line
;; highlights current row
:config
(global-hl-line-mode 1))
(use-package tao-theme)
(load-theme 'tao-yang t)
(set-cursor-color "#61805c")
(set-face-attribute 'region nil :background "#fcf6a7")
(set-face-background 'hl-line "#ddffd6")
;; Fonts
(if (iswin)
(custom-set-faces
'(default ((t (:family "Noto Mono" :foundry "outline" :slant normal :weight normal :height 98 :width normal))))
'(italic ((t (:slant italic))))
'(variable-pitch ((t (:family "Noto Sans" :height 90))))
'(fixed-pitch ((t (:family "Noto Mono" :height 90))))))
(unless (iswin)
(custom-set-faces
'(italic ((t (:slant italic))))
'(variable-pitch ((t (:family "Noto Sans" :height 90))))
'(fixed-pitch ((t (:family "Noto Mono" :height 90))))))
(use-package mixed-pitch
;; intelligent face setting
:hook
(LaTeX-mode . mixed-pitch-mode)
(org-mode . mixed-pitch-mode)
(markdown-mode . mixed-pitch-mode))
;; Startup
(defun load-directory (dir)
(let ((load-it (lambda (f)
(load-file (concat (file-name-as-directory dir) f)))))
(mapc load-it (directory-files dir nil "\\.el$"))))
(load-directory "~/.emacs.d/custom/")
(setq initial-major-mode 'org-mode)
(setq initial-scratch-message
(concat "# emacs " (number-to-string emacs-major-version) " on " (symbol-name system-type) "\n\n"))
(org-reload)
(org-babel-load-file "~/.emacs.d/config.org")

Loading…
Cancel
Save