From 3f30336a57dae29d0b3779463c512aa0898d7745 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 22 Aug 2016 16:02:44 -0700 Subject: [emacs] Add a function to open a doc. page Use ivy/read to list all the documentation page and open one with. Closes #24. --- emacs.d/init.el | 4 ++++ emacs.d/lib/my-functions.el | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/emacs.d/init.el b/emacs.d/init.el index a154a7e..7661aa0 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -24,6 +24,10 @@ (use-package my-settings) +(use-package my-functions + :config + (setq fc/wiki-dir-location "~/src/notes/docs/")) + ;; other packages (use-package ag) diff --git a/emacs.d/lib/my-functions.el b/emacs.d/lib/my-functions.el index e661a01..0bdc6d7 100644 --- a/emacs.d/lib/my-functions.el +++ b/emacs.d/lib/my-functions.el @@ -33,6 +33,17 @@ (set-buffer-modified-p nil) (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name)))))))) +;; find a wiki page +(defun fc/find-wiki-page () + "Finds wiki page." + (interactive) + (let ((collection + (delete-dups + (append (directory-files fc/wiki-dir-location))))) + (ivy-read "wiki pages:" collection + :action (lambda (x) (find-file (concat fc/wiki-dir-location x))) + :caller 'fc/find-wiki-page))) +(global-set-key (kbd "C-c w") 'fc/find-wiki-page) (provide 'my-functions) -- cgit 1.4.1