* .emacs.d/init.el: Add some i3-like windmove bindings.
[~bandali/configs] / .emacs.d / init.el
index 29bfbcc..9c2f1ff 100644 (file)
@@ -135,26 +135,19 @@ This sets each user option VAR's value to the corresponding VALUE.
 ;;   (package-generate-description-file d "refinery-theme-pkg.el"))
 (run-with-idle-timer 0.01 nil #'require 'package)
 (with-eval-after-load 'package
-  (when (= (length package-archives) 1)
-    (csetq
-     package-archives
-     `(,@package-archives
-       ;; ("bndl" . "https://p.bndl.org/elpa/")
-       ("org" . "https://orgmode.org/elpa/"))
-     package-load-list
-     '(;; GNU ELPA
-       (debbugs "0.26")
-       (delight "1.7")
-       (orgalist "1.13")
-       (rt-liberation "1.31")
-       (yasnippet "0.14.0")
-       (expand-region "0.11.0")
-       (emms "6.2")
-       ;; bndl
-       ;; (refinery-theme "0.1.1")
-       ;; Org ELPA
-       (org-plus-contrib "20201109"))))
-  (package-initialize))
+  ;; (csetq
+  ;;  ;; package-archives
+  ;;  ;; `(,@package-archives
+  ;;  ;;   ("bndl" . "https://p.bndl.org/elpa/"))
+  ;;  package-load-list
+  ;;  '(;; GNU ELPA
+  ;;    (debbugs "0.29")
+  ;;    (delight "1.7")
+  ;;    (emms "7.7")
+  ;;    (expand-region "0.11.0")
+  ;;    (rt-liberation "2.4")
+  ;;    (yasnippet "0.14.0")))
+(package-initialize))
 
 (csetq package-archive-upload-base "/ssh:caffeine:~/www/p/elpa")
 
@@ -220,8 +213,10 @@ This sets each user option VAR's value to the corresponding VALUE.
 ;;;; C-level customizations
 
 (csetq
+ ;; line-spacing 3
  ;; completion case sensitivity
  completion-ignore-case t
+ read-buffer-completion-ignore-case t
  ;; minibuffer
  enable-recursive-minibuffers t
  resize-mini-windows t
@@ -245,7 +240,11 @@ This sets each user option VAR's value to the corresponding VALUE.
  indent-tabs-mode nil
  tab-width 4)
 
-(set-fontset-font t 'arabic "Vazir")
+(when (display-graphic-p)
+  (set-fontset-font t 'arabic "Vazir"))
+;; ;; (set-frame-font "Drafting Mono-14:weight=light" nil t)
+;; (set-frame-font "Drafting Mono:pixelsize=16" nil t)
+;; (set-face-attribute 'bold nil :weight 'semi-bold)
 
 ;;;; Elisp-level customizations
 
@@ -286,6 +285,9 @@ This sets each user option VAR's value to the corresponding VALUE.
 ;;   ;; (keyboard-translate ?\] ?\])
 ;; )
 
+;; minibuffer
+(csetq read-file-name-completion-ignore-case t)
+
 ;; startup
 ;; don't need to see the startup echo area message
 (advice-add #'display-startup-echo-area-message :override #'ignore)
@@ -339,7 +341,12 @@ This sets each user option VAR's value to the corresponding VALUE.
    display-time-mail-icon '(image :type xpm
                                   :file "gnus/gnus-pointer.xpm"
                                   :ascent center)
-   display-time-use-mail-icon t)
+   display-time-use-mail-icon t
+   zoneinfo-style-world-list
+   `(,@zoneinfo-style-world-list
+     ("Etc/UTC" "UTC")
+     ("Asia/Tehran" "Tehran")
+     ("Australia/Melbourne" "Melbourne")))
   (display-time-mode))
 
 (run-with-idle-timer 0.1 nil #'require 'battery)
@@ -355,6 +362,14 @@ This sets each user option VAR's value to the corresponding VALUE.
 (require 'winner)
 (winner-mode 1)
 
+(run-with-idle-timer 0.1 nil #'require 'windmove)
+(with-eval-after-load 'windmove
+  (csetq windmove-wrap-around t)
+  (global-set-key (kbd "M-H") #'windmove-left)
+  (global-set-key (kbd "M-L") #'windmove-right)
+  (global-set-key (kbd "M-K") #'windmove-up)
+  (global-set-key (kbd "M-J") #'windmove-down))
+
 (with-eval-after-load 'compile
   ;; don't display *compilation* buffer on success.  based on
   ;; https://stackoverflow.com/a/17788551, with changes to use `cl-letf'
