-(use-package expand-region
- :bind ("C-=" . er/expand-region))
-
-(require 'bandali-yasnippet)
-
-(comment
-
-(use-package debbugs
- :bind
- (("C-c D d" . debbugs-gnu)
- ("C-c D b" . debbugs-gnu-bugs)
- ("C-c D e" .
- (lambda ()
- (interactive) ; bug-gnu-emacs
- (setq debbugs-gnu-current-suppress t)
- (debbugs-gnu debbugs-gnu-default-severities '("emacs"))))
- ("C-c D g" . ; bug-gnuzilla
- (lambda ()
- (interactive)
- (setq debbugs-gnu-current-suppress t)
- (debbugs-gnu debbugs-gnu-default-severities '("gnuzilla"))))
- ("C-c D G b" . ; bug-guix
- (lambda ()
- (interactive)
- (setq debbugs-gnu-current-suppress t)
- (debbugs-gnu debbugs-gnu-default-severities '("guix"))))
- ("C-c D G p" . ; guix-patches
- (lambda ()
- (interactive)
- (setq debbugs-gnu-current-suppress t)
- (debbugs-gnu debbugs-gnu-default-severities '("guix-patches"))))))
-
-(use-package org-ref
- :init
- (b/setq-every '("~/usr/org/references.bib")
- reftex-default-bibliography
- org-ref-default-bibliography)
- (setq
- org-ref-bibliography-notes "~/usr/org/notes.org"
- org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
-
-;; (use-package fill-column-indicator)
-
-(use-package window
- :bind
- (("C-c w s l" . (lambda ()
- (interactive)
- (split-window-right)
- (other-window 1)))
- ("C-c w s j" . (lambda ()
- (interactive)
- (split-window-below)
- (other-window 1)))
- ("C-c w q" . quit-window))
- :custom
- (split-width-threshold 150))
-
-(use-package windmove
- :defer 0.6
- :bind
- (("C-c w h" . windmove-left)
- ("C-c w j" . windmove-down)
- ("C-c w k" . windmove-up)
- ("C-c w l" . windmove-right)
- ("C-c w H" . windmove-swap-states-left)
- ("C-c w J" . windmove-swap-states-down)
- ("C-c w K" . windmove-swap-states-up)
- ("C-c w L" . windmove-swap-states-right)))
-
-(use-package pass
- :commands pass
- :bind ("C-c a p" . pass)
- :hook (pass-mode . View-exit))
-
-(use-package pdf-tools
- :defer 0.5
- :bind (:map pdf-view-mode-map
- ("<C-XF86Back>" . pdf-history-backward)
- ("<mouse-8>" . pdf-history-backward)
- ("<drag-mouse-8>" . pdf-history-backward)
- ("<C-XF86Forward>" . pdf-history-forward)
- ("<mouse-9>" . pdf-history-forward)
- ("<drag-mouse-9>" . pdf-history-forward)
- ("M-RET" . image-previous-line)
- ("C-s" . isearch-forward)
- ("s s" . isearch-forward))
- :config (pdf-tools-install nil t)
- :custom (pdf-view-resize-factor 1.05))
-
-(use-package org-pdftools
- :disabled
- :straight (:host github :repo "fuxialexander/org-pdftools")
- :demand
- :after org
- :config
- (with-eval-after-load 'org
- (require 'org-pdftools)))
-
-(use-package biblio)
-
-(use-package reftex
- :hook (latex-mode . reftex-mode))
-
-(use-package reftex-cite
- :after reftex
- :disabled ; enable to disable
- ; reftex-cite's default choice
- ; of previous word
- :config
- (defun reftex-get-bibkey-default ()
- "If the cursor is in a citation macro, return the word before the macro."
- (let* ((macro (reftex-what-macro 1)))
- (save-excursion
- (when (and macro (string-match "cite" (car macro)))
- (goto-char (cdr macro)))
- (reftex-this-word)))))
-
-(use-package dmenu
- :custom
- (dmenu-prompt-string "run: ")
- (dmenu-save-file (b/var "dmenu-items")))
-
-(use-package eosd
- ;; TODO: fix build by properly building the eosd-pixbuf.c module
- ;; e.g. see https://github.com/raxod502/straight.el/issues/386
- :disabled
- :straight (:host github :repo "clarete/eosd")
- :demand
- :after exwm
- :config
- (eosd-start))
-
-(use-package eww
- :bind ("C-c a e w" . eww)
- :custom
- (eww-download-directory (file-name-as-directory
- (getenv "XDG_DOWNLOAD_DIR"))))
+;; expand-region
+(global-set-key (kbd "C-=") #'er/expand-region)
+
+(run-with-idle-timer 0.6 nil #'require 'yasnippet)
+(with-eval-after-load 'yasnippet
+ (declare-function yas-reload-all
+ "yasnippet" (&optional no-jit interactive))
+ (declare-function yas-maybe-expand-abbrev-key-filter
+ "yasnippet" (cmd))
+
+ (defconst yas-verbosity-cur yas-verbosity)
+ (setq yas-verbosity 2)
+ (csetq yas-snippet-dirs `(,(b/etc "yasnippet/snippets")))
+ (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
+ (yas-reload-all)
+ (setq yas-verbosity yas-verbosity-cur)
+
+ (defun b/yas-maybe-expand-abbrev-key-filter (cmd)
+ (when (and (yas-maybe-expand-abbrev-key-filter cmd)
+ (not (bound-and-true-p git-commit-mode)))
+ cmd))
+ (defconst b/yas-maybe-expand
+ '(menu-item "" yas-expand
+ :filter b/yas-maybe-expand-abbrev-key-filter))
+ (define-key yas-minor-mode-map (kbd "SPC") b/yas-maybe-expand)
+
+ (yas-global-mode))
+
+;; debbugs
+(global-set-key (kbd "C-c D d") #'debbugs-gnu)
+(global-set-key (kbd "C-c D b") #'debbugs-gnu-bugs)
+(global-set-key (kbd "C-c D e") ; bug-gnu-emacs
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("emacs"))))
+(global-set-key (kbd "C-c D g") ; bug-gnuzilla
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("gnuzilla"))))
+(global-set-key (kbd "C-c D G b") ; bug-guix
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("guix"))))
+(global-set-key (kbd "C-c D G p") ; guix-patches
+ (lambda ()
+ (interactive)
+ (setq debbugs-gnu-current-suppress t)
+ (debbugs-gnu debbugs-gnu-default-severities
+ '("guix-patches"))))
+
+;; url and url-cache
+(csetq
+ url-configuration-directory (b/var "url/configuration/")
+ url-cache-directory (b/var "url/cache/"))
+
+;; eww
+(csetq eww-download-directory (file-name-as-directory
+ (getenv "XDG_DOWNLOAD_DIR")))
+(global-set-key (kbd "C-c a e w") #'eww)
+
+;; ;; org-ref
+;; (csetq
+;; reftex-default-bibliography '("~/usr/org/references.bib")
+;; org-ref-default-bibliography '("~/usr/org/references.bib")
+;; org-ref-bibliography-notes "~/usr/org/notes.org"
+;; org-ref-pdf-directory "~/usr/org/bibtex-pdfs/")
+
+;; fill-column-indicator ?
+
+;; window
+(csetq split-width-threshold 150)
+(global-set-key (kbd "C-c w s l")
+ (lambda ()
+ (interactive)
+ (split-window-right)
+ (other-window 1)))
+(global-set-key (kbd "C-c w s j")
+ (lambda ()
+ (interactive)
+ (split-window-below)
+ (other-window 1)))
+(global-set-key (kbd "C-c w q") #'quit-window)
+
+(run-with-idle-timer 0.6 nil #'require 'windmove)
+(global-set-key (kbd "C-c w h") #'windmove-left)
+(global-set-key (kbd "C-c w j") #'windmove-down)
+(global-set-key (kbd "C-c w k") #'windmove-up)
+(global-set-key (kbd "C-c w l") #'windmove-right)
+(global-set-key (kbd "C-c w H") #'windmove-swap-states-left)
+(global-set-key (kbd "C-c w J") #'windmove-swap-states-down)
+(global-set-key (kbd "C-c w K") #'windmove-swap-states-up)
+(global-set-key (kbd "C-c w L") #'windmove-swap-states-right)
+
+;; pass
+;; (global-set-key (kbd "C-c a p") #'pass)
+;; (add-hook 'pass-mode-hook #'View-exit)
+
+;; reftex
+;; uncomment to disable reftex-cite's default choice of previous word
+;; (with-eval-after-load 'reftex
+;; (require 'reftex-cite)
+;; (defun reftex-get-bibkey-default ()
+;; "If the cursor is in a citation macro, return the word before the macro."
+;; (let* ((macro (reftex-what-macro 1)))
+;; (save-excursion
+;; (when (and macro (string-match "cite" (car macro)))
+;; (goto-char (cdr macro)))
+;; (reftex-this-word)))))
+(add-hook 'latex-mode-hook #'reftex-mode)
+
+;; dmenu
+;; (csetq
+;; dmenu-prompt-string "run: "
+;; dmenu-save-file (b/var "dmenu-items"))
+
+;; eosd ?
+
+;; delight
+(run-with-idle-timer 0.5 nil #'require 'delight)
+(with-eval-after-load 'delight
+ (delight 'auto-fill-function " f" "simple")
+ (delight 'abbrev-mode "" "abbrev")
+ (delight 'page-break-lines-mode "" "page-break-lines")
+ (delight 'ivy-mode "" "ivy")
+ (delight 'counsel-mode "" "counsel")
+ (delight 'mml-mode " mml" "mml")
+ (delight 'yas-minor-mode "" "yasnippet"))