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)
|
(package-initialize)
|
||||||
(require 'package)
|
(require 'package)
|
||||||
|
(require 'cl)
|
||||||
|
|
||||||
;; Nope function
|
;; Nope function
|
||||||
(defun nope ()
|
(defun nope ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(message "Nope!"))
|
(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
|
;; Quote
|
||||||
(setq initial-scratch-message
|
(setq initial-scratch-message
|
||||||
(concat ";; Simplicity and elegance are unpopular because\n"
|
(concat ";; Simplicity and elegance are unpopular because\n"
|
||||||
|
@ -174,13 +182,23 @@
|
||||||
(use-package heroku-theme
|
(use-package heroku-theme
|
||||||
:ensure t)
|
: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
|
;; Org-mode
|
||||||
(use-package org
|
(use-package org
|
||||||
:ensure t
|
:ensure t
|
||||||
:config
|
:config
|
||||||
(setq org-directory "~/org")
|
(setq org-directory "~/org")
|
||||||
(setq org-agenda-files "~/org/agenda")
|
(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-keywords '((sequence "TODO" "WORKING" "BLOCKED" "REVIEW" "|" "ABANDONED" "DONE")))
|
||||||
(setq org-todo-keyword-faces
|
(setq org-todo-keyword-faces
|
||||||
'(("TODO" . "firebrick2")
|
'(("TODO" . "firebrick2")
|
||||||
|
|
Loading…
Reference in a new issue