This Emacs package provides minor-mode for prettifying Guix / Nix store paths by replacing SHA-sequences with ellipsis, i.e.:
/gnu/store/72f54nfp6g1hz873w8z3gfcah0h4nl9p-foo-0.1 → /gnu/store/…-foo-0.1 /nix/store/nh4n4yzb1bx7nss2rg342dz44g14m06x-bar-0.2 → /nix/store/…-bar-0.2
This package is avalable on MELPA.
As usual for the manual installation, add a directory with
pretty-sha-path.el
to the load-path
and add necessary autoloads:
(add-to-list 'load-path "/path/to/pretty-sha-path")
(autoload 'pretty-sha-path-mode "pretty-sha-path" nil t)
(autoload 'global-pretty-sha-path-mode "pretty-sha-path" nil t)
pretty-sha-path
is also distributed with GNU Guix (since Guix 0.8), so
if you have Guix installed, this package is already installed. The only
difference is that it is called guix-prettify
there.
- Enable/disable prettifying for the current buffer:
M-x pretty-sha-path-mode
- Enable/disable prettifying globally:
M-x global-pretty-sha-path-mode
Using programmatically in your emacs init file:
- Enable only for some modes:
(add-hook 'shell-mode-hook 'pretty-sha-path-mode) (add-hook 'dired-mode-hook 'pretty-sha-path-mode)
- Or enable globally on emacs start:
(global-pretty-sha-path-mode)
So why does this package exist if there is a more general solution –
pretty-symbols? pretty-symbols
has 2 disadvantages (IMHO):
- It is not possible to enable it globally.
- Decomposition does not occur after disabling the mode, i.e. the paths would stay “prettified”.
So if you are not going to disable it and use it globally, then
pretty-symbols-mode
will probably be a better call.
Note: There is also prettify-symbols-mode
which is a part of Emacs
24.4. It is great for prettifying symbols (like “lambda”) but it does
not support regexps.
For other analogous packages, see EmacsWiki: Pretty Symbol.