[rc/emacs] disable the internal border of Emacs' frame
[~bandali/configs] / init.org
index 371ec1e..cd05bde 100644 (file)
--- a/init.org
+++ b/init.org
@@ -9,9 +9,21 @@
 :END:
 
 This org file is my literate configuration for GNU Emacs, and is
 :END:
 
 This org file is my literate configuration for GNU Emacs, and is
-tangled to [[./init.el][init.el]]. Packages are installed and managed using [[https://github.com/emacscollective/borg][Borg]].
-
-** Installation
+tangled to [[./init.el][init.el]]. Packages are installed and managed using
+[[https://github.com/emacscollective/borg][Borg]]. Over the years, I've taken inspiration from configurations of
+many different people. Some of the configurations that I can remember
+off the top of my head are:
+
+- [[https://github.com/dieggsy/dotfiles][dieggsy/dotfiles]]: literate Emacs and dotfiles configuration, uses
+  straight.el for managing packages
+- [[https://github.com/dakra/dmacs][dakra/dmacs]]: literate Emacs configuration, using Borg for managing
+  packages
+- [[http://pages.sachachua.com/.emacs.d/Sacha.html][Sacha Chua's literate Emacs configuration]]
+- [[https://github.com/dakrone/eos][dakrone/eos]]
+- Ryan Rix's [[http://doc.rix.si/cce/cce.html][Complete Computing Environment]] ([[http://doc.rix.si/projects/fsem.html][about cce]])
+- [[https://github.com/jwiegley/dot-emacs][jwiegley/dot-emacs]]: nix-based configuration
+- [[https://github.com/wasamasa/dotemacs][wasamasa/dotemacs]]
+- [[https://github.com/hlissner/doom-emacs][Doom Emacs]]
 
 I'd like to have a fully reproducible Emacs setup (part of the reason
 why I store my configuration in this repository) but unfortunately out
 
 I'd like to have a fully reproducible Emacs setup (part of the reason
 why I store my configuration in this repository) but unfortunately out
@@ -22,13 +34,28 @@ to my init time; which is unacceptable for me: I use Emacs as my
 window manager (via EXWM) and coming from bspwm, I'm too used to
 having fast startup times.
 
 window manager (via EXWM) and coming from bspwm, I'm too used to
 having fast startup times.
 
+** Installation
+
+To use this config for your Emacs, first you need to clone this repo,
+then bootstrap Borg, tell Borg to retrieve package submodules, and
+byte-compiled the packages. Something along these lines should work:
+
+#+begin_src sh :tangle no
+git clone https://github.com/aminb/dotfiles ~/.emacs.d
+cd ~/.emacs.d
+make bootstrap-borg
+make tangle-init
+make bootstrap
+make build
+#+end_src
+
 * Contents                                                   :toc_1:noexport:
 
 - [[#about][About]]
 - [[#header][Header]]
 - [[#initial-setup][Initial setup]]
 - [[#core][Core]]
 * Contents                                                   :toc_1:noexport:
 
 - [[#about][About]]
 - [[#header][Header]]
 - [[#initial-setup][Initial setup]]
 - [[#core][Core]]
-- [[#post-init][Post initialization]]
+- [[#post-initialization][Post initialization]]
 - [[#footer][Footer]]
 
 * Header
 - [[#footer][Footer]]
 
 * Header
@@ -264,7 +291,6 @@ contain the mess.
         `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
 #+end_src
 
         `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))))
 #+end_src
 
-
 ** Custom file (=custom.el=)
 
 I'm not planning on using the custom file much, but even so, I
 ** Custom file (=custom.el=)
 
 I'm not planning on using the custom file much, but even so, I
@@ -287,15 +313,15 @@ Let's use [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shel
 in my shell.
 
 #+begin_src emacs-lisp
 in my shell.
 
 #+begin_src emacs-lisp
-;; (use-package exec-path-from-shell
-;;   :defer 1
-;;   :init
-;;   (setq exec-path-from-shell-check-startup-files nil)
-;;   :config
-;;   (exec-path-from-shell-initialize)
-;;   ;; while we're at it, let's fix access to our running ssh-agent
-;;   (exec-path-from-shell-copy-env "SSH_AGENT_PID")
-;;   (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
+(use-package exec-path-from-shell
+  :defer 1
+  :init
+  (setq exec-path-from-shell-check-startup-files nil)
+  :config
+  (exec-path-from-shell-initialize)
+  ;; while we're at it, let's fix access to our running ssh-agent
+  (exec-path-from-shell-copy-env "SSH_AGENT_PID")
+  (exec-path-from-shell-copy-env "SSH_AUTH_SOCK"))
 #+end_src
 
 ** Server
 #+end_src
 
 ** Server
@@ -313,6 +339,33 @@ See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.htm
   :config (or (server-running-p) (server-mode)))
 #+end_src
 
   :config (or (server-running-p) (server-mode)))
 #+end_src
 
+** Unicode support
+
+Font stack with better unicode support, around =Ubuntu Mono= and
+=Hack=.
+
+#+begin_src emacs-lisp
+(dolist (ft (fontset-list))
+  (set-fontset-font
+   ft
+   'unicode
+   (font-spec :name "Ubuntu Mono"))
+  (set-fontset-font
+   ft
+   'unicode
+   (font-spec
+    :name "Hack")
+   nil
+   'append)
+  (set-fontset-font
+   ft
+   'unicode
+   (font-spec
+    :name "Symbola monospacified for DejaVu Sans Mono")
+   nil
+   'append))
+#+end_src
+
 * Core
 :PROPERTIES:
 :CUSTOM_ID: core
 * Core
 :PROPERTIES:
 :CUSTOM_ID: core
@@ -320,13 +373,34 @@ See [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.htm
 
 ** Defaults
 
 
 ** Defaults
 
+*** Time and battery in mode-line
+
+Enable displaying time and battery in the mode-line, since I'm not
+using the Xfce panel anymore. Also, I don't need to see the load
+average on a regular basis, so disable that.
+
+#+begin_src emacs-lisp
+(use-package time
+  :ensure nil
+  :init
+  (setq display-time-default-load-average nil)
+  :config
+  (display-time-mode))
+
+(use-package battery
+  :ensure nil
+  :config
+  (display-battery-mode))
+#+end_src
+
 *** Smaller fringe
 
 *** Smaller fringe
 
-Set fringe to a small value so we don't have big borders in EXWM, but
-can still see the =diff-hl= colors in the fringe.
+Might want to set the fringe to a smaller value, especially if using
+EXWM. I'm fine with the default for now.
 
 #+begin_src emacs-lisp
 
 #+begin_src emacs-lisp
-(fringe-mode '(3 . 1))
+;; (fringe-mode '(3 . 1))
+(fringe-mode nil)
 #+end_src
 
 *** Disable disabled commands
 #+end_src
 
 *** Disable disabled commands
@@ -461,14 +535,84 @@ Roll your own modal mode
 *** [[https://github.com/ch11ng/exwm][EXWM]] (window manager)
 
 #+begin_src emacs-lisp
 *** [[https://github.com/ch11ng/exwm][EXWM]] (window manager)
 
 #+begin_src emacs-lisp
-;; (use-package exwm
-;;   :config
-;;   (require 'exwm-config)
-;;   (exwm-config-default)
-;;   (require 'exwm-systemtray)
-;;   (exwm-systemtray-enable)
-;;   (require 'exwm-randr)
-;;   (exwm-randr-enable))
+(use-package exwm
+  :demand t
+  :config
+  (require 'exwm-config)
+
+  ;; Set the initial workspace number.
+  (setq exwm-workspace-number 4)
+
+  ;; Make class name the buffer name, truncating beyond 50 characters
+  (defun exwm-rename-buffer ()
+    (interactive)
+    (exwm-workspace-rename-buffer
+     (concat exwm-class-name ":"
+             (if (<= (length exwm-title) 50) exwm-title
+               (concat (substring exwm-title 0 49) "...")))))
+  (add-hook 'exwm-update-class-hook 'exwm-rename-buffer)
+  (add-hook 'exwm-update-title-hook 'exwm-rename-buffer)
+
+  ;; 's-R': Reset
+  (exwm-input-set-key (kbd "s-R") #'exwm-reset)
+  ;; 's-\': Switch workspace
+  (exwm-input-set-key (kbd "s-\\") #'exwm-workspace-switch)
+  ;; 's-N': Switch to certain workspace
+  (dotimes (i 10)
+    (exwm-input-set-key (kbd (format "s-%d" i))
+                        (lambda ()
+                          (interactive)
+                          (exwm-workspace-switch-create i))))
+  ;; 's-SPC': Launch application
+  (exwm-input-set-key
+   (kbd "s-SPC")
+   (lambda (command)
+     (interactive (list (read-shell-command "➜ ")))
+     (start-process-shell-command command nil command)))
+
+  (exwm-input-set-key (kbd "M-s-SPC") #'counsel-linux-app)
+
+  ;; Shorten 'C-c C-q' to 'C-q'
+  (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
+
+  ;; Line-editing shortcuts
+  (setq exwm-input-simulation-keys
+       '(;; movement
+          ([?\C-b] . [left])
+          ([?\M-b] . [C-left])
+          ([?\C-f] . [right])
+          ([?\M-f] . [C-right])
+          ([?\C-p] . [up])
+          ([?\C-n] . [down])
+          ([?\C-a] . [home])
+          ([?\C-e] . [end])
+          ([?\M-v] . [prior])
+          ([?\C-v] . [next])
+          ([?\C-d] . [delete])
+          ([?\C-k] . [S-end delete])
+          ;; cut/paste
+          ([?\C-w] . [?\C-x])
+          ([?\M-w] . [?\C-c])
+          ([?\C-y] . [?\C-v])
+          ;; search
+          ([?\C-s] . [?\C-f])))
+
+  ;; Enable EXWM
+  (exwm-enable)
+
+  (add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame)
+
+  (require 'exwm-systemtray)
+  (exwm-systemtray-enable)
+
+  (require 'exwm-randr)
+  (exwm-randr-enable)
+
+  (exwm-input-set-key
+   (kbd "M-SPC")
+   (lambda ()
+     (interactive)
+     (start-process "rofi-pass" nil "rofi-pass"))))
 #+end_src
 
 *** [[https://orgmode.org/][Org mode]]
 #+end_src
 
 *** [[https://orgmode.org/][Org mode]]
@@ -520,39 +664,40 @@ There's no way I could top that, so I won't attempt to.
 **** Ivy
 
 #+begin_src emacs-lisp
 **** Ivy
 
 #+begin_src emacs-lisp
-;; (use-package ivy
-;;   :bind
-;;   (:map ivy-minibuffer-map
-;;         ([escape] . keyboard-escape-quit)
-;;         ("C-j"    . ivy-next-line)
-;;         ("C-k"    . ivy-previous-line)
-;;         ([S-up]   . ivy-previous-history-element)
-;;         ([S-down] . ivy-next-history-element)
-;;         ("DEL"    . ivy-backward-delete-char))
-;;   :config
-;;   (ivy-mode 1))
+(use-package ivy
+  :bind
+  (:map ivy-minibuffer-map
+        ([escape] . keyboard-escape-quit)
+        ;; ("C-j"    . ivy-next-line)
+        ;; ("C-k"    . ivy-previous-line)
+        ([S-up]   . ivy-previous-history-element)
+        ([S-down] . ivy-next-history-element)
+        ("DEL"    . ivy-backward-delete-char))
+  :config
+  (ivy-mode 1))
 #+end_src
 
 **** Swiper
 
 #+begin_src emacs-lisp
 #+end_src
 
 **** Swiper
 
 #+begin_src emacs-lisp
-;; (use-package swiper
-;;   :bind (([remap isearch-forward]  . swiper)
-;;      ([remap isearch-backward] . swiper)))
+(use-package swiper
+  :bind (([remap isearch-forward]  . swiper)
+        ([remap isearch-backward] . swiper)))
 #+end_src
 
 **** Counsel
 
 #+begin_src emacs-lisp
 #+end_src
 
 **** Counsel
 
 #+begin_src emacs-lisp
-;; (use-package counsel
-;;   :bind (([remap execute-extended-command] . counsel-M-x)
-;;      ([remap find-file] . counsel-find-file)
-;;      ("s-r"     . counsel-recentf)
-;;      :map minibuffer-local-map
-;;      ("C-r" . counsel-minibuffer-history))
-;;   :config
-;;   (counsel-mode 1)
-;;   (defalias 'locate #'counsel-locate))
+(use-package counsel
+  :defer 1.5
+  :bind (([remap execute-extended-command] . counsel-M-x)
+         ([remap find-file] . counsel-find-file)
+         ("s-r"     . counsel-recentf)
+         :map minibuffer-local-map
+        ("C-r" . counsel-minibuffer-history))
+  :config
+  (counsel-mode 1)
+  (defalias 'locate #'counsel-locate))
 #+end_src
 
 * Borg's =layer/essentials=
 #+end_src
 
 * Borg's =layer/essentials=
@@ -636,9 +781,19 @@ TODO: break this giant source block down into individual org sections.
   (setq undo-tree-mode-lighter ""))
 #+end_src
 
   (setq undo-tree-mode-lighter ""))
 #+end_src
 
+* Programming modes
+
+** Lean mode
+
+#+begin_src emacs-lisp
+(use-package lean-mode
+  :bind (:map lean-mode-map
+             ("S-SPC" . company-complete)))
+#+end_src
+
 * Post initialization
 :PROPERTIES:
 * Post initialization
 :PROPERTIES:
-:CUSTOM_ID: post-init
+:CUSTOM_ID: post-initialization
 :END:
 
 Display how long it took to load the init file.
 :END:
 
 Display how long it took to load the init file.