From e718f6cc8fcfaddc730423b7fe4acbd4b85101f8 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Mon, 10 Nov 2014 15:29:04 +0300 Subject: [PATCH] emacs: Add 'guix-find-file'. * emacs/guix-utils.el (guix-find-file): New procedure. * emacs/guix-info.el (guix-file): Use it. --- emacs/guix-info.el | 2 +- emacs/guix-utils.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/emacs/guix-info.el b/emacs/guix-info.el index edb44506ea..70ae39c970 100644 --- a/emacs/guix-info.el +++ b/emacs/guix-info.el @@ -334,7 +334,7 @@ VAL is a list, call the function on each element of this list." 'face 'guix-info-file-path 'help-echo "Find file" 'action (lambda (btn) - (find-file (button-label btn)))) + (guix-find-file (button-label btn)))) (define-button-type 'guix-url :supertype 'guix diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el index 77ccb67532..823c646610 100644 --- a/emacs/guix-utils.el +++ b/emacs/guix-utils.el @@ -154,6 +154,12 @@ accessed with KEYS." (dolist (key keys val) (setq val (cdr (assq key val)))))) +(defun guix-find-file (file) + "Find FILE if it exists." + (if (file-exists-p file) + (find-file file) + (message "File '%s' does not exist." file))) + ;;; Diff