emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Ypo <ypuntot@gmail.com>,
	 samologist@gmail.com,  Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Numbered footnotes in the manual interfere with diff
Date: Mon, 03 Oct 2022 16:18:30 +0800	[thread overview]
Message-ID: <87sfk5wca1.fsf@localhost> (raw)
In-Reply-To: <871qrzj0tc.fsf@gnu.org>

Bastien <bzg@gnu.org> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> Do you have any suggestion on how to deal with changing footnotes in the
>> manual? When I delete this footnote, all the footnotes must be
>> re-numbered creating a lot of garbage in the diff. Is it ok? Or should
>> we prefer inline footnote definitions in the manual to avoid such
>> situations?
>
> I propose to use inline footnotes for notes of one paragraph and to
> use regular footnotes for notes spanning over more than one paragraph.
> This will enhance both diffs readability and that of the manual's .org
> source.
>
> WDYT?

All the footnotes only span a single paragraph.
However, multiple footnotes span several sentences and thus look
cumbersome when inlined.

Should we just inline the one-sentence footnotes?

Also, there is one footnote that is indexed (does it even work?):

#+findex: org-date
#+findex: org-anniversary
#+findex: org-cyclic
#+findex: org-block

[fn:60] When working with the standard diary expression functions, you

I am not attaching the patch. Instead, you can run M-:
(yant/replace-all-footnotes) inside doc/org-manual.org


(defun yant/replace-footnote-with-def (fn)
  "Replace FN footnote-reference with inline footnote.
Move point to the end of the FN."
  (goto-char (org-element-property :end fn))
  (when (and (org-element-property :label fn)
	     (eq (org-element-type fn) 'footnote-reference))
    (let ((definition
	    (save-excursion
	      (org-footnote-goto-definition (org-element-property :label fn))
	      (let ((def (org-element-context)))
		(org-wrap
		 (org-trim
		  (buffer-substring-no-properties
		   (org-element-property :contents-begin def)
		   (org-element-property :contents-end def)))
                 nil 1)))))
      (when definition
	(replace-region-contents
         (org-element-property :begin fn)
         (org-element-property :end fn)
         (lambda () (format "[fn:: %s]%s" definition (make-string (or (org-element-property :post-blank fn) 0) ?\s))))
        (org-fill-paragraph)))))

(defun yant/replace-all-footnotes ()
  "Replace all footnotes in buffer with their definition."
  (org-with-wide-buffer
   (goto-char (point-min))
   (while (re-search-forward org-footnote-re nil t)
     (backward-char)
     (let ((fn (org-element-context)))
       (yant/replace-footnote-with-def fn)))))


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2022-10-03  8:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 17:45 Dates in headlines Ypo
2022-08-19  5:58 ` Ihor Radchenko
2022-09-25  8:45   ` Numbered footnotes in the manual interfere with diff (was: Dates in headlines) Ihor Radchenko
2022-09-25  8:49     ` Numbered footnotes in the manual interfere with diff Bastien
2022-10-03  8:18       ` Ihor Radchenko [this message]
2022-10-03  8:54         ` Bastien
2022-10-04  2:21           ` Ihor Radchenko
2022-10-04  8:31             ` Bastien
2022-10-05  9:54     ` Numbered footnotes in the manual interfere with diff (was: Dates in headlines) Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfk5wca1.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=samologist@gmail.com \
    --cc=ypuntot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).