emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Richard <theonewiththeevillook@yahoo.fr>
To: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to set C-o back to open-line?
Date: Fri, 17 May 2013 10:58:37 +0200	[thread overview]
Message-ID: <87ehd6ugn6.fsf@yahoo.fr> (raw)
In-Reply-To: <5195C5C5.3050705@easy-emacs.de> ("Andreas \=\?utf-8\?Q\?R\=C3\=B6h\?\= \=\?utf-8\?Q\?ler\=22's\?\= message of "Fri, 17 May 2013 07:53:09 +0200")

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.

  reply	other threads:[~2013-05-17  9:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=87ehd6ugn6.fsf@yahoo.fr \
    --to=theonewiththeevillook@yahoo.fr \
    --cc=andreas.roehler@easy-emacs.de \
    --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).