commit f804248b4fd5245443e3ace916d1b96261ca4ce0 (HEAD, refs/remotes/origin/master) Author: Lars Ingebrigtsen Date: Fri Aug 20 02:32:02 2021 +0200 Tweak a failing custom test * test/lisp/custom-tests.el (custom-tests-require-theme): Fix a native-comp-related test failure. In this test, we set load-path to nil, and under native-comp some of the tests want to give a warning: Warning (comp): Cannot look-up eln file as no source file was found for /tmp/custom-tests-bfdbkW/custom-tests--d.elc But we can't load warning.el after setting load-path to nil, so require it first. diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el index e93c96e1d9..f4c43b0a14 100644 --- a/test/lisp/custom-tests.el +++ b/test/lisp/custom-tests.el @@ -96,6 +96,7 @@ Ensure the directory is recursively deleted after the fact." (ert-deftest custom-tests-require-theme () "Test `require-theme'." + (require 'warnings) (custom-tests--with-temp-dir (let* ((default-directory temporary-file-directory) (custom-theme-load-path (list default-directory)) commit fb81c8c3adf8633f2f617c82f6019aef630860c7 Author: João Távora Date: Thu Aug 19 23:54:51 2021 +0100 Make icomplete-forward-completions O(1) when icomplete-scroll is t In particular, this makes the recently added icomplete-vertical-goto-last (bug#49005) be O(n) instead of O(n^2). That used to be almost unbearably slow for large n. * lisp/icomplete.el (icomplete-forward-completions): don't call last unless needed. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 8407393389..03616f9b6a 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -258,14 +258,14 @@ Return non-nil iff something was stepped." (interactive) (let* ((beg (icomplete--field-beg)) (end (icomplete--field-end)) - (comps (completion-all-sorted-completions beg end)) - (last (last comps))) + (comps (completion-all-sorted-completions beg end))) (when (consp (cdr comps)) (cond (icomplete-scroll (push (pop comps) icomplete--scrolled-past) (setq icomplete--scrolled-completions comps)) (t - (setcdr (last comps) (cons (pop comps) (cdr last))))) + (let ((last (last comps))) + (setcdr (last comps) (cons (pop comps) (cdr last)))))) (completion--cache-all-sorted-completions beg end comps)))) (defun icomplete-backward-completions () commit a3df92f4839699388b096001b65c43f1a37273a3 Author: Lars Ingebrigtsen Date: Thu Aug 19 18:26:18 2021 +0200 Remove more mentions of the removed `M-o' facemenu binding * doc/emacs/text.texi (Fill Commands, Fill Commands): Adjust `M-o' mentions. * etc/refcards/refcard.tex (section{Formatting}): * etc/refcards/pt-br-refcard.tex (section{Formatando}): * etc/refcards/fr-refcard.tex (section{Formater}): Remove mention of `M-o'. diff --git a/doc/emacs/commands.texi b/doc/emacs/commands.texi index 82a917ce7d..f56f820b39 100644 --- a/doc/emacs/commands.texi +++ b/doc/emacs/commands.texi @@ -121,7 +121,7 @@ C-k} is two key sequences, not one. By default, the prefix keys in Emacs are @kbd{C-c}, @kbd{C-h}, @kbd{C-x}, @kbd{C-x @key{RET}}, @kbd{C-x @@}, @kbd{C-x a}, @kbd{C-x n}, @kbd{C-x r}, @kbd{C-x t}, @kbd{C-x v}, @kbd{C-x 4}, @kbd{C-x 5}, -@kbd{C-x 6}, @key{ESC}, @kbd{M-g}, and @kbd{M-o}. (@key{F1} and +@kbd{C-x 6}, @key{ESC}, and @kbd{M-g}. (@key{F1} and @key{F2} are aliases for @kbd{C-h} and @kbd{C-x 6}.) This list is not cast in stone; if you customize Emacs, you can make new prefix keys. You could even eliminate some of the standard ones, though this is not diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi index 3b9d5c2ea6..dc8ca903b7 100644 --- a/doc/emacs/text.texi +++ b/doc/emacs/text.texi @@ -572,7 +572,7 @@ Set the fill column (@code{set-fill-column}). Fill each paragraph in the region (@code{fill-region}). @item M-x fill-region-as-paragraph Fill the region, considering it as one paragraph. -@item M-o M-s +@item M-x center-line Center a line. @end table @@ -621,10 +621,9 @@ numeric argument, it uses that as the new fill column. With just @kbd{C-u} as argument, it sets @code{fill-column} to the current horizontal position of point. -@kindex M-o M-s @r{(Text mode)} @cindex centering @findex center-line - The command @kbd{M-o M-s} (@code{center-line}) centers the current line + The command @kbd{M-x center-line} centers the current line within the current fill column. With an argument @var{n}, it centers @var{n} lines individually and moves past them. This binding is made by Text mode and is available only in that and related modes diff --git a/etc/facemenu-removal.txt b/etc/facemenu-removal.txt deleted file mode 100644 index 9a969df0e4..0000000000 --- a/etc/facemenu-removal.txt +++ /dev/null @@ -1,20 +0,0 @@ -`facemenu-keymap' (normally bound to `M-o') has been disabled. -============================================================== - -We've disabled the normal `M-o' keymap for a month (until March the -10th, 2021) in the development version of Emacs to see whether anybody -uses this feature. - -If the removal of this key binding doesn't annoy too many people, the -plan is to then leave the it unbound, for usage by third-party -packages and users. - -If you wish to restore the binding during the trial period, you can -put the following in your .emacs file: - -(facemenu-keymap-restore) - -After the trial period is over, the function will be removed. - -If you wish to protest the removal of the `M-o' key binding, please -send your thoughts to the emacs-devel@gnu.org mailing list. diff --git a/etc/refcards/de-refcard.tex b/etc/refcards/de-refcard.tex index c890acb69f..9cd0df7a5e 100644 --- a/etc/refcards/de-refcard.tex +++ b/etc/refcards/de-refcard.tex @@ -443,8 +443,6 @@ \section{Formatierung} \key{Spalte f\"ur Umbruch auf {\it Argument\/} setzen}{C-x f} \key{Pr\"afix f\"ur jede Zeile setzen}{C-x .} -\key{Face setzen}{M-o} - \section{Gro\ss{}- und Kleinschreibung} \key{Wort in Gro\ss{}buchstaben}{M-u} diff --git a/etc/refcards/fr-refcard.tex b/etc/refcards/fr-refcard.tex index 34d7ebda19..ad6db6340d 100644 --- a/etc/refcards/fr-refcard.tex +++ b/etc/refcards/fr-refcard.tex @@ -446,8 +446,6 @@ \section{Formater} \key{Placer la marge droite \`a {\it arg\/} colonnes}{C-u {\it arg\/} C-x f} \key{D\'efinir le pr\'efixe des lignes}{C-x .} -\key{D\'efinir la fonte}{M-o} - \section{Modifier la casse} \key{Mettre le mot en capitales}{M-u} diff --git a/etc/refcards/pt-br-refcard.tex b/etc/refcards/pt-br-refcard.tex index 2d6680f793..9226a6d8fb 100644 --- a/etc/refcards/pt-br-refcard.tex +++ b/etc/refcards/pt-br-refcard.tex @@ -452,8 +452,6 @@ \section{Formatando} \key{define a coluna limite de preenchimento}{C-x f} \key{define um prefixo para cada linha}{C-x .} -\key{formata fonte}{M-o} - \section{Mai{\'u}sculas e Min{\'u}sculas} \key{Palavra para mai{\'u}sculas}{M-u} diff --git a/etc/refcards/refcard.tex b/etc/refcards/refcard.tex index 4cb8f9d50a..ae39a4e9f7 100644 --- a/etc/refcards/refcard.tex +++ b/etc/refcards/refcard.tex @@ -457,8 +457,6 @@ \section{Formatting} \key{set fill column to {\it arg}}{C-x f} \key{set prefix each line starts with}{C-x .} -\key{set face}{M-o} - \section{Case Change} \key{uppercase word}{M-u} commit bfa3191c79df5a5e500a11ec8fab505c3b1cb2f3 Author: Madhu Date: Thu Aug 19 18:01:06 2021 +0200 Correctly call completion-in-region in shell.el * lisp/shell.el (shell-dynamic-complete-command) (shell-dynamic-complete-environment-variable): Correctly call completion-in-region (bug#50125). Copyright-paperwork-exempt: yes diff --git a/lisp/shell.el b/lisp/shell.el index 292f267d2e..5cdc0385a6 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -1199,7 +1199,7 @@ Returns t if successful." (if data (prog2 (unless (window-minibuffer-p) (message "Completing command name...")) - (apply #'completion-in-region data))))) + (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)))))) (defun shell-command-completion () "Return the completion data for the command at point, if any." @@ -1314,7 +1314,7 @@ Returns non-nil if successful." (if data (prog2 (unless (window-minibuffer-p) (message "Completing variable name...")) - (apply #'completion-in-region data))))) + (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)))))) (defun shell-environment-variable-completion () commit 489ddc56ab761f2c7308db42bea7fc74ae4bead0 Author: Basil L. Contovounesios Date: Thu Aug 19 16:58:58 2021 +0100 ; Fix escaping in recent ibuf-ext.el doc change. diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index c73f899656..907ee8d63f 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -337,9 +337,9 @@ For instance: (setq ibuffer-saved-filter-groups \\='((\"Home\" (\"Modified\" (predicate buffer-modified-p (current-buffer))) - (\"Helm\" (name . \"\*helm.+\")) - (\"Dev\" (or (filename . \".+\.css$\") - (filename . \".+\.html?$\") + (\"Helm\" (name . \"\\\\*helm.+\")) + (\"Dev\" (or (filename . \".+\\\\.css\\\\'\") + (filename . \".+\\\\.html?\\\\'\") (mode . android-mode) (mode . clojure-mode)))))) commit 9bf8bb0e3e2dc7b62626d877d64adcbd12238be1 Author: Lars Ingebrigtsen Date: Thu Aug 19 17:48:14 2021 +0200 Fix space at the start of appt mode line element * lisp/calendar/appt.el (appt-check): Add space at the end (bug#18164) -- all `global-mode-string' elements should have it there to get an even space distribution. diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el index 29bcd6de2c..f523863440 100644 --- a/lisp/calendar/appt.el +++ b/lisp/calendar/appt.el @@ -402,11 +402,12 @@ displayed in a window: (appt-display-message string-list min-list)) (when appt-display-mode-line (setq appt-mode-string - (concat " " (propertize - (appt-mode-line (mapcar #'number-to-string - min-list) - t) - 'face 'mode-line-emphasis)))) + (concat (propertize + (appt-mode-line (mapcar #'number-to-string + min-list) + t) + 'face 'mode-line-emphasis) + " "))) ;; Reset count to 0 in case we display another appt on the next cycle. (setq appt-display-count (if (eq '(0) min-list) 0 (1+ prev-appt-display-count)))) commit cd00fb5e2a813a71969d1370bb05e1c533107045 Author: Lars Ingebrigtsen Date: Thu Aug 19 17:11:00 2021 +0200 Add ibuffer-saved-filter-groups example to the doc string * lisp/ibuf-ext.el (ibuffer-saved-filter-groups): Add an example for this complicated syntax (bug#18694). diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 1dc8acbe1f..c73f899656 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -332,6 +332,17 @@ where NAME is a unique but arbitrary name and FILTER-GROUP-LIST is a list of filter groups with the same structure as allowed for `ibuffer-filter-groups'. +For instance: + + (setq ibuffer-saved-filter-groups + \\='((\"Home\" + (\"Modified\" (predicate buffer-modified-p (current-buffer))) + (\"Helm\" (name . \"\*helm.+\")) + (\"Dev\" (or (filename . \".+\.css$\") + (filename . \".+\.html?$\") + (mode . android-mode) + (mode . clojure-mode)))))) + See also the functions `ibuffer-save-filter-groups' and `ibuffer-switch-to-saved-filter-groups' for saving and switching between sets of filter groups, and the variable commit 04f723dec944eaa7b5e99373840a8bf920ba5fdd Author: Lars Ingebrigtsen Date: Thu Aug 19 16:21:07 2021 +0200 Fix dired switch (that contain quotes and spaces) parsing * lisp/files.el (insert-directory): Tokenize shell strings correctly (bug#18875). diff --git a/lisp/files.el b/lisp/files.el index 875ac55316..77977f1411 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7463,7 +7463,7 @@ normally equivalent short `-D' option is just passed on to (unless (equal switches "") ;; Split the switches at any spaces so we can ;; pass separate options as separate args. - (split-string-and-unquote switches))) + (split-string-shell-command switches))) ;; Avoid lossage if FILE starts with `-'. '("--") (list file)))))) commit a44432a773f7e131692e3f5c9d765cffeef0739a Author: Lars Ingebrigtsen Date: Thu Aug 19 15:19:23 2021 +0200 Fix st.el doc string * lisp/term/st.el (xterm-st-extra-capabilities): New user option (bug#50119). (terminal-init-st): Use it to avoid a two-second timeout. diff --git a/lisp/term/st.el b/lisp/term/st.el index e1db450b3e..f1cbad6d59 100644 --- a/lisp/term/st.el +++ b/lisp/term/st.el @@ -13,9 +13,7 @@ (defcustom xterm-st-extra-capabilities '( modifyOtherKeys getSelection setSelection) - "Extra capabilities supported under \"stterm\". -Some features of screen depend on the terminal emulator in which -it runs, which can change when the screen session is moved to another tty." + "Extra capabilities supported under \"stterm\"." :version "28.1" :type xterm--extra-capabilities-type :group 'xterm) commit 8bc6dbecd214ff1649edab2258274385ec00a876 Author: Peter Münster Date: Wed Aug 18 11:21:51 2021 +0200 Add support for history of image tags and completion in the minibuffer * lisp/image-dired.el (image-dired-tag-history): New variable holding the tag history. (image-dired-tag-files, image-dired-tag-thumbnail, image-dired-delete-tag) (image-dired-tag-thumbnail-remove): Use it for the user input. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 97fbd7bb1f..cf878ae122 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -652,6 +652,8 @@ Each item has the form (ORIGINAL-FILE TARGET-FILE).") "Maximum number of concurrent jobs permitted for generating images. Increase at own risk.") +(defvar image-dired-tag-history nil "Variable holding the tag history.") + (defun image-dired-pngnq-thumb (spec) "Quantize thumbnail described by format SPEC with pngnq(1)." (let ((process @@ -1147,7 +1149,9 @@ FILE-TAGS is an alist in the following form: (defun image-dired-tag-files (arg) "Tag marked file(s) in dired. With prefix ARG, tag file at point." (interactive "P") - (let ((tag (read-string "Tags to add (separate tags with a semicolon): ")) + (let ((tag (completing-read + "Tags to add (separate tags with a semicolon): " + image-dired-tag-history nil nil nil 'image-dired-tag-history)) files) (if arg (setq files (list (dired-get-filename))) @@ -1161,7 +1165,9 @@ FILE-TAGS is an alist in the following form: (defun image-dired-tag-thumbnail () "Tag current or marked thumbnails." (interactive) - (let ((tag (read-string "Tags to add (separate tags with a semicolon): "))) + (let ((tag (completing-read + "Tags to add (separate tags with a semicolon): " + image-dired-tag-history nil nil nil 'image-dired-tag-history))) (image-dired--with-marked (image-dired-write-tags (list (cons (image-dired-original-file-name) tag))) @@ -1173,7 +1179,8 @@ FILE-TAGS is an alist in the following form: "Remove tag for selected file(s). With prefix argument ARG, remove tag from file at point." (interactive "P") - (let ((tag (read-string "Tag to remove: ")) + (let ((tag (completing-read "Tag to remove: " image-dired-tag-history + nil nil nil 'image-dired-tag-history)) files) (if arg (setq files (list (dired-get-filename))) @@ -1183,7 +1190,8 @@ With prefix argument ARG, remove tag from file at point." (defun image-dired-tag-thumbnail-remove () "Remove tag from current or marked thumbnails." (interactive) - (let ((tag (read-string "Tag to remove: "))) + (let ((tag (completing-read "Tag to remove: " image-dired-tag-history + nil nil nil 'image-dired-tag-history))) (image-dired--with-marked (image-dired-remove-tag (image-dired-original-file-name) tag) (image-dired-update-property commit 63d6e1ffa198d729245eaf51641bfec09ee5e2c4 Author: Peter Münster Date: Wed Aug 18 02:02:02 2021 +0200 Avoid problems when one tag/file is a substring of another * lisp/image-dired.el (image-dired-remove-tag): End of filename is bound by ";" and end of tag is bound by ";" or end of line. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 542701470e..97fbd7bb1f 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1111,11 +1111,12 @@ FILE-TAGS is an alist in the following form: (error "Files must be a string or a list of strings!"))) (dolist (file files) (goto-char (point-min)) - (when (search-forward-regexp (format "^%s" file) nil t) + (when (search-forward-regexp (format "^%s;" file) nil t) (end-of-line) (setq end (point)) (beginning-of-line) - (when (search-forward-regexp (format "\\(;%s\\)" tag) end t) + (when (search-forward-regexp + (format "\\(;%s\\)\\($\\|;\\)" tag) end t) (delete-region (match-beginning 1) (match-end 1)) ;; Check if file should still be in the database. If ;; it has no tags or comments, it will be removed. commit 101b3c81b657198ebaf9abdaa0875d1b09d66192 Author: Peter Münster Date: Wed Aug 18 01:37:43 2021 +0200 New placement of newline characters in image-dired-db-file It's more usual to have the newline at the end of the line, instead of the beginning. This change avoids missing newline at the end of the file, an empty line at the start and eventually a lot of empty lines when `require-final-newline' is not nil. * lisp/image-dired.el (image-dired-write-tags): Insert newline at the end of the line, instead of the beginning. (image-dired-remove-tag): Do not delete empty line at end of buffer. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 9455ab1ff0..542701470e 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -1096,7 +1096,7 @@ FILE-TAGS is an alist in the following form: (end-of-line) (insert (format ";%s" tag)))) (goto-char (point-max)) - (insert (format "\n%s;%s" file tag)))) + (insert (format "%s;%s\n" file tag)))) (save-buffer)))) (defun image-dired-remove-tag (files tag) @@ -1123,11 +1123,7 @@ FILE-TAGS is an alist in the following form: (setq end (point)) (beginning-of-line) (when (not (search-forward ";" end t)) - (kill-line 1) - ;; If on empty line at end of buffer - (and (eobp) - (looking-at "^$") - (delete-char -1))))))) + (kill-line 1)))))) (save-buffer))) (defun image-dired-list-tags (file) @@ -2185,7 +2181,7 @@ FILE-COMMENTS is an alist on the following form: (insert (format "comment:%s;" comment))) ;; File does not exist in database - add it. (goto-char (point-max)) - (insert (format "\n%s;comment:%s" file comment)))) + (insert (format "%s;comment:%s\n" file comment)))) (save-buffer)))) (defun image-dired-update-property (prop value) commit bf64342a8ffd8777df10051037ca13ec4f6857a5 Author: Peter Münster Date: Tue Aug 17 00:19:08 2021 +0200 Fix deletion of associated image * lisp/image-dired.el (image-dired-delete-marked): Treat original images first, because point position is used when there are no marked files. diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 1e1614af9b..9455ab1ff0 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -2313,14 +2313,14 @@ non-nil." (image-dired-dired-file-marked-p)))))) (defun image-dired-delete-marked () - "Delete marked thumbnails and associated images." + "Delete current or marked thumbnails and associated images." (interactive) + (with-current-buffer (image-dired-associated-dired-buffer) + (dired-do-delete)) (image-dired--with-marked (image-dired-delete-char) (backward-char)) - (image-dired--line-up-with-method) - (with-current-buffer (image-dired-associated-dired-buffer) - (dired-do-delete))) + (image-dired--line-up-with-method)) (defun image-dired-thumb-update-marks () "Update the marks in the thumbnail buffer." commit 1511f3cecce73e227a3bbcd7b4d8041fe579f908 Author: Eli Zaretskii Date: Thu Aug 19 15:44:55 2021 +0300 Fix inaccuracies in documentation of 'message-truncate-lines' * doc/lispref/display.texi (Echo Area Customization): * src/xdisp.c (syms_of_xdisp): Adjust the documentation of message-truncate-lines to changes that fixed bug#46718. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 79fb72a464..7ab2896778 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -646,9 +646,9 @@ If the value is zero, then command input is not echoed. @defvar message-truncate-lines Normally, displaying a long message resizes the echo area to display -the entire message. But if the variable @code{message-truncate-lines} -is non-@code{nil}, the echo area does not resize, and the message is -truncated to fit it. +the entire message, wrapping long line as needed. But if the variable +@code{message-truncate-lines} is non-@code{nil}, long lines of +echo-area message are instead truncated to fit the mini-window width. @end defvar The variable @code{max-mini-window-height}, which specifies the diff --git a/src/xdisp.c b/src/xdisp.c index 0846af268e..e853c8c223 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -35445,7 +35445,7 @@ and `scroll-right' overrides this variable's effect. */); Vhscroll_step = make_fixnum (0); DEFVAR_BOOL ("message-truncate-lines", message_truncate_lines, - doc: /* If non-nil, messages are truncated instead of resizing the echo area. + doc: /* If non-nil, messages are truncated when displaying the echo area. Bind this around calls to `message' to let it take effect. */); message_truncate_lines = false; commit 787fa7a8ab3ccf12c0e7e4efafd7506999071ea5 Author: Eli Zaretskii Date: Thu Aug 19 15:29:49 2021 +0300 Minor doc fixes in icomplete.el * lisp/icomplete.el (icomplete-section): Add :version. (icomplete--augment): Doc fix. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index ee34d85514..8407393389 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -112,7 +112,8 @@ Otherwise this should be a list of the completion tables (e.g., :version "28.1") (defface icomplete-section '((t :inherit shadow :slant italic)) - "Face used by `icomplete-vertical-mode' for the section title.") + "Face used by `icomplete-vertical-mode' for the section title." + :version "28.1") ;;;_* User Customization variables (defcustom icomplete-prospects-height 2 @@ -750,7 +751,7 @@ See `icomplete-mode' and `minibuffer-setup-hook'." (defun icomplete--augment (md prospects) "Augment completion strings in PROSPECTS with completion metadata MD. Return a list of strings (COMP PREFIX SUFFIX SECTION). PREFIX -and SUFFIX, if non-nil are obtained from `affixation-function' or +and SUFFIX, if non-nil, are obtained from `affixation-function' or `annotation-function' metadata. SECTION is obtained from `group-function'. Consecutive `equal' sections are avoided. COMP is the element in PROSPECTS or a transformation also given commit 8e93a37b7732e90a2b102b7246cc2cd69d840208 Author: Eli Zaretskii Date: Thu Aug 19 15:25:26 2021 +0300 ; * src/xdisp.c (hscroll_window_tree): Fix a typo in a comment. diff --git a/src/xdisp.c b/src/xdisp.c index dd2ceda023..0846af268e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -14903,7 +14903,7 @@ hscroll_window_tree (Lisp_Object window) echo-area messages. This is because desired_matrix of such windows was prepared while momentarily switched to an echo-area buffer, which is different - from w->contents, and wew simply cannot hscroll such + from w->contents, and we simply cannot hscroll such windows safely. */ && !(w == XWINDOW (echo_area_window) && !NILP (echo_area_buffer[0]))) commit 4bd7be2b8f9420a11d6d06fed6128e082f4e6792 Author: Eli Zaretskii Date: Thu Aug 19 15:24:14 2021 +0300 Fix errors with hscrolling mini-windows under truncate-lines * src/xdisp.c (hscroll_window_tree): Disallow hscroll in mini-windows that display echo-area messages. (Bug#50096) diff --git a/src/xdisp.c b/src/xdisp.c index ada9ed6c22..dd2ceda023 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11771,7 +11771,7 @@ display_echo_area (struct window *w) /* If there is no message, we must call display_echo_area_1 nevertheless because it resizes the window. But we will have to reset the echo_area_buffer in question to nil at the end because - with_echo_area_buffer will sets it to an empty buffer. */ + with_echo_area_buffer will set it to an empty buffer. */ bool i = display_last_displayed_message_p; /* According to the C99, C11 and C++11 standards, the integral value of a "bool" is always 0 or 1, so this array access is safe here, @@ -14898,7 +14898,15 @@ hscroll_window_tree (Lisp_Object window) if (WINDOWP (w->contents)) hscrolled_p |= hscroll_window_tree (w->contents); - else if (w->cursor.vpos >= 0) + else if (w->cursor.vpos >= 0 + /* Don't allow hscroll in mini-windows that display + echo-area messages. This is because desired_matrix + of such windows was prepared while momentarily + switched to an echo-area buffer, which is different + from w->contents, and wew simply cannot hscroll such + windows safely. */ + && !(w == XWINDOW (echo_area_window) + && !NILP (echo_area_buffer[0]))) { int h_margin; int text_area_width; commit 6276f73115a0e976ea1e1cfdec231ca6c2396c88 Author: Lars Ingebrigtsen Date: Thu Aug 19 14:18:27 2021 +0200 stterm doesn't understand all codes that xterm does * lisp/term/st.el (xterm-st-extra-capabilities): New user option (bug#50119). (terminal-init-st): Use it to avoid a two-second timeout. diff --git a/lisp/term/st.el b/lisp/term/st.el index 9a1c0646f8..e1db450b3e 100644 --- a/lisp/term/st.el +++ b/lisp/term/st.el @@ -11,9 +11,20 @@ (require 'term/xterm) +(defcustom xterm-st-extra-capabilities '( modifyOtherKeys getSelection + setSelection) + "Extra capabilities supported under \"stterm\". +Some features of screen depend on the terminal emulator in which +it runs, which can change when the screen session is moved to another tty." + :version "28.1" + :type xterm--extra-capabilities-type + :group 'xterm) + (defun terminal-init-st () "Terminal initialization function for st." - (tty-run-terminal-initialization (selected-frame) "xterm")) + ;; Using `check' leads to a two-second timeout. + (let ((xterm-extra-capabilities xterm-st-extra-capabilities)) + (tty-run-terminal-initialization (selected-frame) "xterm"))) (provide 'term/st) commit 37f0ea99f8dc967f506b70f0d9ccb2a8fe76ca22 Author: João Távora Date: Thu Aug 19 11:29:14 2021 +0100 ; Correct :version tag of icomplete-selected-match face * lisp/icomplete.el (icomplete-selected-match): Fix :version diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 73aaa3196a..ee34d85514 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -109,7 +109,7 @@ Otherwise this should be a list of the completion tables (e.g., (defface icomplete-selected-match '((t :inherit highlight)) "Face used by `icomplete-vertical-mode' for the selected candidate." - :version "24.4") + :version "28.1") (defface icomplete-section '((t :inherit shadow :slant italic)) "Face used by `icomplete-vertical-mode' for the section title.") commit 2be8e2ffc9dff0b43cc6beaac9084791e2f62be6 Author: João Távora Date: Thu Aug 19 00:48:26 2021 +0100 Section by 'group-function' in Icomplete and Fido's vertical modes Fixes: bug#48545 * lisp/icomplete.el (icomplete--augment): Rewrite from icomplete--affixate. (icomplete--render-vertical): Rework. (icomplete--vertical-minibuffer-setup): Separator is hardcoded "\n", no need to set. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 81fc6ff03c..73aaa3196a 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -111,6 +111,9 @@ Otherwise this should be a list of the completion tables (e.g., "Face used by `icomplete-vertical-mode' for the selected candidate." :version "24.4") +(defface icomplete-section '((t :inherit shadow :slant italic)) + "Face used by `icomplete-vertical-mode' for the section title.") + ;;;_* User Customization variables (defcustom icomplete-prospects-height 2 ;; We used to compute how many lines 100 characters would take in @@ -635,8 +638,7 @@ Usually run by inclusion in `minibuffer-setup-hook'." "Setup the minibuffer for vertical display of completion candidates." (use-local-map (make-composed-keymap icomplete-vertical-mode-minibuffer-map (current-local-map))) - (setq-local icomplete-separator "\n" - icomplete-hide-common-prefix nil + (setq-local icomplete-hide-common-prefix nil ;; Ask `icomplete-completions' to return enough completions candidates. icomplete-prospects-height 25 redisplay-adhoc-scroll-in-resize-mini-windows nil)) @@ -745,14 +747,21 @@ See `icomplete-mode' and `minibuffer-setup-hook'." (format icomplete-matches-format current total)))) (overlay-put icomplete-overlay 'after-string text)))))))) -(defun icomplete--affixate (md prospects) - "Affixate PROSPECTS given completion metadata MD. -Return a list of (COMP PREFIX SUFFIX)." - (let ((aff-fun (or (completion-metadata-get md 'affixation-function) - (plist-get completion-extra-properties :affixation-function))) - (ann-fun (or (completion-metadata-get md 'annotation-function) - (plist-get completion-extra-properties :annotation-function)))) - (cond (aff-fun +(defun icomplete--augment (md prospects) + "Augment completion strings in PROSPECTS with completion metadata MD. +Return a list of strings (COMP PREFIX SUFFIX SECTION). PREFIX +and SUFFIX, if non-nil are obtained from `affixation-function' or +`annotation-function' metadata. SECTION is obtained from +`group-function'. Consecutive `equal' sections are avoided. +COMP is the element in PROSPECTS or a transformation also given +by `group-function''s second \"transformation\" protocol." + (let* ((aff-fun (or (completion-metadata-get md 'affixation-function) + (plist-get completion-extra-properties :affixation-function))) + (ann-fun (or (completion-metadata-get md 'annotation-function) + (plist-get completion-extra-properties :annotation-function))) + (grp-fun (completion-metadata-get md 'group-function)) + (annotated + (cond (aff-fun (funcall aff-fun prospects)) (ann-fun (mapcar @@ -766,9 +775,24 @@ Return a list of (COMP PREFIX SUFFIX)." suffix (propertize suffix 'face 'completions-annotations))))) prospects)) - (prospects)))) - -(cl-defun icomplete--render-vertical (comps md &aux scroll-above scroll-below) + (t (mapcar #'list prospects))))) + (if grp-fun + (cl-loop with section = nil + for (c prefix suffix) in annotated + for selectedp = (get-text-property 0 'icomplete-selected c) + for tr = (propertize (or (funcall grp-fun c t) c) + 'icomplete-selected selectedp) + if (not (equal section (setq section (funcall grp-fun c nil)))) + collect (list tr prefix suffix section) + else collect (list tr prefix suffix )) + annotated))) + +(cl-defun icomplete--render-vertical + (comps md &aux scroll-above scroll-below + (total-space ; number of mini-window lines available + (1- (min + icomplete-prospects-height + (truncate (max-mini-window-lines) 1))))) ;; Welcome to loopapalooza! ;; ;; First, be mindful of `icomplete-scroll' and manual scrolls. If @@ -776,11 +800,11 @@ Return a list of (COMP PREFIX SUFFIX)." ;; are: ;; ;; - both nil, there is no manual scroll; - ;; - both non-nil, there is a healthy manual scroll the doesn't need + ;; - both non-nil, there is a healthy manual scroll that doesn't need ;; to be readjusted (user just moved around the minibuffer, for ;; example)l ;; - non-nil and nil, respectively, a refiltering took place and we - ;; need attempt to readjust them to the new filtered `comps'. + ;; may need to readjust them to the new filtered `comps'. (when (and icomplete-scroll icomplete--scrolled-completions (null icomplete--scrolled-past)) @@ -802,52 +826,67 @@ Return a list of (COMP PREFIX SUFFIX)." ;; positions. (cl-loop with preds = icomplete--scrolled-past with succs = (cdr comps) - with max-lines = (1- (min - icomplete-prospects-height - (truncate (max-mini-window-lines) 1))) - with max-above = (- max-lines - 1 - (cl-loop for (_ . r) on comps - repeat (truncate max-lines 2) - while (listp r) - count 1)) - repeat max-lines + with space-above = (- total-space + 1 + (cl-loop for (_ . r) on comps + repeat (truncate total-space 2) + while (listp r) + count 1)) + repeat total-space for neighbour = nil - if (and preds (> max-above 0)) do + if (and preds (> space-above 0)) do (push (setq neighbour (pop preds)) scroll-above) - (cl-decf max-above) + (cl-decf space-above) else if (consp succs) collect (setq neighbour (pop succs)) into scroll-below-aux while neighbour finally (setq scroll-below scroll-below-aux)) - ;; Now figure out spacing and layout - ;; - (cl-loop - with selected = (substring (car comps)) - initially (add-face-text-property 0 (length selected) - 'icomplete-selected-match 'append selected) - with torender = (nconc scroll-above (list selected) scroll-below) - with triplets = (icomplete--affixate md torender) - initially (when (eq triplets torender) - (cl-return-from icomplete--render-vertical - (concat - " \n" - (mapconcat #'identity torender icomplete-separator)))) - for (comp prefix) in triplets - maximizing (length prefix) into max-prefix-len - maximizing (length comp) into max-comp-len - finally return - ;; Finally, render - ;; - (concat - " \n" - (cl-loop for (comp prefix suffix) in triplets - concat prefix - concat (make-string (- max-prefix-len (length prefix)) ? ) - concat comp - concat (make-string (- max-comp-len (length comp)) ? ) - concat suffix - concat icomplete-separator)))) + ;; Halfway there... + (let* ((selected (propertize (car comps) 'icomplete-selected t)) + (chosen (append scroll-above (list selected) scroll-below)) + (tuples (icomplete--augment md chosen)) + max-prefix-len max-comp-len lines nsections) + (add-face-text-property 0 (length selected) + 'icomplete-selected-match 'append selected) + ;; Figure out parameters for horizontal spacing + (cl-loop + for (comp prefix) in tuples + maximizing (length prefix) into max-prefix-len-aux + maximizing (length comp) into max-comp-len-aux + finally (setq max-prefix-len max-prefix-len-aux + max-comp-len max-comp-len-aux)) + ;; Serialize completions and section titles into a list + ;; of lines to render + (cl-loop + for (comp prefix suffix section) in tuples + when section + collect (propertize section 'face 'icomplete-section) into lines-aux + and count 1 into nsections-aux + when (get-text-property 0 'icomplete-selected comp) + do (add-face-text-property 0 (length comp) + 'icomplete-selected-match 'append comp) + collect (concat prefix + (make-string (- max-prefix-len (length prefix)) ? ) + comp + (make-string (- max-comp-len (length comp)) ? ) + suffix) + into lines-aux + finally (setq lines lines-aux + nsections nsections-aux)) + ;; Kick out some lines from the beginning due to extra sections. + ;; This hopes to keep the selected entry more or less in the + ;; middle of the dropdown-like widget when `icomplete-scroll' is + ;; t. Funky, but at least I didn't use `cl-loop' + (setq lines + (nthcdr + (cond ((<= (length lines) total-space) 0) + ((> (length scroll-above) (length scroll-below)) nsections) + (t (min (ceiling nsections 2) (length scroll-above)))) + lines)) + ;; At long last, render final string return value. This may still + ;; kick out lines at the end. + (concat " \n" + (cl-loop for l in lines repeat total-space concat l concat "\n")))) ;;;_ > icomplete-completions (name candidates predicate require-match) (defun icomplete-completions (name candidates predicate require-match) commit 2c699b87c2e4341be30908368eda7237c34a0152 Author: João Távora Date: Thu Aug 19 11:04:37 2021 +0100 Improve fix of bug#49888 on no-pattern flex sorting This version is functionally equivalent, but doesn't duplicate any code. When nothing "flexy" is happening, it works by simply not doing any metadata adjustments, instead of attempting to synthesize a function to mimic the non-flex case. * lisp/minibuffer.el (completion--flex-adjust-metadata): Simplify. diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index f335a9e13b..ffcd5d88ab 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3943,51 +3943,38 @@ that is non-nil." (put 'flex 'completion--adjust-metadata 'completion--flex-adjust-metadata) (defun completion--flex-adjust-metadata (metadata) - (cl-flet - ((compose-flex-sort-fn - (existing-sort-fn) ; wish `cl-flet' had proper indentation... - (lambda (completions) - (cond - (;; Sort by flex score whenever outside the minibuffer or - ;; in the minibuffer with some input. JT@2019-12-23: - ;; FIXME: this is still wrong. What we need to test here - ;; is "some input that actually leads to flex filtering", - ;; not "something after the minibuffer prompt". Among - ;; other inconsistencies, the latter is always true for - ;; file searches, meaning the next clauses in this cond - ;; will be ignored. - (or (not (window-minibuffer-p)) - (> (point-max) (minibuffer-prompt-end))) + "If `flex' is actually doing filtering, adjust sorting." + (let ((flex-is-filtering-p + ;; JT@2019-12-23: FIXME: this is kinda wrong. What we need + ;; to test here is "some input that actually leads/led to + ;; flex filtering", not "something after the minibuffer + ;; prompt". E.g. The latter is always true for file + ;; searches, meaning we'll be doing extra work when we + ;; needn't. + (or (not (window-minibuffer-p)) + (> (point-max) (minibuffer-prompt-end)))) + (existing-dsf + (completion-metadata-get metadata 'display-sort-function)) + (existing-csf + (completion-metadata-get metadata 'cycle-sort-function))) + (cl-flet + ((compose-flex-sort-fn + (existing-sort-fn) ; wish `cl-flet' had proper indentation... + (lambda (completions) (sort - (if existing-sort-fn - (funcall existing-sort-fn completions) - completions) + (funcall existing-sort-fn completions) (lambda (c1 c2) (let ((s1 (get-text-property 0 'completion-score c1)) (s2 (get-text-property 0 'completion-score c2))) - (> (or s1 0) (or s2 0)))))) - (;; If no existing sort fn and nothing flexy happening, use - ;; the customary sorting strategy. - ;; - ;; JT@2021-08-15: FIXME: ideally this wouldn't repeat - ;; logic in `completion-all-sorted-completions', but that - ;; logic has other context that is either expensive to - ;; compute or not easy to access here. - (not existing-sort-fn) - (let ((lalpha (minibuffer--sort-by-length-alpha completions)) - (hist (and (minibufferp) - (and (not (eq minibuffer-history-variable t)) - (symbol-value minibuffer-history-variable))))) - (if hist (minibuffer--sort-by-position hist lalpha) lalpha))) - (t (funcall existing-sort-fn completions)))))) - `(metadata - (display-sort-function - . ,(compose-flex-sort-fn - (completion-metadata-get metadata 'display-sort-function))) - (cycle-sort-function - . ,(compose-flex-sort-fn - (completion-metadata-get metadata 'cycle-sort-function))) - ,@(cdr metadata)))) + (> (or s1 0) (or s2 0)))))))) + `(metadata + ,@(and flex-is-filtering-p + `((display-sort-function + . ,(compose-flex-sort-fn (or existing-dsf #'identity))))) + ,@(and flex-is-filtering-p + `((cycle-sort-function + . ,(compose-flex-sort-fn (or existing-csf #'identity))))) + ,@(cdr metadata))))) (defun completion-flex--make-flex-pattern (pattern) "Convert PCM-style PATTERN into PCM-style flex pattern.