emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] temporary set source blocks major-mode-hook to nil locally to sp


From: stardiviner
Subject: Re: [O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode
Date: Thu, 18 Oct 2018 12:57:11 +0800
User-agent: mu4e 1.1.0; emacs 26.1

Nicolas Goaziou <address@hidden> writes:

> Some major modes may use major mode hooks to finish setting up their
> fontification process, who knows.
>
> In any case, it could be worth trying it. Do you want to provide a patch
> for that?
>
> Regards,

I dived into the source code of two functions which are related to
defcustom variable ~org-src-fontify-natively~.

Here is my try:

#+begin_src diff
modified   lisp/org-src.el
@@ -585,7 +585,14 @@ as `org-src-fontify-natively' is non-nil."
            (erase-buffer)
            ;; Add string and a final space to ensure property change.
            (insert string " "))
-         (unless (eq major-mode lang-mode) (funcall lang-mode))
+         (unless (eq major-mode lang-mode)
+           (message "%s enabled in source block" lang-mode)
+           ;; (make-local-variable (intern (format "%s-hook" lang-mode)))
+           ;; (set (intern (format "%s-hook" lang-mode)) nil)
+           (message "%s is %s"
+                    (intern (format "%s-hook" lang-mode))
+                    (symbol-value (intern (format "%s-hook" lang-mode))))
+           (funcall lang-mode))
          (org-font-lock-ensure)
          (let ((pos (point-min)) next)
            (while (setq next (next-property-change pos))
#+end_src

But it seems does not work as I expected.

Can't find out which real function is invoked when fontify every source blocks.

Attachment: 0001-Set-all-lang-mode-hook-to-nil-to-speedup-source-bloc.patch
Description: a simple try

--
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

reply via email to

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