瀏覽代碼

Fix "Wrong type argument: overlayp"

* lisp/org-src.el (org-src-mode-configure-edit-buffer): Fix "Wrong
  type argument: overlayp".

Changing major mode in a source edit buffer resets local variables
used to link it to source buffer.  As a consequence, overlay in source
buffer can no longer be found nor deleted.
Nicolas Goaziou 10 年之前
父節點
當前提交
c41bbc577e
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lisp/org-src.el

+ 4 - 1
lisp/org-src.el

@@ -816,7 +816,10 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"."
 (defun org-src-mode-configure-edit-buffer ()
   (when (org-bound-and-true-p org-edit-src-from-org-mode)
     (org-add-hook 'kill-buffer-hook
-		  #'(lambda () (delete-overlay org-edit-src-overlay)) nil 'local)
+		  (lambda ()
+		    (when (overlayp org-edit-src-overlay)
+		      (delete-overlay org-edit-src-overlay)))
+		  nil 'local)
     (if (org-bound-and-true-p org-edit-src-allow-write-back-p)
 	(progn
 	  (setq buffer-offer-save t)