branch: externals/compat commit 9b984aeb088901fc8b238a5e52ae343ea1dac527 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Drop unneeded definitions --- compat-25.el | 4 ---- compat-26.el | 16 ++++++++++++++++ compat-27.el | 55 ------------------------------------------------------- compat-28.el | 5 +++++ compat-29.el | 3 --- compat-tests.el | 2 +- compat.texi | 38 -------------------------------------- 7 files changed, 22 insertions(+), 101 deletions(-) diff --git a/compat-25.el b/compat-25.el index 8414ada65d..305f94f4db 100644 --- a/compat-25.el +++ b/compat-25.el @@ -276,9 +276,5 @@ itself or not." form)))))))) (t form))) -;;;; Defined in byte-run.el - -(compat-defalias function-put put) ;; <compat-tests:function-put> - (provide 'compat-25) ;;; compat-25.el ends here diff --git a/compat-26.el b/compat-26.el index bdfb6e91dc..ad080f5f84 100644 --- a/compat-26.el +++ b/compat-26.el @@ -83,6 +83,22 @@ see `region-noncontiguous-p' and `extract-rectangle-bounds'." ;;;; Defined in subr.el +(compat-defun provided-mode-derived-p (mode &rest modes) ;; <compat-tests:provided-derived-mode-p> + "Non-nil if MODE is derived from one of MODES. +Uses the `derived-mode-parent' property of the symbol to trace backwards. +If you just want to check `major-mode', use `derived-mode-p'." + ;; If MODE is an alias, then look up the real mode function first. + (let ((alias (symbol-function mode))) + (when (and alias (symbolp alias)) + (setq mode alias))) + (while + (and + (not (memq mode modes)) + (let* ((parent (get mode 'derived-mode-parent)) + (parentfn (symbol-function parent))) + (setq mode (if (and parentfn (symbolp parentfn)) parentfn parent))))) + mode) + (compat-defun alist-get (key alist &optional default remove testfn) ;; <compat-tests:alist-get> "Handle optional argument TESTFN." :explicit t diff --git a/compat-27.el b/compat-27.el index 8c06a5aabb..ee7f89ec79 100644 --- a/compat-27.el +++ b/compat-27.el @@ -123,40 +123,6 @@ NOTE: This function is not as accurate as the actual `time-equal-p'." (< (abs (- (float-time t1) (float-time t2))) (if (and t1 t2) 1e-6 1e-5))))) -;;;; Defined in fileio.c - -(compat-defun file-name-absolute-p (filename) ;; <compat-tests:file-name-absolute-p> - "Return t if FILENAME is an absolute file name. -On Unix, absolute file names start with `/'. In Emacs, an absolute -file name can also start with an initial `~' or `~USER' component, -where USER is a valid login name." - ;; See definitions in filename.h - (let ((drive - (eval-when-compile - (cond - ((memq system-type '(windows-nt ms-dos)) - "\\`[A-Za-z]:[\\/]") - ((eq system-type 'cygwin) - "\\`\\([\\/]\\|[A-Za-z]:\\)") - ("\\`/")))) - (home - (eval-when-compile - (if (memq system-type '(cygwin windows-nt ms-dos)) - "\\`~[\\/]" "\\`~/"))) - (user-home - (eval-when-compile - (format "\\`\\(~.*?\\)\\(%s.*\\)?$" - (if (memq system-type '(cygwin windows-nt ms-dos)) - "[\\/]" "/"))))) - (or (and (string-match-p drive filename) t) - (and (string-match-p home filename) t) - (save-excursion - (when (string-match user-home filename) - (let ((init (match-string 1 filename))) - (not (string= - (file-name-base (expand-file-name init)) - init)))))))) - ;;;; Defined in subr.el (compat-defalias fixnump integerp) ;; <compat-tests:fixnump> @@ -177,27 +143,6 @@ where USER is a valid login name." body))) (cons 'progn (nreverse body)))) -(compat-defun provided-mode-derived-p (mode &rest modes) ;; <compat-tests:derived-mode-p> - "Non-nil if MODE is derived from one of MODES. -Uses the `derived-mode-parent' property of the symbol to trace backwards. -If you just want to check `major-mode', use `derived-mode-p'." - ;; If MODE is an alias, then look up the real mode function first. - (let ((alias (symbol-function mode))) - (when (and alias (symbolp alias)) - (setq mode alias))) - (while - (and - (not (memq mode modes)) - (let* ((parent (get mode 'derived-mode-parent)) - (parentfn (symbol-function parent))) - (setq mode (if (and parentfn (symbolp parentfn)) parentfn parent))))) - mode) - -(compat-defun derived-mode-p (&rest modes) ;; <compat-tests:derived-mode-p> - "Non-nil if the current major mode is derived from one of MODES. -Uses the `derived-mode-parent' property of the symbol to trace backwards." - (apply #'provided-mode-derived-p major-mode modes)) - (compat-defmacro ignore-error (condition &rest body) ;; <compat-tests:ignore-error> "Execute BODY; if the error CONDITION occurs, return nil. Otherwise, return result of last form in BODY. diff --git a/compat-28.el b/compat-28.el index 2c56c786b6..e1527e7d92 100644 --- a/compat-28.el +++ b/compat-28.el @@ -799,5 +799,10 @@ function will never return nil." ((not text-quoting-style) 'grave) (t 'curve))) +;;;; Defined in button.el + +;; Obsolete Alias since 29 +(compat-defalias button-buttonize buttonize :obsolete t) ;; <compat-tests:button-buttonize> + (provide 'compat-28) ;;; compat-28.el ends here diff --git a/compat-29.el b/compat-29.el index 1988df636f..6e5b93f223 100644 --- a/compat-29.el +++ b/compat-29.el @@ -1188,9 +1188,6 @@ Also see `buttonize'." (add-text-properties start end (button--properties callback data help-echo)) (add-face-text-property start end 'button t)) -;; Obsolete Alias since 29 -(compat-defalias button-buttonize buttonize :obsolete t) ;; <compat-tests:button-buttonize> - ;;;; Defined in rmc.el (compat-defun read-multiple-choice ;; <compat-tests:read-multiple-choice> diff --git a/compat-tests.el b/compat-tests.el index 431a7ffcc8..52d6d57315 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -1147,7 +1147,7 @@ (should-equal '((0 . zero) a (0 . zero)) (compat-call assoc-delete-all 0 (list (cons 0 'zero) (cons 1 'one) 'a (cons 0 'zero)) #'/=)) (should-equal '(a (0 . zero) (0 . zero)) (compat-call assoc-delete-all 0 (list 'a (cons 0 'zero) (cons 1 'one) (cons 0 'zero)) #'/=))) -(ert-deftest derived-mode-p () +(ert-deftest provided-derived-mode-p () (let ((one (make-symbol "1")) (two (make-symbol "2")) (three (make-symbol "3")) diff --git a/compat.texi b/compat.texi index 60528cc3e5..1d5a4ffc7f 100644 --- a/compat.texi +++ b/compat.texi @@ -1281,13 +1281,6 @@ This function returns non-@code{nil} if @var{mode} is derived from any of the major modes given by the symbols @var{modes}. @end defun -@defun derived-mode-p &rest modes -This function returns non-@code{nil} if the current major mode is -derived from any of the major modes given by the symbols @var{modes}. - -@xref{Derived Modes,,,elisp}. -@end defun - @c based on lispref/files.texi @defun make-empty-file filename &optional parents This function creates an empty file named @var{filename}. As @@ -2013,37 +2006,6 @@ If native compilation is not available, this function always returns @code{nil}. @end defun -@c copied from lispref/files.texi -@defun file-name-absolute-p filename -This function returns @code{t} if file @var{filename} is an absolute -file name, @code{nil} otherwise. A file name is considered to be -absolute if its first component is @samp{~}, or is @samp{~@var{user}} -where @var{user} is a valid login name. In the following examples, -assume that there is a user named @samp{rms} but no user named -@samp{nosuchuser}. - -@example -@group -(file-name-absolute-p "~rms/foo") - @result{} t -@end group -@group -(file-name-absolute-p "~nosuchuser/foo") - @result{} nil -@end group -@group -(file-name-absolute-p "rms/foo") - @result{} nil -@end group -@group -(file-name-absolute-p "/user/rms/foo") - @result{} t -@end group -@end example - -@xref{Absolute and Relative File Names,,,elisp}. -@end defun - @subsection Explicit Definitions These functions must be called explicitly via @code{compat-call}, since their calling convention or behavior changed: