bug#25322: preview-latex coding system problem with Japanese LaTeX

2017-05-26 Thread Mosè Giordano
2017-05-26 19:11 GMT+02:00 Ikumi Keita :
> Hi Mosè, thanks for your response!
>
>> Mosè Giordano  writes:
>> Indeed I have a problem: all non skipped tests in
>> japanese/preview-latex.el fail for me.  Attached you can find the log,
>> if it can help you.
>
> It seems that the latest commit is not yet installed on your box.  I
> encountered similar fails with AUCTeX before the update.   My tests only
> pass with the updated codes.

The repo was up-to-date, but I had to make distclean before
recompiling AUCTeX (before I run only make clean, which wasn't
sufficient).  Now the tests pass.  Thanks and sorry for the noise!

Bye,
Mosè



___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#25322: preview-latex coding system problem with Japanese LaTeX

2017-05-26 Thread Ikumi Keita
Hi Mosè, thanks for your response!

> Mosè Giordano  writes:
> Indeed I have a problem: all non skipped tests in
> japanese/preview-latex.el fail for me.  Attached you can find the log,
> if it can help you.

It seems that the latest commit is not yet installed on your box.  I
encountered similar fails with AUCTeX before the update.   My tests only
pass with the updated codes.

Bye,
Ikumi Keita



___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#25322: preview-latex coding system problem with Japanese LaTeX

2017-05-26 Thread Mosè Giordano
Hi!

2017-05-26 15:47 GMT+02:00 Ikumi Keita :
> I wrote a suite of ERT files and commited them with the patches, since I
> heard no objections during the span.  I also commited the patch in my
> previous message to make preview-latex to work with xemacs on w32
> system.
>
> Since it was too difficult for me to write a full automated test which
> can complete entirely in batch mode because the functionality of
> preview-latex depends how images scattered on the buffer "look" like to
> human eyes, some of the tests are marked to be skipped in batch mode.
> Such tests requires manual execution instead.

I know that tests aren't always easy to write, especially for stuff
that requires interaction.  I don't ask tests at any cost, but when
it's possible to write them, they're definitely useful to prevent
future failures ;-)

> If someone finds difficulties with this commit, feel free to ask me.

Indeed I have a problem: all non skipped tests in
japanese/preview-latex.el fail for me.  Attached you can find the log,
if it can help you.

