From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: inline source code blocks Date: Thu, 06 Mar 2014 15:04:05 -0700 Message-ID: <874n3bug4r.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLgd1-00023A-6T for emacs-orgmode@gnu.org; Thu, 06 Mar 2014 17:19:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WLgcw-0005zE-1D for emacs-orgmode@gnu.org; Thu, 06 Mar 2014 17:18:59 -0500 Received: from mail-pd0-x235.google.com ([2607:f8b0:400e:c02::235]:32805) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WLgcv-0005z7-QB for emacs-orgmode@gnu.org; Thu, 06 Mar 2014 17:18:53 -0500 Received: by mail-pd0-f181.google.com with SMTP id p10so3132083pdj.40 for ; Thu, 06 Mar 2014 14:18:52 -0800 (PST) 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: Ilya Shlyakhter Cc: emacs-orgmode Ilya Shlyakhter writes: > Some questions about inline source code blocks: > > - They're not fontified even when org-src-fontify-natively is true > -- correct? Correct. >=20 > - They're not included in tangled code; is that intended behavior? > The manual does not seem to say they're different from normal code > blocks, except for syntax. They were originally added for the sole purpose of including results inline in textual elements. They are not meant to export code. There is currently no support (to my knowledge) for inline fontified code. > There are also mailing list messages that suggest they're not meant > to be exported. What is the correct understanding? I can submit a > patch to the manual once I understand this myself. > That would be much appreciated. > > - For very short code snippets (1-2 lines), it would be good to > allow specifying (via properties) a default language for code blocks > (say C) and a prefix character (say '>'), after which one could write > > > int i; > I think code blocks work well for non-inline code. Although I think that an inline fontification solution may be nice. I use the following to make code block syntax less intrusive... Pretty code blocks #+begin_src emacs-lisp (defun prettier-org-code-blocks () (interactive) (font-lock-add-keywords nil '(("\\(\+begin_src\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) ?=C2= =A6) nil))) ("\\(\+end_src\\)" (0 (progn (compose-region (match-beginning 1) (match-end 1) ?=C2= =A6) nil)))))) (add-hook 'org-mode-hook 'prettier-org-code-blocks) #+end_src and code blocks may easily by typed with "< s TAB". Beyond that you could add personal customization to further reduce either the visual or typing burden. > > and have this be the equivalent of > > +BEGIN_SRC c > int i; > +END_SRC > > by analogy with short literal examples > : such as this > > Would this break any Org invariants? > > (Context: trying to use Org for literate programming in C++; > interested in others' experience in this area). > Hope these suggestions help, > > Thanks, > > Ilya > --=20 Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D