all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: questions about correct reveal-mode usage to hide passwords
Date: Fri, 12 Jun 2020 16:17:25 +0000	[thread overview]
Message-ID: <4krg9s2y.fsf@lifelogs.com> (raw)
In-Reply-To: <jwvbllp9ybu.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 11 Jun 2020 15:51:27 -0400")

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

>> 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 https://github.com/Ilazki/prettify-utils.el/blob/master/prettify-utils.el

* 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
Ted



  reply	other threads:[~2020-06-12 16:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 14:09 questions about correct reveal-mode usage to hide passwords Ted Zlatanov
2020-06-11 14:21 ` Clément Pit-Claudel
2020-06-11 17:33   ` Stefan Monnier
2020-06-11 17:43     ` Clément Pit-Claudel
2020-06-11 17:49       ` Stefan Monnier
2020-06-11 18:31         ` Ted Zlatanov
2020-06-11 19:51           ` Stefan Monnier
2020-06-12 16:17             ` Ted Zlatanov [this message]
2020-06-12 16:35               ` Clément Pit-Claudel
2020-06-12 17:08                 ` Ted Zlatanov
2020-06-16 18:09               ` Ted Zlatanov
2020-06-18 18:38                 ` Ted Zlatanov

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

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

  git send-email \
    --in-reply-to=4krg9s2y.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.