Sfoglia il codice sorgente

org-footnote: prevent LaTeX export from catching footnotes in protect environment

* lisp/org-footnote.el (org-footnote-in-valid-context-p): check
  `org-protected' property before allowing to match a footnote.
(org-footnote-at-reference-p): remove an obsolete test. It's now done
in the previous function.
Nicolas Goaziou 13 anni fa
parent
commit
c3631aae7e
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      lisp/org-footnote.el

+ 4 - 3
lisp/org-footnote.el

@@ -171,8 +171,10 @@ extracted will be filled again."
   (save-match-data
     (not (or (org-in-commented-line)
 	     (org-in-indented-comment-line)
-	     (org-in-verbatim-emphasis)
+	     ;; Avoid protected environments (LaTeX export)
+	     (get-text-property (point) 'org-protected)
 	     ;; Avoid literal example.
+	     (org-in-verbatim-emphasis)
 	     (save-excursion
 	       (beginning-of-line)
 	       (looking-at "[ \t]*:[ \t]+"))
@@ -223,8 +225,7 @@ positions, and the definition, when inlined."
 		 ;; optional argument of the command.  Thus, check
 		 ;; the `org-protected' property of that command.
 		 (or (not (org-inside-latex-macro-p))
-		     (and (get-text-property (1- beg) 'org-protected)
-			  (not (get-text-property beg 'org-protected)))))
+		     (get-text-property (1- beg) 'org-protected)))
 	(list label beg end
 	      ;; Definition: ensure this is an inline footnote first.
 	      (and (or (not label) (match-string 1))