emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to set C-o back to open-line?
@ 2013-05-16 22:38 Christopher Allan Webber
  2013-05-16 23:04 ` Nick Dokos
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Christopher Allan Webber @ 2013-05-16 22:38 UTC (permalink / raw)
  To: Emacs-orgmode

I really hate org-open-line... I can see why people might want it, but
it's messed up my workflow.  I'd like to set C-o back.

However, I have no idea what org-defkey is doing, but I expected this to
work:

  (define-key org-mode-map (kbd "C-o") 'open-line)

it isn't working!

How to get the standard-ol-open-line behavior back?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-16 22:38 How to set C-o back to open-line? Christopher Allan Webber
@ 2013-05-16 23:04 ` Nick Dokos
  2013-05-16 23:10 ` Suvayu Ali
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 14+ messages in thread
From: Nick Dokos @ 2013-05-16 23:04 UTC (permalink / raw)
  To: emacs-orgmode

Christopher Allan Webber <cwebber@dustycloud.org> writes:

> I really hate org-open-line... I can see why people might want it, but
> it's messed up my workflow.  I'd like to set C-o back.
>
> However, I have no idea what org-defkey is doing, but I expected this to
> work:
>
>   (define-key org-mode-map (kbd "C-o") 'open-line)
>
> it isn't working!
>
> How to get the standard-ol-open-line behavior back?
>
>

Try

      (define-key org-mode-map [remap open-line] nil)

You may have to do it in a hook.

See

      (info "(elisp) Remapping commands")

for details.
-- 
Nick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-16 22:38 How to set C-o back to open-line? Christopher Allan Webber
  2013-05-16 23:04 ` Nick Dokos
@ 2013-05-16 23:10 ` Suvayu Ali
  2013-05-17  2:28   ` Christopher Allan Webber
  2013-05-17 13:12 ` Carsten Dominik
  2013-08-31  6:12 ` Carsten Dominik
  3 siblings, 1 reply; 14+ messages in thread
From: Suvayu Ali @ 2013-05-16 23:10 UTC (permalink / raw)
  To: emacs-orgmode

Hello Christopher,

