]> code.delx.au - gnu-emacs/blobdiff - lisp/ibuf-macs.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / ibuf-macs.el
index 659b8e7d78c8b2400ddb6209d0154b5cbeab0fb6..2f4d50d9a3e0bb59dac9d562b5fd389f2d95c5d6 100644 (file)
@@ -1,6 +1,6 @@
-;;; ibuf-macs.el --- macros for ibuffer
+;;; ibuf-macs.el --- macros for ibuffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2016 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <walters@verbum.org>
 ;; Maintainer: John Paul Wallington <jpw@gnu.org>
@@ -27,8 +27,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; From Paul Graham's "ANSI Common Lisp", adapted for Emacs Lisp here.
 (defmacro ibuffer-aif (test true-body &rest false-body)
@@ -73,7 +72,7 @@ During evaluation of body, bind `it' to the value returned by TEST."
           (ibuffer-redisplay t))))))
 
 ;;;###autoload
-(defmacro* define-ibuffer-column (symbol (&key name inline props summarizer
+(cl-defmacro define-ibuffer-column (symbol (&key name inline props summarizer
                                               header-mouse-map) &rest body)
   "Define a column SYMBOL for use with `ibuffer-formats'.
 
@@ -112,6 +111,7 @@ change its definition, you should explicitly call
        ,(if inline
            `(push '(,sym ,bod) ibuffer-inline-columns)
          `(defun ,sym (buffer mark)
+             (ignore mark)            ;Silence byte-compiler if mark is unused.
             ,bod))
        (put (quote ,sym) 'ibuffer-column-name
            ,(if (stringp name)
@@ -129,7 +129,7 @@ change its definition, you should explicitly call
        :autoload-end)))
 
 ;;;###autoload
-(defmacro* define-ibuffer-sorter (name documentation
+(cl-defmacro define-ibuffer-sorter (name documentation
                                       (&key
                                        description)
                                       &rest body)
@@ -160,7 +160,7 @@ value if and only if `a' is \"less than\" `b'.
      :autoload-end))
 
 ;;;###autoload
-(defmacro* define-ibuffer-op (op args
+(cl-defmacro define-ibuffer-op (op args
                                 documentation
                                 (&key
                                  interactive
@@ -205,7 +205,8 @@ macro for exactly what it does.
   (declare (indent 2) (doc-string 3))
   `(progn
      (defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op))
-                                "" "ibuffer-do-") (symbol-name op)))
+                                "" "ibuffer-do-")
+                             (symbol-name op)))
        ,args
        ,(if (stringp documentation)
            documentation
@@ -213,19 +214,19 @@ macro for exactly what it does.
        ,(if (not (null interactive))
            `(interactive ,interactive)
          '(interactive))
-       (assert (derived-mode-p 'ibuffer-mode))
+       (cl-assert (derived-mode-p 'ibuffer-mode))
        (setq ibuffer-did-modification nil)
-       (let ((marked-names  (,(case mark
+       (let ((marked-names  (,(pcase mark
                                (:deletion
                                 'ibuffer-deletion-marked-buffer-names)
-                               (t
+                               (_
                                 'ibuffer-marked-buffer-names)))))
         (when (null marked-names)
           (setq marked-names (list (buffer-name (ibuffer-current-buffer))))
-          (ibuffer-set-mark ,(case mark
+          (ibuffer-set-mark ,(pcase mark
                                (:deletion
                                 'ibuffer-deletion-char)
-                               (t
+                               (_
                                 'ibuffer-marked-char))))
         ,(let* ((finish (append
                          '(progn)
@@ -242,12 +243,15 @@ macro for exactly what it does.
                                      ,@body))
                                  t)))
                 (body `(let ((count
-                              (,(case mark
+                              (,(pcase mark
                                   (:deletion
                                    'ibuffer-map-deletion-lines)
-                                  (t
+                                  (_
                                    'ibuffer-map-marked-lines))
                                #'(lambda (buf mark)
+                                    ;; Silence warning for code that doesn't
+                                    ;; use `mark'.
+                                    (ignore mark)
                                    ,(if (eq modifier-p :maybe)
                                         `(let ((ibuffer-tmp-previous-buffer-modification
                                                 (buffer-modified-p buf)))
@@ -264,7 +268,7 @@ macro for exactly what it does.
      :autoload-end))
 
 ;;;###autoload
-(defmacro* define-ibuffer-filter (name documentation
+(cl-defmacro define-ibuffer-filter (name documentation
                                       (&key
                                        reader
                                        description)