From mboxrd@z Thu Jan 1 00:00:00 1970 From: Calvin Young Subject: Re: Getting beginning postiion of a description list Date: Thu, 15 Jan 2015 21:47:01 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b4145d8a50337050cbe8147 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBzki-0004V0-Eg for emacs-orgmode@gnu.org; Fri, 16 Jan 2015 00:47:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBzkh-0001hp-6Z for emacs-orgmode@gnu.org; Fri, 16 Jan 2015 00:47:24 -0500 Received: from mail-ie0-x233.google.com ([2607:f8b0:4001:c03::233]:63077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBzkg-0001hl-Uz for emacs-orgmode@gnu.org; Fri, 16 Jan 2015 00:47:23 -0500 Received: by mail-ie0-f179.google.com with SMTP id rp18so19060104iec.10 for ; Thu, 15 Jan 2015 21:47:22 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin Cc: emacs-orgmode@gnu.org --047d7b4145d8a50337050cbe8147 Content-Type: text/plain; charset=ISO-8859-1 Ah, this makes sense. Unfortunately, an additional constraint I failed to mention in the first email is that it'd be nice if the solution worked for numbered lists as well. That solution unfortunately breaks on numbered lists :( Is there perhaps another way to accomplish this? P.S. I just noticed the typo in "position" in the subject of this thread...apols, how very embarrassing of me. On Thu, Jan 15, 2015 at 6:31 PM, John Kitchin wrote: > 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 > --047d7b4145d8a50337050cbe8147 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Ah, this makes sense. Unfortunately, an additional constra= int I failed to mention in the first email is that it'd be nice if the = solution worked for numbered lists as well. That solution unfortunately bre= aks on numbered lists :(

Is there perhaps another way to= accomplish this?

P.S. I just noticed the typo in = "position" in the subject of this thread...apols, how very embarr= assing of me.

On Thu, Jan 15, 2015 at 6:31 PM, John Kitchin <= ;johnrkitchin@g= mail.com> wrote:
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=A0 =A0 (goto-char (org-element-property :contents-begin (org-e= lement-at-point)))
-=A0 =A0 =A0baz :: goo
- 1 egg
- 0.5 cups
- :punc

#+BEGIN_SRC emacs-lisp
(defun gg ()
=A0(interactive)
=A0(beginning-of-line)
=A0(forward-word)
=A0(backward-word)
=A0(while (not (looking-at " "))
=A0 =A0(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 descri= ption
> list item, I'd like to get the point represented by the pipe chara= cter "|":
>
> - |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 li= st
> item? Is there a recommended solution that'd work for both descrip= tion
> 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://kitc= hingroup.cheme.cmu.edu

--047d7b4145d8a50337050cbe8147--