From: Nicolas Goaziou <m...@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 <chenpoy...@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!\203 \207\301!\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!\203 \207\301!\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 / 陈泼杨