Revert "* .emacs.d/init.el: Enable electric-pair-mode."
[~bandali/configs] / .emacs.d / init.el
index 4183865..28c1ba7 100644 (file)
@@ -60,8 +60,7 @@
   ;;    (debbugs "0.29")
   ;;    (delight "1.7")
   ;;    (emms "7.7")
-  ;;    (rt-liberation "2.4")
-  ;;    (yasnippet "0.14.0")))
+  ;;    (rt-liberation "2.4")))
 (package-initialize))
 
 (setq package-archive-upload-base "/ssh:caffeine:~/www/p/elpa")
 (defalias 'yes-or-no-p #'y-or-n-p)
 
 (when (display-graphic-p)
+  ;; (set-frame-font "Source Code Pro-10.5:weight=medium" nil t)
+  ;; (set-frame-font "FreeSans" nil t)
   (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
 
   (setq 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)
-(setq
- auto-save-list-file-prefix (b/var "auto-save/sessions/")
- ;; i want *scratch* as my startup buffer
- initial-buffer-choice t
- ;; i don't need the default hint
- initial-scratch-message nil
- ;; use customizable text-mode as major mode for *scratch*
- ;; (initial-major-mode 'text-mode)
- ;; inhibit buffer list when more than 2 files are loaded
- inhibit-startup-buffer-menu t
- ;; don't need to see the startup screen or echo area message
- inhibit-startup-screen t
- inhibit-startup-echo-area-message user-login-name)
+(setq auto-save-list-file-prefix (b/var "auto-save/sessions/"))
 
 (with-eval-after-load 'files
   (setq
 (when (display-graphic-p)
   (with-eval-after-load 'faces
     (let ((grey "#e7e7e7"))
-      (set-face-attribute 'fixed-pitch nil :family "Source Code Pro")
+      (set-face-attribute 'fixed-pitch nil
+                          :font "Source Code Pro"
+                          :weight 'medium)
       (set-face-attribute 'mode-line nil
                           :background grey
                           :inherit 'fixed-pitch))))
@@ -389,16 +375,16 @@ For disabling the behaviour for certain buffers and/or modes."
   (make-local-variable 'mouse-autoselect-window)
   (setq mouse-autoselect-window nil))
 
-(defun b/move-indentation-or-beginning-of-line (arg)
-  "Move to the indentation or to the beginning of line."
-  (interactive "^p")
-  ;; (if (bolp)
-  ;;     (back-to-indentation)
-  ;;   (move-beginning-of-line arg))
-  (if (= (point)
-         (progn (back-to-indentation)
-                (point)))
-      (move-beginning-of-line arg)))
+;; (defun b/move-indentation-or-beginning-of-line (arg)
+;;   "Move to the indentation or to the beginning of line."
+;;   (interactive "^p")
+;;   ;; (if (bolp)
+;;   ;;     (back-to-indentation)
+;;   ;;   (move-beginning-of-line arg))
+;;   (if (= (point)
+;;          (progn (back-to-indentation)
+;;                 (point)))
+;;       (move-beginning-of-line arg)))
 
 (defun b/join-line-top ()
   "Like `join-line', but join next line to the current line."
@@ -436,9 +422,8 @@ Make N (default: 1) copies of the current line or region."
   "Invert the `default' face (swap its background and foreground).
 Effectively a very simple light/dark theme toggle switch."
   (interactive)
-  (invert-face 'default)
-  (when (display-graphic-p)
-    (invert-face 'mode-line)))
+  (invert-face 'default (selected-frame))
+  (invert-face 'mode-line (selected-frame)))
 
 (defun b/export-frame ()
   (interactive)
@@ -453,12 +438,12 @@ Effectively a very simple light/dark theme toggle switch."
 \f
 ;;; General key bindings
 
-(global-set-key (kbd "C-a") #'b/move-indentation-or-beginning-of-line)
-(global-set-key (kbd "C-c i") #'ielm)
+;; (global-set-key (kbd "C-a") #'b/move-indentation-or-beginning-of-line)
+(global-set-key (kbd "C-c i") #'ielm)
 (global-set-key (kbd "C-c d") #'b/duplicate-line-or-region)
 (global-set-key (kbd "C-c j") #'b/join-line-top)
 (global-set-key (kbd "C-S-j") #'b/join-line-top)
-(global-set-key (kbd "C-c s") #'b/*scratch*)
+(global-set-key (kbd "C-c s c") #'b/*scratch*)
 (global-set-key (kbd "C-c x") #'execute-extended-command)
 (global-set-key (kbd "C-c v") #'b/invert-default-face)
 
@@ -601,8 +586,8 @@ Effectively a very simple light/dark theme toggle switch."
         scpaste-scp-destination "p:~"))
 (autoload 'scpaste "scpaste" nil t)
 (autoload 'scpaste-region "scpaste" nil t)
-(global-set-key (kbd "C-c p p") #'scpaste)
-(global-set-key (kbd "C-c p r") #'scpaste-region)
+(global-set-key (kbd "C-c p p") #'scpaste)
+(global-set-key (kbd "C-c p r") #'scpaste-region)
 
 \f
 ;;; Editing
@@ -761,7 +746,6 @@ Effectively a very simple light/dark theme toggle switch."
 ;; ,----
 ;; | make pretty boxed quotes like this
 ;; `----
-(add-to-list 'load-path (b/lisp "boxquote"))
 (run-with-idle-timer 0.6 nil #'require 'boxquote)
 (with-eval-after-load 'boxquote
   (defvar b/boxquote-prefix-map)
@@ -794,31 +778,6 @@ Effectively a very simple light/dark theme toggle switch."
   ;; Highlight TODO in buffers.
   (global-hl-todo-mode))
 
-(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
-        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)
@@ -845,7 +804,7 @@ Effectively a very simple light/dark theme toggle switch."
   (setq
    eww-download-directory
    (file-name-as-directory (getenv "XDG_DOWNLOAD_DIR"))))
-(global-set-key (kbd "C-c e w") #'eww)
+(global-set-key (kbd "C-c e w") #'eww)
 
 ;; (with-eval-after-load 'org-ref
 ;;   (setq
@@ -854,11 +813,10 @@ Effectively a very simple light/dark theme toggle switch."
 ;;    org-ref-bibliography-notes "~/usr/org/notes.org"
 ;;    org-ref-pdf-directory "~/usr/org/bibtex-pdfs/"))
 
-(when (featurep 'display-fill-column-indicator)
-  (run-with-idle-timer
-   0.2 nil #'require 'display-fill-column-indicator)
-  (with-eval-after-load 'display-fill-column-indicator
-    (global-display-fill-column-indicator-mode 1)))
+(run-with-idle-timer
+ 0.2 nil #'require 'display-fill-column-indicator nil 'noerror)
+(with-eval-after-load 'display-fill-column-indicator
+  (global-display-fill-column-indicator-mode 1))
 
 (with-eval-after-load 'window
   (setq split-width-threshold 150)
@@ -897,8 +855,7 @@ Effectively a very simple light/dark theme toggle switch."
 (with-eval-after-load 'delight
   (delight 'auto-fill-function " f" "simple")
   (delight 'abbrev-mode "" "abbrev")
-  (delight 'mml-mode " mml" "mml")
-  (delight 'yas-minor-mode "" "yasnippet"))
+  (delight 'mml-mode " mml" "mml"))
 
 (require 'bandali-po)