Re: [O] Getting beginning postiion of a description list

2015-01-15 Thread Calvin Young
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
>


[O] Getting beginning postiion of a description list

2015-01-14 Thread Calvin Young
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


[O] Path to contrib directory in OSX Emacs

2014-12-31 Thread Calvin Young
Hey all,

Does anyone know whether the version of OSX Emacs from
http://emacsformacosx.com/ comes with all of the org-mode contrib packages?
If so, I'm having a heck of a time finding it.

It looks like `org.el` is getting loaded
from /Applications/Emacs.app/Contents/Resources/lisp/org, but that path
doesn't appear to have any references to the contrib packages.

If the contrib packages don't come bundled with OSX Emacs, what's the
recommended way of getting them?

Calvin


Re: [O] Emulating list functionality from traditional GUI editors

2014-12-13 Thread Calvin Young
No problem, I've gone ahead and packaged my changes here:
https://github.com/calvinwyoung/org-autolist
I'll also submit this to melpa to make it easier to install.

I'd love hear how other Org'ers on this list feel about it. If folks find
it useful, I'd be happy to publish it on Worg as well.

Best,
Calvin

On Fri, Dec 12, 2014 at 12:37 AM, Sebastien Vauban 
wrote:
>
> Calvin Young wrote:
> > Makes sense! Just wanted to see how others felt about this :)
> >
> > Anyway thanks for the consideration, and for the tip
> > about org-element-at-point -- really did make this trivial to implement.
>
> Once your customizations are done, it would be nice if you'd publish
> them on Worg, for future Org'ers who share your editing habits.
>
> Best regards,
>   Seb
>
> --
> Sebastien Vauban
>
>
>


Re: [O] Emulating list functionality from traditional GUI editors

2014-12-11 Thread Calvin Young
Makes sense! Just wanted to see how others felt about this :)

Anyway thanks for the consideration, and for the tip
about org-element-at-point -- really did make this trivial to implement.


On Thu, Dec 11, 2014 at 11:48 AM, Rasmus  wrote:

> Hi,
>
> Calvin Young  writes:
>
> >- If the cursor is at the end of a list item, then "Return" should
> >insert a new list item (i.e., automatically perform org-meta-return)
>
> Maybe you can use org-element-at-point and advice org-return?
>
> >- If the cursor is at the beginning of an empty list item, then
> "Return"
> >should outdent the list item (or remove it if it's already at the
> >outer-most indentation level)
>
> I don't understand this.  Do you know M-{left,right}?  Again, you could
> advice org-return.
>
> In LO it removes the bullet.  Here you can use C-S-Backspace.  Bonus: it
> works everywhere!
>
> >- If the cursor is at the beginning of an empty list item, then
> >"Backspace" should delete the list item and move my cursor to the end
> of
> >the previous list item
>
> This is like C-S-Backspace C-p C-e.  You could advice org-delete-backward.
>
> >- It'd be nice of these rules could be applied to checkboxes as well
>
> It should be trivial to support using org-element-at-point.
>
> > What I'm describing is really just the default behavior around bulleted /
> > numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
> > etc.).
>
> OK...
>
> > Are there any options built in to org-mode that'd let me enable this?
>
> No.  And I doubt it should be.  But Emacs is /your/ extensible editor.
>
> --Rasmus
>
> --
> Need more coffee. . .
>
>
>


[O] Emulating list functionality from traditional GUI editors

2014-12-11 Thread Calvin Young
Hi all,

I've been using org-mode for a while now, and it's been life-changing in
terms of how I keep organized. However, there's still one thing I miss from
traditional note-taking apps when working with lists. Specifically, I'd
like to enable the following behavior:

   - If the cursor is at the end of a list item, then "Return" should
   insert a new list item (i.e., automatically perform org-meta-return)
   - If the cursor is at the beginning of an empty list item, then "Return"
   should outdent the list item (or remove it if it's already at the
   outer-most indentation level)
   - If the cursor is at the beginning of an empty list item, then
   "Backspace" should delete the list item and move my cursor to the end of
   the previous list item
   - It'd be nice of these rules could be applied to checkboxes as well

