Commit Diff


commit - 6ae067c1cae69a350af21fee89d57f3ce543e0a4
commit + 678b3cb307203605ec56017f8c45432dacf13494
blob - /dev/null
blob + f66ce1886bc9bfe2d226a0e86ae1b3fc4262ccd7 (mode 644)
--- /dev/null
+++ emacs/early-init.el.lp
@@ -0,0 +1,27 @@
+# early init
+
+Starting from GNU Emacs 27 there is an additional configuration file
+called `early-init.el'.  As the name suggest, this is called *before*
+the usual `init.el' or `.emacs'.  There are some small tweaks we can
+do here to improve startup performance and to declutter the `init.el'
+
+	(menu-bar-mode -1)
+	(tool-bar-mode -1)
+	(scroll-bar-mode -1)
+	(horizontal-scroll-bar-mode -1)
+
+It's also a great place to tweak the `load-path'!
+
+	(add-to-list 'load-path
+	             (expand-file-name "lisp" user-emacs-directory))
+
+Another thing I do here is to load the theme.  I've developed my own
+theme (minimal-light, a fork of the original), but I'm playing with
+modus now
+
+	;; (load-theme 'minimal-light t) ; disabled for now
+	(load-theme 'modus-operandi)
+
+Also, $CDPATH works strange in eshell so disable it:
+
+	(setenv "CDPATH" nil)
blob - /dev/null
blob + 889abfc40ea02776b0e062a82eb6e4c27c437f27 (mode 644)
--- /dev/null
+++ emacs/init.el
@@ -0,0 +1,495 @@
+(defconst op/backup-dir
+  (expand-file-name "backups" user-emacs-directory))
+(unless (file-exists-p op/backup-dir)
+  (make-directory op/backup-dir))
+(setq backup-directory-alist `(("." . ,op/backup-dir)))
+
+(setq use-dialog-box nil
+      x-stretch-cursor t
+      require-final-newline t
+      visible-bell nil
+      load-prefer-newer t
+      tab-bar-show 1
+      enable-recursive-minibuffers t
+      imenu-auto-rescan 1)
+
+(setq completion-ignore-case t
+      read-file-name-completion-ignore-case t
+      read-buffer-completion-ignore-case t)
+
+(define-key global-map (kbd "C-x C-b") #'ibuffer)
+(define-key global-map (kbd "M-g i") #'imenu)
+
+;; mg-like
+(define-key minibuffer-mode-map (kbd "C-w") #'backward-kill-word)
+
+(setq uniquify-buffer-name-style 'forward
+      uniquify-strip-common-suffix t)
+
+(setq-default scroll-up-aggressively 0.0
+              scroll-down-aggressively 0.0
+              scroll-preserve-screen-position t
+              next-screen-context-lines 1)
+
+(define-key global-map (kbd "M-z") #'zap-up-to-char)
+
+(require 'whitespace)
+(setq whitespace-style '(face trailing)
+      backward-delete-char-untabify-method  'hungry
+      tab-always-indent 'complete
+      tab-width 8
+      sentence-end-double-space t)
+(setq-default indent-tabs-mode t)
+
+(defun op/enable-tabs ()
+  "Enable `indent-tabs-mode' in the current buffer."
+  (interactive)
+  (setq-local indent-tabs-mode t))
+
+(defun op/disable-tabs ()
+  "Disable `indent-tabs-mode' in the current buffer."
+  (interactive)
+  (setq-local indent-tabs-mode nil))
+
+(add-hook 'conf-mode-hook #'op/enable-tabs)
+(add-hook 'text-mode-hook #'op/enable-tabs)
+(add-hook 'prog-mode-hook #'op/enable-tabs)
+(add-hook 'prog-mode-hook #'whitespace-mode)
+(add-hook 'text-mode-hook #'whitespace-mode)
+
+(with-eval-after-load 'log-edit
+  (add-hook 'log-edit-mode #'auto-fill-mode))
+
+;; free the c-z binding
+(define-key global-map (kbd "C-z") nil)
+(define-key global-map (kbd "C-z V") #'variable-pitch-mode)
+(define-key global-map (kbd "C-z n") #'display-line-numbers-mode)
+
+(define-key global-map (kbd "M-SPC") #'cycle-spacing)
+(define-key global-map (kbd "M-u")   #'upcase-dwim)
+(define-key global-map (kbd "M-l")   #'downcase-dwim)
+(define-key global-map (kbd "M-c")   #'capitalize-dwim)
+
+(let ((font "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1"))
+  (set-frame-font font nil t)
+  (add-to-list 'default-frame-alist `(font . ,font)))
+
+;; some cool stuff
+(save-place-mode +1)
+(savehist-mode +1)
+(setq history-delete-duplicates t
+      history-length 1000
+      savehist-save-minibuffer-history t)
+(electric-pair-mode +1)
+
+(define-key global-map (kbd "M-/") #'hippie-expand)
+(setq hippie-expand-try-functions-list
+      '(try-expand-dabbrev
+        try-expand-dabbrev-all-buffers
+        try-expand-dabbrev-from-kill
+        try-complete-file-name-partially
+        try-complete-file-name
+        try-expand-all-abbrevs
+        try-expand-list
+        try-expand-line
+        try-complete-lisp-symbol-partially
+        try-complete-lisp-symbol))
+
+(setq isearch-lazy-count t
+      search-whitespace-regexp ".*?"
+      isearch-allow-scroll 'unlimited)
+
+(defun op/buffer-to-side-window (place)
+        "Place the current buffer in the side window at PLACE."
+        (interactive (list (intern
+                            (completing-read "Which side: "
+                                             '(top left right bottom)))))
+        (let ((buf (current-buffer)))
+          (display-buffer-in-side-window
+           buf `((window-height . 0.15)
+                 (side . ,place)
+                 (slot . -1)
+                 (window-parameters . ((no-delete-other-windows . t)))))
+          (delete-window)))
+
+(defun op/fill-or-unfill (fn &optional justify region)
+  "Meant to be an adviced :around `fill-paragraph'.
+      FN is the original `fill-column'.  If `last-command' is
+      `fill-paragraph', unfill it, fill it otherwise.  Inspired from a
+      post on endless parentheses.  Optional argument JUSTIFY and
+      REGION are passed to `fill-paragraph'."
+  (let ((fill-column
+         (if (eq last-command 'fill-paragraph)
+             (progn (setq this-command nil)
+                    (point-max))
+           fill-column)))
+    (funcall fn justify region)))
+(advice-add 'fill-paragraph :around #'op/fill-or-unfill)
+
+(defmacro op/deftranspose (name scope key doc)
+  "Macro to produce transposition functions.
+      NAME is the function's symbol.  SCOPE is the text object to
+      operate on.  Optional DOC is the function's docstring.
+
+      Transposition over an active region will swap the object at
+      mark (region beginning) with the one at point (region end).
+
+      It can optionally define a key for the defined function in the
+      `global-map' if KEY is passed.
+
+      Originally from protesilaos' dotemacs."
+  (declare (indent defun))
+  `(progn
+     (defun ,name (arg)
+       ,doc
+       (interactive "p")
+       (let ((x (intern (format "transpose-%s" ,scope))))
+         (if (use-region-p)
+             (funcall x 0)
+           (funcall x arg))))
+     ,(when key
+        `(define-key global-map (kbd ,key) #',name))))
+
+(op/deftranspose op/transpose-lines "lines" "C-x C-t"
+  "Transpose lines or swap over active region.")
+
+(op/deftranspose op/transpose-paragraphs "paragraphs" "C-S-t"
+  "Transpose paragraph or swap over active region.")
+
+(op/deftranspose op/transpose-sentences "sentences" "C-x M-t"
+  "Transpose sentences or swap over active region.")
+
+(op/deftranspose op/transpose-sexps "sexps" "C-M-t"
+  "Transpose sexps or swap over active region.")
+
+(op/deftranspose op/transpose-words "words" "M-t"
+  "Transpose words or swap over active region.")
+
+(defun op/narrow-or-widen-dwim (p)
+  "Widen if the buffer is narrowed, narrow-dwim otherwise.
+      Dwim means: region, org-src-block, org-subtree or defun,
+      whichever applies first.  Narrowing to org-src-blocks actually
+      calls `org-edit-src-code'.
+
+      With prefix P, don't widen, just narrow even if buffer is already
+      narrowed.  With P being -, narrow to page instead of to defun.
+
+      Taken from endless parentheses."
+  (interactive "P")
+  (declare (interactive-only))
+  (cond ((and (buffer-narrowed-p) (not p)) (widen))
+        ((region-active-p)
+         (narrow-to-region (region-beginning)
+                           (region-end)))
+        ((derived-mode-p 'org-mode)
+         ;; `org-edit-src-code' isn't a real narrowing
+         (cond ((ignore-errors (org-edit-src-code) t))
+               ((ignore-errors (org-narrow-to-block) t))
+               (t (org-narrow-to-subtree))))
+        ((eql p '-) (narrow-to-page))
+        (t (narrow-to-defun))))
+
+(define-key global-map (kbd "C-c w") #'op/narrow-or-widen-dwim)
+
+(with-eval-after-load 'dired
+  (add-hook 'dired-mode-hook #'dired-hide-details-mode)
+  (add-hook 'dired-mode-hook #'dired-omit-mode)
+
+  (define-key dired-mode-map (kbd "C-c w") #'wdired-change-to-wdired-mode)
+
+  (require 'dired-x)
+  (setq dired-listing-switches "-lahF"
+        dired-dwim-target t
+        dired-deletion-confirmer #'y-or-n-p))
+
+;; just like telescope!
+(with-eval-after-load 'diff-mode
+  (define-key diff-mode-map (kbd "M-SPC") #'scroll-down-command))
+
+(with-eval-after-load 'elisp-mode
+  (add-hook 'emacs-lisp-mode-hook #'checkdoc-minor-mode)
+  (add-hook 'emacs-lisp-mode-hook #'prettify-symbols-mode)
+  (let ((map emacs-lisp-mode-map))
+    (define-key map (kbd "C-c C-k") #'eval-buffer)
+    (define-key map (kbd "C-c k")   #'op/ert-all)
+    (define-key map (kbd "C-c C-z") #'op/ielm-repl)))
+
+(with-eval-after-load 'help
+  (add-hook 'help-mode-hook #'visual-line-mode))
+
+;; add melpa
+(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
+
+;; packages that i want to be installed
+(dolist (pkg '(vc-got pdf-tools eglot nameless sly cider go-mode web-mode
+                      lua-mode markdown-mode elfeed form-feed shackle
+                      embark mct marginalia))
+  (unless (package-installed-p pkg)
+    (message "Installing %s" pkg)
+    (package-install pkg)))
+
+(global-form-feed-mode +1)
+
+(setq completion-styles '(basic substring initials flex partial-completion))
+
+(marginalia-mode +1)
+(mct-minibuffer-mode +1)
+(mct-region-mode +1)
+(setq mct-remove-shadowed-file-names t
+      mct-completions-format 'one-column
+      mct-completion-passlist '(Info-goto-node
+                                Info-index
+                                Info-menu
+                                vc-retrieve-tag
+                                imenu
+                                file
+                                buffer
+                                kill-ring))
+
+(with-eval-after-load 'eglot
+  (define-key eglot-mode-map (kbd "<f1>") #'eglot-code-actions)
+  (define-key eglot-mode-map (kbd "<f2>") #'eglot-format)
+  (add-to-list 'eglot-ignored-server-capabilites
+               :documentHighlightProvider)
+  (add-to-list 'eglot-server-programs
+               '(c-mode . ("clangd" "--header-insertion=never"))))
+
+(with-eval-after-load 'nameless
+  (add-hook 'emacs-lisp-mode #'nameless-mode)
+  (setq nameless-private-prefix t
+        nameless-affect-indentation-and-filling nil)
+  (define-key emacs-lisp-mode-map (kbd "_") #'nameless-insert-name-or-self-insert))
+
+(with-eval-after-load 'web-mode
+  (setq web-mode-markup-indent-offset 2
+        web-mode-css-indent-offset 2
+        web-mode-style-padding 0
+        web-mode-enable-engine-detection t)
+  (add-hook 'web-mode-hook #'op/disable-tabs))
+
+(with-eval-after-load 'css-mode
+  (add-hook 'css-mode-hook #'op/disable-tabs))
+
+(with-eval-after-load 'cc-mode
+  (setq c-basic-offset 8
+        c-default-style "K&R"
+        c-file-offsets '((arglist-intro . +)
+                         (arglist-cont-nonempty . *)))
+  (dolist (hook '(c-mode-hook c++-mode-hook))
+    (add-hook hook #'abbrev-mode)
+    (add-hook hook #'subword-mode))
+
+  ;; TODO: improve it!
+  (defun op/c-add-include (path &optional localp)
+    "Include PATH at the start of the file.
+       If LOCALP is non-nil, the include will be \"local\"."
+    (interactive "Mheader to include: \nP")
+    (save-excursion
+      (let ((re (if localp
+                    "^#[ \t]*include[ \t]*\""
+                  "^#[ \t]*include[ \t]*<"))
+            (ignore-re "^#include \"compat.h\"")
+            start)
+        (goto-char (point-min))
+        (while (not (or (and (looking-at re)
+                             (not (looking-at ignore-re)))
+                        (eobp)))
+          (forward-line))
+        (when (eobp)
+          (error "Don't know where to insert the header"))
+        (open-line 1)
+        (insert "#include " (if localp "\"\"" "<>"))
+        (backward-char)
+        (insert path)
+        (move-beginning-of-line 1)
+        (setq start (point))
+        (forward-line)
+        (while (and (looking-at re)
+                    (not (eobp)))
+          (forward-line))
+        (sort-lines nil start (point)))))
+  (define-key c-mode-map (kbd "C-c C-a") #'op/c-add-include))
+
+(with-eval-after-load 'perl-mode
+  (setq perl-indent-level 8))
+
+(with-eval-after-load 'sh-script
+  (setq sh-basic-offset 8
+        sh-indent-after-loop-construct 8
+        sh-indent-after-continuation nil))
+
+
+
+(defun op/eshell-bufname (dir)
+  (concat "*eshell " (expand-file-name dir) "*"))
+
+(defun op/eshell (arg)
+  "Run or jump to eshell in current project.
+If called with prefix argument ARG always create a new eshell
+buffer."
+  (interactive "P")
+  (let* ((proj (project-current))
+         (dir (if (and proj (not arg))
+                  (project-root proj)
+                default-directory))
+         (default-directory dir)
+         (eshell-buffer-name (let ((name (op/eshell-bufname dir)))
+                               (if arg
+                                   (generate-new-buffer name)
+                                 name))))
+    (eshell)))
+(define-key global-map (kbd "C-c e") #'op/eshell)
+
+(with-eval-after-load 'eshell
+  (setq eshell-save-history-on-exit t
+        eshell-history-size 1024
+
+        eshell-compl-dir-ignore
+        "\\`\\(\\.\\.?\\|CVS\\|\\.svn\\|\\.git\\|\\.got\\)/\\'")
+
+  (defun op/eshell-after-cd (&rest _)
+    (rename-buffer (op/eshell-bufname default-directory) t))
+
+  (advice-add #'eshell/cd :after #'op/eshell-after-cd)
+
+  (defun op/clear-eshell ()
+    (interactive "")
+    (let ((inhibit-read-only t))
+      (erase-buffer)
+      (eshell-send-input)))
+
+  (defun op/eshell-hook ()
+    "Because eshell is stupid."
+    (define-key eshell-mode-map (kbd "C-x M-o") #'op/clear-eshell))
+  (add-hook 'eshell-mode-hook #'op/eshell-hook))
+
+
+;; sndio.el
+(unless (package-installed-p 'sndio)
+  (package-install-file "~/w/sndio.el/sndio.el"))
+
+
+;; saturn
+(unless (package-installed-p 'saturn)
+  (package-install-file "~/w/saturn/GUI/saturn.el"))
+
+
+;; simple-pass
+(unless (package-installed-p 'simple-pass)
+  (package-install-file "~/.emacs.d/simple-pass.el"))
+(define-key global-map (kbd "C-z p") #'simple-pass-copy)
+
+
+
+;; elfeed
+
+(define-key global-map (kbd "C-x w") #'elfeed)
+(with-eval-after-load 'elfeed
+  (define-key elfeed-show-mode-map (kbd "q") #'delete-window)
+  (define-key elfeed-show-mode-map (kbd "S-SPC") #'scroll-down-command)
+  (define-key elfeed-show-mode-map (kbd "M-SPC") #'scroll-down-command)
+  (setq elfeed-show-entry-switch #'pop-to-buffer
+        elfeed-feeds
+        '("https://undeadly.org/cgi?action=rss&full=yes&items=10"
+          "http://www.tedunangst.com/flak/rss"
+          "https://www.dragonflydigest.com/feed"
+          "https://www.mirbsd.org/news.rss"
+          "https://www.mirbsd.org/announce.rss"
+          "https://bentsukun.ch/index.xml"
+          "https://drewdevault.com/feed.xml"
+          "https://www.cambus.net/atom.xml"
+          "https://dataswamp.org/~solene/rss.xml"
+          "https://briancallahan.net/blog/feed.xml"
+          "https://www.poolp.org/index.xml"
+          "https://jcs.org/rss"
+          "https://sanctum.geek.nz/arabesque/feed/"
+          "https://tech.toryanderson.com/"
+          "https://alexschroeder.ch/wiki?action=journal;search=-tag:rpg -tag:rsp;lang=en;title=English Diary without RPG Pages"
+          "http://boston.conman.org/bostondiaries.rss"
+          "https://emacsninja.com/feed.atom"
+          "https://bsdly.blogspot.com/feeds/posts/default"
+          "https://crawshaw.io/atom.xml"
+          "https://nullprogram.com/feed/"
+          "http://pragmaticemacs.com/feed/"
+          "https://emacsnotes.wordpress.com/feed/"
+          "https://metaredux.com/feed.xml"
+          "https://emacsredux.com/atom.xml"
+          "https://endlessparentheses.com/atom.xml"
+          "https://www.masteringemacs.org/feed"
+          "https://cestlaz.github.io/rss.xml"
+          "https://utcc.utoronto.ca/~cks/space/blog/?atom"
+          "https://irreal.org/blog/?feed=rss2"
+          "https://jao.io/blog/rss.xml"
+          "https://planet.lisp.org/rss20.xml"
+          "https://insideclojure.org/feed.xml"
+          "https://tech.toryanderson.com/index.xml"
+          "https://vermaden.wordpress.com/feed/"
+          "https://www.arp242.net/feed.xml"
+          "https://tymoon.eu/api/reader/atom"
+          "https://venam.nixers.net/blog/feed.xml"
+          "https://www.omarpolo.com/rss.xml"
+          "https://owarisubs.lacumpa.biz/feed/"
+          "https://asenshi.moe/feed/"
+          "https://godotengine.org/rss.xml"
+
+          "https://adventofcomputing.libsyn.com/rss"
+
+          "https://github.com/go-gitea/gitea/releases.atom"
+
+          "https://nitter.pussthecat.org/NanoRaptor/rss"
+
+          "https://github.com/yshui/picom/releases.atom"
+          "https://github.com/vslavik/poedit/releases.atom"
+          "https://github.com/TokTok/c-toxcore/releases.atom"
+          "https://github.com/alexander-akhmetov/python-telegram/releases.atom"
+          "https://github.com/paul-nameless/tg/releases.atom"
+          "https://github.com/YACReader/yacreader/releases.atom"
+          "https://github.com/luarocks/luarocks/releases.atom"
+          "https://github.com/okbob/pspg/releases.atom"
+          "https://github.com/taisei-project/taisei/releases.atom"
+          "https://github.com/recp/cglm/releases.atom"
+
+          "https://causal.agency/list/pounce.atom"
+
+          "https://www.crimsonmagic.me/feed/"
+          "https://fullybookedtls.wordpress.com/feed/")))
+
+(setq shackle-default-rule nil
+      shackle-rules
+      (let ((repls "\\*\\(cider-repl\\|sly-mrepl\\|ielm\\)")
+            (godot "\\*godot - .*\\*")
+            (vcs   "\\*\\(Flymake\\|Package-Lint\\|vc-\\(git\\|got\\) :\\).*")
+            (elfeed "\\*elfeed-entry\\*")
+            (vmd    "\\*vmd console .*"))
+        `((compilation-mode :noselect t
+                            :align above
+                            :size 0.2)
+          ("*Async Shell Command*" :ignore t)
+          (,repls :regexp t
+                  :align below
+                  :size 0.3)
+          (,godot :regexp t
+                  :align t
+                  :size 0.3)
+          (occur-mode :select t
+                      :align right
+                      :size 0.3)
+          (diff-mode :select t)
+          (help-mode :select t
+                     :align left
+                     :size 0.3)
+          (,vcs :regexp t
+                :align above
+                :size 0.15
+                :select t)
+          (,elfeed :regexp t
+                   :align t
+                   :select t
+                   :size 0.75)
+          (,vmd :regexp t
+                :align below
+                :select t
+                :size 0.3))))
+(shackle-mode +1)
+
+(define-key global-map (kbd "M-g e") #'embark-act)
blob - /dev/null
blob + 2733dc08c4e22839dd0d618cbc04c2bef661f728 (mode 644)
--- /dev/null
+++ emacs/minimal-theme.el
@@ -0,0 +1,230 @@
+;;; minimal-light-theme.el --- A light/dark minimalistic Emacs 27 theme.  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Omar Polo
+;; Copyright (C) 2014 Anler Hp
+
+;; Author: Anler Hp <anler86 [at] gmail.com>
+;; Keywords: color, theme, minimal
+;; X-URL: http://github.com/ikame/minimal-theme
+;; URL: http://github.com/ikame/minimal-theme
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; A minimalistic color theme to avoid distraction with
+;; colors.  Based on monochrome theme.
+
+;;; Code:
+(deftheme minimal-light "minimal light theme.")
+
+(let* ((class '((class color) (min-colors 89)))
+       (foreground "#586e75")
+       (background "#ffffff") ;; "#fdf6e3"
+       (cursor "#333")
+       (border "grey90")
+       (minibuffer cursor)
+       (region "grey85")
+       (comment-delimiter "grey55")
+       (comment "grey30")
+       (constant foreground)
+       (string "grey40")
+       (modeline-foreground foreground)
+       (modeline-background "#e1dbca")
+       (modeline-foreground-inactive comment)
+       (modeline-background-inactive background)
+       (modeline-border-color "white")
+       (isearch-background modeline-background)
+       (hl-background "grey94")
+       (hl-face-background nil)
+       (failure "red")
+       (org-background "grey94"))
+  (custom-theme-set-faces
+   'minimal-light
+
+   ;; basic stuff
+   `(default ((,class (:background ,background :foreground ,foreground))))
+   `(fringe ((,class (:inherit default))))
+   `(cursor ((,class (:background ,cursor :inverse-video t))))
+   `(vertical-border ((,class (:foreground ,border))))
+
+   ;; minibuffer
+   `(minibuffer-prompt ((,class (:foreground ,minibuffer :weight bold))))
+
+   ;; region
+   `(region ((,class (:background ,region))))
+   `(secondary-selection ((,class (:background ,region))))
+
+   ;; faces
+   `(font-lock-builtin-face ((,class (:foreground ,foreground :weight bold))))
+   `(font-lock-constant-face ((,class (:foreground ,foreground :weight bold))))
+   `(font-lock-keyword-face ((,class (:foreground ,foreground :weight bold))))
+   `(font-lock-type-face ((,class (:foreground ,foreground :slant italic))))
+   `(font-lock-function-name-face ((,class (:foreground ,foreground :weight bold))))
+   `(font-lock-variable-name-face ((,class (:foreground ,foreground))))
+
+   `(font-lock-comment-delimiter-face ((,class (:foreground ,comment-delimiter))))
+   `(font-lock-comment-face ((,class (:foreground ,comment
+                                                  :slant italic))))
+   `(font-lock-doc-face ((,class (:inherit (font-lock-comment-face)))))
+   `(font-lock-string-face ((,class (:foreground ,foreground :foreground ,string))))
+
+   ;; faces used by isearch
+   `(isearch ((,class (:foreground ,foreground :background ,isearch-background :weight normal))))
+   `(isearch-fail ((,class (:foreground ,failure :bold t))))
+   `(lazy-highlight
+     ((,class (:foreground ,foreground :background ,region))))
+
+   ;; flymake-error
+   `(flymake-error ((,class :underline (:style line :color "Red1"))))
+
+   ;; ido-mode
+   `(ido-subdir ((,class (:foreground ,foreground :weight bold))))
+   `(ido-only-match ((,class (:foreground ,foreground :weight bold))))
+
+   ;; show-paren
+   `(show-paren-match
+     ((,class (:inherit highlight
+                        :underline (:color ,foreground :style line)))))
+   `(show-paren-mismatch
+     ((,class (:foreground ,failure :weight bold))))
+   `(show-paren-match-expression
+     ((,class (:inherit default :background "#eee"))))
+
+   ;; highlight-sexp
+   `(hl-sexp-face
+     ((,class (:inherit show-paren-match-expression))))
+
+   ;; tab-bar
+   `(tab-bar ((,class :background ,modeline-background)))
+   `(tab-bar-tab ((,class :background ,modeline-background-inactive
+                          :box (:line-width 4 :color ,modeline-background-inactive))))
+   `(tab-bar-tab-inactive ((,class :background ,modeline-background
+                                   :box (:line-width 4 :color ,modeline-background))))
+
+   ;; help.  Don't print funny boxes around keybindings
+   `(help-key-binding ((,class)))
+
+   ;; modeline
+   `(mode-line
+     ((,class (:inverse-video unspecified
+                              :overline ,border
+                              :underline nil
+                              :foreground ,modeline-foreground
+                              :background ,modeline-background
+                              :overline ,border
+                              :box (:line-width 3 :color ,modeline-background)))))
+   `(mode-line-buffer-id ((,class (:weight bold))))
+   `(mode-line-inactive
+     ((,class (:inverse-video unspecified
+                              :overline ,border
+                              :underline nil
+                              :foreground ,modeline-foreground-inactive
+                              :background ,modeline-background-inactive
+                              :box (:line-width 3 :color ,background)))))
+
+   ;; hl-line-mode
+   `(hl-line ((,class (:background ,hl-background))))
+   `(hl-line-face ((,class (:background ,hl-face-background))))
+
+   ;; highlight-stages-mode
+   `(highlight-stages-negative-level-face ((,class (:foreground ,failure))))
+   `(highlight-stages-level-1-face ((,class (:background ,org-background))))
+   `(highlight-stages-level-2-face ((,class (:background ,region))))
+   `(highlight-stages-level-3-face ((,class (:background ,region))))
+   `(highlight-stages-higher-level-face ((,class (:background ,region))))
+
+   ;; org-mode
+   `(org-level-1 ((,class (:foreground ,foreground :height 1.6))))
+   `(org-level-2 ((,class (:foreground ,foreground :height 1.5))))
+   `(org-level-3 ((,class (:foreground ,foreground :height 1.4))))
+   `(org-level-4 ((,class (:foreground ,foreground :height 1.3))))
+   `(org-level-5 ((,class (:foreground ,foreground :height 1.2))))
+   `(org-level-6 ((,class (:foreground ,foreground :height 1.1))))
+   `(org-level-7 ((,class (:foreground ,foreground))))
+   `(org-level-8 ((,class (:foreground ,foreground))))
+
+   `(org-ellipsis ((,class (:inherit org-ellipsis :underline nil))))
+
+   `(org-table ((,class (:inherit fixed-pitch))))
+   `(org-meta-line ((,class (:inherit (font-lock-comment-face fixed-pitch)))))
+   `(org-property-value ((,class (:inherit fixed-pitch))) t)
+   `(org-verbatim ((,class (:inherit (shadow fixed-pitch)))))
+   `(org-quote ((,class (:slant italic))))
+
+   `(org-document-title ((,class (:foreground ,foreground))))
+
+   `(org-link ((,class (:foreground ,foreground :underline t))))
+   `(org-tag ((,class (:background ,org-background :foreground ,foreground))))
+   `(org-warning ((,class (:background ,region :foreground ,foreground :weight bold))))
+   `(org-todo ((,class (:weight bold))))
+   `(org-done ((,class (:weight bold))))
+   `(org-headline-done ((,class (:foreground ,foreground))))
+
+   `(org-table ((,class (:background ,org-background))))
+   `(org-code ((,class (:background ,org-background))))
+   `(org-date ((,class (:background ,org-background :underline t))))
+   `(org-block ((,class (:background ,org-background))))
+   `(org-block-background ((,class (:background ,org-background :foreground ,foreground))))
+   `(org-block-begin-line
+     ((,class (:background ,org-background :foreground ,comment-delimiter :weight bold))))
+   `(org-block-end-line
+     ((,class (:background ,org-background :foreground ,comment-delimiter :weight bold))))
+
+   ;; outline
+   `(outline-1 ((,class (:inherit org-level-1))))
+   `(outline-2 ((,class (:inherit org-level-2))))
+   `(outline-3 ((,class (:inherit org-level-3))))
+   `(outline-4 ((,class (:inherit org-level-4))))
+   `(outline-5 ((,class (:inherit org-level-5))))
+   `(outline-6 ((,class (:inherit org-level-6))))
+   `(outline-7 ((,class (:inherit org-level-7))))
+   `(outline-8 ((,class (:inherit org-level-8))))
+
+   ;; js2-mode
+   `(js2-external-variable ((,class (:inherit base-faces :weight bold))))
+   `(js2-function-param ((,class (:inherit base-faces))))
+   `(js2-instance-member ((,class (:inherit base-faces))))
+   `(js2-jsdoc-html-tag-delimiter ((,class (:inherit base-faces))))
+   `(js2-jsdoc-html-tag-name ((,class (:inherit base-faces))))
+   `(js2-jsdoc-tag ((,class (:inherit base-faces))))
+   `(js2-jsdoc-type ((,class (:inherit base-faces :weight bold))))
+   `(js2-jsdoc-value ((,class (:inherit base-faces))))
+   `(js2-magic-paren ((,class (:underline t))))
+   `(js2-private-function-call ((,class (:inherit base-faces))))
+   `(js2-private-member ((,class (:inherit base-faces))))
+
+   ;; sh-mode
+   `(sh-heredoc ((,class (:inherit base-faces :slant italic))))
+
+   ;; telega
+   `(telega-msg-heading ((,class (:inherit base-faces :underline ,comment-delimiter
+                                           :foreground ,comment))))
+   `(telega-msg-user-title ((,class (:inherit telega-msg-heading))))
+   `(telega-msg-inline-reply ((,class (:inherit telega-msg-heading
+                                                :slant italic))))
+
+   ;; objed
+   `(objed-hl ((,class (:background ,region))))
+
+   ;; circe
+   `(circe-prompt-face ((,class (:inherit default))))))
+
+;;;###autoload
+(when (and (boundp 'custom-theme-load-path) load-file-name)
+  (add-to-list 'custom-theme-load-path
+               (file-name-as-directory (file-name-directory load-file-name))))
+
+(provide-theme 'minimal-light)
+;;; minimal-light-theme.el ends here
blob - /dev/null
blob + 8a4dba51e67af762040716dad2f5fc89370c4307 (mode 644)
--- /dev/null
+++ emacs/simple-pass.el
@@ -0,0 +1,62 @@
+;;; simple-pass.el --- Interact with pass  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022  Free Software Foundation, Inc.
+
+;; Author: Omar Polo <op@omarpolo.com>
+;; Version: 1.0
+;; Package-Requires: ((emacs "25.1"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Simple wrapper for password-store without unnecessary dependencies.
+
+;;; Code:
+
+(defgroup simple-pass nil
+  "Simple Pass."
+  :group 'simple-pass)
+
+(defcustom simple-pass-cmd "pass"
+  "Path to the pass executable.")
+
+(defcustom simple-pass-dir (expand-file-name ".password-store" (getenv "HOME"))
+  "Path to the password-store repository")
+
+(defun simple-pass--copy ()
+  (let ((default-directory simple-pass-dir)
+        (process-file-side-effects))
+    (with-temp-buffer
+      (when (zerop (process-file "find" nil (current-buffer) nil
+                                 "." "-type" "f" "-iname" "*.gpg"))
+        (goto-char (point-min))
+        (cl-loop until (eobp)
+                 collect (buffer-substring-no-properties
+                          ;; skip ./
+                          (+ 2 (line-beginning-position))
+                          (line-end-position))
+                 do (forward-line +1))))))
+
+(defun simple-pass--copy-cr ()
+  "Completion read function for `simple-pass-copy'."
+  (completing-read "Entry: " (simple-pass--copy)))
+
+;;;###autoload
+(defun simple-pass-copy (pass)
+  (interactive (list (simple-pass--copy-cr)))
+  (shell-command (concat simple-pass-cmd " show -c " pass)))
+
+(provide 'simple-pass)
+;;; simple-pass.el ends here
blob - 009134c7148a334e646334b841942b290d88bff9
blob + 8b9897df2dd0100aea8ee8901b07a045bbe208f3
--- gen
+++ gen
@@ -4,6 +4,18 @@
 # but can't for portability reasons.
 # public domain
 
+copy()
+{
+	dotfiles="$HOME/$1 $dotfiles"
+
+	dname=$(dirname "$HOME/$1")
+	cat <<EOF >> Makefile.local
+$HOME/$1: $2
+	[ ! -d "$dname" ] && mkdir -p "$dname" || true
+	cp \$? \$@
+EOF
+}
+
 pair()
 {
 	files="$files $2"
@@ -61,6 +73,11 @@ pair .config/herbstluftwm/process.awk	config/herbstluf
 pair .config/herbstluftwm/lib		config/herbstluftwm/lib.lp
 pair .config/herbstluftwm/event-gen	config/herbstluftwm/event-gen.lp
 
+pair .emacs.d/early-init.el	emacs/early-init.el.lp
+copy .emacs.d/init.el		emacs/init.el
+copy .emacs.d/minimal-theme.el	emacs/minimal-theme.el
+copy .emacs.d/simple-pass.el	emacs/simple-pass.el
+
 conv index		index.lp
 for file in $files; do
 	conv "${file%.lp}" "$file"