From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Piotr Zielinski" Subject: Re: Re: Electric insert of headline stars Date: Thu, 25 Oct 2007 13:11:05 +0100 Message-ID: <3c12eb8d0710250511k51750491r5ecbfdb8df66b5dc@mail.gmail.com> References: <3c12eb8d0710250315r633d0c9au1fdcc8c8000437b@mail.gmail.com> <878x5rpg0l.fsf@poczta.po.opole.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Il1YK-00010f-Vz for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:11:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Il1YJ-0000xt-8p for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:11:08 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Il1YJ-0000xa-43 for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:11:07 -0400 Received: from nz-out-0506.google.com ([64.233.162.239]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Il1YI-00068i-R9 for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:11:07 -0400 Received: by nz-out-0506.google.com with SMTP id f1so476136nzc for ; Thu, 25 Oct 2007 05:11:06 -0700 (PDT) In-Reply-To: <878x5rpg0l.fsf@poczta.po.opole.pl> Content-Disposition: inline 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: Seweryn Kokot Cc: emacs-orgmode@gnu.org On 25/10/2007, Seweryn Kokot wrote: > A minor inconvenience is a warning when compiling the code First, here's the version after Bastien's and Carsten's comments: (defun local-org-insert-stars () (interactive) (when (looking-back "^ +" (point-at-bol)) (replace-string " " "*" nil (point-at-bol) (point))) (org-self-insert-command 1)) > .emacs:2604:30:Warning: `replace-string' used from Lisp code > That command is designed for interactive use only. > How to get rid of this? This is what I came up with after following the suggestion from the manual, but it looks complicated to me, so I don't really like it: (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)) Piotr