emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <johnrkitchin@gmail.com>
To: Calvin Young <calvinwyoung@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Getting beginning postiion of a description list
Date: Thu, 15 Jan 2015 21:31:08 -0500	[thread overview]
Message-ID: <m24mrrh2xf.fsf@vpn-128-237-146-123.library.vpn.cmu.edu> (raw)
In-Reply-To: <CANniJEwZu8UcvbB6G+0Q+e_ZYQNFUsw9DJxxVg9cfKvSnoSQOw@mail.gmail.com>

This is very un-orgish but it seems to do it. (forward-word) goes to the
end the next recognized word, (backward-word) to the beginning of the
word you are now at the end of, and (backward-char) to get to a
space. You just need org to get you on the list ;)

It seems to work on these.

- foo :: bar    (goto-char (org-element-property :contents-begin (org-element-at-point)))
-     baz :: goo
- 1 egg
- 0.5 cups
- :punc

#+BEGIN_SRC emacs-lisp
(defun gg ()
 (interactive)
 (beginning-of-line)
 (forward-word)
 (backward-word)
 (while (not (looking-at " "))
   (backward-char)))
#+END_SRC


Calvin Young writes:

> Hi all,
>
> If my cursor is in a description list item, what's the recommended way of
> getting the point at the beginning of the description list text (i.e.,
> after the bullet character)? To illustrate, given the following description
> list item, I'd like to get the point represented by the pipe character "|":
>
> - |foo :: bar
>
> If I use something like `(org-element-property :contents-begin
> (org-element-at-point))`, that gives me the point at the beginning of the
> description, not the list item:
>
> - foo :: |bar
>
> How do I need to massage this to give me the beginning of the whole list
> item? Is there a recommended solution that'd work for both description
> lists *and* plain lists?
>
> Thanks everyone :)
>
> Calvin

--
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

  reply	other threads:[~2015-01-16  2:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15  4:28 Getting beginning postiion of a description list Calvin Young
2015-01-16  2:31 ` John Kitchin [this message]
2015-01-16  5:47   ` Calvin Young
2015-01-16  7:31 ` Nicolas Richard
2015-01-16 10:57   ` Eric Abrahamsen
2015-01-16 10:58 ` 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=m24mrrh2xf.fsf@vpn-128-237-146-123.library.vpn.cmu.edu \
    --to=johnrkitchin@gmail.com \
    --cc=calvinwyoung@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).