From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SJBtKOi8bGBXVQAAgWs5BA (envelope-from ) for ; Tue, 06 Apr 2021 21:56:24 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id AHVZIui8bGA8TQAAB5/wlQ (envelope-from ) for ; Tue, 06 Apr 2021 19:56:24 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E14C2258A2 for ; Tue, 6 Apr 2021 21:56:23 +0200 (CEST) Received: from localhost ([::1]:42442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lTroD-0006z9-LA for larch@yhetil.org; Tue, 06 Apr 2021 15:56:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lTrnO-0006z2-IK for Emacs-orgmode@gnu.org; Tue, 06 Apr 2021 15:55:31 -0400 Received: from mail-yb1-xb2d.google.com ([2607:f8b0:4864:20::b2d]:43992) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lTrnL-0004VC-DF for Emacs-orgmode@gnu.org; Tue, 06 Apr 2021 15:55:29 -0400 Received: by mail-yb1-xb2d.google.com with SMTP id i143so9471931yba.10 for ; Tue, 06 Apr 2021 12:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=cp7CW1uwdx1/DPBYR5GTNnGY7oChSgIVTjl4X7tIseg=; b=BteqJ1vDoxJL4SBkmsBznkGui3YeRrENHMTPv2sUTqeM1XYNoddU3SPClhOS20bLmr tGiRGsZYhXzDkTY3kSHinrOz/1U2DB7nLfPOW5RFPlcOCrVfYxXm6YaGJmKcXzyy3oge MqjrHIUpJ2j4OXg1JNwABZRpWALpXvNIn7aASLxJdhvNYElPDuQ1stirtH9YbIPvFliT nNBMWXKcZQjdeDD53x2LnYE7835buxxHxd9KuHEm+WRiHQVjAu1rjVSqwqzyhCx3l8UO BavV3iQXK8gq9gpKa1Bakm6yEQzK+nBIZCT2JYLXMyoe3ETENXP0u7K5xm1Ec/9Z4t3+ VFwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=cp7CW1uwdx1/DPBYR5GTNnGY7oChSgIVTjl4X7tIseg=; b=mRiHaYSgcfvh0/V2EpUXenI+56aKf4izjvMMeyBCuUJLW1Rxgb+sJ5jYiwzR2vSBeW iECRWJ7rCR/yI+fqifPWHbgMYZFeGEdZzCNU922deMvKdMneiJh2Go1GvEXeb98fFjXT yo98zRM57m3pRa00mBojUFwM3jSplm9UWjSXzBLJusM9G4N/ravvW5d761tIhRgQajQo wrZN5Hsb7X6CI04a6L2i7cXEtMs702BVtoGjnX13hCQKk9vROnWGV65vKXF/lhgiESK6 1tVAshc7DPJ/AMVft3JKuSeBwxegaaxh13QvsVRmxnkckvBH4FyG6VHR57wSVZkOr5Ql qAxw== X-Gm-Message-State: AOAM530UaesyZetiHkPIjmicFieh47TQEQdPTgdlv05luAhepKimVaci LnF/rcOAuc4338NmGtFYlvi66PY5uKsdgUjKYR/dQHOgg5M= X-Google-Smtp-Source: ABdhPJxiCHfW5eqRnfsPfMIYwOeeL26P8HstA0pAD9R9VWM/oduCjRY2+OqjUi3v8ZH3Am2fZXEfL+UrvUEWEKlcukg= X-Received: by 2002:a25:4446:: with SMTP id r67mr11807333yba.54.1617738924811; Tue, 06 Apr 2021 12:55:24 -0700 (PDT) MIME-Version: 1.0 From: Jack Bauer Date: Tue, 6 Apr 2021 16:55:13 -0300 Message-ID: Subject: org-refile using the ID of the target To: Emacs-orgmode@gnu.org Content-Type: multipart/alternative; boundary="000000000000f3eaf705bf53313c" Received-SPF: pass client-ip=2607:f8b0:4864:20::b2d; envelope-from=jackb3793@gmail.com; helo=mail-yb1-xb2d.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1617738984; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=cp7CW1uwdx1/DPBYR5GTNnGY7oChSgIVTjl4X7tIseg=; b=iM9iEbjie7OKSUvgWdAI7VAJWY8c8kymK01nJ8/s/mxxR8RJjJ6bCDWEXUgHi5h0NOMooj gfxmzpATT6M2JitC3s1OOF1OFn4HytKyhuPjVOqUV7mQJ4pOnR9otciOFjg+RDcBLDbrQ0 SB00accbtAJTpO48eWrRh+Sclg+eaD4GhitJnX05rc8t0W4w01X/3hUyPx/RbpBnSVB9tz rg7ssdgHL/LtmueWcisvVl6PMJM6TeBZE451TOdiEGOp8d4g7o/o0DWHRWn9asZvu5mRG6 Lh2UX5H+guECd7dEMbmtCOlnP0c0coQWkOdDPgR9Dq0pUFTEGpRPGc8eIDL3Kw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617738984; a=rsa-sha256; cv=none; b=J6SP82ZqZsc8Wyy4zWsqtrxoEjDWF04MwClmBb9r4dRFx7Q7SYJDwzNfM4+P3wtbDxg1xd C8htcSn5v7+vFJuqM5YqCnJSHlyTot/shoM2WlbCqTNi/w66btUteB0jmj4fpZh46bBTDD SBl0gJ9/ElmSJFV47g6p50AFlx15GYHbgN19px+5Wq71cz2dvRw7YIAKj9Uy1VzgW/R4lZ fFfW2ggGQDjBp6TIwacQwu6XcMkMqosJvCqZDs7ucgzH5h3vKmfcJoVNtjVOCZfk9bVgb5 8dzeegkxFNek6V9a2lMs0OoyxIUzPpTeRpBvaUuof9g0tdiMPNhFMq1gCF7EKg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=BteqJ1vD; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=BteqJ1vD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: E14C2258A2 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: mzE+kyWkKpn1 --000000000000f3eaf705bf53313c Content-Type: text/plain; charset="UTF-8" I take a lot of notes using MobileOrg in my phone, and after syncing, they go into in.org (my gtd "in basket"). From there, I do the capturing process. Thing is, sometimes there's a *lot* of notes that I just want to refile to the "Notes" subtree from the corresponding project/context. A quick way to do that would be nice. My idea was to use the org-speed-commands-user to have a single key to press for each category of note. I'd add entries like ("Q" (my/org-refile-to-id "TODO") ("W" (my/org-refile-to-id "DONE") ("E" (my/org-refile-to-id "") At first, I tried using org-refile, but couldn't find a way to tell it to refile to a specific subtree (eg, using its id). Then I started hackstumbling around. So far, what I could come up with was: (defun my/org-refile-to-id (id &optional todo) "Refile current subtree to subtree with ID." (interactive (list (read-string "ID: "))) (when todo (org-todo todo)) (org-cut-subtree) (let ((anchor (ignore-errors (org-id-get-create)))) (org-id-goto id) (org-insert-heading-respect-content) (org-demote-subtree) (org-yank) (exchange-point-and-mark) (zap-to-char 1 (string-to-char " ")) (move-beginning-of-line nil) (if anchor (org-id-goto anchor) (message "This was the last one.")))) It feels kinda messy, though. Any advice would be more than welcome! --000000000000f3eaf705bf53313c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I take a lot of notes using MobileOrg in my phon= e, and after syncing, they go into=C2=A0in.= org=C2=A0(my gtd "in basket"). From there, I do the ca= pturing process.

Thing is, sometimes there's a *lot* of = notes that I just want to refile to the "Notes" subtree from the = corresponding project/context. A quick way to do that would be nice.

My idea was to use the=C2=A0org-speed-commands-user= =C2=A0to have a single key to press for each category of note. I'd add = entries like

("Q" (my/org-refile-to-id <I= D of Notes-subtree from project Q> "TODO")

("W" (my/org-refile-to-id <ID of Notes-subtree from = project W> "DONE")

("E" = (my/org-refile-to-id <ID of Notes-subtree from project E> ""= ;)

At first, I tried using=C2=A0org-refile, but couldn't find a way to tell it to refile to a specific subtree = (eg, using its id).

Then I started hackstumbling around. So = far, what I could come up with was:

(defun my/org-refile-to-id (id &optional todo)=
                                                                           =
                                                                     =20
  "Refile current subtree to subtree with ID."                   =
                                                                           =
                                                  =20
  (interactive                                                             =
                                                                           =
                                        =20
   (list (read-string "ID: ")))                                  =
                                                                           =
                                                  =20
  (when todo (org-todo todo))                                              =
                                                                           =
                                        =20
  (org-cut-subtree)                                                        =
                                                                           =
                                        =20
  (let ((anchor (ignore-errors (org-id-get-create))))                      =
                                                                           =
                                        =20
    (org-id-goto id)                                                       =
                                                                           =
                                        =20
    (org-insert-heading-respect-content)                                   =
                                                                           =
                                        =20
    (org-demote-subtree)                                                   =
                                                                           =
                                        =20
    (org-yank)                                                             =
                                                                           =
                                        =20
    (exchange-point-and-mark)                                              =
                                                                           =
                                        =20
    (zap-to-char 1 (string-to-char " "))                         =
                                                                           =
                                                  =20
    (move-beginning-of-line nil)                                           =
                                                                           =
                                        =20
    (if anchor                                                             =
                                                                           =
                                        =20
        (org-id-goto anchor)                                               =
                                                                           =
                                        =20
     (message "This was the last one."))))                       =
                                                                           =
                                                  =20

It feels kinda messy, though.

Any advi= ce would be more than welcome!

--000000000000f3eaf705bf53313c--