]> git.eshelyaron.com Git - emacs.git/commitdiff
Adjust affected callers of derived-mode-p` to use the new convention
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 14 Nov 2023 00:09:17 +0000 (19:09 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 23 Nov 2023 16:59:49 +0000 (11:59 -0500)
* lisp/align.el (align-rules-list): Prefer `derived-mode-p` over
`provided-mode-derived-p`.
(align--rule-should-run):
* lisp/window.el (display-buffer-reuse-mode-window):
* lisp/whitespace.el (whitespace-enable-predicate):
* lisp/transient.el (transient--do-suffix-p):
* lisp/so-long.el (so-long--set-auto-mode):
* lisp/simple.el (command-completion-with-modes-p):
* lisp/progmodes/tcl.el (tcl-current-word):
* lisp/progmodes/idlwave.el (idlwave-fix-keywords):
* lisp/progmodes/gdb-mi.el (gdb, gdb-locals-mode-map)
(gdb-registers-mode-map, gdb-function-buffer-p):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-style-setter)
(c-ts-mode-set-style):
* lisp/progmodes/bug-reference.el (bug-reference--try-setup-gnus-article):
* lisp/help-fns.el (help-fns--list-local-commands):
* lisp/emulation/viper.el (viper-mode)
(viper-this-major-mode-requires-vi-state):
* lisp/emacs-lisp/easy-mmode.el (easy-mmode--globalized-predicate-p):
* lisp/dired.el (dired-hide-details-mode, dired-click-to-select-mode):
* lisp/calendar/todo-mode.el (todo-reset-nondiary-marker)
(todo-reset-done-string, todo-reset-comment-string):
* lisp/vc/vc.el (vc-deduce-backend): Use new calling convention for
`derived-mode-p` and `provided-mode-derived-p`.

17 files changed:
lisp/align.el
lisp/calendar/todo-mode.el
lisp/dired.el
lisp/emacs-lisp/easy-mmode.el
lisp/emulation/viper.el
lisp/help-fns.el
lisp/progmodes/bug-reference.el
lisp/progmodes/c-ts-mode.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/idlwave.el
lisp/progmodes/tcl.el
lisp/simple.el
lisp/so-long.el
lisp/transient.el
lisp/vc/vc.el
lisp/whitespace.el
lisp/window.el

index 9fa78525ecbd9918ed4f1eb17b4cb0c362f2c82d..4daa20ddd2a878c592e6859d74578f8d06d29351 100644 (file)
@@ -555,8 +555,7 @@ The possible settings for `align-region-separate' are:
      (repeat   . t)
      (run-if   . ,(lambda ()
                     (and (not (eq '- current-prefix-arg))
-                         (not (apply #'provided-mode-derived-p
-                                     major-mode align-tex-modes))))))
+                         (not (derived-mode-p align-tex-modes))))))
 
     ;; With a negative prefix argument, lists of dollar figures will
     ;; be aligned.
@@ -1286,7 +1285,7 @@ Otherwise, create a new marker at position POS, with type TYPE."
 This is decided by the `modes' and `run-if' keys in the alist
 RULE.  Their meaning is documented in `align-rules-list' (which see)."
   (let-alist rule
-    (not (or (and .modes (not (apply #'derived-mode-p (eval .modes))))
+    (not (or (and .modes (not (derived-mode-p (eval .modes))))
              (and .run-if (not (funcall .run-if)))))))
 
 (defun align-region (beg end separate rules exclude-rules
index 4f6a964eb4daa55ef54ec02c9c98936172d4a143..ab9d629d9fc01e268a797f8c85d0faf9c53f6dba 100644 (file)
@@ -6350,7 +6350,7 @@ the empty string (i.e., no time string)."
                      (replace-match (nth 1 value) t t nil 2))
                  (forward-line)))
              (if buf
-                 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
+                 (when (derived-mode-p '(todo-mode todo-archive-mode))
                    (todo-category-select))
                (save-buffer)
                (kill-buffer)))))))))
@@ -6394,7 +6394,7 @@ the empty string (i.e., no time string)."
                    (replace-match value t t nil 1)
                  (forward-line)))
              (if buf
-                 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
+                 (when (derived-mode-p '(todo-mode todo-archive-mode))
                    (todo-category-select))
                (save-buffer)
                (kill-buffer)))))))))
@@ -6420,7 +6420,7 @@ the empty string (i.e., no time string)."
                    (replace-match value t t nil 1)
                  (forward-line)))
              (if buf
-                 (when (derived-mode-p 'todo-mode 'todo-archive-mode)
+                 (when (derived-mode-p '(todo-mode todo-archive-mode))
                    (todo-category-select))
                (save-buffer)
                (kill-buffer)))))))))
index 583cb2475e2f1b2529cd7b24d67641de2b3936aa..c212e3094f82a6f545e6734f6dcdadcacf7ce12e 100644 (file)
@@ -3074,7 +3074,7 @@ permissions are hidden from view.
 See options: `dired-hide-details-hide-symlink-targets' and
 `dired-hide-details-hide-information-lines'."
   :group 'dired
-  (unless (derived-mode-p 'dired-mode 'wdired-mode)
+  (unless (derived-mode-p '(dired-mode wdired-mode))
     (error "Not a Dired buffer"))
   (dired-hide-details-update-invisibility-spec)
   (if dired-hide-details-mode
@@ -5101,7 +5101,7 @@ Dired operation (command whose name starts with `dired-do')
 completes."
   :group 'dired
   :lighter " Click-To-Select"
