From 8fa7dc78022b954d0ad8488c30d12bf7ffdd7267 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 12 Apr 2016 15:39:10 -0400 Subject: [PATCH] Improve narf|update-scratch-buffer-cwd --- core/core-defuns.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/core-defuns.el b/core/core-defuns.el index 8f97f379b..6a67b7144 100644 --- a/core/core-defuns.el +++ b/core/core-defuns.el @@ -205,11 +205,12 @@ Examples: (defun narf|enable-hard-wrap () (turn-on-auto-fill)) -(defun narf|update-scratch-buffer-cwd () ; see core-editor.el +(defun narf|update-scratch-buffer-cwd (&optional dir) ; see core-editor.el "Make sure scratch buffer is always 'in a project.'" - (let ((dir (narf/project-root))) + (let ((dir (or dir (narf/project-root)))) (with-current-buffer (get-buffer-create "*scratch*") - (cd dir)))) + (setq default-directory dir) + (setq header-line-format (concat " ∴ " dir))))) ;;;; Global Defuns ;;;;;;;;;;;;;;;;;;;;;