[Top][All Lists]

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

Re: questions about correct reveal-mode usage to hide passwords

From: Ted Zlatanov
Subject: Re: questions about correct reveal-mode usage to hide passwords
Date: Fri, 12 Jun 2020 16:17:25 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Thu, 11 Jun 2020 15:51:27 -0400 Stefan Monnier <monnier@iro.umontreal.ca> 

>> Is there an example using jit-lock that behaves like
>> prettify-symbols-mode in the following cases?
>> * transforms the text when outside it
>> * temporarily shows the original text when inside it or on its right edge
>> * updates when the user makes changes

SM> Maybe if you look at the `csv-align-mode` in GNU ELPA's `csv-mode.el`
SM> (tho it mixes the job of aligning columns and of truncating/hiding the
SM> text of columns that are too wide).

Hi Stefan. Thank you for the suggestion.

I spent a few hours in that direction, but prettify-symbols-mode was
just too easy to extend... I've pushed my proposed patch to
scratch/tzz/auth-source-reveal-mode as follows:

* allow regexps in prettify-symbols-alist using a new extended format. I
  wasn't sure here if I should go with the current format, and the
  replacement lookup does extra string-match calls, so it's not ideal.
  This specific extension was requested fairly often, looking back at
  the last few years on various Emacs forums.

* define a new local variable prettify-symbols-compose-replacer for the
  function that looks up and replaces the symbol

* create the new auth-source-reveal-mode that behaves as proposed, both
  in JSON and in netrc/authinfo buffers. It warns if
  prettify-symbols-unprettify-at-point is nil, since I think the
  experience is much less pleasant without it. It doesn't check syntax
  as carefully as prettify-symbols-mode.

* document the composition layout format enough that users can customize
  auth-source-reveal-hider to show a fancy string instead of a single
  character. I think this will appeal to prettify-symbols-mode users in
  general, since I have seen quite a few hacks for it in various Emacs
  forums and even a helper library 

* the new code in auth-source.el and prog-mode.el is much less than the
  other approaches I tried, and much much less confusing. I like that :)

Let me know if you have strong objections or any suggestions, otherwise
in a day or two I'll document and push this patch.

Thank you

reply via email to

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