From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +Ie9Et65bWBxBAEAgWs5BA (envelope-from ) for ; Wed, 07 Apr 2021 15:55:42 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id OJtmDN65bWDbSQAAbx9fmQ (envelope-from ) for ; Wed, 07 Apr 2021 13:55:42 +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 8EB111535B for ; Wed, 7 Apr 2021 15:55:41 +0200 (CEST) Received: from localhost ([::1]:38364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lU8eh-0000Xo-Ge for larch@yhetil.org; Wed, 07 Apr 2021 09:55:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8bd-0005kX-Jg for Emacs-orgmode@gnu.org; Wed, 07 Apr 2021 09:52:29 -0400 Received: from mailer-211-152.hitrost.net ([91.185.211.152]:54633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lU8bW-0006iJ-8d for Emacs-orgmode@gnu.org; Wed, 07 Apr 2021 09:52:28 -0400 Received: from lk.84.20.234.47.dc.cable.static.lj-kabel.net ([84.20.234.47] helo=Tauriel) by b1.hitrost.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1lU8bM-004CUv-SD; Wed, 07 Apr 2021 15:52:13 +0200 References: User-agent: mu4e 0.9.19; emacs 25.3.2 From: Christian Moe To: Jack Bauer Subject: Re: org-refile using the ID of the target In-reply-to: Date: Wed, 07 Apr 2021 15:51:04 +0200 Message-ID: <87y2du2ofr.fsf@christianmoe.com> MIME-Version: 1.0 Content-Type: text/plain X-GeoIP: Country [IP], SI [84.20.234.47] X-Antivirus-Scanner: Clean mail though you should still use an Antivirus Received-SPF: pass client-ip=91.185.211.152; envelope-from=mail@christianmoe.com; helo=mailer-211-152.hitrost.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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=1617803741; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=iZOKp4NEgeVMTgHyv6S/nPpG9cTgJQnZmHETkeWQ6fs=; b=Ls3EokgBPWE5+6w0A+24PdqKbBe5mx8X4j/mjiKNix3NxDq2TZNyxqWAW4v+dFZEQ2XE9Q hi0HMhN24uR9mMleEPTRVKz5D96EGkUGRk8Z6XMz58S56OIjtYBW+opEBey7ITTb5h8n72 oVyFITS3TRO+hI2ZzSZz97VPJY0ZsW0yMQo8we7typX2NAukNWCgfdXYRPz01ZilXVO9A7 P9p2A0+4wjsvKDaFyL24ZrBj7w/ZJpGeiWAcM1WwzTvhfbFIVf05xqeU6R+4eW6V9wsML+ jxf7Dj6lT2ij2wPEBiR1cDICGaKm+C2E0mk4sysB961kCXOtFg0pEXF5Ym8RRA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1617803741; a=rsa-sha256; cv=none; b=eLOdNiJdZ97c9De+B3Zp6BFbPnIkc5co/FPJy/e4u8CwCIGmohXeSS33F8TvYFXjPteWJE 5/TnoW6c8GbFLuo9+15Ktbpw3a4wVqKtk4Yxj/fivpFBjVoYDNmuvtQeWgHAf62eXkLgUL Azp0iNzCf8+2f+06rvfjnD4dRcyG6tYzTCDcrgQ5tTLLrBtoidd+qcOZzHXFuxWFUMKB+0 X7ztx/4efDwA5pyoNwNxE5IV765Ry+NIh3Ru23TUxJKcvlKd4NWGwwlf/wXnZCOabwPUqM ICZ5JGzbhLkA8xigm9wbV9I8dJmROCL245QEsF1YCkaxcIs52wHfrH9N9Aw1mA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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: -2.44 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: 8EB111535B X-Spam-Score: -2.44 X-Migadu-Scanner: scn0.migadu.com X-TUID: TnaT7ozwnDsb 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 file (nil . (:level . 1)))) ;; and all top headings current buffer (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, 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!