From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +OXLFFVfimHmhgAAgWs5BA (envelope-from ) for ; Tue, 09 Nov 2021 12:45:25 +0100 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 EDttEFVfimG1KAAAbx9fmQ (envelope-from ) for ; Tue, 09 Nov 2021 11:45:25 +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 53F0A13693 for ; Tue, 9 Nov 2021 12:45:23 +0100 (CET) Received: from localhost ([::1]:34994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkPZ4-00014N-EV for larch@yhetil.org; Tue, 09 Nov 2021 06:45:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkPYX-000146-Lg for emacs-orgmode@gnu.org; Tue, 09 Nov 2021 06:44:49 -0500 Received: from [2a00:1450:4864:20::42d] (port=42838 helo=mail-wr1-x42d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkPYV-0003ak-BF for emacs-orgmode@gnu.org; Tue, 09 Nov 2021 06:44:49 -0500 Received: by mail-wr1-x42d.google.com with SMTP id c4so32480480wrd.9 for ; Tue, 09 Nov 2021 03:44:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=b6iRDWCPrHusDN9YTCLdpAV7INlPHizukQxNscLTj/4=; b=ZNUuVtCvuCsltTZIhTZyBHJKLSHp+vizfVfjeFdMjVmUARLb148/E10gQVl/EV69c+ CeUEjylX/DLH3L/aT+bUcibZvjgWhmyIhYKgibHvjYGtX7oj18ta9aSEny5rho9umNkp 7CTPucu6KYGsSh3kqHWTneOc0F8+PeMyM3lYpB3Sf0c/kQZYo4Q4/nTxXWQ95Wipori1 Z+2Iryw+CcLJu3JpIRsS1CP+tmG3+ouy1Uq+rDDOyMI+oC2xEoVBEwKMdby8jorljNKW +dLkf20okpu1O8oUbsO4E5Fp0ivKkswJ/54HkGb7FC+7McoKQzqck6U9qFeRYM19BpKi +7Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=b6iRDWCPrHusDN9YTCLdpAV7INlPHizukQxNscLTj/4=; b=ngx61fhuXoCKbhbHEPHO0vpyUtSkL17wECWc2g9X/XKNstmnpTt9oogeyPoSoQCvDg WbpcqGgJxSEwoZM7qUxzyco7golHzK2RZj0c6l8965vbkr31N1L8bUephfjWoCIOMKNR 2o1SXF/f3vzPKbGg31tBNt/E5cJZCnHf2az4ov3leLiPjvFdhy04E04bmZ7ClrSlKsSX tlCVyls/513rWVyL9hrGm+ajd2zPw4QpsGzb+Egrr+XBLo0f4MbTeWn0I1Gty60mn6/g A8QlIMARQU/bGPLXb9SqNmFr+3xXri4jicBkATSMbU7X8JK2mVayHBDx3Mc1dMoc2lGg EDnw== X-Gm-Message-State: AOAM532i4rJb2xGIRQ2mSKJVO3Rub/pUBFqHVwtikvhGL/H386H3xMOc HBKJropuCHPACOJuunJ91x+a9DUdnRSh3LBDtRA= X-Google-Smtp-Source: ABdhPJw5v/kp8rxyUh3LTR0nLcPcSuUp6TDjP7P7kU9YDGJwd4ieCPizMSTtbKJKGmRn7oQJG/Xy2A== X-Received: by 2002:a05:6000:1848:: with SMTP id c8mr8370043wri.265.1636458285168; Tue, 09 Nov 2021 03:44:45 -0800 (PST) Received: from localhost ([91.210.107.150]) by smtp.gmail.com with ESMTPSA id o1sm20875659wrn.63.2021.11.09.03.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 03:44:44 -0800 (PST) From: Ihor Radchenko To: Max Nikulin Subject: Re: Incorrect link is stored (org-elements?) In-Reply-To: References: Date: Tue, 09 Nov 2021 19:46:11 +0800 Message-ID: <871r3po8l8.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=yantar92@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: , 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=1636458324; 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:dkim-signature; bh=b6iRDWCPrHusDN9YTCLdpAV7INlPHizukQxNscLTj/4=; b=dQKkeMaTT0hEkLsa86+nHbCUPXnI2cZyqCC7WctvMm8DeCz3VhvCIlQoRExqb1Cy0C2vXi Eb1r7FBZhEXRFjp0g88e48vp7v/xXI+l9u5SYbiBMN2TNAb26LFsNQ3bubnORS+Z3F5FoL WSbmnEL3qBOtEi5jNU7pf48Y3s5cTErVGV4vxMhframJCSeqCbBhScmKoY7tiKLzDAvUq3 bQkgadjB9O1kNOo4h3xuQ0t/sKUG13e5If0+Eq0y53WtKggaZ6tchk3a+m32vZsPaoiUNo lhAQU6Y1DW4sgUu8fjyamM3dLwtUVVqu+0FYjOE67Bjk86pd7Fzbx4CdDPx+WQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1636458324; a=rsa-sha256; cv=none; b=MY0afC+QfkM2Y/bjCmP7/rnGycqoCGLHHBsZ2CGirYaBMoJoBf8L9niAEXVxvo/6ab2BKO RPEbYEMKlq76qrAXdeF69Wh+s6K33I43i6QSngYaNz3xP7lfodrZRw2pLUWLa2bsFh85dF rzQUIoZs9U3EzRKJ3N+k7B26eyKIuxg58Klc8L4hCtTW+lNbp3BB+SJKrZNSfKAXiKDi72 NYWyqZmdai0F2JPQ8YX8oGZKy184VqJDaO4iRIZ85O/qJFkQWbQU4x1U/nw47rBuM5VjDS 0pFm+Mtk+AHY/UwkWuyAc/5ehgczlGhpLa/hkML5n5o/BGN5Gi3Iu8TuvffXqg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZNUuVtCv; 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: -2.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZNUuVtCv; 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: 53F0A13693 X-Spam-Score: -2.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: YMV7PjoY1YzP --=-=-= Content-Type: text/plain Max Nikulin writes: > `org-store-link' under some conditions may pick a link to wrong heading. > Emacs-26.3, Org main~1. I can reproduce, though not exactly following your steps. Can you try the attached patch? Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-element-at-point-Fix-breakage-when-called-at-the.patch >From 6465741dff757af23b10d1f0a412eb41d05f4c75 Mon Sep 17 00:00:00 2001 Message-Id: <6465741dff757af23b10d1f0a412eb41d05f4c75.1636458311.git.yantar92@gmail.com> From: Ihor Radchenko Date: Tue, 9 Nov 2021 19:42:14 +0800 Subject: [PATCH] org-element-at-point: Fix breakage when called at the end of section * lisp/org-element.el (org-element-at-point): Do no unconditionally return first matching cached element when point is within blank lines after section element and CACHED-ONLY is non-nil. Fixes https://list.orgmode.org/smbl59$qjm$1@ciao.gmane.io/T/#u --- lisp/org-element.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 9ea13db9c..ad5c2bbd0 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -7510,9 +7510,6 @@ (defun org-element-at-point (&optional pom cached-only) (and (org-element-property :contents-begin element) (>= pom (org-element-property :begin element)) (< pom (org-element-property :contents-begin element))) - (and (org-element-property :contents-end element) - (< pom (org-element-property :end element)) - (>= pom (org-element-property :contents-end element))) (and (not (org-element-property :contents-end element)) (>= pom (org-element-property :begin element)) (< pom (org-element-property :end element))))))) -- 2.32.0 --=-=-=--