From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Nice theorem display ? Date: Tue, 07 Aug 2012 23:38:22 +0200 Message-ID: <87mx26fkmp.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyrTN-0001nz-LI for emacs-orgmode@gnu.org; Tue, 07 Aug 2012 17:37:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyrTM-00034F-NI for emacs-orgmode@gnu.org; Tue, 07 Aug 2012 17:37:53 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:56210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyrTM-000346-G8 for emacs-orgmode@gnu.org; Tue, 07 Aug 2012 17:37:52 -0400 Received: by wgbds1 with SMTP id ds1so2625308wgb.0 for ; Tue, 07 Aug 2012 14:37:51 -0700 (PDT) In-Reply-To: (Joon Kwon's message of "Tue, 7 Aug 2012 22:53:05 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Joon Kwon Cc: emacs-orgmode@gnu.org Hi Joon, Joon Kwon writes: > I'm wondering if there is a simple way to make the buffer display > theorem environements (for instance) in a nice way... > > For instance, if I have the following code : > #+begin_theorem > My theorem > Bla bla bla > #+end_theorem > > I would like the buffer to display something like : > > Theorem : >  | My theorem >  | Bla bla bla >  +---- (defun my-format-theorem-blocks () "Format theorem blocks in org." (interactive) (save-excursion (goto-char (point-min)) (while (re-search-forward "#\\+begin_theorem" nil t) (let ((beg0 (match-beginning 0)) (beg (1+ (match-end 0))) (end0 (save-excursion (re-search-forward "#\\+end_theorem" nil t))) (end (match-beginning 0)) content c) (setq content (split-string (buffer-substring beg end) "\n" t)) (delete-region beg0 end0) (insert "Theorem :\n") (while (setq c (pop content)) (insert (format " | %s\n" c))) (insert " +----\n"))))) M-x my-format-theorem-blocks RET But this in a one-way only... no return. HTH, -- Bastien