Commit Graph

336 Commits

Author SHA1 Message Date
Nicolas Goaziou a33acf6191 org-src: Fix indentation rampage when editing src blocks
* lisp/org-src.el (org-edit-src-code): Do not add indentation at every
  edit when `org-src-preserve-indentation' is non-nil.

Function taking care of indentation cannot check
`org-src--preserve-indentation' since the variable is buffer-local and
indentation happens in a temporary buffer.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97927>
2015-05-29 09:55:56 +02:00
Nicolas Goaziou 3062753e16 org-src: Change ambiguous variable name
* lisp/org-src.el (org-src--preserve-indentation): New variable.
(org-src--contents-for-write-back):
(org-src--edit-element):
(org-edit-src-code): Use new change.

Before this change `org-src-preserve-indentation' was both a defcustom
and an internal local variable.  Both uses are now separated.
2015-05-26 21:47:05 +02:00
Nicolas Goaziou 59da320b30 org-src: Fix auto-save feature
* lisp/org-src.el (org-src-mode): Do not stop auto save feature when
  current buffer is no longer an edit buffer.

Reported-by: Andreas Leha <andreas.leha@med.uni-goettingen.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97892>
2015-05-26 17:06:53 +02:00
Nicolas Goaziou 5b3d47cf56 org-src: Fix error when editing footnote references
* lisp/org-src.el (org-src--contents-area): Define BEG and END.
2015-05-26 01:17:34 +02:00
Kyle Meyer e50472d926 org-src: Fix reference to free variable
* lisp/org-src.el (org-src--contents-area): Replace a let with let*.
2015-05-23 21:52:06 +02:00
Nicolas Goaziou 71641bc3a0 org-src: Fix escaping in remote editing
* lisp/org-src.el (org-src--contents-area): Include contents to be
  inserted in the edit buffer in return value.
(org-src--edit-element): Apply change above.

Reported-by: Kyle Meyer <kyle@kyleam.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97784>
2015-05-22 20:59:31 +02:00
Nicolas Goaziou 9e52d2ed01 org-src: Allow to edit inline footnote references
* lisp/org-src.el (org-src--edit-element): Do not rely on :value to
  extract contents.  Small refactoring.
(org-src--contents-area): Renamed from
  `org-src--element-contents-area'.  Throw an error on unknown
  elements.
(org-src--on-datum-p): Rename from `org-src--on-element-p'.  Handle
objects.
(org-edit-export-block, org-edit-src-code,
org-edit-fixed-width-region, org-edit-table.el): Apply renaming.
(org-edit-src-save, org-edit-src-exit): Handle inline text.
(org-edit-src-exit): Allow empty or blank code.  Handle inline text.
(org-src--edit-element): Rename an argument
(org-edit-footnote-reference): Allow to edit inline definitions.

* etc/ORG-NEWS: Document new feature.
2015-05-02 16:45:51 +02:00
Nicolas Goaziou f8d1d373fc org-src: Make area being edited read-only
* lisp/org-src.el (org-src--make-source-overlay): Add read-only
  feature to overlay.
(org-edit-src-save): Adapt to change above.
2015-05-01 21:14:19 +02:00
Nicolas Goaziou 427403d0bb org-src: Remove `org-src--type'
* lisp/org-src.el (org-src--type): Remove variable.
(org-src--contents-for-write-back): Apply removal.
(org-edit-src-code): Add indentation in post-process.
2015-05-01 18:46:33 +02:00
Nicolas Goaziou bce77d0db3 org-src: Fix "not in a sub-edit buffer" error on save
* lisp/org-src.el (org-src-mode): Fix "not in a sub-edit buffer" error
  on save.

Reported-by: Detlef Steuer <detlef.steuer@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/97349>
2015-05-01 10:29:05 +02:00
Nicolas Goaziou d289eb9361 org-src: Fix docstrings
* lisp/org-src.el (org-src-mode-hook):
(org-edit-src-code): Fix docstrings.
2015-05-01 10:03:17 +02:00
Nicolas Goaziou 0046955e23 org-src: Fix docstrings
* lisp/org-src.el (org-src-mode-hook):
(org-src-mode): Fix docstring.
(org-src-mode-map): Refactor.
2015-05-01 09:49:14 +02:00
Nicolas Goaziou ea575950d9 org-src: Tiny fix
* lisp/org-src.el (org-src-mode): Tiny fix.
2015-04-29 13:25:34 +02:00
Nicolas Goaziou bf01f6fe66 org-src: Small fix to auto-save feature
* lisp/org-src.el (org-src-mode): Trigger auto-save even when current
  buffer is not and edit buffer.
