(= 0 (length locale))) ; nil or empty string
(setq locale (getenv (pop vars))))))
- (unless (or locale (not (fboundp 'mac-get-preference)))
- (setq locale (mac-get-preference "AppleLocale"))
- (unless locale
- (let ((languages (mac-get-preference "AppleLanguages")))
- (unless (= (length languages) 0) ; nil or empty vector
- (setq locale (aref languages 0))))))
+ (unless locale
+ ;; The two tests are kept separate so the byte-compiler sees
+ ;; that mac-get-preference is only called after checking its existence.
+ (when (fboundp 'mac-get-preference)
+ (setq locale (mac-get-preference "AppleLocale"))
+ (unless locale
+ (let ((languages (mac-get-preference "AppleLanguages")))
+ (unless (= (length languages) 0) ; nil or empty vector
+ (setq locale (aref languages 0)))))))
(unless (or locale (not (boundp 'mac-system-locale)))
(setq locale mac-system-locale))