Regression tests fix (Re: font-latex-match-warning-make void function.)

2021-03-26 Thread Ikumi Keita
> Stefan Monnier  writes:
> Do you *need* the variable to be called "var"?  If not, then renaming it
> will save you the trouble of wondering under which circumstances it's OK
> to use just "var".

I see, thanks for explanation.

Regards,
Ikumi Keita



Re: font-latex-match-warning-make void function.

2021-03-26 Thread Stefan Monnier
> Well, this is a piece of regresstion test suits and the variable in
> question is used only within this particular `ert-deftest'. So I
> presumed it's OK. Is this presumtion wrong?

Do you *need* the variable to be called "var"?  If not, then renaming it
will save you the trouble of wondering under which circumstances it's OK
to use just "var".


Stefan




Re: font-latex-match-warning-make void function.

2021-03-26 Thread Ikumi Keita
> Stefan Monnier  writes:
>> Attached is a possible solution. Stefan, is it safe to repeat the same
>> `advice-add' or `advice-remove'? That is,

> Yes, they're idempotent.

>> Experiments seem to suggest that it's safe. But if not, I have to add
>> `advice-member-p' test.

> Not needed.

Thank you, I can now be confident.

>> diff --git a/tests/tex/path-expansion.el b/tests/tex/path-expansion.el
>> index 2246e92ca8..f19c331965 100644
>> --- a/tests/tex/path-expansion.el
>> +++ b/tests/tex/path-expansion.el
>> @@ -25,6 +25,7 @@
>> 
>> (ert-deftest TeX-variable-truncation ()
>> "Check whether list variable is not truncated as side effect."
>> +  (defvar var)
>> (let ((var '("str1" "str2"))
>> (TeX-kpathsea-path-delimiter nil)
>> (TeX-search-files-type-alist

> This is going in the right direction but the byte-compiler should
> hopefully tell you that this is not quite sufficient: please also rename
> `var` to add some namespace prefix to it (I suggest `TeX--var`).

Well, this is a piece of regresstion test suits and the variable in
question is used only within this particular `ert-deftest'. So I
presumed it's OK. Is this presumtion wrong?

Regards,
Ikumi Keita



Re: font-latex-match-warning-make void function.

2021-03-26 Thread Stefan Monnier
>>> I'll try to mess up in a more challenging way next time, I promise.
>> Challenge accepted. :-)
> Well, it seems that we already have a challenge. :-)
> I'm now fixing regression tests, and found that preview.el(.in) still
> needs adaptation because it uses ad-{enable,disable}-advice explicitly.

Damn, I left it too obvious, didn't I?

> Attached is a possible solution. Stefan, is it safe to repeat the same
> `advice-add' or `advice-remove'? That is,

Yes, they're idempotent.

