From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#19914: 25.0.50; `org-store-link' invokes function to add to `org-store-link-functions' twice Date: Sat, 21 Feb 2015 10:01:03 -0800 (PST) Message-ID: <99056495-17e4-4cc4-86e7-9e506f2a100c@default> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1424541745 25705 80.91.229.3 (21 Feb 2015 18:02:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Feb 2015 18:02:25 +0000 (UTC) To: 19914@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 21 19:02:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YPENX-0006hf-4E for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Feb 2015 19:02:11 +0100 Original-Received: from localhost ([::1]:36948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPENW-0003AI-8c for geb-bug-gnu-emacs@m.gmane.org; Sat, 21 Feb 2015 13:02:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59312) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPENS-00039C-6v for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 13:02:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPENO-00088v-BM for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 13:02:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59128) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPENO-00088p-8U for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 13:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YPENN-0004U4-Vr for bug-gnu-emacs@gnu.org; Sat, 21 Feb 2015 13:02:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Feb 2015 18:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19914 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19914-submit@debbugs.gnu.org id=B19914.142454167117175 (code B ref 19914); Sat, 21 Feb 2015 18:02:01 +0000 Original-Received: (at 19914) by debbugs.gnu.org; 21 Feb 2015 18:01:11 +0000 Original-Received: from localhost ([127.0.0.1]:50368 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YPEMY-0004Sx-UQ for submit@debbugs.gnu.org; Sat, 21 Feb 2015 13:01:11 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:36583) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YPEMX-0004Sp-1f for 19914@debbugs.gnu.org; Sat, 21 Feb 2015 13:01:09 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t1LI16b1032643 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for <19914@debbugs.gnu.org>; Sat, 21 Feb 2015 18:01:08 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t1LI16kr004652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for <19914@debbugs.gnu.org>; Sat, 21 Feb 2015 18:01:06 GMT Original-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t1LI151h004637 for <19914@debbugs.gnu.org>; Sat, 21 Feb 2015 18:01:05 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:99680 Archived-At: > This means that it will have done its thing TWICE: once just to check > whether it should/could do its thing and another time so that it does > its thing. Also, the doc of `org-store-link-functions' says nothing about the function being called twice. It says only: "Each function should check if it is responsible for creating this link (for example by looking at the major mode). If not, it must exit and return nil. If yes, it should return a non-nil value after a calling `org-store-link-props' with a list of properties and values." (And "a calling" is a typo - it should be "calling".) This doc is essentially a spec telling you what a function for this list should do. From the doc, its purpose is to (a) check whether it should call `org-store-link-props' and (b) if so, call it and return non-nil, else return nil (without calling it). Nothing suggests that the function, if invoked to define a link, will be invoked twice: once for (a) (even though (b) will also be done then) and a second time for (b). --- Also wrt the doc: The functions on `org-store-link-functions' do not really "create and store a link", AFAICT. They merely define a link. It is `org-store-link' that uses this definition to create and store a link. The most that these functions do is invoke `org-store-link-props', and that neither creates nor stores a link. Whether you think of "creating" a link as inserting it somewhere or just adding it to `org-stored-links' (in which case "creating" the link is synonymous with "storing" it), the functions on `org-store-link-functions' do not, themselves, update `org-stored-links'. Putting a link on that list is the only thing that could reasonably be considered "storing" a link, AFAICT. (Hence the name of function `org-store-link'.)