emacs: Allow users to choose a 'find-file' function.

* emacs/guix-utils.el (guix-find-file-function): New variable.
  (guix-find-file): Use it.
This commit is contained in:
Alex Kost 2015-08-30 18:51:09 +03:00
parent 70fabd498c
commit 32c0b6d78c
1 changed files with 10 additions and 1 deletions

View File

@ -193,10 +193,19 @@ Return time value."
(require 'org) (require 'org)
(org-read-date nil t nil prompt)) (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) (defun guix-find-file (file)
"Find FILE if it exists." "Find FILE if it exists."
(if (file-exists-p file) (if (file-exists-p file)
(find-file file) (funcall guix-find-file-function file)
(message "File '%s' does not exist." file))) (message "File '%s' does not exist." file)))
(defmacro guix-while-search (regexp &rest body) (defmacro guix-while-search (regexp &rest body)