summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-30 18:51:09 +0300
committerAlex Kost <alezost@gmail.com>2015-09-01 13:03:51 +0300
commit32c0b6d78ce815350acf2f6879579d5b628c437f (patch)
treee077218dd022e7f968a9726647fa5596f9bbb3cb
parent70fabd498c275d0d5cb43f2c13f8293b878c8e4e (diff)
downloadpatches-32c0b6d78ce815350acf2f6879579d5b628c437f.tar
patches-32c0b6d78ce815350acf2f6879579d5b628c437f.tar.gz
emacs: Allow users to choose a 'find-file' function.
* emacs/guix-utils.el (guix-find-file-function): New variable. (guix-find-file): Use it.
-rw-r--r--emacs/guix-utils.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 78ea3545c6..c1ce954f8f 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)