Created
November 7, 2010 15:59
-
-
Save valpackett/666202 to your computer and use it in GitHub Desktop.
Refreshing Safari from Emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Refreshing Safari on save, Mac only | |
;; Don't forget to enable assistive devices access | |
;; in System Preferences -> Universal Access | |
(if (featurep 'aquamacs) | |
(add-hook 'after-save-hook | |
'(lambda () | |
(when (string-match "\.html$" (buffer-name)) | |
(do-applescript (concat "tell application \"Safari\" | |
if \"file://" buffer-file-name "\" = URL of document 1 then | |
activate | |
tell application \"System Events\" | |
tell process \"Safari\" | |
keystroke \"r\" using {command down} | |
end tell | |
end tell | |
end if | |
end tell")))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment