[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-src.el begin_src/end_src fontification may have been broken rece
From: |
Ted Zlatanov |
Subject: |
Re: org-src.el begin_src/end_src fontification may have been broken recently |
Date: |
Mon, 13 Jun 2011 10:36:28 -0500 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
On Mon, 13 Jun 2011 10:05:44 +0200 Štěpán Němec <address@hidden> wrote:
ŠN> Ted Zlatanov <address@hidden> writes:
>> I'd say a mistake shouldn't break Gnus' article display :) Can that be
>> fixed in org.el or in Gnus? It seems to me org.el is the right place.
ŠN> What is there to fix in org.el? In Org, when you use some bogus
ŠN> delimiter like #+begin_src:, the block simply won't work. If Gnus
ŠN> article display is broken, it should obviously be fixed in Gnus, no?
It throws an error during fontification, which is much harder to find
and debug than a normal error. IMHO it should warn but not error out.
Also as I mentioned a valid mode that's not installed,
e.g. `haskell-mode', will also throw the error. So it's not just a
matter of syntax.
It seems to me that org.el should be the one to avoid throwing an
error. I could be wrong; if so we can use Eric's fix below.
ŠN> BTW, if you can't remember the correct delimiters, why don't you make
ŠN> yourself a template/skeleton or something? (In Org, typing `<s' and
ŠN> pressing TAB will give you that, see (info "(org)Easy Templates").)
Oh, I have ;) The problem happens when the syntax is incorrect. Here's
what I use, which picks up the mode automatically.
#+begin_src lisp
(defun tzz-copy-mode (mode)
(cond
((member mode '("emacs-lisp"))
"lisp")
(t "text")))
(defun tzz-copy-region-with-mode-property (beg end)
(interactive "r")
(let ((text (buffer-substring beg end))
(mode (symbol-name major-mode)))
(with-temp-buffer
(insert text)
(goto-char (point-min))
(insert "#+begin_src"
(if (string-match "\\(.+\\)-mode" mode)
(concat " " (tzz-copy-mode (match-string 1 mode)))
"")
"\n")
(goto-char (point-max))
(insert "\n"
"#+end_src"
"\n")
(copy-region-as-kill (point-min) (point-max)))))
#+end_src
On Mon, 13 Jun 2011 07:38:31 -0700 Eric Schulte <address@hidden> wrote:
ES> I have the following altered function definition in my personal
ES> configuration which fixes (well, papers over) the problem.
#+begin_src emacs-lisp
(defun mm-display-org-inline (handle)
"Show an Org mode text from HANDLE inline."
(condition-case nil
(mm-display-inline-fontify handle 'org-mode)
(error (mm-insert-part handle))))
#+end_src
ES> It is not clear to me why Org-mode fontification would only throw errors
ES> when called from `mm-display-inline-fontify'.
I'm OK with your fix but also wonder if org.el should be throwing errors
during fontification. Julien, since you added this to Gnus, can you
please decide on the best place to fix it?
Ted
- Re: org-src.el begin_src/end_src fontification may have been broken recently, (continued)
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/09
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/10
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Thierry Volpiatto, 2011/06/10
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Bastien, 2011/06/11
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/11
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/11
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Julien Danjou, 2011/06/11
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/12
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Štěpán Němec, 2011/06/13
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Eric Schulte, 2011/06/13
- Re: org-src.el begin_src/end_src fontification may have been broken recently,
Ted Zlatanov <=
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Julien Danjou, 2011/06/14
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/14
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Julien Danjou, 2011/06/15
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Ted Zlatanov, 2011/06/15
- Re: org-src.el begin_src/end_src fontification may have been broken recently, Bastien, 2011/06/20
- Re: just-the-text Emacs frame, Julien Danjou, 2011/06/06
- Re: just-the-text Emacs frame, Jan Djärv, 2011/06/06
Re: just-the-text Emacs frame, T. V. Raman, 2011/06/10