2015-04-29 13:23:36 +02:00
Nicolas Goaziou bad0409c3b org-src: Small refactoring
* lisp/org-src.el (org-src--auto-save-timer): Renamed from
  `org-src--code-timer'.
(org-src--edit-element):
(org-src-mode): Enable auto-save features in minor mode.  Apply
variable renaming.
2015-04-29 13:16:21 +02:00
Nicolas Goaziou 21b6b1d9a2 org-src: Fix editing remotely empty footnote definitions
* lisp/org-src.el (org-src--element-contents-area):
(org-edit-footnote-reference): Take into consideration
that :contents-begin and :contents-end may be nil.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/97262>
2015-04-28 00:22:20 +02:00
Nicolas Goaziou 9d4b3e356f org-src: Refuse to edit remotely inline footnotes
* lisp/org-src.el (org-edit-footnote-reference): Throw an error when
  definition is inline.
2015-04-26 14:58:54 +02:00
Nicolas Goaziou ca2b398396 org-src: Allow editing footnote definitions
* lisp/org-src.el (org-src--element-contents-area): Make a special
  case for footnote definitions.
(org-edit-footnote-reference): New function.
* lisp/org.el (org-edit-special): Use new function.
2015-04-26 11:44:35 +02:00
Nicolas Goaziou 58af85a4a2 org-src: Allow editing elements remotely
* lisp/org-src.el (org-src--remote-p): New variable.
(org-src--edit-element): Add optional argument.
(org-edit-src-exit): Handle new optional argument.
2015-04-26 11:37:52 +02:00
Nicolas Goaziou c347b87ffe org-src: Allow to post-process edit buffer
* lisp/org-src.el (org-src--allow-write-back): Rename from
  `org-src--allow-write-back-p'.

(org-src--edit-element):
(org-src-mode-configure-edit-buffer):
(org-edit-src-abort):
(org-edit-src-exit): Apply renaming.

(org-src--contents-for-write-back):
(org-edit-export-block):
(org-edit-src-code):
(org-edit-fixed-width-region): Use post-process.
2015-04-26 11:13:37 +02:00
Nicolas Goaziou 5894a74500 org-src: Update copyright year 2015-02-18 14:58:36 +01:00
Nicolas Goaziou a5f1a3e4be org-src: Small refactoring
* lisp/org-src.el (org-src--remove-overlay): New function.
(org-src--edit-element, org-src-mode-configure-edit-buffer): Use new
function.
2015-02-18 02:05:57 +01:00
Nicolas Goaziou 2dd548a4e0 Merge branch 'maint' 2015-02-18 02:04:39 +01:00
Nicolas Goaziou c41bbc577e 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.
2015-02-18 01:59:51 +01:00
Aaron Ecay 7c86747881 org-src: add a note about bogosity of read-only overlays
* lisp/org-src.el (org-src--make-source-overlay): Add a TODO comment.
2014-12-11 23:48:27 -05:00
Aaron Ecay 398286a00c org-src: fix two bugs
* lisp/org-src.el (org-src--edit-buffer): Construe equality for
markers properly.
(org-edit-src-save): Place point properly when writing back changes.

Thanks to Vikas Rawal for reporting:
<http://mid.gmane.org/C8148BF2-87AF-44A4-B103-6BD338DA8D96@agrarianresearch.org>
2014-12-11 23:34:35 -05:00
Oleh Krehel 433b66f2c7 org-src: allow `org-babel-edit-prep:.*' to mark region
* lisp/org-src.el (org-edit-src-code): Let `deactivate-mark' nil.

<http://permalink.gmane.org/gmane.emacs.orgmode/93053>
2014-12-09 17:26:02 +01:00
Nicolas Goaziou bde27ccacc org-src: Fix docstring
* lisp/org-src.el (org-src-ask-before-returning-to-edit-buffer): Fix
  docstring.  Move variable in appropriate section.
2014-11-24 00:07:39 +01:00
Nicolas Goaziou 203bf5870f org-src: Unify source editing tools
* lisp/org-src.el (org-src-strip-leading-and-trailing-blanklines,
  org-edit-src-force-single-line, org-edit-src-picture,
  org-edit-src-from-org-mode, org-edit-src-allow-write-back-p,
  org-edit-src-beg-marker, org-edit-src-end-marker,
  org-edit-src-overlay, org-edit-src-block-indentation,
  org-edit-src-saved-temp-window-config, org-edit-src-code-timer):
  Remove variables.
