org-compat: Silence byte-compiler

This commit is contained in:
Nicolas Goaziou 2016-12-22 13:16:30 +01:00
parent 1ddadefd37
commit 7a90187fb1
1 changed files with 79 additions and 79 deletions

View File

@ -57,9 +57,9 @@
(defalias 'outline-show-subtree 'show-subtree) (defalias 'outline-show-subtree 'show-subtree)
(defalias 'xref-find-definitions 'find-tag) (defalias 'xref-find-definitions 'find-tag)
(defalias 'format-message 'format) (defalias 'format-message 'format)
(defalias 'gui-get-selection 'x-get-selection) (defalias 'gui-get-selection 'x-get-selection))
;; From "files.el" (unless (fboundp 'directory-name-p)
(defun directory-name-p (name) (defun directory-name-p (name)
"Return non-nil if NAME ends with a directory separator character." "Return non-nil if NAME ends with a directory separator character."
(let ((len (length name)) (let ((len (length name))
@ -68,9 +68,9 @@
(setq lastc (aref name (1- len)))) (setq lastc (aref name (1- len))))
(or (= lastc ?/) (or (= lastc ?/)
(and (memq system-type '(windows-nt ms-dos)) (and (memq system-type '(windows-nt ms-dos))
(= lastc ?\\))))) (= lastc ?\\))))))
;; From "files.el" (unless (fboundp 'directory-files-recursively)
(defun directory-files-recursively (dir regexp &optional include-directories) (defun directory-files-recursively (dir regexp &optional include-directories)
"Return list of all files under DIR that have file names matching REGEXP. "Return list of all files under DIR that have file names matching REGEXP.
This function works recursively. Files are returned in \"depth first\" This function works recursively. Files are returned in \"depth first\"
@ -124,7 +124,7 @@ output directories whose names match REGEXP."
(defmacro org-re (s) (defmacro org-re (s)
"Replace posix classes in regular expression S." "Replace posix classes in regular expression S."
(declare (debug (form)) (declare (debug (form))
(obsolete "you can safely remove it." "Org 9.0")) (obsolete "you can safely remove it." "Org 9.0"))
s) s)
;;;; Functions from cl-lib that Org used to have its own implementation of. ;;;; Functions from cl-lib that Org used to have its own implementation of.
@ -142,8 +142,8 @@ output directories whose names match REGEXP."
Counting starts at 1." Counting starts at 1."
(cl-subseq list (1- start) end)) (cl-subseq list (1- start) end))
(make-obsolete 'org-sublist (make-obsolete 'org-sublist
"use cl-subseq (note the 0-based counting)." "use cl-subseq (note the 0-based counting)."
"Org 9.0") "Org 9.0")
;;;; Functions available since Emacs 24.3 ;;;; Functions available since Emacs 24.3
@ -168,7 +168,7 @@ Counting starts at 1."
(define-obsolete-variable-alias 'org-latex-create-formula-image-program (define-obsolete-variable-alias 'org-latex-create-formula-image-program
'org-preview-latex-default-process "Org 9.0") 'org-preview-latex-default-process "Org 9.0")
(define-obsolete-variable-alias 'org-latex-preview-ltxpng-directory (define-obsolete-variable-alias 'org-latex-preview-ltxpng-directory
'org-preview-latex-image-directory "Org 9.0") 'org-preview-latex-image-directory "Org 9.0")
(define-obsolete-function-alias 'org-table-p 'org-at-table-p "Org 9.0") (define-obsolete-function-alias 'org-table-p 'org-at-table-p "Org 9.0")
(define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "Org 9.0") (define-obsolete-function-alias 'org-on-heading-p 'org-at-heading-p "Org 9.0")
(define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "Org 8.3") (define-obsolete-function-alias 'org-at-regexp-p 'org-in-regexp "Org 8.3")
@ -240,8 +240,8 @@ Counting starts at 1."
(save-match-data (save-match-data
(eq 'fixed-width (org-element-type (org-element-at-point))))) (eq 'fixed-width (org-element-type (org-element-at-point)))))
(make-obsolete 'org-in-fixed-width-region-p (make-obsolete 'org-in-fixed-width-region-p
"use `org-element' library" "use `org-element' library"
"Org 9.0") "Org 9.0")
(defcustom org-read-date-minibuffer-setup-hook nil (defcustom org-read-date-minibuffer-setup-hook nil
"Hook to be used to set up keys for the date/time interface. "Hook to be used to set up keys for the date/time interface.
@ -300,23 +300,23 @@ See `org-link-parameters' for documentation on the other parameters."
(when (and org-table-tab-recognizes-table.el (org-at-table.el-p)) (when (and org-table-tab-recognizes-table.el (org-at-table.el-p))
(beginning-of-line) (beginning-of-line)
(unless (or (looking-at org-table-dataline-regexp) (unless (or (looking-at org-table-dataline-regexp)
(not (looking-at org-table1-hline-regexp))) (not (looking-at org-table1-hline-regexp)))
(forward-line) (forward-line)
(when (looking-at org-table-any-border-regexp) (when (looking-at org-table-any-border-regexp)
(forward-line -2))) (forward-line -2)))
(if (re-search-forward "|" (org-table-end t) t) (if (re-search-forward "|" (org-table-end t) t)
(progn (progn
(require 'table) (require 'table)
(if (table--at-cell-p (point)) t (if (table--at-cell-p (point)) t
(message "recognizing table.el table...") (message "recognizing table.el table...")
(table-recognize-table) (table-recognize-table)
(message "recognizing table.el table...done"))) (message "recognizing table.el table...done")))
(error "This should not happen")))) (error "This should not happen"))))
;; Not used by Org core since commit 6d1e3082, Feb 2010. ;; Not used by Org core since commit 6d1e3082, Feb 2010.
(make-obsolete 'org-table-recognize-table.el (make-obsolete 'org-table-recognize-table.el
"please notify the org mailing list if you use this function." "please notify the org mailing list if you use this function."
"Org 9.0") "Org 9.0")
(define-obsolete-function-alias (define-obsolete-function-alias
'org-minutes-to-hh:mm-string 'org-minutes-to-clocksum-string "Org 8.0") 'org-minutes-to-hh:mm-string 'org-minutes-to-clocksum-string "Org 8.0")
@ -356,40 +356,40 @@ You could use brackets to delimit on what part the link will be.
(defun org-version-check (version feature level) (defun org-version-check (version feature level)
(let* ((v1 (mapcar 'string-to-number (split-string version "[.]"))) (let* ((v1 (mapcar 'string-to-number (split-string version "[.]")))
(v2 (mapcar 'string-to-number (split-string emacs-version "[.]"))) (v2 (mapcar 'string-to-number (split-string emacs-version "[.]")))
(rmaj (or (nth 0 v1) 99)) (rmaj (or (nth 0 v1) 99))
(rmin (or (nth 1 v1) 99)) (rmin (or (nth 1 v1) 99))
(rbld (or (nth 2 v1) 99)) (rbld (or (nth 2 v1) 99))
(maj (or (nth 0 v2) 0)) (maj (or (nth 0 v2) 0))
(min (or (nth 1 v2) 0)) (min (or (nth 1 v2) 0))
(bld (or (nth 2 v2) 0))) (bld (or (nth 2 v2) 0)))
(if (or (< maj rmaj) (if (or (< maj rmaj)
(and (= maj rmaj) (and (= maj rmaj)
(< min rmin)) (< min rmin))
(and (= maj rmaj) (and (= maj rmaj)
(= min rmin) (= min rmin)
(< bld rbld))) (< bld rbld)))
(if (eq level :predicate) (if (eq level :predicate)
;; just return if we have the version ;; just return if we have the version
nil nil
(let ((msg (format "Emacs %s or greater is recommended for %s" (let ((msg (format "Emacs %s or greater is recommended for %s"
version feature))) version feature)))
(display-warning 'org msg level) (display-warning 'org msg level)
t)) t))
t))) t)))
(defun org-get-x-clipboard (value) (defun org-get-x-clipboard (value)
"Get the value of the X or Windows clipboard." "Get the value of the X or Windows clipboard."
(cond ((and (eq window-system 'x) (cond ((and (eq window-system 'x)
(fboundp 'gui-get-selection)) ;Silence byte-compiler. (fboundp 'gui-get-selection)) ;Silence byte-compiler.
(org-no-properties (org-no-properties
(ignore-errors (ignore-errors
(or (gui-get-selection value 'UTF8_STRING) (or (gui-get-selection value 'UTF8_STRING)
(gui-get-selection value 'COMPOUND_TEXT) (gui-get-selection value 'COMPOUND_TEXT)
(gui-get-selection value 'STRING) (gui-get-selection value 'STRING)
(gui-get-selection value 'TEXT))))) (gui-get-selection value 'TEXT)))))
((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data)) ((and (eq window-system 'w32) (fboundp 'w32-get-clipboard-data))
(w32-get-clipboard-data)))) (w32-get-clipboard-data))))
(defun org-add-props (string plist &rest props) (defun org-add-props (string plist &rest props)
"Add text properties to entire string, from beginning to end. "Add text properties to entire string, from beginning to end.
@ -401,20 +401,20 @@ that will be added to PLIST. Returns the string that was modified."
(put 'org-add-props 'lisp-indent-function 2) (put 'org-add-props 'lisp-indent-function 2)
(defun org-fit-window-to-buffer (&optional window max-height min-height (defun org-fit-window-to-buffer (&optional window max-height min-height
shrink-only) shrink-only)
"Fit WINDOW to the buffer, but only if it is not a side-by-side window. "Fit WINDOW to the buffer, but only if it is not a side-by-side window.
WINDOW defaults to the selected window. MAX-HEIGHT and MIN-HEIGHT are WINDOW defaults to the selected window. MAX-HEIGHT and MIN-HEIGHT are
passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call passed through to `fit-window-to-buffer'. If SHRINK-ONLY is set, call
`shrink-window-if-larger-than-buffer' instead, the height limit is `shrink-window-if-larger-than-buffer' instead, the height limit is
ignored in this case." ignored in this case."
(cond ((if (fboundp 'window-full-width-p) (cond ((if (fboundp 'window-full-width-p)
(not (window-full-width-p window)) (not (window-full-width-p window))
;; do nothing if another window would suffer ;; do nothing if another window would suffer
(> (frame-width) (window-width window)))) (> (frame-width) (window-width window))))
((and (fboundp 'fit-window-to-buffer) (not shrink-only)) ((and (fboundp 'fit-window-to-buffer) (not shrink-only))
(fit-window-to-buffer window max-height min-height)) (fit-window-to-buffer window max-height min-height))
((fboundp 'shrink-window-if-larger-than-buffer) ((fboundp 'shrink-window-if-larger-than-buffer)
(shrink-window-if-larger-than-buffer window))) (shrink-window-if-larger-than-buffer window)))
(or window (selected-window))) (or window (selected-window)))
;; `set-transient-map' is only in Emacs >= 24.4 ;; `set-transient-map' is only in Emacs >= 24.4
@ -436,7 +436,7 @@ Unlike to `use-region-p', this function also checks
(defun org-cursor-to-region-beginning () (defun org-cursor-to-region-beginning ()
(when (and (org-region-active-p) (when (and (org-region-active-p)
(> (point) (region-beginning))) (> (point) (region-beginning)))
(exchange-point-and-mark))) (exchange-point-and-mark)))
;;; Invisibility compatibility ;;; Invisibility compatibility
@ -446,8 +446,8 @@ Unlike to `use-region-p', this function also checks
(if (fboundp 'remove-from-invisibility-spec) (if (fboundp 'remove-from-invisibility-spec)
(remove-from-invisibility-spec arg) (remove-from-invisibility-spec arg)
(if (consp buffer-invisibility-spec) (if (consp buffer-invisibility-spec)
(setq buffer-invisibility-spec (setq buffer-invisibility-spec
(delete arg buffer-invisibility-spec))))) (delete arg buffer-invisibility-spec)))))
(defun org-in-invisibility-spec-p (arg) (defun org-in-invisibility-spec-p (arg)
"Is ARG a member of `buffer-invisibility-spec'?" "Is ARG a member of `buffer-invisibility-spec'?"
@ -458,9 +458,9 @@ Unlike to `use-region-p', this function also checks
"Move to column COLUMN. "Move to column COLUMN.
Pass COLUMN and FORCE to `move-to-column'." Pass COLUMN and FORCE to `move-to-column'."
(let ((buffer-invisibility-spec (let ((buffer-invisibility-spec
(if (listp buffer-invisibility-spec) (if (listp buffer-invisibility-spec)
(remove '(org-filtered) buffer-invisibility-spec) (remove '(org-filtered) buffer-invisibility-spec)
buffer-invisibility-spec))) buffer-invisibility-spec)))
(move-to-column column force))) (move-to-column column force)))
(defmacro org-find-library-dir (library) (defmacro org-find-library-dir (library)
@ -472,12 +472,12 @@ Pass COLUMN and FORCE to `move-to-column'."
(while (string-match "\n" s start) (while (string-match "\n" s start)
(setq start (match-end 0) n (1+ n))) (setq start (match-end 0) n (1+ n)))
(if (and (> (length s) 0) (= (aref s (1- (length s))) ?\n)) (if (and (> (length s) 0) (= (aref s (1- (length s))) ?\n))
(setq n (1- n))) (setq n (1- n)))
n)) n))
(defun org-kill-new (string &rest args) (defun org-kill-new (string &rest args)
(remove-text-properties 0 (length string) '(line-prefix t wrap-prefix t) (remove-text-properties 0 (length string) '(line-prefix t wrap-prefix t)
string) string)
(apply 'kill-new string args)) (apply 'kill-new string args))
;; `font-lock-ensure' is only available from 24.4.50 on ;; `font-lock-ensure' is only available from 24.4.50 on
@ -493,7 +493,7 @@ Let-bind some variables to nil around BODY to achieve the desired
effect, which variables to use depends on the Emacs version." effect, which variables to use depends on the Emacs version."
(if (org-version-check "24.2.50" "" :predicate) (if (org-version-check "24.2.50" "" :predicate)
`(let (pop-up-frames display-buffer-alist) `(let (pop-up-frames display-buffer-alist)
,@body) ,@body)
`(let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function) `(let (pop-up-frames special-display-buffer-names special-display-regexps special-display-function)
,@body))) ,@body)))
@ -501,19 +501,19 @@ effect, which variables to use depends on the Emacs version."
(defmacro org-check-version () (defmacro org-check-version ()
"Try very hard to provide sensible version strings." "Try very hard to provide sensible version strings."
(let* ((org-dir (org-find-library-dir "org")) (let* ((org-dir (org-find-library-dir "org"))
(org-version.el (concat org-dir "org-version.el")) (org-version.el (concat org-dir "org-version.el"))
(org-fixup.el (concat org-dir "../mk/org-fixup.el"))) (org-fixup.el (concat org-dir "../mk/org-fixup.el")))
(if (require 'org-version org-version.el 'noerror) (if (require 'org-version org-version.el 'noerror)
'(progn '(progn
(autoload 'org-release "org-version.el") (autoload 'org-release "org-version.el")
(autoload 'org-git-version "org-version.el")) (autoload 'org-git-version "org-version.el"))
(if (require 'org-fixup org-fixup.el 'noerror) (if (require 'org-fixup org-fixup.el 'noerror)
'(org-fixup) '(org-fixup)
;; provide fallback definitions and complain ;; provide fallback definitions and complain
(warn "Could not define org version correctly. Check installation!") (warn "Could not define org version correctly. Check installation!")
'(progn '(progn
(defun org-release () "N/A") (defun org-release () "N/A")
(defun org-git-version () "N/A !!check installation!!")))))) (defun org-git-version () "N/A !!check installation!!"))))))
(defmacro org-with-silent-modifications (&rest body) (defmacro org-with-silent-modifications (&rest body)
(if (fboundp 'with-silent-modifications) (if (fboundp 'with-silent-modifications)
@ -529,7 +529,7 @@ an error is signaled without being caught by a `condition-case'.
Implements `define-error' for older emacsen." Implements `define-error' for older emacsen."
(if (fboundp 'define-error) (define-error name message) (if (fboundp 'define-error) (define-error name message)
(put name 'error-conditions (put name 'error-conditions
(copy-sequence (cons name (get 'error 'error-conditions)))))) (copy-sequence (cons name (get 'error 'error-conditions))))))
(unless (fboundp 'string-suffix-p) (unless (fboundp 'string-suffix-p)
;; From Emacs subr.el. ;; From Emacs subr.el.
@ -539,8 +539,8 @@ If IGNORE-CASE is non-nil, the comparison is done without paying
attention to case differences." attention to case differences."
(let ((start-pos (- (length string) (length suffix)))) (let ((start-pos (- (length string) (length suffix))))
(and (>= start-pos 0) (and (>= start-pos 0)
(eq t (compare-strings suffix nil nil (eq t (compare-strings suffix nil nil
string start-pos nil ignore-case)))))) string start-pos nil ignore-case))))))
(provide 'org-compat) (provide 'org-compat)