redacted.el icon indicating copy to clipboard operation
redacted.el copied to clipboard

Redact mode line?

Open kchanqvq opened this issue 2 years ago • 4 comments

Currently it doesn't seem to do anything to the mode line. Can it be redacted as well?

kchanqvq avatar Oct 09 '22 07:10 kchanqvq

Hey @BlueFlo0d, thanks for the suggestion. That's an interesting take. It might be possible, but I'm not certain how overlays or display-tables work within the mode line. I'll have a look at the weekend.

bkaestner avatar Oct 11 '22 16:10 bkaestner

So, just to be sure, you would like redacted-mode to act as if the following hook was active?

(add-hook 'redacted-mode-hook
          (lambda () (if redacted-mode
                         (setq mode-line-format " [REDACTED ] ")
                       (setq mode-line-format (cdar (get 'mode-line-format 'standard-value))))))

(You can try it out with the current redacted-mode package)

That might be feasible, yeah. I'd probably have to introduce a new customization option redacted-mode-redact-modeline, which is either nil, t or a string (for custom [REDACTED] messages).

bkaestner avatar Oct 15 '22 12:10 bkaestner

Ah, that's a feasible solution, and I'm already doing it :) https://github.com/BlueFlo0d/insecure-lock

I think a new customization option is not strictly necessary because users can do this themselves relatively easily.

I'm still curious about whether the same effect applied to buffer text can be applied to mode line…

kchanqvq avatar Oct 15 '22 17:10 kchanqvq

I'm still curious about whether the same effect applied to buffer text can be applied to mode line…

That's a good question; I'm not entirely sure though. The mode-line is, as far as I know, not accessible as a "normal" buffer, so the buffer-display-table trick doesn't apply. If you were able to get the contents of the mode-line, then a string replacement should be feasible.

bkaestner avatar Oct 16 '22 12:10 bkaestner