* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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.
* 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
* 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.
* 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.
* 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).
* 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
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.
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.
* 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.
* 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
* 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.
* 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.
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
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
* 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.
* 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.
* 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
* 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.
* 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.
* 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.
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
* 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'
* 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.
* 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
* 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.
* 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'
* 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.
* 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.
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
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
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.
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 '
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.
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 '.
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.
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.
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.
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?
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.
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.