From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Enhancing the Org/Gnus experience Date: Sun, 31 Oct 2010 20:57:29 +0000 Message-ID: <878w1ef5c6.fsf@gmail.com> References: <80k4lj78ui.fsf@mundaneum.com> <87sk07fl3s.fsf@gmail.com> <80k4lf337a.fsf@mundaneum.com> <80vd4z9q2f.fsf@mundaneum.com> <874oc2z2uv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=57849 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCeys-0005i3-6u for emacs-orgmode@gnu.org; Sun, 31 Oct 2010 16:58:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCeym-00069T-PL for emacs-orgmode@gnu.org; Sun, 31 Oct 2010 16:58:22 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:43572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCeym-00064U-GX for emacs-orgmode@gnu.org; Sun, 31 Oct 2010 16:58:16 -0400 In-Reply-To: <874oc2z2uv.fsf@gmail.com> (Eric Schulte's message of "Sun, 31 Oct 2010 11:30:29 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: =?utf-8?Q?S=C3=A9bastien?= Vauban , emacs-orgmode@gnu.org Hi Seb, Wow, magic. I've totally got no idea how it works, but thanks! Dan "Eric Schulte" writes: > Hi Seb, > > This is really great. I finally folded it into my gnus setup, and while > it looks great when it works, I was getting frequent errors throw by the > org-mode fontification engine recursing too deeply. I've changed it to > the following which augments what you sent with some simple error > handling. > > ** Org-mode code block fontification > Correctly fontify Org-mode attachments > #+begin_src emacs-lisp > (add-to-list 'mailcap-mime-extensions '(".org" . "text/org")) > (add-to-list 'mm-automatic-display "text/org") >=20=20=20=20=20 > (add-to-list 'mm-inline-media-tests > '("text/org" my-display-org-inline > (lambda (el) t))) >=20=20=20=20=20 > (defun my-display-org-inline (handle) > (condition-case nil > (mm-display-inline-fontify handle 'org-mode) > (error > (insert (with-temp-buffer (mm-insert-part handle) (buffer-string= )) > "\n")))) > #+end_src > > Update =3Dorg-src-lang-modes=3D to provide some leeway for posters > #+begin_src emacs-lisp > (add-to-list 'org-src-lang-modes > '("elisp" . emacs-lisp)) > (add-to-list 'org-src-lang-modes > '("emacs_lisp" . emacs-lisp)) > #+end_src > > Fontify code blocks in the text of messages > #+begin_src emacs-lisp > (defun my-mm-org-babel-src-extract () > (mm-make-handle (mm-uu-copy-to-buffer start-point end-point) '("text/= org"))) >=20=20=20 > (add-to-list 'mm-uu-type-alist > '(org-src-block > "^[ \t]*#\\+begin_" > "^[ \t]*#\\+end_" > my-mm-org-babel-src-extract > nil)) >=20=20=20 > (mm-uu-configure) > #+end_src > > Best -- Eric > > S=C3=A9bastien Vauban writes: > >> Hi, >> >>> "Eric Schulte" wrote: >>>> S=C3=A9bastien Vauban writes: >>>>> I don't have in mind full fontification like we now have in Org. No: = *just >>>>> the basic yellow background*, so that code blocks are outstanding in = any >>>>> mail, exactly *like it is now* but for the "cut here" markers (or "v+= /v-"). >>>> >>>> While we're at it, why not go all the way to full fontification code b= lock >>>> fontification? Is the current code in org-src portable enough to be ap= plied >>>> to this (or maybe be applied whenever org-struct mode is enabled)? >>> >>> Yes, we can!? >>> >>> No idea... Maybe David could answer on such a topic? >>> >>> >>>>> Though, I don't know where to begin... Can some Org/Gnus expert give a >>>>> hint? >>>> >>>> This strays out of my narrow areas of expertise, but I hereby throw my= +1 >>>> onto the request. >>> >>> Playing a bit around, I've succeeded to make it work for the blocks, and >>> almost for the results. >> >> Put this in your .emacs file: >> >> ;; regexp matching TeX groups >> (setq mm-uu-tex-groups-regexp ".*") >> >> (eval-after-load "mm-uu" >> '(progn >> (add-to-list 'mailcap-mime-extensions '(".org" . "text/org")) >> (add-to-list 'mm-automatic-display "text/org") >> ;; (add-to-list 'mm-inlined-types "text/org") >> (add-to-list 'mm-inline-media-tests >> '("text/org" >> my-display-org-inline >> identity)) >> >> (defun my-display-org-inline (handle) >> (mm-display-inline-fontify handle 'org-mode)) >> >> (defun my-mm-org-babel-src-extract () >> (mm-make-handle (mm-uu-copy-to-buffer start-point end-point) >> '("text/org") >> nil nil >> (list mm-dissect-disposition >> (cons 'filename "Org Babel source fil= e")))) >> >> (add-to-list 'mm-uu-type-alist >> '(org-babel-block >> "^#\\+begin_" >> "^#\\+end_" >> ;; (lambda nil >> ;; (mm-uu-verbatim-marks-extract 0 0)) >> my-mm-org-babel-src-extract >> nil)) >> (mm-uu-configure))) >> >> This is an enhanced version of what I sent previously: here, the identif= ied >> block is highlighted as an Org-mode buffer. In other words, it's not in = yellow >> background anymore, but really using the faces you've customized for suc= h an >> Org-Babel block in a standard Org buffer. >> >> >>> What'd be an good extra is the colorization of such =3Dorg-verbatim=3D = strings... >> >> Still true; no clue for that one... >> >> Best regards, >> Seb > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode