From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Giovanni Bono Newsgroups: gmane.emacs.help Subject: Re: how to renumber footnotes? Date: Fri, 17 Apr 2020 15:53:08 +0200 Message-ID: <87blnqrzgb.fsf@cb001.local.net> References: <87v9lyvk3z.fsf@skimble.plus.com> <87mu7aycm5.fsf@ebih.ebihd> <87a73aaar5.fsf@hillenius.net> <87a73av34s.fsf@skimble.plus.com> <87y2qu8g92.fsf@hillenius.net> <87ftd2s2lv.fsf@cb001.local.net> 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="6521"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: help-gnu-emacs@gnu.org, Sharon Kimble To: =?utf-8?Q?G=C4=B3s?= Hillenius Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 17 15:53:38 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 1jPRR4-0001at-Ln for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 15:53:38 +0200 Original-Received: from localhost ([::1]:47578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPRR3-0006ny-Oh for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 17 Apr 2020 09:53:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39581) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPRQk-0006nk-My for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 09:53:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPRQj-0001oV-Bx for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 09:53:18 -0400 Original-Received: from sender7.unimi.it ([159.149.10.87]:35708) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jPRQj-0001kx-52 for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 09:53:17 -0400 X-Envelope-From: Original-Received: from mta05.msg.unimi.it (unknown [172.24.11.15]) by sender7.unimi.it (Postfix) with ESMTP id EF9F540417 for ; Fri, 17 Apr 2020 15:53:08 +0200 (CEST) Original-Received: from cb001 ([84.33.144.204]) by mta05.msg.unimi.it (Oracle Communications Messaging Server 8.1.0.0.20190227 64bit (built Feb 27 2019)) with ESMTPSA id <0Q8X00K87QKKR680@mta05.msg.unimi.it> for help-gnu-emacs@gnu.org; Fri, 17 Apr 2020 15:53:08 +0200 (CEST) In-reply-to: <87ftd2s2lv.fsf@cb001.local.net> X-Unimi-Libra-ESVA-Information: Please contact for more information X-Unimi-Libra-ESVA-ID: EF9F540417.A7236 X-Unimi-Libra-ESVA: No virus found X-Unimi-Libra-ESVA-SpamScore: ss X-Unimi-Libra-ESVA-From: giovanni.bono@unimi.it X-Unimi-Libra-ESVA-Watermark: 1587736389.09158@eKPY55hB02kaCw+Lht7ANw X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 159.149.10.87 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:122866 Archived-At: Giovanni Bono writes: > G=C4=B3s Hillenius writes: > >> [...] >> >>> org-footnote can't tell that footnote 1 ([fn:1]) at the beginning is in >>> the right place when confronted with footnote 1 ([fn:1]) half-way >>> through! Which is why I'm looking for some other solution, and I believe >>> that it might be able to be achieved programmatically. Unfortunately my >>> lisp skills are almost nil, hence my request for someone to help. >> >> Ah! >> >> Suppose file A has 372 footnotes, and B has another x. I would create a >> macro that I start just ahead of the second [fn:1], and that adds 372 to >> [fn:1] so it becomes [fn:373] and repeat that to x. >> >> It might take you a few tries, but something like put point at the >> second [fn:1] c-X ( to start recording the macro, search for [fn: copy >> the 1 (+ "yank" 273) paste (<-- I'm missing a step here, I bet), and >> then end the macro-recording with C-x ). > > An even simpler manual solution could be adding a sentence with 372 > footnotes at the beginning of file-b and merging the relevant part of > file-b with file-a. Maybe with something like: > > (let ((org-footnote-define-inline t) > (org-footnote-auto-adjust t)) > (dotimes (x 371) > (insert (concat "a [fn:" (number-to-string (1+ x)) ":a] ")))) > > Regards, > > Giovanni sorry, that was untested. I tried it and it does not work. The following apparently does: (let ((org-footnote-auto-adjust t) (ins 0)) (dotimes (x 371) (goto-char (+ ins (length (number-to-string x)) 5)) (insert " a ") (setq ins (point)) (call-interactively #'org-footnote-new nil [(number-to-string (1+ x))]))) The initial value of the =E2=80=98ins=E2=80=99 let variable should be the p= oint where you want the sentence inserted. Regards, Giovanni