emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: org-mode <emacs-orgmode@gnu.org>
Subject: Re: temporary set source blocks major-mode-hook to nil locally to speed up Org Mode
Date: Fri, 19 Oct 2018 08:14:44 +0800	[thread overview]
Message-ID: <875zxyiyh7.fsf@gmail.com> (raw)
In-Reply-To: <87zhva6grs.fsf@nicolasgoaziou.fr>


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>
> Did you try to set the hook to a different value before (funcall lang-mode)?
>

Yes, like I said in previous messages, I want to make lang-mode-hook empty. It tested a few times, with restarting Emacs (loading a refresh Org Mode). It failed to fontify source blocks.

Reports error:

Failed to fontify source block.

I can see all source blocks are not fontified. Until I manually load the mode with [M-x load-library RET clojure-mode RET]. Then I reopen the Org file, the clojure source blocks are fontified.

Also I improved my code:

#+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)
+	    ;; FIXME: Org mode fontification error in #<buffer Code.org> at 203
+	    ;; (let (hook (intern (format "%s-hook" lang-mode)))
+	    ;;   (message "%s enabled in source block" lang-mode)
+	    ;;   (make-local-variable hook)
+	    ;;   (set hook nil)
+	    ;;   (message "%s is %s" hook (symbol-value hook)))
+	    (funcall lang-mode))
 	  (org-font-lock-ensure)
 	  (let ((pos (point-min)) next)
 	    (while (setq next (next-property-change pos))
#+end_src

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

      reply	other threads:[~2018-10-19  0:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14  7:48 temporary set source blocks major-mode-hook to nil locally to speed up Org Mode stardiviner
2018-10-15 20:58 ` Nicolas Goaziou
2018-10-18  4:57   ` stardiviner
2018-10-18 22:17     ` Nicolas Goaziou
2018-10-19  0:14       ` stardiviner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zxyiyh7.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).