mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-29 11:02:33 +00:00
org-footnote: fix problem with normalize in message-mode
* lisp/org-footnote.el (org-footnote-at-definition-p, org-footnote-normalize): do not grab signature in the definition of the last footnote.
This commit is contained in:
parent
def5a2f567
commit
b824725df1
@ -235,11 +235,20 @@ label, start, end and definition of the footnote otherwise."
|
||||
(list (match-string 2)
|
||||
(match-beginning 0)
|
||||
(save-match-data
|
||||
;; In a message, limit search to signature.
|
||||
(let ((bound (and (derived-mode-p 'message-mode)
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(re-search-backward
|
||||
message-signature-separator nil t)))))
|
||||
(or (and (re-search-forward
|
||||
(org-re "^[ \t]*$\\|^\\*+ \\|^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]")
|
||||
nil t)
|
||||
(org-re
|
||||
(concat "^[ \t]*$" "\\|"
|
||||
"^\\*+ " "\\|"
|
||||
"^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]"))
|
||||
bound 'move)
|
||||
(progn (skip-chars-forward " \t\n") (point-at-bol)))
|
||||
(point-max)))
|
||||
(point))))
|
||||
(org-trim (buffer-substring (match-end 0) (point))))))))
|
||||
|
||||
(defun org-footnote-get-next-reference (&optional label backward limit)
|
||||
@ -653,9 +662,17 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
|
||||
"[ \t]*$")
|
||||
nil t)
|
||||
(replace-match ""))
|
||||
;; In message-mode, ensure footnotes are inserted before the
|
||||
;; signature.
|
||||
(let ((pt-max
|
||||
(or (and (derived-mode-p 'message-mode)
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(re-search-backward message-signature-separator nil t)))
|
||||
(point-max))))
|
||||
(goto-char pt-max)
|
||||
(skip-chars-backward " \t\n\r")
|
||||
(delete-region (point) (point-max))
|
||||
(delete-region (point) pt-max))
|
||||
(insert "\n\n" org-footnote-tag-for-non-org-mode-files "\n")
|
||||
(setq ins-point (point))))
|
||||
;; 3. Clean-up REF-TABLE.
|
||||
@ -693,7 +710,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
|
||||
(nth (if sort-only 0 1) x) (nth 2 x)))
|
||||
ref-table "\n\n")
|
||||
"\n\n")
|
||||
;; When exporting, add newly insert markers along with their
|
||||
;; When exporting, add newly inserted markers along with their
|
||||
;; associated definition to `org-export-footnotes-seen'.
|
||||
(when export-props
|
||||
(setq org-export-footnotes-seen ref-table)))
|
||||
|
Loading…
Reference in New Issue
Block a user