Commit Graph

266 Commits

Author SHA1 Message Date
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
Carsten Dominik 275b6627a6 Release 3.34 2010-01-10 10:54:52 +01:00
Carsten Dominik 62a7301a5e Push release number to 6.33trans 2009-11-20 20:20:31 +01:00
Carsten Dominik 24061fddd1 Release 6.33f 2009-11-20 15:15:05 +01:00
Carsten Dominik 37e9b1c51f Release 6.33e 2009-11-20 13:58:31 +01:00
Carsten Dominik 24a49967f1 Release 6.33d 2009-11-20 12:34:50 +01:00
Carsten Dominik c7371cc7fe Push version number to 6.33trans 2009-11-15 09:46:43 +01:00
Carsten Dominik 6bc6379dfe Release 6.33c 2009-11-15 08:00:52 +01:00
Carsten Dominik 6c977c41c3 Release 6.33b 2009-11-14 16:25:31 +01:00
Carsten Dominik b8a6721a68 Release 6.33a 2009-11-13 23:22:18 +01:00
Carsten Dominik 5ca6635993 Push version number to 6.33a 2009-11-13 22:54:22 +01:00
Carsten Dominik 82ee0cc583 Release 6.33 2009-11-13 07:10:51 +01:00
Dan Davison 081ff1ebe3 Avoid altering window configuration when saving edit buffer.
Saving the edit buffer is achieved by calling org-edit-src-exit,
saving the org buffer and returning to the edit buffer with
org-edit-src-code. When those two functions are used in this context,
they should not attempt to restore the saved window configuration, nor
alter the saved window configuration.
2009-11-09 17:05:07 -05:00
Eric Schulte a7543733e2 org-edit-src: now saves window layout when editing source code 2009-11-03 18:36:08 -07:00
Carsten Dominik fd54dd9c66 Add ChangeLog entries for Dan's block indentation commits 2009-11-01 08:43:50 +01:00
Dan Davison d9447ad7b0 Allow code indentation to be preserved on export
This is controlled on a per-block basis with a new src block flag
-i. It can be controlled globally using the variable
org-src-preserve-indentation.
2009-10-31 15:43:42 -04:00
Carsten Dominik 721bf5c3d3 Keep compiler happy 2009-10-29 16:34:33 +01:00
Carsten Dominik 089b5b2ff1 Add ChangeLog for Dan's patch and reformat a docstring 2009-10-27 20:36:24 +01:00
Dan Davison bf89d74325 Provide frame/window control when switching to source code edit buffer.
These changes provides frame / window management preferences for the
edit buffer generated using C-c ' on a source code block. Preferences
are specified by a new variable org-src-window-setup, which is based
on org-agenda-window-setup and has the same four options:
current-window, other-window, reorganize-frame, other-frame. These
behave as follows:

* current-window
The edit buffer appears in the current window.