> Experiments seem to suggest that it's safe. But if not, I have to add
> `advice-member-p' test.

Not needed.

>  (if (fboundp 'advice-add)   ;Emacs≥24.4 (or ELPA package nadvice)
> -(advice-add 'replace-highlight :before #'preview--open-for-replace)
> +nil ; See the defcustom below.
>(defadvice replace-highlight (before preview)
>  (preview--open-for-replace (ad-get-arg 0) (ad-get-arg 1

That's right.

> @@ -2073,10 +2073,16 @@ overlays not in the active window."
>:require 'preview
>:set (lambda (symbol value)
>   (set-default symbol value)
> - (if value
> - (ad-enable-advice 'replace-highlight 'before 'preview)
> -   (ad-disable-advice 'replace-highlight 'before 'preview))
> - (ad-activate 'replace-highlight))
> + (if (fboundp 'advice-add) ; COMPATIBILITY for Emacs<24.4
> + (if value
> + (advice-add 'replace-highlight :before
> + #'preview--open-for-replace)
> +   (advice-remove 'replace-highlight
> +  #'preview--open-for-replace))
> +   (if value
> +   (ad-enable-advice 'replace-highlight 'before 'preview)
> + (ad-disable-advice 'replace-highlight 'before 'preview))
> +   (ad-activate 'replace-highlight)))
>:initialize #'custom-initialize-reset)

LGTM.

>  (defun preview-relaxed-string= ( args)
> diff --git a/tests/japanese/preview-latex.el b/tests/japanese/preview-latex.el
> index 9b5f395523..14fc3d1ac9 100644
> --- a/tests/japanese/preview-latex.el
> +++ b/tests/japanese/preview-latex.el
> @@ -274,7 +274,7 @@ String encoded in `shift_jis' can have regexp meta 
> characters in it."
>(let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
>   (process (get-buffer-process buffer)))
>  (if process (delete-process process))
> -(kill-buffer buffer))
> +(if (get-buffer buffer) (kill-buffer buffer)))
>(TeX-clean t)
>(dolist (dir preview-temp-dirs)
>  (if (file-exists-p (directory-file-name dir))

No idea/opinion on that one.

> diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
> index 7484d03992..f748b3 100644
> --- a/tests/latex/font-latex-test.el
> +++ b/tests/latex/font-latex-test.el
> @@ -24,6 +24,8 @@
>  (require 'ert)
>  (require 'latex)
>  (require 'font-latex)
> +(defvar font-lock-beg)
> +(defvar font-lock-end)
>  
>  (ert-deftest font-latex-three-dollars ()
>"Test three consecutive dollar is ignored."
> @@ -45,8 +47,7 @@ $a$")
>"Test f-l-e-r-b-q doesn't extend region too eagerly."
>(with-temp-buffer
>  (let ((TeX-install-font-lock 'font-latex-setup)
> -  (font-latex-quotes 'french)
> -  font-lock-beg font-lock-end)
> +  (font-latex-quotes 'french))
>(LaTeX-mode)

Good catch, thanks.

> diff --git a/tests/tex/path-expansion.el b/tests/tex/path-expansion.el
> index 2246e92ca8..f19c331965 100644
> --- a/tests/tex/path-expansion.el
> +++ b/tests/tex/path-expansion.el
> @@ -25,6 +25,7 @@
>  
>  (ert-deftest TeX-variable-truncation ()
>"Check whether list variable is not truncated as side effect."
> +  (defvar var)
>(let ((var '("str1" "str2"))
>  (TeX-kpathsea-path-delimiter nil)
>  (TeX-search-files-type-alist

This is going in the right direction but the byte-compiler should
hopefully tell you that this is not quite sufficient: please also rename
`var` to add some namespace prefix to it (I suggest `TeX--var`).


Stefan




Re: font-latex-match-warning-make void function.

2021-03-26 Thread Ikumi Keita
> Tassilo Horn  writes:
> Stefan Monnier  writes:
>>> Get your shits together, Stefan,
>> 
>> I'll try to mess up in a more challenging way next time, I promise.

> Challenge accepted. :-)

Well, it seems that we already have a challenge. :-)

I'm now fixing regression tests, and found that preview.el(.in) still
needs adaptation because it uses ad-{enable,disable}-advice explicitly.
Attached is a possible solution. Stefan, is it safe to repeat the same
`advice-add' or `advice-remove'? That is,
1. Do (advice-add FUNC :before #'preview--open-for-replace) once.
2. Do the same (advice-add FUNC :before #'preview--open-for-replace)
   again.
or
1. Do (advice-remove FUNC #'preview--open-for-replace) on a FUNC which
   isn't yet given advice.

Experiments seem to suggest that it's safe. But if not, I have to add
`advice-member-p' test.

Regards,
Ikumi Keita

diff --git a/preview.el.in b/preview.el.in
index c6bc8b7705..d8395935ce 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -2058,7 +2058,7 @@ overlays not in the active window."
   (push ovr preview-temporary-opened
 
 (if (fboundp 'advice-add)   ;Emacs≥24.4 (or ELPA package nadvice)
-(advice-add 'replace-highlight :before #'preview--open-for-replace)
+nil ; See the defcustom below.
   (defadvice replace-highlight (before preview)
 (preview--open-for-replace (ad-get-arg 0) (ad-get-arg 1
 
@@ -2073,10 +2073,16 @@ overlays not in the active window."
   :require 'preview
   :set (lambda (symbol value)
  (set-default symbol value)
- (if value
- (ad-enable-advice 'replace-highlight 'before 'preview)
-   (ad-disable-advice 'replace-highlight 'before 'preview))
- (ad-activate 'replace-highlight))
+ (if (fboundp 'advice-add) ; COMPATIBILITY for Emacs<24.4
+ (if value
+ (advice-add 'replace-highlight :before
+ #'preview--open-for-replace)
+   (advice-remove 'replace-highlight
+  #'preview--open-for-replace))
+   (if value
+   (ad-enable-advice 'replace-highlight 'before 'preview)
+ (ad-disable-advice 'replace-highlight 'before 'preview))
+   (ad-activate 'replace-highlight)))
   :initialize #'custom-initialize-reset)
 
 (defun preview-relaxed-string= ( args)
diff --git a/tests/japanese/preview-latex.el b/tests/japanese/preview-latex.el
index 9b5f395523..14fc3d1ac9 100644
--- a/tests/japanese/preview-latex.el
+++ b/tests/japanese/preview-latex.el
@@ -274,7 +274,7 @@ String encoded in `shift_jis' can have regexp meta characters in it."
   (let* ((buffer (TeX-process-buffer-name (TeX-master-file nil t)))
  (process (get-buffer-process buffer)))
 (if process (delete-process process))
-(kill-buffer buffer))
+(if (get-buffer buffer) (kill-buffer buffer)))
   (TeX-clean t)
   (dolist (dir preview-temp-dirs)
 (if (file-exists-p (directory-file-name dir))
diff --git a/tests/latex/font-latex-test.el b/tests/latex/font-latex-test.el
index 7484d03992..f748b3 100644
--- a/tests/latex/font-latex-test.el
+++ b/tests/latex/font-latex-test.el
@@ -24,6 +24,8 @@
 (require 'ert)
 (require 'latex)
 (require 'font-latex)
+(defvar font-lock-beg)
+(defvar font-lock-end)
 
 (ert-deftest font-latex-three-dollars ()
   "Test three consecutive dollar is ignored."
@@ -45,8 +47,7 @@ $a$")
   "Test f-l-e-r-b-q doesn't extend region too eagerly."
   (with-temp-buffer
 (let ((TeX-install-font-lock 'font-latex-setup)
-  (font-latex-quotes 'french)
-  font-lock-beg font-lock-end)
+  (font-latex-quotes 'french))
   (LaTeX-mode)
 
   ;; Test 1: Double prime in math expression doesn't cause region
diff --git a/tests/tex/path-expansion.el b/tests/tex/path-expansion.el
index 2246e92ca8..f19c331965 100644
--- a/tests/tex/path-expansion.el
+++ b/tests/tex/path-expansion.el
@@ -25,6 +25,7 @@
 
 (ert-deftest TeX-variable-truncation ()
   "Check whether list variable is not truncated as side effect."
+  (defvar var)
   (let ((var '("str1" "str2"))
 (TeX-kpathsea-path-delimiter nil)
 (TeX-search-files-type-alist


Re: font-latex-match-warning-make void function.

2021-03-25 Thread Stefan Monnier
>> Also, I had changes in the `README` which I had to throw out because
>> I couldn't find anything corresponding to it in the auctex.git code.
> The README file is generated from intro.texi and preview-readme.texi in
> auctex.git, so README itself isn't under control of git and is listed in
> .gitignore.

Thanks.
I looked for them by searching for `http:` but of course it returned no
match since those problems had already been fixed in `intro.texi`.
So all is well :-(


Stefan




Re: font-latex-match-warning-make void function.

2021-03-25 Thread Ikumi Keita
> Stefan Monnier  writes:
> Also, I had changes in the `README` which I had to throw out because
> I couldn't find anything corresponding to it in the auctex.git code.

The README file is generated from intro.texi and preview-readme.texi in
auctex.git, so README itself isn't under control of git and is listed in
.gitignore.

Bye,
Ikumi Keita



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Tassilo Horn
Stefan Monnier  writes:

>> Get your shits together, Stefan,
>
> I'll try to mess up in a more challenging way next time, I promise.

Challenge accepted. :-)

>> I've just merged master into externals/auctex.  Could you please
>> check if everything's right there, i.e., foremost that changes in
>> *.el.in files on master are in the corresponding *.el file in
>> externals/auctex.
>
> That worked fine for preview.el but not for auctex.el, apparently.
> [ I'm not surprised: the same thing happened to me when rebasing my
>   branch from the elpa.git code to the auctex.git code ;-)  ]
>
> Also, I had changes in the `README` which I had to throw out because I
> couldn't find anything corresponding to it in the auctex.git code.
>
> See patch below.
> For good measure, I threw in a tweak to `.gitignore`.

Thanks a lot, I've applied it.

Bye,
Tassilo



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Stefan Monnier
> Get your shits together, Stefan,

I'll try to mess up in a more challenging way next time, I promise.

> I've just merged master into externals/auctex.  Could you please check
> if everything's right there, i.e., foremost that changes in *.el.in
> files on master are in the corresponding *.el file in externals/auctex.

That worked fine for preview.el but not for auctex.el, apparently.
[ I'm not surprised: the same thing happened to me when rebasing my
  branch from the elpa.git code to the auctex.git code ;-)  ]

Also, I had changes in the `README` which I had to throw out because
I couldn't find anything corresponding to it in the auctex.git code.

See patch below.
For good measure, I threw in a tweak to `.gitignore`.


Stefan


diff --git a/.gitignore b/.gitignore
index 658ce83fcd..f625e65b26 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 #*
 *.aux
+*.orig
 *.elc
 *.log
 *.synctex.gz
@@ -49,3 +50,7 @@ auctex-autoloads.el
 tests/*/auto/*
 *.dynvars
 auctex-dynvars
+
+# ELPA-generated files
+/auctex-autoloads.el
+/auctex-pkg.el
diff --git a/README b/README
index fe474cf8be..c9a8c12f79 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 This is the README file for the AUCTeX distribution.
 
- Copyright (C) 2008, 2017 Free Software Foundation, Inc.
+ Copyright (C) 2008-2021 Free Software Foundation, Inc.
 
  Copying and distribution of this file, with or without
  modification, are permitted in any medium without royalty provided
@@ -48,10 +48,10 @@ new features for your own needs.  It is a GNU project and 
distributed
 under the 'GNU General Public License Version 3'.
 
 The most recent version is always available at
-.
+.
 
 WWW users may want to check out the AUCTeX page at
-.
+.
 
 For comprehensive information about how to install AUCTeX read the file
 'INSTALL' or 'INSTALL.windows', respectively.
@@ -175,7 +175,7 @@ case, 'dvipng' will be used for converting DVI files and 
Ghostscript
 (with a 'PNG' device) for converting PDF files.  'dvipng' is much faster
 than the combination of Dvips and Ghostscript.  You can get downloads,
 access to its CVS archive and further information from its project site
-(http://savannah.nongnu.org/projects/dvipng).
+(https://savannah.nongnu.org/projects/dvipng).
 
 5 More documentation
 
@@ -204,9 +204,9 @@ will display it.
 **
 
 The preview-latex project is now part of AUCTeX and accessible as part
-of the AUCTeX project page (http://savannah.gnu.org/projects/auctex).
+of the AUCTeX project page (https://savannah.gnu.org/projects/auctex).
 You can get its files from the AUCTeX download area
-(ftp://ftp.gnu.org/pub/gnu/auctex).  As of AUCTeX 11.81, preview-latex
+(https://ftp.gnu.org/pub/gnu/auctex).  As of AUCTeX 11.81, preview-latex
 should already be integrated into AUCTeX, so no separate download will
 be necessary.
 
@@ -222,7 +222,7 @@ installation fails (but this should be a rare event), 
report bugs to
 .
 
 There is a general discussion list for AUCTeX which also covers
-preview-latex, look at .
+preview-latex, look at .
 For more information on the mailing list, send a message with just the
 word "help" as subject or body to .  For the
 developers, there is the  list; it would probably
diff --git a/auctex.el b/auctex.el
index ea9d858605..13cc562a15 100644
--- a/auctex.el
+++ b/auctex.el
@@ -1,4 +1,4 @@
-;;; auctex.el --- Integrated environment for *TeX*
+;;; auctex.el --- Integrated environment for *TeX*  -*- lexical-binding: t; -*-
 
 ;; Copyright (C) 2014-2021 Free Software Foundation, Inc.
 
@@ -6,7 +6,7 @@
 ;; URL: https://www.gnu.org/software/auctex/
 ;; Maintainer: auctex-devel@gnu.org
 ;; Notifications-To: auctex-di...@gnu.org
-;; Package-Requires: ((emacs "24.3") (cl-lib "1.0"))
+;; Package-Requires: ((emacs "24.3"))
 ;; Keywords: TeX LaTeX Texinfo ConTeXt docTeX preview-latex
 
 ;; This file is part of GNU Emacs.




Re: font-latex-match-warning-make void function.

2021-03-25 Thread Ikumi Keita
> Stefan Monnier  writes:
>> At last I managed to figure out the origin and seem to recover the
>> normal behavior. Sorry for your inconvinience.

> Clearly I'm to blame, so thanks for the fix.

Sorry, I should have actually tested before merge. Actually, I think
that the relevant code should be refactored and made easier to
understand.

Regards,
Ikumi Keita



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Colin Baxter
> Tassilo Horn  writes:

> Stefan Monnier  writes:
>>> At last I managed to figure out the origin and seem to recover
>>> the normal behavior. Sorry for your inconvinience.
>> 
>> Clearly I'm to blame, so thanks for the fix.

> Get your shits together, Stefan, and thanks a lot! ;-)

> I've just merged master into externals/auctex.  Could you please
> check if everything's right there, i.e., foremost that changes in
> *.el.in files on master are in the corresponding *.el file in
> externals/auctex.

Things seem to be back to normal. Thanks to everyone.

Best wishes,



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Tassilo Horn
Stefan Monnier  writes:

>> At last I managed to figure out the origin and seem to recover the
>> normal behavior. Sorry for your inconvinience.
>
> Clearly I'm to blame, so thanks for the fix.

Get your shits together, Stefan, and thanks a lot! ;-)

I've just merged master into externals/auctex.  Could you please check
if everything's right there, i.e., foremost that changes in *.el.in
files on master are in the corresponding *.el file in externals/auctex.

Thanks again,
Tassilo



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Stefan Monnier
> At last I managed to figure out the origin and seem to recover the
> normal behavior. Sorry for your inconvinience.

Clearly I'm to blame, so thanks for the fix.




Re: font-latex-match-warning-make void function.

2021-03-25 Thread Ikumi Keita
> Colin Baxter  writes:
> Ikumi Keita  writes:
>> Ah, no. The fontification doesn't happen when I open another latex
>> file. I have to figure out why...

>> Regards, Ikumi Keita

> Yes, I can confirm that. I was too quick off the mark in my previous
> email. I should have checked more thoroughly.

At last I managed to figure out the origin and seem to recover the
normal behavior. Sorry for your inconvinience.

Regards,
Ikumi Keita



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Colin Baxter
Dear Ikumi,

> Ikumi Keita  writes:
> Ah, no. The fontification doesn't happen when I open another latex
> file. I have to figure out why...

> Regards, Ikumi Keita

Yes, I can confirm that. I was too quick off the mark in my previous
email. I should have checked more thoroughly.

Best wishes,




Re: font-latex-match-warning-make void function.

2021-03-25 Thread Ikumi Keita
>>>>> Ikumi Keita  writes:
> Hi Colin,
>>>>> Colin Baxter  writes:
>> After today's pull of auctex, I'm getting a
>> "font-latex-match-warning-make" void function error and auctex will not
>> load.

> Thank you, fixed in the git repo. Recent reorder in font-latex.el broke
> the dependency of function and variable.

Ah, no. The fontification doesn't happen when I open another latex
file. I have to figure out why...

Regards,
Ikumi Keita



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Colin Baxter
>>>>> Ikumi Keita  writes:

> Hi Colin,
>>>>> Colin Baxter  writes:
>> After today's pull of auctex, I'm getting a
>> "font-latex-match-warning-make" void function error and auctex
>> will not load.

> Thank you, fixed in the git repo. Recent reorder in font-latex.el
> broke the dependency of function and variable.

> Regards, Ikumi Keita

Thank you, Ikumi. I can confirm that it is fixed.

Best wishes,



Re: font-latex-match-warning-make void function.

2021-03-25 Thread Ikumi Keita
Hi Colin,

>>>>> Colin Baxter  writes:
> After today's pull of auctex, I'm getting a
> "font-latex-match-warning-make" void function error and auctex will not
> load.

Thank you, fixed in the git repo. Recent reorder in font-latex.el broke
the dependency of function and variable.

Regards,
Ikumi Keita



font-latex-match-warning-make void function.

2021-03-25 Thread Colin Baxter
Hello,

After today's pull of auctex, I'm getting a
"font-latex-match-warning-make" void function error and auctex will not
load.

Best wishes,

Colin Baxter.