On Oct 25, 2007, at 2:11 PM, Piotr Zielinski wrote:

On 25/10/2007, Seweryn Kokot <[EMAIL PROTECTED]> 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))


Another option would be:

(defun local-org-insert-stars ()
  (interactive)
  (if (looking-back "^ +" (point-at-bol))
(insert (make-string (prog1 (current-column) (replace-match "")) ?*)
              "* ")
    (org-self-insert-command 1)))

- Carsten


_______________________________________________
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

Reply via email to