Checkout from .macs script

I use two emacs (Aquamcs and text emacs) on my Mac. I usually use text emacs to edit something, so I don’t want to download anything with it.

What I came up with is to check the code in .emacs to exit / break if it is based on emacs text (darwin system but not aquamacs).

 (when (and (equal system-type 'darwin) (not (boundp 'aquamacs-version)))
     (exit) ??? (break) ????
 )

It seems to work, but I don't know how to break out of .emacs. How to do it?

ADDED

I just wanted to speed up the loading of text emacs on my mac, and I thought about breaking out as a solution. Based on helpful answers, I came up with the following code that runs .emacs only when it is not based on emacs text.

(setq inhibit-splash-screen t)
(unless (null window-system)
+3
source share
3 answers

I do not know how to do what you want. Some workarounds:

  • .emacs, (error "message"), .

  • .emac, (unless (CONDITION) ...) .

  • emacs -Q FILE, .

? , .emacs? , / Emacs.

+4

, , ..... , .

, , ~/.emacs( ~/.emacs.d/init.el) , ~/.emacs.d/aquamacs.el ~/.emacs.d/textmode.el .

That would make your init having something like this :
(defun my-short-hostname() 
  (string-match "[0-9A-Za-z]+" system-name)
  (substring system-name (match-beginning 0) (match-end 0))
  )

;Load different config file in text mode or gui mode.
(if (null window-system)
    (load-file "~/.emacs.d/texmode-emacs.el")
  (load-file "~/.emacs.d/gui.el"))

;Load configuration for this host only, ie ~/.emacs.d/myhostname.el if exist
(if (file-exists-p 
     (downcase (concat "~/.emacs.d/" (my-short-hostname) ".el")))
    (load-file (downcase "~/.emacs.d/" (my-short-hostname) ".el"))))
+4

I suggest having specific, different files for conditional download from .emacs, one for one installation, another for another setting.

Alternatively, simply wrap the code for each installation in prognand fulfill the condition in place in .emacs.

0
source

Source: https://habr.com/ru/post/1784179/


All Articles