Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Melpa Status Melpa Stable Status Support me

osx-location.el

This library uses OS X CoreLocation services to put useful information into variables osx-location-latitude and osx-location-longitude.

Installation

If you choose not to use one of the convenient packages in MELPA, you'll need to add the directory containing osx-location.el and EmacsLocationHelper to your load-path, and then (require 'osx-location).

If you don't trust the required bundled executable (EmacsLocationHelper) which does the communication with CoreServices, you can build it yourself from the instructions here or using the bundled Makefile.

Usage

Start monitoring the location asynchronously like this:

 M-x osx-location-watch

To add code which responds to location changes, use osx-location-changed-hook. For example, you might add a hook function which updates calendar-latitude and calendar-longitude (defined in the built-in library solar), and then use rase.el to execute code automatically at sunrise or sunset.

Hook functions take no arguments; when your hook function runs, it can use the freshly-updated values of osx-location-latitude and osx-location-longitude.

Here's an example:

(eval-after-load 'osx-location
  '(when (eq system-type 'darwin)
     (add-hook 'osx-location-changed-hook
               (lambda ()
                 (setq calendar-latitude osx-location-latitude
                       calendar-longitude osx-location-longitude
                       calendar-location-name (format "%s, %s" osx-location-latitude osx-location-longitude))))))

Steve Purcell's blog // @sanityinc on Twitter

About

Make Emacs watch and respond to changes in geographical location on OS X

Resources

Sponsor this project

Packages

No packages published