From mboxrd@z Thu Jan 1 00:00:00 1970 From: stardiviner 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 Message-ID: <875zxyiyh7.fsf@gmail.com> References: <87r2gt55pq.fsf@gmail.com> <87d0sbexkq.fsf@nicolasgoaziou.fr> <871s8nua1k.fsf@gmail.com> <87zhva6grs.fsf@nicolasgoaziou.fr> Reply-To: numbchild@gmail.com Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDIRQ-0007aD-Gd for emacs-orgmode@gnu.org; Thu, 18 Oct 2018 20:15:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDIRM-0004QF-3l for emacs-orgmode@gnu.org; Thu, 18 Oct 2018 20:15:00 -0400 Received: from [61.175.244.13] (port=26715 helo=dark.localdomain) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDIRL-0003xx-84 for emacs-orgmode@gnu.org; Thu, 18 Oct 2018 20:14:55 -0400 In-reply-to: <87zhva6grs.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: org-mode Nicolas Goaziou 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 # 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