On Thu, May 16, 2013 at 05:38:11PM -0500, Christopher Allan Webber wrote:
> I really hate org-open-line... I can see why people might want it, but
> it's messed up my workflow.  I'd like to set C-o back.
> 
> However, I have no idea what org-defkey is doing, but I expected this to
> work:
> 
>   (define-key org-mode-map (kbd "C-o") 'open-line)
> 
> it isn't working!
> 
> How to get the standard-ol-open-line behavior back?

Does using org-defkey instead make it work?

That said, I'm curious what is so different about org-open-line?  The
docstring says the following:

  It is bound to C-o, <insertline>.
  
  (org-open-line N)
  
  Insert a new row in tables, call `open-line' elsewhere.

So unless you are in a table, it should be the same as normal.  Is that
broken?  Anyway, I never use open-line myself, but I was curious after I
saw several people mention it on unrelated threads on a few lists.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-16 23:10 ` Suvayu Ali
@ 2013-05-17  2:28   ` Christopher Allan Webber
  2013-05-17  5:53     ` Andreas Röhler
  2013-05-17 17:10     ` Suvayu Ali
  0 siblings, 2 replies; 14+ messages in thread
From: Christopher Allan Webber @ 2013-05-17  2:28 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

Suvayu Ali writes:

> Hello Christopher,
>
> On Thu, May 16, 2013 at 05:38:11PM -0500, Christopher Allan Webber wrote:
>> I really hate org-open-line... I can see why people might want it, but
>> it's messed up my workflow.  I'd like to set C-o back.
>> 
>> However, I have no idea what org-defkey is doing, but I expected this to
>> work:
>> 
>>   (define-key org-mode-map (kbd "C-o") 'open-line)
>> 
>> it isn't working!
>> 
>> How to get the standard-ol-open-line behavior back?
>
> Does using org-defkey instead make it work?

org-defkey doesn't seem to work.

> That said, I'm curious what is so different about org-open-line?  The
> docstring says the following:
>
>   It is bound to C-o, <insertline>.
>   
>   (org-open-line N)
>   
>   Insert a new row in tables, call `open-line' elsewhere.
>
> So unless you are in a table, it should be the same as normal.  Is that
> broken?  Anyway, I never use open-line myself, but I was curious after I
> saw several people mention it on unrelated threads on a few lists.
>
> Cheers,

Right, exactly.  The way I use org-diet often involves me splitting
apart and rejoining tables and the whole "adding a new line in between"
is part of expected behavior for me.  The new system is driving me crazy!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17  2:28   ` Christopher Allan Webber
@ 2013-05-17  5:53     ` Andreas Röhler
  2013-05-17  8:58       ` Nicolas Richard
  2013-05-17 12:26       ` Christopher Allan Webber
  2013-05-17 17:10     ` Suvayu Ali
  1 sibling, 2 replies; 14+ messages in thread
From: Andreas Röhler @ 2013-05-17  5:53 UTC (permalink / raw)
  To: emacs-orgmode

Am 17.05.2013 04:28, schrieb Christopher Allan Webber:
> Suvayu Ali writes:
>
>> Hello Christopher,
>>
>> On Thu, May 16, 2013 at 05:38:11PM -0500, Christopher Allan Webber wrote:
>>> I really hate org-open-line... I can see why people might want it, but
>>> it's messed up my workflow.  I'd like to set C-o back.
>>>
>>> However, I have no idea what org-defkey is doing, but I expected this to
>>> work:
>>>
>>>    (define-key org-mode-map (kbd "C-o") 'open-line)
>>>
>>> it isn't working!
>>>
>>> How to get the standard-ol-open-line behavior back?
>>
>> Does using org-defkey instead make it work?
>
> org-defkey doesn't seem to work.
>
>> That said, I'm curious what is so different about org-open-line?  The
>> docstring says the following:
>>
>>    It is bound to C-o, <insertline>.
>>
>>    (org-open-line N)
>>
>>    Insert a new row in tables, call `open-line' elsewhere.
>>
>> So unless you are in a table, it should be the same as normal.  Is that
>> broken?  Anyway, I never use open-line myself, but I was curious after I
>> saw several people mention it on unrelated threads on a few lists.
>>
>> Cheers,
>
> Right, exactly.  The way I use org-diet often involves me splitting
> apart and rejoining tables and the whole "adding a new line in between"
> is part of expected behavior for me.  The new system is driving me crazy!
>
>

Installing this instead should fix it:

(defun org-open-line (n)
   "Insert a new row in tables, call `open-line' elsewhere.
With \C-u NUMBER `open-line' is called the common way also in table context"
   (interactive "*P")
   (cond (n
          (open-line (prefix-numeric-value n)))
         ((org-at-table-p)
          (org-table-insert-row))
         (t (open-line (prefix-numeric-value n)))))

Cheers,

Andreas

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17  5:53     ` Andreas Röhler
@ 2013-05-17  8:58       ` Nicolas Richard
  2013-05-17 12:26       ` Christopher Allan Webber
  1 sibling, 0 replies; 14+ messages in thread
From: Nicolas Richard @ 2013-05-17  8:58 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-orgmode

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
> (defun org-open-line (n)
>   "Insert a new row in tables, call `open-line' elsewhere.
> With \C-u NUMBER `open-line' is called the common way also in table context"
>   (interactive "*P")
>   (cond (n
>          (open-line (prefix-numeric-value n)))
>         ((org-at-table-p)
>          (org-table-insert-row))
>         (t (open-line (prefix-numeric-value n)))))

I think that calling open-line in a table only makes sense at bol, so
I'd suggest this :

(defun org-open-line (n)
  "Insert a new row in tables, call `open-line' elsewhere.

As an exception, if point is at the beginning of a
line,`open-line' is called."
  (interactive "*p")
  (if (and (not (bolp)) (org-at-table-p))
      (org-table-insert-row)
    (open-line n)))

or even the following, so as to use the argument also in tables.

(defun org-open-line (n)
  "Insert a new row in tables, call `open-line' elsewhere.

As an exception, if point is at the beginning of a
line,`open-line' is called. The argument N is the number of rows
or lines to insert."
  (interactive "*p")
  (if (and (not (bolp)) (org-at-table-p))
      (dotimes (_ n)
	(org-table-insert-row))
    (open-line n)))


-- 
Nico.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17  5:53     ` Andreas Röhler
  2013-05-17  8:58       ` Nicolas Richard
@ 2013-05-17 12:26       ` Christopher Allan Webber
  2013-05-17 12:37         ` Nicolas Richard
  1 sibling, 1 reply; 14+ messages in thread
From: Christopher Allan Webber @ 2013-05-17 12:26 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-orgmode

Andreas Röhler writes:

> Installing this instead should fix it:
>
> (defun org-open-line (n)
>    "Insert a new row in tables, call `open-line' elsewhere.
> With \C-u NUMBER `open-line' is called the common way also in table context"
>    (interactive "*P")
>    (cond (n
>           (open-line (prefix-numeric-value n)))
>          ((org-at-table-p)
>           (org-table-insert-row))
>          (t (open-line (prefix-numeric-value n)))))
>
> Cheers,
>
> Andreas

Hm, alright.  Sadly there seems to be no way to change the key (very
un-emacs like?)  So if redefining it is the way, I replaced with the
much simpler:

  (setq org-open-line 'open-line)

Much better!  Hopefully no tooling ever makes use of org-open-line,
shooting me in the foot... :)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17 12:26       ` Christopher Allan Webber
@ 2013-05-17 12:37         ` Nicolas Richard
  2013-05-17 22:02           ` Christopher Allan Webber
  0 siblings, 1 reply; 14+ messages in thread
From: Nicolas Richard @ 2013-05-17 12:37 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: emacs-orgmode

Christopher Allan Webber <cwebber@dustycloud.org> writes:
> Hm, alright.  Sadly there seems to be no way to change the key (very
> un-emacs like?)

That was answered by Nick Dokos ; use :
      (define-key org-mode-map [remap open-line] nil)

(btw, why does org use remap here is a mystery to me)

>   (setq org-open-line 'open-line)

How could that possibly work ?

-- 
Nico.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-16 22:38 How to set C-o back to open-line? Christopher Allan Webber
  2013-05-16 23:04 ` Nick Dokos
  2013-05-16 23:10 ` Suvayu Ali
@ 2013-05-17 13:12 ` Carsten Dominik
  2013-05-17 22:05   ` Christopher Allan Webber
  2013-08-31  6:12 ` Carsten Dominik
  3 siblings, 1 reply; 14+ messages in thread
From: Carsten Dominik @ 2013-05-17 13:12 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: Emacs-orgmode


On 17.5.2013, at 00:38, Christopher Allan Webber <cwebber@dustycloud.org> wrote:

> I really hate org-open-line... I can see why people might want it, but
> it's messed up my workflow.  I'd like to set C-o back.
> 
> However, I have no idea what org-defkey is doing, but I expected this to
> work:
> 
> (define-key org-mode-map (kbd "C-o") 'open-line)

This one will work if you do it in org-mode-hook.

We could also introduce a variable to turn off the special behavior,
just like we do for C-a, C-e, and C-k.  This seems to me a better
option than to introduce additional context dependencies or use
prefix arguments to influence the behavior.

- Carsten

> 
> it isn't working!
> 
> How to get the standard-ol-open-line behavior back?
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17  2:28   ` Christopher Allan Webber
  2013-05-17  5:53     ` Andreas Röhler
@ 2013-05-17 17:10     ` Suvayu Ali
  1 sibling, 0 replies; 14+ messages in thread
From: Suvayu Ali @ 2013-05-17 17:10 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: emacs-orgmode

On Thu, May 16, 2013 at 09:28:35PM -0500, Christopher Allan Webber wrote:
> Suvayu Ali writes:
> 
> > That said, I'm curious what is so different about org-open-line?  The
> > docstring says the following:
> >
> >   It is bound to C-o, <insertline>.
> >   
> >   (org-open-line N)
> >   
> >   Insert a new row in tables, call `open-line' elsewhere.
> >
> > So unless you are in a table, it should be the same as normal.  Is that
> > broken?  Anyway, I never use open-line myself, but I was curious after I
> > saw several people mention it on unrelated threads on a few lists.
> 
> Right, exactly.  The way I use org-diet often involves me splitting
> apart and rejoining tables and the whole "adding a new line in between"
> is part of expected behavior for me.  The new system is driving me crazy!

Thanks, I see the use case.  I did have a similar need a few times.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17 12:37         ` Nicolas Richard
@ 2013-05-17 22:02           ` Christopher Allan Webber
  0 siblings, 0 replies; 14+ messages in thread
From: Christopher Allan Webber @ 2013-05-17 22:02 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: emacs-orgmode

Nicolas Richard writes:

>>   (setq org-open-line 'open-line)
>
> How could that possibly work ?

It didn't... my bad :)  I had both set that and done a redefinition of
org-open-line to just call open-line like:

(defun org-open-line (n)
  (interactive "*p")
  (open-line n))

Guess which one actually did anything ;)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17 13:12 ` Carsten Dominik
@ 2013-05-17 22:05   ` Christopher Allan Webber
  2013-09-13 19:14     ` Carsten Dominik
  0 siblings, 1 reply; 14+ messages in thread
From: Christopher Allan Webber @ 2013-05-17 22:05 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Emacs-orgmode

Carsten Dominik writes:

> On 17.5.2013, at 00:38, Christopher Allan Webber <cwebber@dustycloud.org> wrote:
>
>> I really hate org-open-line... I can see why people might want it, but
>> it's messed up my workflow.  I'd like to set C-o back.
>> 
>> However, I have no idea what org-defkey is doing, but I expected this to
>> work:
>> 
>> (define-key org-mode-map (kbd "C-o") 'open-line)
>
> This one will work if you do it in org-mode-hook.

Ahah... okay, great, thanks :)

> We could also introduce a variable to turn off the special behavior,
> just like we do for C-a, C-e, and C-k.  This seems to me a better
> option than to introduce additional context dependencies or use
> prefix arguments to influence the behavior.
>
> - Carsten

I think that would be nice.  We have options for everything else, why
not this? ;)

Thanks for the help, all!

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-16 22:38 How to set C-o back to open-line? Christopher Allan Webber
                   ` (2 preceding siblings ...)
  2013-05-17 13:12 ` Carsten Dominik
@ 2013-08-31  6:12 ` Carsten Dominik
  3 siblings, 0 replies; 14+ messages in thread
From: Carsten Dominik @ 2013-08-31  6:12 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: Emacs-orgmode

Hi Christopher,

Would you like to prepare a patch to this effect?

- Carsten

On 17.5.2013, at 00:38, Christopher Allan Webber <cwebber@dustycloud.org> wrote:

> I really hate org-open-line... I can see why people might want it, but
> it's messed up my workflow.  I'd like to set C-o back.
> 
> However, I have no idea what org-defkey is doing, but I expected this to
> work:
> 
>  (define-key org-mode-map (kbd "C-o") 'open-line)
> 
> it isn't working!
> 
> How to get the standard-ol-open-line behavior back?
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: How to set C-o back to open-line?
  2013-05-17 22:05   ` Christopher Allan Webber
@ 2013-09-13 19:14     ` Carsten Dominik
  0 siblings, 0 replies; 14+ messages in thread
From: Carsten Dominik @ 2013-09-13 19:14 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: Emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

Hi Christopher,

you can now do

(setq org-special-ctrl-o nil)

to get what you want.

Regards

- Carsten

On 18.5.2013, at 00:05, Christopher Allan Webber <cwebber@dustycloud.org> wrote:

> Carsten Dominik writes:
> 
>> On 17.5.2013, at 00:38, Christopher Allan Webber <cwebber@dustycloud.org> wrote:
>> 
>>> I really hate org-open-line... I can see why people might want it, but
>>> it's messed up my workflow.  I'd like to set C-o back.
>>> 
>>> However, I have no idea what org-defkey is doing, but I expected this to
>>> work:
>>> 
>>> (define-key org-mode-map (kbd "C-o") 'open-line)
>> 
>> This one will work if you do it in org-mode-hook.
> 
> Ahah... okay, great, thanks :)
> 
>> We could also introduce a variable to turn off the special behavior,
>> just like we do for C-a, C-e, and C-k.  This seems to me a better
>> option than to introduce additional context dependencies or use
>> prefix arguments to influence the behavior.
>> 
>> - Carsten
> 
> I think that would be nice.  We have options for everything else, why
> not this? ;)
> 
> Thanks for the help, all!


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-09-13 19:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16 22:38 How to set C-o back to open-line? Christopher Allan Webber
2013-05-16 23:04 ` Nick Dokos
2013-05-16 23:10 ` Suvayu Ali
2013-05-17  2:28   ` Christopher Allan Webber
2013-05-17  5:53     ` Andreas Röhler
2013-05-17  8:58       ` Nicolas Richard
2013-05-17 12:26       ` Christopher Allan Webber
2013-05-17 12:37         ` Nicolas Richard
2013-05-17 22:02           ` Christopher Allan Webber
2013-05-17 17:10     ` Suvayu Ali
2013-05-17 13:12 ` Carsten Dominik
2013-05-17 22:05   ` Christopher Allan Webber
2013-09-13 19:14     ` Carsten Dominik
2013-08-31  6:12 ` Carsten Dominik

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