emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Numbered footnotes in the manual interfere with diff


From: Ihor Radchenko
Subject: Re: Numbered footnotes in the manual interfere with diff
Date: Mon, 03 Oct 2022 16:18:30 +0800

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 via email to

[Prev in Thread] Current Thread [Next in Thread]