cp-org-agenda: Add
This commit is contained in:
parent
7751773cb2
commit
390fe57b04
2 changed files with 33 additions and 5 deletions
10
README.md
10
README.md
|
|
@ -20,6 +20,7 @@
|
||||||
- [The `counsel-projectile-ag` command](#the-counsel-projectile-ag-command)
|
- [The `counsel-projectile-ag` command](#the-counsel-projectile-ag-command)
|
||||||
- [The `counsel-projectile-rg` command](#the-counsel-projectile-rg-command)
|
- [The `counsel-projectile-rg` command](#the-counsel-projectile-rg-command)
|
||||||
- [The `counsel-projectile-org-capture` command](#the-counsel-projectile-org-capture-command)
|
- [The `counsel-projectile-org-capture` command](#the-counsel-projectile-org-capture-command)
|
||||||
|
- [The `counsel-projectile-org-agenda` command](#the-counsel-projectile-org-agenda-command)
|
||||||
- [Configuration](#configuration)
|
- [Configuration](#configuration)
|
||||||
- [Enabling counsel-projectile mode when emacs starts](#enabling-counsel-projectile-mode-when-emacs-starts)
|
- [Enabling counsel-projectile mode when emacs starts](#enabling-counsel-projectile-mode-when-emacs-starts)
|
||||||
- [Customizing action lists](#customizing-action-lists)
|
- [Customizing action lists](#customizing-action-lists)
|
||||||
|
|
@ -71,7 +72,8 @@ New commands:
|
||||||
| :------------------- | :------------------------------- | :-------------------------------------------------- |
|
| :------------------- | :------------------------------- | :-------------------------------------------------- |
|
||||||
| <kbd>C-c p SPC</kbd> | `counsel-projectile` | Jump to a project buffer or file, or switch project |
|
| <kbd>C-c p SPC</kbd> | `counsel-projectile` | Jump to a project buffer or file, or switch project |
|
||||||
| <kbd>C-c p s r</kbd> | `counsel-projectile-rg` | Search project with rg |
|
| <kbd>C-c p s r</kbd> | `counsel-projectile-rg` | Search project with rg |
|
||||||
| <kbd>C-c p O</kbd> | `counsel-projectile-org-capture` | Org-capture into project |
|
| <kbd>C-c p O c</kbd> | `counsel-projectile-org-capture` | Org-capture into project |
|
||||||
|
| <kbd>C-c p O a</kbd> | `counsel-projectile-org-capture` | Open project agenda |
|
||||||
## The `counsel-projectile` command
|
## The `counsel-projectile` command
|
||||||
Default key binding: <kbd>C-c p SPC</kbd>.
|
Default key binding: <kbd>C-c p SPC</kbd>.
|
||||||
|
|
||||||
|
|
@ -169,9 +171,13 @@ Default key binding: <kbd>C-c p s r</kbd>.
|
||||||
|
|
||||||
This command is similar to `counsel-projectile-grep` (see above) but uses `rg` (ripgrep) instead of `grep`.
|
This command is similar to `counsel-projectile-grep` (see above) but uses `rg` (ripgrep) instead of `grep`.
|
||||||
## The `counsel-projectile-org-capture` command
|
## The `counsel-projectile-org-capture` command
|
||||||
Default key binding: <kbd>C-c p O</kbd>.
|
Default key binding: <kbd>C-c p O c</kbd>.
|
||||||
|
|
||||||
This command lets you capture something (a note, todo item, ...) into the current project using org-mode's `org-capture` (actually `counsel-org-capture`) command. Like `org-capture`, it first lets you select a capture template then file the newly captured information. By default, there is a single template storing the captured information into file `notes.org` in the project root directory, under headline `Tasks`.
|
This command lets you capture something (a note, todo item, ...) into the current project using org-mode's `org-capture` (actually `counsel-org-capture`) command. Like `org-capture`, it first lets you select a capture template then file the newly captured information. By default, there is a single template storing the captured information into file `notes.org` in the project root directory, under headline `Tasks`.
|
||||||
|
## The `counsel-projectile-org-agenda` command
|
||||||
|
Default key binding: <kbd>C-c p O a</kbd>.
|
||||||
|
|
||||||
|
This command opens the current projects agenda. It simply calls `org-agenda` after filtering out all agenda files that do not belong to the current project.
|
||||||
# Configuration
|
# Configuration
|
||||||
## Enabling counsel-projectile mode when emacs starts
|
## Enabling counsel-projectile mode when emacs starts
|
||||||
To automatically enable counsel-projectile mode when emacs starts, you can either use the Customize interface to toggle on the variable `counsel-projectile-mode` and save your customization, or add `(counsel-projectile-mode)` to your init file.
|
To automatically enable counsel-projectile mode when emacs starts, you can either use the Customize interface to toggle on the variable `counsel-projectile-mode` and save your customization, or add `(counsel-projectile-mode)` to your init file.
|
||||||
|
|
|
||||||
|
|
@ -945,6 +945,25 @@ capture."
|
||||||
(with-current-buffer (or from-buffer (current-buffer))
|
(with-current-buffer (or from-buffer (current-buffer))
|
||||||
(counsel-org-capture))))
|
(counsel-org-capture))))
|
||||||
|
|
||||||
|
;;;; counsel-projectile-org-agenda
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun counsel-projectile-org-agenda (&optional arg org-keys restriction)
|
||||||
|
"Open project agenda.
|
||||||
|
|
||||||
|
This command simply calls `org-agenda' after filtering out all
|
||||||
|
agenda files that do not belong to the current project.
|
||||||
|
|
||||||
|
Optional arguments ARG, ORG-KEYS, and RESTRICTION are as in
|
||||||
|
`org-agenda'."
|
||||||
|
(interactive "P")
|
||||||
|
(let* ((root (projectile-project-root))
|
||||||
|
(org-agenda-files
|
||||||
|
(cl-remove-if-not (lambda (file)
|
||||||
|
(string-prefix-p root file))
|
||||||
|
(org-agenda-files t 'ifmode))))
|
||||||
|
(org-agenda arg org-keys restriction)))
|
||||||
|
|
||||||
;;;; counsel-projectile-switch-project
|
;;;; counsel-projectile-switch-project
|
||||||
|
|
||||||
(defcustom counsel-projectile-sort-projects nil
|
(defcustom counsel-projectile-sort-projects nil
|
||||||
|
|
@ -1002,8 +1021,10 @@ candidates list of `counsel-projectile-switch-project'."
|
||||||
"invoke eshell from project root")
|
"invoke eshell from project root")
|
||||||
("xt" counsel-projectile-switch-project-action-run-term
|
("xt" counsel-projectile-switch-project-action-run-term
|
||||||
"invoke term from project root")
|
"invoke term from project root")
|
||||||
("O" counsel-projectile-switch-project-action-org-capture
|
("Oc" counsel-projectile-switch-project-action-org-capture
|
||||||
"org-capture into project"))
|
"capture into project")
|
||||||
|
("Oa" counsel-projectile-switch-project-action-org-capture
|
||||||
|
"open project agenda"))
|
||||||
'counsel-projectile)
|
'counsel-projectile)
|
||||||
|
|
||||||
(defun counsel-projectile-switch-project-by-name (project)
|
(defun counsel-projectile-switch-project-by-name (project)
|
||||||
|
|
@ -1318,7 +1339,8 @@ If not inside a project, call `counsel-projectile-switch-project'."
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
(set-keymap-parent map projectile-command-map)
|
(set-keymap-parent map projectile-command-map)
|
||||||
(define-key map (kbd "s r") 'counsel-projectile-rg)
|
(define-key map (kbd "s r") 'counsel-projectile-rg)
|
||||||
(define-key map (kbd "O") 'counsel-projectile-org-capture)
|
(define-key map (kbd "O c") 'counsel-projectile-org-capture)
|
||||||
|
(define-key map (kbd "O a") 'counsel-projectile-org-agenda)
|
||||||
(define-key map (kbd "SPC") 'counsel-projectile)
|
(define-key map (kbd "SPC") 'counsel-projectile)
|
||||||
map)
|
map)
|
||||||
"Keymap for Counesl-Projectile commands after `projectile-keymap-prefix'.")
|
"Keymap for Counesl-Projectile commands after `projectile-keymap-prefix'.")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue