emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: Publishing with org-src-fontify-natively fails with Lisp error: (void-function -mode) [7.4 (release_7.4.79.g9c4b9)]
@ 2010-12-22  3:56 Bernt Hansen
  2010-12-22  4:06 ` [PATCH] Skip source block fontification when the language is not defined Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2010-12-22  3:56 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I have a patch for this problem which works for me but I'm not sure it's
the correct fix.  Will post the patch following this report.

When I attempt to publish the source for
http://doc.norang.ca/org-mode.html (a copy of which is at
http://doc.norang.ca/org-mode.org) with org-src-fontify-natively set to
t I get the error void-function -mode.

I start a fresh emacs, load the org file and call M-x
bh/save-then-publish.

--8<---------------cut here---------------start------------->8---
(defun bh/save-then-publish (&optional force)
  (interactive "P")
  (save-buffer)
  (org-save-all-org-buffers)
  (org-publish-current-project force))

(setq org-publish-project-alist
      ;
      ; http://www.norang.ca/  (norang website)
      ; norang-org are the org-files that generate the content
      ; norang-extra are images and css files that need to be included
      ; norang is the top-level project that gets published
      (quote (("norang-org"
	       :base-directory "~/git/www.norang.ca"
	       :publishing-directory "/ssh:www-data@www:~/www.norang.ca/htdocs"
	       :recursive t
	       :table-of-contents nil
	       :base-extension "org"
	       :publishing-function org-publish-org-to-html
	       :style-include-default nil
	       :section-numbers nil
	       :table-of-contents nil
	       :style "<link rel=\"stylesheet\" href=\"norang.css\" type=\"text/css\" />"
	       :author-info nil
	       :creator-info nil)
	      ("norang-extra"
	       :base-directory "~/git/www.norang.ca/"
	       :publishing-directory "/ssh:www-data@www:~/www.norang.ca/htdocs"
	       :base-extension "css\\|pdf\\|png\\|jpg\\|gif"
	       :publishing-function org-publish-attachment
	       :recursive t
	       :author nil)
	      ("norang"
	       :components ("norang-org" "norang-extra"))
	      ;
	      ; http://doc.norang.ca/  (norang website)
	      ; doc-org are the org-files that generate the content
	      ; doc-extra are images and css files that need to be included
	      ; doc is the top-level project that gets published
	      ("doc-org"
	       :base-directory "~/git/doc.norang.ca/"
	       :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs"
	       :recursive t
	       :section-numbers nil
	       :table-of-contents nil
	       :base-extension "org"
	       :publishing-function (org-publish-org-to-html org-publish-org-to-org)
	       :style-include-default nil
	       :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />"
	       :author-info nil
	       :creator-info nil)
	      ("doc-extra"
	       :base-directory "~/git/doc.norang.ca/"
	       :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs"
	       :base-extension "css\\|pdf\\|png\\|jpg\\|gif"
	       :publishing-function org-publish-attachment
	       :recursive t
	       :author nil)
	      ("doc"
	       :components ("doc-org" "doc-extra"))
	      ;
	      ; Miscellaneous pages for other websites
	      ; org are the org-files that generate the content
	      ("org-org"
	       :base-directory "~/git/org/"
	       :publishing-directory "/ssh:www-data@www:~/org"
	       :recursive t
	       :section-numbers nil
	       :table-of-contents nil
	       :base-extension "org"
	       :publishing-function org-publish-org-to-html
	       :style-include-default nil
	       :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />"
	       :author-info nil
	       :creator-info nil)
	      ;
	      ; http://doc.norang.ca/  (norang website)
	      ; org-mode-doc-org this document
	      ; org-mode-doc-extra are images and css files that need to be included
	      ; org-mode-doc is the top-level project that gets published
	      ; This uses the same target directory as the 'doc' project
	      ("org-mode-doc-org"
	       :base-directory "~/git/org-mode-doc/"
	       :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs"
	       :recursive t
	       :section-numbers nil
	       :table-of-contents nil
	       :base-extension "org"
	       :publishing-function (org-publish-org-to-html org-publish-org-to-org)
	       :plain-source t
	       :htmlized-source t
	       :style-include-default nil
	       :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />"
	       :author-info nil
	       :creator-info nil)
	      ("org-mode-doc-extra"
	       :base-directory "~/git/org-mode-doc/"
	       :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs"
	       :base-extension "css\\|pdf\\|png\\|jpg\\|gif"
	       :publishing-function org-publish-attachment
	       :recursive t
	       :author nil)
	      ("org-mode-doc"
	       :components ("org-mode-doc-org" "org-mode-doc-extra"))
	      ;
	      ; http://doc.norang.ca/  (norang website)
	      ; org-mode-doc-org this document
	      ; org-mode-doc-extra are images and css files that need to be included
	      ; org-mode-doc is the top-level project that gets published
	      ; This uses the same target directory as the 'doc' project
	      ("tmp-org"
	       :base-directory "/tmp/"
	       :publishing-directory "/ssh:www-data@www:~/www.norang.ca/htdocs/tmp"
	       :recursive t
	       :section-numbers nil
	       :table-of-contents nil
	       :base-extension "org"
	       :publishing-function (org-publish-org-to-html org-publish-org-to-org)
	       :plain-source t
	       :htmlized-source t
	       :style-include-default t
	       :author-info nil
	       :creator-info nil)
	      ("tmp-extra"
	       :base-directory "/tmp/"
	       :publishing-directory "/ssh:www-data@www:~/www.norang.ca/htdocs/tmp"
	       :base-extension "png"
	       :publishing-function org-publish-attachment
	       :recursive t
	       :author nil)
	      ("tmp"
	       :components ("tmp-org" "tmp-extra")))))

--8<---------------cut here---------------end--------------->8---


This results in the following error:

Debugger entered--Lisp error: (void-function -mode)
  -mode()
  funcall(-mode)
  (if (eq major-mode lang-mode) nil (funcall lang-mode))
  (unless (eq major-mode lang-mode) (funcall lang-mode))
  (save-current-buffer (set-buffer (get-buffer-create ...)) (delete-region (point-min) (point-max)) (insert string) (unless (eq major-mode lang-mode) (funcall lang-mode)) (font-lock-fontify-buffer) (setq pos (point-min)) (while (setq next ...) (put-text-property ... ... ... ... org-buffer) (setq pos next)))
  (with-current-buffer (get-buffer-create (concat " org-src-fontification:" ...)) (delete-region (point-min) (point-max)) (insert string) (unless (eq major-mode lang-mode) (funcall lang-mode)) (font-lock-fontify-buffer) (setq pos (point-min)) (while (setq next ...) (put-text-property ... ... ... ... org-buffer) (setq pos next)))
  (let* ((lang-mode ...) (string ...) (modified ...) (org-buffer ...) pos next) (remove-text-properties start end (quote ...)) (with-current-buffer (get-buffer-create ...) (delete-region ... ...) (insert string) (unless ... ...) (font-lock-fontify-buffer) (setq pos ...) (while ... ... ...)) (add-text-properties start end (quote ...)) (set-buffer-modified-p modified))
  org-src-font-lock-fontify-block("" 49905 50459)
  (cond ((and lang org-src-fontify-natively) (org-src-font-lock-fontify-block lang block-start block-end)) (quoting (add-text-properties beg1 ... ...)) ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") (add-text-properties beg1 end1 ...)) ((string= block-type "verse") (add-text-properties beg1 end1 ...)))
  (progn (setq end (match-end 0) end1 (1- ...)) (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end ...)) (add-text-properties beg end (quote ...)) (add-text-properties beg beg1 (quote ...)) (add-text-properties end1 (+ end 1) (quote ...)) (cond (... ...) (quoting ...) (...) (... ...) (... ...)) t)
  (if (re-search-forward (concat "^[ 	]*#\\+end" ... "\\>.*") nil t) (progn (setq end ... end1 ...) (setq block-end ...) (when quoting ...) (add-text-properties beg end ...) (add-text-properties beg beg1 ...) (add-text-properties end1 ... ...) (cond ... ... ... ... ...) t))
  (when (re-search-forward (concat "^[ 	]*#\\+end" ... "\\>.*") nil t) (setq end (match-end 0) end1 (1- ...)) (setq block-end (match-beginning 0)) (when quoting (remove-text-properties beg end ...)) (add-text-properties beg end (quote ...)) (add-text-properties beg beg1 (quote ...)) (add-text-properties end1 (+ end 1) (quote ...)) (cond (... ...) (quoting ...) (...) (... ...) (... ...)) t)
  (cond ((member dc1 ...) (org-remove-flyspell-overlays-in ... ...) (remove-text-properties ... ... ...) (add-text-properties ... ... ...) (add-text-properties ... ... ...) t) ((and ... ...) (setq block-type ... quoting ...) (when ... ... ... ... ... ... ... ... t)) ((member dc1 ...) (add-text-properties beg ... ...) (add-text-properties ... ... ...)) ((not ...) (add-text-properties beg ... ...) t) ((or ... ...) (add-text-properties beg ... ...) t) ((member dc3 ...) (add-text-properties beg ... ...)) (t nil))
  (let ((beg ...) (block-start ...) (block-end nil) (lang ...) (beg1 ...) (dc1 ...) (dc3 ...) end end1 quoting block-type) (cond (... ... ... ... ... t) (... ... ...) (... ... ...) (... ... t) (... ... t) (... ...) (t nil)))
  (if (re-search-forward "^\\([ 	]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ 	]*\\(\\([^ 	\n]*\\)[ 	]*\\(.*\\)\\)\\)" limit t) (let (... ... ... ... ... ... ... end end1 quoting block-type) (cond ... ... ... ... ... ... ...)))
  (let ((case-fold-search t)) (if (re-search-forward "^\\([ 	]*#\\+\\(\\([a-zA-Z]+:?\\| \\|$\\)\\(_\\([a-zA-Z]+\\)\\)?\\)[ 	]*\\(\\([^ 	\n]*\\)[ 	]*\\(.*\\)\\)\\)" limit t) (let ... ...)))
  org-fontify-meta-lines-and-blocks(157030)
  font-lock-fontify-keywords-region(1 157030 nil)
  font-lock-default-fontify-region(1 157030 nil)
  ad-Orig-font-lock-fontify-region(1 157030 nil)
  (setq ad-return-value (ad-Orig-font-lock-fontify-region beg end loudly))
  (let ((develock-inhibit-advice-font-lock-set-defaults t)) (setq ad-return-value (ad-Orig-font-lock-fontify-region beg end loudly)))
  (let (ad-return-value) (let (...) (setq ad-return-value ...)) ad-return-value)
  font-lock-fontify-region(1 157030)
  run-hook-with-args(font-lock-fontify-region 1 157030)
  byte-code("\302\303\b	#\207" [start next run-hook-with-args jit-lock-functions] 4)
  jit-lock-fontify-now(1 157030)
  (progn (if (> ... 65536) (message "Forcing fontification of %s..." ...)) (jit-lock-fontify-now (point-min) (point-max)) (if (> ... 65536) (message "Forcing fontification of %s...done" ...)))
  (htmlize-with-fontify-message (jit-lock-fontify-now (point-min) (point-max)))
  (cond ((and ... ...) (htmlize-with-fontify-message ...)) ((and ... ...) (htmlize-with-fontify-message ...)) ((and ... ...) (htmlize-with-fontify-message ...)))
  (progn (cond (... ...) (... ...) (... ...)))
  (if (and (boundp ...) font-lock-mode) (progn (cond ... ... ...)))
  (when (and (boundp ...) font-lock-mode) (cond (... ...) (... ...) (... ...)))
  htmlize-ensure-fontified()
  (save-excursion (save-excursion (run-hooks ...)) (htmlize-ensure-fontified) (clrhash htmlize-extended-character-cache) (clrhash htmlize-memoization-table) (let* (... ... ... ... ...) (with-current-buffer htmlbuf ... ... ... ... ... ... ... ... ... ... ... ...) (let ... ... ...) (with-current-buffer htmlbuf ... ... ... ... ... ... ... ... ... ... ... ... ...) htmlbuf))
  htmlize-buffer-1()
  (save-current-buffer (set-buffer (or buffer ...)) (htmlize-buffer-1))
  (with-current-buffer (or buffer (current-buffer)) (htmlize-buffer-1))
  (let ((htmlbuf ...)) (when (interactive-p) (switch-to-buffer htmlbuf)) htmlbuf)
  htmlize-buffer()
  (let* ((htmlize-output-type ...) (newbuf ...)) (with-current-buffer newbuf (when org-export-htmlized-org-css-url ... ...) (write-file ...)) (kill-buffer newbuf))
  (progn (require (quote htmlize)) (require (quote org-html)) (font-lock-fontify-buffer) (let* (... ...) (with-current-buffer newbuf ... ...) (kill-buffer newbuf)))
  (if (plist-get opt-plist :htmlized-source) (progn (require ...) (require ...) (font-lock-fontify-buffer) (let* ... ... ...)))
  (when (plist-get opt-plist :htmlized-source) (require (quote htmlize)) (require (quote org-html)) (font-lock-fontify-buffer) (let* (... ...) (with-current-buffer newbuf ... ...) (kill-buffer newbuf)))
  (save-excursion (switch-to-buffer buffer) (erase-buffer) (insert region) (let (...) (org-mode)) (org-install-letbind) (org-export-remove-archived-trees (plist-get opt-plist :archived-trees)) (org-export-remove-comment-blocks-and-subtrees) (org-export-handle-export-tags (plist-get opt-plist :select-tags) (plist-get opt-plist :exclude-tags)) (when (or ... ...) (save-buffer)) (when (plist-get opt-plist :htmlized-source) (require ...) (require ...) (font-lock-fontify-buffer) (let* ... ... ...)) (set-buffer-modified-p nil) (if (equal to-buffer ...) (progn ... ... str-ret) (kill-buffer ...)))
  (let* ((opt-plist ...) (bfname ...) (filename ...) (filename ...) (backup-inhibited t) (buffer ...) (region ...) str-ret) (save-excursion (switch-to-buffer buffer) (erase-buffer) (insert region) (let ... ...) (org-install-letbind) (org-export-remove-archived-trees ...) (org-export-remove-comment-blocks-and-subtrees) (org-export-handle-export-tags ... ...) (when ... ...) (when ... ... ... ... ...) (set-buffer-modified-p nil) (if ... ... ...)))
  org-export-as-org(nil nil (:buffer-will-be-killed t :base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) nil nil "/ssh:www-data@www:/var/www/doc.norang.ca/htdocs/")
  funcall(org-export-as-org nil nil (:buffer-will-be-killed t :base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) nil nil "/ssh:www-data@www:/var/www/doc.norang.ca/htdocs/")
  (setq export-buf-or-file (funcall (intern ...) (plist-get plist :headline-levels) nil plist nil (plist-get plist :body-only) pub-dir))
  (let* ((plist ...) (init-buf ...) (init-point ...) (init-buf-string ...) export-buf-or-file) (run-hooks (quote org-publish-before-export-hook)) (setq export-buf-or-file (funcall ... ... nil plist nil ... pub-dir)) (when (and ... ...) (set-buffer export-buf-or-file) (progn ... ...) (kill-buffer export-buf-or-file)) (set-buffer init-buf) (when (buffer-modified-p init-buf) (erase-buffer) (insert init-buf-string) (save-buffer) (goto-char init-point)) (unless visiting (kill-buffer init-buf)))
  (save-excursion (switch-to-buffer (or visiting ...)) (let* (... ... ... ... export-buf-or-file) (run-hooks ...) (setq export-buf-or-file ...) (when ... ... ... ...) (set-buffer init-buf) (when ... ... ... ... ...) (unless visiting ...)))
  (let ((visiting ...)) (save-excursion (switch-to-buffer ...) (let* ... ... ... ... ... ... ...)))
  org-publish-org-to("org" (:base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) "/home/bernt/git/org-mode-doc/org-mode.org" "/ssh:www-data@www:/var/www/doc.norang.ca/htdocs/")
  org-publish-org-to-org((:base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) "/home/bernt/git/org-mode-doc/org-mode.org" "/ssh:www-data@www:/var/www/doc.norang.ca/htdocs/")
  funcall(org-publish-org-to-org (:base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) "/home/bernt/git/org-mode-doc/org-mode.org" "/ssh:www-data@www:/var/www/doc.norang.ca/htdocs/")
  (progn (funcall f project-plist filename tmp-pub-dir) (org-publish-update-timestamp filename pub-dir f))
  (if (org-publish-needed-p filename pub-dir f tmp-pub-dir) (progn (funcall f project-plist filename tmp-pub-dir) (org-publish-update-timestamp filename pub-dir f)))
  (when (org-publish-needed-p filename pub-dir f tmp-pub-dir) (funcall f project-plist filename tmp-pub-dir) (org-publish-update-timestamp filename pub-dir f))
  (lambda (f) (when (org-publish-needed-p filename pub-dir f tmp-pub-dir) (funcall f project-plist filename tmp-pub-dir) (org-publish-update-timestamp filename pub-dir f)))(org-publish-org-to-org)
  mapc((lambda (f) (when (org-publish-needed-p filename pub-dir f tmp-pub-dir) (funcall f project-plist filename tmp-pub-dir) (org-publish-update-timestamp filename pub-dir f))) (org-publish-org-to-html org-publish-org-to-org))
  (if (listp publishing-function) (mapc (lambda ... ...) publishing-function) (when (org-publish-needed-p filename pub-dir publishing-function tmp-pub-dir) (funcall publishing-function project-plist filename tmp-pub-dir) (org-publish-update-timestamp filename pub-dir publishing-function)))
  (let* ((project ...) (project-plist ...) (ftname ...) (publishing-function ...) (base-dir ...) (pub-dir ...) tmp-pub-dir) (unless no-cache (org-publish-initialize-cache ...)) (setq tmp-pub-dir (file-name-directory ...)) (if (listp publishing-function) (mapc ... publishing-function) (when ... ... ...)) (unless no-cache (org-publish-write-cache-file)))
  org-publish-file("/home/bernt/git/org-mode-doc/org-mode.org" ("org-mode-doc-org" :base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) t)
  (while (setq file (pop files)) (org-publish-file file project t))
  (let* ((project-plist ...) (exclude-regexp ...) (sitemap-p ...) (sitemap-filename ...) (sitemap-function ...) (preparation-function ...) (completion-function ...) (files ...) file) (when preparation-function (run-hooks ...)) (if sitemap-p (funcall sitemap-function project sitemap-filename)) (while (setq file ...) (org-publish-file file project t)) (when (plist-get project-plist :makeindex) (org-publish-index-generate-theindex\.inc ...) (org-publish-file ... project t)) (when completion-function (run-hooks ...)) (org-publish-write-cache-file))
  (lambda (project) (org-publish-initialize-cache (car project)) (let* (... ... ... ... ... ... ... ... file) (when preparation-function ...) (if sitemap-p ...) (while ... ...) (when ... ... ...) (when completion-function ...) (org-publish-write-cache-file)))(("org-mode-doc-org" :base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil))
  mapc((lambda (project) (org-publish-initialize-cache (car project)) (let* (... ... ... ... ... ... ... ... file) (when preparation-function ...) (if sitemap-p ...) (while ... ...) (when ... ... ...) (when completion-function ...) (org-publish-write-cache-file))) (("org-mode-doc-org" :base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www-data@www:~/doc.norang.ca/htdocs" :recursive t :section-numbers nil :table-of-contents nil :base-extension "org" :publishing-function (org-publish-org-to-html org-publish-org-to-org) :plain-source t :htmlized-source t :style-include-default nil :style "<link rel=\"stylesheet\" href=\"/org.css\" type=\"text/css\" />" :author-info nil :creator-info nil) ("org-mode-doc-extra" :base-directory "~/git/org-mode-doc/" :publishing-directory "/ssh:www
 -data@www:~/doc.norang.ca/htdocs" :base-extension "css\\|pdf\\|png\\|jpg\\|gif" :publishing-function org-publish-attachment :recursive t :author nil)))
  org-publish-projects((("org-mode-doc" :components ("org-mode-doc-org" "org-mode-doc-extra"))))
  (let* ((org-publish-use-timestamps-flag ...)) (org-publish-projects (if ... ... ...)))
  (save-window-excursion (let* (...) (org-publish-projects ...)))
  org-publish(("org-mode-doc" :components ("org-mode-doc-org" "org-mode-doc-extra")))
  (let ((project ...) (org-publish-use-timestamps-flag ...)) (if (not project) (error "File %s is not part of any known project" ...)) (org-publish project))
  (save-window-excursion (let (... ...) (if ... ...) (org-publish project)))
  org-publish-current-project(nil)
  bh/save-then-publish(nil)
  call-interactively(bh/save-then-publish nil nil)


Emacs  : GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2010-11-03 on potassium, modified by Debian
Package: Org-mode version 7.4 (release_7.4.79.g9c4b9)

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

* [PATCH] Skip source block fontification when the language is not defined
  2010-12-22  3:56 Bug: Publishing with org-src-fontify-natively fails with Lisp error: (void-function -mode) [7.4 (release_7.4.79.g9c4b9)] Bernt Hansen
@ 2010-12-22  4:06 ` Bernt Hansen
  2010-12-22 12:08   ` Dan Davison
  0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2010-12-22  4:06 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

* lisp/org.el: Skip source block fontification during export when language
is not defined
---
This may not be the correct fix for this issue but it works for me.

This patch is available at git://git.norang.ca/org-mode.git fix-export

-Bernt

 lisp/org.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3cecca7..006e7bf 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5142,7 +5142,7 @@ will be prompted for."
 	      (add-text-properties end1 (+ end 1) '(face org-meta-line))
 					; for end_src
 	      (cond
-	       ((and lang org-src-fontify-natively)
+	       ((and lang (not (string-equal lang "")) org-src-fontify-natively)
 		(org-src-font-lock-fontify-block lang block-start block-end))
 	       (quoting
 		(add-text-properties beg1 (+ end1 1) '(face
-- 
1.7.3.3.464.gf80b6

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

* Re: [PATCH] Skip source block fontification when the language is not defined
  2010-12-22  4:06 ` [PATCH] Skip source block fontification when the language is not defined Bernt Hansen
