Commit Graph

427 Commits

Author SHA1 Message Date
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
Bastien Guerry afe5eb140e Fix some docstrings format.
* org-src.el (org-edit-src-code): Fix docstring formatting.

* ob.el (org-babel-do-key-sequence-in-edit-buffer): Ditto.
2012-07-11 19:33:29 +02:00
Bastien Guerry dadc199491 org-src.el: Fix some typos in docstrings.
* org-src.el (org-src-font-lock-fontify-block)
(org-src-strip-leading-and-trailing-blank-lines)
(org-src-ask-before-returning-to-edit-buffer)
(org-edit-src-code, org-edit-src-continue)
(org-edit-fixed-width-region)
(org-src-do-key-sequence-at-code-block)
(org-src-font-lock-fontify-block, org-src-fontify-buffer): Fix
typos in docstrings.
2012-07-11 18:36:22 +02:00
Bastien Guerry d5c0af72cf Use (derived-mode-p 'org-mode) instead of (eq major-mode 'org-mode).
* org.el (org-show-hierarchy-above, org-cycle)
(org-global-cycle, org-files-list, org-store-link)
(org-link-search, org-open-file, org-display-outline-path)
(org-refile-get-location, org-update-all-dblocks)
(org-change-tag-in-region, org-entry-properties)
(org-save-all-org-buffers, org-revert-all-org-buffers)
(org-buffer-list, org-cdlatex-mode)
(org-install-agenda-files-menu, org-end-of-subtree)
(org-speedbar-set-agenda-restriction): Use (derived-mode-p
'org-mode) instead of (eq major-mode 'org-mode).

* org-timer.el (org-timer-set-timer): Ditto.

* org-table.el (orgtbl-mode, org-table-align, orgtbl-mode): Ditto.

* org-src.el (org-edit-src-exit, org-edit-src-code)
(org-edit-fixed-width-region, org-edit-src-exit): Ditto.

* org-remember.el (org-remember-handler): Ditto.

* org-mouse.el (dnd-open-file, org-mouse-insert-item): Ditto.

* org-macs.el (org-get-limited-outline-regexp): Ditto.

* org-lparse.el (org-replace-region-by): Ditto.

* org-latex.el (org-latex-to-pdf-process)
(org-replace-region-by-latex): Ditto.

* org-indent.el (org-indent-indent-buffer): Ditto.

* org-id.el (org-id-store-link, org-id-update-id-locations)
(org-id-store-link): Ditto.

* org-html.el (org-export-html-preprocess)
(org-replace-region-by-html): Ditto.

* org-footnote.el (org-footnote-normalize)
(org-footnote-goto-definition)
(org-footnote-create-definition, org-footnote-normalize): Ditto.

* org-docbook.el (org-replace-region-by-docbook): Ditto.

* org-ctags.el (find-tag): Ditto.

* org-colview.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.

* org-colview-xemacs.el (org-columns-redo)
(org-columns-display-here, org-columns-edit-value)
(org-columns-redo): Ditto.

* org-capture.el (org-capture-insert-template-here)
(org-capture, org-capture-finalize)
(org-capture-set-target-location)
(org-capture-insert-template-here): Ditto.

* org-ascii.el (org-replace-region-by-ascii):  Ditto.

* org-archive.el (org-archive-subtree): Ditto.

* org-agenda.el (org-agenda)
(org-agenda-get-restriction-and-command)
(org-agenda-get-some-entry-text, org-search-view)
(org-tags-view, org-agenda-get-day-entries)
(org-agenda-format-item, org-agenda-goto, org-agenda-kill)
(org-agenda-archive-with, org-agenda-switch-to): Ditto.
2012-04-21 00:43:16 +02:00
Bastien Guerry 44bf4de900 Merge branch 'hotfix-7.8.06'
Conflicts:
	lisp/org-agenda.el
2012-03-20 13:06:26 +01:00
Bastien Guerry fc717f3eb7 Fix compiler warnings. 2012-03-20 13:04:55 +01:00
Bastien Guerry 3982ce5f6c Merge branch 'hotfix-7.8.06' 2012-03-20 03:03:43 +01:00
Suvayu Ali 526cac1776 Change let bind to a let* in org-edit-src-code
* org-src.el (org-edit-src-code): Change let bind to let*,
          e.g. if case-fold-search is bound to nil globally, the
          (case-fold-search t) doesn't work until we get to the body.

	  The fix and analysis was provided by Nick Dokos on this
          email message thread:
          <http://thread.gmane.org/gmane.emacs.orgmode/53335/focus=53342>

	  TINY CHANGE
2012-03-20 03:03:32 +01:00
Bastien Guerry ecd0562c5f Fix the master branch.
I started from the 78ec8e commit then cherry-picked and squashed
commits that have been done in master since then, except the bad
commits that overwrote the tree (in master) with the tree in maint.

This commit also bumps the version number to 7.8.06.

