emacs: Add 'guix-find-file'.

* emacs/guix-utils.el (guix-find-file): New procedure.
* emacs/guix-info.el (guix-file): Use it.
This commit is contained in:
Alex Kost 2014-11-10 15:29:04 +03:00
parent 7be25d4af0
commit e718f6cc8f
2 changed files with 7 additions and 1 deletions

View File

@ -334,7 +334,7 @@ VAL is a list, call the function on each element of this list."
'face 'guix-info-file-path 'face 'guix-info-file-path
'help-echo "Find file" 'help-echo "Find file"
'action (lambda (btn) 'action (lambda (btn)
(find-file (button-label btn)))) (guix-find-file (button-label btn))))
(define-button-type 'guix-url (define-button-type 'guix-url
:supertype 'guix :supertype 'guix

View File

@ -154,6 +154,12 @@ accessed with KEYS."
(dolist (key keys val) (dolist (key keys val)
(setq val (cdr (assq key 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 ;;; Diff