Skip to content
timfelPublic

About

No description or website provided.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Latest commit

 

History

1,317 Commits

Folders and files

Repository files navigation

My Emacs config

This repository has been around for a long time, and pretty much any change I make I commit and push. I use Emacs on Windows, Linux, and Android, sometimes on macOS, too. So that’s where those different settings come from.

This document will be outdated soon, but let’s write something down for now.

In general, I try to stick to built-in features if I can. I have replaced lsp-mode with eglot as the latter matured, I have started using use-package, icomplete, xref, speedbar over el-get, ido, hydra, treemacs … over the years as it evolves. I am not religious about it, I just like sharing config over different platforms and sticking to built-in things makes that easier.

I am not religious about vanilla Emacs though, and there are some things I’m still holding out on. term has gotten very good in Emacs 31, even TUIs such btm work, but it’s still not great on Windows, so I stick to ghostel for now. vc is getting better, but it has nothing on magit for me. And company-mode is only barely better for me these days than vertical icomplete an in-buffer completions, but the integration with eglot documentation still makes it win out for me… So there.

Initial Setup

On most platforms, I set everything up using mise and starting from my dotfiles, but that doesn’t work on Android.

So on Android, I install Nextcloud, Unexpected Keyboard, and Emacs and Termux.

First, I open Termux once, then close it.

Then I open Emacs, go to a scratch buffer, paste and eval this:

(progn
  (unless (file-expand-wildcards "/sdcard/Download/")
    (x-popup-dialog t '("Allow storage access" ("Ok" . t)))
    (android-request-storage-access))
  (unless (file-expand-wildcards "/content/storage/com.termux.documents/")
    (x-popup-dialog t '("Choose the top-level Termux folder" ("Ok" . t)))
    (android-request-directory-access))
  (unless (file-expand-wildcards "/content/storage/org.nextcloud.documents/")
    (x-popup-dialog t '("Choose the top-level Nextcloud folder" ("Ok" . t)))
    (android-request-directory-access))
  (let ((termuxpath "/data/data/com.termux/files/usr/bin"))
    (setenv "PATH" (concat (getenv "PATH") ":"  termuxpath))
    (add-to-list 'exec-path termuxpath t))
  (when (executable-find "pkg")
    (shell-command "pkg update -yy")
    (shell-command "pkg upgrade -yy")
    (shell-command "pkg install -yy git gh mise")
    (shell-command "git clone https://github.com/timfel/dotfiles ~/dotfiles")
    (shell-command "mise trust ~/dotfiles")
    (shell-command "mise bootstrap apply --cd ~/dotfiles --force --yes")
    (delete-directory "~/.emacs.d" t)
    (shell-command "git clone https://github.com/timfel/.emacs.d ~/.emacs.d")
    ;; Android's sfnt font driver only scans TrueType files in ~/fonts,
    ;; before it reads the init file.  Keep the managed copies in
    ;; ~/.emacs.d/fonts and expose that directory through ~/fonts.
    (require 'url)
    (let ((font-directory (expand-file-name "~/.emacs.d/fonts/"))
          (fonts '(("NotoSansMono-Regular.ttf"
                    . "https://fonts.gstatic.com/s/notosansmono/v37/BngrUXNETWXI6LwhGYvaxZikqZqK6fBq6kPvUce2oAZcdthSBUsYck4-_FNJ49o.ttf")
                   ("NotoEmoji-Regular.ttf"
                    . "https://fonts.gstatic.com/s/notoemoji/v64/bMrnmSyK7YY-MEu6aWjPDs-ar6uWaGWuob-r0jwv.ttf")
                   ("NotoSansSymbols2-Regular.ttf"
                    . "https://fonts.gstatic.com/s/notosanssymbols2/v25/I_uyMoGduATTei9eI8daxVHDyfisHr71ypM.ttf"))))
      (make-directory font-directory t)
      (dolist (font fonts)
        (let ((destination (expand-file-name (car font) font-directory)))
          (unless (file-exists-p destination)
            (let ((temporary (make-temp-file "emacs-font-" nil ".ttf")))
              (unwind-protect
                  (progn
                    (url-copy-file (cdr font) temporary t)
                    (rename-file temporary destination t))
                (when (file-exists-p temporary)
                  (delete-file temporary)))))))
      (let ((android-font-directory (expand-file-name "~/fonts")))
        (unless (file-exists-p android-font-directory)
          (make-symbolic-link font-directory android-font-directory))))
    (kill-emacs)))

Then start again.

About

No description or website provided.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Contributors

Languages