From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: Electric insert of headline stars Date: Thu, 25 Oct 2007 14:14:32 +0200 Message-ID: References: <3c12eb8d0710250315r633d0c9au1fdcc8c8000437b@mail.gmail.com> <878x5rpg0l.fsf@poczta.po.opole.pl> 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 1Il1bk-0005tD-AZ for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:14:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Il1bi-0005pp-Fl for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:14:39 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Il1bi-0005pd-Dv for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:14:38 -0400 Received: from ug-out-1314.google.com ([66.249.92.170]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Il1bi-0006so-4c for emacs-orgmode@gnu.org; Thu, 25 Oct 2007 08:14:38 -0400 Received: by ug-out-1314.google.com with SMTP id a2so550410ugf for ; Thu, 25 Oct 2007 05:14:37 -0700 (PDT) In-Reply-To: <878x5rpg0l.fsf@poczta.po.opole.pl> 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 Oct 25, 2007, at 1:53 PM, Seweryn Kokot wrote: > "Piotr Zielinski" writes: > >> which of course doesn't normally work, hence this elisp code. >> >> (defun local-org-insert-stars () >> (interactive) >> (when (looking-back "^ *" (point-at-bol)) >> (replace-string " " "*" nil (point-at-bol) (point))) >> (insert "*")) >> >> (define-key org-mode-map "*" 'local-org-insert-stars) >> > > Very nice idea! > A minor inconvenience is a warning when compiling the code > > .emacs:2604:30:Warning: `replace-string' used from Lisp code > That command is designed for interactive use only. > > How to get rid of this? The docstring of replace-string shows what replacement code should be used, a combination of re-search-forward and replace-match. Or you can wrap the call into a `with-no-warnings' form. However, is the code is just in your own .emacs and works well, who cares. - Carsten