public
Created — forked from nonsequitur/moz-reload-mode.el

  • Download Gist
moz-reload-mode.el
Emacs Lisp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
(require 'moz)
 
;;; Usage
;; Run M-x moz-reload-mode to switch moz-reload on/off in the
;; current buffer.
;; When active, every change in the buffer triggers Firefox
;; to reload its current page.
 
(define-minor-mode moz-reload-mode
"Moz Reload Minor Mode"
nil " Reload" nil
(if moz-reload-mode
;; Edit hook buffer-locally.
(add-hook 'post-command-hook 'moz-reload nil t)
(remove-hook 'post-command-hook 'moz-reload t)))
 
(defun moz-reload ()
(when (buffer-modified-p)
(save-buffer)
(moz-firefox-reload)))
 
(defun moz-firefox-reload ()
(comint-send-string (inferior-moz-process) "BrowserReload();"))

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.