The only "fix" that was made between 78ec8e and the previous commit
is e0072f which has been reported to break stuff.
2012-03-19 22:01:29 +01:00
Bastien Guerry 6e306f65ff Fix copyright years in maint. 2012-03-17 16:31:04 +01:00
Bastien Guerry de42649f7b Manually revert maint to e85080.
e85080 is the last correct commit in the maint branch
before releasing 7.8.04.  The 7.8.05 release should be
done from this commit.
2012-03-17 16:28:46 +01:00
Bastien Guerry 73bb18ba37 Manually revert to the Release 7.8.04 tag. 2012-03-17 15:52:24 +01:00
Bastien Guerry 38c5045725 Fix copyright years. 2012-03-17 14:36:25 +01:00
Bastien Guerry 6e534f9c61 Manually revert back to commit e85080.
This fixes a wrong merge that should not have happened:
commit 7e903a merges the master branch into the maint branch,
while we really want to keep the maint branch a bugfix-only
branch.

This commit reverts back the maint branch to its state before
merging the master branch.  From there, we will fix remaining
problems with the maint branch (e.g. copyright issues) then
release this maint branch as Org-mode 7.8.05.
2012-03-17 14:34:01 +01:00
Bastien Guerry 95e318ae06 Merge branch 'maint' 2012-03-16 19:39:36 +01:00
Bastien Guerry ce8b0963db Correctly match source block edit buffers.
* org-src.el (org-src-edit-buffer-p): New function.

* org.el (org-store-link): Use the new function to correctly
match source code buffer.

TINYCHANGE

Thanks to Ilya Shlyakhter for this patch.
2012-03-16 19:24:24 +01:00
Ilya Shlyakhter de4ba0d4cd Fixed compiler warnings, including one small bug in ob-lilypond
* lisp/ob-lilypond.el (ly-compile-lilyfile): Fixed misplaced comma in a
quoting expression.

* lisp/org-pcomplete.el: added missing defvar definitions for org vars

* lisp/org-src.el: added declare-function line for org-babel-tangle

* lisp/ob.el (org-scan-tags): protected the variable tags-list with a let
(other) added missing defvar declarations.

TINYCHANGE
2012-03-16 10:48:31 -04:00
Eric Schulte 07ac15ef72 Merge branch 'origin-maint'
Conflicts:
	lisp/org-src.el
2012-03-14 09:56:52 -04:00
Eric Schulte 4542824f2c fix compiler warnings
* lisp/ob.el (org-strip-protective-commas): Declared.
* lisp/org-agenda.el (org-agenda-filtered-by-category): Declared.
  (org-agenda-filter-apply): Capture free variable.
* lisp/org-footnote.el (org-skip-whitespace): Declared.
* lisp/org-mobile.el (org-agenda-filter): Declared.
* lisp/org-src.el (org-strip-protective-commas): Declared.
2012-03-14 09:55:04 -04:00
Eric Schulte 5a24348778 Merge branch 'origin-maint' 2012-02-18 10:39:04 -07:00
Eric Schulte 19f1bf6bce unified stripping of protective commas -- idempotent org-edit-src-code
* lisp/ob.el (org-babel-strip-protective-commas): Use
  `org-strip-protective-commas'.
* lisp/org-exp.el (org-export-select-backend-specific-text): Use
  `org-strip-protective-commas'.
