diff options
author | Bastien Guerry <bzg@altern.org> | 2012-05-05 10:50:07 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-05-05 10:50:07 +0200 |
commit | 75e1c141f89c600112ca275b6b916faf12617ce8 (patch) | |
tree | 7a4f54b0c13e8fadbece78b73d69f599dae9b536 | |
parent | e508b497a393a3eeec9e332a9b86520ec9260a11 (diff) | |
download | org-mode-75e1c141f89c600112ca275b6b916faf12617ce8.tar.gz |
org.el: Allow `C-u C-c *' to toggle headings in the whole list at point.
* org.el (org-toggle-heading): Allow `C-u C-c *' to mark the
list at point before converting items to headings. With a
simple universal-argument, set `current-prefix-arg' to 1,
otherwise keep the numeric value.
-rw-r--r-- | lisp/org.el | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el index 219963b..87703cb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19068,13 +19068,18 @@ argument ARG, change each line in region into an item." "Convert headings to normal text, or items or text to headings. If there is no active region, only the current line is considered. -If the first non blank line is an headline, remove the stars from -all headlines in the region. +With a \\[universal-argument] prefix, convert the whole list at +point into heading. -If it is a plain list item, turn all plain list items into headings. +In a region: -If it is a normal line, turn each and every normal line (i.e. not -an heading or an item) in the region into a heading. +- If the first non blank line is an headline, remove the stars + from all headlines in the region. + +- If it is a normal line turn each and every normal line (i.e. not an + heading or an item) in the region into a heading. + +- If it is a plain list item, turn all plain list items into headings. When converting a line into a heading, the number of stars is chosen such that the lines become children of the current entry. However, @@ -19091,8 +19096,14 @@ stars to add." (skip-chars-forward " \r\t\n") (point-at-bol))))) beg end) - ;; Determine boundaries of changes. If region ends at a bol, do - ;; not consider the last line to be in the region. + ;; Determine boundaries of changes. If a universal prefix has + ;; been given, put the list in a region. If region ends at a bol, + ;; do not consider the last line to be in the region. + + (when (and current-prefix-arg (org-at-item-p)) + (if (equal current-prefix-arg '(4)) (setq current-prefix-arg 1)) + (org-mark-list)) + (if (org-region-active-p) (setq beg (funcall skip-blanks (region-beginning)) end (copy-marker (save-excursion |