From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QGZyLf/EbWBoIQEAgWs5BA (envelope-from ) for ; Wed, 07 Apr 2021 16:43:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id eLNXJ//EbWDuaAAAbx9fmQ (envelope-from ) for ; Wed, 07 Apr 2021 14:43:11 +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 E487D1FB15 for ; Wed, 7 Apr 2021 16:43:10 +0200 (CEST) Received: from localhost ([::1]:47908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU9Of-0000DE-HU for larch@yhetil.org; Wed, 07 Apr 2021 10:43:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU9Nm-0000B3-FM for Emacs-orgmode@gnu.org; Wed, 07 Apr 2021 10:42:14 -0400 Received: from mail-qv1-xf2a.google.com ([2607:f8b0:4864:20::f2a]:41485) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lU9Nk-0002OB-FR for Emacs-orgmode@gnu.org; Wed, 07 Apr 2021 10:42:14 -0400 Received: by mail-qv1-xf2a.google.com with SMTP id u3so6951516qvj.8 for ; Wed, 07 Apr 2021 07:42:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=/W7tZr+EjLxXbF/VriooS2M1DGqA++QMVKzbNhQFTE0=; b=Kn6I5OyWPEgSJUC1QSmrq00j/PXPEhmFmq2J+wH9TABbsav6EcQkxaZOa7G6v//yyX 0Ix8NRDn2lqk9X4OI/ohOBaHxWcxCdYA4Q+P8IjsfhjYeIeXyCcwGsnkw9hAfua9sePU 6FqvmOm7g5Ad8kOgalP8AF6wAyyiYtthanuP/qLVjsg+2mVHKBOWtXn+2o6hsrapoG0u kf1wTRRZlHwCS+3+ENdV6ofabPd1g5SHYfpzq1y/kb7lWXys4HPccrl4+7vXQlao4jfN pvAmxAs+e3i9DzNarvc7WYBgQIJDkQQzuNS5o6K5I2UFS3WSbgCbn6YY3/q+oa6w9hFe hxNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=/W7tZr+EjLxXbF/VriooS2M1DGqA++QMVKzbNhQFTE0=; b=sYEfBumNsrgb4quLN7o+jtqfB0e3i4EL3PxMPfUiFL13V0n35+RGN3hQWiJhPy0Maz AtSYk4/RRNphk0IDP0mZQB/HNYX7hwb4dSFcfpj++8h8EeJuTZZvIz2MeUIlZ0jZXLZ7 GzgjAc06C2SoBMREiQ7IvmVmJdCPYLWASoLe7cK30Jv3BcmDoasWvxqzsMj+hp7sXZEW ErdwtlF4gBUUuVl4kY6yl47wQ8B5MCjQ1wIDrv4hXkctA7viYp7f7LIHAKa0kPE/Ma6v bhtTq6Lf+esZk8MzfeUUC4b0WLzHfc+o6QIsDrqwrridhF0kDtAtdz6kBG7NesHNtlBH xrlQ== X-Gm-Message-State: AOAM533c3A6FHDUaQ0hcHdPtzd+X2wnHsWyUc/xhuH0R30zTNYjqRdFN 9Klo79FCedADnoLtR8qurEjS0ZF8/Bo= X-Google-Smtp-Source: ABdhPJyC7GVbjAJhJB8QB+8vas2sXf/5oj5DlhXQNtosPJkbVsD8bVcJdCsbECxf/RF0SPhWsLg2Nw== X-Received: by 2002:a0c:aa45:: with SMTP id e5mr3693028qvb.44.1617806531092; Wed, 07 Apr 2021 07:42:11 -0700 (PDT) Received: from bach (189-113-67-139.static.sumicity.net.br. [189.113.67.139]) by smtp.gmail.com with ESMTPSA id d10sm18346232qko.70.2021.04.07.07.42.10 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Apr 2021 07:42:10 -0700 (PDT) From: Eglur To: Christian Moe Subject: Re: org-refile using the ID of the target References: <87y2du2ofr.fsf@christianmoe.com> Date: Wed, 07 Apr 2021 11:42:08 -0300 In-Reply-To: <87y2du2ofr.fsf@christianmoe.com> (Christian Moe's message of "Wed, 07 Apr 2021 15:51:04 +0200") Message-ID: <877dlexikf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::f2a; envelope-from=jackb3793@gmail.com; helo=mail-qv1-xf2a.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, 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: , Cc: Emacs-orgmode@gnu.org 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=1617806591; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=/W7tZr+EjLxXbF/VriooS2M1DGqA++QMVKzbNhQFTE0=; b=IWba4yvjtpjtjyIjyLhdZPJ0w4z6XJaJ6sikYe/6RJjGpbli23VAsVWcE8NjduHuIXHt8J 6sVj50Wkz8OBoDLe0bj8cfLSMHVMqgxc7jPfwVF0GsmXXWkkmzNSgLsBRBhdeXFZkudMEI 7YjW8+XeAruyNDopiPnR4v3BnVsP/VUOCa+5jeuwMTaDSyKBRHzzCQJ2z0/3JzkCtG+zNS rn4BajOzwvgiu89pvNu2F8pBg1CK759eX5ZalNn0QL87r/mY2qCMg4lMIDKt1+Z8F4rx8J Jfz2ZryW6aoI91a+hTc/YTnTDm/y9FLvonVj1Hc7ATS65VcH2hE5oPEELDcRhA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617806591; a=rsa-sha256; cv=none; b=ovGOVxyXx/jj6X36gfuvkVeZ6bOUsExKakUfR3MReY3NFAZodA7hCkUSMIOSRLF9ztoJkm 3TyXahTiX4PU0eLx511ER5ZamE8S19u1iTlrLlTZHhMbcUXjJWf2r6WKGsAC32+xGBjmsi FV9fpxlZzKHI8xYv3ksba430y3Pr37h4EVaU+Btl/mVGegwQMMiB2xO7KQlRGHhgY+3gTZ nzFOmjTtEUCLplkEIJidH3hfMxM2tITJ2mpfsU4d0zfwc3MJwQ0VhlZKU6k2bt0vEf7HoV 0JP1lDzfzBY1LYYf46GUew5FJdN30ig58Za44Afl9zqd8UPjiwCnkuaEGKkrmQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=Kn6I5OyW; 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-Spam-Score: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=Kn6I5OyW; 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: E487D1FB15 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: 7bKjAvOH2kZI Hello, Christian. Thanks for the tip! It is indeed a very good solution. For now, I=E2=80=99m improvising the one-key approach with this ~/.emacs.d/init.el: (setq org-speed-commands-user '(("j" my/org-quick-refile))) (defun my/org-quick-refile () "Refile subtree using list of predefined targets." (interactive) (let ((choice (car (read-multiple-choice "Refile where?" '((?j "Journal") (?a "Project 1 Notes") (?s "Project 2 Notes")))))) (let ((id (cond ((=3D ?a choice) "eb952006-71f4-4fc3-93d0-9f0cb61aed5b") ((=3D ?s choice) "3e444863-a617-414d-97bf-31fdd888b4dc") ((=3D ?j choice) "journal")))) (if id (if (string=3D id "journal") (my/org-journal-pre-resolve-with-header) (my/org-refile-to-id id "")))))) (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.")))) P.S.: Please ignore the =E2=80=98my/org-journal-pre-resolve-with-header=E2= =80=99---it=E2=80=99s a /very/ ugly newbie hack that I commited what I would like to believe ages ago. Christian Moe writes: > My approach is to tag the equivalent of your "Notes" subtree of the > various projects in my agenda files with an :INBOX: tag. > > The following code in .emacs then makes sure they are presented as > refile targets: > > ;; Refile > (setq org-refile-targets > '((org-agenda-files . (:tag . "INBOX")) ;; Inbox subtree in each fi= le > (nil . (:level . 1)))) ;; and all top headings current bu= ffer > (setq org-refile-use-outline-path t) > > It may not be quite as fast as what you have in mind, but it is perhaps > more flexible, and saves having to define or remember those keys. > > If you already consistently use "Notes" as the heading for this purpose, > you might not even need to tag them; you could try simply replacing > (:tag . "INBOX") above with (:regexp . "Notes"). > (This might cast too wide a net, though.) See the documentation for > org-refile targets. > > Yours, > Christian > > Jack Bauer writes: > >> I take a lot of notes using MobileOrg in my phone, and after syncing, th= ey 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 p= ress 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 t= o refile to a specific subtree (eg, using its id). >> >> Then I started hackstumbling around. So far, what I could come up with w= as: >> >> (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!