* lisp/org-src.el (org-edit-src-code): Use
  `org-strip-protective-commas'.
* lisp/org.el (org-strip-protective-commas): Single definition for
  this functionality.
2012-02-18 10:38:32 -07:00
Eric Schulte 5935b59698 Rebinding org-edit-src-save in the org-src-mode-map.
* lisp/org-src.el (org-src-mode-map): Rebinding org-edit-src-save in
  the org-src-mode-map.
2012-02-18 08:08:24 -07:00
Bastien Guerry 04971de4b9 Add version tag "24.1" for options introduced since Emacs 23.4 (and <= 24.1)
* org-exp.el (org-export-kill-product-buffer-when-displayed)
(org-export-initial-scope, org-export-date-timestamp-format)
(org-export-with-tasks, org-export-email-info)
(org-export-table-remove-empty-lines): Add version tag.

* org-mobile.el (org-mobile-files-exclude-regexp)
(org-mobile-use-encryption, org-mobile-encryption-tempfile)
(org-mobile-encryption-password, org-mobile-agendas): Add
version tag.

* ob-plantuml.el (org-plantuml-jar-path): Add version tag.

* org.el (org-babel-load-languages, org-clone-delete-id)
(org-log-buffer-setup-hook)
(org-loop-over-headlines-in-active-region)
(org-use-sub-superscripts, org-startup-with-beamer-mode)
(org-startup-with-inline-images, org-ctrl-k-protect-subtree)
(org-catch-invisible-edits)
(org-link-search-must-match-exact-headline)
(org-confirm-shell-link-not-regexp)
(org-confirm-elisp-link-not-regexp, org-log-refile)
(org-refile-use-cache)
(org-refile-active-region-within-subtree)
(org-todo-repeat-to-state, org-get-priority-function)
(org-agenda-jump-prefer-future)
(org-read-date-force-compatible-dates)
(org-use-effective-time)
(org-complete-tags-always-offer-all-agenda-tags)
(org-properties-postprocess-alist)
(org-format-latex-signal-error)
(org-latex-to-mathml-jar-file)
(org-latex-to-mathml-convert-command)
(org-export-latex-default-packages-alist)
(org-hidden-keywords, org-pretty-entities)
(org-pretty-entities-include-sub-superscripts)
(org-src-fontify-natively, org-effort-durations)
(org-speed-command-hook): Add version tag.

* org-html.el (org-export-html-footnote-separator)
(org-export-html-mathjax-options)
(org-export-html-mathjax-template)
(org-export-html-headline-anchor-format)
(org-export-html-preamble-format)
(org-export-html-postamble-format)
(org-export-html-table-align-individual-fields)
(org-export-html-protect-char-alist, org-export-html-divs):
Add version tag.

* org-ctags.el (org-ctags-path-to-ctags)
(org-ctags-open-link-functions)
(org-ctags-new-topic-template): Add version tag.

* ob-exp.el (org-export-babel-evaluate): Add version tag.

* org-beamer.el (org-beamer-use-parts)
(org-beamer-frame-level, org-beamer-frame-default-options)
(org-beamer-column-view-format, org-beamer-themes)
(org-beamer-environments-extra, org-beamer-fragile-re)
(org-beamer-outline-frame-title)
(org-beamer-outline-frame-options): Add version tag.

* org-wl.el (org-wl-link-remove-filter)
(org-wl-shimbun-prefer-web-links)
(org-wl-nntp-prefer-web-links, org-wl-disable-folder-check)
(org-wl-namazu-default-index): Add version tag.

* org-clock.el (org-task-overrun-text)
(org-clocktable-defaults, org-clock-clocktable-formatter)
(org-clock-clocktable-language-setup)
(org-clock-report-include-clocking-task)
(org-clock-resolve-expert): Add version tag.

* ob-lob.el (org-babel-lob-files): Add version tag.

* org-freemind.el (org-freemind-node-css-style): Add version
tag.

* org-archive.el (org-archive-reversed-order)
(org-archive-subtree-add-inherited-tags): Add version tag.

* org-bibtex.el (org-bibtex-autogen-keys, org-bibtex-prefix)
(org-bibtex-treat-headline-as-title)
(org-bibtex-export-arbitrary-fields)
(org-bibtex-key-property, org-bibtex-tags)
(org-bibtex-tags-are-keywords, org-bibtex-no-export-tags)
(org-bibtex-type-property-name): Add version tag.

* org-timer.el (org-timer-default-timer): Add version tag.

* org-taskjuggler.el (org-export-taskjuggler-extension)
(org-export-taskjuggler-project-tag)
(org-export-taskjuggler-resource-tag)
(org-export-taskjuggler-target-version)
(org-export-taskjuggler-default-project-version)
(org-export-taskjuggler-default-project-duration)
(org-export-taskjuggler-default-reports)
(org-export-taskjuggler-default-global-properties): Add
version tag.

* org-habit.el (org-habit-today-glyph)
(org-habit-completed-glyph): Add version tag.

* org-list.el (org-alphabetical-lists)
(org-list-ending-method, org-list-end-regexp)
(org-list-automatic-rules, org-list-use-circular-motion)
(org-list-indent-offset): Add version tag.

* ob-picolisp.el (org-babel-picolisp-cmd): Add version tag.

* org-icalendar.el (org-icalendar-alarm-time)
(org-icalendar-combined-description)
(org-icalendar-honor-noexport-tag)
(org-icalendar-date-time-format): Add version tag.

* org-src.el (org-src-tab-acts-natively): Add version tag.

* org-exp-blocks.el (org-export-blocks-postblock-hook): Add
version tag.

* org-table.el (org-table-exit-follow-field-mode-when-leaving-table)
(org-table-fix-formulas-confirm)
(org-table-duration-custom-format)
(org-table-formula-field-format): Add version tag.

* org-publish.el (org-publish-sitemap-sort-files)
(org-publish-sitemap-sort-folders)
(org-publish-sitemap-sort-ignore-case)
(org-publish-sitemap-date-format)
(org-publish-sitemap-file-entry-format): Add version tag.

* ob-js.el (org-babel-js-cmd): Add version tag.

* org-docbook.el (org-export-docbook-footnote-separator)
(org-export-docbook-xslt-stylesheet): Add version tag.

* org-entities.el (org-entities-ascii-explanatory)
(org-entities-user): Add version tag.

* ob.el (org-confirm-babel-evaluate)
(org-babel-no-eval-on-ctrl-c-ctrl-c): Add version tag.

* ob-tangle.el (org-babel-tangle-lang-exts)
(org-babel-post-tangle-hook, org-babel-pre-tangle-hook)
(org-babel-tangle-body-hook)
(org-babel-tangle-comment-format-beg)
(org-babel-tangle-comment-format-end)
(org-babel-process-comment-text): Add version tag.

* org-gnus.el (org-gnus-nnimap-query-article-no-from-file):
Add version tag.

* org-crypt.el (org-crypt-disable-auto-save): Add version tag.

* org-inlinetask.el (org-inlinetask-default-state): Add
version tag.

* ob-scheme.el (org-babel-scheme-cmd): Add version tag.

* ob-lisp.el (org-babel-lisp-dir-fmt): Add version tag.

* org-attach.el (org-attach-store-link-p): Add version tag.

* org-capture.el (org-capture-templates)
(org-capture-before-finalize-hook)
(org-capture-after-finalize-hook): Add version tag.

* org-agenda.el (org-agenda-skip-deadline-prewarning-if-scheduled)
(org-agenda-time-leading-zero, org-agenda-follow-indirect)
(org-agenda-menu-two-column, org-agenda-menu-show-matcher)
(org-agenda-timegrid-use-ampm)
(org-agenda-remove-timeranges-from-blocks)
(org-agenda-inactive-leader, org-agenda-current-time-string)
(org-agenda-show-current-time-in-grid)
(org-agenda-search-view-force-full-words)
(org-agenda-search-view-always-boolean)
(org-agenda-clock-consistency-checks)
(org-agenda-include-deadlines)
(org-agenda-move-date-from-past-immediately-to-today)
(org-agenda-day-face-function)
(org-agenda-category-icon-alist)
(org-agenda-bulk-custom-functions)
(org-agenda-insert-diary-extract-time): Add version tag.

* org-latex.el (org-export-latex-inputenc-alist)
(org-export-latex-tag-markup)
(org-export-latex-timestamp-inactive-markup)
(org-export-latex-href-format)
(org-export-latex-hyperref-format)
(org-export-latex-footnote-separator)
(org-export-latex-quotes)
(org-export-latex-table-caption-above)
(org-export-latex-listings-w-names)
(org-export-latex-minted-langs)
(org-export-latex-listings-options)
(org-export-latex-minted-options)
(org-latex-default-figure-position, org-export-pdf-logfiles):
Add version tag.

* org-faces.el (org-faces-easy-properties)
(org-fontify-quote-and-verse-blocks, org-cycle-level-faces):
Add version tag.

* ob-ditaa.el (org-ditaa-jar-option): Add version tag.

Thanks to Glenn Morris for reporting this.
2012-02-13 15:49:28 +01:00
Bastien Guerry 314bd75c13 org-src.el: Make sure `buffer-file-name' is always nil.
* org-src.el (org-edit-src-code): Make sure `buffer-file-name'
is always nil.

Thanks to Leo Alekseyev in hunting this down.
2012-01-24 16:23:34 +01:00
Bastien Guerry cc7acb65ff org-src.el: Save and restore `buffer-undo-list' after editing.
* org-src.el (org-src-in-org-buffer): Save and restore
`buffer-undo-list' after editing.

Thanks to Peter Danenberg for this fix.
2012-01-24 14:59:54 +01:00
Eric Schulte 10f26fb805 Merge branch 'origin-maint' 2012-01-20 12:00:31 -07:00
Litvinov Sergey f92facd890 Map "screen" to shell-script-mode 2012-01-20 11:47:13 -07:00
Eric Schulte 5852cf7fbf tangle the parent buffer of a code edit buffer
* lisp/org-src.el (org-src-in-org-buffer): Run commands in the parent
  buffer.
  (org-edit-src-save): Use new macro.
  (org-src-tangle): Tangle the parent buffer.
2012-01-20 11:00:46 -07:00
Eric Schulte e796c91b60 Merge branch 'origin-maint' 2012-01-12 07:47:53 -07:00
Eric Schulte d9f53f17f2 Referenced code block should not be evaluated on code block edit
* lisp/org-src.el (org-edit-src-code): Referenced code block should
  not be evaluated on code block edit.
2012-01-12 07:47:30 -07:00
Bastien Guerry f6d7b32bf2 Fix trailing whitespaces. 2012-01-04 16:20:04 +01:00
Bastien Guerry e44d2975ff Fix copyright (to 2012) year and Org version (to 7.8.03). 2012-01-03 18:47:01 +01:00
Bastien Guerry 4d10c36e2b * org-src.el (org-edit-src-code): Fix typo-bug.
This is leftover from Tassilo's previous patch applied today.
2011-10-22 15:26:36 +02:00
Tassilo Horn 4bbdfd229d Replace org-mode-p with usual (eq major-mode 'org-mode) check
Additionally, replace one

  (or (org-mode-p) (derived-mode-p 'org-mode))

with

  (derived-mode-p 'org-mode)

cause that is reflexive anyway (returns true, if the current mode is
org-mode).

Delete one check testing for org-mode or org derived mode
2011-10-22 11:29:24 +02:00
Bastien Guerry 58f1dbccf8 Remove the "Version" header in Org libraries (leave it in org.el).
Also remove blank lines before the ";;; org*el ends here" declarations.

Having a "Version" header forced us to update every file when releasing a
new version of Org; it also forced us to update every file when merging Org
with Emacs trunk, thus cluttering the diffs between the previously merged
version and the new one with useless information.

Glenn Morris suggested this in emacs-devel:
http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00322.html
2011-08-17 14:42:34 +02:00
Bastien Guerry ad23b7d173 Fix bzg email address (s/altern/gnu). 2011-08-15 21:22:30 +02:00
Bastien Guerry 7a18799e25 Remove arch-tag at the bottom of files. 2011-08-15 20:04:38 +02:00
Bastien Guerry 904ed18bc2 Fix copyright years for elisp files in core and contrib.
Also add "This file is not part of GNU Emacs." when this is the case.
2011-08-15 15:23:11 +02:00
David Maus 545bfddeea Provide edebug specifications for macros
* org-macs.el (org-with-gensyms, org-called-interactively-p)
(with-silent-modifications, org-bound-and-true-p)
(org-unmodified, org-re, org-preserve-lc)
(org-without-partial-completion, org-with-point-at)
(org-no-warnings, org-if-unprotected, org-if-unprotected-1)
(org-if-unprotected-at, org-with-remote-undo)
(org-no-read-only, org-save-outline-visibility)
(org-with-wide-buffer, org-with-limited-levels)
(org-eval-in-environment): Provide edebug specifications.
* org-src.el (org-src-do-at-code-block): Dto.
* org-publish.el (org-publish-with-aux-preprocess-maybe): Dto.
* org-compat.el (org-xemacs-without-invisibility): Dto.
* org-clock.el (org-with-clock-position, org-with-clock): Dto.
* org-agenda.el (org-agenda-with-point-at-orig-entry)
(org-batch-agenda, org-batch-agenda-csv)
(org-batch-store-agenda-views): Dto.
* ob.el (org-babel-do-in-edit-buffer)
(org-babel-map-src-blocks, org-babel-map-inline-src-blocks): Dto.
* ob-tangle.el (org-babel-with-temp-filebuffer): Dto.
* ob-table.el (sbe): Dto.
* ob-exp.el (org-babel-exp-in-export-file): Dto.
* ob-comint.el (org-babel-comint-in-buffer)
(org-babel-comint-with-output): Dto.
2011-08-12 08:38:59 +02:00
Sergey Litvinov c0e2351e1a Map "cpp" to c++-mode 2011-08-05 11:32:02 -06:00
emacs 7340cee33a Update website to show 7.7 as current release 2011-07-28 10:33:35 +00:00
Bastien Guerry 5c53026d32 Fix (a lot of) compiler warnings.
Also introduce `org-pop-to-buffer-same-window' as a compatibility
function for Emacs =>24.1.
2011-07-18 19:25:10 +02:00
Bastien Guerry 9c05a7c781 Bump to version 7.6 2011-07-06 21:06:03 +02:00
Dan Davison 4f3a31dd97 Fix a bug in in-buffer src fontification
* lisp/org-src.el: Append a space character to copied text so that the
                   final text property change is picked up correctly