@ 2010-12-22 12:08   ` Dan Davison
  2010-12-22 13:57     ` Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Davison @ 2010-12-22 12:08 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> * lisp/org.el: Skip source block fontification during export when language
> is not defined
> ---
> This may not be the correct fix for this issue but it works for me.

Hi Bernt,

I've checked in a slightly different version[1] of this fix. Thanks for
the report; it wasn't nice to have been throwing errors every time an
unrecognised (e.g. partial) language string was entered, even if most of
the time font-lock was subduing these errors.

Dan

Footnotes:
[1] I've made the org-src fontification function test, early on, whether
the language major-mode function exists. If it doesn't then it returns
immediately.


>
> This patch is available at git://git.norang.ca/org-mode.git fix-export
>
> -Bernt
>
>  lisp/org.el |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lisp/org.el b/lisp/org.el
> index 3cecca7..006e7bf 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -5142,7 +5142,7 @@ will be prompted for."
>  	      (add-text-properties end1 (+ end 1) '(face org-meta-line))
>  					; for end_src
>  	      (cond
> -	       ((and lang org-src-fontify-natively)
> +	       ((and lang (not (string-equal lang "")) org-src-fontify-natively)
>  		(org-src-font-lock-fontify-block lang block-start block-end))
>  	       (quoting
>  		(add-text-properties beg1 (+ end1 1) '(face

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

* Re: [PATCH] Skip source block fontification when the language is not defined
  2010-12-22 12:08   ` Dan Davison
@ 2010-12-22 13:57     ` Bernt Hansen
  2010-12-22 15:11       ` Dan Davison
  0 siblings, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2010-12-22 13:57 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode

Dan Davison <dandavison7@gmail.com> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> * lisp/org.el: Skip source block fontification during export when language
>> is not defined
>> ---
>> This may not be the correct fix for this issue but it works for me.
>
> Hi Bernt,
>
> I've checked in a slightly different version[1] of this fix. Thanks for
> the report; it wasn't nice to have been throwing errors every time an
> unrecognised (e.g. partial) language string was entered, even if most of
> the time font-lock was subduing these errors.
>
> Dan
>
> Footnotes:
> [1] I've made the org-src fontification function test, early on, whether
> the language major-mode function exists. If it doesn't then it returns
> immediately.

Thanks Dan,

Your fix works for me :).

I'm confused about _why_ I'm getting these errors though - I was
expecting fontification only to apply to #+begin_src blocks and I'm only
using a few languages in that document (sh, org, emacs-lisp, ditaa, and dot).

Unless it's picking up on the begin_src in the following text

,----
| I use this to create =#+begin_*= blocks like 
| - =#+begin_example=
| - =#+begin_ditaa=
| - =#+begin_dot=
| - =#+begin_src=
| - etc.
`----

I wasn't able to determine the source line of the problem from the stack
dump information.  Is there any way to determine what part of the
document is causing this (other than manually bisecting and exporting
with missing sections) ?

Regards,
Bernt

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

* Re: [PATCH] Skip source block fontification when the language is not defined
  2010-12-22 13:57     ` Bernt Hansen
@ 2010-12-22 15:11       ` Dan Davison
  2010-12-22 17:34         ` Bernt Hansen
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Davison @ 2010-12-22 15:11 UTC (permalink / raw)
  To: emacs-orgmode

Bernt Hansen <bernt@norang.ca> writes:

> Dan Davison <dandavison7@gmail.com> writes:
>
>> Bernt Hansen <bernt@norang.ca> writes:
>>
>>> * lisp/org.el: Skip source block fontification during export when language
>>> is not defined
>>> ---
>>> This may not be the correct fix for this issue but it works for me.
>>
>> Hi Bernt,
>>
>> I've checked in a slightly different version[1] of this fix. Thanks for
>> the report; it wasn't nice to have been throwing errors every time an
>> unrecognised (e.g. partial) language string was entered, even if most of
>> the time font-lock was subduing these errors.
>>
>> Dan
>>
>> Footnotes:
>> [1] I've made the org-src fontification function test, early on, whether
>> the language major-mode function exists. If it doesn't then it returns
>> immediately.
>
> Thanks Dan,
>
> Your fix works for me :).
>
> I'm confused about _why_ I'm getting these errors though - I was
> expecting fontification only to apply to #+begin_src blocks and I'm only
> using a few languages in that document (sh, org, emacs-lisp, ditaa, and dot).
>
> Unless it's picking up on the begin_src in the following text

Hi Bernt,

I was wondering about the same thing.

How about hacking the org-src-font-lock-fontify-block function so that
it throws an error with a helpful message when the language string is
unrecognised? I just tried this on your document with C-c C-e h and it
didn't throw anything, but maybe in your setup it will? (Check the
*Messages* buffer, it may be that font-lock handles the error). I've
prepended the below with "$ " to stop patchwork from grabbing it.

$ diff --git a/lisp/org-src.el b/lisp/org-src.el
$ index f55e292..0d796b4 100644
$ --- a/lisp/org-src.el
$ +++ b/lisp/org-src.el
$ @@ -781,7 +781,9 @@ fontification of code blocks see `org-src-fontify-block' and
$  	  (add-text-properties
$  	   start end
$  	   '(font-lock-fontified t fontified t font-lock-multiline t))
$ -	  (set-buffer-modified-p modified)))))
$ +	  (set-buffer-modified-p modified))
$ +      (error "Unrecognised language: %s line: %d"
$ +	       lang (line-number-at-pos (point))))))

