• Setting Up TypeScript and Eslint With Eglot

    Using TypeScript with eglot in Emacs is fiddly to set up. I also prefer using eslint as a plugin to typescript-language-server so no other setup is required. Together, this makes for an extremely portable setup with minimal fuss which is the whole point of the language server protocol to begin with.

    Install the typescript-language-server:

    npm install -g typescript-language-server
    

    Install the eslint plugin for typescript-language-server:

    npm install typescript-eslint-language-service -D
    

    Add the plugin to your config’s compilerOptions:

    {...
      "compilerOptions": {
         "plugins": [{
          "name": "typescript-eslint-language-service"
        }]
        ...
      }
     }
    

    In init.el, tell eglot how to locate your tsconfig.json (otherwise your TypeScript project configuration won’t be picked up and eslint won’t work):

    ;; I'm not sure why this is needed, but it throws an error if I remove it
    (cl-defmethod project-root ((project (head eglot-project)))
      (cdr project))
    
    (defun my-project-try-tsconfig-json (dir)
      (when-let* ((found (locate-dominating-file dir "tsconfig.json")))
        (cons 'eglot-project found)))
    
    (add-hook 'project-find-functions
              'my-project-try-tsconfig-json nil nil)
    
    (add-to-list 'eglot-server-programs
                 '((typescript-mode) "typescript-language-server" "--stdio"))
    

    See also:


  • Lockfiles Let You Deal With Breaking Changes on Your Own Terms

    Most package managers have some form of a lockfile which freezes the exact version of a installed libraries. This makes building the environment again reproducible (with some big caveats around system libraries) so you won’t suddenly encounter a breaking change from an upstream library or dependence changing from yesterday to today. Lockfiles don’t fix the problem of breaking changes, but it allows you to choose when you have to deal with it (at upgrade time).


  • Hapax Legomenon

    A hapax logomenon (“being said once” in Greek) is a word that only appears once in the written record of a language, author, or single text. This makes it difficult to determine it’s meaning and must be derived from context.

    Examples include “epiousios” which appears in The Lord’s Prayer and has come to mean “daily”, but is not known for sure.


  • Emacs Natural Title Bar With No Text in MacOS

    To make emacs more modern looking in v26, you can enable a “natural title bar” (the color of title bar matches the color of the buffer).

    Compile emacs with the right flags (using railwaycat/homebrew-emacsmacport):

    brew install emacs-mac --with-natural-title-bar
    

    Add the settings to your init.el:

    (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
    (add-to-list 'default-frame-alist '(ns-appearance . dark))
    (setq ns-use-proxy-icon nil)
    (setq frame-title-format nil)
    

    Hide the document icon:

    defaults write org.gnu.Emacs HideDocumentIcon YES
    

    Restart and enjoy a modern looking emacs.