Browse Source

Allow footnote markers like [1] to occur in verbatim emphasis

Carsten Dominik 15 years ago
parent
commit
7507bdd922
5 changed files with 21 additions and 6 deletions
  1. 8 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-exp.el
  3. 1 1
      lisp/org-footnote.el
  4. 7 4
      lisp/org-latex.el
  5. 4 0
      lisp/org.el

+ 8 - 0
lisp/ChangeLog

@@ -1,3 +1,11 @@
+2009-10-29  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-latex.el (org-export-latex-fontify): Apply verbatim
+	emphasis.
+
+	* org-exp.el (org-export-protect-verbatim): Add an
+	`org-verbatim-emph' property to such text.
+
 2009-10-28  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-10-28  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org-icalendar.el (org-icalendar-use-plain-timestamp): New option.
 	* org-icalendar.el (org-icalendar-use-plain-timestamp): New option.

+ 1 - 1
lisp/org-exp.el

@@ -1686,7 +1686,7 @@ from the buffer."
   (goto-char (point-min))
   (goto-char (point-min))
   (while (re-search-forward org-verbatim-re nil t)
   (while (re-search-forward org-verbatim-re nil t)
     (add-text-properties (match-beginning 4) (match-end 4)
     (add-text-properties (match-beginning 4) (match-end 4)
-			 '(org-protected t))
+			 '(org-protected t org-verbatim-emph t))
     (goto-char (1+ (match-end 4)))))
     (goto-char (1+ (match-end 4)))))
 
 
 (defun org-export-protect-colon-examples ()
 (defun org-export-protect-colon-examples ()

+ 1 - 1
lisp/org-footnote.el

@@ -365,7 +365,7 @@ referenced sequence."
       ;; Now find footnote references, and extract the definitions
       ;; Now find footnote references, and extract the definitions
       (goto-char (point-min))
       (goto-char (point-min))
       (while (re-search-forward org-footnote-re nil t)
       (while (re-search-forward org-footnote-re nil t)
-	(unless (org-in-commented-line)
+	(unless (or (org-in-commented-line) (org-in-verbatim-emphasis))
 	  (org-if-unprotected
 	  (org-if-unprotected
 	   (setq def (match-string 4)
 	   (setq def (match-string 4)
 		 idef def
 		 idef def

+ 7 - 4
lisp/org-latex.el

@@ -1469,7 +1469,9 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
       (unless emph
       (unless emph
 	(message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\""
 	(message "`org-export-latex-emphasis-alist' has no entry for formatting triggered by \"%s\""
 		 (match-string 3)))
 		 (match-string 3)))
-      (unless (or (get-text-property (- (point) 2) 'org-protected)
+      (unless (or (and (get-text-property (- (point) 2) 'org-protected)
+		       (not (get-text-property
+			     (- (point) 2) 'org-verbatim-emph)))
 		  (save-excursion
 		  (save-excursion
 		    (goto-char (match-beginning 1))
 		    (goto-char (match-beginning 1))
 		    (save-match-data
 		    (save-match-data
@@ -1799,9 +1801,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     (goto-char (point-min))
     (goto-char (point-min))
     (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t)
     (while (re-search-forward "\\[\\([0-9]+\\)\\]" nil t)
       (org-if-unprotected
       (org-if-unprotected
-       (when (save-match-data
-	       (save-excursion (beginning-of-line)
-			       (looking-at "[^:|#]")))
+       (when (and (save-match-data
+		    (save-excursion (beginning-of-line)
+				    (looking-at "[^:|#]")))
+		  (not (org-in-verbatim-emphasis)))
 	 (let ((foot-beg (match-beginning 0))
 	 (let ((foot-beg (match-beginning 0))
 	       (foot-end (match-end 0))
 	       (foot-end (match-end 0))
 	       (foot-prefix (match-string 0))
 	       (foot-prefix (match-string 0))

+ 4 - 0
lisp/org.el

@@ -15890,6 +15890,10 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
   "Is point in a line starting with `#'?"
   "Is point in a line starting with `#'?"
   (equal (char-after (point-at-bol)) ?#))
   (equal (char-after (point-at-bol)) ?#))
 
 
+(defun org-in-verbatim-emphasis ()
+  (save-match-data
+    (and (org-in-regexp org-emph-re 2) (member (match-string 3) '("=" "~")))))
+
 (defun org-goto-marker-or-bmk (marker &optional bookmark)
 (defun org-goto-marker-or-bmk (marker &optional bookmark)
   "Go to MARKER, widen if necessary.  When marker is not live, try BOOKMARK."
   "Go to MARKER, widen if necessary.  When marker is not live, try BOOKMARK."
   (if (and marker (marker-buffer marker)
   (if (and marker (marker-buffer marker)