2011-06-17 16:51:29 -07:00
Eric Schulte 94b325839c Replacing '(λ...) with #'(λ...).
* lisp/org-ascii.el (org-export-as-ascii): Replacing '(λ...) with #'(λ...).
* lisp/org-attach.el: Replacing '(λ...) with #'(λ...).
  (org-attach-commit): Replacing '(λ...) with #'(λ...).
* lisp/org-exp.el: Replacing '(λ...) with #'(λ...).
  (org-export-handle-include-files): Replacing '(λ...) with #'(λ...).
* lisp/org-html.el: Replacing '(λ...) with #'(λ...).
  (org-export-as-html): Replacing '(λ...) with #'(λ...).
* lisp/org-mouse.el: Replacing '(λ...) with #'(λ...).
  (org-mouse-popup-global-menu): Replacing '(λ...) with
  (org-mode-hook): Replacing '(λ...) with #'(λ...).
  (org-agenda-mode-hook): Replacing '(λ...) with #'(λ...).
* #'(λ...).Replacing '(λ...) with #'(λ...).
  (org-mouse-context-menu): Replacing '(λ...) with #'(λ...).
* lisp/org-src.el: Replacing '(λ...) with #'(λ...).
  (org-src-mode-configure-edit-buffer): Replacing '(λ...) with #'(λ...).
