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

Re: w3m mode should extend to .txt files by default

Is it possible to adapt that idea to force w3m to open local files
that do not end with "\\.[sx]?html?\\'" as HTML?

Here's an example: run

  cd /tmp/
  wget http://angg.twu.net/emacs.html
  cp -v ~/TH/L/emacs.html /tmp/emacs.ht
  cp -v ~/TH/L/emacs.html /tmp/emacs.txt
  wget http://www.polimetrica.com/main/list.php

  # Optional
  # (find-file "~/.w3m/")
  # (shell-command-to-string "rm -Rv ~/.w3m/")
  rm -Rv ~/.w3m/

and now (broken, but I hope this may be a step in the right

  (w3m "file:///tmp/emacs.html")
  (w3m "file:///tmp/emacs.txt")
  (w3m "file:///tmp/emacs.ht")
  (w3m "file:///tmp/list.php")
  (let ((w3m-local-find-file-regexps '(nil . "")))
    (w3m "file:///tmp/emacs.html"))
  (let ((w3m-local-find-file-regexps '(nil . "")))
    (w3m "file:///tmp/emacs.txt"))
  (let ((w3m-local-find-file-regexps '(nil . "")))
    (w3m "file:///tmp/emacs.ht"))
  (let ((w3m-local-find-file-regexps '(nil . "")))
    (w3m "file:///tmp/list.php"))

In the case ".html" w3m treats it as HTML, as expected;
in the case ".txt" w3m renders it as plain text (not good),
in the case ".ht" I get the message

  Input emacs.ht's content type (default Download):

in the minibuffer while a temporary buffer called "*w3m-work*" is
displayed, and when I answer "text/html" w3m renders it as HTML -
good, but how do I skip the question? And it seems that the answer is
cached in ~/.w3m/ in some format that I do not understand...
and the case ".php" seems to be similar to the case ".ht"...

Cheers, thanks in advance,
  Eduardo Ochs

P.S.: I am using emacs-w3m from CVS, updated a few minutes ago.

On Tue, Dec 2, 2008 at 2:02 AM, Naohiro Aota <nao.aota@xxxxxxxxx> wrote:
> From: jidanni@xxxxxxxxxxx
> Subject: [emacs-w3m:10469] w3m mode should extend to .txt files by default
> Date: Sun, 30 Nov 2008 06:10:12 +0800
>> In file:///usr/share/doc/git-doc/howto-index.html
>> I click file:///usr/share/doc/git-doc/howto/setup-git-server-over-http.txt
>> and I end up in (Text) mode. In real w3m I would still be in w3m mode,
>> where B goes BACK, etc.
> How about trying this?
> (setq w3m-local-find-file-regexps
>      '(nil . "\\.\\(?:[sx]?html?\\|txt\\)\\'"))