[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 3378549 3/3: Merge from origin/emacs-28
From: |
Glenn Morris |
Subject: |
master 3378549 3/3: Merge from origin/emacs-28 |
Date: |
Mon, 25 Oct 2021 12:51:10 -0400 (EDT) |
branch: master
commit 33785495722f9f75cf50f7beabda8859399403d9
Merge: 8d0f7e7 a2c17e1
Author: Glenn Morris <rgm@gnu.org>
Commit: Glenn Morris <rgm@gnu.org>
Merge from origin/emacs-28
a2c17e115e (origin/emacs-28) Merge branch 'emacs-28' of git.savannah....
fde56eeb76 Revert "Fix a typo in emacs-lisp-intro.texi"
4779d3ba19 * doc/lispref/functions.texi (Mapping Functions): Use #' w...
85ea3f7f47 Fix issue with interpreting ANSI codes in eshell
50f9436146 image-dired: Doc fix to better explain thumbnail generation
bb475e10b9 Clarify two image-dired docstrings
f5b4bb4a6f Fix flymake example backend conditions in the manual
0771d8939a * etc/PROBLEMS: Mention problems with regexp matcher. (Bu...
ee579033b9 * test/lisp/repeat-tests.el: New file.
7385a7667f * lisp/tab-bar.el (tab-bar-move-repeat-map): Fix alias bin...
56caf1c9b8 Use restrictive umask when creating image-dired data
3b5de7f991 ; lisp/transient.el: Revert some misguided stylistic fixes.
---
doc/emacs/dired.texi | 8 +--
doc/lispintro/emacs-lisp-intro.texi | 2 +-
doc/lispref/functions.texi | 20 +++----
doc/misc/flymake.texi | 2 +-
etc/PROBLEMS | 12 ++++
lisp/eshell/esh-mode.el | 7 +--
lisp/image-dired.el | 23 ++++++--
lisp/tab-bar.el | 3 +-
lisp/transient.el | 19 +++---
test/lisp/repeat-tests.el | 111 ++++++++++++++++++++++++++++++++++++
10 files changed, 172 insertions(+), 35 deletions(-)
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 540abc3..9cdd4b8 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -1507,10 +1507,10 @@ buffer containing image-dired, corresponding to the
marked files.
You can also enter Image-Dired directly by typing @kbd{M-x
image-dired}. This prompts for a directory; specify one that has
image files. This creates thumbnails for all the images in that
-directory, and displays them all in the thumbnail buffer. This
-takes a long time if the directory contains many image files, and it
-asks for confirmation if the number of image files exceeds
-@code{image-dired-show-all-from-dir-max-files}.
+directory, and displays them all in the thumbnail buffer. The
+thumbnails are generated in the background and are loaded as they
+become available. This command asks for confirmation if the number of
+image files exceeds @code{image-dired-show-all-from-dir-max-files}.
With point in the thumbnail buffer, you can type @key{RET}
(@code{image-dired-display-thumbnail-original-image}) to display a
diff --git a/doc/lispintro/emacs-lisp-intro.texi
b/doc/lispintro/emacs-lisp-intro.texi
index 5ce46ea..fba1094 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -1177,7 +1177,7 @@ are different from the meaning the letters make as a
word. For
example, the word for the South American sloth, the @samp{ai}, is
completely different from the two words, @samp{a}, and @samp{i}.
-There are many kinds of atoms in nature but only a few in Lisp: for
+There are many kinds of atom in nature but only a few in Lisp: for
example, @dfn{numbers}, such as 37, 511, or 1729, and @dfn{symbols}, such
as @samp{+}, @samp{foo}, or @samp{forward-line}. The words we have
listed in the examples above are all symbols. In everyday Lisp
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 33ef036..8f98ac9 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -910,11 +910,11 @@ length of @var{sequence}. For example:
@example
@group
-(mapcar 'car '((a b) (c d) (e f)))
+(mapcar #'car '((a b) (c d) (e f)))
@result{} (a c e)
-(mapcar '1+ [1 2 3])
+(mapcar #'1+ [1 2 3])
@result{} (2 3 4)
-(mapcar 'string "abc")
+(mapcar #'string "abc")
@result{} ("a" "b" "c")
@end group
@@ -930,14 +930,14 @@ Return the list of results."
;; @r{If no list is exhausted,}
(if (not (memq nil args))
;; @r{apply function to @sc{car}s.}
- (cons (apply function (mapcar 'car args))
- (apply 'mapcar* function
+ (cons (apply function (mapcar #'car args))
+ (apply #'mapcar* function
;; @r{Recurse for rest of elements.}
- (mapcar 'cdr args)))))
+ (mapcar #'cdr args)))))
@end group
@group
-(mapcar* 'cons '(a b c) '(1 2 3 4))
+(mapcar* #'cons '(a b c) '(1 2 3 4))
@result{} ((a . 1) (b . 2) (c . 3))
@end group
@end example
@@ -954,10 +954,10 @@ the results (which must be lists), by altering the
results (using
@example
@group
;; @r{Contrast this:}
-(mapcar 'list '(a b c d))
+(mapcar #'list '(a b c d))
@result{} ((a) (b) (c) (d))
;; @r{with this:}
-(mapcan 'list '(a b c d))
+(mapcan #'list '(a b c d))
@result{} (a b c d)
@end group
@end example
@@ -986,7 +986,7 @@ string.
@example
@group
-(mapconcat 'symbol-name
+(mapconcat #'symbol-name
'(The cat in the hat)
" ")
@result{} "The cat in the hat"
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index cfe7343..309bed7 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -774,7 +774,7 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be
active.
;; Check that the process has indeed exited, as it might
;; be simply suspended.
;;
- (when (eq 'exit (process-status proc))
+ (when (memq (process-status proc) '(exit signal))
(unwind-protect
;; Only proceed if `proc' is the same as
;; `ruby--flymake-proc', which indicates that
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index ede83a6..daff102 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -742,6 +742,18 @@ completed" message that tls.el relies upon, causing
affected Emacs
functions to hang. To work around the problem, use older or newer
versions of gnutls-cli, or use Emacs's built-in gnutls support.
+*** Stack overflow in regexp matcher.
+Due to fundamental limitations in the way Emacs' regular expression
+engine is designed, you might run into combinatorial explosions in
+backtracking with certain regexps.
+
+Avoid "\(...\(...\)*...\)*" and "\(...\)*\(...\)*". Look for a way to
+anchor your regular expression, to avoid matching the null string in
+infinite ways. The latter is what creates backtrack points, and
+eventual overflow in practice.
+
+(Also prefer "\(?:...\)" to "\(...\)" unless you need the latter.)
+
* Runtime problems related to font handling
** Characters are displayed as empty boxes or with wrong font under X.
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 579b01f..2b5a464 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -315,6 +315,8 @@ and the hook `eshell-exit-hook'."
(setq-local bookmark-make-record-function #'eshell-bookmark-make-record)
(setq local-abbrev-table eshell-mode-abbrev-table)
+ (setq-local window-point-insertion-type t)
+
(setq-local list-buffers-directory (expand-file-name default-directory))
;; always set the tab width to 8 in Eshell buffers, since external
@@ -696,13 +698,10 @@ This is done after all necessary filtering has been done."
(setq oend (+ oend nchars)))
;; Let the ansi-color overlay hooks run.
(let ((inhibit-modification-hooks nil))
- (insert-before-markers string))
+ (insert string))
(if (= (window-start) (point))
(set-window-start (selected-window)
(- (point) nchars)))
- (if (= (point) eshell-last-input-end)
- (set-marker eshell-last-input-end
- (- eshell-last-input-end nchars)))
(set-marker eshell-last-output-start ostart)
(set-marker eshell-last-output-end (point))
(force-mode-line-update))
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 9313c62..d73dbdb 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -170,7 +170,12 @@
:group 'multimedia)
(defcustom image-dired-dir (locate-user-emacs-file "image-dired/")
- "Directory where thumbnail images are stored."
+ "Directory where thumbnail images are stored.
+
+The value of this option will be ignored if Image Dired is
+customized to use the Thumbnail Managing Standard; they will be
+saved in \"$XDG_CACHE_HOME/thumbnails/\" instead. See
+`image-dired-thumbnail-storage'."
:type 'directory)
(defcustom image-dired-thumbnail-storage 'use-image-dired-dir
@@ -446,7 +451,11 @@ Used by `image-dired-gallery-generate' to leave out
\"hidden\" images."
(t 100))
"Size of thumbnails, in pixels.
This is the default size for both `image-dired-thumb-width'
-and `image-dired-thumb-height'."
+and `image-dired-thumb-height'.
+
+The value of this option will be ignored if Image Dired is
+customized to use the Thumbnail Managing Standard; the standard
+sizes will be used instead. See `image-dired-thumbnail-storage'."
:type 'integer)
(defcustom image-dired-thumb-width image-dired-thumb-size
@@ -582,7 +591,8 @@ Create the thumbnails directory if it does not exist."
(let ((image-dired-dir (file-name-as-directory
(expand-file-name image-dired-dir))))
(unless (file-directory-p image-dired-dir)
- (make-directory image-dired-dir t)
+ (with-file-modes #o700
+ (make-directory image-dired-dir t))
(message "Creating thumbnails directory"))
image-dired-dir))
@@ -1122,10 +1132,12 @@ Signal error if there are problems creating it."
(let (dir buf)
(unless (file-directory-p (setq dir (file-name-directory
image-dired-db-file)))
- (make-directory dir t))
+ (with-file-modes #o700
+ (make-directory dir t)))
(with-current-buffer (setq buf (create-file-buffer
image-dired-db-file))
- (write-file image-dired-db-file))
+ (with-file-modes #o600
+ (write-file image-dired-db-file)))
(kill-buffer buf)
(file-exists-p image-dired-db-file))
(error "Could not create %s" image-dired-db-file)))
@@ -2552,6 +2564,7 @@ when using per-directory thumbnail file storage"))
(if (file-exists-p image-dired-gallery-dir)
(if (not (file-directory-p image-dired-gallery-dir))
(error "Variable image-dired-gallery-dir is not a directory"))
+ ;; FIXME: Should we set umask to 077 here, as we do for thumbnails?
(make-directory image-dired-gallery-dir))
;; Open index file
(with-temp-file index-file
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 10ff57b..10f2687 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -2378,12 +2378,13 @@ Used in `repeat-mode'.")
(defvar tab-bar-move-repeat-map
(let ((map (make-sparse-keymap)))
- (define-key map "m" 'tab-bar-move-tab)
+ (define-key map "m" 'tab-move)
(define-key map "M" 'tab-bar-move-tab-backward)
map)
"Keymap to repeat tab move key sequences `C-x t m m M'.
Used in `repeat-mode'.")
(put 'tab-move 'repeat-map 'tab-bar-move-repeat-map)
+(put 'tab-bar-move-tab-backward 'repeat-map 'tab-bar-move-repeat-map)
(provide 'tab-bar)
diff --git a/lisp/transient.el b/lisp/transient.el
index c33a4c7..77bf41d 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1289,8 +1289,8 @@ variable instead.")
(defvar transient--exitp nil "Whether to exit the transient.")
(defvar transient--showp nil "Whether the transient is show in a popup
buffer.")
-(defvar transient--helpp nil "Whether `help-mode' is active.")
-(defvar transient--editp nil "Whether `edit-mode' is active.")
+(defvar transient--helpp nil "Whether help-mode is active.")
+(defvar transient--editp nil "Whether edit-mode is active.")
(defvar transient--active-infix nil "The active infix awaiting user input.")
@@ -3119,19 +3119,19 @@ and its value is returned to the caller."
desc)))
(cl-defmethod transient-format-description ((obj transient-group))
- "Format the description by calling the next method.
-If the result doesn't use the `face' property at all, then apply
-the face `transient-heading' to the complete string."
+ "Format the description by calling the next method. If the result
+doesn't use the `face' property at all, then apply the face
+`transient-heading' to the complete string."
(when-let ((desc (cl-call-next-method obj)))
(if (text-property-not-all 0 (length desc) 'face nil desc)
desc
(propertize desc 'face 'transient-heading))))
(cl-defmethod transient-format-description :around ((obj transient-suffix))
- "Format the description by calling the next method.
-If the result is nil, then use \"(BUG: no description)\" as the
-description. If the OBJ's `key' is currently unreachable, then
-apply the face `transient-unreachable' to the complete string."
+ "Format the description by calling the next method. If the result
+is nil, then use \"(BUG: no description)\" as the description.
+If the OBJ's `key' is currently unreachable, then apply the face
+`transient-unreachable' to the complete string."
(let ((desc (or (cl-call-next-method obj)
(and (slot-boundp transient--prefix 'suffix-description)
(funcall (oref transient--prefix suffix-description)
@@ -3672,5 +3672,6 @@ we stop there."
(provide 'transient)
;; Local Variables:
;; indent-tabs-mode: nil
+;; checkdoc-symbol-words: ("command-line" "edit-mode" "help-mode")
;; End:
;;; transient.el ends here
diff --git a/test/lisp/repeat-tests.el b/test/lisp/repeat-tests.el
new file mode 100644
index 0000000..a1f9bbb
--- /dev/null
+++ b/test/lisp/repeat-tests.el
@@ -0,0 +1,111 @@
+;;; repeat-tests.el --- Tests for repeat.el -*- lexical-binding: t;
-*-
+
+;; Copyright (C) 2021 Free Software Foundation, Inc.
+
+;; Author: Juri Linkov <juri@linkov.net>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'repeat)
+
+(defvar repeat-tests-calls nil)
+
+(defun repeat-tests-call-a (&optional arg)
+ (interactive "p")
+ (push `(,arg a) repeat-tests-calls))
+
+(defun repeat-tests-call-b (&optional arg)
+ (interactive "p")
+ (push `(,arg b) repeat-tests-calls))
+
+(defvar repeat-tests-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "C-x w a") 'repeat-tests-call-a)
+ map)
+ "Keymap for keys that initiate repeating sequences.")
+
+(defvar repeat-tests-repeat-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "a" 'repeat-tests-call-a)
+ (define-key map "b" 'repeat-tests-call-b)
+ map)
+ "Keymap for repeating sequences.")
+(put 'repeat-tests-call-a 'repeat-map 'repeat-tests-repeat-map)
+(put 'repeat-tests-call-b 'repeat-map 'repeat-tests-repeat-map)
+
+(defmacro with-repeat-mode (&rest body)
+ "Create environment for testing `repeat-mode'."
+ `(unwind-protect
+ (progn
+ (repeat-mode +1)
+ (with-temp-buffer
+ (save-window-excursion
+ ;; `execute-kbd-macro' applied to window only
+ (set-window-buffer nil (current-buffer))
+ (use-local-map repeat-tests-map)
+ ,@body)))
+ (repeat-mode -1)))
+
+(defun repeat-tests--check (keys calls inserted)
+ (setq repeat-tests-calls nil)
+ (delete-region (point-min) (point-max))
+ (execute-kbd-macro (kbd keys))
+ (should (equal (nreverse repeat-tests-calls) calls))
+ ;; Check for self-inserting keys
+ (should (equal (buffer-string) inserted)))
+
+(ert-deftest repeat-tests-exit-key ()
+ (with-repeat-mode
+ (let ((repeat-echo-function 'ignore))
+ (let ((repeat-exit-key nil))
+ (repeat-tests--check
+ "C-x w a b a b RET c"
+ '((1 a) (1 b) (1 a) (1 b)) "\nc"))
+ (let ((repeat-exit-key [return]))
+ (repeat-tests--check
+ "C-x w a b a b <return> c"
+ '((1 a) (1 b) (1 a) (1 b)) "c")))))
+
+(ert-deftest repeat-tests-keep-prefix ()
+ (with-repeat-mode
+ (let ((repeat-echo-function 'ignore))
+ (repeat-tests--check
+ "C-x w a b a b c"
+ '((1 a) (1 b) (1 a) (1 b)) "c")
+ (let ((repeat-keep-prefix nil))
+ (repeat-tests--check
+ "C-2 C-x w a b a b c"
+ '((2 a) (1 b) (1 a) (1 b)) "c")
+ (repeat-tests--check
+ "C-2 C-x w a C-3 c"
+ '((2 a)) "ccc"))
+ ;; TODO: fix and uncomment
+ ;; (let ((repeat-keep-prefix t))
+ ;; (repeat-tests--check
+ ;; "C-2 C-x w a b a b c"
+ ;; '((2 a) (2 b) (2 a) (2 b)) "c")
+ ;; (repeat-tests--check
+ ;; "C-2 C-x w a C-1 C-2 b a C-3 C-4 b c"
+ ;; '((2 a) (12 b) (12 a) (34 b)) "c"))
+ )))
+
+;; TODO: :tags '(:expensive-test) for repeat-exit-timeout
+
+(provide 'repeat-tests)
+;;; repeat-tests.el ends here