mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2025-01-11 16:08:15 +00:00
Move org-file-url-p' to "org-macs.el", rename it to
org-url-p'
* lisp/org-macs.el (org-url-p): New function. * lisp/org-compat.el (org-file-url-p): Make obsolete alias for function above. * lisp/org-lint.el (org-lint-non-existent-setupfile-parameter): * lisp/org.el (org--collect-keywords-1): (org-file-contents): (org-edit-special): Use new function.
This commit is contained in:
parent
0c85c8d7ed
commit
6de34f2891
@ -361,6 +361,8 @@ Counting starts at 1."
|
||||
(make-obsolete 'org-attach-store-link "No longer used" "9.4")
|
||||
(make-obsolete 'org-attach-expand-link "No longer used" "9.4")
|
||||
|
||||
(define-obsolete-function-alias 'org-file-url-p 'org-url-p "9.5")
|
||||
|
||||
(defun org-in-fixed-width-region-p ()
|
||||
"Non-nil if point in a fixed-width region."
|
||||
(save-match-data
|
||||
|
@ -593,7 +593,7 @@ in description"
|
||||
(let ((file (org-unbracket-string
|
||||
"\"" "\""
|
||||
(org-element-property :value k))))
|
||||
(and (not (org-file-url-p file))
|
||||
(and (not (org-url-p file))
|
||||
(not (file-remote-p file))
|
||||
(not (file-exists-p file))
|
||||
(list (org-element-property :begin k)
|
||||
|
@ -61,7 +61,6 @@
|
||||
(declare-function org-element-type "org-element" (element))
|
||||
(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
|
||||
(declare-function org-file-contents "org" (file &optional noerror nocache))
|
||||
(declare-function org-file-url-p "org" (file))
|
||||
(declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
|
||||
(declare-function org-link-search "ol" (s &optional avoid-pos stealth))
|
||||
(declare-function org-mode "org" ())
|
||||
|
@ -39,6 +39,7 @@
|
||||
(declare-function org-string-collate-lessp "org-compat" (s1 s2 &optional locale ignore-case))
|
||||
|
||||
(defvar org-ts-regexp0)
|
||||
(defvar ffap-url-regexp)
|
||||
|
||||
|
||||
;;; Macros
|
||||
@ -807,6 +808,10 @@ return nil."
|
||||
(list context (match-beginning group) (match-end group))
|
||||
t)))
|
||||
|
||||
(defun org-url-p (s)
|
||||
"Non-nil if string S is a URL."
|
||||
(require 'ffap)
|
||||
(string-match-p ffap-url-regexp s))
|
||||
|
||||
|
||||
;;; String manipulation
|
||||
|
12
lisp/org.el
12
lisp/org.el
@ -191,7 +191,6 @@ Stars are put in group 1 and the trimmed body in group 2.")
|
||||
(declare-function org-toggle-archive-tag "org-archive" (&optional find-done))
|
||||
(declare-function org-update-radio-target-regexp "ol" ())
|
||||
|
||||
(defvar ffap-url-regexp)
|
||||
(defvar org-element-paragraph-separate)
|
||||
(defvar org-indent-indentation-per-level)
|
||||
(defvar org-radio-target-regexp)
|
||||
@ -4539,7 +4538,7 @@ directory."
|
||||
(when (and (org-string-nw-p value)
|
||||
(not buffer-read-only)) ;FIXME: bug in Gnus?
|
||||
(let* ((uri (org-strip-quotes value))
|
||||
(uri-is-url (org-file-url-p uri))
|
||||
(uri-is-url (org-url-p uri))
|
||||
(uri (if uri-is-url
|
||||
uri
|
||||
(expand-file-name uri))))
|
||||
@ -4669,11 +4668,6 @@ This is the cache of file URLs read using `org-file-contents'.")
|
||||
"Reset the cache of files downloaded by `org-file-contents'."
|
||||
(clrhash org--file-cache))
|
||||
|
||||
(defun org-file-url-p (file)
|
||||
"Non-nil if FILE is a URL."
|
||||
(require 'ffap)
|
||||
(string-match-p ffap-url-regexp file))
|
||||
|
||||
(defun org-file-contents (file &optional noerror nocache)
|
||||
"Return the contents of FILE, as a string.
|
||||
|
||||
@ -4688,7 +4682,7 @@ from file or URL, and return nil.
|
||||
|
||||
If NOCACHE is non-nil, do a fresh fetch of FILE even if cached version
|
||||
is available. This option applies only if FILE is a URL."
|
||||
(let* ((is-url (org-file-url-p file))
|
||||
(let* ((is-url (org-url-p file))
|
||||
(cache (and is-url
|
||||
(not nocache)
|
||||
(gethash file org--file-cache))))
|
||||
@ -17555,7 +17549,7 @@ Otherwise, return a user error."
|
||||
(let ((file (and (string-match "\\`\"\\(.*?\\)\"\\|\\S-+" value)
|
||||
(or (match-string 1 value)
|
||||
(match-string 0 value)))))
|
||||
(when (org-file-url-p file)
|
||||
(when (org-url-p file)
|
||||
(user-error "Files located with a URL cannot be edited"))
|
||||
(org-link-open-from-string
|
||||
(format "[[%s]]" (expand-file-name file))))))
|
||||
|
Loading…
Reference in New Issue
Block a user