diff options
| author | Glenn Morris | 2018-08-14 09:06:43 -0700 |
|---|---|---|
| committer | Glenn Morris | 2018-08-14 09:06:43 -0700 |
| commit | 2eabf4c13c16b58bddfa232adada667f1ebf9135 (patch) | |
| tree | f51622053b18fbbb72ced29013870dcafee1d6b4 | |
| parent | 2e08ca25fd2cdc00dd1fa1067dd351228f58049e (diff) | |
| parent | 34e75c144efe54dd6063fbb65d5a40176952422c (diff) | |
| download | emacs-2eabf4c13c16b58bddfa232adada667f1ebf9135.tar.gz emacs-2eabf4c13c16b58bddfa232adada667f1ebf9135.zip | |
Merge from origin/emacs-26
34e75c1 Add comment about floating point test
e73e683 Ibuffer: Add toggle ibuffer-do-toggle-lock
12f7116 Ibuffer: Detect correctly the buffers running a process
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ibuffer.el | 27 | ||||
| -rw-r--r-- | test/src/data-tests.el | 20 |
3 files changed, 40 insertions, 12 deletions
| @@ -59,6 +59,11 @@ option --enable-check-lisp-object-type is therefore no longer as | |||
| 59 | useful and so is no longer enabled by default in developer builds, | 59 | useful and so is no longer enabled by default in developer builds, |
| 60 | to reduce differences between developer and production builds. | 60 | to reduce differences between developer and production builds. |
| 61 | 61 | ||
| 62 | ** Ibuffer | ||
| 63 | |||
| 64 | --- | ||
| 65 | *** New toggle 'ibuffer-do-toggle-lock', bound to 'L'. | ||
| 66 | |||
| 62 | ** Gnus | 67 | ** Gnus |
| 63 | 68 | ||
| 64 | +++ | 69 | +++ |
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 0fd29719344..78dab1c93e5 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el | |||
| @@ -579,6 +579,7 @@ directory, like `default-directory'." | |||
| 579 | (define-key map (kbd "R") 'ibuffer-do-rename-uniquely) | 579 | (define-key map (kbd "R") 'ibuffer-do-rename-uniquely) |
| 580 | (define-key map (kbd "S") 'ibuffer-do-save) | 580 | (define-key map (kbd "S") 'ibuffer-do-save) |
| 581 | (define-key map (kbd "T") 'ibuffer-do-toggle-read-only) | 581 | (define-key map (kbd "T") 'ibuffer-do-toggle-read-only) |
| 582 | (define-key map (kbd "L") 'ibuffer-do-toggle-lock) | ||
| 582 | (define-key map (kbd "r") 'ibuffer-do-replace-regexp) | 583 | (define-key map (kbd "r") 'ibuffer-do-replace-regexp) |
| 583 | (define-key map (kbd "V") 'ibuffer-do-revert) | 584 | (define-key map (kbd "V") 'ibuffer-do-revert) |
| 584 | (define-key map (kbd "W") 'ibuffer-do-view-and-eval) | 585 | (define-key map (kbd "W") 'ibuffer-do-view-and-eval) |
| @@ -851,6 +852,10 @@ directory, like `default-directory'." | |||
| 851 | '(menu-item "Print" ibuffer-do-print)) | 852 | '(menu-item "Print" ibuffer-do-print)) |
| 852 | (define-key-after operate-map [do-toggle-modified] | 853 | (define-key-after operate-map [do-toggle-modified] |
| 853 | '(menu-item "Toggle modification flag" ibuffer-do-toggle-modified)) | 854 | '(menu-item "Toggle modification flag" ibuffer-do-toggle-modified)) |
| 855 | (define-key-after operate-map [do-toggle-read-only] | ||
| 856 | '(menu-item "Toggle read-only flag" ibuffer-do-toggle-read-only)) | ||
| 857 | (define-key-after operate-map [do-toggle-lock] | ||
| 858 | '(menu-item "Toggle lock flag" ibuffer-do-toggle-lock)) | ||
| 854 | (define-key-after operate-map [do-revert] | 859 | (define-key-after operate-map [do-revert] |
| 855 | '(menu-item "Revert" ibuffer-do-revert | 860 | '(menu-item "Revert" ibuffer-do-revert |
| 856 | :help "Revert marked buffers to their associated file")) | 861 | :help "Revert marked buffers to their associated file")) |
| @@ -1349,6 +1354,16 @@ Otherwise, toggle read only status." | |||
| 1349 | :modifier-p t) | 1354 | :modifier-p t) |
| 1350 | (read-only-mode (if (integerp arg) arg 'toggle))) | 1355 | (read-only-mode (if (integerp arg) arg 'toggle))) |
| 1351 | 1356 | ||
| 1357 | (define-ibuffer-op ibuffer-do-toggle-lock (&optional arg) | ||
| 1358 | "Toggle locked status in marked buffers. | ||
| 1359 | If optional ARG is a non-negative integer, lock buffers. | ||
| 1360 | If ARG is a negative integer or 0, unlock buffers. | ||
| 1361 | Otherwise, toggle lock status." | ||
| 1362 | (:opstring "toggled lock status in" | ||
| 1363 | :interactive "P" | ||
| 1364 | :modifier-p t) | ||
| 1365 | (emacs-lock-mode (if (integerp arg) arg 'toggle))) | ||
| 1366 | |||
| 1352 | (define-ibuffer-op ibuffer-do-delete () | 1367 | (define-ibuffer-op ibuffer-do-delete () |
| 1353 | "Kill marked buffers as with `kill-this-buffer'." | 1368 | "Kill marked buffers as with `kill-this-buffer'." |
| 1354 | (:opstring "killed" | 1369 | (:opstring "killed" |
| @@ -1896,11 +1911,9 @@ If point is on a group name, this function operates on that group." | |||
| 1896 | (let ((procs 0) | 1911 | (let ((procs 0) |
| 1897 | (files 0)) | 1912 | (files 0)) |
| 1898 | (dolist (string strings) | 1913 | (dolist (string strings) |
| 1899 | (if (string-match "\\(?:\\`([[:ascii:]]+)\\)" string) | 1914 | (when (get-text-property 1 'ibuffer-process string) |
| 1900 | (progn (setq procs (1+ procs)) | 1915 | (setq procs (1+ procs))) |
| 1901 | (if (< (match-end 0) (length string)) | 1916 | (setq files (1+ files))) |
| 1902 | (setq files (1+ files)))) | ||
| 1903 | (setq files (1+ files)))) | ||
| 1904 | (concat (cond ((zerop files) "No files") | 1917 | (concat (cond ((zerop files) "No files") |
| 1905 | ((= 1 files) "1 file") | 1918 | ((= 1 files) "1 file") |
| 1906 | (t (format "%d files" files))) | 1919 | (t (format "%d files" files))) |
| @@ -1912,7 +1925,8 @@ If point is on a group name, this function operates on that group." | |||
| 1912 | (filename (ibuffer-make-column-filename buffer mark))) | 1925 | (filename (ibuffer-make-column-filename buffer mark))) |
| 1913 | (if proc | 1926 | (if proc |
| 1914 | (concat (propertize (format "(%s %s)" proc (process-status proc)) | 1927 | (concat (propertize (format "(%s %s)" proc (process-status proc)) |
| 1915 | 'font-lock-face 'italic) | 1928 | 'font-lock-face 'italic |
| 1929 | 'ibuffer-process proc) | ||
| 1916 | (if (> (length filename) 0) | 1930 | (if (> (length filename) 0) |
| 1917 | (format " %s" filename) | 1931 | (format " %s" filename) |
| 1918 | "")) | 1932 | "")) |
| @@ -2498,6 +2512,7 @@ Operations on marked buffers: | |||
| 2498 | `\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame. | 2512 | `\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame. |
| 2499 | `\\[ibuffer-do-revert]' - Revert the marked buffers. | 2513 | `\\[ibuffer-do-revert]' - Revert the marked buffers. |
| 2500 | `\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers. | 2514 | `\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers. |
| 2515 | `\\[ibuffer-do-toggle-lock]' - Toggle lock state of marked buffers. | ||
| 2501 | `\\[ibuffer-do-delete]' - Kill the marked buffers. | 2516 | `\\[ibuffer-do-delete]' - Kill the marked buffers. |
| 2502 | `\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers. | 2517 | `\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers. |
| 2503 | `\\[ibuffer-do-isearch-regexp]' - Isearch for regexp in the marked buffers. | 2518 | `\\[ibuffer-do-isearch-regexp]' - Isearch for regexp in the marked buffers. |
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index ee6a3eb9222..82649022576 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -23,13 +23,21 @@ | |||
| 23 | 23 | ||
| 24 | (require 'cl-lib) | 24 | (require 'cl-lib) |
| 25 | 25 | ||
| 26 | (defconst data-tests--float-greater-than-fixnums (+ 1.0 most-positive-fixnum) | ||
| 27 | "A floating-point value that is greater than all fixnums. | ||
| 28 | It is also as small as conveniently possible, to make the tests sharper. | ||
| 29 | Adding 1.0 to most-positive-fixnum should suffice on all | ||
| 30 | practical Emacs platforms, since the result is a power of 2 and | ||
| 31 | this is exactly representable and is greater than | ||
| 32 | most-positive-fixnum, which is just less than a power of 2.") | ||
| 33 | |||
| 26 | (ert-deftest data-tests-= () | 34 | (ert-deftest data-tests-= () |
| 27 | (should-error (=)) | 35 | (should-error (=)) |
| 28 | (should (= 1)) | 36 | (should (= 1)) |
| 29 | (should (= 2 2)) | 37 | (should (= 2 2)) |
| 30 | (should (= 9 9 9 9 9 9 9 9 9)) | 38 | (should (= 9 9 9 9 9 9 9 9 9)) |
| 31 | (should (= most-negative-fixnum (float most-negative-fixnum))) | 39 | (should (= most-negative-fixnum (float most-negative-fixnum))) |
| 32 | (should-not (= most-positive-fixnum (+ 1.0 most-positive-fixnum))) | 40 | (should-not (= most-positive-fixnum data-tests--float-greater-than-fixnums)) |
| 33 | (should-not (apply #'= '(3 8 3))) | 41 | (should-not (apply #'= '(3 8 3))) |
| 34 | (should-error (= 9 9 'foo)) | 42 | (should-error (= 9 9 'foo)) |
| 35 | ;; Short circuits before getting to bad arg | 43 | ;; Short circuits before getting to bad arg |
| @@ -40,7 +48,7 @@ | |||
| 40 | (should (< 1)) | 48 | (should (< 1)) |
| 41 | (should (< 2 3)) | 49 | (should (< 2 3)) |
| 42 | (should (< -6 -1 0 2 3 4 8 9 999)) | 50 | (should (< -6 -1 0 2 3 4 8 9 999)) |
| 43 | (should (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))) | 51 | (should (< 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums)) |
| 44 | (should-not (apply #'< '(3 8 3))) | 52 | (should-not (apply #'< '(3 8 3))) |
| 45 | (should-error (< 9 10 'foo)) | 53 | (should-error (< 9 10 'foo)) |
| 46 | ;; Short circuits before getting to bad arg | 54 | ;; Short circuits before getting to bad arg |
| @@ -51,7 +59,7 @@ | |||
| 51 | (should (> 1)) | 59 | (should (> 1)) |
| 52 | (should (> 3 2)) | 60 | (should (> 3 2)) |
| 53 | (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) | 61 | (should (> 6 1 0 -2 -3 -4 -8 -9 -999)) |
| 54 | (should (> (+ 1.0 most-positive-fixnum) most-positive-fixnum 0.5)) | 62 | (should (> data-tests--float-greater-than-fixnums most-positive-fixnum 0.5)) |
| 55 | (should-not (apply #'> '(3 8 3))) | 63 | (should-not (apply #'> '(3 8 3))) |
| 56 | (should-error (> 9 8 'foo)) | 64 | (should-error (> 9 8 'foo)) |
| 57 | ;; Short circuits before getting to bad arg | 65 | ;; Short circuits before getting to bad arg |
| @@ -62,7 +70,7 @@ | |||
| 62 | (should (<= 1)) | 70 | (should (<= 1)) |
| 63 | (should (<= 2 3)) | 71 | (should (<= 2 3)) |
| 64 | (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) | 72 | (should (<= -6 -1 -1 0 0 0 2 3 4 8 999)) |
| 65 | (should (<= 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum))) | 73 | (should (<= 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums)) |
| 66 | (should-not (apply #'<= '(3 8 3 3))) | 74 | (should-not (apply #'<= '(3 8 3 3))) |
| 67 | (should-error (<= 9 10 'foo)) | 75 | (should-error (<= 9 10 'foo)) |
| 68 | ;; Short circuits before getting to bad arg | 76 | ;; Short circuits before getting to bad arg |
| @@ -73,7 +81,7 @@ | |||
| 73 | (should (>= 1)) | 81 | (should (>= 1)) |
| 74 | (should (>= 3 2)) | 82 | (should (>= 3 2)) |
| 75 | (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) | 83 | (should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)) |
| 76 | (should (>= (+ 1.0 most-positive-fixnum) most-positive-fixnum)) | 84 | (should (>= data-tests--float-greater-than-fixnums most-positive-fixnum)) |
| 77 | (should-not (apply #'>= '(3 8 3))) | 85 | (should-not (apply #'>= '(3 8 3))) |
| 78 | (should-error (>= 9 8 'foo)) | 86 | (should-error (>= 9 8 'foo)) |
| 79 | ;; Short circuits before getting to bad arg | 87 | ;; Short circuits before getting to bad arg |
| @@ -97,7 +105,7 @@ | |||
| 97 | (should (= 2 (min 3 2))) | 105 | (should (= 2 (min 3 2))) |
| 98 | (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))) | 106 | (should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))) |
| 99 | (should (= most-positive-fixnum | 107 | (should (= most-positive-fixnum |
| 100 | (min (+ 1.0 most-positive-fixnum) most-positive-fixnum))) | 108 | (min data-tests--float-greater-than-fixnums most-positive-fixnum))) |
| 101 | (should (= 3 (apply #'min '(3 8 3)))) | 109 | (should (= 3 (apply #'min '(3 8 3)))) |
| 102 | (should-error (min 9 8 'foo)) | 110 | (should-error (min 9 8 'foo)) |
| 103 | (should-error (min (make-marker))) | 111 | (should-error (min (make-marker))) |