From d5f8c3b5d49cb5f95f8db903ae9ce718a542fc21 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 10 Jul 2017 14:10:45 +0200 Subject: Emacs: Add nix generation info to title if built via nix --- emacs/.emacs.d/init.org | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'emacs') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 99d5899..59bf5d4 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -293,7 +293,25 @@ correct, at least for Liberation Mono. (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 -- cgit 1.4.1