emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Michaël Cadilhac" <michael@cadilhac.name>
To: Leo Gaspard <orgmode@leo.gaspard.io>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-clock: Custom shortcuts for C-u C-c C-x C-i
Date: Thu, 14 Feb 2019 12:32:23 +0000	[thread overview]
Message-ID: <CADt3fpOvxTtnq-zLq8Hf4-zSFGrrzDO6-2yRF4JSp9TtLAM2vg@mail.gmail.com> (raw)
In-Reply-To: <87lg2jlgxt.fsf@llwynog.ekleog.org>

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

Hi Leo;

On Wed, 13 Feb 2019 at 17:46, Leo Gaspard <orgmode@leo.gaspard.io> wrote:
> Michaël Cadilhac <michael@cadilhac.name> writes:
> > This is not possible out of the box; can you say a bit more about how
> > you expect to indicate which tasks are to be always present?
>
> I would be thinking of something like defining a list of key -> link to
> a task (that may be generated with org-id's task ID, [[*foobar]] links
> or whatever) in my `init.el`.

Alright, can you give this patch a spin and see if that's what you want?

Cheers;
M.

[-- Attachment #2: default-tasks.patch --]
[-- Type: text/x-patch, Size: 1285 bytes --]

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 343264f7e..1f0870e62 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -164,6 +164,13 @@ which case all digits and capital letters are used up by the
   :group 'org-clock
   :type 'integer)
 
+(defcustom org-clock-default-tasks nil
+  "List of pairs (KEY . ID) ..."
+  :group 'org-clock
+  :type '(repeat (cons :tag "Key and ID"
+		       (character :tag "Access char")
+		       (string    :tag "Task ID"))))
+
 (defcustom org-clock-goto-may-find-recent-task t
   "Non-nil means `org-clock-goto' can go to recent task if no active clock."
   :group 'org-clock
@@ -622,6 +629,15 @@ there is no recent clock to choose from."
 		       (+ i (- ?A 10))) m))
 	    (if (fboundp 'int-to-char) (setf (car s) (int-to-char (car s))))
 	    (push s sel-list)))
+	(let (has-elt m)
+	  (dolist (charid org-clock-default-tasks)
+	    (setq m (org-id-find (cdr charid) 'marker))
+	    (when m
+	      (unless has-elt
+		(setq has-elt t)
+		(insert (org-add-props "Default Tasks\n" nil 'face 'bold)))
+	      (setq s (org-clock-insert-selection-line (car charid) m))
+	      (push s sel-list))))
 	(run-hooks 'org-clock-before-select-task-hook)
 	(goto-char (point-min))
 	;; Set min-height relatively to circumvent a possible but in

  reply	other threads:[~2019-02-14 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 16:29 org-clock: Custom shortcuts for C-u C-c C-x C-i Leo Gaspard
2019-02-13 13:23 ` Michaël Cadilhac
2019-02-13 17:46   ` Leo Gaspard
2019-02-14 12:32     ` Michaël Cadilhac [this message]
2019-08-30 17:38       ` Michaël Cadilhac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADt3fpOvxTtnq-zLq8Hf4-zSFGrrzDO6-2yRF4JSp9TtLAM2vg@mail.gmail.com \
    --to=michael@cadilhac.name \
    --cc=emacs-orgmode@gnu.org \
    --cc=orgmode@leo.gaspard.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).