-  (unless (derived-mode-p 'dired-mode 'wdired-mode)
+  (unless (derived-mode-p '(dired-mode wdired-mode))
     (error "Not a Dired buffer"))
   (if dired-click-to-select-mode
       (setq-local tool-bar-map
index 529f6e90e8854a7f2d1ad2ccf71ac2d6bde21263..c9e7b3a4dfe3634b3b661c2bf159cf8412e2fceb 100644 (file)
@@ -661,7 +661,7 @@ list."
           (throw 'found nil))
          ((and (consp elem)
                (eq (car elem) 'not))
-          (when (apply #'derived-mode-p (cdr elem))
+          (when (derived-mode-p (cdr elem))
             (throw 'found nil)))
          ((symbolp elem)
           (when (derived-mode-p elem)
index 96da914275bb4e07b6aaaaf89b0cc63c66929fc7..767ad57c471e5cd0ffb0ae9f768fe4f276e9687b 100644 (file)
@@ -593,8 +593,8 @@ This startup message appears whenever you load Viper, unless you type \\`y' now.
                    ))
              (viper-set-expert-level 'dont-change-unless)))
 
-       (or (apply #'derived-mode-p viper-emacs-state-mode-list) ; don't switch to Vi
-           (apply #'derived-mode-p viper-insert-state-mode-list) ; don't switch
+       (or (derived-mode-p viper-emacs-state-mode-list) ; don't switch to Vi
+           (derived-mode-p viper-insert-state-mode-list) ; don't switch
            (viper-change-state-to-vi))
        ))
 
@@ -607,9 +607,9 @@ This startup message appears whenever you load Viper, unless you type \\`y' now.
 ;; that are not listed in viper-vi-state-mode-list
 (defun viper-this-major-mode-requires-vi-state (mode)
   (let ((major-mode mode))
-    (cond ((apply #'derived-mode-p viper-vi-state-mode-list) t)
-          ((apply #'derived-mode-p viper-emacs-state-mode-list) nil)
-          ((apply #'derived-mode-p viper-insert-state-mode-list) nil)
+    (cond ((derived-mode-p viper-vi-state-mode-list) t)
+          ((derived-mode-p viper-emacs-state-mode-list) nil)
+          ((derived-mode-p viper-insert-state-mode-list) nil)
           (t (and (eq (key-binding "a") 'self-insert-command)
                   (eq (key-binding " ") 'self-insert-command))))))
 
index e723d97cfc24e58ed4f24e20cd7844ba3825e096..a8c6094612165d92e4a50ffb9e05b7d9b4f35964 100644 (file)
@@ -2240,7 +2240,7 @@ documentation for the major and minor modes of that buffer."
                   (not (get sym 'byte-obsolete-info))
                   ;; Ignore everything bound.
                   (not (where-is-internal sym nil t))
-                  (apply #'derived-mode-p (command-modes sym)))
+                  (derived-mode-p (command-modes sym)))
          (push sym functions))))
     (with-temp-buffer
       (when functions
index 3f6e1e68e5ba5f2d68bad9ee50e61c686754c826..0afed5276f584249ab13b64dd3b6ac382411b97c 100644 (file)
@@ -467,10 +467,10 @@ and set it if applicable."
 (defun bug-reference--try-setup-gnus-article ()
   (when (and bug-reference-mode ;; Only if enabled in article buffers.
              (derived-mode-p
-              'gnus-article-mode
-              ;; Apparently, gnus-article-prepare-hook is run in the
-              ;; summary buffer...
-              'gnus-summary-mode)
+              '(gnus-article-mode
+                ;; Apparently, `gnus-article-prepare-hook' is run in the
+                ;; summary buffer...
+                gnus-summary-mode))
              gnus-article-buffer
              gnus-original-article-buffer
              (buffer-live-p (get-buffer gnus-article-buffer))
index 70717a90caafa76b4170d60b824d776a14dae9f8..a56ce26fc797a68e3dc71156b46059ec8ef0b5e0 100644 (file)
@@ -135,7 +135,7 @@ symbol."
               res)
       (let ((buffer (car buffers)))
         (with-current-buffer buffer
-          (if (derived-mode-p 'c-ts-mode 'c++-ts-mode)
+          (if (derived-mode-p '(c-ts-mode c++-ts-mode))
               (loop (append res (list buffer)) (cdr buffers))
             (loop res (cdr buffers))))))))
 
@@ -193,7 +193,7 @@ in this Emacs session."
 To set the default indent style globally, use
 `c-ts-mode-set-global-style'."
   (interactive (list (c-ts-mode--prompt-for-style)))
-  (if (not (derived-mode-p 'c-ts-mode 'c++-ts-mode))
+  (if (not (derived-mode-p '(c-ts-mode c++-ts-mode)))
       (user-error "The current buffer is not in `c-ts-mode' nor `c++-ts-mode'")
     (setq-local c-ts-mode-indent-style style)
     (setq treesit-simple-indent-rules
index 3afdc59a67ec271b56f155735fbfb4a18066e290..7ae4bcea1e1cfe43d0b818dad8d31a0b8fdf898e 100644 (file)
@@ -1006,9 +1006,10 @@ detailed description of this mode.
   (gud-def gud-pp
           (gud-call
            (concat
-            "pp " (if (eq (buffer-local-value
-                           'major-mode (window-buffer)) 'speedbar-mode)
-                      (gdb-find-watch-expression) "%e")) arg)
+            "pp " (if (eq (buffer-local-value 'major-mode (window-buffer))
+                          'speedbar-mode)
+                      (gdb-find-watch-expression) "%e"))
+           arg)
           nil   "Print the Emacs s-expression.")
 
   (define-key gud-minor-mode-map [left-margin mouse-1]
@@ -4586,7 +4587,8 @@ left-to-right display order of the properties."
                            (gdb-set-window-buffer
                             (gdb-get-buffer-create
                              'gdb-registers-buffer
-                             gdb-thread-number) t)))
+                             gdb-thread-number)
+                            t)))
     map))
 
 (define-derived-mode gdb-locals-mode gdb-parent-mode "Locals"
@@ -4706,7 +4708,8 @@ executes FUNCTION."
                            (gdb-set-window-buffer
                             (gdb-get-buffer-create
                              'gdb-locals-buffer
-                             gdb-thread-number) t)))
+                             gdb-thread-number)
+                            t)))
     (define-key map "f" #'gdb-registers-toggle-filter)
     map))
 
@@ -5106,7 +5109,7 @@ Function buffers are locals buffer, registers buffer, etc, but
 not including main command buffer (the one where you type GDB
 commands) or source buffers (that display program source code)."
   (with-current-buffer buffer
-    (derived-mode-p 'gdb-parent-mode 'gdb-inferior-io-mode)))
+    (derived-mode-p '(gdb-parent-mode gdb-inferior-io-mode))))
 
 (defun gdb--buffer-type (buffer)
   "Return the type of BUFFER if it is a function buffer.
index d9eccacc48be71fb53bfdacb78320beae3fcdbaa..f60cc9372ebdd1aa4c4442f5d5e95d1e44671881 100644 (file)
@@ -6892,7 +6892,7 @@ If these don't exist, a letter in the string is automatically selected."
     ;; Display prompt and wait for quick reply
     (message "%s[%s]" prompt
              (mapconcat (lambda(x) (char-to-string (car x)))
-                        keys-alist ""))
+                        keys-alist))
     (if (sit-for delay)
         ;; No quick reply: Show help
         (save-window-excursion
@@ -7958,7 +7958,7 @@ demand _EXTRA in the keyword list."
     ;; If this is the OBJ_NEW function, try to figure out the class and use
     ;; the keywords from the corresponding INIT method.
     (if (and (equal (upcase name) "OBJ_NEW")
-            (derived-mode-p 'idlwave-mode 'idlwave-shell-mode))
+            (derived-mode-p '(idlwave-mode idlwave-shell-mode)))
        (let* ((bos (save-excursion (idlwave-beginning-of-statement) (point)))
               (string (buffer-substring bos (point)))
               (case-fold-search t)
index ba0cbc8b06630d7ef612a1de28cf73070c419cc8..b983c671cd9d1c08b08b1ba946e56d04d0ff8f2e 100644 (file)
@@ -1340,7 +1340,7 @@ to update the alist.")
 If FLAG is nil, just uses `current-word'.
 Otherwise scans backward for most likely Tcl command word."
   (if (and flag
-          (derived-mode-p 'tcl-mode 'inferior-tcl-mode))
+          (derived-mode-p '(tcl-mode inferior-tcl-mode)))
       (condition-case nil
          (save-excursion
            ;; Look backward for first word actually in alist.
@@ -1575,7 +1575,7 @@ The first line is assumed to look like \"#!.../program ...\"."
               (if (memq char '(?\[ ?\] ?{ ?} ?\\ ?\" ?$ ?\s ?\;))
                   (concat "\\" (char-to-string char))
                 (char-to-string char)))
-            string ""))
+            string))
 
 \f
 
index de6eed3fe8fca35a24f8dc764f362811abb48eb5..2e2d73e9bf49fd789d09359074d368d3e589c6db 100644 (file)
@@ -2427,9 +2427,7 @@ BUFFER."
   "Say whether MODES are in action in BUFFER.
 This is the case if either the major mode is derived from one of MODES,
 or (if one of MODES is a minor mode), if it is switched on in BUFFER."
-  (or (apply #'provided-mode-derived-p
-             (buffer-local-value 'major-mode buffer)
-             modes)
+  (or (provided-mode-derived-p (buffer-local-value 'major-mode buffer) modes)
       ;; It's a minor mode.
       (seq-intersection modes
                         (buffer-local-value 'local-minor-modes buffer)
index e5f7b81e717e18def84a5bd23906d262f59291b2..d91002e873a3cc5146d5898f57d80cc77d4d3541 100644 (file)
@@ -1716,7 +1716,7 @@ major mode is a member (or derivative of a member) of `so-long-target-modes'.
        (not so-long--inhibited)
        (not so-long--calling)
        (or (eq so-long-target-modes t)
-           (apply #'derived-mode-p so-long-target-modes))
+           (derived-mode-p so-long-target-modes))
        (setq so-long-detected-p (funcall so-long-predicate))
        ;; `so-long' should be called; but only if and when the buffer is
        ;; displayed in a window.  Long lines in invisible buffers are generally
index 52c2187154880bc33cf1cec8dbb0d8da658e4d14..dd2b4e0db0b8e01a9d52fab5e1f250fdc5e6d441 100644 (file)
@@ -1959,10 +1959,11 @@ value.  Otherwise return CHILDREN as is."
    (if-not-mode    (not (if (atom if-not-mode)
                             (eq major-mode if-not-mode)
                           (memq major-mode if-not-mode))))
-   (if-derived          (if (atom if-derived)
+   (if-derived          (if (or (atom if-derived) (>= emacs-major-version 30))
                             (derived-mode-p if-derived)
                           (apply #'derived-mode-p if-derived)))
-   (if-not-derived (not (if (atom if-not-derived)
+   (if-not-derived (not (if (or (atom if-not-derived)
+                                (>= emacs-major-version 30))
                             (derived-mode-p if-not-derived)
                           (apply #'derived-mode-p if-not-derived))))
    (t default)))
index d768af678c34cd1d6ad68fb05366950cdb320bf0..1bd9ecb219372e0a5805289e5c00757f4de04660 100644 (file)
@@ -1084,7 +1084,7 @@ When nil, the backend is deduced in all modes.")
        ((derived-mode-p 'log-edit-mode) log-edit-vc-backend)
        ((derived-mode-p 'diff-mode)     diff-vc-backend)
        ((or (null vc-deduce-backend-nonvc-modes)
-            (apply #'derived-mode-p vc-deduce-backend-nonvc-modes))
+            (derived-mode-p vc-deduce-backend-nonvc-modes))
         (ignore-errors (vc-responsible-backend default-directory)))
        (vc-mode (vc-backend buffer-file-name))))
 
index 86fc179396ed683e190ee451b923cc1ce9f1c6d2..f4095c9908942840e0abb4b3343874cb7dc0c6e5 100644 (file)
@@ -1026,8 +1026,8 @@ See also `whitespace-newline' and `whitespace-display-mappings'."
           ((eq whitespace-global-modes t))
           ((listp whitespace-global-modes)
            (if (eq (car-safe whitespace-global-modes) 'not)
-               (not (apply #'derived-mode-p (cdr whitespace-global-modes)))
-             (apply #'derived-mode-p whitespace-global-modes)))
+               (not (derived-mode-p (cdr whitespace-global-modes)))
+             (derived-mode-p whitespace-global-modes)))
           (t nil))
          ;; ...we have a display (not running a batch job)
          (not noninteractive)
index 06d5cfc00770ff0f6e4af66b028e9173d1dd04e5..0c5ccf167dcfb0738f7a4dffd2d968da3d780a34 100644 (file)
@@ -8054,10 +8054,8 @@ indirectly called by the latter."
       (dolist (window windows)
         (let ((mode?
                (with-current-buffer (window-buffer window)
-                 (cond ((memq major-mode allowed-modes)
-                        'same)
-                       ((apply #'derived-mode-p allowed-modes)
-                        'derived)))))
+                 (cond ((memq major-mode allowed-modes) 'same)
+                       ((derived-mode-p allowed-modes)  'derived)))))
           (when (and mode?
                      (not (and inhibit-same-window-p
                                (eq window curwin))))