emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Using C-c - to (un)listify and/or C-c * to (un)"headify" ?
@ 2007-12-22 18:20 Bastien
  2008-03-03 10:57 ` Carsten Dominik
  0 siblings, 1 reply; 3+ messages in thread
From: Bastien @ 2007-12-22 18:20 UTC (permalink / raw)
  To: emacs-orgmode

Ahem. Sorry for the messy subject line.  
Here are two needs I often meet:

1. I need to listify the lines between a region
2. I need to convert lines into headlines

For now I'm using two simple functions (see below).  But I think there
is room for improvement.

The first function could be merged into (org-ctrl-c-minus): (un)listify
the active region, and if there is no active region, just cycle through
the list types (as it does now).  The second fonction could convert raw
lines into headings and headings back into raw lines.

Do other people find this useful?

========================================================================
(defun bzg-org-convert-to-plain-list (beg end)
  "Convert each line in the region into a plain list."
  (interactive "r")
  (string-rectangle beg end "- "))

(defun bzg-org-convert-to-headings (beg end)
  "Convert each line in the region into subheadings."
  (interactive "r")
  (let ((stars (save-excursion
		 (re-search-backward org-complex-heading-regexp nil t)
		 (or (match-string 1) "*")))
	(add-stars (if org-odd-levels-only "**" "*")))
    (string-rectangle beg end (concat add-stars stars " "))))

(define-key org-mode-map (kbd "C-c C--") 'bzg-org-convert-to-list)
(define-key org-mode-map (kbd "C-c C-*") 'bzg-org-convert-to-headings)
========================================================================

-- 
Bastien

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

* Re: Using C-c - to (un)listify and/or C-c * to (un)"headify" ?
  2007-12-22 18:20 Using C-c - to (un)listify and/or C-c * to (un)"headify" ? Bastien
@ 2008-03-03 10:57 ` Carsten Dominik
  2008-03-03 11:06   ` Bastien Guerry
  0 siblings, 1 reply; 3+ messages in thread
From: Carsten Dominik @ 2008-03-03 10:57 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1785 bytes --]


On Dec 22, 2007, at 7:20 PM, Bastien wrote:

> Ahem. Sorry for the messy subject line.
> Here are two needs I often meet:
>
> 1. I need to listify the lines between a region
> 2. I need to convert lines into headlines
>
> For now I'm using two simple functions (see below).  But I think there
> is room for improvement.
>
> The first function could be merged into (org-ctrl-c-minus):  
> (un)listify
> the active region, and if there is no active region, just cycle  
> through
> the list types (as it does now).

This is now implemented in `C-c -'

> The second fonction could convert raw
> lines into headings and headings back into raw lines.

This is now on `C-c *'

>
>
> Do other people find this useful?
>
> = 
> = 
> ======================================================================
> (defun bzg-org-convert-to-plain-list (beg end)
>  "Convert each line in the region into a plain list."
>  (interactive "r")
>  (string-rectangle beg end "- "))
>
> (defun bzg-org-convert-to-headings (beg end)
>  "Convert each line in the region into subheadings."
>  (interactive "r")
>  (let ((stars (save-excursion
> 		 (re-search-backward org-complex-heading-regexp nil t)
> 		 (or (match-string 1) "*")))
> 	(add-stars (if org-odd-levels-only "**" "*")))
>    (string-rectangle beg end (concat add-stars stars " "))))
>
> (define-key org-mode-map (kbd "C-c C--") 'bzg-org-convert-to-list)
> (define-key org-mode-map (kbd "C-c C-*") 'bzg-org-convert-to-headings)
> = 
> = 
> ======================================================================
>
> -- 
> Bastien
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[-- Attachment #1.2: Type: text/html, Size: 2642 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Using C-c - to (un)listify and/or C-c * to (un)"headify" ?
  2008-03-03 10:57 ` Carsten Dominik
@ 2008-03-03 11:06   ` Bastien Guerry
  0 siblings, 0 replies; 3+ messages in thread
From: Bastien Guerry @ 2008-03-03 11:06 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

>     The first function could be merged into (org-ctrl-c-minus): (un)listify
>     the active region, and if there is no active region, just cycle through
>     the list types (as it does now).  
>
> This is now implemented in `C-c -'
>
>     The second fonction could convert raw
>     lines into headings and headings back into raw lines.
>
> This is now on `C-c *'

Great!   I was to lazy to implement this myself, but switching from a
list of items to a list of entries is really useful.  Thanks!

-- 
Bastien

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

end of thread, other threads:[~2008-03-03 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-22 18:20 Using C-c - to (un)listify and/or C-c * to (un)"headify" ? Bastien
2008-03-03 10:57 ` Carsten Dominik
2008-03-03 11:06   ` Bastien Guerry

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