From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Using C-c - to (un)listify and/or C-c * to (un)"headify" ? Date: Mon, 3 Mar 2008 11:57:54 +0100 Message-ID: <3D0FB4A6-96B6-464B-B4F7-FF2D84A9C569@gmail.com> References: <873atu617k.fsf@bzg.ath.cx> Mime-Version: 1.0 (Apple Message framework v919.2) Content-Type: multipart/mixed; boundary="===============1375638647==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JW8Mv-0002jh-HG for emacs-orgmode@gnu.org; Mon, 03 Mar 2008 05:58:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JW8Mu-0002hq-2a for emacs-orgmode@gnu.org; Mon, 03 Mar 2008 05:58:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JW8Mt-0002ha-7H for emacs-orgmode@gnu.org; Mon, 03 Mar 2008 05:58:03 -0500 Received: from ug-out-1314.google.com ([66.249.92.173]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JW8Ms-0001tV-Lx for emacs-orgmode@gnu.org; Mon, 03 Mar 2008 05:58:03 -0500 Received: by ug-out-1314.google.com with SMTP id a2so1895922ugf.48 for ; Mon, 03 Mar 2008 02:58:01 -0800 (PST) In-Reply-To: <873atu617k.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: emacs-orgmode@gnu.org --===============1375638647== Content-Type: multipart/alternative; boundary=Apple-Mail-1-748891405 --Apple-Mail-1-748891405 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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 --Apple-Mail-1-748891405 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
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?

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D
(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)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D

-- =
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

= --Apple-Mail-1-748891405-- --===============1375638647== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1375638647==--