|
| From: | Seweryn Kokot |
| Subject: | [Orgmode] Re: Electric insert of headline stars |
| Date: | Thu, 25 Oct 2007 15:03:58 +0200 |
| User-agent: | Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Seweryn Kokot <address@hidden> 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
| [Prev in Thread] | Current Thread | [Next in Thread] |