emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Enhancing the Org/Gnus experience


From: Sébastien Vauban
Subject: [Orgmode] Re: Enhancing the Org/Gnus experience
Date: Thu, 04 Nov 2010 14:11:04 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

Eric,

Eric S Fraga wrote:
> Sébastien Vauban <address@hidden> writes:
>> Hi Eric (and Dan),
>> "Eric Schulte" wrote:
>>> This is really great.  I finally folded it into my gnus setup, and while
>>> it looks great when it works
>>
>> Great you love it. I'm *VERY* pleased. Moreover, having no reaction on that
>> (and on some other posts[1]), I thought I'd been kill-filed ;-)[2]
>
> Sébastien et al.,
>
> I have also included the code in my gnus configuration but I am not sure
> if it is actually doing anything or not.  Well, actually, I think it
> *is* doing something but I haven't actually seen any fontification etc.
> On the other hand, I am still getting to grips with gnus article display
> functionality so I've probably done something wrong...
>
> If there are any obvious things I should be looking at, please let me know.

Not that I know of.

For the sake of completeness, this is the part I have about my viewing
customizations.

Maybe take this into your .gnus and see what it gives?

#+begin_src emacs-lisp
;;*** 1.2 (info "(emacs-mime)Non-MIME")

      ;; regexp of Emacs sources groups
      (setq mm-uu-emacs-sources-regexp "emacs")

      ;; regexp matching diff groups
      (setq mm-uu-diff-groups-regexp
            "\\(diff\\|commit\\|cvs\\|bug\\|devel\\|reviews\\|mc\\|orgmode\\)")

      ;; regexp matching TeX groups
      (setq mm-uu-tex-groups-regexp ".*") ;; 2010-10-21 was "tex"

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

           ;; update `org-src-lang-modes' to provide some leeway for posters
           (add-to-list 'org-src-lang-modes '("elisp" . emacs-lisp))
           (add-to-list 'org-src-lang-modes '("emacs_lisp" . emacs-lisp))

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

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

           (mm-uu-configure)))


;;*** 1.5 (info "(emacs-mime)Display Customization")

      ;; You can view "text/html" parts of the current article with a WWW
      ;; browser by pressing `K H' (`gnus-article-browse-html-article')

      ;; ;; MIME type that will be displayed externally automatically
      ;; (add-to-list 'mm-automatic-external-display "text/html")

      ;; do not treat inline images as real attachments (display them,
      ;; instead)
      (add-to-list 'mm-attachment-override-types "image/.*")
                                        ; "text/x-vcard"...

      ;; don't render HTML automatically *when plain text alternative is
      ;; available*
      (eval-after-load "mm-decode"
        '(progn
           (add-to-list 'mm-discouraged-alternatives "text/html")
           (add-to-list 'mm-discouraged-alternatives "text/richtext")
           (add-to-list 'mm-discouraged-alternatives "text/enriched")
           (add-to-list 'mm-discouraged-alternatives "multipart/related")))

      ;; all images fit in the buffer
      (setq mm-inline-large-images t)

      ;; ;; always show HTML mails as attachments (even if they can be
      ;; ;; displayed) use `browse-url-browser-function' (firefox) to render
      ;; ;; HTML mails
      ;; (push "text/html" mm-inline-override-types)


      ;; use `w3m' browser (if installed) to render HTML-only mails
      (setq mm-text-html-renderer
            (cond ((executable-find "w3m") 'w3m)
                  (t 'html2text))) ;; Emacs built-in

      (eval-after-load "w3m"
        '(progn
           ;; (setq browse-url-browser-function 'w3m-browse-url)
           (setq mm-inline-text-html-renderer
                 'mm-inline-text-html-render-with-w3m)
           (setq gnus-article-wash-function
                 'gnus-article-wash-html-with-w3m)

           ;; Whenever you try to browse URLs found in articles, Gnus
           ;; (`emacs-w3m', in fact) complains that "This link is considered
           ;; unsafe...". To turn it off, frob the variables
           ;; `w3m-safe-url-regexp' and `mm-w3m-safe-url-regexp'.
           ))

      ;; allow retrieving images in HTML contents with the <img> tags
      (setq mm-inline-text-html-with-images t)

      ;; Remove HTML tags from a buffer
      (defun my/wash-ugly-html ()
        "Remove ugly HTML tags."
        (interactive)
        (toggle-read-only -1)
        (save-excursion
          (goto-char (point-min))
          (while (re-search-forward "<[^#][^<@>]*>" nil t)
            (replace-match "" nil nil))
          (goto-char (point-min))
          (while (re-search-forward "&gt;" nil t)
            (replace-match ">" nil nil))
          (goto-char (point-min))
          (while (re-search-forward "&lt;" nil t)
            (replace-match "<" nil nil))

          ;; FIXME Do not simply remove accents like it does now
          (goto-char (point-min))
          (while (re-search-forward "&[^;]*;" nil t)
            (replace-match "" nil nil))))
#+end_src


>>> 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.
>>
>> I _never_ observed problems in my case. Anyway, adding such a protection is
>> the code is a great addition. Thanks!
>>
>> I've just singed the FSF papers. Once received by the FSF, I'll
>> propagate your update onto the Gnus newsgroup.
>
> Please post here as well.  I do follow the gnus newsgroup but less
> frequently.

I'll do. For sure!


>> When that will be done, we will have a real Org experience when
>> reading mails with Gnus. I love all this tools.
>
> Yes, there's great potential for the gnus+org combination to give a
> really nice email experience!

I'm impatient to have the above things added...

Best regards,
  Seb

-- 
Sébastien Vauban




reply via email to

[Prev in Thread] Current Thread [Next in Thread]