imp.el
imp.el copied to clipboard
example of major-mode senstivity, i.e. org-mode support
Don't know if this is useful, but it made me happy.
(defun imp-htmlize-filter (buffer)
"Alternate htmlization of BUFFER before sending to clients."
(let ((m (with-current-buffer buffer major-mode)))
(case m
(org-mode
(let ((output (current-buffer)))
(with-current-buffer buffer
(org-export-as-html 100 nil output))))
(t
(let ((html-buffer (save-match-data (htmlize-buffer buffer))))
(insert-buffer-substring html-buffer)
(kill-buffer html-buffer))))))
Other approaches would probably be better though.
Fun hack, thanks!
I modified the mode definition so that it also updates clients when visibility in org-mode is cycled:
;;;###autoload
(define-minor-mode impatient-mode
"Serves the buffer live over HTTP."
:group 'impatient-mode
:lighter " imp"
:keymap impatient-mode-map
(if (not impatient-mode)
(progn
(remove-hook 'after-change-functions 'imp--on-change t)
(when (eq major-mode 'org-mode)
(remove-hook 'org-cycle-hook 'imp--on-change t)))
(add-hook 'after-change-functions 'imp--on-change nil t)
(when (eq major-mode 'org-mode)
(add-hook 'org-cycle-hook 'imp--on-change t t))
(imp-remove-user-filter)))
Sorry for dragging up an old issue, but not sure how to get this to work?
I added @bhyde's code to my startup, and enabled impatient-mode
on a .org
file but all I get displayed is "Loading Content" which from what I can ascertain is /imp/static/loading.html
@bhyde are you still using this setup with org-mode?
OK seems org-export-as-html
needs to be changed to org-html-export-as-html
. Unfortunately now getting a Process 'org-export-process' exited abnormally
error in *Messages*
and no output.
Hello, this is still basically the case. I would love to use this.