* Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
@ 2017-12-26 9:54 陈泼杨
2017-12-26 11:28 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: 陈泼杨 @ 2017-12-26 9:54 UTC (permalink / raw)
To: emacs-orgmode
.h file use c/c++ mode or objc-mode base on it's content, so there is emacswiki solution there:
https://www.emacswiki.org/emacs/ObjectiveCMode, so i put the the code in my configuration:
;; header .h add to objc-mode, this cause org unable to export to html file
(add-to-list 'magic-mode-alist
`(,(lambda ()
(and (string= (file-name-extension buffer-file-name) "h")
(re-search-forward "@\\<interface\\>"
magic-mode-regexp-match-limit t)))
. objc-mode))
i turn on debug-on-error options:(setq debug-on-error t),
and export org file to html by typing: C-c C-e h h, and there is error:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
file-name-nondirectory(nil)
file-name-extension(nil)
(string= (file-name-extension buffer-file-name) "h")
(and (string= (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))
(lambda nil (and (string= (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))()
#[514 "\300\x02!\203 \0\x01 \207\301\x02!\207" [functionp looking-at] 4 "\n\n(fn RE DUMMY)"]((lambda nil (and (string= (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))) nil)
assoc-default(nil (((lambda nil (and (string= (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))) . objc-mode) ("^[{[]$" . json-mode)) #[514 "\300\x02!\203 \0\x01 \207\301\x02!\207" [functionp looking-at] 4 "\n\n(fn RE DUMMY)"])
set-auto-mode(t)
org-html-final-function(...) ;; some long text i delete to make the mail clean
org-export-filter-apply-functions(...) ;; some long text i delete to make the mail clean
org-export-as(html nil nil nil (:output-file "study.html"))
org-export-to-file(html "study.html" nil nil nil nil nil)
org-html-export-to-html(nil nil nil nil)
org-export-dispatch(nil)
funcall-interactively(org-export-dispatch nil)
call-interactively(org-export-dispatch nil nil)
command-execute(org-export-dispatch)
may be it cause org file unable to convert to other format files too.
------------------------------------------------------------------------
Emacs : GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
of 2017-09-13
Package: Org mode version 9.1.5 (9.1.5-1-gb3ddb0-elpa @ /Users/peck/.emacs.d/elpa/org-20171225/)
current state:
==============
(setq
org-hide-leading-stars t
org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate)
org-occur-hook '(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-log-done t
org-confirm-shell-link-function 'yes-or-no-p
org-agenda-custom-commands '(("h" "Daily habits" ((agenda ""))
((org-agenda-show-log t) (org-agenda-ndays-to-span 7)
(org-agenda-log-mode-items (quote (state)))
(org-agenda-skip-function
(quote (org-agenda-skip-entry-if (quote notregexp) ":DAILY:")))
)
)
("w" . "Task schedule")
("wa" "Important and urgent task" tags-todo "+PRIORITY=\"A\"")
("wb" "Important but not urgent task" tags-todo
"-Weekly-Monthly-Daily+PRIORITY=\"B\"")
("wc" "Unimportant and not urgent task" tags-todo "+PRIORITY=\"C\"")
("p" . "Project schedule")
("pw" tags-todo "PROJECT+WORK+CATEGORY=\"c/c++/objc\"")
("pl" tags-todo "PROJECT+DREAM+CATEGORY=\"peckchen\"")
("W" "Weekly Review" ((stuck "") (tags-todo "PROJECT"))))
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-font-lock-set-keywords-hook '(doom-org-custom-fontification)
org-mode-hook '((lambda nil (org-bullets-mode 1))
(lambda nil (company-mode) (local-set-key "\x03w" (quote org-pomodoro)))
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-show-block-all append local] 5]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
org-fontify-done-headline t
org-bibtex-headline-format-function #[257 "\300\x01\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
org-archive-hook '(org-attach-archive-delete-maybe)
org-pomodoro-ticking-sound "/Users/peck/.emacs.d/elpa/org-pomodoro-20171108.1314/resources/tick.wav"
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
org-load-hook '(doom-org-default-settings)
org-fontify-quote-and-verse-blocks t
org-pomodoro-start-sound "/Users/peck/.emacs.d/elpa/org-pomodoro-20171108.1314/resources/bell.wav"
org-confirm-elisp-link-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("id" :follow org-id-open)
("rmail" :follow org-rmail-open :store org-rmail-store-link)
("mhe" :follow org-mhe-open :store org-mhe-store-link)
("irc" :follow org-irc-visit :store org-irc-store-link)
("info" :follow org-info-open :export org-info-export :store
org-info-store-link)
("gnus" :follow org-gnus-open :store org-gnus-store-link)
("docview" :follow org-docview-open :export org-docview-export :store
org-docview-store-link)
("bibtex" :follow org-bibtex-open :store org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete
org-bbdb-complete-link :store org-bbdb-store-link)
("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs")
("doi" :follow org--open-doi-link) ("elisp" :follow org--open-elisp-link)
("file" :complete org-file-complete-link)
("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path))))
("help" :follow org--open-help-link)
("http" :follow (lambda (path) (browse-url (concat "http:" path))))
("https" :follow (lambda (path) (browse-url (concat "https:" path))))
("mailto" :follow (lambda (path) (browse-url (concat "mailto:" path))))
("news" :follow (lambda (path) (browse-url (concat "news:" path))))
("shell" :follow org--open-shell-link))
org-pomodoro-long-break-sound "/Users/peck/.emacs.d/elpa/org-pomodoro-20171108.1314/resources/bell_multiple.wav"
org-pomodoro-finished-sound "/Users/peck/.emacs.d/elpa/org-pomodoro-20171108.1314/resources/bell.wav"
org-pomodoro-short-break-sound "/Users/peck/.emacs.d/elpa/org-pomodoro-20171108.1314/resources/bell.wav"
org-fontify-whole-heading-line t
org-agenda-files '("~/org/study.org" "~/org/work.org" "~/org/daily.org" "~/org/issue.org")
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
)
--
Best regards
Peck Chen / 陈泼杨
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
2017-12-26 9:54 Bug: the code(convert the file to objc-mode) cause orgmode export to html file error 陈泼杨
@ 2017-12-26 11:28 ` Nicolas Goaziou
2017-12-26 13:13 ` 陈泼杨
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2017-12-26 11:28 UTC (permalink / raw)
To: 陈泼杨; +Cc: emacs-orgmode
Hello,
陈泼杨 <chenpoyang@163.com> writes:
> .h file use c/c++ mode or objc-mode base on it's content, so there is emacswiki solution there:
> https://www.emacswiki.org/emacs/ObjectiveCMode, so i put the the code in my configuration:
>
> ;; header .h add to objc-mode, this cause org unable to export to html file
> (add-to-list 'magic-mode-alist
> `(,(lambda ()
> (and (string= (file-name-extension buffer-file-name) "h")
> (re-search-forward "@\\<interface\\>"
> magic-mode-regexp-match-limit t)))
> . objc-mode))
Try to use `equal' instead of `string='.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
2017-12-26 11:28 ` Nicolas Goaziou
@ 2017-12-26 13:13 ` 陈泼杨
2017-12-26 13:35 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: 陈泼杨 @ 2017-12-26 13:13 UTC (permalink / raw)
To: mail; +Cc: emacs-orgmode
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: Re: Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
Date: Tue, 26 Dec 2017 12:28:47 +0100
> Hello,
>
> =E9=99=88=E6=B3=BC=E6=9D=A8 <chenpoyang@163.com> writes:
>
>> .h file use c/c++ mode or objc-mode base on it's content, so there is ema=
> cswiki solution there:
>> https://www.emacswiki.org/emacs/ObjectiveCMode, so i put the the code in =
> my configuration:
>>
>> ;; header .h add to objc-mode, this cause org unable to export to html fi=
> le
>> (add-to-list 'magic-mode-alist
>> `(,(lambda ()
>> (and (string=3D (file-name-extension buffer-file-name) "h")
>> (re-search-forward "@\\<interface\\>"
>> magic-mode-regexp-match-limit t)))
>> . objc-mode))
>
> Try to use `equal' instead of `string=3D'.
>
> Regards,
>
> --=20
> Nicolas Goaziou
follow your tips, i change to code, use equal, and the code is:
--------------------------------------------------------------------------------
(add-to-list 'magic-mode-alist
`(,(lambda ()
(and (equal (file-name-extension buffer-file-name) "h")
(re-search-forward "@\\<interface\\>"
magic-mode-regexp-match-limit t)))
. objc-mode))
--------------------------------------------------------------------------------
still unable to export org file to html:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
file-name-nondirectory(nil)
file-name-extension(nil)
(equal (file-name-extension buffer-file-name) "h")
(and (equal (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))
(lambda nil (and (equal (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t)))()
#[514 "\300\x02!\203 \0\x01 \207\301\x02!\207" [functionp looking-at] 4 "\n\n(fn RE DUMMY)"]((lambda nil (and (equal (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))) nil)
assoc-default(nil (((lambda nil (and (equal (file-name-extension buffer-file-name) "h") (re-search-forward "@\\<interface\\>" magic-mode-regexp-match-limit t))) . objc-mode) ("^[{[]$" . json-mode)) #[514 "\300\x02!\203 \0\x01 \207\301\x02!\207" [functionp looking-at] 4 "\n\n(fn RE DUMMY)"])
set-auto-mode(t)
org-html-final-function(...)
org-export-filter-apply-functions(...)
org-export-as(html nil nil nil (:output-file "note.html"))
org-export-to-file(html "note.html" nil nil nil nil nil)
org-html-export-to-html(nil nil nil nil)
org-export-dispatch(nil)
funcall-interactively(org-export-dispatch nil)
call-interactively(org-export-dispatch nil nil)
command-execute(org-export-dispatch)
--
Best regards
Peck Chen / 陈泼杨
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
2017-12-26 13:13 ` 陈泼杨
@ 2017-12-26 13:35 ` Nicolas Goaziou
2017-12-26 14:05 ` 陈泼杨
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2017-12-26 13:35 UTC (permalink / raw)
To: 陈泼杨; +Cc: emacs-orgmode
陈泼杨 <chenpoyang@163.com> writes:
> --------------------------------------------------------------------------------
> (add-to-list 'magic-mode-alist
> `(,(lambda ()
> (and (equal (file-name-extension buffer-file-name) "h")
> (re-search-forward "@\\<interface\\>"
> magic-mode-regexp-match-limit t)))
> . objc-mode))
> --------------------------------------------------------------------------------
>
> still unable to export org file to html:
Your function doesn't handle buffers not associated to a file. You may
want to try
(and (stringp buffer-file-name)
(equal "h" (file-name-extension buffer-file-name))
...)
Regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
2017-12-26 13:35 ` Nicolas Goaziou
@ 2017-12-26 14:05 ` 陈泼杨
0 siblings, 0 replies; 5+ messages in thread
From: 陈泼杨 @ 2017-12-26 14:05 UTC (permalink / raw)
To: mail; +Cc: emacs-orgmode
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: Re: Bug: the code(convert the file to objc-mode) cause orgmode export to html file error
Date: Tue, 26 Dec 2017 14:35:18 +0100
> Your function doesn't handle buffers not associated to a file. You may
> want to try
>
> (and (stringp buffer-file-name)
> (equal "h" (file-name-extension buffer-file-name))
> ...)
>
> Regards,
thanks for your help.
--
Best regards
Peck Chen / 陈泼杨
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-12-26 14:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-26 9:54 Bug: the code(convert the file to objc-mode) cause orgmode export to html file error 陈泼杨
2017-12-26 11:28 ` Nicolas Goaziou
2017-12-26 13:13 ` 陈泼杨
2017-12-26 13:35 ` Nicolas Goaziou
2017-12-26 14:05 ` 陈泼杨
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).