mirror of
https://github.com/joaotavora/yasnippet.git
synced 2025-10-13 13:13:03 +00:00
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.
This commit is contained in:
parent
048d030b68
commit
6a3619b4f2
10
yasnippet.el
10
yasnippet.el
@ -3519,17 +3519,21 @@ This renders the snippet as ordinary text."
|
|||||||
;; Org mode uses temp buffers for fontification and "native tab",
|
;; Org mode uses temp buffers for fontification and "native tab",
|
||||||
;; move all the snippets to the original org-mode buffer when it's
|
;; move all the snippets to the original org-mode buffer when it's
|
||||||
;; killed.
|
;; killed.
|
||||||
(let ((org-marker nil))
|
(let ((org-marker nil)
|
||||||
|
(org-buffer nil))
|
||||||
(when (and yas-minor-mode
|
(when (and yas-minor-mode
|
||||||
(or (bound-and-true-p org-edit-src-from-org-mode)
|
(or (bound-and-true-p org-edit-src-from-org-mode)
|
||||||
(bound-and-true-p org-src--from-org-mode))
|
(bound-and-true-p org-src--from-org-mode))
|
||||||
(markerp
|
(markerp
|
||||||
(setq org-marker
|
(setq org-marker
|
||||||
(or (bound-and-true-p org-edit-src-beg-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
|
(yas--prepare-snippets-for-move
|
||||||
(point-min) (point-max)
|
(point-min) (point-max)
|
||||||
(marker-buffer org-marker) org-marker))))
|
org-buffer org-marker))))
|
||||||
|
|
||||||
(add-hook 'kill-buffer-hook #'yas--on-buffer-kill)
|
(add-hook 'kill-buffer-hook #'yas--on-buffer-kill)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user