branch: master
commit 6a3619b4f2e7c4e591cbfbc60c8bcb05447fe291
Author: Noam Postavsky <[email protected]>
Commit: Noam Postavsky <[email protected]>
Fix additional corner case with org source block integration
* yasnippet.el (yas--on-buffer-kill): Check if the org-marker still points
to a buffer.
---
yasnippet.el | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/yasnippet.el b/yasnippet.el
index 656fd2c..dbb9b4d 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -3519,17 +3519,21 @@ This renders the snippet as ordinary text."
;; Org mode uses temp buffers for fontification and "native tab",
;; move all the snippets to the original org-mode buffer when it's
;; killed.
- (let ((org-marker nil))
+ (let ((org-marker nil)
+ (org-buffer nil))
(when (and yas-minor-mode
(or (bound-and-true-p org-edit-src-from-org-mode)
(bound-and-true-p org-src--from-org-mode))
(markerp
(setq org-marker
(or (bound-and-true-p org-edit-src-beg-marker)
- (bound-and-true-p org-src--beg-marker)))))
+ (bound-and-true-p org-src--beg-marker))))
+ ;; If the org source buffer is killed before the temp
+ ;; fontification one, org-marker might point nowhere.
+ (setq org-buffer (marker-buffer org-marker)))
(yas--prepare-snippets-for-move
(point-min) (point-max)
- (marker-buffer org-marker) org-marker))))
+ org-buffer org-marker))))
(add-hook 'kill-buffer-hook #'yas--on-buffer-kill)