From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id kAbuFthMrGIhIAEAbAwnHQ (envelope-from ) for ; Fri, 17 Jun 2022 11:43:52 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id UBdpFthMrGJllgAAauVa8A (envelope-from ) for ; Fri, 17 Jun 2022 11:43:52 +0200 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 06009DB96 for ; Fri, 17 Jun 2022 11:43:52 +0200 (CEST) Received: from localhost ([::1]:54062 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o28W7-0003hO-59 for larch@yhetil.org; Fri, 17 Jun 2022 05:43:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o28VU-0003fL-Tu for emacs-orgmode@gnu.org; Fri, 17 Jun 2022 05:43:12 -0400 Received: from mail-ua1-x92e.google.com ([2607:f8b0:4864:20::92e]:37588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o28VP-0005na-OJ for emacs-orgmode@gnu.org; Fri, 17 Jun 2022 05:43:12 -0400 Received: by mail-ua1-x92e.google.com with SMTP id l9so1355416uac.4 for ; Fri, 17 Jun 2022 02:43:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=93GRJIyyy4Rbex0/gGkWgEZpbfhiNNWvQM/vbllo74o=; b=kdcUb+zjh1LoFlzuxo9S01+ZTMQ0MudHYp/NnV20+8jylESuPJ/38f0dJTwq7ThzDT Cx2oAGu6cgjsREWaaDyW1Ldz+5q5po1UjRVSuEehKCJJAJh97q8ziyfBkdgfcoYJBlBi NuWUOl5QfDg+hm+JFCH12nwrmc4Ayv01QQ7+yK7syTZK4BDtvq9tuHh9MjosdUpu0Wgy ItzJjIM4ktN/9E5JEKJe9yNf3ijJ83QMaLFdQFPgGpUdMK5drbmI3iicosAuAzX0srZb EWubEErZvm8QBOEElq1gdle9EXXHnm3W6/qBbBQqqnHLcykh2/QC+l6lXzECaZoGwfUl x01g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=93GRJIyyy4Rbex0/gGkWgEZpbfhiNNWvQM/vbllo74o=; b=1Sc8ZLSUvyrfAL70R4u390NuKaFEeII6bSQo9GejMULe5y9LNjzsudPGjFYO2XjSPW ++wvtsw4OMsYTVQ+U08AZSr4ITKpQfXHEKdsshaza9OoD9x+7kj8v2aNmR4hhYMWhqIO 1n7FMRBxQm8ND5x+SOnOaWXQ0Tkgw9Gvst87m4rpu+SnQReRLPGDT9MxFy1/edNhuLTI ezQVANiwA6ePMWtN8g5Be6TjRNc3F/ufIHpZFzkt5WWApcuEqSRctKpVPXjg3adqOJzs IkQ8ayQ+O5jzkQkci4AEoJVJ5k6bGAzCAgAdT2RJ+GnKgZMUltylvY4Ch/21/FgGohAv ngUA== X-Gm-Message-State: AJIora9UC5LJDINqXVCb4UN3wnU89gkLF8pwypfZxNaAolsSzMHHVphz 3Xi9i4qTz31JG7xWjInarbNLidAyChoOKXrywfvKJU3CbK0= X-Google-Smtp-Source: AGRyM1sc6oOlLmjDUy7+oCWWYpOWKNfP8INE3EpY07CvStzPZlZPKMEi5WOADjEGcE8tK9M37OK5cQPQeCv1dKx3Jic= X-Received: by 2002:ab0:6cfa:0:b0:37f:296:266d with SMTP id l26-20020ab06cfa000000b0037f0296266dmr221522uai.28.1655458985960; Fri, 17 Jun 2022 02:43:05 -0700 (PDT) MIME-Version: 1.0 From: Haakon HR Date: Fri, 17 Jun 2022 11:42:55 +0200 Message-ID: Subject: Agenda view sorting based on custom property To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::92e; envelope-from=haakonhr@gmail.com; helo=mail-ua1-x92e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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 X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1655459032; 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=93GRJIyyy4Rbex0/gGkWgEZpbfhiNNWvQM/vbllo74o=; b=R9WyZVbP+EHZI7HRL+t4QrEqzsbOHsoLIihXct37TrA6puN+dEtlaeYn4oRfyMh8LkV/yV auNTnU0sO8R9gmnTardUhzK9ZUekZjZax/Vf80vpJEPAvdwwZcRAdBawf5n88cDuDilasb YAqL/z/+Gd3jB9T7ZOi9nk6oKmlxmb6MfEflD8kadAM8oXQQDlUOYRbPSipXkPGcH+rVdP 0WZc2t41tkn///MJsqiGPIloh8O8aEVUUext/w41UbJX6qsY9pzJeORra2cQHRbYgpVwJU JBF+vhoV1aFl0KRJOqq1I6kNOFeYrk+0/sjeAU4yNnWH2ua4g6VgNreEbAClpQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1655459032; a=rsa-sha256; cv=none; b=pkwKhAXhIuMZPhibf4MzmRez/3UnOtIc2QdoyoUqdMagzbRS0Okt7DuAxc7Gv4mXJefBzy XQ5e/Q9S5MP9FK6XYUkMuBGXgDkRmmTGmA5DmwN1gTCLVE1ItV1Zvt6XjmMhANq1QTOrA+ 6CipzNRrV3rPkFTDSJ0MerlkP1Xt/K3i/sjoURBdtJvYrRMFUN6yjUM2JZZ8OwuxjjtWBh 1sXTZ/RRwCZRLuU2go2uPDdIroCpmIHlDyiO5m6vcY3FLoMspPxrBhlZJM0JbSbcr5WHvu gie5HxW0xDvhWDJ4v6E493OYH1qch8qOAnvIKdUKNDVeQvKk4LGr7hEik3qMWQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=kdcUb+zj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -5.49 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=kdcUb+zj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 06009DB96 X-Spam-Score: -5.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: bunLTgDVm7u9 Hi all, I'm trying to hack together a custom agenda view where I want to sort the entries by a custom property, let's call it :CUSTOM:. So the entries in question would look like this: * TODO Buy cheese :PROPERTIES :CUSTOM: 2 :END: I have tried a few approaches but I'm a bit stuck. My first approach was to use the variable `org-agenda-cmp-user-defined' and implement a comparison function based on the already existing ones like `org-cmp-alpha' or `org-cmp-effort'. However, I'm not able to extract the custom property from the kind of entry that is passed into the comparison function, which seem to rely on `text-properties'. Is it possible to somehow make custom properties available as a text property, similar to things like 'todo-state, 'tags and so on? My second approach was to try to use the org parsing capabilities. I can get the AST by parsing the buffers of interest containing entries I want to sort. I'm for example able to get the list of :CUSTOM: with this snippet: `(org-element-map (org-element-parse-buffer) '(headline) (lambda (hl) (org-element-property :RELEVANCE hl)))' Then I imagine I can manipulate the AST into the order I want and then use `org-element-interpret-data' to create a new buffer w/ the desired sorting. However, I haven't found a way to actually create a buffer containing all the information from the interpreted AST as some information seem to get lost. The end goal in this case is also an agenda view where I can build on top of all the agenda capabilities, but using this custom sorting. Is there a way to start from an AST and transform it into an agenda view? Thanks for any help or tips, Haakon