Dan

>
> ,----
> | I use this to create =#+begin_*= blocks like 
> | - =#+begin_example=
> | - =#+begin_ditaa=
> | - =#+begin_dot=
> | - =#+begin_src=
> | - etc.
> `----
>
> I wasn't able to determine the source line of the problem from the stack
> dump information.  Is there any way to determine what part of the
> document is causing this (other than manually bisecting and exporting
> with missing sections) ?
>
> Regards,
> Bernt
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [PATCH] Skip source block fontification when the language is not defined
  2010-12-22 15:11       ` Dan Davison
@ 2010-12-22 17:34         ` Bernt Hansen
  0 siblings, 0 replies; 6+ messages in thread
From: Bernt Hansen @ 2010-12-22 17:34 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs-orgmode

Dan Davison <dandavison7@gmail.com> writes:

> Bernt Hansen <bernt@norang.ca> writes:
>
>> I'm confused about _why_ I'm getting these errors though - I was
>> expecting fontification only to apply to #+begin_src blocks and I'm only
>> using a few languages in that document (sh, org, emacs-lisp, ditaa, and dot).
>>
>> Unless it's picking up on the begin_src in the following text
>
> Hi Bernt,
>
> I was wondering about the same thing.
>
> How about hacking the org-src-font-lock-fontify-block function so that
> it throws an error with a helpful message when the language string is
> unrecognised? I just tried this on your document with C-c C-e h and it
> didn't throw anything, but maybe in your setup it will? (Check the
> *Messages* buffer, it may be that font-lock handles the error). I've
> prepended the below with "$ " to stop patchwork from grabbing it.
>
> $ diff --git a/lisp/org-src.el b/lisp/org-src.el
> $ index f55e292..0d796b4 100644
> $ --- a/lisp/org-src.el
> $ +++ b/lisp/org-src.el
> $ @@ -781,7 +781,9 @@ fontification of code blocks see `org-src-fontify-block' and
> $  	  (add-text-properties
> $  	   start end
> $  	   '(font-lock-fontified t fontified t font-lock-multiline t))
> $ -	  (set-buffer-modified-p modified)))))
> $ +	  (set-buffer-modified-p modified))
> $ +      (error "Unrecognised language: %s line: %d"
> $ +	       lang (line-number-at-pos (point))))))
>
> Dan

