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

Re: Fix melpa installation



Katsumi Yamaoka <yamaoka@xxxxxxx> writes:

> In [emacs-w3m:13554]
> On Fri, 13 Sep 2019 17:14:11 +0900, Katsumi Yamaoka wrote:
> > I posted an isseue message as:
> > <https://github.com/melpa/melpa/issues/6435>
>
> I made a change so to make emacs-w3m create the w3m-load.el file
> if it is missing in the melpa installation after all, and changed
> the recommended recipe for getting started emacs-w3m as follows:
>
> ,---- <https://emacs-w3m.github.io/index.html#configuration>
> | Emacs-w3m has many configuration options, but the minimum that
> | is required is just to put this line into your ~/.emacs file:
> |
> |     (require 'w3m-load)
> |
> |     If you have installed emacs-w3m from MELPA, there is no
> |     w3m-load.el file initially, so we recommend using instead
> |     this in order to create the w3m-load.el file:
> |
> |         (condition-case nil
> |             (require 'w3m-load)
> |           (file-error (require 'w3m)))
> |
> |     Once the w3m-load.el file is created by w3m.elc, you may
> |     replace the above form with the one-line setting (if you
> |     want), i.e.:
> |
> |         (require 'w3m-load)
> |
> |     If the w3m-load.el file is not created, make sure if the
> |     file ~/.emacs.d/elpa/archives/melpa/archive-contents
> |     exists.
> |
> | And then, just type M-x w3m, and you can use emacs-w3m.
> `----

Works for me, thanks.  I can now file bug reports.  I didn't look at
your change, just at the effects.

A negative point: apparently, when w3m created "w3m-load" after
restarting my emacs here, it produced a warning (AFAIR something like
"unknown var package-desc" or something like that).  And there was no
indication where it came from so users might investigate and invest time
uselessly.  Either try to avoid that warning and/or print a message like
"Creating file w3m-load.el for you..."

Then I would like to discuss your suggested form for the users' init
files:

|         (condition-case nil
|             (require 'w3m-load)
|           (file-error (require 'w3m)))

I think I'll instead use

(eval-and-compile
  (or (require 'w3m-load nil t)
      (require 'w3m      nil t)))

Differences:

- use NOERROR arg of `require' to avoid co-case - can you use that too?

- (important) Don't error in case w3m is not installed!  Maybe the user
wants to reinstall or temporarily uninstall it later etc - this
shouldn't break Emacs startup.

- nitpick: I use `eval-and-compile' because I compile my init file and
so the compiler knows about w3m stuff when compiling.


Thanks,

Michael.