(org-src--allow-write-back-p, org-src--beg-marker,
org-src--block-indentation, org-src--code-timer, org-src--end-marker,
org-src--end-marker, org-src--from-org-mode, org-src--overlay,
org-src--saved-temp-window-config, org-src--type,
org-src--babel-info): New variables.

(org-src--construct-edit-buffer-name, org-src--edit-buffer,
org-src--source-buffer, org-src--get-lang-mode, org-src--coordinates,
org-src--goto-coordinates, org-src--element-contents-area,
org-src--make-source-overlay, org-src--on-element-p,
org-src--contents-for-write-back, org-src--edit-element,
org-edit-table.el, org-edit-export-block): New functions.
(org-edit-src-find-buffer, org-src-construct-edit-buffer-name,
org-src-tangle, org-src-in-org-buffer): Remove functions.

(org-edit-src-code, org-edit-fixed-width-region, org-edit-src-abort,
org-edit-src-save): Use new functions and variables.
(org-edit-src-exit): Use new functions and variables.  Change
signature.

* lisp/org.el (org-edit-special, org-indent-line, org-indent-region):
  Use new functions and variables.

* lisp/ob-core.el (org-babel-do-in-edit-buffer): Remove useless check.
(org-babel-expand-src-block): Apply signature change.

This patches resolves discrepancies between source editing tools and
globally simplifies process (auto-save feature, region
preservation...).  It introduces export block editing.  It also moves
internal variables and functions into an appropriate namespace and
delete some unused functions.
2014-11-24 00:07:39 +01:00
Nicolas Goaziou 9c06f8cce9 org-src: Remove unused functions and variables
* lisp/org-src.el (org-edit-src-region-extra): Remove variable.
(org-edit-src-find-region-and-lang, org-edit-src-get-lang,
org-edit-src-get-label-format, org-edit-src-get-indentation,
org-src-fontify-block, org-src-fontify-buffer): Remove functions.

(org-src-font-lock-fontify-block): Remove reference to removed
function in docstring.

Remove all functions and variables related to parsing, which is now
delegated to org-element.el.  Also reorder a defcustom and
a declaration in the library.
2014-11-22 20:59:08 +01:00
Nicolas Goaziou 3d45b4285b Merge branch 'maint' 2014-09-11 18:27:22 +02:00
Nicolas Goaziou 01f736b763 org-src: Fix idle auto-save feature
* lisp/org-src.el (org-edit-src-code): Fix regexp.
(org-edit-src-exit): Do not remove auto-save timer.  This is
handled by the timer itself.

`org-edit-src-save' calls `org-edit-src-exit', which then clears the
auto-save timer, thus preventing any further auto-saves before the
next `org-edit-src-code' call.

Thanks to Adriaan Sticker for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/90650
2014-09-11 18:21:41 +02:00
Bastien Guerry 98295a8a25 Remove useless declaration 2014-07-28 18:29:24 +02:00
Bastien Guerry 99f999944e org-src.el (org-src-font-lock-fontify-block): Do not use `font-lock-ensure'
* org-src.el (org-src-font-lock-fontify-block): Use
`font-lock-fontify-buffer' instead of `font-lock-ensure',
otherwise fonts are not displayed for src blocks.

Thanks to Mathäus Meyer for reporting this.
2014-07-28 00:34:55 +02:00
Eric Schulte 8ad20618d1 map alternate code blocks shell names to sh-mode
* lisp/org-src.el (org-src-lang-modes): Map alternate shell names to
  sh-mode.
2014-06-22 19:50:31 -04:00
Aaron Ecay 5ee0d29f57 Remove another vestige of org-mtags
* lisp/org-src.el (org-edit-src-find-region-and-lang): Remove old
<foo>-style tags.

This completes commit 94939bd
2014-06-21 21:38:32 -04:00
Bastien Guerry f36b19eef6 org.el: Send a warning when org-loaddefs.el could not be found
* org.el: Send a warning when org-loaddefs.el could not be
found in the directory where this org.el file is loaded from.

* ox-org.el (org-org-publish-to-org):
* ox-odt.el (org-odt-do-format-code):
* ox-html.el (org-html-fontify-code):
* org.el (org-fontify-like-in-org-mode):
* org-src.el (org-src-font-lock-fontify-block):
* org-clock.el (org-clock-get-clocktable): Use
`font-lock-ensure' instead of `font-lock-fontify-buffer'.