* lisp/org-table.el: Replacing '(λ...) with #'(λ...).
  (org-table-fix-formulas-confirm): Replacing '(λ...) with #'(λ...).
* lisp/org.el: Replacing '(λ...) with #'(λ...).
  (org-confirm-shell-link-function): Replacing '(λ...) with
  (org-category): Replacing '(λ...) with #'(λ...).
* #'(λ...).Replacing '(λ...) with #'(λ...).
  (org-time-stamp-rounding-minutes): Replacing '(λ...) with #'(λ...).
2011-06-14 12:01:04 -07:00
Eric Schulte 1997e19bd5 org-src-lang-modes: added alias "C" to "c"
* lisp/org-src.el (org-src-lang-modes): Added a language alias of "C"
  to "c".
2011-04-15 10:16:52 -06:00
Eric Schulte 30931bfe1d edit-prep: language specific src-edit buffer preparation, with R session association
* lisp/ob-R.el (org-babel-edit-prep:R): Associate the appropriate R
  process with the edit buffer when :session is specified.

* lisp/org-src.el (org-edit-src-code): Allow language-specific
  edit-buffer preparation by calling the org-babel-edit-prep:lang
  function when it is defined.
2011-04-02 11:46:08 -06:00
emacs 11a10bdfe7 Update website to show 7.5 as current release 2011-03-07 14:27:39 +00:00
Bastien Guerry 846a2d13d3 Code cleanup: use (org-mode-p) when possible. 2011-02-15 05:18:22 +01:00
Bastien Guerry a923f528cd org-src.el: allow source editing from modes derived from Org.
* org-src.el (org-edit-src-code): allow to edit source code
from modes derived from Org.
2011-02-15 05:04:22 +01:00
Dan Davison 10f5ac643d Reorganize org-edit-src-code; allow buffer-local `org-edit-src-content-indentation'
* lisp/org-src.el (org-edit-src-code): When generating the code edit
buffer, it is necessary for several variables to inherit their values
from the parent org buffer. These changes collect all such variables
together into a single association list of (variable-name value)
pairs. In addition, a new variable is added to the list:
`org-edit-src-content-indentation'. This has the effect that a buffer
local value can be used for that variable.
2011-02-13 11:00:17 +00:00
Dan Davison bbb28d5bf8 Get rid of extra help message when editing src code
* lisp/org-src.el (org-edit-src-persistent-message): Change docstring.
(org-edit-src-code): Get rid of help message in echo area.
* lisp/ob.el (org-babel-do-in-edit-buffer): Do not pass 'quietly
argument to org-edit-src-code as this has been removed
2011-02-01 11:44:32 +00:00
Dan Davison 7fa375d632 Avoid errors during fontification of src blocks.
* lisp/org-src.el (org-src-font-lock-fontify-block): Test, early on,
that a major-mode function corresponding to the language string
exists.

