summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-08-22 16:02:44 -0700
committerFranck Cuny <franck.cuny@gmail.com>2016-08-22 16:02:44 -0700
commit3f30336a57dae29d0b3779463c512aa0898d7745 (patch)
treeff54bc1b8e534bde1a072c5a6c4a87d51ec4af5d
parent[make] update email for git config (diff)
downloademacs.d-3f30336a57dae29d0b3779463c512aa0898d7745.tar.gz
[emacs] Add a function to open a doc. page
Use ivy/read to list all the documentation page and open one with.

Closes #24.
-rw-r--r--emacs.d/init.el4
-rw-r--r--emacs.d/lib/my-functions.el11
2 files changed, 15 insertions, 0 deletions
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)