[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: [PATCH] w3m-filter: correct return value, remove extra code



On 2017-06-12 16:25, Katsumi Yamaoka wrote:
> In [emacs-w3m : No.12677]
> On Mon, 12 Jun 2017 00:25:14 -0400, Boruch Baum wrote:
> > On 2017-06-12 11:35, Katsumi Yamaoka wrote:
> >> In [emacs-w3m : No.12675]
> >> On Mon, 12 Jun 2017 10:06:09 +0900, Katsumi Yamaoka wrote:
>
> >> Well, is there a way to get rid of those compiler warnings against
> >> `w3m-filter-delete-regions' and `w3m-filter-replace-regexp'
> >> exclusively?
>
> > My first guess, because of the number of times the warnings are
> > issued, is that those errors are because the functions are now macros.
>
> I think reverting those macros to the functions (and making them
> slow) doesn't solve it essentially.  The byte complier says truth.
> But the matter is it is just noisy.  After some thoughts, I've
> added a trick to `w3mhack-compile-file' in w3mhack.el.

Great. I'll make an effort anyway to do something to remove the
warnings. On that note, when performed a `make install', I received a
few other warnings:

   w3m-filter.el:913:53:Warning: assignment to free variable `p'
   w3m-filter.el:849:14:Warning: reference to free variable `p'

I was improperly using `setq'. Patch attached.


--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
--- ./w3m-filter.el.~1.63.~	2017-06-12 06:43:48.391583670 -0400
+++ ./w3m-filter.el	2017-06-12 06:53:45.821247450 -0400
@@ -822,10 +822,10 @@
 			       nil nil nil (point) nil 1)
     (goto-char (point-min))
     (when (search-forward "<h2 class=\"main-viralbox__title\">" nil t)
-      (setq p (match-beginning 0))
-      (goto-char (point-min))
-      (while (re-search-forward "<a[^>]+>\\(<img[^>]+>\\)</a>" p t)
-	(replace-match "\\1"))
+      (let ((p (match-beginning 0)))
+        (goto-char (point-min))
+        (while (re-search-forward "<a[^>]+>\\(<img[^>]+>\\)</a>" p t)
+          (replace-match "\\1")))
       (while (re-search-forward "<a[^>]+>\\(<div[^>]+>\\)?\
 \\(<img[^>]+>\\)\\(.*?\\)\\(<a[^<]+</a>\\)"
 				nil t)