Andreas Röhler <andreas.roeh...@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 via email to