From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gKzlOCImvF61PAAA0tVLHw (envelope-from ) for ; Wed, 13 May 2020 16:53:54 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QBIJLDEmvF64RAAA1q6Kng (envelope-from ) for ; Wed, 13 May 2020 16:54:09 +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 3A78F940D36 for ; Wed, 13 May 2020 16:54:07 +0000 (UTC) Received: from localhost ([::1]:58928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYue0-0001hN-97 for larch@yhetil.org; Wed, 13 May 2020 12:54:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYuVq-0005mT-VR for emacs-orgmode@gnu.org; Wed, 13 May 2020 12:45:42 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:38675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYuVp-0005VJ-HH for emacs-orgmode@gnu.org; Wed, 13 May 2020 12:45:42 -0400 Received: by mail-pl1-x636.google.com with SMTP id m7so59394plt.5 for ; Wed, 13 May 2020 09:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=kmNF5VSL/w1RnGZ/Epp+GexnyU/ueLQ6AWVB6DCgeUc=; b=d6Bq1uoy96sDhNsaGs19eCUEtcaGS4NgM6635Lq6sAwqXGmqNJtyXcxg4RC9l8wh60 HXDFxdDq1egVTI9rgEG8yCeVLRa3su0HWO8/AL56Zm4YUD5MbsEn7arZJ4KEQweyJ1yA UzZY+Ab3B/46XZA99QIgCRG5gM5SSAhKGg5ZbTu9GTlljouxXVBLRaTcuPIyXuriu2BJ Ny/ALj3Kq5vnCE5mWrrSndy7S+W2tnVud5lyshSaBS7tIxhLq4qPYzDJMfiAzkXOOSt1 n1psdkrlEuhSL0bIm97X5cDb3wtnaBzvmWlkKG+G7LpqDc1nOmmrhtCUmym4py0jwRDZ 2gXg== 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:in-reply-to:references:date :message-id:mime-version; bh=kmNF5VSL/w1RnGZ/Epp+GexnyU/ueLQ6AWVB6DCgeUc=; b=ih9RH00+A9tSM/BRBqcYmK3F0LcmX5YNzmqxXyu/NcQe4jinwJS774lBog/iMaXJP0 oZk5QpBfzp7pCfy4yXAVuLLW00XSHj35UdB2To2OSKtE6SMLi+gUcdDLmiW0M94iPAcT woSmbPxekQ5Dpu6M5DNnINyaQjbJYtGaR1C8q+yipJV1fmxDJIYLppxi0fWTLCdSKI/q ynAdOVTQhpzjoJW13mRpSAIj6vwS5vnUXU5GxoNWAREBEYsifuUOD4riKL657EcJB5/5 tj4j9PwXqODYFpPsWV3uUGsPR7POBIcG14eK+QkERqavoV+ZSbNu1Z899AhD/+oKee1p jskA== X-Gm-Message-State: AGi0PuYefByMPm+Kj7wEL80loHwiAUWgESwKw9FQVFsisvs3SIXtq2qA xRIyGyXtR8ETlLomeVYsihM= X-Google-Smtp-Source: APiQypIqUE2AOMnQADHhSY2/0e5JAZmupSkomx1jma8+7z3/G94gkvaR84VesLhKNuYndjGUVp1dng== X-Received: by 2002:a17:90a:1b6c:: with SMTP id q99mr37677205pjq.70.1589388340226; Wed, 13 May 2020 09:45:40 -0700 (PDT) Received: from localhost ([210.3.160.230]) by smtp.gmail.com with ESMTPSA id k1sm174569pgh.78.2020.05.13.09.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 09:45:39 -0700 (PDT) From: Ihor Radchenko To: Eric Abrahamsen , John Kitchin Subject: Re: get the body of a heading up to the next subheading In-Reply-To: <87eernu8bi.fsf@ericabrahamsen.net> References: <87ftc5agb1.fsf@localhost> <87eernu8bi.fsf@ericabrahamsen.net> Date: Thu, 14 May 2020 00:41:21 +0800 Message-ID: <87lflvaitq.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=yantar92@gmail.com; helo=mail-pl1-x636.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: org-mode-email Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -1.21 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=d6Bq1uoy; 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-Scan-Result: default: False [-1.21 / 13.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; GENERIC_REPUTATION(0.00)[-0.53997054253458]; DWL_DNSWL_FAIL(0.00)[gmail.com:server fail,209.51.188.17:server fail]; R_SPF_ALLOW(-0.20)[+ip4:209.51.188.0/24:c]; FREEMAIL_FROM(0.00)[gmail.com]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.05), country: US(-0.00), ip: 209.51.188.17(-0.54)]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[209.51.188.17:server fail]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:22989, ipnet:209.51.188.0/24, country:US]; TAGGED_FROM(0.00)[larch=yhetil.org]; FROM_NEQ_ENVFROM(0.00)[yantar92@gmail.com,emacs-orgmode-bounces@gnu.org]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_COUNT_FIVE(0.00)[6]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; URIBL_BLOCKED(0.00)[cmu.edu:email,sutd.edu.sg:email,ericabrahamsen.net:email]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[emacs-orgmode@gnu.org]; HAS_LIST_UNSUB(-0.01)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.51.188.17:from]; MID_RHS_NOT_FQDN(0.50)[]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: OIHQp6Mgm2C/ > I don't think there's anything built-in, no. I have needed this in > various places, and did something similar to the above, except with a > combination of `org-back-to-heading', `org-end-of-meta-data', then > `outline-next-heading'. Hmm. I just noticed a reference to built-in org-agenda-get-some-entry-text in the function I sent earlier. I do not see why it cannot be used outside agenda. Maybe something like (let ((org-agenda-entry-text-cleanup-hook nil)) (org-agenda-get-some-entry-text (point-marker) #x40000000)) Eric Abrahamsen writes: > John Kitchin writes: > >> Thanks! Here is what I am currently using: >> >> (defun canvas-org-get-heading-body () >> "Return the body of the current heading up to the next heading." >> (interactive) >> (save-excursion >> (unless (org-at-heading-p) >> (org-previous-visible-heading 1)) >> (org-end-of-meta-data) >> (buffer-substring (point) >> (progn (re-search-forward org-heading-regexp nil 'mv) >> (line-beginning-position))))) >> >> So far it gets what I want. I am pretty sure I have reinvented this, >> maybe even from code I wrote before... I couldn't find my answer on SO >> or my blog though. > > I don't think there's anything built-in, no. I have needed this in > various places, and did something similar to the above, except with a > combination of `org-back-to-heading', `org-end-of-meta-data', then > `outline-next-heading'. -- Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg