From 861b6b1bd07b6ceeef0aa3b5185d77f09ba955eb Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Fri, 6 Nov 2015 12:27:28 +0000 Subject: [PATCH] =?UTF-8?q?org.el:=20Obsolete=20=E2=80=98org-image-file-na?= =?UTF-8?q?me-regexp=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/org.el (org-image-file-name-regexp): Make obsolete. Change callers. --- contrib/lisp/org-screenshot.el | 10 +++++----- lisp/org.el | 25 +++++++------------------ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/contrib/lisp/org-screenshot.el b/contrib/lisp/org-screenshot.el index 6d1078375..3c59df938 100644 --- a/contrib/lisp/org-screenshot.el +++ b/contrib/lisp/org-screenshot.el @@ -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) diff --git a/lisp/org.el b/lisp/org.el index a70fe01fd..1184484e4 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -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.