From mboxrd@z Thu Jan 1 00:00:00 1970 From: Seweryn Kokot Subject: Re: Electric insert of headline stars Date: Thu, 25 Oct 2007 15:03:58 +0200 Message-ID: <87tzofmjlt.fsf@poczta.po.opole.pl> References: <3c12eb8d0710250315r633d0c9au1fdcc8c8000437b@mail.gmail.com> <878x5rpg0l.fsf@poczta.po.opole.pl> <3c12eb8d0710250511k51750491r5ecbfdb8df66b5dc@mail.gmail.com> <87y7drmkml.fsf@poczta.po.opole.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Il2Lh-000855-To for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 09:02:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Il2Lf-00083v-Dm for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 09:02:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Il2Lf-00083c-86 for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 09:02:07 -0400 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Il2Le-0007vb-LH for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 09:02:07 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Il2LZ-00051M-Pj for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 13:02:01 +0000 Received: from nat-warynskiego.po.opole.pl ([217.173.199.132]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Oct 2007 13:02:01 +0000 Received: from s.kokot by nat-warynskiego.po.opole.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 25 Oct 2007 13:02:01 +0000 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: emacs-orgmode@gnu.org Seweryn Kokot writes: >> >> (defun local-org-insert-stars () >> (interactive) >> (when (looking-back "^ +" (point-at-bol)) >> (save-excursion >> (while (search-backward " " (point-at-bol) t) >> (replace-match "*" nil t)))) >> (org-self-insert-command 1)) > > It seems that the line > "(when (looking-back "^ +" (point-at-bol))" > is not required in the second version. ^^^^^^^^^^^^^^^ 1. > And for me it's better to add and > extra whitespace to directly type a heading name. I don't know if the > line (insert " ") is correct in this case or it should be replaced with > something (org-self-insert-command x)? ^^^^^^^^^^^^^^^ 2. > > (defun ks-org-insert-stars () > (interactive) > (save-excursion > (while (search-backward " " (point-at-bol) t) > (replace-match "*" nil t))) > (org-self-insert-command 1) > (insert " ")) > > Anyway I prefer the version without a warning and it is politically > correct according to the manual :) After some testing I withdraw the two things I wrote in my previous post. Forget it! So I'm staying with the following version (defun local-org-insert-stars () (interactive) (when (looking-back "^ +" (point-at-bol)) (save-excursion (while (search-backward " " (point-at-bol) t) (replace-match "*" nil t)))) (org-self-insert-command 1)) -- Seweryn Kokot