,----[ messages buffer ]
| Fontifying  org-src-fontification:emacs-lisp-mode... (regexps.....................)
| if: Unrecognised language:  line: 1210
| Ispell process killed
| Starting new Ispell process [british] ...
`----

This chokes on the #+end_example line of this block:

,----
| 
| *Clock history selection buffer for C-u C-c C-x C-i*
| #+begin_example
|   Default Task
|   [d] norang          Organization                          <-- Task B
|   The task interrupted by starting the last one
|   [i] norang          Organization                          <-- Task B
|   Current Clocking Task
|   [c] org             NEXT Document my use of org-mode      <-- Task A
|   Recent Tasks
|   [1] org             NEXT Document my use of org-mode      <-- Task A
|   [2] norang          Organization                          <-- Task B
|   ...
|   [Z] org             DONE Fix default section links        <-- 35 clock task entries ago
| #+end_example
`----

The last line '#+end_example' is line 1210.

Huh?

-Bernt

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

end of thread, other threads:[~2010-12-22 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22  3:56 Bug: Publishing with org-src-fontify-natively fails with Lisp error: (void-function -mode) [7.4 (release_7.4.79.g9c4b9)] Bernt Hansen
2010-12-22  4:06 ` [PATCH] Skip source block fontification when the language is not defined Bernt Hansen
2010-12-22 12:08   ` Dan Davison
2010-12-22 13:57     ` Bernt Hansen
2010-12-22 15:11       ` Dan Davison
2010-12-22 17:34         ` Bernt Hansen

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).