diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-08-21 11:27:41 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-08-21 11:27:41 +0200 |
commit | 4df137420d8201ab540e573738e2663effcc62b8 (patch) | |
tree | 7b5fe779a3128be94531897e6ad8e6620ac5ef42 | |
parent | 251f88340acf586c761513e9e53a9e778d6b2dc7 (diff) | |
download | org-mode-4df137420d8201ab540e573738e2663effcc62b8.tar.gz |
org-src: Fix remote footnote edition
* lisp/org-src.el (org-src--edit-element): Ensure read-only overlay in
source buffer is properly removed upon exiting the remote editing
buffer.
-rw-r--r-- | lisp/org-src.el | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el index 6b5b5ff..9a3ff53 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -424,11 +424,10 @@ Assume point is in the corresponding edit buffer." (buffer-string)))) (defun org-src--edit-element - (datum name &optional major write-back contents remote) + (datum name &optional initialize write-back contents remote) "Edit DATUM contents in a dedicated buffer NAME. -MAJOR is the major mode used in the edit buffer. A nil value is -equivalent to `fundamental-mode'. +INITIALIZE is a function to call upon creating the buffer. When WRITE-BACK is non-nil, assume contents will replace original region. Moreover, if it is a function, apply it in the edit @@ -489,12 +488,13 @@ Leave point in edit buffer." (unless preserve-ind (org-do-remove-indentation)) (set-buffer-modified-p nil) (setq buffer-file-name nil) - ;; Start major mode. - (if (not major) (fundamental-mode) + ;; Initialize buffer. + (when (functionp initialize) (let ((org-inhibit-startup t)) - (condition-case e (funcall major) - (error (message "Language mode `%s' fails with: %S" - major (nth 1 e)))))) + (condition-case e + (funcall initialize) + (error (message "Initialization fails with: %S" + (error-message-string e)))))) ;; Transmit buffer-local variables for exit function. It must ;; be done after initializing major mode, as this operation ;; may reset them otherwise. @@ -837,7 +837,10 @@ A coderef format regexp can only match at the end of a line." (org-src--edit-element definition (format "*Edit footnote [%s]*" label) - #'org-mode + (let ((source (current-buffer))) + (lambda () + (org-mode) + (org-clone-local-variables source))) (lambda () (if (not inline?) (delete-region (point) (search-forward "]")) (delete-region (point) (search-forward ":" nil t 2)) @@ -850,8 +853,7 @@ A coderef format regexp can only match at the end of a line." (when (org-element-lineage definition '(table-cell)) (while (search-forward "\n" nil t) (replace-match ""))))) contents - 'remote) - (org-clone-local-variables (org-src--source-buffer))) + 'remote)) ;; Report success. t)) |