Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syntax error from examples of plantuml.com #101

Closed
2 tasks
c02y opened this issue Jul 24, 2019 · 15 comments
Closed
2 tasks

syntax error from examples of plantuml.com #101

c02y opened this issue Jul 24, 2019 · 15 comments

Comments

@c02y
Copy link

c02y commented Jul 24, 2019

Summary

When I use old plantuml.jar in emacs+plantuml-mode, and tried an example from plantuml.com, and tried to plantuml-preview in it, it shows syntax error (check screenshot), and I tried multiple examples from plantuml.com, all of them failed.

The old plantuml.jar used to work very well years ago.

I tried to download the latest plantuml.jar and use it in emacs, when I open a plantuml buffer, it says

File mode specification error: (wrong-type-argument stringp nil)

and I tried to plantuml-preview it, it still says the same error message as screenshot
plantuml

Checklist for pull requests

  • I'm fine with my code being released under the GPLv2 license
  • the pull request is filed against the develop branch instead of master
@rajasegar
Copy link

Try this

; Set your plantuml.jar path
  (setq plantuml-jar-path (expand-file-name "~/plantuml.jar"))
; Change preview mode to jar
  (setq plantuml-default-exec-mode 'jar)

@c02y
Copy link
Author

c02y commented Jul 25, 2019

No, the same old, it doesn't work, I tried the old version and the lastest version of plantuml.jar.

@alexvs11
Copy link

alexvs11 commented Jul 26, 2019

Got the same issue.
It can be fixed by changing:
(let* ((url-request-location (concat plantuml-server-url "/" plantuml-output-type "/-base64-" (base64-encode-string string))))
to
(let* ((url-request-location (concat plantuml-server-url "/" plantuml-output-type "/-base64-" (base64-encode-string string t))))

the problem is in a malformed multiline request

@c02y
Copy link
Author

c02y commented Jul 27, 2019

Yes, the syntax error is gone.

But when I open a pum file in emacs, it still displays error message on minibuffer:

File mode specification error: (wrong-type-argument stringp nil)

@alexvs11
Copy link

@c02y M-x toggle-debug-on-error
I would make a PR, but there is still some instability with encoding of answer %)

@skuro
Copy link
Owner

skuro commented Aug 3, 2019

@alexvs11 looks like a good catch, can you please elaborate on the last sentence though? Is there any further issue with server interactions that your solution wouldn't fix?

skuro added a commit that referenced this issue Aug 3, 2019
@skuro
Copy link
Owner

skuro commented Aug 3, 2019

@c02y as suggested, enabling debug will give us a stack trace to work with. Could you please M-x toggle-debug-on-error, trigger the issue and post here the stack trace?

@piotr-kozbial
Copy link

As for "File mode specification error", I have that too when I try to open a *.pum file. Afterwards I have no syntax highlighting, although the major mode is set to "plantuml".

I'm using Spacemacs with plantuml layer. Here's the version:

"GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.23.2)
of 2018-08-27, modified by Debian"

And here's the stack-trace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-to-number(nil)
  plantuml-init(server)
  plantuml-init-once()
  plantuml-mode()
  set-auto-mode-0(plantuml-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer diagram.pum> "~/diagram.pum" nil nil "~/diagram.pum" (4989866 2049))
  find-file-noselect("/home/ja/diagram.pum" nil nil nil)
  find-file("/home/ja/diagram.pum")
  helm-find-file-or-marked("/home/ja/diagram.pum")
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal(helm-source-find-files "/home/ja/" "Find files or url: " nil nil "*helm find files*" nil nil nil)
  apply(helm-internal (helm-source-find-files "/home/ja/" "Find files or url: " nil nil "*helm find files*" nil nil nil))
  helm(helm-source-find-files "/home/ja/" "Find files or url: " nil nil "*helm find files*" nil nil nil)
  apply(helm (helm-source-find-files "/home/ja/" "Find files or url: " nil nil "*helm find files*" nil nil nil))
  helm(:sources helm-source-find-files :input "/home/ja/" :case-fold-search smart :preselect nil :ff-transformer-show-only-basename t :default nil :prompt "Find files or url: " :buffer "*helm find files*")
  helm-find-files-1("/home/ja/")
  (let* ((hist (and arg helm-ff-history (helm-find-files-history))) (default-input hist) (input (cond ((and (eq major-mode (quote dired-mode)) default-input) (file-name-directory default-input)) ((and (not (string= default-input "")) default-input)) (t (expand-file-name (helm-current-directory)))))) (set-text-properties 0 (length input) nil input) (helm-find-files-1 input))
  spacemacs/helm-find-files(nil)
  funcall-interactively(spacemacs/helm-find-files nil)
  call-interactively(spacemacs/helm-find-files nil nil)
  command-execute(spacemacs/helm-find-files)

@c02y
Copy link
Author

c02y commented Aug 9, 2019

As for "File mode specification error", I have that too when I try to open a *.pum file. Afterwards I have no syntax highlighting, although the major mode is set to "plantuml".
I'm using Spacemacs with plantuml layer.

@piotr-kozbial Exactly the same here.

@skuro

  1. M-x toggle-debug-on-error
  2. open the test.pum file
    here is the Backtrace buffer:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-to-number(nil)
  plantuml-init(server)
  plantuml-init-once()
  plantuml-mode()
  set-auto-mode-0(plantuml-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer test.pum> "~/test.pum" nil nil "~/test.pum" (569925 53))
  find-file-noselect("/home/chz/test.pum")
  mapcar(find-file-noselect ("/home/chz/test.pum"))
  (let* ((files (helm-marked-candidates)) (buffers (mapcar (quote find-file-noselect) files))) (spacemacs//helm-open-buffers-in-windows buffers))
  (lambda (candidate) (let* ((files (helm-marked-candidates)) (buffers (mapcar (quote find-file-noselect) files))) (spacemacs//helm-open-buffers-in-windows buffers)))("/home/chz/test.pum")
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal(helm-source-find-files "/home/chz/" "Find files or url: " nil nil "*helm find files*" nil "/home/chz/Documentation" nil)
  apply(helm-internal (helm-source-find-files "/home/chz/" "Find files or url: " nil nil "*helm find files*" nil "/home/chz/Documentation" nil))
  helm(helm-source-find-files "/home/chz/" "Find files or url: " nil nil "*helm find files*" nil "/home/chz/Documentation" nil)
  apply(helm (helm-source-find-files "/home/chz/" "Find files or url: " nil nil "*helm find files*" nil "/home/chz/Documentation" nil))
  helm(:sources helm-source-find-files :input "/home/chz/" :case-fold-search smart :preselect nil :ff-transformer-show-only-basename t :default "/home/chz/Documentation" :prompt "Find files or url: " :buffer "*helm find files*")
  helm-find-files-1("/home/chz/")
  (let* ((hist (and arg helm-ff-history (helm-find-files-history))) (default-input hist) (input (cond ((and (eq major-mode (quote dired-mode)) default-input) (file-name-directory default-input)) ((and (not (string= default-input "")) default-input)) (t (expand-file-name (helm-current-directory)))))) (set-text-properties 0 (length input) nil input) (helm-find-files-1 input))
  spacemacs/helm-find-files(nil)
  funcall-interactively(spacemacs/helm-find-files nil)
  call-interactively(spacemacs/helm-find-files nil nil)
  command-execute(spacemacs/helm-find-files)

And the content of the test.pum, if it matters, is copied from http://plantuml.com/zh/sequence-diagram:

@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response

Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
@enduml

@skuro
Copy link
Owner

skuro commented Aug 9, 2019

Alright, I can reproduce the issue locally, thank you so much for your input. Seems to be a problem with parsing the language spec since the server is not working anymore with https. As a workaround, you could customize plantuml-server-url to use http instead of https although I would not really feel good with myself suggesting anyone to drop encryption when accessing a public website.

I'll raise the issue with the guys behind the online plantuml server. Keep you posted.

@skuro
Copy link
Owner

skuro commented Aug 9, 2019

Interestingly, only the /language endpoint, which plantuml-mode uses to fetch keywords in order to do syntax highlight, causes a redirect, whereas rendering commands still work

@piotr-kozbial
Copy link

Thanks! I'll use the workaround for the time being - I use jar exec mode, so it doesn't really compromise much.

@skuro
Copy link
Owner

skuro commented Aug 10, 2019

The HTTPS endpoint works again and I cannot reproduce the issue anymore. Should be fixed.

@skuro skuro closed this as completed Aug 10, 2019
@c02y
Copy link
Author

c02y commented Aug 11, 2019

Ths syntax error is gone, but the plantuml-preview doens't work

1. M-x toggle-debug-on-error
2. open the test.pum file (the same one)
3. M-x plantuml-preview
3. Check the screenshot, empty in *`*PLANTUML Preview\** buffer

No *Backtrace* buffer is created, and here is the content of *Messages* buffer(ImageMagick package is installed):

Contacting host: www.plantuml.com:443 [2 times]
ImageMagick error: negative or zero image size `/tmp/magick-57602adGE5S8ZQEW' @ error/image.c/SetImageExtent/2663
ImageMagick error: width or height exceeds limit `/tmp/magick-5760rqhj3HIAcKla' @ error/cache.c/OpenPixelCache/3666
Type C-c C-c or C-c C-x to view the image as text or hex.
ImageMagick error: negative or zero image size `/tmp/magick-5760p5yeAuwVqLco' @ error/image.c/SetImageExtent/2663
ImageMagick error: negative or zero image size `/tmp/magick-57600HrUMcjGLQ8B' @ error/image.c/SetImageExtent/2663
ImageMagick error: width or height exceeds limit `/tmp/magick-5760kM_ZBlAVG9EU' @ error/cache.c/OpenPixelCache/3666
ImageMagick error: width or height exceeds limit `/tmp/magick-5760nTUPlwSveuRq' @ error/cache.c/OpenPixelCache/3666
ImageMagick error: negative or zero image size `/tmp/magick-5760KpVH2tqUnXl3' @ error/image.c/SetImageExtent/2663
ImageMagick error: negative or zero image size `/tmp/magick-5760qsKAiFzIb2CY' @ error/image.c/SetImageExtent/2663

plant

FlexW pushed a commit to FlexW/plantuml-mode that referenced this issue Aug 12, 2019
@iT-Boyer
Copy link

iT-Boyer commented Aug 10, 2021

the same issue,how to fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants