From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Electric insert of headline stars Date: Thu, 25 Oct 2007 12:59:36 +0200 Message-ID: <19A00E1C-EC56-40EA-9EB5-966D6B60B0C2@science.uva.nl> References: <3c12eb8d0710250315r633d0c9au1fdcc8c8000437b@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Il0RL-0004CT-Pb for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 06:59:51 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Il0RJ-0004CH-8i for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 06:59:50 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Il0RJ-0004CE-20 for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 06:59:49 -0400 Received: from ug-out-1314.google.com ([66.249.92.175]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Il0RI-0006sg-Oa for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 06:59:49 -0400 Received: by ug-out-1314.google.com with SMTP id a2so538529ugf for ; Thu, 25 Oct 2007 03:59:47 -0700 (PDT) In-Reply-To: <3c12eb8d0710250315r633d0c9au1fdcc8c8000437b@mail.gmail.com> 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: Piotr Zielinski Cc: emacs-orgmode@gnu.org On Oct 25, 2007, at 12:15 PM, Piotr Zielinski wrote: > Hi, > > Here's a small piece of elisp code that might be useful to some of > you. > Pressing '*' now inserts '*' as before, but if there are only spaces > between the beginning of the current line and the point, then all of > them are converted to stars. Useful for inserting new headlines. > > Longer explanaition: assume you have the following structure: > > * first level headline > _* second level headline > __* third level headline > > (_ denotes an invisible star) Since stars are invisible, I often find > myself trying to create a new subheadline by just inserting a single > star > > * first level headline > _* second level headline > __* third level headline > * > > which of course doesn't normally work, hence this elisp code. hmm, intresting. > > (defun local-org-insert-stars () > (interactive) > (when (looking-back "^ *" (point-at-bol)) > (replace-string " " "*" nil (point-at-bol) (point))) > (insert "*")) like this it will break table alignment. it is better to use (org-self-insert-command 1) instead of (insert "*") - Carsten > > (define-key org-mode-map "*" 'local-org-insert-stars) > > Haven't thoroughly tested it, but it seems to work ok. > > Piotr > > > _______________________________________________ > 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