1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-23 19:49:32 +00:00

Move link-related core functions out of "org.el"

* contrib/lisp/org-wl.el (org-wl-store-link-message):
* lisp/Makefile (clean-install):
* lisp/ob-core.el (org-link-bracket-re):
(org-babel-open-src-block-result):
(org-babel-read-element):
(org-babel-read-link):
(org-babel-result-end):
* lisp/ob-tangle.el (org-link-bracket-re):
(org-babel-tangle-single-block):
(org-link-analytic-bracket-re):
(org-babel-detangle):
(org-babel-tangle-jump-to-org):
* lisp/ol.el:
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
(org-diary):
(org-agenda-format-item):
(org-agenda-open-link):
(org-agenda-switch-to):
(org-agenda-to-appt):
* lisp/org-bbdb.el (org-bbdb-store-link):
* lisp/org-bibtex.el (org-bibtex-store-link):
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-clock.el (org-clocktable-write-default):
(org-clock-get-table-data):
* lisp/org-compat.el (org-doi-server-url):
(org-email-link-description-format):
(org-make-link-description-function):
(org-from-is-user-regexp):
(org-descriptive-links):
(org-url-hexify-p):
(org-context-in-file-links):
(org-keep-stored-link-after-insertion):
(org-display-internal-link-with-indirect-buffer):
(org-confirm-shell-link-function):
(org-confirm-shell-link-not-regexp):
(org-confirm-elisp-link-function):
(org-confirm-elisp-link-not-regexp):
(org-file-complete-link):
(org-email-link-description):
(org-make-link-string):
(org-store-link-props):
(org-add-link-props):
(org-make-link-regexps):
(org-angle-link-re):
(org-plain-link-re):
(org-bracket-link-regexp):
(org-bracket-link-analytic-regexp):
(org-any-link-re):
* lisp/org-docview.el (org-docview-store-link):
(org-docview-complete-link):
* lisp/org-element.el (org-element-link-parser):
* lisp/org-eshell.el (org-eshell-store-link):
* lisp/org-eww.el (org-eww-store-link):
(org-eww-copy-for-org-mode):
* lisp/org-footnote.el (org-footnote-next-reference-or-definition):
* lisp/org-gnus.el (org-gnus-article-link):
(org-gnus-store-link):
* lisp/org-id.el (org-id-store-link):
* lisp/org-info.el (org-info-store-link):
* lisp/org-irc.el (org-irc-erc-store-link):
* lisp/org-mhe.el (org-mhe-store-link):
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead):
* lisp/org-protocol.el (org-protocol-do-capture):
* lisp/org-rmail.el (org-rmail-store-link):
* lisp/org-w3m.el (org-w3m-store-link):
(org-w3m-copy-for-org-mode):
This commit is contained in:
Nicolas Goaziou 2018-11-27 00:04:41 +01:00
parent 8060ca6727
commit a486d9cbd7
32 changed files with 2516 additions and 2352 deletions

View File

