org.el: Obsolete ‘org-image-file-name-regexp’

* lisp/org.el (org-image-file-name-regexp): Make obsolete.  Change
callers.
This commit is contained in:
Aaron Ecay 2015-11-06 12:27:28 +00:00
parent d29d9a029c
commit 861b6b1bd0
2 changed files with 12 additions and 23 deletions

View File

@ -339,8 +339,8 @@ by most recent first"
org-screenshot-rotation-index -1
org-screenshot-file-list
(let ((files (directory-files org-screenshot-image-directory
t (org-image-file-name-regexp) t)))
(mapcar 'file-name-nondirectory
t (image-file-name-regexp) t)))
(mapcar 'file-name-nondirectory
(sort files
(lambda (file1 file2)
(let ((mtime1 (nth 5 (file-attributes file1)))
@ -365,7 +365,7 @@ other direction"
(link-re
;; taken from `org-display-inline-images'
(concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?"
(substring (org-image-file-name-regexp) 0 -2)
(substring (image-file-name-regexp) 0 -2)
"\\)\\]"))
newfile oldfile)
(save-excursion
@ -497,7 +497,7 @@ entered, at which point event will be unread"
(let ((files-in-buffer)
dired-buffer
had-any
(image-re (org-image-file-name-regexp))
(image-re (image-file-name-regexp))
beg end)
(save-excursion
(save-restriction
@ -505,7 +505,7 @@ entered, at which point event will be unread"
(setq beg (or beg (point-min)) end (or end (point-max)))
(goto-char beg)
(let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?"
(substring (org-image-file-name-regexp) 0 -2)
(substring (image-file-name-regexp) 0 -2)
"\\)\\]"))
(case-fold-search t)
old file ov img type attrwidth width)

View File

@ -19625,7 +19625,7 @@ boundaries."
(org-with-wide-buffer
(goto-char (or beg (point-min)))
(let ((case-fold-search t)
(file-extension-re (org-image-file-name-regexp)))
(file-extension-re (image-file-name-regexp)))
(while (re-search-forward "[][]\\[\\(?:file\\|[./~]\\)" end t)
(let ((link (save-match-data (org-element-context))))
;; Check if we're at an inline image.
@ -22773,26 +22773,15 @@ not an indirect buffer."
(or (buffer-base-buffer buf) buf)
nil)))
(defun org-image-file-name-regexp (&optional extensions)
"Return regexp matching the file names of images.
If EXTENSIONS is given, only match these."
(if (and (not extensions) (fboundp 'image-file-name-regexp))
(image-file-name-regexp)
(let ((image-file-name-extensions
(or extensions
'("png" "jpeg" "jpg" "gif" "tiff" "tif"
"xbm" "xpm" "pbm" "pgm" "ppm"))))
(concat "\\."
(regexp-opt (nconc (mapcar 'upcase
image-file-name-extensions)
image-file-name-extensions)
t)
"\\'"))))
(define-obsolete-function-alias 'org-image-file-name-regexp 'image-file-name-regexp
"Org 9.0")
(defun org-file-image-p (file &optional extensions)
;;; TODO: Only called once, from ox-odt which should probably use
;;; org-export-inline-image-p or something.
(defun org-file-image-p (file)
"Return non-nil if FILE is an image."
(save-match-data
(string-match (org-image-file-name-regexp extensions) file)))
(string-match (image-file-name-regexp) file)))
(defun org-get-cursor-date (&optional with-time)
"Return the date at cursor in as a time.