Emacs: Add nix generation info to title if built via nix
Alan Pearce alan@alanpearce.eu
Mon, 10 Jul 2017 14:10:45 +0200
1 files changed, 19 insertions(+), 1 deletions(-)
jump to
M emacs/.emacs.d/init.org → emacs/.emacs.d/init.org
@@ -293,7 +293,25 @@ (column-number-mode -1) (line-number-mode -1) (size-indication-mode t) -(setq frame-title-format '("%f" (dired-directory dired-directory))) + +(require 'f) +(if (f-ancestor-of? "/nix/store" invocation-directory) + (setq frame-title-format (list "Emacs (Nix Generation " + (cadr + (split-string (f-base + (car + (last (split-string + (s-chomp (shell-command-to-string (concat "nix-store -q --roots " invocation-directory))) + "\n")))) + "-")) + " " + (s-left 6 (nth 3 (f-split invocation-directory))) + "..." + (s-right 6 (car (split-string (nth 3 (f-split invocation-directory)) "-"))) + ")" + " — %f" + '(dired-directory dired-directory))) + (setq frame-title-format '("Emacs — %f" (dired-directory dired-directory)))) #+END_SRC ** Chrome