dieter-wilhelm / apdl-mode

An Emacs mode for investigating and coding APDL (Ansys Parametric Design Language). Its full documentation is on:
http://dieter-wilhelm.github.io/apdl-mode
41 stars 7 forks source link

C-c,C-b failed for local help files with eww #16

Open wyl-phd opened 8 months ago

wyl-phd commented 8 months ago

I tried to open the apdl help documention, using"C-c C-b" with eww, but it failed to open it and reterned wrong file adress as

Loading http://file%3a%2f%2f%2fd%3a/Program%20Files/ANSYS%20Inc/v171/commonfiles/help/en-us/help/ans_elem/Hlp_C_MP.html...

I think this issue comes from that APDL-mode gives the wrong file path to eww. Because I tried to manually edit the address as

http://file:///d:/Program Files/ANSYS Inc/v171/commonfiles/help/en-us/help/ans_elem/Hlp_C_MP.html

and it worked out in the outside browser (MP command help is showed).

BTW, I am using ANSYS 17.1, which contains local help documention. And I'm sure I set the correct path, as

(setq apdl-ansys-help-path "D:/Program Files/ANSYS Inc/v171/commonfiles/help/en-us/help/")

For some reason, the characters '/ ' -> '%2f' ' : '->'%3a' ' ' ->'%20' , when the path is transfered to eww.

Following is the 'Bug Report'

==================================================================================== Emacs : GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-08-02 Package: APDL-Mode

current state:

(setq apdl-mode-version "20.7.0" apdl-mode-update "2021-10-23" apdl-mode-install-directory "c:/Users/Lee/AppData/Roaming/.emacs.d/elpa/apdl-mode-20211023.1831/" apdl-initialised-flag t apdl-current-ansys-version "v171" apdl-is-unix-system-flag nil apdl-parameter-help-duration "30" apdl-hide-region-before-string "![ ... hidden" apdl-hide-region-after-string " region ... ]" apdl-hide-region-propertize-markers t apdl-highlighting-level 2 apdl-dynamic-highlighting-flag t apdl-indicate-empty-lines-flag nil apdl-comment-padding " " apdl-comment-add 1 apdl-code-comment-column 15 apdl-auto-indent-flag t apdl-indent-comment-suffix "" apdl-ruler-wide-flag nil apdl-require-spaces-flag nil apdl-blink-matching-block-flag t apdl-blink-matching-delay 0.7 apdl-block-offset 2 apdl-outline-string "@" apdl-mode-hook '(apdl-outline-minor-mode) apdl-align-rules-list '((apdl-align-= (regexp . "\(\s-\)=") (modes quote (apdl-mode)) (justify . t) (tab-stop)) (apdl-align-text-column (regexp . "=\(\s-[0-9]+\|\s-\)") (modes quote (apdl-mode)) (justify . t) (tab-stop)) (apdl-align-comment (regexp . "[0-9.)]+\(\s-\)\!") (modes quote (apdl-mode)) (tab-stop)) ) apdl-license-occur-regexp '("granta" "electronics" "spaceclaim" "cfd" "disc" "aimmp" "stba" "struct" "mpba" "ane3" "^ansys" "anshpc" "^preppost" "mech" "[0-9][0-9]:[0-9][0-9]:[0-9][0-9]") apdl-job "file" apdl-license-categories '("ansys" "struct" "ane3" "ansysds" "ane3fl" "preppost") apdl-license "preppost" apdl-no-of-processors 3 apdl-blink-delay 0.3 apdl-blink-region-flag t apdl-username "Lee" apdl-ansys-install-directory "D:/Program Files/ANSYS Inc/v171" apdl-ansys-program "D:/Program Files/ANSYS Inc/v171" apdl-ansys-launcher "D:/Program Files/ANSYS Inc/v171/winx64/launcher" apdl-ansys-wb "D:/Program Files/ANSYS Inc/v171/Framework/bin/Linux64/runwb2" apdl-ansys-help-program "D:/Program Files/ANSYS Inc/v171/commonfiles/help/HelpViewer/AnsysHelpViewer.exe" apdl-ansys-help-path "D:/Program Files/ANSYS Inc/v171/commonfiles/help/en-us/help/" apdl-lmutil-program "D:/Program Files/ANSYS Inc/shared_files/licensing/linx64/lmutil" apdl-license-file "ANSYSLI_NOFLEX=1" apdl-ansysli-servers "ANSYSLI_NOFLEX=1" apdl-wb-custom-template-directory "c:/Users/Lee/AppData/Roaming/.emacs.d/elpa/apdl-mode-20211023.1831/" )

dieter-wilhelm commented 8 months ago

Hi @wyl-phd

Ansys 17.1 is quite ancient ;-) I'm not sure I'm able to reproduce your problem. At the moment I'm using the online help (default since Ansys 19) with Apdl-mode, this works nearly as fast as with the local help files. I'll try to download the local documentation from the Customer Portal and see if I find some helpful hint for you.

dieter-wilhelm commented 8 months ago

I suspect that some Emacs' defaults were changed since I wrote the function. Would you please change the file apdl-process.el? Here are the relevant lines (with modification):

  ;; for eww, reverting to file:/// 2021-08-28
  ;;(browse-url-of-file (concat "file:///" path file))) ; not working for Emacs 29.1!
  (browse-url-of-file (concat path file))) ; <- this is working for me in Emacs 29.1

(and restart Emacs.) thank you

wyl-phd commented 8 months ago

@dieter-wilhelm I've already tried to edit apdl-process.el file before I posted the issue. But it didn't work.

I'll convert to a higher ANSYS version.

Thanks any way.

dieter-wilhelm commented 8 months ago

@dieter-wilhelm I've already tried to edit apdl-process.el file before I posted the issue. But it didn't work.

I'll convert to a higher ANSYS version.

I've tested apdl-mode's C-cC-b command with the local documentation of Ansys 2023R2 and above change of apdl-process.el..

wyl-phd commented 7 months ago

@dieter-wilhelm I edited apdl-porcess.ed as you suggested and then tested C-c C-b command in emacs 29.1 with ANSYS 2024R1. The online documentation worked well with the external browser (Firfox). However it failed in eww with the following message 图片 This problem is easy to solve, but it's difficult for me

The local documentation fialed to work in neither eww nor external browser, which might be caused by the same issue I mentioned at the beginning. eww returns the following message: Loading http://file%3a%2f%2f%2fd%3a/Program%20Files/ANSYS%20Inc/v241/commonfiles/help/en-us/help/ans_cmd/Hlp_C_E.html... The path should be file:///D:/Program Files/ANSYS Inc/v241/... I gausse it is a characters encoding problem of emacs when running in Chinese OS. concat file path may not work as expected.

Now I am using the online documentation. Thanks to your amazing package, it promots my work efficiency a lot.