浏览代码

Repair the export of source code line references in LaTeX

Marting G. Skjaeveland writes:

> I pulled a fresh copy of org-mode this morning and noticed that
> references to source code line numbers no longer work as they used
> to. Instead of displaying the number of the line with the label, the
> label is displayed.
>
> Exporting the following example, retrieved from the online
> documentation (http://orgmode.org/manual/Literal-examples.html),
>
> -------------------------------------start
> #+BEGIN_SRC emacs-lisp -n -r
>  (save-excursion                  (ref:sc)
>  (goto-char (point-min))       (ref:jump)
> #+END_SRC
>
>  In line [[(sc)]] we remember the current position.  [[(jump)][Line
> (jump)]] jumps to point-min.
>
> -------------------------------------end
>
> gives me in latex export
>
> -------------------------------------start
> \begin{verbatim}
> 1:  (save-excursion
> 2:  (goto-char (point-min))
> \end{verbatim}
>
>  In line \hyperref[(sc)]{(sc)} we remember the current
>  position. \hyperref[(jump)]{Line (jump)} jumps to point-min.
>  -------------------------------------end
>
Carsten Dominik 15 年之前
父节点
当前提交
bfad012629
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 3 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-exp.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2010-01-14  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-exp.el (org-export-target-internal-links): Check for
+	protectedness after the first bracket.
+
 	* org.el (org-entry-properties): Don't match wrong-case TODO
 	keywords.
 

+ 1 - 1
lisp/org-exp.el

@@ -1537,7 +1537,7 @@ This function also handles the id links, if they have a match in
 the current file."
   (goto-char (point-min))
   (while (re-search-forward org-bracket-link-regexp nil t)
-    (org-if-unprotected-at (match-beginning 1)
+    (org-if-unprotected-at (1+ (match-beginning 0))
      (let* ((md (match-data))
 	    (desc (match-end 2))
 	    (link (org-link-unescape (match-string 1)))