I'm trying to configure my .emacs file to work in a Windows, Linux, and Mac environment--specifically, I need it to choose the correct font and a certain directory for org-mode.
I have tried the following which loads the correct font, but does not load the path specified for org-mode:
;; On Windows (if (eq system-type 'windows-nt) (set-default-font "-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1") (setq load-path (cons "~/elisp/org-6.34c/lisp" load-path)) ) ;; On Linux (if (eq system-type 'gnu/linux) (set-default-font "Inconsolata-11") (setq load-path (cons "~/elisp/org-current/lisp" load-path)) )
I have tried the following which on my Windows machine returns the error Font Inconsolata-11 is not defined
, and on my Linux machine returns the error Font -outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1 is not defined
. For both, the specified org path is not loaded:
;; On Windows (if (eq system-type 'windows-nt) (setq load-path (cons "~/elisp/org-6.34c/lisp" load-path)) (set-default-font "-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1") ) ;; On Linux (if (eq system-type 'gnu/linux) (setq load-path (cons "~/elisp/org-current/lisp" load-path)) (set-default-font "Inconsolata-11") )
I evaluated the system-type
variable in both environments, and they both evaluate correctly.
Can anyone see what's wrong--also, I'm not very versed in emacs-lisp, can you see what incorrect assumptions I'm making?
Thank you, Zachary
note that if in lisp is if-then-else. so, in your first case you are doing if windows, set the font, ELSE set the loadpath for windows! then independantly, you are doin if linux setthe font, else set the loadpath for linux!
try
(if (eq system-type 'windows-nt)
(progn
(setq load-path (cons "~/elisp/org-6.34c/lisp" load-path))
(set-default-font "-outline-Consolas-normal-r-normal-normal-14-97-96-96-c-*-iso8859-1")
)
(progn
(setq load-path (cons "~/elisp/org-current/lisp" load-path))
(set-default-font "Inconsolata-11")
)
)
this won't work on mac, or whatever, but if you're only ever using NT or linux, this should work. Otherwise you can stick the other if outside the 2nd progn...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With