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

Re: w3m-pop-up-windows and w3m-use-tab



In [emacs-w3m:12938]
On Thu, 15 Mar 2018 15:24:42 -0400, Boruch Baum wrote:
> That handles only an evaluation upon beginning emacs-w3m, but
> not once it has started?

To change the display mode immediately while emacs-w3m is running,
a user has to use `M-x customize-option' to modify the value of
`w3m-display-mode'.  When a user presses the [Apply] button,
a function assigned to the `:set' keyword of the defcustom form
does it, i.e., changing the three variables `w3m-use-tab',
`w3m-pop-up-windows', and `w3m-pop-up-frames' according to the
specified mode.  Because defcustom is the main user's tool to
modify user options, there are more than a few variables that
require a user to use `customize-option' to modify the actual
behavior of Emacs.  Try ``grep ':set' *.el'' in the Emacs source.

> Now, changing any of the variables at any time has an immediate
> effect.

I know your approach aims to do it, but I don't like to do it for
the feature that wouldn't be used so frequently because it can
make the emacs-w3m code complicated[1] and force an overhead.
But if you don't like to use `customize-option'[2], how about
making it a special minor mode?  Using `define-minor-mode' would
be cool; it provides the ones equivalent to:

(defcustom w3m-display-mode nil
  "A variable.")

(defun w3m-display-mode (&optional mode)
  "A function."
  (interactive (list (completing-read "Mode: " ...)))
  (setq w3m-use-tab 'foo)
  (setq w3m-pop-up-windows 'bar)
  (setq w3m-pop-up-frames 'baz))

[1] It's already complicated enough? ;-)
[2] I don't like to use `customize-option' so much, but I like
designing :type, :set, and :get forms of defcustom very much. ;-)