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

Re: using filter correctly?



Thank you.  I tried the searches and they work fine, but it seems as
if the filter is  not being run.  I put a message in it and it did not
appear.

On 7/21/13, Katsumi Yamaoka <yamaoka@xxxxxxx> wrote:
> In [emacs-w3m : No.12096] Samuel Wales wrote:
>> Is this the correct way?  Seems to not display the changes.
>
> Looks ok.  But if it doesn't work as expected, you may want to
> verify if two regexps match the actual html contents.  To do
> that:
>
> ・Visit the page in question using emacs-w3m.
> ・Press the backslash key to show the html source.
> ・Eval (i.e. `M-:') these sexps one by one:
>   (goto-char (point-min))
>   (re-search-forward "whatever: begin" nil t)
>   (re-search-forward "whatever: end" nil t)
>
>>     (setq w3m-use-filter t)
>>     (require 'w3m-filter)
>
>>     ;; (setf w3m-filter-configuration nil)
>>     (add-to-list 'w3m-filter-configuration
>>      '(t
>>        "whatever -- remove stuff at top"
>>        "https://whatever.com";
>>        alpha-w3m-fix-whatever))
>>     (defun alpha-w3m-fix-whatever (_url)
>>       (let ((b (and (goto-char (point-min))
>>                     (re-search-forward "whatever: begin" nil t)
>>                     (beginning-of-line)
>>                     (point)))
>>             (e (and (re-search-forward "whatever: end" nil t)
>>                     (beginning-of-line)
>>                     (forward-line 1)
>>                     (point))))
>>         (when (and b e)
>>           (delete-region b e))))
>
>


-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.