From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Sharon Kimble Newsgroups: gmane.emacs.help Subject: Re: how to renumber footnotes? Date: Fri, 17 Apr 2020 18:03:34 +0100 Message-ID: <87ftd2kpsp.fsf@skimble.plus.com> References: <87v9lyvk3z.fsf@skimble.plus.com> <127dd11b-9379-361f-d315-d89882a5ac31@easy-emacs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="82672"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Andreas =?utf-8?Q?R=C3=B6hler?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 17 19:04:44 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPUQ0-000LMz-Dv for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 19:04:44 +0200 Original-Received: from localhost ([::1]:49830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPUPy-0004hN-FP for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 13:04:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41807) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPUPN-0004gO-4O for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 13:04:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPUPK-00083y-2m for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 13:04:04 -0400 Original-Received: from avasout04.plus.net ([212.159.14.19]:54812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jPUPJ-0007xf-9h for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 13:04:01 -0400 Original-Received: from london.london ([147.147.30.144]) by smtp with ESMTPA id PUPBjXaGwpB7IPUPDj2Fqz; Fri, 17 Apr 2020 18:03:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019; t=1587143035; bh=lXdPsmGDHkhY3uGPIlm1YDhz5Hq2cPuwJ0/DGBBK0mU=; h=From:To:Cc:Subject:References:Date:In-Reply-To; b=L0/IMxiyYGRJz0VDgrgxMWQR8iYVtVUCGvYcaOB3/HKmXLWKGtU7IY4QFp/zyaxr0 dJ4glAOWHlnNYgRBz9p7416ckAF22CwpPnFXaFfJoP7cYTZOMLnQ17M953r2NmIdTR vR59V2Wu02Y3NlOITBZudu0cSkccTr9f9ttM7oTV9sjfwVh9Ca3B8jwY/v2uyiJyIT eMm27x2TOSllovUO6NgvhIWyT39SyEon2RtJy1w8Ks9quuv+WBz76r3q1HpZliPwQX uHiWKgIGQfC56LdNthRYX3oTAOH3EC95Bh5XPLj7lwlcUlKqoAvSTLNL68R9rodkME mR65/jxNyZXEQ== X-Clacks-Overhead: "GNU Terry Pratchett" X-CM-Score: 0.00 X-CNFS-Analysis: v=2.3 cv=MKb7ZPRl c=1 sm=1 tr=0 a=mfde8XM5OSjOt+FlnmF8Qw==:117 a=mfde8XM5OSjOt+FlnmF8Qw==:17 a=IkcTkHD0fZMA:10 a=LlzXLoV6AAAA:8 a=iI7HsYTVAAAA:8 a=bAHfVwKlAAAA:8 a=xIb34hYA2j0ckW1XGtoA:9 a=-E_CQ1CvvUv7g_pp:21 a=ktvpzHM3e7dx-c6X:21 a=QEXdDO2ut3YA:10 a=diwpeB1DDhFXqWA7J4Up:22 a=KxyM1Xthmv57RbWRIpnN:22 a=fjrkRJ71zQ2jzMzczd-K:22 X-AUTH: skimble@:2500 In-Reply-To: <127dd11b-9379-361f-d315-d89882a5ac31@easy-emacs.de> ("Andreas =?utf-8?Q?R=C3=B6hler=22's?= message of "Fri, 17 Apr 2020 18:10:54 +0200") X-CMAE-Envelope: MS4wfOJ6DtTfzKJvoGniT/QCG/yq0ykOcA8jJCjnvh9RA7ZZpG1NhaUVRdssyfebKET+YtfDPsI2O5RtvS3G2JWGvuxP4gqT4tS2jIYjluKarVwTbaUEZeV4 CMWGdQvVTiORNNFS1gFz+bJsH0mEueISTvYlzODzi75/ACxyPig8frMnOGcYAHta7FhxzFhW2oc8LQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 212.159.14.19 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122870 Archived-At: =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Andreas R=C3=B6hler writes: > On 17.04.20 05:58, Sharon Kimble wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> >> Please, can someone help me sort out an org-mode footnote problem? >> >> I have 2 org-mode documents called 'file-a' and 'file-b', and both have >> got several hundred footnotes starting with 1. I'm adding file-b on to >> the end of file-a, and trying to renumber the footnotes, so that even if >> file-a has 354 footnotes, and file-b has 421 footnotes, the whole file >> renumbers the footnotes and continues on from 354 to 355, 356, 357, etc >> and onwards. >> >> But how can I do this please? The org-mode footnote program can't do it, >> so how do I do it please? >> >> (The footnote numbers I've shown are purely arbitrary, some files that >> I'm wanting to do this with have up to 700 footnotes in their combined > > Make sure there is only one footnote-section at the end of file and all f= n appear in correct order: > > (defun ar-org-footnote-renumber-intern () > =C2=A0 (let ((c 0)) > =C2=A0=C2=A0=C2=A0 (while (re-search-forward org-footnote-re nil t) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (backward-char 2) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (when (looking-at "[0-9]+") > =C2=A0=C2=A0=C2=A0 (replace-match (number-to-string (cl-incf c))))))) > > (defun ar-org-footnote-renumber () > =C2=A0 "Renumber footnotes." > =C2=A0 (interactive "*") > =C2=A0 (save-restriction > =C2=A0=C2=A0=C2=A0 (widen) > =C2=A0=C2=A0=C2=A0 (goto-char (point-min)) > =C2=A0=C2=A0=C2=A0 (when (re-search-forward "^* Footnotes" nil t) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; first renumber fns in text section, aft= erwards the > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;; fn-definitions > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (save-restriction > =C2=A0=C2=A0=C2=A0 (narrow-to-region (point-min) (line-beginning-position= )) > =C2=A0=C2=A0=C2=A0 (goto-char (point-min)) > =C2=A0=C2=A0=C2=A0 (ar-org-footnote-renumber-intern) > =C2=A0=C2=A0=C2=A0 (widen) > =C2=A0=C2=A0=C2=A0 (when (re-search-forward "^* Footnotes" nil t) > =C2=A0=C2=A0=C2=A0 =C2=A0 (narrow-to-region (line-beginning-position) (po= int-max)) > =C2=A0=C2=A0=C2=A0 =C2=A0 (goto-char (point-min)) > =C2=A0=C2=A0=C2=A0 =C2=A0 (ar-org-footnote-renumber-intern)))))) > Thanks Andreas, but all my footnotes are inline. Perhaps I should've said that earlier on, sorry! Perhaps I could put them at the end but I'm too tired at the moment to think about it, but plenty of time at the weekend, hooray! Thanks Sharon.=20=20 =2D --=20 A taste of linux =3D http://www.sharons.org.uk TGmeds =3D http://www.tgmeds.org.uk DrugFacts =3D https://www.drugfacts.org.uk Debian 10.2, fluxbox 1.3.7, emacs 27.0.90, org 9.3.6 =2D----BEGIN PGP SIGNATURE----- iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl6Z4W8bHGJvdWRpY2Nh c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INbkEYP/2dwUATppGxBm+wUz4sM KD76bdvePUB82SN5aXMEy8fBUvgs+ts/zgi/wqafh4s/HHgkxbfBftHaYqTXJXsI djcNGg84yQBZ28PKZpbpeqB52bjs5pIaUtfoQNUbto0/cS++u0GaLbf4n4nNAR6D Xu76+45RxOhlMRkJaS89GfvK4rl1ii7UMhyrx054NStQWZg/obz0ihMub7ADzdMq tajsdfo2/vWbZSk2vlFR4Wt46G334jczz7hVggh8JaIM2Z04ias+SqTfLd47sUE3 QJNAjlRMpnUhC+4Z6lC0P607bU2UKuwPut1rMk7jDds5R06SidkJCDM4T1HwUgv0 ZzSRI30Zqb28FzZ0aP9ec6hAgrADEqsqh+6ueOVR/YUOiIs0vSw2b0E65V+ZfGTP TuQQV+pzZnvPeOgaVrGcnLEOW5g6skIdC8YWbjpjkyCq+gyV0BUmu6D9jUanjZMT ZdJouKRHl/MhovcyF6mHgVF+GDvCBM6jI4nT8+iyr3ZFPCU4iLtMReItTFK66nuU 5WVrob1IVi2zr9Vu5g+ku78u7shfQ/2/rSu94uAT5egYZF8q2XUVV1BpyKdItY21 zb54mJci4W0WBOEo28f1NRJlSmFyO36SrDjnALvFYEaomSWQKSLWDhU1J/JKwZ3A Ot/8PlVpIIwQkNbgBELgRorX =3DakPr =2D----END PGP SIGNATURE-----