From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH] emacs: Add 'pretty-sha-path'. Date: Wed, 05 Nov 2014 14:24:49 +0300 Message-ID: <87d291uby6.fsf@gmail.com> References: <87d2926he1.fsf@gmail.com> <87h9ye8x6d.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xlyhw-0002w5-IE for guix-devel@gnu.org; Wed, 05 Nov 2014 06:25:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xlyhp-0007fG-Lm for guix-devel@gnu.org; Wed, 05 Nov 2014 06:25:00 -0500 In-Reply-To: <87h9ye8x6d.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Tue, 04 Nov 2014 22:37:14 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s (2014-11-05 00:37 +0300) wrote: > Alex Kost skribis: > >> Also I forgot to mention =E2=80=9Cemacs/guix-messages.el=E2=80=9D in =E2= =80=9Cemacs.am=E2=80=9D in >> commit 62f261d, so I did it in this patch (I hope it's not too evil :-)) > > Maybe =E2=80=9Cevil=E2=80=9D is too strong a word ;-), but please keep the > emacs/guix-messages.el addition in a separate commit. > > Commits are cheap and easy, so let=E2=80=99s favor clarity. Yes, cheap, I know, but not very easy for me as I never sure what to write in a commit message and I have to ask guix-devel even about such trivial changes (the patch is attached :-)). >> From e7ca6550d7f33d894e0023e3305938fce365fdba Mon Sep 17 00:00:00 2001 >> From: Alex Kost >> Date: Tue, 4 Nov 2014 19:38:27 +0300 >> Subject: [PATCH] emacs: Add 'pretty-sha-path'. >> >> * emacs/pretty-sha-path.el: New file. >> * emacs.am (ELFILES): Add it. >> * doc/emacs.texi (Emacs Pretty Path): New node. > > [...] > >> +@node Emacs Pretty Path >> +@subsection Pretty SHA Path Mode > > What about adding, at the end of the first paragraph of the =E2=80=9CFeat= ures=E2=80=9D > section, something like: > > ... where @code{xxx} is a base32 string (note that Guix comes with an > Emacs extension to shorten those file names, @ref{Emacs Pretty Path}.) OK, will do. >> +Along with ``guix.el'', GNU@tie{}Guix comes with ``pretty-sha-path.el''. >> +It provides a minor mode for abbreviating store paths by replacing >> +SHA-sequences of symbols with ``@dots{}'': >> + >> +@example >> +/gnu/store/onecansee32lettersandnumbershere-foo-0.1 @result{} /gnu/st= ore/=E2=80=A6-foo-0.1 > > Perhaps insert a line break before @result{}, otherwise the PDF output > may be truncated. OK. >> +@item M-x pretty-sha-path-global-mode >> +Enable/disable prettifying globally. > > It seemed to me that the convention would be to call it > global-pretty-sha-path-mode rather, no? Ah, thanks! I didn't thought about that; I just always used a package prefix for all symbols. According to (info "(elisp) Coding Conventions"): --8<---------------cut here---------------start------------->8--- =E2=80=A2 You should choose a short word to distinguish your program from other Lisp programs. The names of all global symbols in your program, that is the names of variables, constants, and functions, should begin with that chosen prefix. Separate the prefix from the rest of the name with a hyphen, =E2=80=98-=E2=80=99. This practice he= lps avoid name conflicts, since all global variables in Emacs Lisp share the same name space, and all functions share another name space(1). --8<---------------cut here---------------end--------------->8--- And also: --8<---------------cut here---------------start------------->8--- Occasionally, for a command name intended for users to use, it is more convenient if some words come before the package=E2=80=99s name prefix. --8<---------------cut here---------------end--------------->8--- So I'm going to add =E2=80=98global-pretty-sha-path-mode=E2=80=99 and menti= on it in the documentation, but I also leave =E2=80=98pretty-sha-path-global-mode=E2=80= =99 just in case (I'll make it an alias). > Other than that, LGTM! > > Mark is right about refining the regexp, but OTOH false positives are > very unlikely, and it might make things slightly slower, no? So either > way is fine with me. I think it shouldn't be visibly slower. I've realized that "pretty-sha-path" is a bad name, because those 32 numbers and letters have nothing to do with SHA-sequences as I thought initially. So maybe it would be better to rename it into "pretty-hash-path" or "guix-pretty-path" (as it will be a part of Guix) or something else. Or is it OK to leave it as it is? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-build-Add-missing-emacs-guix-messages.el.patch >From 4648af5bab6a9e98cc4c725b8fcca159874d4380 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Wed, 5 Nov 2014 14:00:05 +0300 Subject: [PATCH] build: Add missing "emacs/guix-messages.el". * emacs.am (ELFILES): Add "emacs/guix-messages.el". --- emacs.am | 1 + 1 file changed, 1 insertion(+) diff --git a/emacs.am b/emacs.am index 35470a3..9279078 100644 --- a/emacs.am +++ b/emacs.am @@ -24,6 +24,7 @@ ELFILES = \ emacs/guix-history.el \ emacs/guix-info.el \ emacs/guix-list.el \ + emacs/guix-messages.el \ emacs/guix-utils.el \ emacs/guix.el -- 2.1.2 --=-=-=--