emacs-devel
[Top][All Lists]
Advanced

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

Re: Hiding passords in authinfo


From: Stefan Monnier
Subject: Re: Hiding passords in authinfo
Date: Sun, 14 Oct 2018 16:55:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Right. I tried to find a standard way to do the hiding part, especially
> one that would work with `reveal-mode`, and failed. Would doing it with
> `jit-lock-register` work with `reveal-mode` automatically?

reveal-mode doesn't care which mechanism you use to add the `invisible`
property, so doing it with jit-lock-register will neither help nor
hinder the use of reveal-mode.

The current constraint of reveal-mode is that it only works for text
hidden using the `invisible' property, and only if that property is
applied via an overlay.

It might very well be too restrictive for your use case (e.g. you might
prefer to hide the passwords by replacing them with ******* or something
like that, which requires the use of a `display` rather than
`invisible` property, and you might also prefer to use a text-property
rather than an overlay), but my suggestion was to extend reveal-mode to
be able to handle such cases.

You can see in reveal-open-new-overlays what tests are applied before
"opening" an overlay:

                  (and inv
                       ;; There's an `invisible' property.  Make sure it's
                       ;; actually invisible, and ellipsized.
                       (and (consp buffer-invisibility-spec)
                            (cdr (assq inv buffer-invisibility-spec)))
                       (or (setq open
                                 (or (overlay-get ol 'reveal-toggle-invisible)
                                     (and (symbolp inv)
                                          (get inv 'reveal-toggle-invisible))
                                     (overlay-get ol 
'isearch-open-invisible-temporary)))
                           (overlay-get ol 'isearch-open-invisible)
                           (and (consp buffer-invisibility-spec)
                                (cdr (assq inv buffer-invisibility-spec))))
                       (overlay-put ol 'reveal-invisible inv))

It could test for the presence of the `display` property (and maybe
check for the presence of a reveal-specific property like
reveal-toggle-invisible above, so that it doesn't reveal any and all
`display` properties but only those that were designed to be revealed).


        Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]