Skip to content

Sporadic Catalina Emacs crashes

Hi Vincent:

I am now on Ventura. And with your latest release, Emacs v.29.1 (as of this writing), I am very happy to report no crashes (so far)! For those on Catalina and Big Sur, read on...

I've been having lots of crashes on Catalina (and Big Sur too). After hours of debugging, building emacs and essentially wasting my time. I can't seem to figure out how to fix this or make the crash 100% reproducible. I'm summarizing my resolution here at the top. There are a few comments between Vincent and I below, but there is/was no resolution based on those which I was able to find. However, I have cloned Vincent's setup to the homebrew binaries at https://github.com/railwaycat/homebrew-emacsmacport/releases Homebrew has some nice features that emacsformacosx does not and vice versa. The main advantage being able to Save Option the font you have selected (which I have been craving for many years). The main disadvantage is the Apple Command Key Human Interface Guidelines keypresses don't work, but that is fixable: see below (updated for emacs 27/28). Haven't had a crash since I switched to the homebrew binary even though I don't use homebrew: I'm just using the binary that I got from the URL above. Vincent, do you have any interest in switching this project to homebrew binaries? I realize this is a major change, but perhaps others are having issues as well.

(defun open-directory ()
  "*Open directory."
  (interactive)
  (call-process "open" nil nil nil
		(read-string "Open directory:" default-directory))
)
(defun clipboard-kill-region-if-active (&optional BEG END) 
"*Cut: workaround for bug/feature."
  (interactive)
  (if (use-region-p) (clipboard-kill-region (region-beginning) (region-end))))

(setq mac-command-modifier 'alt)
(setq mac-option-modifier 'meta)

; Mac command keys using alt modifier
(define-key key-translation-map [(alt ?x)] nil) ;; needed for emacs 27/28
(global-set-key [(alt x)] 'clipboard-kill-region-if-active)  ; cut
(define-key key-translation-map [(alt ?c)] nil)
(global-set-key [(alt c)] 'clipboard-kill-ring-save)         ; copy
(define-key key-translation-map [(alt ?v)] nil)
(global-set-key [(alt v)] 'clipboard-yank)                   ; paste
(define-key key-translation-map [(alt ?a)] nil)
(global-set-key [(alt a)] 'mark-whole-buffer)                ; all
(define-key key-translation-map [(alt ?k)] nil)
(global-set-key [(alt k)] 'kill-this-buffer)                 ; kill
(define-key key-translation-map [(alt ?o)] nil)
(global-set-key [(alt o)] 'open-directory)                   ; open
(define-key key-translation-map [(alt ?q)] nil)
(global-set-key [(alt q)] 'save-buffers-kill-terminal)       ; quit
(define-key key-translation-map [(alt ?s)] nil)
(global-set-key [(alt s)] 'save-buffer)                      ; save

Rodney

Edited by Rodney Sparapani