Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2017-08-21 11:31:29 +02:00
commit e40d2df680
1 changed files with 13 additions and 11 deletions

View File

@ -424,11 +424,10 @@ Assume point is in the corresponding edit buffer."
(buffer-string)))) (buffer-string))))
(defun org-src--edit-element (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. "Edit DATUM contents in a dedicated buffer NAME.
MAJOR is the major mode used in the edit buffer. A nil value is INITIALIZE is a function to call upon creating the buffer.
equivalent to `fundamental-mode'.
When WRITE-BACK is non-nil, assume contents will replace original When WRITE-BACK is non-nil, assume contents will replace original
region. Moreover, if it is a function, apply it in the edit 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)) (unless preserve-ind (org-do-remove-indentation))
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(setq buffer-file-name nil) (setq buffer-file-name nil)
;; Start major mode. ;; Initialize buffer.
(if (not major) (fundamental-mode) (when (functionp initialize)
(let ((org-inhibit-startup t)) (let ((org-inhibit-startup t))
(condition-case e (funcall major) (condition-case e
(error (message "Language mode `%s' fails with: %S" (funcall initialize)
major (nth 1 e)))))) (error (message "Initialization fails with: %S"
(error-message-string e))))))
;; Transmit buffer-local variables for exit function. It must ;; Transmit buffer-local variables for exit function. It must
;; be done after initializing major mode, as this operation ;; be done after initializing major mode, as this operation
;; may reset them otherwise. ;; 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 (org-src--edit-element
definition definition
(format "*Edit footnote [%s]*" label) (format "*Edit footnote [%s]*" label)
#'org-mode (let ((source (current-buffer)))
(lambda ()
(org-mode)
(org-clone-local-variables source)))
(lambda () (lambda ()
(if (not inline?) (delete-region (point) (search-forward "]")) (if (not inline?) (delete-region (point) (search-forward "]"))
(delete-region (point) (search-forward ":" nil t 2)) (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)) (when (org-element-lineage definition '(table-cell))
(while (search-forward "\n" nil t) (replace-match ""))))) (while (search-forward "\n" nil t) (replace-match "")))))
contents contents
'remote) 'remote))
(org-clone-local-variables (org-src--source-buffer)))
;; Report success. ;; Report success.
t)) t))