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

View File

@ -19625,7 +19625,7 @@ boundaries."
(org-with-wide-buffer (org-with-wide-buffer
(goto-char (or beg (point-min))) (goto-char (or beg (point-min)))
(let ((case-fold-search t) (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) (while (re-search-forward "[][]\\[\\(?:file\\|[./~]\\)" end t)
(let ((link (save-match-data (org-element-context)))) (let ((link (save-match-data (org-element-context))))
;; Check if we're at an inline image. ;; Check if we're at an inline image.
@ -22773,26 +22773,15 @@ not an indirect buffer."
(or (buffer-base-buffer buf) buf) (or (buffer-base-buffer buf) buf)
nil))) nil)))
(defun org-image-file-name-regexp (&optional extensions) (define-obsolete-function-alias 'org-image-file-name-regexp 'image-file-name-regexp
"Return regexp matching the file names of images. "Org 9.0")
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)
"\\'"))))
(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." "Return non-nil if FILE is an image."
(save-match-data (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) (defun org-get-cursor-date (&optional with-time)
"Return the date at cursor in as a time. "Return the date at cursor in as a time.