Skip to content

purcell/osx-location

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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))))))

💝 Support this project and my other Open Source work

💼 LinkedIn profile

✍ sanityinc.com

About

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

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors