* .emacs.d/init.el (b/*scratch*): Invert `mode-line' when `display-graphic-p'.
[~bandali/configs] / .emacs.d / init.el
index 0fd70e5..60f5f0d 100644 (file)
 
 (setq
  ;; 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
- ;; mode-line
  mode-line-compact t
+ ;; mouse-autoselect-window t
+ scroll-conservatively 101
+ scroll-preserve-screen-position 1
  ;; i don't feel like jumping out of my chair every now and again;
  ;; so...don't *BEEP* at me, emacs =)
- ring-bell-function 'ignore
- ;; better scrolling
- ;; scroll-conservatively 101
- scroll-conservatively 15
- ;; scroll-preserve-screen-position 1
- ;; focus follows mouse
- ;; mouse-autoselect-window t
- )
+ ring-bell-function 'ignore)
 
 (setq-default
  ;; case-sensitive search (and `dabbrev-expand')
 ;; faces
 (when (display-graphic-p)
   (with-eval-after-load 'faces
-    (let* ((grey "#e7e7e7")
-           ;; (darker-grey "#d9d9d9")
-           ;; (box ;; 'unspecified
-           ;;      `(;; :line-width -1
-           ;;        :style released-button))
-           )
-      ;; (set-face-attribute 'fixed-pitch nil :family "Source Code Pro")
-      (set-face-attribute 'fixed-pitch nil :family "Inconsolata")
+    (let ((grey "#e7e7e7"))
+      (set-face-attribute 'fixed-pitch nil :family "Source Code Pro")
       (set-face-attribute 'mode-line nil
-                          :background grey ;; :box box
-                          :inherit 'fixed-pitch)
-      ;; (set-face-attribute 'mode-line-inactive nil
-      ;;                     :background darker-grey :box box)
-      )))
+                          :background grey
+                          :inherit 'fixed-pitch))))
 
 \f
 ;;; Useful utilities
@@ -527,7 +511,9 @@ 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))
+  (invert-face 'default)
+  (when (display-graphic-p)
+    (invert-face 'mode-line)))
 
 \f
 ;;; General key bindings
@@ -803,6 +789,12 @@ Effectively a very simple light/dark theme toggle switch."
 (add-hook 'tex-mode-hook #'auto-fill-mode)
 (add-hook 'tex-mode-hook #'flyspell-mode)
 
+(run-with-idle-timer 0.5 nil #'require 'cmake-mode)
+(with-eval-after-load 'cmake-mode
+  (setq cmake-tab-width 4)
+  (add-to-list 'load-path (b/lisp "cmake-font-lock"))
+  (run-with-idle-timer 0.5 nil #'require 'cmake-font-lock))
+
 \f
 ;;; Emacs enhancements & auxiliary packages
 
@@ -812,11 +804,10 @@ Effectively a very simple light/dark theme toggle switch."
 (defun b/*scratch* ()
   "Switch to `*scratch*' buffer, creating it if it does not exist."
   (interactive)
-  (switch-to-buffer
-   (or (get-buffer "*scratch*")
-       (with-current-buffer (get-buffer-create "*scratch*")
-         (set-buffer-major-mode (current-buffer))
-         (current-buffer)))))
+  (let ((fun (if (functionp #'get-scratch-buffer-create)
+                 #'get-scratch-buffer-create ; (version<= "29" emacs-version)
+               #'startup--get-buffer-create-scratch))) ; (version< emacs-version "29")
+    (switch-to-buffer (funcall fun))))
 (global-set-key (kbd "C-c s") #'b/*scratch*)
 
 ;; ,----
@@ -972,6 +963,21 @@ Effectively a very simple light/dark theme toggle switch."
 (with-eval-after-load 'emms
   (setq emms-directory (b/var "emms")))
 
+(add-to-list 'load-path (b/lisp "ffs"))
+(run-with-idle-timer 0.5 nil #'require 'ffs)
+(with-eval-after-load 'ffs
+  (global-set-key (kbd "C-c f s") #'ffs))
+
+(defun b/export-frame ()
+  (interactive)
+  ;; TODO: ask for fn and/or take as arg
+  (let* ((fn (make-temp-file "emacs" nil ".pdf"))
+         (data (x-export-frames nil 'pdf)))
+    (with-temp-file fn
+      (insert data))
+    (kill-new fn)
+    (message fn)))
+
 \f
 ;;; Post initialization