Thanks to Bernt Hansen for the report and investigation.
2010-12-22 11:50:42 +00:00
Carsten Dominik 7666ba421f Version number back to 7.4 2010-12-10 18:49:40 +01:00
Carsten Dominik 76a25715c9 Bump version number to 7.5 2010-12-10 18:43:10 +01:00
Dan Davison 9db0d7e20b Tweak condition for src buffer to inherit active region.
* lisp/org-src.el (org-edit-src-code): Allow region to be inherited by
edit buffer when mark is one character beyond end of src block.

Thanks to Jambunathan K. for the bug report:

 C-c C-v C-M-h and C-c C-v C-x interaction

   In the block below do

   1. C-c C-v C-M-h, C-c C-v C-x C-M-\
   2. Mark (just) the code-block with C-SPC etc etc. C-c C-v C-x C-M-\

   See the difference in behaviour.

<text:p text:style-name="Standard">This is a xref to
<text:bookmark-ref text:reference-format="text"
text:ref-name="__RefHeading__1669_1684552201">Heading8
</text:bookmark-ref>.</text:p>

I have transient mark mode on.
2010-11-19 23:32:30 +00:00
Bastien Guerry 6630edbd0f Set version number to 7.3 2010-11-07 14:52:14 +01:00
Eric Schulte 598be4a4a4 ob-calc: added to org-src-lang-modes, safer evaluation, better error messages
* lisp/ob-calc.el (org-babel-execute:calc): safer evaluation and
  hopefully better error messages

* lisp/org-src.el (org-src-lang-modes): mapping calc blocks to
  fundamental mode
2010-10-29 19:18:28 -06:00
Carsten Dominik 82af72eef7 Push version number to 7.02trans 2010-10-29 09:11:46 +02:00
Dan Davison 60423d2805 Avoid resolving babel references with C-c '
* org-src.el (org-edit-src-code): Supply non-nil argument to
	`org-babel-get-src-block-info' to avoid resolving variable
	references
2010-10-21 13:06:56 +01:00
Carsten Dominik 5014288b68 Fix Emacs 22 compatibility
* lisp/org-src.el (org-edit-src-code): Use `org-region-active-p'.
2010-10-12 17:51:31 +02:00
Dan Davison 9c211df6ae Don't move point when generating org-src edit buffer
* org-src.el (org-edit-src-code): Don't move point when
	generating edit buffer
2010-09-30 11:43:55 +01:00
Dan Davison 940ab32aa8 Adjustment of location of point when generating org-src edit buffer
* org-src.el (org-edit-src-code): Deal with point being in #+end_src line
2010-09-30 11:43:55 +01:00
Dan Davison 1923c54502 Add customize interface for `org-src-tab-acts-natively'
* org-src.el (org-src-tab-acts-natively): Add customize interface
2010-09-21 15:17:01 +01:00
Dan Davison ca4391f9b5 Provide control over stripping of leading/trailing blank lines from code blocks
* org-src.el (org-src-strip-leading-and-trailing-blank-lines):
    New variable allowing prevention of automatic stripping of
    leading and trailing blank lines when exiting edit buffer.
    (org-edit-src-exit): Respect value of
    `org-src-strip-leading-and-trailing-blank-lines'
    (org-src-native-tab-command-maybe): Bind
    `org-src-strip-leading-and-trailing-blank-lines' to nil during
    this function.
2010-09-21 15:02:33 +01:00
Dan Davison 92249cffb0 Transmit active region from Org buffer to code edit buffer
* org-src.el (org-edit-src-code): If mark was inside code
    block then code edit buffer inherits mark with active region.
2010-09-21 15:02:33 +01:00
Eric Schulte 2a688e9aeb Explicitly mention when a language-mode throws an error
Hi,

The attached patch makes it clear when a language mode has thrown an
error.  This can clear up confusion whether an error is originating from
Org-mode or form the language-mode in question.

Should this be committed?

Best -- Eric
2010-09-14 14:03:15 +02:00
Dan Davison 0d5791e7b7 Allow language-native TAB command in code blocks.
* org-src.el (org-src-tab-indents-natively): New variable controlling
    whether language-native TAB action should be performed
    (org-src-native-tab-command-maybe): New function to perform
    language-native TAB action.
    (org-tab-first-hook): Add `org-src-native-tab-command-maybe'