* org.el (org-outline-level, org-copy-subtree)
(org-sort-entries, orgstruct-setup, org-show-context)
(org-create-formula-image-with-dvipng)
(org-create-formula-image-with-imagemagick)
(org-goto-sibling, org-goto-first-child, org-show-entry): Use
`ignore-errors' instead of (condition-case nil ... (error nil)).

People trying to load org.el when org-loaddefs.el is not available
has been a major cause of trouble when installing Org.  The warning
tells them what they need to do.
2014-05-29 22:08:43 +02:00
Nicolas Goaziou 51ffcd02dd Rewrite `org-indent-line'
* lisp/org.el (org--get-expected-indentation,
  org--align-node-property): New functions.
(org-indent-line): Use new function.  Also merge functionalities with
`org-src-native-tab-command-maybe'.

* lisp/org-src.el (org-src-native-tab-command-maybe): Remove function.

* testing/lisp/test-org.el (test-org/indent-line): New test.
2014-05-07 17:39:52 +02:00
Aaron Ecay cb53665e55 Fix org-src-edit interaction with undo.
* org-src.el (org-edit-src-exit): Place an undo boundary before
writing changes back to parent buffer.

The previous code attempted to preserve the undo information in the
indirect buffer editing the source code, but this interacts poorly
with the undo system, and can lead to undo operations scrambling the
buffer.  The new approach means that edits made in the indirect buffer
cannot be undone piece-by-piece (instead, all changes made in the
indirect buffer constitute one “change” from the point of view of
undo), but the misbehavior of undo is (hopefully) now avoided.
2014-03-22 09:40:18 +01:00
Bastien Guerry e1ede2271c org-src.el (org-src-preserve-indentation): Reformat docstring
* org-src.el (org-src-preserve-indentation): Reformat
docstring.
2014-03-15 07:42:19 +01:00
Bastien Guerry 07347025ee Merge branch 'maint' 2014-03-14 09:59:38 +01:00
Bastien Guerry 49a9c2b213 Fix 9323857 (again^2)
Thanks to Florian Beck for providing the right fix.
2014-03-14 09:59:28 +01:00
Bastien Guerry 6a57319d47 Merge branch 'maint' 2014-03-13 19:08:00 +01:00
Bastien Guerry 5ef5e7119f Fix 9323857 (again) 2014-03-13 19:07:50 +01:00
Bastien Guerry a6f8460487 Merge branch 'maint' 2014-03-13 09:46:58 +01:00
Bastien Guerry f94ed64ffd Fix 9323857
Thanks to Charles Berry for reporting this.
2014-03-13 09:46:45 +01:00
Bastien Guerry 4d835d719d Merge branch 'maint'
Conflicts:
	lisp/org.el
2014-03-12 19:14:03 +01:00
Arun Persaud 9323857411 org-src.el (org-edit-src-exit): Don't add indentation on empty lines
* org-src.el (org-edit-src-exit): Don't add indentation on
empty lines.

TINYCHANGE
2014-03-12 19:08:17 +01:00
Bastien Guerry f0e5683a12 org-src.el (org-edit-src-find-region-and-lang): Check if we are in a table.el table last
* org-src.el (org-edit-src-find-region-and-lang): Check if we
are in a table.el table last.

Thanks to zwz and Thomas Holst for reporting this.
2014-03-12 18:56:57 +01:00
Bastien Guerry 05cd942f31 Merge branch 'maint' 2014-02-09 14:54:23 +01:00
Bastien Guerry 0ceb68d599 org-src.el (org-edit-src-code): Throw a warning instead of an error
* org-src.el (org-edit-src-code): Throw a warning instead of
an error when loading the mode fails, otherwise the user is
left with unusable buffers.

Thanks to Florian Beck for suggesting this.
2014-02-09 14:54:12 +01:00
Bastien Guerry f8e1745440 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-07 14:19:03 +01:00
Bastien Guerry 7d9a883b50 Update copyright years again.
Hint: copyright years are all updated in Emacs.
2014-01-07 14:18:17 +01:00
Bastien Guerry c41f5075ac Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-05 06:36:11 +01:00
Bastien Guerry 0beda99171 Revert "Update copyright years."
This reverts commit 21105594fc.
2014-01-05 06:28:07 +01:00
Bastien Guerry 096ff7e078 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-04 18:58:12 +01:00
Bastien Guerry 21105594fc Update copyright years. 2014-01-04 18:56:11 +01:00
Bastien Guerry 9214000c21 Merge branch 'maint'
Conflicts:
	doc/org.texi
2013-11-17 09:17:39 +01:00
Bastien Guerry a6210cc9c2 Backport Paul's fixes from Emacs trunk (1/2)
See http://article.gmane.org/gmane.emacs.diffs/123123
2013-11-17 09:12:41 +01:00
Bastien Guerry 71884cc039 Merge branch 'maint'
Conflicts:
	lisp/ob-C.el
	lisp/ob-clojure.el
	lisp/ob-core.el
	lisp/ob-lisp.el
	lisp/org-clock.el
2013-11-12 21:00:49 +01:00
Bastien Guerry f95641c443 Backport changes from Emacs revs 115081 and 115082
2013-11-12  Stefan Monnier  <monnier@iro.umontreal.ca>

	Address some byte-compiler warnings.
	* ob-abc.el (org-babel-expand-body:abc): Use dolist.
	(org-babel-execute:abc): Fix regexp quoting.
	* ob-calc.el (org--var-syms): Rename from `var-syms'.
	* ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding.
	* ob-table.el (sbe): Move debug declaration.
	* org-clock.el (org--msg-extra): Rename from `msg-extra'.
	* org.el (org-version): Avoid var name starting with _.
	(org-inhibit-startup, org-called-with-limited-levels)
	(org-link-search-inhibit-query, org-time-was-given)
	(org-end-time-was-given, org-def, org-defdecode, org-with-time):
	* org-colview.el (org-agenda-overriding-columns-format):
	* org-agenda.el (org-agenda-multi, org-depend-tag-blocked)
	(org-agenda-show-log-scoped):
	* ob-python.el (py-which-bufname, python-shell-buffer-name):
	* ob-haskell.el (org-export-copy-to-kill-ring):
	* ob-exp.el (org-link-search-inhibit-query):
	* ob-R.el (ess-eval-visibly-p):
	* ob-core.el (org-src-window-setup): Declare before use.
	(org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'.
	* ox-odt.el (org-odt-hfy-face-to-css):
	* org-src.el (org-src-associate-babel-session, org-src-get-lang-mode):
	* org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex)
	(org-bibtex-check):
	* ob-tangle.el (org-babel-tangle, org-babel-spec-to-string)
	(org-babel-tangle-single-block, org-babel-tangle-comment-links):
	* ob-table.el (sbe):
	* ob-sqlite.el (org-babel-sqlite-expand-vars):
	* ob-sql.el (org-babel-sql-expand-vars):
	* ob-shen.el (org-babel-execute:shen):
	* ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate):
	* ob-scala.el (org-babel-scala-evaluate):
	* ob-ruby.el (org-babel-ruby-table-or-string)
	(org-babel-ruby-evaluate):
	* ob-python.el (org-babel-python-table-or-string)
	(org-babel-python-evaluate-external-process)
	(org-babel-python-evaluate-session):
	* ob-picolisp.el (org-babel-execute:picolisp):
	* ob-perl.el (org-babel-perl-evaluate):
	* ob-maxima.el (org-babel-execute:maxima):
	* ob-lisp.el (org-babel-execute:lisp):
	* ob-java.el (org-babel-execute:java):
	* ob-io.el (org-babel-io-evaluate):
	* ob-haskell.el (org-babel-execute:haskell):
	* ob-fortran.el (org-babel-execute:fortran):
	* ob-exp.el (org-babel-exp-code):
	* ob-emacs-lisp.el (org-babel-execute:emacs-lisp):
	* ob-ditaa.el (org-babel-execute:ditaa):
	* ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash)
	(org-babel-parse-header-arguments, org-babel-reassemble-table)
	(org-babel-goto-src-block-head, org-babel-mark-block)
	(org-babel-expand-noweb-references, org-babel-script-escape)
	(org-babel-process-file-name):
	* ob-clojure.el (org-babel-execute:clojure):
	* ob-calc.el (org-babel-execute:calc):
	* ob-awk.el (org-babel-execute:awk):
	* ob-abc.el (org-babel-execute:abc):
	* ob-R.el (org-babel-expand-body:R):
	* ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...).

2013-11-12  Glenn Morris  <rgm@gnu.org>

	* ox-html.el (org-html-scripts): Add 2013 to copyright years.
	(org-html-infojs-template): Copyright holder to FSF.
2013-11-12 20:57:31 +01:00
Aaron Ecay 8b264d505e Fix org-src-edit interaction with undo.
* org-src.el (org-edit-src-exit): Place an undo boundary before
writing changes back to parent buffer.

The previous code attempted to preserve the undo information in the
indirect buffer editing the source code, but this interacts poorly
with the undo system, and can lead to undo operations scrambling the
buffer.  The new approach means that edits made in the indirect buffer
cannot be undone piece-by-piece (instead, all changes made in the
indirect buffer constitute one “change” from the point of view of
undo), but the misbehavior of undo is (hopefully) now avoided.
2013-10-28 15:09:25 -04:00
Bastien Guerry 0eb0e5778b Use bzg@gnu.org instead of bzg AT gnu DOT org 2013-10-08 08:07:21 +02:00
Carsten Dominik 4cd14bd2ff Protect src overlay during saving the src snipped
* lisp/org-src.el (org-edit-src-exit): Let overlay survive after the
buffer has been saved.
2013-09-25 09:14:12 +02:00
rasmus 6727f1aa75 Better C++ recognition
* ob-C.el: Added =C++= to =`org-babel-load-languages'=
automatically after loading =C=.
* org-src.el (org-src-lang-modes): Added association between
language =C++= and =`c++-mode'=.

=C++= is added to org-babel-load-languages to make
`org-babel-demarcate-block' recognize =C++= as a proper language.
2013-07-13 10:35:34 -06:00
Bastien Guerry 7790a97cdd org-src.el (org-edit-src-turn-on-auto-save): New option
* org-src.el (org-edit-src-turn-on-auto-save): New option.
(org-edit-src-code): Use it.
(org-edit-src-auto-save-idle-delay): Enhance docstring.

