From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: [PATCH 3/4] emacs: Allow to choose 'find-file' function. Date: Mon, 31 Aug 2015 00:04:25 +0300 Message-ID: <1440968666-23605-4-git-send-email-alezost@gmail.com> References: <1440968666-23605-1-git-send-email-alezost@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9mf-0001Go-Ex for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZW9me-0003ym-Gv for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:01 -0400 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]:34521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9me-0003yF-8m for guix-devel@gnu.org; Sun, 30 Aug 2015 17:05:00 -0400 Received: by laba3 with SMTP id a3so59891514lab.1 for ; Sun, 30 Aug 2015 14:04:59 -0700 (PDT) Received: from localhost.localdomain ([217.107.192.146]) by smtp.gmail.com with ESMTPSA id f1sm3353473laf.15.2015.08.30.14.04.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Aug 2015 14:04:58 -0700 (PDT) In-Reply-To: <1440968666-23605-1-git-send-email-alezost@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * emacs/guix-utils.el (guix-find-file-function): New variable. (guix-find-file): Use it. --- emacs/guix-utils.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el index 78ea354..c1ce954 100644 --- a/emacs/guix-utils.el +++ b/emacs/guix-utils.el @@ -193,10 +193,19 @@ Return time value." (require 'org) (org-read-date nil t nil prompt)) +(defcustom guix-find-file-function #'find-file + "Function used to find a file. +The function is called by `guix-find-file' with a file name as a +single argument." + :type '(choice (function-item find-file) + (function-item org-open-file) + (function :tag "Other function")) + :group 'guix) + (defun guix-find-file (file) "Find FILE if it exists." (if (file-exists-p file) - (find-file file) + (funcall guix-find-file-function file) (message "File '%s' does not exist." file))) (defmacro guix-while-search (regexp &rest body) -- 2.4.3