@ -25,7 +25,7 @@
(defun molecule-jump (name)
"Jump to molecule `NAME' definition."
(org-mark-ring-push)
(org-open-link-from-string (format "[[%s]]" path)))
(org-link-open-from-string (format "[[%s]]" path)))
(defun molecule-export (path desc backend)
"Export molecule to HTML format on `PATH' with `DESC' and `BACKEND'."

View File

@ -107,7 +107,7 @@
(defun org-vm-follow-link (&optional folder article readonly)
"Follow a VM link to FOLDER and ARTICLE."
(require 'vm)
(setq article (org-add-angle-brackets article))
(setq article (org-link-add-angle-brackets article))
(if (string-match "^//\\([a-zA-Z]+@\\)?\\([^:]+\\):\\(.*\\)" folder)
;; ange-ftp or efs or tramp access
(let ((user (or (match-string 1 folder) (user-login-name)))
@ -124,7 +124,7 @@
(when folder
(funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
(when article
(org-vm-select-message (org-add-angle-brackets article)))))
(org-vm-select-message (org-link-add-angle-brackets article)))))
(defun org-vm-imap-open (path)
"Follow a VM link to an IMAP folder."
@ -143,7 +143,7 @@
(funcall (cdr (assq 'vm-imap org-link-frame-setup))
mailbox-spec)
(when message-id
(org-vm-select-message (org-add-angle-brackets message-id))))))
(org-vm-select-message (org-link-add-angle-brackets message-id))))))
(defun org-vm-select-message (message-id)
"Go to the message with message-id in the current folder."

View File

@ -221,10 +221,10 @@ ENTITY is a message entity."
((and (eq folder-type 'nntp) org-wl-nntp-prefer-web-links)
(setq link
(format
(if (string-match "gmane\\." folder-name)
(if (string-match-p "gmane\\." folder-name)
"http://mid.gmane.org/%s"
"http://groups.google.com/groups/search?as_umsgid=%s")
(org-fixup-message-id-for-http message-id)))
(url-encode-url message-id)))
(org-store-link-props :type "http" :link link :description subject
:from from :to to :message-id message-id
:message-id-no-brackets message-id-no-brackets
@ -291,7 +291,7 @@ for namazu index."
(goto-char old-point))
(when article
(if (string-match-p "@" article)
(wl-summary-jump-to-msg-by-message-id (org-add-angle-brackets
(wl-summary-jump-to-msg-by-message-id (org-link-add-angle-brackets
article))
(or (wl-summary-jump-to-msg (string-to-number article))
(error "No such message: %s" article)))

View File

@ -89,5 +89,5 @@ clean cleanall cleanelc::
clean-install:
if [ -d $(DESTDIR)$(lispdir) ] ; then \
$(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
$(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* $(DESTDIR)$(lispdir)/ol*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
fi ;

View File

@ -1023,7 +1023,7 @@ evaluation mechanisms."
(call-interactively
(key-binding (or key (read-key-sequence nil))))))
(defvar org-bracket-link-regexp)
(defvar org-link-bracket-re)
(defun org-babel-active-location-p ()
(memq (org-element-type (save-match-data (org-element-context)))
@ -1049,7 +1049,7 @@ exist."
(end-of-line)
(skip-chars-forward " \r\t\n")
;; Open the results.
(if (looking-at org-bracket-link-regexp) (org-open-at-point)
(if (looking-at org-link-bracket-re) (org-open-at-point)
(let ((r (org-babel-format-result (org-babel-read-result)
(cdr (assq :sep arguments)))))
(pop-to-buffer (get-buffer-create "*Org Babel Results*"))
@ -2093,7 +2093,7 @@ Return nil if ELEMENT cannot be read."
(`paragraph
;; Treat paragraphs containing a single link specially.
(skip-chars-forward " \t")
(if (and (looking-at org-bracket-link-regexp)
(if (and (looking-at org-link-bracket-re)
(save-excursion
(goto-char (match-end 0))
(skip-chars-forward " \r\t\n")
@ -2135,7 +2135,7 @@ Return nil if ELEMENT cannot be read."
If the path of the link is a file path it is expanded using
`expand-file-name'."
(let* ((case-fold-search t)
(raw (and (looking-at org-bracket-link-regexp)
(raw (and (looking-at org-link-bracket-re)
(org-no-properties (match-string 1))))
(type (and (string-match org-link-types-re raw)
(match-string 1 raw))))
@ -2479,7 +2479,7 @@ in the buffer."
(defun org-babel-result-end ()
"Return the point at the end of the current set of results."
(cond ((looking-at-p "^[ \t]*$") (point)) ;no result
((looking-at-p (format "^[ \t]*%s[ \t]*$" org-bracket-link-regexp))
((looking-at-p (format "^[ \t]*%s[ \t]*$" org-link-bracket-re))
(line-beginning-position 2))
(t
(let ((element (org-element-at-point)))

View File

@ -43,7 +43,7 @@
(declare-function org-id-find "org-id" (id &optional markerp))
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
(declare-function org-link-escape "org" (text &optional table merge))
(declare-function org-open-link-from-string "org" (s &optional arg reference-buffer))
(declare-function org-link-open-from-string "ol" (s &optional arg))
(declare-function org-store-link "org" (arg &optional interactive?))
(declare-function outline-previous-heading "outline" ())
@ -332,7 +332,7 @@ references."
(save-excursion (end-of-line 1) (forward-char 1) (point)))))
(defvar org-stored-links)
(defvar org-bracket-link-regexp)
(defvar org-link-bracket-re)
(defun org-babel-spec-to-string (spec)
"Insert SPEC into the current file.
@ -428,7 +428,7 @@ non-nil, return the full association list to be used by
(match-string 1 extra))
org-coderef-label-format))
(link (let ((l (org-no-properties (org-store-link nil))))
(and (string-match org-bracket-link-regexp l)
(and (string-match org-link-bracket-re l)
(match-string 1 l))))
(source-name
(or (nth 4 info)
@ -517,7 +517,7 @@ non-nil, return the full association list to be used by
(org-fill-template org-babel-tangle-comment-format-end link-data))))
;; de-tangling functions
(defvar org-bracket-link-analytic-regexp)
(defvar org-link-analytic-bracket-re)
(defun org-babel-detangle (&optional source-code-file)
"Propagate changes in source file back original to Org file.
This requires that code blocks were tangled with link comments
@ -527,7 +527,7 @@ which enable the original code blocks to be found."
(when source-code-file (find-file source-code-file))
(goto-char (point-min))
(let ((counter 0) new-body end)
(while (re-search-forward org-bracket-link-analytic-regexp nil t)
(while (re-search-forward org-link-analytic-bracket-re nil t)
(when (re-search-forward
(concat " " (regexp-quote (match-string 5)) " ends here"))
(setq end (match-end 0))
@ -547,7 +547,7 @@ which enable the original code blocks to be found."
target-buffer target-char link path block-name body)
(save-window-excursion
(save-excursion
(while (and (re-search-backward org-bracket-link-analytic-regexp nil t)
(while (and (re-search-backward org-link-analytic-bracket-re nil t)
(not ; ever wider searches until matching block comments
(and (setq start (line-beginning-position))
(setq body-start (line-beginning-position 2))
@ -568,7 +568,7 @@ which enable the original code blocks to be found."
(find-file (or (car (org-id-find path)) path))
(setq target-buffer (current-buffer))
;; Go to the beginning of the relative block in Org file.
(org-open-link-from-string link)
(org-link-open-from-string link)
(if (string-match "[^ \t\n\r]:\\([[:digit:]]+\\)" block-name)
(let ((n (string-to-number (match-string 1 block-name))))
(if (org-before-first-heading-p) (goto-char (point-min))

1924
lisp/ol.el Normal file

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,7 @@
;;; Code:
(require 'cl-lib)
(require 'ol)
(require 'org)
(require 'org-macs)
@ -3537,7 +3538,7 @@ removed from the entry content. Currently only `planning' is allowed here."
(add-text-properties (match-beginning 0) (match-end 0)
'(face org-link))))
(goto-char (point-min))
(while (re-search-forward org-bracket-link-regexp (point-max) t)
(while (re-search-forward org-link-bracket-re (point-max) t)
(set-text-properties (match-beginning 0) (match-end 0)
nil))
(goto-char (point-min))
@ -5200,7 +5201,7 @@ function from a program - use `org-agenda-get-day-entries' instead."
(when results
(setq results
(mapcar (lambda (i) (replace-regexp-in-string
org-bracket-link-regexp "\\3" i)) results))
org-link-bracket-re "\\3" i)) results))
(concat (org-agenda-finalize-entries results) "\n"))))
;;; Agenda entry finders
@ -6568,7 +6569,7 @@ Any match of REMOVE-RE will be removed from TXT."
extra (or (and (not habitp) extra) "")
category (if (symbolp category) (symbol-name category) category)
level (or level ""))
(if (string-match org-bracket-link-regexp category)
(if (string-match org-link-bracket-re category)
(progn
(setq l (if (match-end 3)
(- (match-end 3) (match-beginning 3))
@ -8629,9 +8630,9 @@ It also looks at the text of the entry itself."
((and buffer lk)
(mapcar (lambda(l)
(with-current-buffer buffer
(setq trg (and (string-match org-bracket-link-regexp l)
(setq trg (and (string-match org-link-bracket-re l)
(match-string 1 l)))
(if (or (not trg) (string-match org-any-link-re trg))
(if (or (not trg) (string-match org-link-any-re trg))
(org-with-wide-buffer
(goto-char marker)
(when (search-forward l nil lkend)
@ -8645,11 +8646,11 @@ It also looks at the text of the entry itself."
(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-link-bracket-re "\\)"))
(save-excursion
(beginning-of-line 1)
(looking-at (concat ".*?\\(" org-bracket-link-regexp "\\)"))))
(org-open-link-from-string (match-string 1)))
(looking-at (concat ".*?\\(" org-link-bracket-re "\\)"))))
(org-link-open-from-string (match-string 1)))
(t (message "No link to open here")))))
(defun org-agenda-copy-local-variable (var)
@ -8667,8 +8668,8 @@ displayed Org file fills the frame."
(interactive)
(if (and org-return-follows-link
(not (org-get-at-bol 'org-marker))
(org-in-regexp org-bracket-link-regexp))
(org-open-link-from-string (match-string 0))
(org-in-regexp org-link-bracket-re))
(org-link-open-from-string (match-string 0))
(let* ((marker (or (org-get-at-bol 'org-marker)
(org-agenda-error)))
(buffer (marker-buffer marker))
@ -10237,7 +10238,7 @@ to override `appt-message-warning-time'."
(lambda (x)
(let* ((evt (org-trim
(replace-regexp-in-string
org-bracket-link-regexp "\\3"
org-link-bracket-re "\\3"
(or (get-text-property 1 'txt x) ""))))
(cat (get-text-property (1- (length x)) 'org-category x))
(tod (get-text-property 1 'time-of-day x))

View File

@ -93,7 +93,7 @@
;;
;;; Code:
(require 'org)
(require 'ol)
(require 'cl-lib)
;; Declare external functions and variables
@ -230,7 +230,7 @@ date year)."
(bbdb-record-getprop rec 'company)
(car (bbdb-record-field rec 'organization))))
(link (concat "bbdb:" name)))
(org-store-link-props :type "bbdb" :name name :company company
(org-link-store-props :type "bbdb" :name name :company company
:link link :description name)
link)))

View File

@ -107,7 +107,7 @@
;;; Code:
(require 'org)
(require 'ol)
(require 'bibtex)
(require 'cl-lib)
(require 'org-compat)
@ -488,7 +488,7 @@ With optional argument OPTIONAL, also prompt for optional fields."
(save-excursion
(bibtex-beginning-of-entry)
(bibtex-parse-entry)))))
(org-store-link-props
(org-link-store-props
:key (cdr (assoc "=key=" entry))
:author (or (cdr (assoc "author" entry)) "[no author]")
:editor (or (cdr (assoc "editor" entry)) "[no editor]")

View File

@ -54,7 +54,12 @@
(declare-function org-clock-update-mode-line "org-clock" (&optional refresh))
(declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction))
(declare-function org-decrypt-entry "org-crypt" ())
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-lineage "org-element" (datum &optional types with-self))
(declare-function org-element-property "org-element" (property element))
(declare-function org-encrypt-entry "org-crypt" ())
(declare-function org-insert-link "ol" (&optional complete-file link-location default-description))
(declare-function org-link-make-string "ol" (link &optional description))
(declare-function org-table-analyze "org-table" ())
(declare-function org-table-current-dline "org-table" ())
(declare-function org-table-fix-formulas "org-table" (key replace &optional limit delta remove))
@ -64,6 +69,7 @@
(defvar org-end-time-was-given)
(defvar org-remember-default-headline)
(defvar org-remember-templates)
(defvar org-store-link-plist)
(defvar org-table-border-regexp)
(defvar org-table-current-begin-pos)
(defvar org-table-fix-formulas-confirm)
@ -1593,7 +1599,7 @@ The template may still contain \"%?\" for cursor positioning."
(org-no-properties org-clock-heading)
""))
(v-K (if (marker-buffer org-clock-marker)
(org-make-link-string
(org-link-make-string
(format "%s::*%s"
(buffer-file-name (marker-buffer org-clock-marker))
v-k)

View File

@ -35,14 +35,17 @@
(declare-function notifications-notify "notifications" (&rest params))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
(declare-function org-link-display-format "ol" (s))
(declare-function org-link-heading-search-string "ol" (&optional string))
(declare-function org-link-make-string "ol" (link &optional description))
(declare-function org-table-goto-line "org-table" (n))
(declare-function org-dynamic-block-define "org" (type func))
(defvar org-frame-title-format-backup frame-title-format)
(defvar org-state)
(defvar org-link-bracket-re)
(defvar org-time-stamp-formats)
(defgroup org-clock nil
"Options concerning clocking working time in Org mode."
:tag "Org Clock"
@ -2616,7 +2619,7 @@ from the dynamic block definition."
(when narrow-cut-p
(setq headline
(if (and (string-match
(format "\\`%s\\'" org-bracket-link-regexp)
(format "\\`%s\\'" org-link-bracket-re)
headline)
(match-end 3))
(format "[[%s][%s]]"
@ -2854,8 +2857,8 @@ PROPERTIES: The list properties specified in the `:properties' parameter
(hdl
(if (not link) headline
(let ((search
(org-make-org-heading-search-string headline)))
(org-make-link-string
(org-link-heading-search-string headline)))
(org-link-make-string
(if (not (buffer-file-name)) search
(format "file:%s::%s" (buffer-file-name) search))
;; Prune statistics cookies. Replace

View File

@ -42,6 +42,8 @@
(declare-function org-element-restriction "org-element" (element))
(declare-function org-element-type "org-element" (element))
(declare-function org-dynamic-block-define "org" (type func))
(declare-function org-link-display-format "ol" (s))
(declare-function org-link-open-from-string "ol" (s &optional arg))
(defvar org-agenda-columns-add-appointments-to-effort-sum)
(defvar org-agenda-columns-compute-summary-properties)
@ -763,7 +765,7 @@ around it."
(defun org-columns-open-link (&optional arg)
(interactive "P")
(let ((value (get-char-property (point) 'org-columns-value)))
(org-open-link-from-string value arg)))
(org-link-open-from-string value arg)))
;;;###autoload
(defun org-columns-get-format-and-top-level ()

View File

@ -47,7 +47,7 @@
(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment))
(declare-function org-get-tags "org" (&optional pos local))
(declare-function org-link-display-format "org" (s))
(declare-function org-link-set-parameters "org" (type &rest rest))
(declare-function org-link-set-parameters "ol" (type &rest rest))
(declare-function org-log-into-drawer "org" ())
(declare-function org-make-tag-string "org" (tags))
(declare-function org-reduced-level "org" (l))
@ -447,6 +447,87 @@ use of this function is for the stuck project list."
(define-obsolete-variable-alias 'org-agenda-overriding-columns-format
'org-overriding-columns-format "Org 9.2.2")
(define-obsolete-variable-alias 'org-doi-server-url
'org-link-doi-server-url "Org 9.3")
(define-obsolete-variable-alias 'org-email-link-description-format
'org-link-email-description-format "Org 9.3")
(define-obsolete-variable-alias 'org-make-link-description-function
'org-link-make-description-function "Org 9.3")
(define-obsolete-variable-alias 'org-from-is-user-regexp
'org-link-from-user-regexp "Org 9.3")
(define-obsolete-variable-alias 'org-descriptive-links
'org-link-descriptive "Org 9.3")
(define-obsolete-variable-alias 'org-url-hexify-p
'org-link-url-hexify "Org 9.3")
(define-obsolete-variable-alias 'org-context-in-file-links
'org-link-context-for-files "Org 9.3")
(define-obsolete-variable-alias 'org-keep-stored-link-after-insertion
'org-link-keep-stored-after-insertion "Org 9.3")
(define-obsolete-variable-alias 'org-display-internal-link-with-indirect-buffer
'org-link-use-indirect-buffer-for-internals "Org 9.3")
(define-obsolete-variable-alias 'org-confirm-shell-link-function
'org-link-shell-confirm-function "Org 9.3")
(define-obsolete-variable-alias 'org-confirm-shell-link-not-regexp
'org-link-shell-skip-confirm-regexp "Org 9.3")
(define-obsolete-variable-alias 'org-confirm-elisp-link-function
'org-link-elisp-confirm-function "Org 9.3")
(define-obsolete-variable-alias 'org-confirm-elisp-link-not-regexp
'org-link-elisp-skip-confirm-regexp "Org 9.3")
(define-obsolete-function-alias 'org-file-complete-link
'org-link-complete-file "Org 9.3")
(define-obsolete-function-alias 'org-email-link-description
'org-link-email-description "Org 9.3")
(define-obsolete-function-alias 'org-make-link-string
'org-link-make-string "Org 9.3")
(define-obsolete-function-alias 'org-store-link-props
'org-link-store-props "Org 9.3")
(define-obsolete-function-alias 'org-add-link-props
'org-link-add-props "Org 9.3")
(define-obsolete-function-alias 'org-make-org-heading-search-string
'org-link-heading-search-string "Org 9.3")
(define-obsolete-function-alias 'org-make-link-regexps
'org-link-make-regexps "Org 9.3")
(define-obsolete-variable-alias 'org-angle-link-re
'org-link-angle-re "Org 9.3")
(define-obsolete-variable-alias 'org-plain-link-re
'org-link-plain-re "Org 9.3")
(define-obsolete-variable-alias 'org-bracket-link-regexp
'org-link-bracket-re "Org 9.3")
(define-obsolete-variable-alias 'org-bracket-link-analytic-regexp
'org-link-analytic-bracket-re "Org 9.3")
(define-obsolete-variable-alias 'org-any-link-re
'org-link-any-re "Org 9.3")
(define-obsolete-function-alias 'org-open-link-from-string
'org-link-open-from-string "Org 9.3")
(define-obsolete-function-alias 'org-add-angle-brackets
'org-link-add-angle-brackets "Org 9.3")
;; The function was made obsolete by commit 65399674d5 of 2013-02-22.
;; This make-obsolete call was added 2016-09-01.
(make-obsolete 'org-capture-import-remember-templates
@ -496,7 +577,7 @@ use of this function is for the stuck project list."
;;;; Obsolete link types
(eval-after-load 'org
(eval-after-load 'ol
'(progn
(org-link-set-parameters "file+emacs") ;since Org 9.0
(org-link-set-parameters "file+sys"))) ;since Org 9.0

View File

@ -43,7 +43,7 @@
;;; Code:
(require 'org)
(require 'ol)
(require 'doc-view)
(declare-function doc-view-goto-page "doc-view" (page))
@ -84,7 +84,7 @@
(let* ((path buffer-file-name)
(page (image-mode-window-get 'page))
(link (concat "docview:" path "::" (number-to-string page))))
(org-store-link-props
(org-link-store-props
:type "docview"
:link link
:description path))))
@ -93,7 +93,7 @@
"Use the existing file name completion for file.
Links to get the file name, then ask the user for the page number
and append it."
(concat (replace-regexp-in-string "^file:" "docview:" (org-file-complete-link))
(concat (replace-regexp-in-string "^file:" "docview:" (org-link-complete-file))
"::"
(read-from-minibuffer "Page:" "1")))

View File

@ -62,6 +62,16 @@
(require 'avl-tree)
(require 'cl-lib)
(declare-function org-link-expand-abbrev "ol" (link))
(declare-function org-link-types "ol" ())
(declare-function org-link-unescape "ol" (str))
(defvar org-link-translation-function)
(defvar org-link-types-re)
(defvar org-link-angle-re)
(defvar org-link-plain-re)
(defvar org-link-bracket-re)
;;; Definitions And Rules
@ -3097,7 +3107,7 @@ Assume point is at the beginning of the link."
(setq contents-begin (match-beginning 1))
(setq contents-end (match-end 1)))
;; Type 2: Standard link, i.e. [[https://orgmode.org][homepage]]
((looking-at org-bracket-link-regexp)
((looking-at org-link-bracket-re)
(setq format 'bracket)
(setq contents-begin (match-beginning 3))
(setq contents-end (match-end 3))
@ -3147,7 +3157,7 @@ Assume point is at the beginning of the link."
(setq type "fuzzy")
(setq path raw-link))))
;; Type 3: Plain link, e.g., https://orgmode.org
((looking-at org-plain-link-re)
((looking-at org-link-plain-re)
(setq format 'plain)
(setq raw-link (match-string-no-properties 0))
(setq type (match-string-no-properties 1))
@ -3156,7 +3166,7 @@ Assume point is at the beginning of the link."
;; Type 4: Angular link, e.g., <https://orgmode.org>. Unlike to
;; bracket links, follow RFC 3986 and remove any extra
;; whitespace in URI.
((looking-at org-angle-link-re)
((looking-at org-link-angle-re)
(setq format 'angle)
(setq type (match-string-no-properties 1))
(setq link-end (match-end 0))

View File

@ -23,9 +23,9 @@
;;; Code:
(require 'org)
(require 'eshell)
(require 'esh-mode)
(require 'ol)
(org-link-set-parameters "eshell"
:follow #'org-eshell-open
@ -57,7 +57,7 @@
(when (eq major-mode 'eshell-mode)
(let* ((command (concat "cd " dired-directory))
(link (concat (buffer-name) ":" command)))
(org-store-link-props
(org-link-store-props
:link (concat "eshell:" link)
:description command))))

View File

@ -44,7 +44,7 @@
;;; Code:
(require 'org)
(require 'ol)
(require 'cl-lib)
(defvar eww-current-title)
@ -60,7 +60,7 @@
(defun org-eww-store-link ()
"Store a link to the url of an EWW buffer."
(when (eq major-mode 'eww-mode)
(org-store-link-props
(org-link-store-props
:type "eww"
:link (if (< emacs-major-version 25)
eww-current-url
@ -93,7 +93,7 @@ Otherwise point is not moved. Return point."
(defun org-eww-copy-for-org-mode ()
"Copy current buffer content or active region with `org-mode' style links.
This will encode `link-title' and `link-location' with
`org-make-link-string' and insert the transformed text into the
`org-link-make-string' and insert the transformed text into the
kill ring, so that it can be yanked into an Org mode buffer with
links working correctly.
@ -144,7 +144,7 @@ keep the structure of the Org file."
(if (org-string-nw-p link-location)
;; Hint: link-location is different
;; for form-elements.
(org-make-link-string link-location link-title)
(org-link-make-string link-location link-title)
link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t))) ; for break out `while' loop

View File

@ -56,7 +56,7 @@
(defvar electric-indent-mode)
(defvar org-blank-before-new-entry) ; defined in org.el
(defvar org-bracket-link-regexp) ; defined in org.el
(defvar org-link-bracket-re) ; defined in org.el
(defvar org-complex-heading-regexp) ; defined in org.el
(defvar org-odd-levels-only) ; defined in org.el
(defvar org-outline-regexp) ; defined in org.el
@ -489,7 +489,7 @@ This function is meant to be used for fontification only."
(goto-char beg)
(let ((linkp
(save-match-data
(org-in-regexp org-bracket-link-regexp))))
(org-in-regexp org-link-bracket-re))))
(and linkp (< (point) (cdr linkp))))))
;; Verify point doesn't belong to a LaTeX macro.
(not (org-inside-latex-macro-p))

View File

@ -35,7 +35,7 @@
(require 'gnus-util)
(require 'nnheader)
(require 'nnir)
(require 'org)
(require 'ol)
;;; Declare external functions and variables
@ -104,6 +104,7 @@ If `org-store-link' was called with a prefix arg the meaning of
(defun org-gnus-article-link (group newsgroups message-id x-no-archive)
"Create a link to a Gnus article.
The article is specified by its MESSAGE-ID. Additional
parameters are the Gnus GROUP, the NEWSGROUPS the article was
posted to and the X-NO-ARCHIVE header value of that article.
@ -115,12 +116,12 @@ Otherwise create a link to the article inside Gnus.
If `org-store-link' was called with a prefix arg the meaning of
`org-gnus-prefer-web-links' is reversed."
(if (and (org-xor current-prefix-arg org-gnus-prefer-web-links)
newsgroups ;; Make web links only for nntp groups
(not x-no-archive)) ;; and if X-No-Archive isn't set.
(format (if (string-match "gmane\\." newsgroups)
newsgroups ;make web links only for nntp groups
(not x-no-archive)) ;and if X-No-Archive isn't set
(format (if (string-match-p "gmane\\." newsgroups)
"http://mid.gmane.org/%s"
"http://groups.google.com/groups/search?as_umsgid=%s")
(org-fixup-message-id-for-http message-id))
(url-encode-url message-id))
(concat "gnus:" group "#" message-id)))
(defun org-gnus-store-link ()
@ -129,9 +130,9 @@ If `org-store-link' was called with a prefix arg the meaning of
(`gnus-group-mode
(let ((group (gnus-group-group-name)))
(when group
(org-store-link-props :type "gnus" :group group)
(org-link-store-props :type "gnus" :group group)
(let ((description (org-gnus-group-link group)))
(org-add-link-props :link description :description description)
(org-link-add-props :link description :description description)
description))))
((or `gnus-summary-mode `gnus-article-mode)
(let* ((group
@ -169,12 +170,12 @@ If `org-store-link' was called with a prefix arg the meaning of
(setq to (or to (gnus-fetch-original-field "To")))
(setq newsgroups (gnus-fetch-original-field "Newsgroups"))
(setq x-no-archive (gnus-fetch-original-field "x-no-archive")))
(org-store-link-props :type "gnus" :from from :date date :subject subject
(org-link-store-props :type "gnus" :from from :date date :subject subject
:message-id message-id :group group :to to)
(let ((link (org-gnus-article-link
group newsgroups message-id x-no-archive))
(description (org-email-link-description)))
(org-add-link-props :link link :description description)
(description (org-link-email-description)))
(org-link-add-props :link link :description description)
link)))
(`message-mode
(setq org-store-link-plist nil) ;reset
@ -197,11 +198,11 @@ If `org-store-link' was called with a prefix arg the meaning of
(subject (mail-fetch-field "Subject"))
newsgroup xarchive) ;those are always nil for gcc
(unless gcc (error "Can not create link: No Gcc header found"))
(org-store-link-props :type "gnus" :from from :subject subject
(org-link-store-props :type "gnus" :from from :subject subject
:message-id id :group gcc :to to)
(let ((link (org-gnus-article-link gcc newsgroup id xarchive))
(description (org-email-link-description)))
(org-add-link-props :link link :description description)
(description (org-link-email-description)))
(org-link-add-props :link link :description description)
link)))))))
(defun org-gnus-open-nntp (path)

View File

@ -71,9 +71,11 @@
;;; Code:
(require 'org)
(require 'ol)
(declare-function message-make-fqdn "message" ())
(declare-function org-goto-location "org-goto" (&optional _buf help))
(declare-function org-link-set-parameters "ol" (type &rest rest))
;;; Customization
@ -648,7 +650,7 @@ optional argument MARKERP, return the position as a new marker."
(match-string 4)
(match-string 0)))
link))))
(org-store-link-props :link link :description desc :type "id")
(org-link-store-props :link link :description desc :type "id")
link)))
(defun org-id-open (id)

View File

@ -30,7 +30,7 @@
;;; Code:
(require 'org)
(require 'ol)
;; Declare external functions and variables
@ -54,7 +54,7 @@
"#" Info-current-node))
(desc (concat (file-name-nondirectory Info-current-file)
"#" Info-current-node)))
(org-store-link-props :type "info" :file Info-current-file
(org-link-store-props :type "info" :file Info-current-file
:node Info-current-node
:link link :desc desc)
link)))

View File

@ -48,7 +48,7 @@
;;; Code:
(require 'org)
(require 'ol)
(declare-function erc-buffer-filter "erc" (predicate &optional proc))
(declare-function erc-channel-p "erc" (channel))
@ -155,7 +155,7 @@ the session itself."
(parsed-line (org-irc-erc-get-line-from-log erc-line)))
(if (erc-logging-enabled nil)
(progn
(org-store-link-props
(org-link-store-props
:type "file"
:description (concat "'" (org-irc-ellipsify-description
(cadr parsed-line) 20)
@ -168,7 +168,7 @@ the session itself."
(link (org-irc-parse-link link-text)))
(if link-text
(progn
(org-store-link-props
(org-link-store-props
:type "irc"
:link (concat "irc:/" link-text)
:description (concat "irc session `" link-text "'")

View File

@ -106,10 +106,11 @@
;;; Code:
(require 'cl-lib)
(require 'ob)
(require 'ol)
(require 'org-element)
(require 'org-macro)
(require 'ox)
(require 'ob)
;;; Checkers
@ -606,14 +607,13 @@ Use :header-args: instead"
"Non-existent file argument in INCLUDE keyword")
(let* ((visiting (if file (find-buffer-visiting file)
(current-buffer)))
(buffer (or visiting (find-file-noselect file))))
(buffer (or visiting (find-file-noselect file)))
(org-link-search-must-match-exact-headline t))
(unwind-protect
(with-current-buffer buffer
(when (and search
(not
(ignore-errors
(let ((org-link-search-inhibit-query t))
(org-link-search search nil t)))))
(not (ignore-errors
(org-link-search search nil t))))
(list (org-element-property :post-affiliated k)
(format
"Invalid search part \"%s\" in INCLUDE keyword"

View File

@ -31,7 +31,7 @@
;;; Code:
(require 'org-macs)
(require 'org)
(require 'ol)
;; Customization variables
@ -88,12 +88,12 @@ supported by MH-E."
(subject (org-mhe-get-header "Subject:"))
(date (org-mhe-get-header "Date:"))
link desc)
(org-store-link-props :type "mh" :from from :to to :date date
(org-link-store-props :type "mh" :from from :to to :date date
:subject subject :message-id message-id)
(setq desc (org-email-link-description))
(setq desc (org-link-email-description))
(setq link (concat "mhe:" (org-mhe-get-message-real-folder) "#"
(org-unbracket-string "<" ">" message-id)))
(org-add-link-props :link link :description desc)
(org-link-add-props :link link :description desc)
link))))
(defun org-mhe-open (path)
@ -199,7 +199,7 @@ folders."
(mh-search-choose)
(if (eq mh-searcher 'pick)
(progn
(setq article (org-add-angle-brackets article))
(setq article (org-link-add-angle-brackets article))
(mh-search folder (list "--message-id" article))
(when (and org-mhe-search-all-folders
(not (org-mhe-get-message-real-folder)))

View File

@ -35,6 +35,9 @@
(require 'org-agenda)
(require 'cl-lib)
(declare-function org-link-escape "ol" (text &optional table merge))
(declare-function org-link-unescape "ol" (str))
(defvar org-agenda-keep-restricted-file-list)
;;; Code:

View File

@ -44,7 +44,7 @@
(declare-function org-get-export-keywords "org" ())
(declare-function org-get-heading "org" (&optional no-tags no-todo no-priority no-comment))
(declare-function org-get-tags "org" (&optional pos local))
(declare-function org-make-org-heading-search-string "org" (&optional string))
(declare-function org-link-heading-search-string "ol" (&optional string))
(declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
(defvar org-current-tag-alist)
@ -352,8 +352,7 @@ This needs more work, to handle headings with lots of spaces in them."
(goto-char (point-min))
(let (tbl)
(while (re-search-forward org-outline-regexp nil t)
(push (org-make-org-heading-search-string
(org-get-heading t t t t))
(push (org-link-heading-search-string (org-get-heading t t t t))
tbl))
(pcomplete-uniquify-list tbl)))
;; When completing a bracketed link, i.e., "[[*", argument

View File

@ -116,6 +116,7 @@
;;; Code:
(require 'org)
(require 'ol)
(declare-function org-publish-get-project-from-filename "ox-publish"
(filename &optional up))
@ -489,12 +490,12 @@ Now template ?b will be used."
(region (or (plist-get parts :body) ""))
(orglink
(if (null url) title
(org-make-link-string url (or (org-string-nw-p title) url))))
(org-link-make-string url (or (org-string-nw-p title) url))))
;; Avoid call to `org-store-link'.
(org-capture-link-is-already-stored t))
;; Only store link if there's a URL to insert later on.
(when url (push (list url title) org-stored-links))
(org-store-link-props :type type
(org-link-store-props :type type
:link url
:description title
:annotation orglink

View File

@ -30,7 +30,7 @@
;;; Code:
(require 'org)
(require 'ol)
;; Declare external functions and variables
(declare-function rmail-show-message "rmail" (&optional n no-summary))
@ -65,13 +65,13 @@
(subject (mail-fetch-field "subject"))
(date (mail-fetch-field "date"))
desc link)
(org-store-link-props
(org-link-store-props
:type "rmail" :from from :to to :date date
:subject subject :message-id message-id)
(setq message-id (org-unbracket-string "<" ">" message-id))
(setq desc (org-email-link-description))
(setq desc (org-link-email-description))
(setq link (concat "rmail:" folder "#" message-id))
(org-add-link-props :link link :description desc)
(org-link-add-props :link link :description desc)
(rmail-show-message rmail-current-message)
link)))))
@ -89,7 +89,7 @@
(require 'rmail)
(cond ((null article) (setq article ""))
((stringp article)
(setq article (org-add-angle-brackets article)))
(setq article (org-link-add-angle-brackets article)))
(t (user-error "Wrong RMAIL link format")))
(let (message-number)
(save-excursion

View File

@ -41,7 +41,7 @@
;;; Code:
(require 'org)
(require 'ol)
(defvar w3m-current-url)
(defvar w3m-current-title)
@ -50,7 +50,7 @@
(defun org-w3m-store-link ()
"Store a link to a w3m buffer."
(when (eq major-mode 'w3m-mode)
(org-store-link-props
(org-link-store-props
:type "w3m"
:link w3m-current-url
:url (url-view-url t)
@ -59,7 +59,7 @@
(defun org-w3m-copy-for-org-mode ()
"Copy current buffer content or active region with Org style links.
This will encode `link-title' and `link-location' with
`org-make-link-string', and insert the transformed test into the kill ring,
`org-link-make-string', and insert the transformed test into the kill ring,
so that it can be yanked into an Org buffer with links working correctly."
(interactive)
(let* ((regionp (org-region-active-p))
@ -98,7 +98,7 @@ so that it can be yanked into an Org buffer with links working correctly."
(setq return-content
(concat return-content
(if (org-string-nw-p link-location)
(org-make-link-string link-location link-title)
(org-link-make-string link-location link-title)
link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t))) ; for break out `while' loop

File diff suppressed because it is too large Load Diff

View File

@ -73,6 +73,7 @@
(require 'cl-lib)
(require 'ob-exp)
(require 'ol)
(require 'org-element)
(require 'org-macro)
(require 'tabulated-list)
@ -3531,8 +3532,8 @@ is to happen."
(goto-char (point-min))
(unless (eq major-mode 'org-mode)
(let ((org-inhibit-startup t)) (org-mode))) ;set regexps
(let ((regexp (concat org-plain-link-re "\\|" org-angle-link-re)))
(while (re-search-forward org-any-link-re nil t)
(let ((regexp (concat org-link-plain-re "\\|" org-link-angle-re)))
(while (re-search-forward org-link-any-re nil t)
(let ((link (save-excursion
(forward-char -1)
(save-match-data (org-element-context)))))
@ -4257,8 +4258,8 @@ structure of RULES.
Return modified DATA."
(let ((link-re (format "\\`\\(?:%s\\|%s\\)\\'"
org-plain-link-re
org-angle-link-re))
org-link-plain-re
org-link-angle-re))
(case-fold-search t))
(org-element-map data 'link
(lambda (l)