[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: saving a buffer without images
On 2016-09-07 09:26, Katsumi Yamaoka wrote:
> In [emacs-w3m : No.12595]
> On Tue, 06 Sep 2016 17:44:30 -0400, Boruch Baum wrote:
> Long diff is ok, but please use the ways like the following to
> generate a diff and send it as a MIME part from the next time.
Will do. Sorry.
> I believe caddr is not a typo:
> (setq bname (cadr (assoc img imgs))
> ext (caddr (assoc img imgs)))
> Where `imgs' includes:
> (("url" "file-basename" "file-extention")...)
> cadar is not a typo either:
> (cadar w3m-history)
> See the variable documentation of `w3m-history'.
I don't see anything there regarding caddr or cadar, although I do see
that w3m-hist.el also calls such undefined functions. Running C-h f
and C-h v on both `cadar' and `caddr' also yield nothing.
My cvs version was up-to-date as of a few hours ago.
> > * change of parameter name `no-image' to `no-images'
> > * there seems to be a bug in the function call to
> > `w3m-history-set-current', so that function call was removed in
> > order to illustrate an error-free test.
> Why bug? After saving a w3m buffer, `w3m-view-next-page' in the
> buffer shows the saved one as designed.
It was generating an error message (in my *Messages* buffer)
w3m-history-previous-position: Wrong type argument: numberp, nil
> The docstring should mention what it is in one line:
> ,---- (info "(elisp)Documentation Tips")
> | • Format the documentation string so that it fits in an Emacs window
> | on an 80-column screen. It is a good idea for most lines to be no
> | wider than 60 characters. The first line should not be wider than
> | 67 characters or it will look bad in the output of ‘apropos’.
> Not a few emacs-w3m objects violate it though.
I don't understand. The documentation that you're quoting is talking
about line width, not number of lines.
> The idea of `w3m-save-buffer-html-only' is acceptable, but
> the variable name and its docstring don't mention that it is
> a complement operator:
Good point, but maybe regarding the function's prefix argument, not
the `w3m-save-buffer-html-only' variable, because with this patch, it
would be the prefix argument that performs the complement. The
following just replaces the word `over-ridden' with `toggled', which
is a less technical term. but more commonly undestood.
(defun w3m-save-buffer (name &optional no-images)
"Save the current buffer as `w3m-save-buffer-directory'/NAME.html,
and optionally save the buffer's associated image files in
folder `w3m-save-buffer-directory'/NAME-files/. Use of
`w3m-save-buffer-directory' may be over-ridden by including a
folder path in NAME. Variable `w3m-save-buffer-html-only'
determines whether images will be save by default, but that
setting may be toggled using the prefix argument (the
optional NO-IMAGES). The saved page will be added to the
history list, and be viewable using `w3m-next-page'."
> And `no-images' is not necessary to be `let'-bound because it is
> already bound as a function argument.
Also a correct point. I put it in the `let' because it didn't seem to
hurt, and it saved a separate assignment function call.
> BTW, there seems to be another way to achieve your personal
> purpose in a simple way, e.g.:
You alternative wasn't viewable in my email, but if it does the job
and you prefer it, it's fine with me.
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0