What I'm describing is really just the default behavior around bulleted /
numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
etc.). Are there any options built in to org-mode that'd let me enable this?

Best,
Calvin


Re: [O] Emulating list functionality from traditional GUI editors

2014-12-11 Thread Calvin Young
Jorge, thanks for the quick response!


>  * If the cursor is at the end of a list item, then "Return" should
>>  insert a new list item (i.e., automatically perform   org-meta-return)
>>
>
> M- does this. You do not want  to do that because you when
> you want to finish the list  finishes it.
>

I don't think I explained myself clearly the first time around. The
behavior I'm hoping to achieve (i.e., the default bulletting behavior in
Google Docs, OSX Notes, etc.) is as follows:

;; Starting with this setup:

- one
- two
 + a[CURSOR_HERE]

;; Hitting  should produce:

- one
- two
 + a
 + [CURSOR_HERE]

;; Hitting  again would then produce:

- one
- two
 + a
- [CURSOR_HERE]

;; And hitting  one last time would produce:

- one
- two
 + a

[CURSOR_HERE]

I know we can already achieve this with some combination of M-,
, and M-S-, but this behavior has 2 distinct advantages:

1. The user only needs to remember one key to cycle between all of these
actions, rather than 3 key combinations.
2. This behavior is more consistent with the bulleting behavior in other
editors, which could make it feel more intuitive for new org-mode users.


>  * If the cursor is at the beginning of an empty list item, then
>>  "Return" should outdent the list item (or remove it if it's   already at
>> the outer-most indentation level)
>>
>
> I am not sure that I understand this but I assume that you would obtain
> the same with . It goes back and forth between levels of list so if
> you have
>
> - one
> - two
>  + a
>  + CURSOR_HERE
>
> and you hit  then it changes to
> - one
> - two
>  + a
>+ CURSOR_HERE
>
> and then two times  (or S- from the beginning) changes it to
>
> - one
> - two
>  + a
> - CURSOR_HERE
>

Yes, but for the reasons mentioned above, it'd be nice if we could use the
 to outdent a new list entry as well.


>  * If the cursor is at the beginning of an empty list item, then
>>  "Backspace" should delete the list item and move my cursor to   the end of
>> the previous list item
>>
>
> I guess you could remap  to a function that checks if you are
> at the beginning of the list and when that is true it does what you want,
> otherwise it just calls `delete-backward-char'. But generally I would do
> C-a C-k , just two more keystrokes.
>

Makes sense. This is an easy function to write -- just wanted to make sure
there wasn't something that already does this out-of-the-box.


>  * It'd be nice of these rules could be applied to checkboxes as well
>>
>
> M-S- inserts a check box.


In general, I *believe* a lot of folks use lists and checkboxs in similar
ways. I certainly do, and I frequently accidentally hit M- while
editing a checkbox when I really intend to insert a new checkbox entry. As
a result, it seems desirable to create an interface that treats them more
similarly (e.g., using a single  keypress to auto-insert a new
entry).

If this doesn't exist yet, I'd be happy to roll it myself. But it'd be nice
to avoid re-inventing the wheel here if possible :)


[O] Emulating list functionality from traditional GUI editors

2014-12-11 Thread Calvin Young
Hi all,

I've been using org-mode for a while now, and it's been life-changing in
terms of how I keep organized. However, there's still one thing I miss from
traditional note-taking apps when working with lists. Specifically, I'd
like to enable the following behavior:

   - If the cursor is at the end of a list item, then "Return" should
   insert a new list item (i.e., automatically perform org-meta-return)
   - If the cursor is at the beginning of an empty list item, then "Return"
   should outdent the list item (or remove it if it's already at the
   outer-most indentation level)
   - If the cursor is at the beginning of an empty list item, then
   "Backspace" should delete the list item and move my cursor to the end of
   the previous list item
   - It'd be nice of these rules could be applied to checkboxes as well

What I'm describing is really just the default behavior around bulleted /
numbered lists in other GUI editors (e.g., Google Docs, Gmail, OSX Notes,
etc.). Are there options built in to org-mode that'd let me enable this?

Best,
Calvin