From: "Eric Schulte" <schulte.eric@gmail.com>
To: Dan Davison <davison@stats.ox.ac.uk>
Cc: Richard Riley <rileyrg@gmail.com>,
emacs-orgmode@gnu.org, mail@christianmoe.com
Subject: Re: Re: org-babel - utility to ease chopping src chunks into smaller org entries
Date: Tue, 21 Sep 2010 09:35:29 -0600 [thread overview]
Message-ID: <87eicnaz3y.fsf@gmail.com> (raw)
In-Reply-To: <87mxrb40d8.fsf@stats.ox.ac.uk> (Dan Davison's message of "Tue, 21 Sep 2010 15:50:11 +0100")
Applied, Thanks
Dan Davison <davison@stats.ox.ac.uk> writes:
> Christian -- thanks, I think your suggestion is better than mine.
>
> Eric -- here's a small change that allows it to work before the first
> headline. (protected from patchwork I hope)
>
> Dan
>
> X diff --git a/lisp/ob.el b/lisp/ob.el
> X index e3f9fc7..655a79d 100644
> X --- a/lisp/ob.el
> X +++ b/lisp/ob.el
> X @@ -1146,7 +1146,8 @@ region is not active then the point is demarcated."
> X (goto-char place)
> X (let ((lang (nth 0 info))
> X (indent (make-string (nth 6 info) ? ))
> X - (stars (concat (make-string (org-current-level) ?*) " ")))
> X + (stars
> X + (concat (make-string (or (org-current-level) 0) ?*) " ")))
> X (when (string-match "^[[:space:]]*$"
> X (buffer-substring (point-at-bol)
> X (point-at-eol)))
> X @@ -1161,7 +1162,7 @@ region is not active then the point is demarcated."
> X (let ((start (point))
> X (body (delete-and-extract-region
> X (if (region-active-p) (mark) (point)) (point)))
> X - (stars (concat (make-string (org-current-level) ?*) " ")))
> X + (stars (concat (make-string (or (org-current-level) 0) ?*) " ")))
> X (insert (concat (if (looking-at "^") "" "\n")
> X (if arg (concat stars "\n") "")
> X "#+begin_src " (read-from-minibuffer "Lang: ") "\n"
> X
>
>
> Christian Moe <mail@christianmoe.com> writes:
>
>> Hi Eric,
>>
>> Great, thanks.
>>
>> Christian
>>
>> On 9/21/10 3:04 PM, Eric Schulte wrote:
>>> Hi Christian,
>>>
>>> I agree generalizing this function over all block types would be very
>>> useful. When I find the time I will make this change.
>>>
>>> Thanks -- Eric
>>>
>>> Christian Moe<mail@christianmoe.com> writes:
>>>
>>>> Hi,
>>>>
>>>> I'm late to this discussion, but just a lateral thought:
>>>>
>>>> Would you consider rewriting this as `org-demarcate-block' or similar,
>>>> to operate on all #+begin_...end blocks, not just src?
>>>>
>>>> If generalized this function could be equally useful for non-src
>>>> blocks as well. Example blocks come immediately to mind, but there are
>>>> non-coding applications too.
>>>>
>>>> For instance, I store many notes with quotes from various texts,
>>>> sometimes in fairly long =#+begin_quote= blocks, which I then need to
>>>> split up when I want to write an extended discussion of a passage,
>>>> quoting a few lines at a time.
>>>>
>>>> For those who use verse blocks (I all too seldom have the need...), it
>>>> may be even more useful.
>>>>
>>>> For personal use, I already have a little org-insert-block utility
>>>> function to insert/wrap [q]uote, [s]rc, e[x]ample, [v]erse or [o]ther
>>>> blocks at a keystroke. This works for me since I use at least the
>>>> first two more or less equally often. A generalized demarcate-block
>>>> function would be a nice complement.
>>>>
>>>> Yours,
>>>> CM
>>>>
>>>>
>>>>
>>>>
>>>>>> I've just added this to the org-mode repo.
>>>>>>
>>>>>>> Not in the babel key map - in the org key map (I use it most in normal
>>>>>>> non src org entries to mark a block of elisp as src for samples/examples).
>>>>>>
>>>>>> For now it still lives in the babel keymap behind (C-c C-v d) since it
>>>>>> is fundamentally code-block related,
>>>>>
>>>>> For me, "fundamentally code-block related", in the absence of
>>>>> execution-related functionality, points to org-src.el rather than
>>>>> org-babel, so I suggest naming this function
>>>>> org-src-demarcate-block. The babel keymap is still a good place for a
>>>>> binding -- I think it's reasonable for the babel keymap to accomodate
>>>>> pure code block stuff in addition to execution/tangling stuff.
>>>>>
>>>>> Dan
>>>>>
>>>>> _______________________________________________
>>>>> Emacs-orgmode mailing list
>>>>> Please use `Reply All' to send replies to the list.
>>>>> Emacs-orgmode@gnu.org
>>>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>>>>
>>>
next prev parent reply other threads:[~2010-09-21 15:35 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-19 1:48 org-babel - utility to ease chopping src chunks into smaller org entries Richard Riley
2010-09-19 18:21 ` Eric Schulte
2010-09-19 22:03 ` Richard Riley
2010-09-19 23:20 ` Richard Riley
2010-09-20 3:41 ` Eric Schulte
2010-09-20 5:18 ` Richard Riley
2010-09-20 14:30 ` Eric Schulte
2010-09-20 15:15 ` Sébastien Vauban
2010-09-20 22:21 ` Sébastien Vauban
2010-09-21 12:46 ` Eric Schulte
2010-09-21 13:49 ` Dan Davison
2010-09-21 14:37 ` Sébastien Vauban
2010-09-21 12:44 ` Eric Schulte
2010-09-21 15:19 ` Sébastien Vauban
2010-09-20 20:09 ` Dan Davison
2010-09-21 7:58 ` Christian Moe
2010-09-21 11:17 ` Richard Riley
2010-09-21 13:04 ` Eric Schulte
2010-09-21 14:35 ` Christian Moe
2010-09-21 14:50 ` Dan Davison
2010-09-21 15:35 ` Eric Schulte [this message]
2010-09-24 13:24 ` Requests about the code demarcation Sébastien Vauban
2010-09-27 13:18 ` Eric Schulte
2010-09-27 13:47 ` Sébastien Vauban
2010-09-27 14:36 ` Sébastien Vauban
2010-09-27 14:58 ` Eric Schulte
2010-09-30 18:17 ` Achim Gratz
2010-09-30 22:19 ` Eric Schulte
2010-10-01 19:28 ` Achim Gratz
2010-10-17 11:53 ` Richard Riley
2010-09-21 6:33 ` org-babel - utility to ease chopping src chunks into smaller org entries Achim Gratz
2010-09-21 13:01 ` Eric Schulte
2010-09-21 17:03 ` Achim Gratz
2010-09-19 21:24 ` Sébastien Vauban
2010-09-19 21:44 ` Richard Riley
2010-09-19 21:52 ` Sébastien Vauban
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87eicnaz3y.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=davison@stats.ox.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=mail@christianmoe.com \
--cc=rileyrg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.