* doc/org.texi (Editing source code): Document
`org-edit-src-auto-save-idle-delay' and
`org-edit-src-turn-on-auto-save'.

Thanks to Charles C. Berry for bringing this up again.
2013-04-16 10:38:01 +02:00
Bastien Guerry 8c7e46b6a9 org-src.el (org-edit-src-code): Don't set `buffer-auto-save-file-name' unless `auto-save-default' is non-nil
* org-src.el (org-edit-src-code): Don't set
`buffer-auto-save-file-name' unless `auto-save-default' is
non-nil.

Thanks to Charles Berry for reporting this.
2013-04-07 22:43:02 +02:00
Bastien Guerry 9c8f4a53d7 org-src.el (org-src-native-tab-command-maybe): Check that we are in a source code block
* org-src.el (org-src-native-tab-command-maybe): Check that we
are in a source code block.

Consider this content:

#+HEADERS: :var data1=1
#+BEGIN_SRC emacs-lisp :var data2=2
  (message "data1:%S, data2:%S" data1 data2)
#+END_SRC

Before the fix, hitting TAB on #+HEADERS would throw an error.
2013-04-03 18:28:29 +02:00
Aaron Ecay 50226db65d org-src.el (org-edit-src-exit): Don't modify the undo list when inserting the code
* org-src.el (org-edit-src-exit): Don't modify the undo list when
inserting the code.
2013-03-08 18:31:14 +01:00
Achim Gratz 3773029db9 fix 17131cbf63
* lisp/ob-tangle.el (org-babel-tangle): Do not change signature, a nil
  arg is even documented in the manual.
