Add counsel function to easily open org files in org directory
This commit is contained in:
parent
02f5429c44
commit
0dab4eb051
1 changed files with 19 additions and 1 deletions
|
@ -1,11 +1,19 @@
|
|||
(package-initialize)
|
||||
(require 'package)
|
||||
(require 'cl)
|
||||
|
||||
;; Nope function
|
||||
(defun nope ()
|
||||
(interactive)
|
||||
(message "Nope!"))
|
||||
|
||||
;; Helper function
|
||||
(defun string-ends-with-p (string suffix)
|
||||
"Return t if STRING ends with SUFFIX."
|
||||
(and (string-match (rx-to-string `(: ,suffix eos) t)
|
||||
string)
|
||||
t))
|
||||
|
||||
;; Quote
|
||||
(setq initial-scratch-message
|
||||
(concat ";; Simplicity and elegance are unpopular because\n"
|
||||
|
@ -174,13 +182,23 @@
|
|||
(use-package heroku-theme
|
||||
:ensure t)
|
||||
|
||||
;; Open .org files in org directory
|
||||
(defun my/counsel-org-agenda ()
|
||||
"Open .org files in org directory"
|
||||
(interactive)
|
||||
(find-file (concat (file-name-as-directory org-directory)
|
||||
(ivy-read "Org files: "
|
||||
(remove-if-not
|
||||
(lambda (e) (string-ends-with-p e ".org"))
|
||||
(directory-files org-directory))))))
|
||||
|
||||
;; Org-mode
|
||||
(use-package org
|
||||
:ensure t
|
||||
:config
|
||||
(setq org-directory "~/org")
|
||||
(setq org-agenda-files "~/org/agenda")
|
||||
(global-set-key (kbd "<f12>") 'org-agenda)
|
||||
(global-set-key (kbd "<f12>") 'my/counsel-org-agenda)
|
||||
(setq org-todo-keywords '((sequence "TODO" "WORKING" "BLOCKED" "REVIEW" "|" "ABANDONED" "DONE")))
|
||||
(setq org-todo-keyword-faces
|
||||
'(("TODO" . "firebrick2")
|
||||
|
|
Loading…
Reference in a new issue