Presently, I'm testing for windows like this in my startup for Emacs v23.1.1:
(if (eq system-type 'windows-nt) (load-library "visual-basic-mode"))
However, this is true for both Windows 7 and Windows XP and I do not have visual-basic-mode
on my windows XP machine.
Is there a way to add a condition to detect that it is XP and not load the file? Alternatively, can I pass arguments to load-library so that it is not an error if not found?
Update: I tried adding t
as the second argument to load-library
and get this error:
byte-code: Wrong number of arguments:
#[(library) "Á!" [library load] 2 729706
(list (completing-read "Load library: "
(apply-partially (quote locate-file-completion-table)
load-path (get-load-suffixes))))], 2
Update: Trying to use the system version does not eval:
Debugger entered--Lisp error: (void-function pcase)
(pcase (and (eq system-type ...) (w32-version))
(\` (5 0 \,_) (quote windows-2k))
(\` (5 \, ... \,_) (quote windows-xp))
(\` (6 0 \,_) (quote windows-vista))
(\` (6 1 \,_) (load-library "visual-basic-mode") (quote windows-7))
(\` (6 2 \,_) (quote windows-8))
(\` (6 3 \,_) (quote windows-8\.1)))
eval-region(42066 42335 t (lambda (ignore) (goto-char 42335)
(quote (pcase ... ... ... ... ... ...
...)))) ; Reading at buffer position 42223
apply(eval-region (42066 42335 t (lambda (ignore) (goto-char 42335) (quote ...))))
eval-defun-2()
eval-defun(nil)
call-interactively(eval-defun t nil)
execute-extended-command(nil)
call-interactively(execute-extended-command nil nil)
recursive-edit()
byte-code("Æ @Ç=!
Nor compile:
Error: Wrong number of arguments: #[(structure) "\301!A\207"
[structure backquote-process] 2 1716431], 2
I note that the value of (w32-version) on Windows XP for me is: (5 1 2600)
load
instead ofload-library
.load-library
is only intended for interactive use.