Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the `counsel-org-clock-default-action' option #1

Merged
merged 1 commit into from
Apr 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 18 additions & 3 deletions counsel-org-clock.el
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ If there is no clocking task, display the clock history using
:caller 'counsel-org-clock-context
:require-match t
:preselect (car current)
:action (lambda (x) (org-goto-marker-or-bmk (cdr x)))))
:action counsel-org-clock-default-action))
(counsel-org-clock-history)))

;;;###autoload
Expand All @@ -88,7 +88,7 @@ If there is no clocking task, display the clock history using
:test (lambda (x y) (equal (cdr x) (cdr y))))
:caller 'counsel-org-clock-history
:require-match t
:action (lambda (x) (org-goto-marker-or-bmk (cdr x)))))
:action counsel-org-clock-default-action))

;;;; Functions to format candidates

Expand Down Expand Up @@ -168,8 +168,23 @@ If there is no clocking task, display the clock history using

;;;;; Define a set of actions

(defcustom counsel-org-clock-default-action
(lambda (x)
(org-goto-marker-or-bmk (cdr x)))
"Default action for commands in counsel-org-clock."
:group 'counsel-org-clock)

;; (defcustom counsel-org-clock-default-action
;; (lambda (x)
;; (save-excursion
;; (org-goto-marker-or-bmk (cdr x))
;; (org-clock-in)))
;; "Default action for commands in counsel-org-clock."
;; :group 'counsel-org-clock)

(defcustom counsel-org-clock-actions
`(("n" ,(counsel-org-clock--candidate-display-action
`(("g" (lambda (x) (org-goto-marker-or-bmk (cdr x))) "goto")
("n" ,(counsel-org-clock--candidate-display-action
(org-narrow-to-subtree)) "narrow")
("s" ,(counsel-org-clock--candidate-display-action
(org-tree-to-indirect-buffer)) "show in indirect buffer")
Expand Down