* other-window
`switch-to-buffer-other-window' is used to switch to the edit buffer
in the same frame.

* reorganize-frame [default]
The current frame is reorganized so that it is split between the
source code edit buffer and the parent org buffer.

* other-frame
The edit buffer appears in a new frame. That frame is deleted when
exiting the edit buffer with C-c '.
2009-10-27 14:18:23 -04:00
Dan Davison a22dba296e Remove redundant line from org-src.el 2009-10-27 14:18:10 -04:00
Dan Davison 8fa55ab87d org-src-mode bug fix
In org-edit-src-save, point and mark were being restored inside the
save-window-excursion. As it happens, although mark is lost, point
nevertheless retained its position with switch-to-buffer being used to
switch between org and edit buffers, as is currently the
case. However, the failure to restore point correctly is exposed if
more complex options controlling window and frame management are
provided for the edit buffer.
2009-10-27 14:18:00 -04:00
Dan Davison 2e20a2eea9 org-src-mode bug fix.
Go straight to edit buffer if
org-src-ask-before-returning-to-edit-buffer is nil
2009-10-27 14:17:51 -04:00
Carsten Dominik 58562167b4 Version number to 6.32trans 2009-10-27 18:23:19 +01:00
Carsten Dominik e0949896f7 Release 6.32b 2009-10-27 18:22:28 +01:00
Carsten Dominik 037b685d50 Push version number to 6.32trans 2009-10-27 09:25:30 +01:00
Carsten Dominik fcd2ef541f Release 6.32 2009-10-26 08:57:21 +01:00
Dan Davison 8bd1eb5d4b Merge commit 'org/master' into ded-org-src 2009-10-15 10:29:23 -04:00
Dan Davison 9592b6f1bd New variable org-src-ask-before-returning-to-edit-buffer
If an active edit buffer exists for a source block, and this variable
is non-nil, then org-edit-src-code will not ask before returning to
the edit buffer, and future saves will overwrite the source block's
contents.
2009-10-14 18:43:25 -04:00
Eric Schulte b0c1758c2a org-babel: dot improvements
for more information on the dot family of tools see
http://www.graphviz.org/
2009-10-14 16:03:40 -06:00
Dan Davison 23b4026937 org-src-mode: maintain relative location of point when lines are protected 2009-10-12 12:13:08 -04:00
Dan Davison 8dff317e33 One docstring improvement and 2 docstring typos. 2009-10-08 12:29:16 -04:00
Dan Davison 8da6520429 Prevent point movement when switching between org and code buffers.
Keep point in the same location relative to surrounding text when
switching between org and code buffers.
2009-10-08 12:29:04 -04:00
Dan Davison d1eacbcbe8 Optionally prevent altering indentation of source code.
New customizable variable org-src-preserve-indentation, if non-nil,
prevents automatic removal of rectangular blocks of leading whitespace
in source code blocks. This is necessary when embedding python code in
an org file with a view to extracting all python blocks into a single
file (because whitespace indentation is critical in python code). The
changes in this commit also fix two bugs:

- Setting org-edit-src-content-indentation to zero resulted in an
  infinite loop in org-edit-src-exit.

- Fixed width regions are defined by lines starting with a colon, with
  optional leading whitespace. However, if there was any leading
  whitespace, org-edit-src-exit behaved incorrectly, causing the leading
  whitespace to grow.
2009-10-08 12:28:53 -04:00
Carsten Dominik e59e619a8f Make "C-c '" also edit #+MACRO definitions, including multiline 2009-10-06 18:42:24 +02:00
Carsten Dominik 6b0a251eea Push version number to 6.31trans 2009-10-01 11:57:17 +02:00
Carsten Dominik 1b37d5e07c Release 6.31a 2009-10-01 09:13:58 +02:00
Carsten Dominik c11e0b44ae Release 6.31 2009-09-30 16:03:17 +02:00
Eric Schulte 8e87868df2 org-babel: asymptote maps to asy-mode in `org-src-lang-modes' and added requirements section to org-babel-asymptote.el 2009-09-16 10:54:43 -06:00
Carsten Dominik 91197ce280 Fix cleaning up Edit Src buffers 2009-09-09 15:06:42 +02:00
Carsten Dominik 25226d7d65 Minor fixes o the edit src code mechanism
Patch by Dan Davison
2009-09-06 07:53:21 +02:00
Carsten Dominik 291a6db848 Release number back to 6.30trans 2009-09-04 10:39:01 +02:00
Carsten Dominik 12ab55ca43 Release 6.30d 2009-09-03 13:53:46 +02:00
Carsten Dominik adfa87282d Push version number to 6.30trans 2009-09-03 08:10:36 +02:00
Carsten Dominik 63e1714288 Release 6.30c 2009-09-02 14:40:56 +02:00
Carsten Dominik fc332703bf Release 6.30b 2009-09-02 11:33:10 +02:00
Carsten Dominik 1d04b205e6 Release 6.30a 2009-09-02 09:00:23 +02:00
Carsten Dominik db70cdb13b Release 6.30 2009-09-01 06:09:23 +02:00
Carsten Dominik 49d54ab90f Fix bug with editing fixed width region 2009-08-31 18:41:06 +02:00
Carsten Dominik ff176db7a8 Add artist as an editing mode for ditaa. 2009-08-28 23:33:04 +02:00
Carsten Dominik 31b0deb4aa Add language abbreviation "elisp" for "emacs-lisp".
Patch by Eric Schulte.
2009-08-28 13:03:12 +02:00
Carsten Dominik 4b6988bf36 Make editing src snippets work better with killing buffers and exiting emacs
Patch by Dan Davison.  For more information, see

   http://thread.gmane.org/gmane.emacs.orgmode/14142/focus=16378
