>From 11fea59d41063b3511a84a0d783cfa2016ed68c4 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Sat, 31 Oct 2015 21:36:41 +0300 Subject: [PATCH 1/2] emacs: Add 'guix-hash-char-regexp'. * emacs/guix-utils.el (guix-hash-char-regexp): New constant. * emacs/guix-prettify.el (guix-prettify-regexp): Use it. --- emacs/guix-prettify.el | 8 ++++---- emacs/guix-utils.el | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/emacs/guix-prettify.el b/emacs/guix-prettify.el index 38d72e8..0411aee 100644 --- a/emacs/guix-prettify.el +++ b/emacs/guix-prettify.el @@ -84,10 +84,10 @@ disabling `guix-prettify-mode' a little faster." ;; http://hydra.gnu.org/nar/…-foo-0.1 ;; http://hydra.gnu.org/log/…-foo-0.1 - (rx "/" (or "store" "nar" "log") "/" - ;; Hash-parts do not include "e", "o", "u" and "t". See base32Chars - ;; at - (group (= 32 (any "0-9" "a-d" "f-n" "p-s" "v-z")))) + (rx-to-string + `(and "/" (or "store" "nar" "log") "/" + (group (= 32 (regexp ,guix-hash-char-regexp)))) + t) "Regexp matching file names for prettifying. Disable `guix-prettify-mode' before modifying this variable and diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el index d1f088b..d8dad91 100644 --- a/emacs/guix-utils.el +++ b/emacs/guix-utils.el @@ -33,6 +33,12 @@ "String used to format time values. For possible formats, see `format-time-string'.") +(defconst guix-hash-char-regexp + ;; Hash parts do not include "e", "o", "u" and "t". See base32Chars + ;; at . + "[0-9a-df-np-sv-z]" + "Regexp matching a character used by Nix base32 hash.") + (defun guix-get-string (val &optional face) "Convert VAL into a string and return it. -- 2.5.0