Closed nesteiner closed 2 years ago
I tried to reproduce the issue with emacs -Q
, and I did not see an error. Please provide minimal instructions to reproduce the issue. One idea for creating a minimal broken example would be the following.
mkdir /tmp/mbe
cd /tmp/mbe
echo '#+begin_src dart\nmain() {}\n#+end_src' > test.org
HOME=. emacs -nw test.org
# C-c C-e h o
Maybe you can describe minimal contents to add to /tmp/mbe/.emacs
in order to reproduce the error you see.
Also, might as well have provided the backtrace or what is "some function about dart-mode".
You may want something like the following in your /tmp/mbe/.emacs
or /tmp/mbe/.emacs.d/init.el
.
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")))
;; (package-refresh-contents)
;; (package-install 'dart-mode)
I don't feel you provided what I asked for. But I will try some other strategies next.
If you see an error there in the echo area, can you try M-x toggle-debug-on-error RET
beforehand, so that the error will provoke a backtrace? Then share the text of the backtrace please, ideally videos are not necessary. You can wrap the text with the markdown markup, like this:
here you are,
Please share backtrace as text, wrapped with ```. See https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code.
Images are not conducive to discussing code. Compare the discussion at https://meta.stackoverflow.com/questions/303812/discourage-screenshots-of-code-and-or-errors.
I think I found the problem, that when there is syntax error in the dart source block. the org file can't be export normally
you can try this code:
#+title: This is a test
* hello world
#+begin_src dart
var expose = context.read<ExposedType>();
#+end_src
#+begin_src c++
int main()
#+end_src
var expose = context.read<ExposedType>()
, which has no ;
, the org file can't be exported normallyI'm not clear where the blame has to go, but I hope we can find a fix that has a low risk of breaking dart-mode.el.
Bug seems to be at https://github.com/bradyt/dart-mode/blob/1.0.7/dart-mode.el#L434-L437.
;; If point is followed by semi-colon, we are done.
((or (> (point) limit)
(= (char-after (point)) ?\;)
(< (car (syntax-ppss)) depth))
So it seems somehow with org export, not even htmlize by itself, that (char-after (point))
evaluates as nil
, and Emacs errors on the comparison. So presumably we can avoid the error with (or ... (null (char-after (point))) ...)
.
Drafted solution at https://github.com/bradyt/dart-mode/commit/e800e0301d58cc2f7e60695edd48253df14e8b46, on temporary branch, https://github.com/bradyt/dart-mode/tree/scratch/fix/org-export.
If it's easy for you to install that, I think you'll find it fixes the bug. But you may be satisfied with your workaround for now.
I guess I should use the commit for a while before I provoke a release to nongnu-elpa and melpa-stable with a git tag.
Thank you for reporting, and your patience with clarifying.
it seems that the matter of ;
, :yum:
Drafted solution is pushed to main
branch. Closing. Let me know if the issue continues after the change. Closing optimistically.
You can try write a dart source code block in a org file, and then
org-html-export-to-html
, you will find an error thatwrong type argument: number-of-marker-p, nil
.When I try to debug it, the stack top is some function about dart-mode, can you check out that ??