Browse Source

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 3 years ago
parent
commit
c41bbc577e
1 changed files with 4 additions and 1 deletions
  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)