From: John Kitchin <jkitchin@andrew.cmu.edu>
To: "Somelauw ." <somelauw@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Expose value-begin and value-end instead of just value in org-element API
Date: Tue, 20 Feb 2018 11:59:31 -0800 [thread overview]
Message-ID: <CAJ51ETrUDO+0MhLa-0vBZMQ+Mgx+wX3fLHmr2ocKAmz+joC3rA@mail.gmail.com> (raw)
In-Reply-To: <CA+gt_a_6GU7a3LO27k6d7_-2_JZW_2jdA=DBi1DfmATE+MbYYA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]
+1 on this.
I also have some janky code to do things like go to the beginning/end of
the value in a src block. Here is my solution to mark the code in a src
block.
(defun ob-ipython-mark-code ()
"Mark the code in the block."
(interactive)
(org-edit-special)
(let ((p0 (point-min))
(p1 (point-max)))
(goto-char p0)
(org-edit-src-exit)
(set-mark (point))
(goto-char (+ (point) (- p1 2)))))
John
-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
On Mon, Feb 19, 2018 at 3:29 PM, Somelauw . <somelauw@gmail.com> wrote:
> Some org-mode elements expose "contents-begin" and "contents-end"
> properties as buffer positions, whereas other elements such as verbatim and
> org-src-block expose a "value" property in the form of a string.
>
> I think it would be preferable to also expose the value by beginning and
> ending buffer positions for the following reasons:
> - Consistency with elements that expose contents-begin and contents-end.
> - More powerful. In my evil-org plugin I want to be able to mark the value
> property of the org element at point (so the user can do stuff like easily
> copy the code of the current code block), but to do so I need the beginning
> and ending position in the buffer of "value". The org-element API does
> currently not provide clean way to retrieve these positions.
> - It's usually more efficient to return the beginning and ending positions
> than to retrieve the substring that contains the value, which may require a
> large buffer partition to be copied.
>
> Kind regards,
> Somelauw
[-- Attachment #2: Type: text/html, Size: 2531 bytes --]
next prev parent reply other threads:[~2018-02-20 19:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-19 23:29 Expose value-begin and value-end instead of just value in org-element API Somelauw .
2018-02-20 19:59 ` John Kitchin [this message]
2018-02-21 11:17 ` Nicolas Goaziou
2018-02-21 21:13 ` Somelauw .
2018-02-26 3:43 ` John Kitchin
2018-02-26 10:05 ` Nicolas Goaziou
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJ51ETrUDO+0MhLa-0vBZMQ+Mgx+wX3fLHmr2ocKAmz+joC3rA@mail.gmail.com \
--to=jkitchin@andrew.cmu.edu \
--cc=emacs-orgmode@gnu.org \
--cc=somelauw@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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).