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: Fri, 12 Jun 2020 16:17:25 +0000 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <4krg9s2y.fsf@lifelogs.com> References: <4973bec9-0abf-8f55-0b60-0879b6fe1fa7@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="6876"; 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 Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 12 18:18:14 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 1jjmNg-0001cy-4Z for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Jun 2020 18:18:12 +0200 Original-Received: from localhost ([::1]:43170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jjmNf-0007Lj-6m for ged-emacs-devel@m.gmane-mx.org; Fri, 12 Jun 2020 12:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jjmN7-0006kv-Vq for emacs-devel@gnu.org; Fri, 12 Jun 2020 12:17:37 -0400 Original-Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:44478) by eggs.gnu.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jjmN3-000336-Vk for emacs-devel@gnu.org; Fri, 12 Jun 2020 12:17:37 -0400 Original-Received: by mail-qk1-x72a.google.com with SMTP id c14so9461149qka.11 for ; Fri, 12 Jun 2020 09:17:28 -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; bh=Ka+rtkLqophSzToqKNwnQWgoHlTO3gO8aOe2HKRiSTM=; b=bQAeXXaVnCEjl2g4ZqFJnvOQuiXYmdz5DQcyrLp2AOsvYXWfLaGvsmuKhfKhD2rtXH 2MV0mh116wH0ESkfolIcRCocsBR20F+nP5pHtOHRWzdmkQwIKyFcFc9he03TWyvxoSoY onrq9WhYvG8NhhLPLD3usYBkQjbdvAdofjsuw= 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; bh=Ka+rtkLqophSzToqKNwnQWgoHlTO3gO8aOe2HKRiSTM=; b=be5zgaVFw6WTN8YY0mQ0NNP+/Aqu3Fq4WAXuF8ONdDAcbityUoIpFc1g6IMN6oh4OQ wdNvh9iqbW7jTv7y66pMPmmTAznki6tk+LtI9izZC5nZxpvx3xe94b6KYy1mGY2QQh7H 3WMe65DXfE4MdcYlQq2c0gUWD+184KN5MihJpjmIGTB8JvDhN+f5ub0DnEUVk/bYiVVJ 0EUx7PNn7B9SOpGVPeTvu5a8fax6IBOKF+HaBaI2JjJusu11uN4sTns//mBulpWHM6jS NSX+CAbBveocxuuQVi1hJyyNZqJP3FmfrCwj9OTRWBBsp+PLmoXUb84tBczbEfHkBFF8 Y1sQ== X-Gm-Message-State: AOAM533PWPMtl8wCmd+NdY+cur1nFSDn+LbZHrL8l7kF342LzjUnN3u1 2n0DpmVs3kYOstpuSy/G8FBX7dLewRIFHA== X-Google-Smtp-Source: ABdhPJxqNDpgyCjfhjbAs3Y8JgAwUR4jy1qCiiFknsuwLOv8SLzUiz9ZTWXKw3LsUlpIPyhcFvazbQ== X-Received: by 2002:a37:4048:: with SMTP id n69mr3644243qka.344.1591978647698; Fri, 12 Jun 2020 09:17:27 -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 d78sm4754630qkg.106.2020.06.12.09.17.26 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Jun 2020 09:17:26 -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: (Stefan Monnier's message of "Thu, 11 Jun 2020 15:51:27 -0400") Received-SPF: none client-ip=2607:f8b0:4864:20::72a; envelope-from=tzz@lifelogs.com; helo=mail-qk1-x72a.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 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:252136 Archived-At: On Thu, 11 Jun 2020 15:51:27 -0400 Stefan Monnier 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