   (define-key evil-window-map "t" 'evil-window-right) ; Replaces evil-window-top-left
   (define-key evil-window-map "-" 'evil-window-split) ; Replaces evil-window-set-width
   (define-key evil-window-map "|" 'evil-window-vsplit) ; Replaces evil-window-decrease-height
-  (define-key evil-window-map "x" 'kill-buffer-and-window-ask)
+  (define-key evil-window-map "x" 'my-kill-buffer-and-window-ask)
   (define-key evil-window-map "s" 'ido-switch-buffer)
   (global-set-key (kbd "C-w") 'nil)
 

    (mapcar (lambda (x) (date-to-time (concat wrap-start x wrap-end)))
            (list sunrise-time sunset-time))))

(defun time-greater-p (time1 time2)
  "Return non-nil if TIME1 is later than TIME2."
  (not (or (time-less-p time1 time2) (eq time1 time2))))

(defun location-sunrise-sunset (location)
  "Get the '(SUNRISE SUNSET) times for LOCATION."
  (let ((loc-name (car location))
        (loc-lat (cadr location))
        (loc-lon  (caddr location)))
    (sunrise-sunset-times loc-name loc-lat loc-lon)))

(defun date-in-daylight-hours (date)
  "Return non-nil if DATE is within the daylight hours for the current location.

Default to NIL if daylight times cannot be retrieved."
  (let* ((sunrise-sunset (location-sunrise-sunset location-loc))
         (sunrise-time (car sunrise-sunset))
         (sunset-time (cadr sunrise-sunset))
         (curr-time (or date (current-time))))
    (and sunrise-time sunset-time
         (time-greater-p curr-time sunrise-time) (time-less-p curr-time sunset-time))))

(defun get-background-mode-for-time-of-day (&optional date)
  "Return either 'light or 'dark based on whether DATE (or (current-time)) is during daylight
hours or not."
  (if (date-in-daylight-hours (or date (current-time))) 'light 'dark))

;; Color theme
(let ((bgmode (get-background-mode-for-time-of-day)))
  (set-frame-parameter nil 'background-mode bgmode)
  (set-terminal-parameter nil 'background-mode bgmode))
(load-theme 'solarized t)


(require 'calendar)

(defvar my-location-name "London"
  "Name of major location for use in calendar calculations.")

(defvar my-location-longitude [0 5 west]
  "Longitude of major location.")

(defvar my-location-latitude [51 32 north]
  "Latitude of major location.")

(defvar my-location-loc (list my-location-name my-location-latitude my-location-longitude)
  "Preferred location information in the form '(NAME LATITUDE LONGITUDE).")

(require 'solar)

(defun my-sunrise-sunset-times (loc-name loc-lat loc-lon)
  "Get the sunrise, sunset and hours of daylight in the form (SUNRISE SUNSET HOURS).

LOC-NAME, LOC-LON, and LOC-LAT should be the name, longitude, and latitude of the location for
