Emacs: Open in TextEdit 🚀

By Xah Lee. Date: . Last updated: .

Here's a command to open current file in TextEdit. This is Mac only.

This is great for spell checking. Just open it in TextEdit, and you get all misspelled words highlighted automatically. In emacs, it's 10 times slower and doesn't work well.

put this in your Emacs Init File:

(defun xah-dired-open-in-textedit ()
  "Open the current file or `dired' marked files in Mac's TextEdit.
This command is for macOS only.

URL `http://xahlee.info/emacs/emacs/emacs_open_in_textedit.html'
Version: 2017-11-21 2021-02-07 2023-06-26"
  (interactive)
  (when (not (eq system-type 'darwin)) (user-error "Error: textedit only run in Mac"))
  (let* (
         (xFList (if (eq major-mode 'dired-mode) (dired-get-marked-files) (list buffer-file-name)))
         (xDoIt (if (<= (length xFList) 10) t (y-or-n-p "Open more than 10 files? "))))
    (when xDoIt
      (mapc (lambda (x) (shell-command (format "open -a TextEdit.app \"%s\"" x))) xFList))))

Emacs, Command to Open File in External Apps