2009-08-28 09:58:20 +02:00
Carsten Dominik 350691164b Avoid calling `goto-line' from lisp programs 2009-08-27 10:24:09 +02:00
Carsten Dominik 0f826c4e87 Fix the definition of org-src-language-modes
Patch by Eric Schulte
2009-08-24 12:25:17 +02:00
Carsten Dominik 5e9fc20394 Allow language names where the major mode name seems unrelated to the language
Eric Schulte writes:

> Attached is a small patch for a small issue.
>
> Sometimes a language uses a major mode which can't be guessed
> from it's name.  This patch introduces the `org-src-lang-modes'
> variable which can be used to map language names to major modes
> when this is the case.  This is used when editing a source-code
> block, or when exporting fontified source-code with htmlize.
>
> So far the only instance of this that I know of is ocaml and
> tuareg-mode, so that's the only thing that `org-src-lang-modes'
> is pre-populated with.  Maybe there are other instances as well?
2009-08-23 19:31:47 +02:00
Carsten Dominik 6bd7ffef36 Incorporate Glen Morris' changes in downstream Emacs 2009-08-08 06:34:24 +02:00
Carsten Dominik bfdd3d3fd3 Push version number to 6.29trans 2009-08-06 12:07:20 +02:00
Carsten Dominik 0864163024 Release 6.29c 2009-08-06 06:26:23 +02:00
Carsten Dominik d6b37ddbea Release 6.29b 2009-08-05 12:34:30 +02:00
Carsten Dominik 1c25048e48 Release 6.29a 2009-08-04 23:54:22 +02:00
Carsten Dominik d67a9be8a2 Release 6.29 2009-08-04 23:06:39 +02:00
Carsten Dominik 2eecb4c43c Fix white-space errors 2009-08-03 17:30:30 +02:00
Bastien Guerry 5a7f43293d Enhance export options for code source examples.
Allow whitespace in code references.  Allow the -r switch to remove the
references in the source code even when the lines are not numbered: the
labels can be explicit enough.  Note that "-r -k" is the same than no
switch - as expected.

Thanks to Ulf Stegemann for bring this up.
2009-07-23 21:48:43 +02:00
Carsten Dominik aa6654c9ce Examples: Untabify before re-inserting into Org
Leaving tabs in the code will mess up indentation in Org.
2009-07-06 16:08:49 +02:00
Carsten Dominik f648323253 Push version number to 6.28trans 2009-06-26 17:26:50 +02:00
Carsten Dominik cd4e52a5ef Release 6.28d 2009-06-26 17:23:27 +02:00
Carsten Dominik 00ddc4dba7 Release 6.28c 2009-06-26 09:27:50 +02:00
Carsten Dominik e7ffcc1d4d Release 6.28b 2009-06-25 09:01:20 +02:00
Carsten Dominik 7906427aa6 Release 6.28 2009-06-25 08:59:59 +02:00
Carsten Dominik dc5bc0d443 Move variable `org-protecting-blocks' to org.el 2009-06-14 08:05:18 +02:00
Carsten Dominik d1f1e63d22 Keep byte compiler happy 2009-06-11 22:18:47 +02:00
Carsten Dominik 92163f2518 Protect ditaa, r, R, and dot blocks from fontification
Since org-exp-blocks.el is now core, we protect these blocks from the
start.
2009-06-11 17:59:35 +02:00
Carsten Dominik a6449c0324 Fix positioning bug when returning from source code editing 2009-06-09 20:19:13 +02:00
Carsten Dominik 05438ec08f Minor fixes 2009-06-09 19:23:59 +02:00
Carsten Dominik 737757a5fd Allow for extra indentation of block contents. 2009-06-08 09:39:19 +02:00
Carsten Dominik 5f3b2c275c New hook `org-src-mode-hook'.
This commit adds a new hook `org-src-mode-hook'.

The Hook  run after Org switched a source code snippet to
its Emacs mode.  This hook will run

- when editing a source code snippet with \"C-c '\".
- When formatting a source code snippet for export with htmlize.

You may want to use this hook for example to turn off `outline-minor-mode'
or similar things which you want to have when editing a source code file,
but which mess up the display of a snippet in Org exported files.
2009-06-08 08:52:25 +02:00
Carsten Dominik ea846889f2 Base block indentation after editing on #+begin line 2009-06-07 23:10:36 +02:00
Carsten Dominik 503e571e43 Keep byte compiler happy 2009-06-07 17:07:07 +02:00
Carsten Dominik 73c522f727 New file org-src.el, split out of org.el 2009-06-07 16:28:10 +02:00