Bye,
Mosè
Loading 00debian-vars...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Loading /etc/emacs/site-start.d/50emacs-goodies-el.el (source)...
Loading /etc/emacs/site-start.d/50festival.el (source)...
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...
Running 8 tests (2017-05-26 17:29:15+0200)
Test japanese-preview-convert-^^ab backtrace:
  (let ((fn-65 (function string=)) (args-66 (list (preview--convert-^^
  (let (case-fold-search) (let ((fn-65 (function string=)) (args-66 (l
  (lambda nil (let (case-fold-search) (let ((fn-65 (function string=))
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test japanese-preview-convert-^^ab "`pre
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test j
  ert-run-tests(t #[385 "\306\307\"\203G\211\211G\310U\203\211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-L" ".." "-l" "ert" "-l" "japanese/preview-latex.el
  command-line()
  normal-top-level()
Test japanese-preview-convert-^^ab condition:
(void-function preview--convert-^^ab)
   FAILED  1/8  japanese-preview-convert-^^ab
Test japanese-preview-decode-^^ab backtrace:
  (let ((fn-45 (function string=)) (args-46 (list (preview--decode-^^a
  (let (case-fold-search) (let ((fn-45 (function string=)) (args-46 (l
  (lambda nil (let (case-fold-search) (let ((fn-45 (function string=))
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test japanese-preview-decode-^^ab "`prev
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test j
  ert-run-tests(t #[385 "\306\307\"\203G\211\211G\310U\203\211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-L" ".." "-l" "ert" "-l" "japanese/preview-latex.el
  command-line()
  normal-top-level()
Test japanese-preview-decode-^^ab condition:
(void-function preview--decode-^^ab)
   FAILED  2/8  japanese-preview-decode-^^ab
  skipped  3/8  japanese-preview-different-coding-system
Test japanese-preview-error-quote-shift-jis backtrace:
  (setq value-42 (apply fn-40 args-41))
  (unwind-protect (setq value-42 (apply fn-40 args-41)) (setq form-des
  (if (unwind-protect (setq value-42 (apply fn-40 args-41)) (setq form
  (let (form-description-44) (if (unwind-protect (setq value-42 (apply
  (let ((value-42 (quote ert-form-evaluation-aborted-43))) (let (form-
  (let ((fn-40 (function string-match)) (args-41 (list (preview-error-
  (while --dolist-tail-- (setq str (car --dolist-tail--)) (let ((fn-40
  (let ((--dolist-tail-- (quote ("表(1)" "予{a}" "能|" "{あ} %能" "アース" "型"
  (let (case-fold-search (buffer-file-coding-system (quote shift_jis))
  (lambda nil (let (case-fold-search (buffer-file-coding-system (quote
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  ert-run-test([cl-struct-ert-test japanese-preview-error-quote-shift-
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test j
  ert-run-tests(t #[385 "\306\307\"\203G\211\211G\310U\203\211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-L" ".." "-l" "ert" "-l" "japanese/preview-latex.el
  command-line()
  normal-top-level()
Test japanese-preview-error-quote-shift-jis condition:
(invalid-regexp "Unmatched ( or \\(")
   FAILED  4/8  japanese-preview-error-quote-shift-jis
  skipped  5/8  japanese-preview-preserve-kanji-option
Applying style hooks...
Applying style hooks... done
Applying style hooks...
Applying style hooks... done
Type `C-c C-l' to display results of 

bug#25322: preview-latex coding system problem with Japanese LaTeX

2017-05-26 Thread Ikumi Keita
Hi Mosè and all,

>> I only read the patch, didn't actually try it, but I'm confident you
>> did it ;-)  I didn't see anything clearly wrong.  I have only a
>> request: do you think it's possible to add a test for this fix?

> OK, I'll try.  Maybe it takes a week or so.  I'll also wait for possible
> comments from others to arrive during that.

I wrote a suite of ERT files and commited them with the patches, since I
heard no objections during the span.  I also commited the patch in my
previous message to make preview-latex to work with xemacs on w32
system.

Since it was too difficult for me to write a full automated test which
can complete entirely in batch mode because the functionality of
preview-latex depends how images scattered on the buffer "look" like to
human eyes, some of the tests are marked to be skipped in batch mode.
Such tests requires manual execution instead.

If someone finds difficulties with this commit, feel free to ask me.

Best regards,
Ikumi Keita



___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex


bug#25322: preview-latex coding system problem with Japanese LaTeX

2017-05-19 Thread Ikumi Keita
Hi Mosè, thanks for your reply!

> Mosè Giordano  writes:

> I only read the patch, didn't actually try it, but I'm confident you
> did it ;-)  I didn't see anything clearly wrong.  I have only a
> request: do you think it's possible to add a test for this fix?

OK, I'll try.  Maybe it takes a week or so.  I'll also wait for possible
comments from others to arrive during that.

And I found another issue and made a patch which might be incorporated
as well.
Preview-latex on xemacs on w32 does not work except when
`preview-image-type' is set to `dvipng'.  It fails to call ghostscript
correctly and ghostscript signals error without generating any image
files.  The attached patch fixes this.  How do you think about this one?

[Background of the patch]
Preview-latex constructs path names like
"circ.prv/tmpkWCzEN/preview.dsc" and tries to pass them to ghostscript.
However, functions of xemacs on w32 uses backslash as path separator by
default when the return value is a file name, and
`preview-ps-quote-filename' is confused by this feature:

(defun preview-ps-quote-filename (str  nonrel)
  "Make a PostScript string from filename STR.
The file name is first made relative unless
NONREL is not NIL."
  (unless nonrel (setq str (file-relative-name str)))
  (let ((index 0))
(while (setq index (string-match "[\\()]" str index))
  (setq str (replace-match "\\&" t nil str)
index (+ 2 index)))
(concat "(" str ")")))

Here, `file-relative-name' converts slashes contained in `str' to
backslashes, each of which is duplicated by the while loop after it.  As
a result, the path names actually passed to ghostscript become like
"circ.prv\\tmpkWCzEN\\preview.dsc".  That's the reason ghostscript
signals error.

The behavior of w32 xemacs functions with respect to path separator
mentioned above is controlled by binding a suitable value to
`directory-sep-char', so the attatched patch takes care of that.  With
this change, preview-latex does work as expected, at least for the
xemacs 21.5 binary I found and installed on my machine.

I tried applying the previous patch, and to my delight, it makes
preview-latex to cooperate with Japanese LaTeX on w32 xemacs, too.

Regards,
Ikumi Keita

diff --git a/prv-xemacs.el b/prv-xemacs.el
--- a/prv-xemacs.el
+++ b/prv-xemacs.el
@@ -743,6 +743,12 @@
 (nth 1 image)
 (nth 2 image)
 
+(if (eq system-type 'windows-nt)
+(defadvice preview-ps-quote-filename (around path-sep-to-slash)
+  "Make path separator to slash so that the function will not be confused."
+  (let ((directory-sep-char ?/))
+	ad-do-it)))
+
 (provide 'prv-xemacs)
 
 ;;; Local variables:
___
bug-auctex mailing list
bug-auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-auctex