emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Redshank gets loaded when exporting ELisp code blocks to HTML!?
@ 2014-04-07 14:38 Sebastien Vauban
  2014-04-07 15:20 ` Sacha Chua
  2014-04-07 15:26 ` Nicolas Goaziou
  0 siblings, 2 replies; 5+ messages in thread
From: Sebastien Vauban @ 2014-04-07 14:38 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello,

Incidentally, because I had removed `paredit.el' from my load-path,
I could not export any Org file anymore which contained just one simple
`emacs-lisp' code block, such as:

--8<---------------cut here---------------start------------->8---
* ECM

Type:

#+begin_src emacs-lisp
M-x load-library RET ox-beamer RET
#+end_src
--8<---------------cut here---------------end--------------->8---

I found the culprit lines being:

--8<---------------cut here---------------start------------->8---
  ;; Common Lisp editing extensions
  (autoload 'redshank-mode "redshank"
    "Minor mode for restructuring Lisp code (i.e., refactoring)." t)

  (add-hook 'emacs-lisp-mode-hook 'turn-on-redshank-mode)
--8<---------------cut here---------------end--------------->8---

because:

- Redshank requires ParEdit, and
- ParEdit was not found anymore.

What I don't understand is:

    Why are Emacs Lisp minor modes loaded for exporting
    the Org document to HTML?

If not necessary, this seems suboptimal (performance-wise).

Is it really necessary?  I don't think so, because if I comment the
Redshank activation, then I can still export to HTML as before.  I just
loose the editing features in my real Emacs Lisp buffers.

So, is there a way to disactivate those minor modes during export?

Best regards,
  Seb

-- 
Sebastien Vauban

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

* Re: Redshank gets loaded when exporting ELisp code blocks to HTML!?
  2014-04-07 14:38 Redshank gets loaded when exporting ELisp code blocks to HTML!? Sebastien Vauban
@ 2014-04-07 15:20 ` Sacha Chua
  2014-05-02 13:10   ` Sebastien Vauban
  2014-04-07 15:26 ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Sacha Chua @ 2014-04-07 15:20 UTC (permalink / raw)
  To: emacs-orgmode

Sebastien Vauban <sva-news@mygooglest.com>
writes:

Hello, Sebastien!

>     Why are Emacs Lisp minor modes loaded for exporting
>     the Org document to HTML?
> If not necessary, this seems suboptimal (performance-wise).

org-export-format-source-code-or-example loads the mode associated with
the language in org-src-lang-modes in order to fontify the block. You
could check if org-export-current-backend is nil before loading anything
that you want to use only interactively.

Maybe like so?

  (add-hook 'emacs-lisp-mode-hook (lambda ()
    (unless org-export-current-backend
      (turn-on-redshank-mode))))

Sacha

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

* Re: Redshank gets loaded when exporting ELisp code blocks to HTML!?
  2014-04-07 14:38 Redshank gets loaded when exporting ELisp code blocks to HTML!? Sebastien Vauban
  2014-04-07 15:20 ` Sacha Chua
@ 2014-04-07 15:26 ` Nicolas Goaziou
  2014-04-07 15:37   ` Nicolas Goaziou
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2014-04-07 15:26 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hello,

Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:

> What I don't understand is:
>
>     Why are Emacs Lisp minor modes loaded for exporting
>     the Org document to HTML?

As a final filter, `set-auto-mode' is called in order to indent the
buffer properly. See `org-html-final-function'. When the major mode
switch happens, all associated minor modes are installed.

It also happens when exporting to a temporary buffer.

Of course, this doesn't explain why Emacs lisp minor modes are attached
to an HTML buffer. I guess there is something funny happening with
`set-auto-mode'.

> If not necessary, this seems suboptimal (performance-wise).
>
> Is it really necessary?

Not really. We could be more careful when generating code, i.e., 
we could generate code already indented.

Another option is to change major mode only when `org-html-indent' is
non-nil.

> So, is there a way to disactivate those minor modes during export?

Not at the moment.


Regards,

-- 
Nicolas Goaziou

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

* Re: Redshank gets loaded when exporting ELisp code blocks to HTML!?
  2014-04-07 15:26 ` Nicolas Goaziou
@ 2014-04-07 15:37   ` Nicolas Goaziou
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Goaziou @ 2014-04-07 15:37 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Nicolas Goaziou <n.goaziou@gmail.com> writes:

Correcting myself,

> Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
> writes:
>
>> What I don't understand is:
>>
>>     Why are Emacs Lisp minor modes loaded for exporting
>>     the Org document to HTML?
>
> As a final filter, `set-auto-mode' is called in order to indent the
> buffer properly. See `org-html-final-function'. When the major mode
> switch happens, all associated minor modes are installed.

Err, I'm wide of the mark.  Sacha is right.


Regards,

-- 
Nicolas Goaziou

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

* Re: Redshank gets loaded when exporting ELisp code blocks to HTML!?
  2014-04-07 15:20 ` Sacha Chua
@ 2014-05-02 13:10   ` Sebastien Vauban
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastien Vauban @ 2014-05-02 13:10 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hello Sacha and Nicolas,

Answering after a (too) long time with very intermittent Internet
access...

Sacha Chua wrote:
> Sebastien Vauban writes:
>
>> Why are Emacs Lisp minor modes loaded for exporting the Org document
>> to HTML?  If not necessary, this seems suboptimal (performance-wise).
>
> org-export-format-source-code-or-example loads the mode associated
> with the language in org-src-lang-modes in order to fontify the
> block.

Only to fontify, not to indent, right?

> You could check if org-export-current-backend is nil before
> loading anything that you want to use only interactively.
>
> Maybe like so?
>
>   (add-hook 'emacs-lisp-mode-hook (lambda ()
>     (unless org-export-current-backend
>       (turn-on-redshank-mode))))

This seems to be a solution (although I did not test it), but it seems
as well impractical: I'd have to chase almost all minor modes of all
languages...

Can't we assume that the major modes have all the information to fontify
the code blocks, and -- if yes -- have a manner to forbid loading all
the minor modes at once (as, then, they'd be completely useless for the
export process)?

Best regards,
  Seb

-- 
Sebastien Vauban

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

end of thread, other threads:[~2014-05-02 13:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-07 14:38 Redshank gets loaded when exporting ELisp code blocks to HTML!? Sebastien Vauban
2014-04-07 15:20 ` Sacha Chua
2014-05-02 13:10   ` Sebastien Vauban
2014-04-07 15:26 ` Nicolas Goaziou
2014-04-07 15:37   ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).