Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: Extra marking of inserted text
       [not found] <87pqvme4m2.fsf@mundaneum.com>
@ 2010-10-07 20:45 ` Lars Magne Ingebrigtsen
       [not found]   ` <80hbggt0n0.fsf@mundaneum.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-10-07 20:45 UTC (permalink / raw)
  To: info-gnus-english

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> I would like to get such Org constructs:
>
> #+begin_src emacs-lisp
> (setq org-latex-to-pdf-process '("sh -v -x texi2dvi -p -b -c -V %f"))
> #+end_src
>
> or
>
> #+begin_src sh
> ls
> #+end_src
>
> to be *highlighted* when viewed (while reading received messages).

Doesn't Org mode have hooks into Gnus to do stuff like that?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Correctly fontify Org-mode code blocks
       [not found]     ` <m3mxq71rdd.fsf@quimbies.gnus.org>
@ 2011-01-06 10:38       ` Sébastien Vauban
  0 siblings, 0 replies; 2+ messages in thread
From: Sébastien Vauban @ 2011-01-06 10:38 UTC (permalink / raw)
  To: info-gnus-english-mXXj517/zsQ

Hi Lars,

Lars Magne Ingebrigtsen wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>>
>>> I would like to get such Org constructs:
>>>
>>> #+begin_src emacs-lisp
>>> (setq org-latex-to-pdf-process '("sh -v -x texi2dvi -p -b -c -V %f"))
>>> #+end_src
>>>
>>> or
>>>
>>> #+begin_src sh
>>> ls
>>> #+end_src
>>>
>>> to be *highlighted* when viewed (while reading received messages).
>>
>> Does this sound good to you?
>
> Looks good. Could you provide a patch to Gnus?

This is the best final code I currently have:

--8<---------------cut here---------------start------------->8---
      (eval-after-load "mm-uu"
        '(progn
           ;; correctly fontify Org-mode attachments
           (add-to-list 'mailcap-mime-extensions '(".org" . "text/org"))
           (add-to-list 'mm-automatic-display "text/org")

           (add-to-list 'mm-inline-media-tests
                        '("text/org" my/display-org-inline
                          (lambda (el) t)))

           (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"))))

           ;; fontify code blocks in the text of messages
           (defun my/mm-org-src-code-block-extract ()
             (mm-make-handle (mm-uu-copy-to-buffer start-point end-point)
                             '("text/org")))

           (add-to-list 'mm-uu-type-alist
                        '(org-src-code-block
                          "^[ \t]*#\\+begin_"
                          "^[ \t]*#\\+end_"
                          my/mm-org-src-code-block-extract
                          nil))

           (add-to-list 'mm-uu-type-alist
                        '(org-meta-line
                          "^[ \t]*#\\+[[:alpha:]]+: "
                          "$"
                          my/mm-org-src-code-block-extract
                          nil))

           (mm-uu-configure)))
--8<---------------cut here---------------end--------------->8---

It is based on my original code, and has been slightly reviewed by Eric
Schulte (adding error handling).


> And do you have copyright assignment papers on file with the FSF? That's
> needed for "substantial changes", which is "more than ten lines of code",
> basically.

I did. I will send a digital copy to you by private email.

Best regards,
  Seb

-- 
Sébastien Vauban

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-06 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87pqvme4m2.fsf@mundaneum.com>
2010-10-07 20:45 ` Extra marking of inserted text Lars Magne Ingebrigtsen
     [not found]   ` <80hbggt0n0.fsf@mundaneum.com>
     [not found]     ` <m3mxq71rdd.fsf@quimbies.gnus.org>
2011-01-06 10:38       ` Correctly fontify Org-mode code blocks Sébastien Vauban

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 NNTP newsgroup(s).