bkaestner / redacted.el

GNU General Public License v3.0
106 stars 6 forks source link

Auto redact word list and pdf-tools #10

Open gringobenuk opened 1 year ago

gringobenuk commented 1 year ago

Does this redact everything or can it discriminate based on a supplied word list (CSV file)? Is it likely to work on buffers that represent text within pdf files when using pdf-tools?

bkaestner commented 1 year ago

Hey @gringobenuk, sorry for the late reply.

Does this redact everything or can it discriminate based on a supplied word list (CSV file)?

It redacts the whole buffer currently by replacing the shown characters. This is a simple and efficient method, as it doesn't need any fancy filtering/regex or similar, but unfortunately, it's not customizable at all.

However, there might be something similar already built-in. If you open .authinfo with already saved passwords, you will notice that there is some kind of redaction mechanism at hand. Maybe you can reuse that one for your use case? See authinfo--hide-passwords (but without the reveal-toggle-dislplay part). Keep in mind that any change of a redacted element will leak parts of it though, so you really only want something like this for screenshots, never for streams.

Overlays might be the only way to implement several feature requests (see #8), so I might tackle it at some point. But no due date at the moment, somewhat busy. Sorry again :/

Is it likely to work on buffers that represent text within pdf files when using pdf-tools?

Very unlikely IMHO. I don't know pdf-tools and docview-mode by heart, but I can imagine that you would need to change the document before its actually rendered. But even then, it might be misleading, because some (bad) PDFs have no text information, just vector information, and you would have to do some kind of text recognition first in order to fix that. I don't have the knowledge nor experience to do that, so it's out-of-scope for redacted.el (#patcheswelcome).

Hope that helps!

bkaestner commented 1 year ago

Does this redact everything or can it discriminate based on a supplied word list (CSV file)?

Just a quick note: you can use highlight-phrase programmatically with a hidden face, @gringobenuk as an intermediate solution.