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

Re: Using w3m-download



On 2019-03-12 13:41, andres.ramirez wrote:
> Hi Boruch.
>
> > https://github.com/Boruch-Baum/emacs-w3m/raw/bb_download/w3m-download.el
>
> Then I could change some of my scripts from doing:
> --8<---------------cut here---------------start------------->8---
> w3m-browse-url (used on pdf links)
> --8<---------------cut here---------------end--------------->8---
> To
> --8<---------------cut here---------------start------------->8---
> w3m-download-using-wget
> --8<---------------cut here---------------end--------------->8---

Yes, I think so. I haven't seen your scripts, but I've tested my work
both interactively and as direct elisp evaluations. Even without my
script, you could maybe use function `w3m-download' instead of
`w3m-browse-url', though that I don' remember ever tried scripting.

> Is it possible to have a notification when the N downloads have
> completed? (a hook). I know before hand the number of pdf's I would like
> to download.

The code originally did have a simple 'notification upon completion' in
the form of sending a message to the echo area at the end of each
individual download, but I didn't find it very useful since it would pop
in and out at any time, and often I wouldn't notice it. That would be
very easy to put back in - it's just a single line `message' call.

If what you're asking for is only a single notification when the number
of downloads has returned to zero, that can also be done easily. The way
that looks good to me would be to put a check in function
`w3m--download-sentinel' against the length of
`w3m--download-processes-list'. As above, if the idea is to send a
message to the echo area, keep in mind that it would pop in and out at
any time and you might not notice it. Another option, that doesn't need
any coding, is to perform `M-x list-processes', and occasionally peek at
it to see if any wget processes still exist.

In the code file, after the 'commentary' section, I've added to the
'dangerous feature creep' list an idea similar to notification, that has
the advantage of giving an overview of the progress of all downloads:

;;   + replace individual progress buffers with a single buffer, and
;;     use the process-fiter function to maintain a dedicated section
;;     for each download. This would be similar to the 'look' of the
;;     download windows of many other browsers.
;;     + summary line at top of buffer.
;;     + download states could be color-coded.
;;     + click option to resume a download
;;     + click option to open a download

BTW, also added to that list:

;;   + files in the process of being downloaded should have a
;;     temporary extension `.part' appended to their name, which would
;;     be removed upon successful completion, and possibly upon the
;;     pesky error code 1.

-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0