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

Re: privacy function for deleting cookies, history, etc. [SNIPPET INCLUDED]

My plan is always welcome code review, and to respond, so here goes:

On 2019-02-04 17:11, Filipp Gunbin wrote:
> I'd really not like having something which calls rm -f from inside
> emacs by default.

Opinion noted.

>  And how is rm -f better than emacs's delete-file?

The edge case of a file somehow getting minor-level protection.

> Maybe just empty default value for w3m-scrub-command-list? Or, better,
> just visit files (cookie file etc.) and clear them?

Neither of those suggestions would amount to something that could be
characterized as a scrub, but we could always just call it "delete.."
instead. The goal of the snippet is to take that extra step.

I'm hoping to get feedback from users of other operating systems with
corresponding methods used in their environments, so that those methods
could be added to the list. If/when the snippet is merged before such
feedback is offered, my intent is to peck around myself.

> >          (cmd (progn
> >                 (while (and (setq cmd (pop cmds))
> >                             (not (file-executable-p (car cmd)))))
> >                 cmd))
> Seems dangerous to use "cmd" inside its own initialization.  Better user
> let-form with a new var for use in loop.

That's not a constructive comment to which I can respond. "Seems" is a
weasel-word, "dangerous" is a vague scare-mongering word that you don't
substantiate, and your second sentence I can't make sense of - it would
be better to actually code an alternative snippet.

> >          (cmd-string (if cmd
> >                        (format "%s %s" (car cmd) (cdr cmd))
> >                       "emacs' delete-file"))
> Hm?  I don't get this "emacs' .." value.

There's nothing to get, it's an output string; it give the variable
cmd-string the value "emacs' delete-file".

> >                   (directory-files w3m-profile-directory 'full
> >                     "^w3m\\(cache\\|cookie\\|el\\|src\\|tmp\\)" 'nosort))))
> What does el/src have to do with private files?

If you look through the code, you'll see how those files are used.

> >    (switch-to-buffer stdout-buf)
> This functions states in the docstring: "WARNING: This is NOT the way to
> work on another buffer temporarily within a Lisp program!  Use
> ‘set-buffer’ instead.  That avoids messing with the window-buffer
> correspondences."

I did read that before I decided that the function was the correct tool
for this job, because in this use-case, we want the buffer to be visibly
presented to the user while the buffer is being acted upon. The
scrubbing process that the snippet performs could take many seconds, so
this will show the user the progress as it unfolds. The warning in the
docstring is for uses meant not to be visible to the user during its

> >    (insert "Beginning emacs-w3m history scrub "
> >            (format-time-string "%Y-%m-%d %H:%M")
> >            "\n\nDeleting files ...\n")
> Actually, maybe just write a shorter log to *Messages*?

This speaks to my prior comment, and is an opportunity to elaborate on
it. What I want is to confront the user with the details of the progress of
the operation, and then allow the user to then delete that record, ie.
kill-buffer, or possibly save it. My opinion is that the messages are
too much detail for the message log.


CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0