unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Hiding passords in authinfo
Date: Sun, 14 Oct 2018 16:55:14 -0400	[thread overview]
Message-ID: <jwvwoqk45pv.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <ftx8wcj8.fsf@lifelogs.com> (Ted Zlatanov's message of "Sun, 14 Oct 2018 19:31:23 +0000")

> 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	other threads:[~2018-10-14 20:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-14 14:56 Automatic minor modes? Lars Ingebrigtsen
2018-04-14 11:49 ` Charles A. Roelli
2018-04-14 18:59   ` Lars Ingebrigtsen
2018-04-14 15:23 ` Yuri Khan
2018-04-14 15:27   ` Lars Ingebrigtsen
2018-06-27  1:31     ` Ted Zlatanov
2018-07-22 12:26       ` Lars Ingebrigtsen
2018-07-22 15:51         ` Clément Pit-Claudel
2018-07-22 19:01           ` Stefan Monnier
2018-07-22 20:06             ` Clément Pit-Claudel
2018-10-08  1:05               ` Ted Zlatanov
2018-10-08 14:57                 ` Stefan Monnier
2018-10-09 19:44                   ` Ted Zlatanov
2018-10-14  3:59                     ` Ted Zlatanov
2018-10-14 14:44                       ` Eli Zaretskii
2018-10-14 15:48                         ` Ted Zlatanov
2018-10-14 16:05                           ` Eli Zaretskii
2018-10-14 18:23                           ` Hiding passords in authinfo (was: Automatic minor modes?) Stefan Monnier
2018-10-14 19:31                             ` Hiding passords in authinfo Ted Zlatanov
2018-10-14 20:55                               ` Stefan Monnier [this message]
2018-04-14 15:39 ` Automatic minor modes? Clément Pit-Claudel
2018-04-14 15:45   ` Lars Ingebrigtsen
2018-04-14 16:40     ` Clément Pit-Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvwoqk45pv.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).