@@ -425,11 +440,6 @@ This sets each user option VAR's value to the corresponding VALUE.
  ;; this will fail if gpg>=2.1 is not available
  epg-pinentry-mode 'loopback)
 
-;; (require 'pinentry)
-;; workaround for systemd-based distros:
-;; (setq pinentry--socket-dir server-socket-dir)
-;; (pinentry-start)
-
 ;; auth-source
 (csetq
  auth-sources '("~/.authinfo.gpg")
@@ -446,13 +456,17 @@ This sets each user option VAR's value to the corresponding VALUE.
 (when (display-graphic-p)
   (with-eval-after-load 'faces
     (let* ((grey "#e7e7e7")
-           (darker-grey "#d9d9d9")
-           (box ;; `(:line-width -1 :style released-button)
-            'unspecified))
+           ;; (darker-grey "#d9d9d9")
+           ;; (box ;; 'unspecified
+           ;;      `(;; :line-width -1
+           ;;        :style released-button))
+           )
       (set-face-attribute 'mode-line nil
-                          :background grey :box box)
-      (set-face-attribute 'mode-line-inactive nil
-                          :background darker-grey :box box))))
+                          :background grey ;; :box box
+                          )
+      ;; (set-face-attribute 'mode-line-inactive nil
+      ;;                     :background darker-grey :box box)
+      )))
 
 \f
 ;;; Useful utilities
