diff options
| author | John Paul Wallington | 2008-05-15 00:12:08 +0000 |
|---|---|---|
| committer | John Paul Wallington | 2008-05-15 00:12:08 +0000 |
| commit | 4e02f55c17ab23ecc6be70de41c42a21541b3063 (patch) | |
| tree | 43d9618226bcbcaa958c7f93ae7738a436d8f482 | |
| parent | 87a6a53ae2f403824dcbf8ae6447356d7fa686aa (diff) | |
| download | emacs-4e02f55c17ab23ecc6be70de41c42a21541b3063.tar.gz emacs-4e02f55c17ab23ecc6be70de41c42a21541b3063.zip | |
(ibuffer-aif, ibuffer-awhen, ibuffer-save-marks)
(define-ibuffer-column, define-ibuffer-sorter)
(define-ibuffer-op, define-ibuffer-filter): Add declarations
containing indentation specs, replacing equivalent top-level
forms that set `lisp-indent-function' properties.
(define-ibuffer-op): Use `derived-mode-p'.
(define-ibuffer-filter): Remove redundant `concat' call.
| -rw-r--r-- | lisp/ChangeLog | 17 | ||||
| -rw-r--r-- | lisp/ibuf-macs.el | 146 |
2 files changed, 90 insertions, 73 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 379f2731ac5..f4e26605ff9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,20 @@ | |||
| 1 | 2008-05-15 John Paul Wallington <jpw@pobox.com> | ||
| 2 | |||
| 3 | * ibuffer.el (ibuffer-assert-ibuffer-mode): New defsubst. | ||
| 4 | (ibuffer-mark-interactive, ibuffer-set-mark) | ||
| 5 | (ibuffer-insert-buffer-line, ibuffer-redisplay-current) | ||
| 6 | (ibuffer-map-lines, ibuffer-switch-format) | ||
| 7 | (ibuffer-update-title-and-summary) | ||
| 8 | (ibuffer-redisplay-engine): Use it. | ||
| 9 | |||
| 10 | * ibuf-macs.el (ibuffer-aif, ibuffer-awhen, ibuffer-save-marks) | ||
| 11 | (define-ibuffer-column, define-ibuffer-sorter) | ||
| 12 | (define-ibuffer-op, define-ibuffer-filter): Add declarations | ||
| 13 | containing indentation specs, replacing equivalent top-level | ||
| 14 | forms that set `lisp-indent-function' properties. | ||
| 15 | (define-ibuffer-op): Use `derived-mode-p'. | ||
| 16 | (define-ibuffer-filter): Remove redundant `concat' call. | ||
| 17 | |||
| 1 | 2008-05-14 Michael Albinus <michael.albinus@gmx.de> | 18 | 2008-05-14 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 19 | ||
| 3 | * net/tramp.el (tramp-echo-mark): Update docstring. | 20 | * net/tramp.el (tramp-echo-mark): Update docstring. |
diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 0519c43bcc1..6889b68f01b 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | If TEST returns non-nil, bind `it' to the value, and evaluate | 36 | If TEST returns non-nil, bind `it' to the value, and evaluate |
| 37 | TRUE-BODY. Otherwise, evaluate forms in FALSE-BODY as if in `progn'. | 37 | TRUE-BODY. Otherwise, evaluate forms in FALSE-BODY as if in `progn'. |
| 38 | Compare with `if'." | 38 | Compare with `if'." |
| 39 | (declare (indent 2)) | ||
| 39 | (let ((sym (make-symbol "ibuffer-aif-sym"))) | 40 | (let ((sym (make-symbol "ibuffer-aif-sym"))) |
| 40 | `(let ((,sym ,test)) | 41 | `(let ((,sym ,test)) |
| 41 | (if ,sym | 42 | (if ,sym |
| @@ -43,18 +44,18 @@ Compare with `if'." | |||
| 43 | ,true-body) | 44 | ,true-body) |
| 44 | (progn | 45 | (progn |
| 45 | ,@false-body))))) | 46 | ,@false-body))))) |
| 46 | ;; (put 'ibuffer-aif 'lisp-indent-function 2) | ||
| 47 | 47 | ||
| 48 | (defmacro ibuffer-awhen (test &rest body) | 48 | (defmacro ibuffer-awhen (test &rest body) |
| 49 | "Evaluate BODY if TEST returns non-nil. | 49 | "Evaluate BODY if TEST returns non-nil. |
| 50 | During evaluation of body, bind `it' to the value returned by TEST." | 50 | During evaluation of body, bind `it' to the value returned by TEST." |
| 51 | (declare (indent 1)) | ||
| 51 | `(ibuffer-aif ,test | 52 | `(ibuffer-aif ,test |
| 52 | (progn ,@body) | 53 | (progn ,@body) |
| 53 | nil)) | 54 | nil)) |
| 54 | ;; (put 'ibuffer-awhen 'lisp-indent-function 1) | ||
| 55 | 55 | ||
| 56 | (defmacro ibuffer-save-marks (&rest body) | 56 | (defmacro ibuffer-save-marks (&rest body) |
| 57 | "Save the marked status of the buffers and execute BODY; restore marks." | 57 | "Save the marked status of the buffers and execute BODY; restore marks." |
| 58 | (declare (indent 0)) | ||
| 58 | (let ((bufsym (make-symbol "bufsym"))) | 59 | (let ((bufsym (make-symbol "bufsym"))) |
| 59 | `(let ((,bufsym (current-buffer)) | 60 | `(let ((,bufsym (current-buffer)) |
| 60 | (ibuffer-save-marks-tmp-mark-list (ibuffer-current-state-list))) | 61 | (ibuffer-save-marks-tmp-mark-list (ibuffer-current-state-list))) |
| @@ -70,10 +71,9 @@ During evaluation of body, bind `it' to the value returned by TEST." | |||
| 70 | e)) | 71 | e)) |
| 71 | ibuffer-save-marks-tmp-mark-list))) | 72 | ibuffer-save-marks-tmp-mark-list))) |
| 72 | (ibuffer-redisplay t)))))) | 73 | (ibuffer-redisplay t)))))) |
| 73 | ;; (put 'ibuffer-save-marks 'lisp-indent-function 0) | ||
| 74 | 74 | ||
| 75 | ;;;###autoload | 75 | ;;;###autoload |
| 76 | (defmacro* define-ibuffer-column (symbol (&key name inline props summarizer | 76 | (defmacro* define-ibuffer-column (symbol (&key name inline props summarizer |
| 77 | header-mouse-map) &rest body) | 77 | header-mouse-map) &rest body) |
| 78 | "Define a column SYMBOL for use with `ibuffer-formats'. | 78 | "Define a column SYMBOL for use with `ibuffer-formats'. |
| 79 | 79 | ||
| @@ -98,14 +98,15 @@ change its definition, you should explicitly call | |||
| 98 | `ibuffer-recompile-formats'. | 98 | `ibuffer-recompile-formats'. |
| 99 | 99 | ||
| 100 | \(fn SYMBOL (&key NAME INLINE PROPS SUMMARIZER) &rest BODY)" | 100 | \(fn SYMBOL (&key NAME INLINE PROPS SUMMARIZER) &rest BODY)" |
| 101 | (declare (indent defun)) | ||
| 101 | (let* ((sym (intern (concat "ibuffer-make-column-" | 102 | (let* ((sym (intern (concat "ibuffer-make-column-" |
| 102 | (symbol-name symbol)))) | 103 | (symbol-name symbol)))) |
| 103 | (bod-1 `(with-current-buffer buffer | 104 | (bod-1 `(with-current-buffer buffer |
| 104 | ,@body)) | 105 | ,@body)) |
| 105 | (bod (if props | 106 | (bod (if props |
| 106 | `(propertize | 107 | `(propertize |
| 107 | ,bod-1 | 108 | ,bod-1 |
| 108 | ,@props) | 109 | ,@props) |
| 109 | bod-1))) | 110 | bod-1))) |
| 110 | `(progn | 111 | `(progn |
| 111 | ,(if inline | 112 | ,(if inline |
| @@ -126,7 +127,6 @@ change its definition, you should explicitly call | |||
| 126 | ;; summary. | 127 | ;; summary. |
| 127 | `(put (quote ,sym) 'ibuffer-column-summary nil)) | 128 | `(put (quote ,sym) 'ibuffer-column-summary nil)) |
| 128 | :autoload-end))) | 129 | :autoload-end))) |
| 129 | ;; (put 'define-ibuffer-column 'lisp-indent-function 'defun) | ||
| 130 | 130 | ||
| 131 | ;;;###autoload | 131 | ;;;###autoload |
| 132 | (defmacro* define-ibuffer-sorter (name documentation | 132 | (defmacro* define-ibuffer-sorter (name documentation |
| @@ -143,6 +143,7 @@ buffer object, and `b' bound to another. BODY should return a non-nil | |||
| 143 | value if and only if `a' is \"less than\" `b'. | 143 | value if and only if `a' is \"less than\" `b'. |
| 144 | 144 | ||
| 145 | \(fn NAME DOCUMENTATION (&key DESCRIPTION) &rest BODY)" | 145 | \(fn NAME DOCUMENTATION (&key DESCRIPTION) &rest BODY)" |
| 146 | (declare (indent 1)) | ||
| 146 | `(progn | 147 | `(progn |
| 147 | (defun ,(intern (concat "ibuffer-do-sort-by-" (symbol-name name))) () | 148 | (defun ,(intern (concat "ibuffer-do-sort-by-" (symbol-name name))) () |
| 148 | ,(or documentation "No :documentation specified for this sorting method.") | 149 | ,(or documentation "No :documentation specified for this sorting method.") |
| @@ -157,7 +158,6 @@ value if and only if `a' is \"less than\" `b'. | |||
| 157 | ,@body)) | 158 | ,@body)) |
| 158 | ibuffer-sorting-functions-alist) | 159 | ibuffer-sorting-functions-alist) |
| 159 | :autoload-end)) | 160 | :autoload-end)) |
| 160 | ;; (put 'define-ibuffer-sorter 'lisp-indent-function 1) | ||
| 161 | 161 | ||
| 162 | ;;;###autoload | 162 | ;;;###autoload |
| 163 | (defmacro* define-ibuffer-op (op args | 163 | (defmacro* define-ibuffer-op (op args |
| @@ -202,66 +202,66 @@ COMPLEX means this function is special; see the source code of this | |||
| 202 | macro for exactly what it does. | 202 | macro for exactly what it does. |
| 203 | 203 | ||
| 204 | \(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING COMPLEX) &rest BODY)" | 204 | \(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING COMPLEX) &rest BODY)" |
| 205 | (declare (indent 2)) | ||
| 205 | `(progn | 206 | `(progn |
| 206 | (defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op)) | 207 | (defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op)) |
| 207 | "" "ibuffer-do-") (symbol-name op))) | 208 | "" "ibuffer-do-") (symbol-name op))) |
| 208 | ,args | 209 | ,args |
| 209 | ,(if (stringp documentation) | 210 | ,(if (stringp documentation) |
| 210 | documentation | 211 | documentation |
| 211 | (format "%s marked buffers." active-opstring)) | 212 | (format "%s marked buffers." active-opstring)) |
| 212 | ,(if (not (null interactive)) | 213 | ,(if (not (null interactive)) |
| 213 | `(interactive ,interactive) | 214 | `(interactive ,interactive) |
| 214 | '(interactive)) | 215 | '(interactive)) |
| 215 | (assert (eq major-mode 'ibuffer-mode)) | 216 | (assert (derived-mode-p 'ibuffer-mode)) |
| 216 | (setq ibuffer-did-modification nil) | 217 | (setq ibuffer-did-modification nil) |
| 217 | (let ((marked-names (,(case mark | 218 | (let ((marked-names (,(case mark |
| 218 | (:deletion | 219 | (:deletion |
| 219 | 'ibuffer-deletion-marked-buffer-names) | 220 | 'ibuffer-deletion-marked-buffer-names) |
| 220 | (t | 221 | (t |
| 221 | 'ibuffer-marked-buffer-names))))) | 222 | 'ibuffer-marked-buffer-names))))) |
| 222 | (when (null marked-names) | 223 | (when (null marked-names) |
| 223 | (setq marked-names (list (buffer-name (ibuffer-current-buffer)))) | 224 | (setq marked-names (list (buffer-name (ibuffer-current-buffer)))) |
| 224 | (ibuffer-set-mark ,(case mark | 225 | (ibuffer-set-mark ,(case mark |
| 225 | (:deletion | 226 | (:deletion |
| 226 | 'ibuffer-deletion-char) | 227 | 'ibuffer-deletion-char) |
| 227 | (t | 228 | (t |
| 228 | 'ibuffer-marked-char)))) | 229 | 'ibuffer-marked-char)))) |
| 229 | ,(let* ((finish (append | 230 | ,(let* ((finish (append |
| 230 | '(progn) | 231 | '(progn) |
| 231 | (if (eq modifier-p t) | 232 | (if (eq modifier-p t) |
| 232 | '((setq ibuffer-did-modification t)) | 233 | '((setq ibuffer-did-modification t)) |
| 233 | ()) | 234 | ()) |
| 234 | `((ibuffer-redisplay t) | 235 | `((ibuffer-redisplay t) |
| 235 | (message ,(concat "Operation finished; " opstring " %s buffers") count)))) | 236 | (message ,(concat "Operation finished; " opstring " %s buffers") count)))) |
| 236 | (inner-body (if complex | 237 | (inner-body (if complex |
| 237 | `(progn ,@body) | 238 | `(progn ,@body) |
| 238 | `(progn | 239 | `(progn |
| 239 | (with-current-buffer buf | 240 | (with-current-buffer buf |
| 240 | (save-excursion | 241 | (save-excursion |
| 241 | ,@body)) | 242 | ,@body)) |
| 242 | t))) | 243 | t))) |
| 243 | (body `(let ((count | 244 | (body `(let ((count |
| 244 | (,(case mark | 245 | (,(case mark |
| 245 | (:deletion | 246 | (:deletion |
| 246 | 'ibuffer-map-deletion-lines) | 247 | 'ibuffer-map-deletion-lines) |
| 247 | (t | 248 | (t |
| 248 | 'ibuffer-map-marked-lines)) | 249 | 'ibuffer-map-marked-lines)) |
| 249 | #'(lambda (buf mark) | 250 | #'(lambda (buf mark) |
| 250 | ,(if (eq modifier-p :maybe) | 251 | ,(if (eq modifier-p :maybe) |
| 251 | `(let ((ibuffer-tmp-previous-buffer-modification | 252 | `(let ((ibuffer-tmp-previous-buffer-modification |
| 252 | (buffer-modified-p buf))) | 253 | (buffer-modified-p buf))) |
| 253 | (prog1 ,inner-body | 254 | (prog1 ,inner-body |
| 254 | (when (not (eq ibuffer-tmp-previous-buffer-modification | 255 | (when (not (eq ibuffer-tmp-previous-buffer-modification |
| 255 | (buffer-modified-p buf))) | 256 | (buffer-modified-p buf))) |
| 256 | (setq ibuffer-did-modification t)))) | 257 | (setq ibuffer-did-modification t)))) |
| 257 | inner-body))))) | 258 | inner-body))))) |
| 258 | ,finish))) | 259 | ,finish))) |
| 259 | (if dangerous | 260 | (if dangerous |
| 260 | `(when (ibuffer-confirm-operation-on ,active-opstring marked-names) | 261 | `(when (ibuffer-confirm-operation-on ,active-opstring marked-names) |
| 261 | ,body) | 262 | ,body) |
| 262 | body)))) | 263 | body)))) |
| 263 | :autoload-end)) | 264 | :autoload-end)) |
| 264 | ;; (put 'define-ibuffer-op 'lisp-indent-function 2) | ||
| 265 | 265 | ||
| 266 | ;;;###autoload | 266 | ;;;###autoload |
| 267 | (defmacro* define-ibuffer-filter (name documentation | 267 | (defmacro* define-ibuffer-filter (name documentation |
| @@ -280,23 +280,23 @@ will be evaluated with BUF bound to the buffer object, and QUALIFIER | |||
| 280 | bound to the current value of the filter. | 280 | bound to the current value of the filter. |
| 281 | 281 | ||
| 282 | \(fn NAME DOCUMENTATION (&key READER DESCRIPTION) &rest BODY)" | 282 | \(fn NAME DOCUMENTATION (&key READER DESCRIPTION) &rest BODY)" |
| 283 | (declare (indent 2)) | ||
| 283 | (let ((fn-name (intern (concat "ibuffer-filter-by-" (symbol-name name))))) | 284 | (let ((fn-name (intern (concat "ibuffer-filter-by-" (symbol-name name))))) |
| 284 | `(progn | 285 | `(progn |
| 285 | (defun ,fn-name (qualifier) | 286 | (defun ,fn-name (qualifier) |
| 286 | ,(concat (or documentation "This filter is not documented.")) | 287 | ,(or documentation "This filter is not documented.") |
| 287 | (interactive (list ,reader)) | 288 | (interactive (list ,reader)) |
| 288 | (ibuffer-push-filter (cons ',name qualifier)) | 289 | (ibuffer-push-filter (cons ',name qualifier)) |
| 289 | (message "%s" | 290 | (message "%s" |
| 290 | (format ,(concat (format "Filter by %s added: " description) | 291 | (format ,(concat (format "Filter by %s added: " description) |
| 291 | " %s") | 292 | " %s") |
| 292 | qualifier)) | 293 | qualifier)) |
| 293 | (ibuffer-update nil t)) | 294 | (ibuffer-update nil t)) |
| 294 | (push (list ',name ,description | 295 | (push (list ',name ,description |
| 295 | #'(lambda (buf qualifier) | 296 | #'(lambda (buf qualifier) |
| 296 | ,@body)) | 297 | ,@body)) |
| 297 | ibuffer-filtering-alist) | 298 | ibuffer-filtering-alist) |
| 298 | :autoload-end))) | 299 | :autoload-end))) |
| 299 | ;; (put 'define-ibuffer-filter 'lisp-indent-function 2) | ||
| 300 | 300 | ||
| 301 | (provide 'ibuf-macs) | 301 | (provide 'ibuf-macs) |
| 302 | 302 | ||