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

Re: `g' and `G' do not provide current url as the initial minibuffer contents

In [emacs-w3m : No.12370]
	On Thu, 31 Jul 2014 18:12:10 +0200, Michael Heerdegen wrote:
> It actually is called, but I think it is just written in an illegitimate
> way and doesn't work correctly.

I realized the first `M-n' (with no prefix argument) doesn't call
`minibuffer-default-add-function'; binding of `minibuffer-default'
has no effect, it's a bad manner if anything (as you wrote).

> You must not shadow the variable `minibuffer-default', because it is
> already bound to the DEFAULT-VALUE argument of `read-from-minibuffer,
> e.g. "about:".

I thought "about:" is useless, but now I see it is necessary.

> Rebinding this variable obviously confuses Emacs.  Here
> is a version that works for me:

> (defun w3m-input-url-default-add-completions ()

Thanks.  I've installed it in CVS (with the removing of duplication).
The `M-n' key binding no longer exists.

> There is probably no sane solution that calls
> `minibuffer-default-add-completions' and avoids code duplication.

> Note that in the list returned by
> `w3m-input-url-default-add-completions' the current value of
> `minibuffer-default' must be the first element; else, the thing doesn't
> work.

> So, if you want the current url to be the first candidate when hitting
> M-n, you must make it the DEFAULT-VALUE of `read-from-minibuffer'.


> BTW, which Emacs versions do we need to support?  Because, starting with
> Emacs 23, the DEFAULT-VALUE argument of `read-from-minibuffer' is
> allowed to be a list of several defaults.  When we would use this
> feature, everything would become trivially simple.

Emacs-w3m still supports XEmacs(en), so we have to take care of
the old functions behaviors.  Though I'm personally ok to drop
those old ones.