Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun org-babel-block-range ()
- "Return the begin and end points of the current src block"
- ;; based on org-babel-mark-block
- (let ((head (org-babel-where-is-src-block-head)))
- (when head
- (save-excursion
- (goto-char head)
- (looking-at org-babel-src-block-regexp))
- (cons (match-beginning 0) (match-end 0)))))
- (defvar org-babel-evaluation-overlay nil)
- (defvar org-babel-evaluation-timer nil)
- (defun org-babel-remove-overlay ()
- (when org-babel-evaluation-timer
- (cancel-timer org-babel-evaluation-timer)
- (setq org-babel-evaluation-timer nil))
- (when org-babel-evaluation-overlay
- (delete-overlay org-babel-evaluation-overlay)
- (setq org-babel-evaluation-overlay nil)))
- (defadvice org-babel-execute-src-block (around progress nil activate)
- (unless org-babel-current-src-block-location ;; don't handle this yet
- (let ((range (org-babel-block-range)))
- (org-babel-remove-overlay)
- (setq org-babel-evaluation-overlay
- (make-overlay (car range) (cdr range) (current-buffer) nil nil))
- (overlay-put org-babel-evaluation-overlay 'priority 2)
- (overlay-put org-babel-evaluation-overlay 'face
- '(:background "yellow"))
- (redisplay)
- (unwind-protect ad-do-it
- (setq org-babel-evaluation-timer (timer-create))
- (timer-set-function org-babel-evaluation-timer
- 'org-babel-remove-overlay)
- (timer-set-time org-babel-evaluation-timer
- (time-add (current-time) (seconds-to-time 0.1)))
- (timer-activate org-babel-evaluation-timer)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement