[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 2eabf4c 3/4: Merge from origin/emacs-26
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] master 2eabf4c 3/4: Merge from origin/emacs-26 |
Date: |
Tue, 14 Aug 2018 12:08:18 -0400 (EDT) |
branch: master
commit 2eabf4c13c16b58bddfa232adada667f1ebf9135
Merge: 2e08ca2 34e75c1
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>
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
---
etc/NEWS | 5 +++++
lisp/ibuffer.el | 27 +++++++++++++++++++++------
test/src/data-tests.el | 20 ++++++++++++++------
3 files changed, 40 insertions(+), 12 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 7695a96..e381a54 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -59,6 +59,11 @@ option --enable-check-lisp-object-type is therefore no
longer as
useful and so is no longer enabled by default in developer builds,
to reduce differences between developer and production builds.
+** Ibuffer
+
+---
+*** New toggle 'ibuffer-do-toggle-lock', bound to 'L'.
+
** Gnus
+++
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 0fd2971..78dab1c 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -579,6 +579,7 @@ directory, like `default-directory'."
(define-key map (kbd "R") 'ibuffer-do-rename-uniquely)
(define-key map (kbd "S") 'ibuffer-do-save)
(define-key map (kbd "T") 'ibuffer-do-toggle-read-only)
+ (define-key map (kbd "L") 'ibuffer-do-toggle-lock)
(define-key map (kbd "r") 'ibuffer-do-replace-regexp)
(define-key map (kbd "V") 'ibuffer-do-revert)
(define-key map (kbd "W") 'ibuffer-do-view-and-eval)
@@ -851,6 +852,10 @@ directory, like `default-directory'."
'(menu-item "Print" ibuffer-do-print))
(define-key-after operate-map [do-toggle-modified]
'(menu-item "Toggle modification flag" ibuffer-do-toggle-modified))
+ (define-key-after operate-map [do-toggle-read-only]
+ '(menu-item "Toggle read-only flag" ibuffer-do-toggle-read-only))
+ (define-key-after operate-map [do-toggle-lock]
+ '(menu-item "Toggle lock flag" ibuffer-do-toggle-lock))
(define-key-after operate-map [do-revert]
'(menu-item "Revert" ibuffer-do-revert
:help "Revert marked buffers to their associated file"))
@@ -1349,6 +1354,16 @@ Otherwise, toggle read only status."
:modifier-p t)
(read-only-mode (if (integerp arg) arg 'toggle)))
+(define-ibuffer-op ibuffer-do-toggle-lock (&optional arg)
+ "Toggle locked status in marked buffers.
+If optional ARG is a non-negative integer, lock buffers.
+If ARG is a negative integer or 0, unlock buffers.
+Otherwise, toggle lock status."
+ (:opstring "toggled lock status in"
+ :interactive "P"
+ :modifier-p t)
+ (emacs-lock-mode (if (integerp arg) arg 'toggle)))
+
(define-ibuffer-op ibuffer-do-delete ()
"Kill marked buffers as with `kill-this-buffer'."
(:opstring "killed"
@@ -1896,11 +1911,9 @@ If point is on a group name, this function operates on
that group."
(let ((procs 0)
(files 0))
(dolist (string strings)
- (if (string-match "\\(?:\\`([[:ascii:]]+)\\)" string)
- (progn (setq procs (1+ procs))
- (if (< (match-end 0) (length string))
- (setq files (1+ files))))
- (setq files (1+ files))))
+ (when (get-text-property 1 'ibuffer-process string)
+ (setq procs (1+ procs)))
+ (setq files (1+ files)))
(concat (cond ((zerop files) "No files")
((= 1 files) "1 file")
(t (format "%d files" files)))
@@ -1912,7 +1925,8 @@ If point is on a group name, this function operates on
that group."
(filename (ibuffer-make-column-filename buffer mark)))
(if proc
(concat (propertize (format "(%s %s)" proc (process-status proc))
- 'font-lock-face 'italic)
+ 'font-lock-face 'italic
+ 'ibuffer-process proc)
(if (> (length filename) 0)
(format " %s" filename)
""))
@@ -2498,6 +2512,7 @@ Operations on marked buffers:
`\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
`\\[ibuffer-do-revert]' - Revert the marked buffers.
`\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
+ `\\[ibuffer-do-toggle-lock]' - Toggle lock state of marked buffers.
`\\[ibuffer-do-delete]' - Kill the marked buffers.
`\\[ibuffer-do-isearch]' - Do incremental search in the marked buffers.
`\\[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 ee6a3eb..8264902 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -23,13 +23,21 @@
(require 'cl-lib)
+(defconst data-tests--float-greater-than-fixnums (+ 1.0 most-positive-fixnum)
+ "A floating-point value that is greater than all fixnums.
+It is also as small as conveniently possible, to make the tests sharper.
+Adding 1.0 to most-positive-fixnum should suffice on all
+practical Emacs platforms, since the result is a power of 2 and
+this is exactly representable and is greater than
+most-positive-fixnum, which is just less than a power of 2.")
+
(ert-deftest data-tests-= ()
(should-error (=))
(should (= 1))
(should (= 2 2))
(should (= 9 9 9 9 9 9 9 9 9))
(should (= most-negative-fixnum (float most-negative-fixnum)))
- (should-not (= most-positive-fixnum (+ 1.0 most-positive-fixnum)))
+ (should-not (= most-positive-fixnum data-tests--float-greater-than-fixnums))
(should-not (apply #'= '(3 8 3)))
(should-error (= 9 9 'foo))
;; Short circuits before getting to bad arg
@@ -40,7 +48,7 @@
(should (< 1))
(should (< 2 3))
(should (< -6 -1 0 2 3 4 8 9 999))
- (should (< 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum)))
+ (should (< 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums))
(should-not (apply #'< '(3 8 3)))
(should-error (< 9 10 'foo))
;; Short circuits before getting to bad arg
@@ -51,7 +59,7 @@
(should (> 1))
(should (> 3 2))
(should (> 6 1 0 -2 -3 -4 -8 -9 -999))
- (should (> (+ 1.0 most-positive-fixnum) most-positive-fixnum 0.5))
+ (should (> data-tests--float-greater-than-fixnums most-positive-fixnum 0.5))
(should-not (apply #'> '(3 8 3)))
(should-error (> 9 8 'foo))
;; Short circuits before getting to bad arg
@@ -62,7 +70,7 @@
(should (<= 1))
(should (<= 2 3))
(should (<= -6 -1 -1 0 0 0 2 3 4 8 999))
- (should (<= 0.5 most-positive-fixnum (+ 1.0 most-positive-fixnum)))
+ (should (<= 0.5 most-positive-fixnum data-tests--float-greater-than-fixnums))
(should-not (apply #'<= '(3 8 3 3)))
(should-error (<= 9 10 'foo))
;; Short circuits before getting to bad arg
@@ -73,7 +81,7 @@
(should (>= 1))
(should (>= 3 2))
(should (>= 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999))
- (should (>= (+ 1.0 most-positive-fixnum) most-positive-fixnum))
+ (should (>= data-tests--float-greater-than-fixnums most-positive-fixnum))
(should-not (apply #'>= '(3 8 3)))
(should-error (>= 9 8 'foo))
;; Short circuits before getting to bad arg
@@ -97,7 +105,7 @@
(should (= 2 (min 3 2)))
(should (= -999 (min 666 1 0 0 -2 -3 -3 -3 -4 -8 -8 -9 -999)))
(should (= most-positive-fixnum
- (min (+ 1.0 most-positive-fixnum) most-positive-fixnum)))
+ (min data-tests--float-greater-than-fixnums
most-positive-fixnum)))
(should (= 3 (apply #'min '(3 8 3))))
(should-error (min 9 8 'foo))
(should-error (min (make-marker)))