From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: questions about correct reveal-mode usage to hide passwords Date: Tue, 16 Jun 2020 18:09:48 +0000 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <7dw6naqb.fsf@lifelogs.com> References: <4973bec9-0abf-8f55-0b60-0879b6fe1fa7@gmail.com> <4krg9s2y.fsf@lifelogs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="127388"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier , =?iso-8859-1?Q?Cl=E9ment?= Pit-Claudel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 16 20:10:29 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlG2X-000X2S-2z for ged-emacs-devel@m.gmane-mx.org; Tue, 16 Jun 2020 20:10:29 +0200 Original-Received: from localhost ([::1]:35684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlG2W-0005TL-2r for ged-emacs-devel@m.gmane-mx.org; Tue, 16 Jun 2020 14:10:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jlG1y-0004yY-TX for emacs-devel@gnu.org; Tue, 16 Jun 2020 14:09:55 -0400 Original-Received: from mail-qk1-x732.google.com ([2607:f8b0:4864:20::732]:38728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jlG1x-0001hD-0w for emacs-devel@gnu.org; Tue, 16 Jun 2020 14:09:54 -0400 Original-Received: by mail-qk1-x732.google.com with SMTP id w1so20080380qkw.5 for ; Tue, 16 Jun 2020 11:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lifelogs.com; s=google; h=from:to:cc:subject:organization:references:mail-copies-to:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=OmIOsDBy6gNxSN92Oxd8nqf7bpNLoi86F06i+TO7Kas=; b=b8wwJxIriBH3UySJZbi43CTWGTnsld3mFpHi1RinE/AACF2RstI6Gn7JJXwHlwgh0n 618zwVxkGcFEZrCT0/Dn2WUXlkBAjtU5/RpRjKsOvIOc6Ecl6drWFM0IlBGdQkywuKNe n+/K7Fk5L+s0iikU0phPmwdYBvMX0EbTq0j4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:organization:references :mail-copies-to:date:in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=OmIOsDBy6gNxSN92Oxd8nqf7bpNLoi86F06i+TO7Kas=; b=Lr4ohBcESpZ8F0Q0IC1EC6RbIFJ/vT9cYUvUU+o8vsLgTqpQv2lvTB4MTUkoCG+aR2 8VKy8js/rk00jUrd0rCkqp5UhiVVP7gPrRn++agSpFRfB9Exej/ColVAcb9Gh0tyCjXN FsXf0zvNP+kA6dinoQKtpJaeLOIW0+HMjwDop7SJpiE2F7qYDOSxusyMGMtNkh4v3Rs4 qvm38jzpymGUPJdicpxdGz0dxRcme8+e9sJwEc1WiXRUp8esNApmXBwJ9GfbOsL2+Am+ kQye9mZ/Cgt2H6esP38/sh0C/+8+6uUeT8y6rRUxaJQiTAX5l29ovYK4CUs+kT8efqCD oyKw== X-Gm-Message-State: AOAM533mP5vlmPB3WxmULv5n32RRat1bhTNad11/PkcK8jAglkLXYzTs h22NGqaq/FYyVKtWxy5EQLNc6oF/Jsbc2g== X-Google-Smtp-Source: ABdhPJwpyeb43b8zWaqO8OhosRfq0M0so03Qsg75Fw+Al12mUJiKxY0Sy7BxsI88kwgADt739BZa0w== X-Received: by 2002:a05:620a:22d7:: with SMTP id o23mr19202332qki.119.1592330990941; Tue, 16 Jun 2020 11:09:50 -0700 (PDT) Original-Received: from flea (c-76-28-41-155.hsd1.ma.comcast.net. [76.28.41.155]) by smtp.gmail.com with ESMTPSA id b74sm14180473qkc.17.2020.06.16.11.09.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jun 2020 11:09:49 -0700 (PDT) X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Copies-To: never In-Reply-To: <4krg9s2y.fsf@lifelogs.com> (Ted Zlatanov's message of "Fri, 12 Jun 2020 16:17:25 +0000") Received-SPF: none client-ip=2607:f8b0:4864:20::732; envelope-from=tzz@lifelogs.com; helo=mail-qk1-x732.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:252281 Archived-At: On Fri, 12 Jun 2020 16:17:25 +0000 Ted Zlatanov wrote:=20 TZ> I spent a few hours in that direction, but prettify-symbols-mode was TZ> just too easy to extend... I've pushed my proposed patch to TZ> scratch/tzz/auth-source-reveal-mode as follows: TZ> * allow regexps in prettify-symbols-alist using a new extended format. I TZ> wasn't sure here if I should go with the current format, and the TZ> replacement lookup does extra string-match calls, so it's not ideal. TZ> This specific extension was requested fairly often, looking back at TZ> the last few years on various Emacs forums. I extended the new format to allow any symbol as an identifier, and speed up lookups based on the identifier. Each fixed entry is still collected in one big optimized regexp by prettify-symbols--make-fixed-matcher, and there is no identifier (we just do a fast assoc as before). But in addition, each regexp entry in prettify-symbols-alist now gets processed by prettify-symbols--make-regexp-keywords, with the identifier propagated down the call chain. I think this is fairly clean. TZ> * define a new local variable prettify-symbols-compose-replacer for the TZ> function that looks up and replaces the symbol TZ> * create the new auth-source-reveal-mode that behaves as proposed, both TZ> in JSON and in netrc/authinfo buffers. It warns if TZ> prettify-symbols-unprettify-at-point is nil, since I think the TZ> experience is much less pleasant without it. It doesn't check syntax TZ> as carefully as prettify-symbols-mode. TZ> * document the composition layout format enough that users can customize TZ> auth-source-reveal-hider to show a fancy string instead of a single TZ> character. I think this will appeal to prettify-symbols-mode users in TZ> general, since I have seen quite a few hacks for it in various Emacs TZ> forums and even a helper library https://github.com/Ilazki/prettify-u= tils.el/blob/master/prettify-utils.el TZ> * the new code in auth-source.el and prog-mode.el is much less than the TZ> other approaches I tried, and much much less confusing. I like that :) Following Cl=E9ment's suggestion, I started on the library path by creating some new functions to install and remove prettifications. Coupled with the new identifier symbols and regexps, I think this covers all the use cases for touching or bypassing prettify-symbols-alist I've seen. prettify-symbols-add-prettification-entry "Add ENTRY to `prettify-symbols-alist' for the current buffer. prettify-symbols-add-prettification-rx "Convenience wrapper of `prettify-symbols-add-prettification-entry' to pr= ettify REGEXP with REPLACEMENT." prettify-symbols-add-prettification-string "Convenience wrapper of `prettify-symbols-add-prettification-entry' to pr= ettify FIXED-STRING with REPLACEMENT." prettify-symbols-remove-prettification "Remove ENTRY to `prettify-symbols-alist' for the current buffer. prettify-symbols-remove-prettifications "Remove all IDENTIFIER entries from `prettify-symbols-alist' for the curr= ent buffer. TZ> Let me know if you have strong objections or any suggestions, otherwise TZ> in a day or two I'll document and push this patch. I haven't heard from Stefan, so I'm still holding off merging and would appreciate feedback. Ted