2020-02-19 23:07:30 +00:00
|
|
|
;;; funcs.el --- geolocation functions File for Spacemacs
|
2017-06-13 08:45:05 +00:00
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2017-06-13 08:45:05 +00:00
|
|
|
;;
|
|
|
|
;; Author: Eivind Fonn <evfonn@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2017-06-13 08:45:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs//osx-location-changed ()
|
|
|
|
(let ((location-changed-p nil)
|
|
|
|
(_longitude (/ (truncate (* osx-location-longitude 10)) 10.0)) ; one decimal point, no rounding
|
|
|
|
(_latitdue (/ (truncate (* osx-location-latitude 10)) 10.0)))
|
|
|
|
(unless (equal (bound-and-true-p calendar-longitude) _longitude)
|
|
|
|
(setq calendar-longitude _longitude
|
|
|
|
location-changed-p t))
|
|
|
|
(unless (equal (bound-and-true-p calendar-latitude) _latitdue)
|
|
|
|
(setq calendar-latitude _latitdue
|
|
|
|
location-changed-p t))
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (and (configuration-layer/layer-used-p 'geolocation) location-changed-p)
|
2017-06-13 08:45:05 +00:00
|
|
|
(message "Location changed %s %s (restarting rase-timer)" calendar-latitude calendar-longitude)
|
|
|
|
(rase-start t))))
|
|
|
|
|
|
|
|
(defun spacemacs//osx-location-changed-rase ()
|
|
|
|
(setq calendar-latitude osx-location-latitude
|
|
|
|
calendar-longitude osx-location-longitude)
|
|
|
|
(unless (bound-and-true-p calendar-location-name)
|
|
|
|
(setq calendar-location-name
|
|
|
|
(format "%s, %s"
|
|
|
|
osx-location-latitude
|
|
|
|
osx-location-longitude))))
|
|
|
|
|
|
|
|
(defun geolocation//activate-theme-changer ()
|
2017-07-30 13:02:06 +00:00
|
|
|
(unless (bound-and-true-p calendar-longitude)
|
|
|
|
(user-error "calendar-longitude is not set"))
|
|
|
|
(unless (bound-and-true-p calendar-latitude)
|
|
|
|
(user-error "calendar-latitude is not set"))
|
2017-06-13 08:45:05 +00:00
|
|
|
(when (> (length dotspacemacs-themes) 1)
|
|
|
|
(change-theme (nth 0 dotspacemacs-themes)
|
|
|
|
(nth 1 dotspacemacs-themes))))
|