@@ -555,6 +569,7 @@ Make N (default: 1) copies of the current line or region."
 (global-set-key (kbd "C-c f .") #'find-file)
 (global-set-key (kbd "C-c f d") #'find-name-dired)
 (global-set-key (kbd "C-c f l") #'find-library)
+(global-set-key (kbd "C-c f p") #'find-file-at-point)
 
 ;; frames
 (global-set-key (kbd "C-c F m") #'make-frame-command)
@@ -600,51 +615,21 @@ Make N (default: 1) copies of the current line or region."
    (completing-read "Find recent file: " recentf-list)))
   (global-set-key (kbd "C-c f r") #'b/recentf-open))
 
-(fido-mode 1)
-(defun b/icomplete--fido-mode-setup ()
-  "Customizations to `fido-mode''s minibuffer."
-  (when (and icomplete-mode (icomplete-simple-completing-p))
-    (setq-local
-     ;; icomplete-compute-delay 0.1
-     ;; icomplete-hide-common-prefix t
-     icomplete-separator " · "
-     completion-styles '(basic substring partial-completion flex))))
-(add-hook 'minibuffer-setup-hook #'b/icomplete--fido-mode-setup 1)
+;; (fido-mode 1)
+;; (defun b/icomplete--fido-mode-setup ()
+;;   "Customizations to `fido-mode''s minibuffer."
+;;   (when (and icomplete-mode (icomplete-simple-completing-p))
+;;     (setq-local
+;;      ;; icomplete-compute-delay 0.1
+;;      ;; icomplete-hide-common-prefix t
+;;      icomplete-separator " · "
+;;      completion-styles '(basic substring partial-completion flex))))
+;; (add-hook 'minibuffer-setup-hook #'b/icomplete--fido-mode-setup 1)
 
 (require 'bandali-eshell)
 
 (require 'bandali-ibuffer)
 
-;; outline
-;; (with-eval-after-load 'outline
-;;   (when (featurep 'which-key)
-;;     (which-key-add-key-based-replacements
-;;       "C-c @" "outline"
-;;       "s-O"   "outline"))
-;;   (define-key outline-minor-mode-map (kbd "<s-tab>")
-;;     #'outline-toggle-children)
-;;   (define-key outline-minor-mode-map (kbd "M-p")
-;;     #'outline-previous-visible-heading)
-;;   (define-key outline-minor-mode-map (kbd "M-n")
-;;     #'outline-next-visible-heading)
-;;   (defvar b/outline-prefix-map)
-;;   (define-prefix-command 'b/outline-prefix-map)
-;;   (define-key outline-minor-mode-map (kbd "s-O")
-;;     'b/outline-prefix-map)
-;;   (define-key b/outline-prefix-map (kbd "TAB")
-;;     #'outline-toggle-children)
-;;   (define-key b/outline-prefix-map (kbd "a")
-;;     #'outline-hide-body)
-;;   (define-key b/outline-prefix-map (kbd "H")
-;;     #'outline-hide-body)
-;;   (define-key b/outline-prefix-map (kbd "S")
-;;     #'outline-show-all)
-;;   (define-key b/outline-prefix-map (kbd "h")
-;;     #'outline-hide-subtree)
-;;   (define-key b/outline-prefix-map (kbd "s")
-;;     #'outline-show-subtree))
-;; (add-hook 'prog-mode-hook #'outline-minor-mode)
-
 (require 'bandali-dired)
 
 (with-eval-after-load 'help
@@ -669,9 +654,12 @@ Make N (default: 1) copies of the current line or region."
 
 (csetq shr-max-width 80)
 
-;; Email (with Gnus and message)
+;; Email (with Gnus, message, and smtpmail)
 (require 'bandali-gnus)
 (require 'bandali-message)
+;; (with-eval-after-load 'smtpmail
+;;   (csetq smtpmail-queue-mail t
+;;          smtpmail-queue-dir (concat b/maildir "queue/")))
 
 ;; IRC (with ERC)
 (require 'bandali-erc)
@@ -740,19 +728,6 @@ Make N (default: 1) copies of the current line or region."
 (with-eval-after-load 'flyspell
   (csetq flyspell-mode-line-string " fly"))
 
-;; flycheck
-;; (run-with-idle-timer 0.6 nil #'require 'flycheck)
-;; (with-eval-after-load 'flycheck
-;;   (csetq
-;;    ;; Use the load-path from running Emacs when checking elisp files
-;;    flycheck-emacs-lisp-load-path 'inherit
-;;    ;; Only flycheck when I actually save the buffer
-;;    flycheck-check-syntax-automatically '(mode-enabled save)
-;;    flycheck-mode-line-prefix "flyc"))
-;; (define-key flycheck-mode-map (kbd "M-P") #'flycheck-previous-error)
-;; (define-key flycheck-mode-map (kbd "M-N") #'flycheck-next-error)
-;; (add-hook 'prog-mode-hook #'flycheck-mode)
-
 ;; ispell
 ;; http://endlessparentheses.com/ispell-and-apostrophes.html
 ;; (run-with-idle-timer 0.6 nil #'require 'ispell)
@@ -832,9 +807,6 @@ Make N (default: 1) copies of the current line or region."
 (with-eval-after-load 'css-mode
   (csetq css-indent-offset 2))
 
-;; po-mode
-;; (add-hook 'po-mode-hook (lambda nil (run-with-timer 0.1 nil 'View-exit)))
-
 ;; auctex
 ;; (csetq font-latex-fontify-sectioning 'color)
 
@@ -1008,6 +980,12 @@ Make N (default: 1) copies of the current line or region."
   (delight 'mml-mode " mml" "mml")
   (delight 'yas-minor-mode "" "yasnippet"))
 
+;; po-mode
+(require 'bandali-po)
+
+(with-eval-after-load 'emms
+  (csetq emms-directory (b/var "emms")))
+
 \f
 ;;; Post initialization