2010-09-02 11:57:03 -07:00
Dan Davison abfc2cc30e Re-use hidden language major mode buffers during code fontification
* org-src.el (org-src-font-lock-fontify-block): Re-use hidden
	language major mode buffers during fontification
2010-09-02 08:13:13 -07:00
Dan Davison 73957b8fbf Fontify code in code blocks.
* org.el (org-fontify-meta-lines-and-blocks): Alter main
    regexp to match code blocks with switches and header
    args. Call `org-src-font-lock-fontify-block' for automatic
    fontification of code in code blocks, controlled by variable
    `org-src-fontify-natively'.
    (org-src-fontify-natively): New variable

    * org-src.el (org-src-font-lock-fontify-block): New function
    called during font-lock
    (org-src-fontify-block): New function for manual fontification
    of code block at point.
    (org-src-fontify-buffer): New function to manually fontify all
    code blocks in buffer
    (org-src-get-lang-mode): New utility function to map language
    name as a string to major mode symbol

Based on an initial fontification patch by David O'Toole and
suggestions from Carsten Dominik.
2010-09-02 08:12:58 -07:00
Dan Davison 49d63185cc babel: Docstring improvement
* org-src.el (org-edit-src-code): Improve docstring

Patch from Richard Riley
2010-09-01 21:16:15 -07:00
Dan Davison 4ac8294020 Avoid error and unnecessary message in transient use of code edit buffer
* ob.el (org-babel-do-in-edit-buffer): Suppress message and
	check that org-src buffer is current before attempting exit

	* org-src.el (org-edit-src-code): New argument quietlyp allows
	message to be suppressed
2010-08-17 23:40:53 -04:00
Dan Davison 76790e1aa8 Get rid of some compiler warnings.
* org-src.el (ob-comint): require 'ob-comint
	(org-src-babel-info): define variable

Also, reposition `org-src-do-at-code-block' and
`org-src-do-key-sequence-at-code-block' function definitions within
the file.
2010-08-17 22:37:19 -04:00
Dan Davison f9cecd192d Make language major mode commands available at Org code blocks.
* ob.el (org-babel-do-in-edit-buffer): New macro to
    evaluate lisp in the language major mode edit buffer.
    (org-babel-do-key-sequence-in-edit-buffer): New function to call
    an arbitrary key sequence in the language major mode edit
    buffer
    * org-src.el (org-src-switch-to-buffer): Add new allowed value
    'switch-invisibly for `org-src-window-setup'.

    * ob-keys.el (org-babel-key-bindings): Bind
    `org-babel-do-key-sequence-in-edit-buffer' to x and C-x in
    `org-babel-map'
2010-08-17 17:46:04 -04:00
Dan Davison 441288ee72 Make Org-babel commands available in code edit buffers
* org-src.el (ob-keys): Require ob-keys, because
    `org-babel-map' is used.
    (org-src-do-at-code-block): New macro to evaluate lisp with
    point at the start of the Org code block containing the code
    in this edit buffer.
    (org-src-do-key-sequence-at-code-block): New function to
    execute command bound to key at the Org code block containing
    the code in this edit buffer.
2010-08-17 17:45:47 -04:00
Dan Davison b61e0c4dfc Associate code edit buffer with babel comint session, if one exists.
* org-src.el (org-edit-src-code): If at src block, store babel
	info as buffer local variable.
	(org-src-associate-babel-session): New function to associate
	code edit buffer with comint session. Does nothing
	unless a language-specific function named
	`org-babel-LANG-associate-session' exists.
	(org-src-babel-configure-edit-buffer): New function to be
	called in `org-src-mode-hook'.
	(org-src-mode-hook): add `org-src-babel-configure-edit-buffer'
	to hook.
2010-08-17 17:32:23 -04:00
Carsten Dominik 6268cceec3 Mention release 7.01 on the website, push release number to 7.01trans 2010-07-19 08:33:24 +02:00
Philip Rooke 6e6790f685 Correct some doc strings [part 5]
This is the fifth patch in a series that makes some straightforward
corrections to a number of docstrings.  Each change is normally to:

- correct a typo, or
- fix up hyperlinks to function or variable names, or
- ensure slightly better conformance with the documentation guidelines
  and tips given in the Elisp manual

No attempt is made to provide missing docstrings or document arguments.

Cheers,

Phil
2010-07-18 07:23:51 +02:00
Eric Schulte 869082e5fd added sqlite -> sql-mode mapping to org-src-lang-modes
* lisp/org-src.el (org-src-lang-modes): added sqlite to sql-mode
2010-07-07 12:40:43 -07:00
Dan Davison cab9fefbf9 Read-only src buffers
Carsten Dominik <dominik@uva.nl> writes:

