New variable org-src-ask-before-returning-to-edit-buffer
[rgr-org-mode.git] / lisp / org-src.el
blob685a311ff96eb3411fad033961d81ee6e1545de0
1 ;;; org-src.el --- Source code examples in Org
2 ;;
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
4 ;; Free Software Foundation, Inc.
5 ;;
6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Bastien Guerry <bzg AT altern DOT org>
8 ;; Keywords: outlines, hypermedia, calendar, wp
9 ;; Homepage: http://orgmode.org
10 ;; Version: 6.31trans
12 ;; This file is part of GNU Emacs.
14 ;; GNU Emacs is free software: you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation, either version 3 of the License, or
17 ;; (at your option) any later version.
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;; Commentary:
30 ;; This file contains the code dealing with source code examples in Org-mode.
32 ;;; Code:
34 (require 'org-macs)
35 (require 'org-compat)
37 (declare-function org-do-remove-indentation "org" (&optional n))
38 (declare-function org-get-indentation "org" (&optional line))
40 (defcustom org-edit-src-region-extra nil
41 "Additional regexps to identify regions for editing with `org-edit-src-code'.
42 For examples see the function `org-edit-src-find-region-and-lang'.
43 The regular expression identifying the begin marker should end with a newline,
44 and the regexp marking the end line should start with a newline, to make sure
45 there are kept outside the narrowed region."
46 :group 'org-edit-structure
47 :type '(repeat
48 (list
49 (regexp :tag "begin regexp")
50 (regexp :tag "end regexp")
51 (choice :tag "language"
52 (string :tag "specify")
53 (integer :tag "from match group")
54 (const :tag "from `lang' element")
55 (const :tag "from `style' element")))))
57 (defcustom org-coderef-label-format "(ref:%s)"
58 "The default coderef format.
59 This format string will be used to search for coderef labels in literal
60 examples (EXAMPLE and SRC blocks). The format can be overwritten in
61 an individual literal example with the -f option, like
63 #+BEGIN_SRC pascal +n -r -l \"((%s))\"
64 ...
65 #+END_SRC
67 If you want to use this for HTML export, make sure that the format does
68 not introduce special font-locking, and avoid the HTML special
69 characters `<', `>', and `&'. The reason for this restriction is that
70 the labels are searched for only after htmlize has done its job."
71 :group 'org-edit-structure ; FIXME this is not in the right group
72 :type 'string)
74 (defcustom org-edit-fixed-width-region-mode 'artist-mode
75 "The mode that should be used to edit fixed-width regions.
76 These are the regions where each line starts with a colon."
77 :group 'org-edit-structure
78 :type '(choice
79 (const artist-mode)
80 (const picture-mode)
81 (const fundamental-mode)
82 (function :tag "Other (specify)")))
84 (defcustom org-src-preserve-indentation nil
85 "If non-nil, leading whitespace characters in source code
86 blocks are preserved. Otherwise, after editing with
87 \\[org-edit-src-code], the minimum (across-lines) number of
88 leading whitespace characters are removed from all lines, and
89 the code block is then uniformly indented according to the
90 value of `org-edit-src-content-indentation'."
91 :group 'org-edit-structure
92 :type 'boolean)
94 (defcustom org-edit-src-content-indentation 2
95 "Indentation for the content of a source code block.
96 This should be the number of spaces added to the indentation of the #+begin
97 line in order to compute the indentation of the block content after
98 editing it with \\[org-edit-src-code]. Has no effect if
99 `org-src-preserve-indentation' is non-nil."
100 :group 'org-edit-structure
101 :type 'integer)
103 (defcustom org-edit-src-persistent-message t
104 "Non-nil means show persistent exit help message while editing src examples.
105 The message is shown in the header-line, which will be created in the
106 first line of the window showing the editing buffer.
107 When nil, the message will only be shown intermittently in the echo area."
108 :group 'org-edit-structure
109 :type 'boolean)
112 (defvar org-src-mode-hook nil
113 "Hook run after Org switched a source code snippet to its Emacs mode.
114 This hook will run
116 - when editing a source code snippet with \"C-c '\".
117 - When formatting a source code snippet for export with htmlize.
119 You may want to use this hook for example to turn off `outline-minor-mode'
120 or similar things which you want to have when editing a source code file,
121 but which mess up the display of a snippet in Org exported files.")
123 (defcustom org-src-lang-modes
124 '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
125 ("asymptote" . asy))
126 "Alist mapping languages to their major mode.
127 The key is the language name, the value is the string that should
128 be inserted as the name of the major mode. For many languages this is
129 simple, but for language where this is not the case, this variable
130 provides a way to simplify things on the user side.
131 For example, there is no ocaml-mode in Emacs, but the mode to use is
132 `tuareg-mode'."
133 :group 'org-edit-structure
134 :type '(repeat
135 (cons
136 (string "Language name")
137 (symbol "Major mode"))))
139 ;;; Editing source examples
141 (defvar org-src-mode-map (make-sparse-keymap))
142 (define-key org-src-mode-map "\C-c'" 'org-edit-src-exit)
143 (defvar org-edit-src-force-single-line nil)
144 (defvar org-edit-src-from-org-mode nil)
145 (defvar org-edit-src-picture nil)
146 (defvar org-edit-src-beg-marker nil)
147 (defvar org-edit-src-end-marker nil)
148 (defvar org-edit-src-overlay nil)
149 (defvar org-edit-src-block-indentation nil)
151 (defvar org-src-ask-before-returning-to-edit-buffer t
152 "If nil, when org-edit-src code is used on a block that already
153 has an active edit buffer, it will switch to that edit buffer
154 immediately; otherwise it will ask whether you want to return
155 to the existing edit buffer.")
157 (define-minor-mode org-src-mode
158 "Minor mode for language major mode buffers generated by org.
159 This minor mode is turned on in two situations:
160 - when editing a source code snippet with \"C-c '\".
161 - When formatting a source code snippet for export with htmlize.
162 There is a mode hook, and keybindings for `org-edit-src-exit' and
163 `org-edit-src-save'")
165 (defun org-edit-src-code ()
166 "Edit the source code example at point.
167 The example is copied to a separate buffer, and that buffer is switched
168 to the correct language mode. When done, exit with \\[org-edit-src-exit].
169 This will remove the original code in the Org buffer, and replace it with
170 the edited version."
171 (interactive)
172 (let ((line (org-current-line))
173 (col (current-column))
174 (case-fold-search t)
175 (msg (substitute-command-keys
176 "Edit, then exit with C-c ' (C-c and single quote)"))
177 (info (org-edit-src-find-region-and-lang))
178 (org-mode-p (eq major-mode 'org-mode))
179 (beg (make-marker))
180 (end (make-marker))
181 (preserve-indentation org-src-preserve-indentation)
182 block-nindent total-nindent ovl lang lang-f single lfmt code begline buffer)
183 (if (not info)
185 (setq beg (move-marker beg (nth 0 info))
186 end (move-marker end (nth 1 info))
187 code (buffer-substring-no-properties beg end)
188 lang (or (cdr (assoc (nth 2 info) org-src-lang-modes))
189 (nth 2 info))
190 lang (if (symbolp lang) (symbol-name lang) lang)
191 single (nth 3 info)
192 lfmt (nth 4 info)
193 block-nindent (nth 5 info)
194 lang-f (intern (concat lang "-mode"))
195 begline (save-excursion (goto-char beg) (org-current-line)))
196 (unless (functionp lang-f)
197 (error "No such language mode: %s" lang-f))
198 (org-goto-line line)
199 (if (and (setq buffer (org-edit-src-find-buffer beg end))
200 org-src-ask-before-returning-to-edit-buffer
201 (y-or-n-p "Return to existing edit buffer? [n] will revert changes: "))
202 (switch-to-buffer buffer)
203 (when buffer
204 (with-current-buffer buffer
205 (if (boundp 'org-edit-src-overlay)
206 (org-delete-overlay org-edit-src-overlay)))
207 (kill-buffer buffer))
208 (setq buffer (generate-new-buffer
209 (org-src-construct-edit-buffer-name (buffer-name) lang)))
210 (setq ovl (org-make-overlay beg end))
211 (org-overlay-put ovl 'face 'secondary-selection)
212 (org-overlay-put ovl 'edit-buffer buffer)
213 (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment")
214 (org-overlay-put ovl 'face 'secondary-selection)
215 (org-overlay-put ovl
216 'keymap
217 (let ((map (make-sparse-keymap)))
218 (define-key map [mouse-1] 'org-edit-src-continue)
219 map))
220 (org-overlay-put ovl :read-only "Leave me alone")
221 (switch-to-buffer buffer)
222 (if (eq single 'macro-definition)
223 (setq code (replace-regexp-in-string "\\\\n" "\n" code t t)))
224 (insert code)
225 (remove-text-properties (point-min) (point-max)
226 '(display nil invisible nil intangible nil))
227 (unless preserve-indentation
228 (setq total-nindent (or (org-do-remove-indentation) 0)))
229 (let ((org-inhibit-startup t))
230 (funcall lang-f))
231 (set (make-local-variable 'org-edit-src-force-single-line) single)
232 (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
233 (set (make-local-variable 'org-src-preserve-indentation) preserve-indentation)
234 (when lfmt
235 (set (make-local-variable 'org-coderef-label-format) lfmt))
236 (when org-mode-p
237 (goto-char (point-min))
238 (while (re-search-forward "^," nil t)
239 (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent)))
240 (replace-match "")))
241 (org-goto-line (1+ (- line begline)))
242 (org-move-to-column
243 (if preserve-indentation col (max 0 (- col total-nindent))))
244 (org-set-local 'org-edit-src-beg-marker beg)
245 (org-set-local 'org-edit-src-end-marker end)
246 (org-set-local 'org-edit-src-overlay ovl)
247 (org-set-local 'org-edit-src-block-indentation block-nindent)
248 (org-src-mode)
249 (set-buffer-modified-p nil)
250 (and org-edit-src-persistent-message
251 (org-set-local 'header-line-format msg)))
252 (message "%s" msg)
253 t)))
255 (defun org-edit-src-continue (e)
256 (interactive "e")
257 (mouse-set-point e)
258 (let ((buf (get-char-property (point) 'edit-buffer)))
259 (if buf (switch-to-buffer buf)
260 (error "Something is wrong here"))))
262 (defun org-src-construct-edit-buffer-name (org-buffer-name lang)
263 "Construct the buffer name for a source editing buffer"
264 (concat "*Org Src " org-buffer-name "[ " lang " ]*"))
266 (defun org-edit-src-find-buffer (beg end)
267 "Find a source editing buffer that is already editing the region BEG to END."
268 (catch 'exit
269 (mapc
270 (lambda (b)
271 (with-current-buffer b
272 (if (and (string-match "\\`*Org Src " (buffer-name))
273 (local-variable-p 'org-edit-src-beg-marker (current-buffer))
274 (local-variable-p 'org-edit-src-end-marker (current-buffer))
275 (equal beg org-edit-src-beg-marker)
276 (equal end org-edit-src-end-marker))
277 (throw 'exit (current-buffer)))))
278 (buffer-list))
279 nil))
281 (defun org-edit-fixed-width-region ()
282 "Edit the fixed-width ascii drawing at point.
283 This must be a region where each line starts with a colon followed by
284 a space character.
285 An new buffer is created and the fixed-width region is copied into it,
286 and the buffer is switched into `artist-mode' for editing. When done,
287 exit with \\[org-edit-src-exit]. The edited text will then replace
288 the fragment in the Org-mode buffer."
289 (interactive)
290 (let ((line (org-current-line))
291 (col (current-column))
292 (case-fold-search t)
293 (msg (substitute-command-keys
294 "Edit, then exit with C-c ' (C-c and single quote)"))
295 (org-mode-p (eq major-mode 'org-mode))
296 (beg (make-marker))
297 (end (make-marker))
298 (preserve-indentation org-src-preserve-indentation)
299 block-nindent ovl beg1 end1 code begline buffer)
300 (beginning-of-line 1)
301 (if (looking-at "[ \t]*[^:\n \t]")
303 (if (looking-at "[ \t]*\\(\n\\|\\'\\)")
304 (setq beg1 (point) end1 beg1)
305 (save-excursion
306 (if (re-search-backward "^[ \t]*[^: \t]" nil 'move)
307 (setq beg1 (point-at-bol 2))
308 (setq beg1 (point))))
309 (save-excursion
310 (if (re-search-forward "^[ \t]*[^: \t]" nil 'move)
311 (setq end1 (1- (match-beginning 0)))
312 (setq end1 (point))))
313 (org-goto-line line))
314 (setq beg (move-marker beg beg1)
315 end (move-marker end end1)
316 code (buffer-substring-no-properties beg end)
317 begline (save-excursion (goto-char beg) (org-current-line)))
318 (if (and (setq buffer (org-edit-src-find-buffer beg end))
319 (y-or-n-p "Return to existing edit buffer? [n] will revert changes: "))
320 (switch-to-buffer buffer)
321 (when buffer
322 (with-current-buffer buffer
323 (if (boundp 'org-edit-src-overlay)
324 (org-delete-overlay org-edit-src-overlay)))
325 (kill-buffer buffer))
326 (setq buffer (generate-new-buffer
327 (org-src-construct-edit-buffer-name
328 (buffer-name) "Fixed Width")))
329 (setq ovl (org-make-overlay beg end))
330 (org-overlay-put ovl 'face 'secondary-selection)
331 (org-overlay-put ovl 'edit-buffer buffer)
332 (org-overlay-put ovl 'help-echo "Click with mouse-1 to switch to buffer editing this segment")
333 (org-overlay-put ovl 'face 'secondary-selection)
334 (org-overlay-put ovl
335 'keymap
336 (let ((map (make-sparse-keymap)))
337 (define-key map [mouse-1] 'org-edit-src-continue)
338 map))
339 (org-overlay-put ovl :read-only "Leave me alone")
340 (switch-to-buffer buffer)
341 (insert code)
342 (remove-text-properties (point-min) (point-max)
343 '(display nil invisible nil intangible nil))
344 (setq block-nindent (or (org-do-remove-indentation) 0))
345 (cond
346 ((eq org-edit-fixed-width-region-mode 'artist-mode)
347 (fundamental-mode)
348 (artist-mode 1))
349 (t (funcall org-edit-fixed-width-region-mode)))
350 (set (make-local-variable 'org-edit-src-force-single-line) nil)
351 (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
352 (set (make-local-variable 'org-edit-src-picture) t)
353 (goto-char (point-min))
354 (while (re-search-forward "^[ \t]*: ?" nil t)
355 (replace-match ""))
356 (org-goto-line (1+ (- line begline)))
357 (org-move-to-column (max 0 (- col block-nindent 2)))
358 (org-set-local 'org-edit-src-beg-marker beg)
359 (org-set-local 'org-edit-src-end-marker end)
360 (org-set-local 'org-edit-src-overlay ovl)
361 (org-set-local 'org-edit-src-block-indentation block-nindent)
362 (org-set-local 'org-edit-src-content-indentation 0)
363 (org-set-local 'org-src-preserve-indentation nil)
364 (org-src-mode)
365 (set-buffer-modified-p nil)
366 (and org-edit-src-persistent-message
367 (org-set-local 'header-line-format msg)))
368 (message "%s" msg)
369 t)))
371 (defun org-edit-src-find-region-and-lang ()
372 "Find the region and language for a local edit.
373 Return a list with beginning and end of the region, a string representing
374 the language, a switch telling if the content should be in a single line."
375 (let ((re-list
376 (append
377 org-edit-src-region-extra
379 ("<src\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</src>" lang)
380 ("<literal\\>[^<]*>[ \t]*\n?" "\n?[ \t]*</literal>" style)
381 ("<example>[ \t]*\n?" "\n?[ \t]*</example>" "fundamental")
382 ("<lisp>[ \t]*\n?" "\n?[ \t]*</lisp>" "emacs-lisp")
383 ("<perl>[ \t]*\n?" "\n?[ \t]*</perl>" "perl")
384 ("<python>[ \t]*\n?" "\n?[ \t]*</python>" "python")
385 ("<ruby>[ \t]*\n?" "\n?[ \t]*</ruby>" "ruby")
386 ("^[ \t]*#\\+begin_src\\( \\([^ \t\n]+\\)\\)?.*\n" "\n[ \t]*#\\+end_src" 2)
387 ("^[ \t]*#\\+begin_example.*\n" "\n[ \t]*#\\+end_example" "fundamental")
388 ("^[ \t]*#\\+html:" "\n" "html" single-line)
389 ("^[ \t]*#\\+begin_html.*\n" "\n[ \t]*#\\+end_html" "html")
390 ("^[ \t]*#\\+latex:" "\n" "latex" single-line)
391 ("^[ \t]*#\\+begin_latex.*\n" "\n[ \t]*#\\+end_latex" "latex")
392 ("^[ \t]*#\\+ascii:" "\n" "fundamental" single-line)
393 ("^[ \t]*#\\+begin_ascii.*\n" "\n[ \t]*#\\+end_ascii" "fundamental")
394 ("^[ \t]*#\\+docbook:" "\n" "xml" single-line)
395 ("^[ \t]*#\\+macro:[ \t]+\\S-+\\( \\|$\\)"
396 "\n" "fundamental" macro-definition)
397 ("^[ \t]*#\\+begin_docbook.*\n" "\n[ \t]*#\\+end_docbook" "xml")
399 (pos (point))
400 re1 re2 single beg end lang lfmt match-re1 ind entry)
401 (catch 'exit
402 (while (setq entry (pop re-list))
403 (setq re1 (car entry) re2 (nth 1 entry) lang (nth 2 entry)
404 single (nth 3 entry))
405 (save-excursion
406 (if (or (looking-at re1)
407 (re-search-backward re1 nil t))
408 (progn
409 (setq match-re1 (match-string 0))
410 (setq beg (match-end 0)
411 lang (org-edit-src-get-lang lang)
412 lfmt (org-edit-src-get-label-format match-re1)
413 ind (org-edit-src-get-indentation (match-beginning 0)))
414 (if (and (re-search-forward re2 nil t)
415 (>= (match-end 0) pos))
416 (throw 'exit (list beg (match-beginning 0)
417 lang single lfmt ind))))
418 (if (or (looking-at re2)
419 (re-search-forward re2 nil t))
420 (progn
421 (setq end (match-beginning 0))
422 (if (and (re-search-backward re1 nil t)
423 (<= (match-beginning 0) pos))
424 (progn
425 (setq lfmt (org-edit-src-get-label-format
426 (match-string 0))
427 ind (org-edit-src-get-indentation
428 (match-beginning 0)))
429 (throw 'exit
430 (list (match-end 0) end
431 (org-edit-src-get-lang lang)
432 single lfmt ind))))))))))))
434 (defun org-edit-src-get-lang (lang)
435 "Extract the src language."
436 (let ((m (match-string 0)))
437 (cond
438 ((stringp lang) lang)
439 ((integerp lang) (match-string lang))
440 ((and (eq lang 'lang)
441 (string-match "\\<lang=\"\\([^ \t\n\"]+\\)\"" m))
442 (match-string 1 m))
443 ((and (eq lang 'style)
444 (string-match "\\<style=\"\\([^ \t\n\"]+\\)\"" m))
445 (match-string 1 m))
446 (t "fundamental"))))
448 (defun org-edit-src-get-label-format (s)
449 "Extract the label format."
450 (save-match-data
451 (if (string-match "-l[ \t]+\\\\?\"\\([^\t\r\n\"]+\\)\\\\?\"" s)
452 (match-string 1 s))))
454 (defun org-edit-src-get-indentation (pos)
455 "Count leading whitespace characters on line"
456 (save-match-data
457 (goto-char pos)
458 (org-get-indentation)))
460 (defun org-edit-src-exit ()
461 "Exit special edit and protect problematic lines."
462 (interactive)
463 (unless org-edit-src-from-org-mode
464 (error "This is not a sub-editing buffer, something is wrong..."))
465 (let* ((beg org-edit-src-beg-marker)
466 (end org-edit-src-end-marker)
467 (ovl org-edit-src-overlay)
468 (buffer (current-buffer))
469 (single (org-bound-and-true-p org-edit-src-force-single-line))
470 (macro (eq single 'macro-definition))
471 (total-nindent (+ (or org-edit-src-block-indentation 0)
472 org-edit-src-content-indentation))
473 (preserve-indentation org-src-preserve-indentation)
474 (delta 0) code line col indent)
475 (untabify (point-min) (point-max))
476 (save-excursion
477 (goto-char (point-min))
478 (if (looking-at "[ \t\n]*\n") (replace-match ""))
479 (unless macro
480 (if (re-search-forward "\n[ \t\n]*\\'" nil t) (replace-match ""))))
481 (setq line (if (org-bound-and-true-p org-edit-src-force-single-line)
483 (org-current-line))
484 col (current-column))
485 (when single
486 (goto-char (point-min))
487 (if (re-search-forward "\\s-+\\'" nil t) (replace-match ""))
488 (goto-char (point-min))
489 (let ((cnt 0))
490 (while (re-search-forward "\n" nil t)
491 (setq cnt (1+ cnt))
492 (replace-match (if macro "\\n" " ") t t))
493 (when (and macro (> cnt 0))
494 (goto-char (point-max)) (insert "\\n")))
495 (goto-char (point-min))
496 (if (looking-at "\\s-*") (replace-match " ")))
497 (when (org-bound-and-true-p org-edit-src-from-org-mode)
498 (goto-char (point-min))
499 (while (re-search-forward
500 (if (org-mode-p) "^\\(.\\)" "^\\([*]\\|[ \t]*#\\+\\)") nil t)
501 (if (eq (org-current-line) line) (setq delta (1+ delta)))
502 (replace-match ",\\1")))
503 (when (org-bound-and-true-p org-edit-src-picture)
504 (setq preserve-indentation nil)
505 (untabify (point-min) (point-max))
506 (goto-char (point-min))
507 (while (re-search-forward "^" nil t)
508 (replace-match ": ")))
509 (unless (or single preserve-indentation (= total-nindent 0))
510 (setq indent (make-string total-nindent ?\ ))
511 (goto-char (point-min))
512 (while (re-search-forward "^" nil t)
513 (replace-match indent)))
514 (if (org-bound-and-true-p org-edit-src-picture)
515 (setq total-nindent (+ total-nindent 2)))
516 (setq code (buffer-string))
517 (set-buffer-modified-p nil)
518 (switch-to-buffer (marker-buffer beg))
519 (kill-buffer buffer)
520 (goto-char beg)
521 (delete-region beg end)
522 (insert code)
523 (goto-char beg)
524 (if single (just-one-space))
525 (org-goto-line (1- (+ (org-current-line) line)))
526 (org-move-to-column (if preserve-indentation col (+ col total-nindent delta)))
527 (move-marker beg nil)
528 (move-marker end nil)))
530 (defun org-edit-src-save ()
531 "Save parent buffer with current state source-code buffer."
532 (interactive)
533 (save-window-excursion
534 (let ((p (point)) (m (mark)) msg)
535 (org-edit-src-exit)
536 (save-buffer)
537 (setq msg (current-message))
538 (org-edit-src-code)
539 (push-mark m 'nomessage)
540 (goto-char (min p (point-max)))
541 (message (or msg "")))))
543 (defun org-src-mode-configure-edit-buffer ()
544 (when org-edit-src-from-org-mode
545 (setq buffer-offer-save t)
546 (setq buffer-file-name
547 (concat (buffer-file-name (marker-buffer org-edit-src-beg-marker))
548 "[" (buffer-name) "]"))
549 (set (if (featurep 'xemacs) 'write-contents-hooks 'write-contents-functions)
550 '(org-edit-src-save))
551 (org-add-hook 'kill-buffer-hook
552 '(lambda () (org-delete-overlay org-edit-src-overlay)) nil 'local)))
554 (org-add-hook 'org-src-mode-hook 'org-src-mode-configure-edit-buffer)
556 (provide 'org-src)
558 ;; arch-tag: 6a1fc84f-dec7-47be-a416-64be56bea5d8
559 ;;; org-src.el ends here