emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Piotr Zielinski <piotr.zielinski@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Electric insert of headline stars
Date: Thu, 25 Oct 2007 12:59:36 +0200	[thread overview]
Message-ID: <19A00E1C-EC56-40EA-9EB5-966D6B60B0C2@science.uva.nl> (raw)
In-Reply-To: <3c12eb8d0710250315r633d0c9au1fdcc8c8000437b@mail.gmail.com>


On Oct 25, 2007, at 12:15 PM, Piotr Zielinski wrote:

> Hi,
>
> Here's a small piece of elisp code that might be useful to some of  
> you.
> Pressing '*' now inserts '*' as before, but if there are only spaces
> between the beginning of the current line and the point, then all of
> them are converted to stars.  Useful for inserting new headlines.
>
> Longer explanaition: assume you have the following structure:
>
> * first level headline
> _* second level headline
> __* third level headline
>
> (_ denotes an invisible star) Since stars are invisible, I often find
> myself trying to create a new subheadline by just inserting a single
> star
>
> * first level headline
> _* second level headline
> __* third level headline
>    *
>
> which of course doesn't normally work, hence this elisp code.


hmm, intresting.

>
> (defun local-org-insert-stars ()
>   (interactive)
>   (when (looking-back "^ *" (point-at-bol))
>     (replace-string " " "*" nil (point-at-bol) (point)))
>   (insert "*"))

like this it will break table alignment.  it is better to use

(org-self-insert-command 1)

     instead of

(insert "*")


- Carsten

>
> (define-key org-mode-map "*" 'local-org-insert-stars)
>
> Haven't thoroughly tested it, but it seems to work ok.
>
> Piotr
>
>
> _______________________________________________
> 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	other threads:[~2007-10-25 10:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-25 10:15 Electric insert of headline stars Piotr Zielinski
2007-10-25 10:59 ` Carsten Dominik [this message]
2007-10-25 11:29 ` Bastien
2007-10-25 11:53 ` Seweryn Kokot
2007-10-25 12:11   ` Piotr Zielinski
2007-10-25 12:25     ` Carsten Dominik
2007-10-25 12:41     ` Seweryn Kokot
2007-10-25 13:03       ` Seweryn Kokot
2007-10-25 13:17     ` Bastien
2007-10-25 12:14   ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19A00E1C-EC56-40EA-9EB5-966D6B60B0C2@science.uva.nl \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=piotr.zielinski@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).