> Hi Dan,
>
> after a long time, I tried to edit a fixed width region today.
> So I entered
>
>  : a
>  : b
>  : c
>
> and pressed "C-c '" in there.  The edit buffer came up in
> read-only mode, which should not be so.
>
> Also, when I do "C-c '" in an empty line, it used to be the case
> that I get an empty artist buffer which I can then edit.  Also this
> buffer comes up as read-only.
>
> I suspect that this has to do with the changes you made for read-only
> view buffers.  Before I dive into this issue myself, maybe it will be
> much
> easier if you do this?

Hi Carsten,

You're right that it dates from then. Here's the fix I suggest. I've
tested that this results in writable fixed-width edit buffers, writable
src edit buffers, and non-writable babel preview buffers.

Dan

--8<---------------cut here---------------start------------->8---
commit ed4eb9d150
Author: Dan Davison <davison@stats.ox.ac.uk>
Date:   Sat Jun 5 12:35:19 2010 +0100

    * lisp/org-src.el: Prevent fixed-width region edit buffers
    being created as read-only.

	Modified lisp/org-src.el
2010-06-05 14:31:35 +02:00
Michael Sperber 67b5a92c78 Fix org-src saving mechanism for XEmacs
write-contents-hooks is not buffer-local by default in XEmacs 21.4.
2010-05-24 09:20:23 -04:00
Carsten Dominik c86a3fc4aa Push version number to 6.36trans 2010-05-09 06:24:20 +02:00
Carsten Dominik 88100d1580 Release 6.36a 2010-05-09 06:13:54 +02:00
Carsten Dominik f5cffa89ef Minor fixes 2010-05-08 09:25:47 +02:00
Dan Davison b1f1cdda40 Correct free variable error in org-src.el 2010-05-02 00:57:30 -04:00
Dan Davison 182b107682 Correct coderef switch in docstring 2010-04-30 22:53:53 -04:00
Dan Davison 02e557745f org-src: different message in read-only mode 2010-04-23 10:10:01 -06:00
Dan Davison d1b8b347fe Allow org-src edit buffer to be used in read-only mode
org-edit-src-code gains extra optional arguments `code' and
`edit-buffer-name'. If `code' is supplied, then this code forms the
contents of the edit buffer, which is made read-only. In this case,
the mechanisms for writing back to the org buffer on save are
disabled.

Optional argument `edit-buffer-name' allows a name for the edit buffer
to be supplied.
2010-04-23 10:10:01 -06:00
Carsten Dominik 008dbe15ec Don't mistake ditaa figures for tables
Patch by Dan Davison, after a report by Bernt Hansen.
2010-04-21 09:49:31 +02:00
Carsten Dominik c6ea2a1457 Use overlay-in and overlay-at instead of compatibility functions 2010-04-20 12:17:06 +02:00
Carsten Dominik f45e6a28b1 Use the normal overlay API, not Org's one 2010-04-18 16:49:58 +02:00
Carsten Dominik 43bf1bbbd7 Push version number to 6.35trans 2010-04-15 12:24:55 +02:00
Carsten Dominik 6f3026edf1 Release 6.35g 2010-04-08 20:15:15 +02:00
Carsten Dominik a589c7a22e Release 6.35f 2010-04-08 10:36:32 +02:00
Carsten Dominik 50e5924d8a Release 6.35e 2010-04-07 16:33:52 +02:00
Carsten Dominik f722763f8a Release 6.35d 2010-04-07 16:26:42 +02:00
Carsten Dominik d65ed03be6 Update copyright notices and fix wrong version tags 2010-04-07 16:26:10 +02:00
Carsten Dominik cafbe1d038 Release 6.35c 2010-04-07 08:58:25 +02:00
Carsten Dominik b213c0f31e Release 6.35b 2010-04-07 07:54:14 +02:00
Carsten Dominik 08d0d2fa20 Release 6.35 2010-04-06 09:16:36 +02:00
Carsten Dominik 8fdf80bb5b Fix whitespace and compiler wanings 2010-04-01 13:11:54 +02:00
Dan Davison c0707b1f31 Don't leave point in hidden region after exiting code buffer. 2010-03-23 11:18:04 -04:00
Carsten Dominik 6d1e30828b Re-install the support for table.el tables again.
This support was totally broken.  It works now again.  Unfortunately
it is not possible to edit the table directly in the org-mode buffer
anymore - to edit such a table, you have to use C-c '
2010-02-26 22:33:49 +01:00
Dan Davison 7c686465b5 Widen before exiting edit buffers 2010-02-09 16:10:06 -05:00
Dan Davison 3693a47f85 org-src: Don't remove tabs when org-src-preserve-indentation is non-nil 2010-01-29 10:22:34 -05:00
Carsten Dominik 06e74afce3 Version number to 6.34trans 2010-01-20 10:13:21 +01:00
Carsten Dominik a1709ba641 Release 6.34c 2010-01-18 00:10:11 +01:00
Carsten Dominik 2f2f9441d4 Release 6.34b 2010-01-14 23:06:55 +01:00
Carsten Dominik c077142241 Release 6.34a 2010-01-12 08:53:44 +01:00
Carsten Dominik 288c724335 Release 6.34 2010-01-10 10:57:53 +01:00