Merge branch 'maint'

This commit is contained in:
Bastien Guerry 2013-01-16 18:36:33 +01:00
commit 1d8ba5a9cd
1 changed files with 24 additions and 22 deletions

View File

@ -8109,32 +8109,34 @@ It also looks at the text of the entry itself."
(let* ((marker (or (org-get-at-bol 'org-hd-marker) (let* ((marker (or (org-get-at-bol 'org-hd-marker)
(org-get-at-bol 'org-marker))) (org-get-at-bol 'org-marker)))
(buffer (and marker (marker-buffer marker))) (buffer (and marker (marker-buffer marker)))
(prefix (buffer-substring (prefix (buffer-substring (point-at-bol) (point-at-eol)))
(point-at-bol) (point-at-eol)))
(lkall (org-offer-links-in-entry buffer marker arg prefix)) (lkall (org-offer-links-in-entry buffer marker arg prefix))
(lk (car lkall)) (lk0 (car lkall))
(lk (if (stringp lk0) (list lk0) lk0))
(lkend (cdr lkall)) (lkend (cdr lkall))
trg) trg)
(cond (cond
((and buffer (stringp lk)) ((and buffer lk)
(with-current-buffer buffer (mapcar (lambda(l)
(setq trg (and (string-match org-bracket-link-regexp lk) (with-current-buffer buffer
(match-string 1 lk))) (setq trg (and (string-match org-bracket-link-regexp l)
(if (or (not trg) (string-match org-any-link-re trg)) (match-string 1 l)))
(save-excursion (if (or (not trg) (string-match org-any-link-re trg))
(save-restriction (save-excursion
(widen) (save-restriction
(goto-char marker) (widen)
(when (search-forward lk nil lkend) (goto-char marker)
(goto-char (match-beginning 0)) (when (search-forward l nil lkend)
(org-open-at-point)))) (goto-char (match-beginning 0))
;; This is an internal link, widen the buffer (org-open-at-point))))
(switch-to-buffer-other-window buffer) ;; This is an internal link, widen the buffer
(widen) (switch-to-buffer-other-window buffer)
(goto-char marker) (widen)
(when (search-forward lk nil lkend) (goto-char marker)
(goto-char (match-beginning 0)) (when (search-forward l nil lkend)
(org-open-at-point))))) (goto-char (match-beginning 0))
(org-open-at-point)))))
lk))
((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)")) ((or (org-in-regexp (concat "\\(" org-bracket-link-regexp "\\)"))
(save-excursion (save-excursion
(beginning-of-line 1) (beginning-of-line 1)