* lisp/org-src.el: Change declaration of `org-babel-tangle´ to "arg"
  for first argument.
2013-03-02 18:13:52 +01:00
Bastien Guerry 463a2f602f org-src.el (org-edit-src-auto-save-idle-delay): Deactivate auto-saving by default
* org-src.el (org-edit-src-auto-save-idle-delay): Use a delay
of 0 by default (i.e., deactivate auto-saving.)
(org-edit-src-code): Set `buffer-auto-save-file-name' for
auto-saving with `auto-save-mode'.

Thanks to Andreas Leha for suggesting this.
2013-03-02 15:04:43 +01:00
Bastien Guerry 295b0ba5d1 Bump :version to "24.4" and add :package-version.
The options updated are those who won't be in Emacs 24.3.
2013-02-26 18:21:28 +01:00
Bastien Guerry c1cdb379af org-src.el: Use C-c C-k for `org-edit-src-abort'
* org-src.el (org-src-mode-map, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-save): Use C-c C-k
for `org-edit-src-abort'.

Thanks to Bernt Hansen for the suggestion.
2013-02-16 21:33:28 +01:00
Bastien Guerry 25aabd7d2f org-src.el (org-edit-src-auto-save-idle-delay): New option
* org-src.el (org-edit-src-auto-save-idle-delay): New option.
(org-src-ask-before-returning-to-edit-buffer): Make a defcustom.
(org-edit-src-code-timer): New timer variable.
(org-edit-src-code): Run the timer.
(org-edit-fixed-width-region): Enhance message.
(org-edit-src-exit): Cancel the timer.

Thanks to Andreas Leha for suggesting this.
2013-02-16 11:35:39 +01:00
Bastien Guerry 602d6edb56 org-src.el: Prevent saving when editing fixed-width buffer, exiting will save already
* org-src.el (org-edit-src-save): Prevent saving when editing
fixed-width buffer, exiting will save already.
(org-edit-src-exit): Inconditionally kill the src/example
editing buffer.
2013-02-16 10:35:08 +01:00
Bastien Guerry 7c9663eb4a org-src.el: Allow to abort editing with C-c k
* org-src.el (org-src-mode-map): New binding C-c k to abort
editing.
(org-edit-src-code): Mention the keybinding to abort editing
and go back to the correct position.
(org-edit-src-abort): New command to abort editing.

Thanks to Zech for suggesting this.
2013-02-15 22:59:13 +01:00
Bastien Guerry 7a4d026b67 Remove references to the DocBook exporter
* org.el (org-emphasis-alist, org-protecting-blocks):
* org-src.el (org-edit-src-find-region-and-lang):
* org-list.el (org-list-forbidden-blocks):
* org-footnote.el (org-footnote-forbidden-blocks): Remove
references to the deleted DocBook exporter.

* org.texi (Top, Markup, Initial text, Images and tables)
(@LaTeX{} fragments, @LaTeX{} fragments, Exporting)
(Export options, JavaScript support, Beamer class export):
Remove references to the DocBook export, which has been
deleted.
(History and Acknowledgments): Mention that DocBook has been
deleted, suggest to use the Texinfo exporter instead, then to
convert the .texi to DocBook with makeinfo.
(Links in ODT export, Tables in ODT export): Fix indices.
2013-02-14 09:48:36 +01:00
Bastien Guerry a5815f3f5b org-src.el (org-edit-src-find-region-and-lang): Try to find table.el tables first
* org-src.el (org-edit-src-find-region-and-lang): Try to find
table.el tables first.

Thanks to Jacobo de Vera for insisting on this.
2013-01-08 18:26:06 +01:00
Bastien Guerry a4b4143132 org-src.el (org-edit-src-code): Fix bug when trying to edit a table.el table
* org-src.el (org-edit-src-code): Fix bug when trying to edit
a table.el table.

Thanks to Jacobo de Vera for reporting this regression.
2013-01-08 15:57:10 +01:00
Bastien Guerry 98cd4687a2 Update copyright years.
Happy new year!
2013-01-01 16:04:24 +01:00
Bastien Guerry e4ca9f44e3 org-src.el (org-edit-src-exit): Don't comma-escape the content of a fixed width region
* org-src.el (org-edit-src-exit): Don't comma-escape the
content of a fixed width region.

Thanks to Bernt Hansen for reporting this.
2012-12-29 11:20:10 +01:00
Bastien Guerry bdbdc4cb2c org-src.el: Fix compiler warning 2012-12-29 09:23:11 +01:00
Bastien Guerry 40cb44e795 Fix regression: allow editing HTML and LaTeX source blocks again
* org.el (org-table-map-tables): Fix allowed blocks.
(org-edit-special): Fix regression: allow editing HTML and
LaTeX source blocks again.

* org-src.el (org-edit-src-code): Ditto.

Thanks to Nicolas Richard and Bernt Hansen for reporting bugs
in this area.
2012-12-24 01:25:33 +01:00
Bastien Guerry 98a5f3df32 Don't allow special edit in verbatim blocks.
* org.el (org-edit-special): Don't edit in verbatim blocks.

* org-src.el (org-edit-src-code): Ditto.
2012-12-23 17:54:42 +01:00
Bastien Guerry a118ae4e1c org-src.el (org-edit-src-code): Fix another bug about editing special blocks "example" and "verbatim"
* org-src.el (org-edit-src-code): Fix another bug about
editing special blocks "example" and "verbatim".
2012-12-23 17:20:27 +01:00
Bastien Guerry 963ede0a9d Fix some compiler warnings.
* org.el (org-in-fixed-width-region-p): Define before use.

* org-src.el (org-in-src-block-p): Declare function.
2012-12-20 01:16:01 +01:00
Bastien Guerry 81d5ebce8d org-src.el (org-edit-src-code): Check if we are in a source code block with `org-in-src-block-p'.
* org-src.el (org-edit-src-code): Check if we are in a source
code block with `org-in-src-block-p'.  Slightly reformat the
docstring.
2012-12-14 10:10:40 +01:00
Michael Gauland 4524a02b39 Edit source: fix 'end' initialisation
* org-src.el: Create a marker to pass to copy-marker.

This fixes a 'wrong type argument' error when running
org-edit-src-code (observed on Emacs 23.2.1).

The problem was that copy-marker expects a marker, and it was given
nil. This change gives it a marker that doesn't point anywhere, but
still lets us set the insertion type of the end marker.

TINYCHANGE
2012-12-13 23:47:07 +01:00
Bastien Guerry 22e4a4ecb9 Revert "org-src.el (org-edit-src-code): Fix bug on Emacs <24.1."
This reverts commit 7a770c10c1.
2012-12-13 23:45:55 +01:00
Bastien Guerry 7a770c10c1 org-src.el (org-edit-src-code): Fix bug on Emacs <24.1.
* org-src.el (org-edit-src-code): Fix bug triggered by the
sexp (copy-marker nil) on Emacs <24.1.

Thanks to Bernt Hansen for reporting this.
2012-12-13 17:04:38 +01:00
Bastien Guerry 570ecb4e31 org-src.el: Fix bug: the S-TAB key should not trigger a native TAB command.
* org-src.el (org-src-native-tab-command-maybe): Fix bug: the
S-TAB key should not trigger a native TAB command.
2012-12-12 09:09:04 +01:00
Le Wang 8d22b11978 org-src: Fix org-edit-src-code for empty blocks and block with just an empty line
* lisp/org-src.el (org-edit-src-code): Use marker with insertion type
t to track end and remove hack requiring delete from beg to (1- end).
2012-11-30 14:19:27 +01:00
Le Wang d22e732d7a org-src.el (org-edit-src-exit): Fix editing source section with blank lines
* org-src.el (org-edit-src-exit): Fix editing source section
with blank lines.

TINYCHANGE

This bug was introduced by commit aba9e2b9.
2012-10-29 06:37:41 +01:00
Bastien Guerry aba9e2b94d org-src.el (org-edit-src-exit): Fix bug when saving an empty source buffer
* org-src.el (org-edit-src-exit): Fix bug when saving an empty
source buffer.

Thanks to Hsiu-Khuern Tang for reporting this.
2012-10-25 10:48:33 +02:00
Nicolas Goaziou fac86b03fe Normalize comma-escaping of src-blocks and example-blocks
* lisp/org-src.el (org-escape-code-in-string,
  org-unescape-code-in-string, org-escape-code-in-region,
  org-unescape-code-in-region): New functions.
(org-edit-src-code, org-edit-src-exit): Use new functions.
* lisp/org.el (org-strip-protective-commas): Removed function.
* lisp/org-exp.el (org-export-select-backend-specific-text): Use new
  function.
* lisp/ob.el (org-babel-parse-src-block-match,
  org-babel-parse-inline-src-block-match, org-babel-insert-result):
  Always escape produced blocks, independently on the language of the
  block, if any.  Use new functions.
* doc/org.texi: Update documentation.
* testing/lisp/test-ob.el: Update test.
2012-10-01 21:24:00 +02:00
Eric Schulte 7a06ed790a marginally less hacky comma escaping of org blocks
* ob.el (org-babel-insert-result): Replace key sequence with
  function call.  Use a more informative flag to the local function.
  (org-add-protective-commas): Declare a new external function.
* org-src.el (org-add-protective-commas): This should be its own
  function.
  (org-edit-src-exit): Use the new function.
2012-09-29 08:12:26 +02:00
Bastien Guerry da606d8aaa org-src.el: Fix commit e279e9 2012-09-29 07:21:12 +02:00
Bastien Guerry 468a73ea11 org-src.el: Fix bug about C-c C-s'ing in the source editing window
* org-src.el (org-edit-src-code, org-edit-src-exit): Fix bug
about saving the source editing window with the default value
for `org-src-window-setup' (i.e. 'reorganize-frame).
2012-09-27 23:45:34 +02:00
Bastien Guerry e279e98e77 org-src.el (org-src-font-lock-fontify-block): Fix bug: don't fontify the last character
* org-src.el (org-src-font-lock-fontify-block): Fix bug: don't
fontify the last character.
2012-09-27 23:40:28 +02:00
Bastien Guerry 70dd1196d2 Massive code clean-up.
Delete trailing whitespaces.
Indent all sexps correctly.
Sentences end with double spaces.
2012-08-11 19:10:44 +02:00