emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to set C-o back to open-line?


From: Nicolas Richard
Subject: Re: [O] How to set C-o back to open-line?
Date: Fri, 17 May 2013 10:58:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Andreas Röhler <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]