>>> 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= (&rest 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..5555f748b3 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