commit f26a027d6b8e0b894d5d28c446643d411b376ea9 (HEAD, refs/remotes/origin/master) Author: pillule Date: Wed Aug 18 09:21:06 2021 +0200 Fix ediff3 layouts with window-combination-resize non-nil (Bug#49277) * lisp/vc/ediff-wind.el (ediff-setup-windows-plain-compare) (ediff-setup-windows-multiframe-compare): Fix three windows layouts produced by ediff3 when 'window-combination-resize' was customized to t and 'even-window-sizes' to nil. diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el index fc6ea944ae..7c90348b5d 100644 --- a/lisp/vc/ediff-wind.el +++ b/lisp/vc/ediff-wind.el @@ -400,7 +400,8 @@ keyboard input to go into icons." ;; skip dedicated and unsplittable frames (ediff-destroy-control-frame control-buffer) (let ((window-min-height 1) - split-window-function wind-width-or-height + (window-combination-resize t) + split-window-function three-way-comparison wind-A-start wind-B-start wind-A wind-B wind-C) (with-current-buffer control-buffer @@ -419,22 +420,12 @@ keyboard input to go into icons." (select-window (next-window nil 'ignore-minibuf))) (delete-other-windows) (set-window-dedicated-p (selected-window) nil) - (split-window-vertically) - (ediff-select-lowest-window) - (ediff-setup-control-buffer control-buffer) ;; go to the upper window and split it betw A, B, and possibly C (other-window 1) (switch-to-buffer buf-A) (setq wind-A (selected-window)) - (if three-way-comparison - (setq wind-width-or-height - (/ (if (eq split-window-function #'split-window-vertically) - (window-height wind-A) - (window-width wind-A)) - 3))) - - (funcall split-window-function wind-width-or-height) + (funcall split-window-function) (if (eq (selected-window) wind-A) (other-window 1)) @@ -443,7 +434,7 @@ keyboard input to go into icons." (if three-way-comparison (progn - (funcall split-window-function) ; equally + (funcall split-window-function) (if (eq (selected-window) wind-B) (other-window 1)) (switch-to-buffer buf-C) @@ -461,7 +452,9 @@ keyboard input to go into icons." (set-window-start wind-A wind-A-start) (set-window-start wind-B wind-B-start))) - (ediff-select-lowest-window) + (select-window (display-buffer-in-direction + control-buffer + '((direction . bottom)))) (ediff-setup-control-buffer control-buffer) )) @@ -746,6 +739,7 @@ keyboard input to go into icons." (and (not (frame-live-p frame-A)) (or ctl-frame-exists-p (eq frame-B (selected-frame)))))) + (window-combination-resize t) wind-A-start wind-B-start designated-minibuffer-frame) @@ -758,7 +752,7 @@ keyboard input to go into icons." 'B ediff-narrow-bounds)))) (if use-same-frame - (let (wind-width-or-height) ; this affects 3way setups only + (progn (if (and (eq frame-A frame-B) (frame-live-p frame-A)) (select-frame frame-A) ;; avoid dedicated and non-splittable windows @@ -767,15 +761,7 @@ keyboard input to go into icons." (switch-to-buffer buf-A) (setq wind-A (selected-window)) - (if three-way-comparison - (setq wind-width-or-height - (/ - (if (eq split-window-function #'split-window-vertically) - (window-height wind-A) - (window-width wind-A)) - 3))) - - (funcall split-window-function wind-width-or-height) + (funcall split-window-function) (if (eq (selected-window) wind-A) (other-window 1)) (switch-to-buffer buf-B) commit eddb003f30e48bdbc0b9cb774f261b1558912167 Author: pillule Date: Wed Aug 18 09:16:06 2021 +0200 Fix behavior when switch-to-prev-buffer-skip is a function (Bug#49275) * lisp/window.el (switch-to-prev-buffer) (switch-to-next-buffer): More correctly handle cases where 'switch-to-prev-buffer-skip' is a function. diff --git a/lisp/window.el b/lisp/window.el index 0346397566..e14d472cf3 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -4721,8 +4721,8 @@ This function is called by `prev-buffer'." window new-buffer (nth 1 entry) (nth 2 entry)) (throw 'found t))))) - (when skipped - ;; Show first skipped buffer. + (when (and skipped (not (functionp switch-to-prev-buffer-skip))) + ;; Show first skipped buffer, unless skip was a function. (setq new-buffer skipped) (set-window-buffer-start-and-point window new-buffer))) @@ -4831,6 +4831,7 @@ This function is called by `next-buffer'." ;; nreverse here!) (dolist (entry (reverse (window-prev-buffers window))) (when (and (not (eq new-buffer (car entry))) + (not (eq old-buffer (car entry))) (setq new-buffer (car entry)) (or (buffer-live-p new-buffer) (not (setq killed-buffers @@ -4842,8 +4843,8 @@ This function is called by `next-buffer'." window new-buffer (nth 1 entry) (nth 2 entry)) (throw 'found t)))) - (when skipped - ;; Show first skipped buffer. + (when (and skipped (not (functionp switch-to-prev-buffer-skip))) + ;; Show first skipped buffer, unless skip was a function. (setq new-buffer skipped) (set-window-buffer-start-and-point window new-buffer))) commit 6d3455eb144e30f4cc4f56eb3454f4ad785e411d Author: Basil L. Contovounesios Date: Wed Aug 18 00:54:44 2021 +0100 ; Fix quoting of braces in electric-tests.el. diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index 4b79992553..c5124aca5e 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -872,7 +872,7 @@ baz\"\"" (defun electric-layout-for-c-style-du-jour (inserted) "A function to use in `electric-layout-rules'" - (when (memq inserted '(?{ ?})) + (when (memq inserted '(?\{ ?\})) (save-excursion (backward-char 2) (c-point-syntax) (forward-char) ; silly, but needed (c-brace-newlines (c-point-syntax))))) commit 7fa5dec86e78242d0868fb7e5161fe16a416be15 Author: Andrea Corallo Date: Tue Aug 17 23:44:12 2021 +0200 * Fix `native-compile-target-directory' effectiveness for async compilation. * lisp/emacs-lisp/comp.el (comp-run-async-workers): Forward to async workers `native-compile-target-directory'. diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index ed75bf2bfa..7bbe63c3e1 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3918,7 +3918,8 @@ display a message." do (let* ((expr `((require 'comp) ,(when (boundp 'backtrace-line-length) `(setf backtrace-line-length ,backtrace-line-length)) - (setf native-comp-speed ,native-comp-speed + (setf native-compile-target-directory ,native-compile-target-directory + native-comp-speed ,native-comp-speed native-comp-debug ,native-comp-debug native-comp-verbose ,native-comp-verbose comp-libgccjit-reproducer ,comp-libgccjit-reproducer commit ca781e4430bb817ad4918644ef45814de71e5927 Author: Glenn Morris Date: Tue Aug 17 11:31:09 2021 -0700 * lisp/mouse.el (context-menu-filter-function): Fix type. diff --git a/lisp/mouse.el b/lisp/mouse.el index 4c4a7d35a8..5424039700 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -299,7 +299,7 @@ the same menu with changes such as added new menu items." (defcustom context-menu-filter-function nil "Function that can filter the list produced by `context-menu-functions'." - :type 'function + :type '(choice (const nil) function) :version "28.1") (defun context-menu-map () commit 130d47bdccee31d9fd9d74e273443416d2da20fa Author: Eli Zaretskii Date: Tue Aug 17 21:29:58 2021 +0300 Another fix for quitting while displaying non-selected windows * src/xdisp.c (handle_face_prop, extend_face_to_end_of_line): Inhibit quitting around the call to face_at_pos, to prevent leaking wrong value of point when the user quits while we redisplay a non-selected window. (Bug#44448) diff --git a/src/xdisp.c b/src/xdisp.c index 972b90177c..3b7ed2be20 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -4472,7 +4472,13 @@ face_at_pos (const struct it *it, enum lface_attribute_index attr_filter) static enum prop_handled handle_face_prop (struct it *it) { + ptrdiff_t count = SPECPDL_INDEX (); + /* Don't allow the user to quit out of face-merging code, in case + this is called when redisplaying a non-selected window, with + point temporarily moved to window-point. */ + specbind (Qinhibit_quit, Qt); const int new_face_id = face_at_pos (it, 0); + unbind_to (count, Qnil); /* Is this a start of a run of characters with box face? @@ -22111,10 +22117,17 @@ extend_face_to_end_of_line (struct it *it) || WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0)) return; + ptrdiff_t count = SPECPDL_INDEX (); + + /* Don't allow the user to quit out of face-merging code, in case + this is called when redisplaying a non-selected window, with + point temporarily moved to window-point. */ + specbind (Qinhibit_quit, Qt); const int extend_face_id = (it->face_id == DEFAULT_FACE_ID || it->s != NULL) ? DEFAULT_FACE_ID : face_at_pos (it, LFACE_EXTEND_INDEX); + unbind_to (count, Qnil); /* Face extension extends the background and box of IT->extend_face_id to the end of the line. If the background equals the background commit c609b4c7287c416e320a1b95f866f1ce1ce7254d Author: Glenn Morris Date: Tue Aug 17 08:53:00 2021 -0700 * test/lisp/electric-tests.el: Skip most c-mode tests on hydra. diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el index ea856ab311..4b79992553 100644 --- a/test/lisp/electric-tests.el +++ b/test/lisp/electric-tests.el @@ -587,6 +587,7 @@ baz\"\"" ;;; Electric newlines between pairs ;;; TODO: better tests (ert-deftest electric-pair-open-extra-newline () + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (save-electric-modes (with-temp-buffer (c-mode) @@ -877,6 +878,8 @@ baz\"\"" (c-brace-newlines (c-point-syntax))))) (ert-deftest electric-layout-plainer-c-mode-use-c-style () + ;; FIXME hangs since c4d34d2 + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) @@ -890,6 +893,7 @@ baz\"\"" (should (equal (buffer-string) "int main ()\n{\n \n}\n")))) (ert-deftest electric-layout-int-main-kernel-style () + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) @@ -906,6 +910,7 @@ baz\"\"" (ert-deftest electric-layout-control-reindentation () "Same as `emacs-lisp-int-main-kernel-style', but checking Bug#35254." + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) @@ -924,6 +929,7 @@ Bug#35254." (should (equal (buffer-string) "int main () {\n\n \n}")))) (ert-deftest electric-modes-int-main-allman-style () + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) @@ -938,6 +944,7 @@ Bug#35254." (should (equal (buffer-string) "int main ()\n{\n \n}")))) (ert-deftest electric-pair-mode-newline-between-parens () + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode -1) ;; ensure e-l-m mode is off @@ -949,6 +956,7 @@ Bug#35254." (should (equal (buffer-string) "int main () {\n \n}")))) (ert-deftest electric-layout-mode-newline-between-parens-without-e-p-m () + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) @@ -970,6 +978,7 @@ Bug#35254." (should (equal (buffer-string) "int main () {\n \n}")))) (ert-deftest electric-layout-mode-newline-between-parens-without-e-p-m-2 () + (skip-unless (not (getenv "EMACS_HYDRA_CI"))) (ert-with-test-buffer () (plainer-c-mode) (electric-layout-local-mode 1) commit 54039d721c5b7fd210a79dc641914cba8fc82185 Author: Eli Zaretskii Date: Tue Aug 17 15:47:10 2021 +0300 ; * etc/NEWS: Fix wording of a recently added entry. diff --git a/etc/NEWS b/etc/NEWS index 3f95d175e0..1b4712828c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -384,11 +384,12 @@ onto 'file-name-history'. ** Menus +++ -*** New mode 'context-menu-mode' for a context menu bound to 'mouse-3'. +*** New minor mode 'context-menu-mode' for context menus popped by 'mouse-3'. When this mode is enabled, clicking 'down-mouse-3' anywhere in the buffer -pops up a context menu whose contents depends on surrounding context -near the mouse click. You can customize the order of the default submenus -in the context menu by customizing the user option 'context-menu-functions'. +pops up a menu whose contents depends on surrounding context near the +mouse click. You can customize the order of the default sub-menus in +the context menu by customizing the user option +'context-menu-functions'. +++ *** The "Edit => Clear" menu item now obeys a rectangular region. commit b960e1aea27a9fcc7c6fe0c315cfb9cd0e8025aa Author: Eli Zaretskii Date: Tue Aug 17 15:40:05 2021 +0300 ; Fix a comment in a recent commit. * lisp/help-mode.el (help-mode-syntax-table): Fix punctuation in a comment. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index b53d00d0fb..87f26651e0 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -142,8 +142,8 @@ The format is (FUNCTION ARGS...).") (defvar help-mode-syntax-table (let ((table (make-syntax-table emacs-lisp-mode-syntax-table))) - ;; treat single quotes as parens so that forward-sexp does not - ;; break when quoted string contains punctuation + ;; Treat single quotes as parens so that forward-sexp does not + ;; break when a quoted string contains punctuation. (modify-syntax-entry ?‘ "(’ " table) (modify-syntax-entry ?’ ")‘ " table) table) commit 5f47d17d33948e3802843c3552be544e7c8e5cf1 Author: Eli Zaretskii Date: Tue Aug 17 15:31:53 2021 +0300 Fix TTY display performance degradation due to many markers * src/coding.c (encode_coding_object): Don't assume that src_object == dst_object means src_object is the current buffer. Add the missing commentary that explains the arguments. (Bug#49127) diff --git a/src/coding.c b/src/coding.c index 87b55aecc0..d027c7d539 100644 --- a/src/coding.c +++ b/src/coding.c @@ -8250,6 +8250,39 @@ decode_coding_object (struct coding_system *coding, } +/* Encode the text in the range FROM/FROM_BYTE and TO/TO_BYTE in + SRC_OBJECT into DST_OBJECT by coding context CODING. + + SRC_OBJECT is a buffer, a string, or Qnil. + + If it is a buffer, the text is at point of the buffer. FROM and TO + are positions in the buffer. + + If it is a string, the text is at the beginning of the string. + FROM and TO are indices into the string. + + If it is nil, the text is at coding->source. FROM and TO are + indices into coding->source. + + DST_OBJECT is a buffer, Qt, or Qnil. + + If it is a buffer, the encoded text is inserted at point of the + buffer. If the buffer is the same as SRC_OBJECT, the source text + is replaced with the encoded text. + + If it is Qt, a string is made from the encoded text, and set in + CODING->dst_object. However, if CODING->raw_destination is non-zero, + the encoded text is instead returned in CODING->destination as a C string, + and the caller is responsible for freeing CODING->destination. This + feature is meant to be used when the caller doesn't need the result as + a Lisp string, and wants to avoid unnecessary consing of large strings. + + If it is Qnil, the encoded text is stored at CODING->destination. + The caller must allocate CODING->dst_bytes bytes at + CODING->destination by xmalloc. If the encoded text is longer than + CODING->dst_bytes, CODING->destination is reallocated by xrealloc + (and CODING->dst_bytes is enlarged accordingly). */ + void encode_coding_object (struct coding_system *coding, Lisp_Object src_object, @@ -8275,11 +8308,14 @@ encode_coding_object (struct coding_system *coding, attrs = CODING_ID_ATTRS (coding->id); - if (EQ (src_object, dst_object)) + bool same_buffer = false; + if (EQ (src_object, dst_object) && BUFFERP (src_object)) { struct Lisp_Marker *tail; - for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) + same_buffer = true; + + for (tail = BUF_MARKERS (XBUFFER (src_object)); tail; tail = tail->next) { tail->need_adjustment = tail->charpos == (tail->insertion_type ? from : to); @@ -8298,7 +8334,7 @@ encode_coding_object (struct coding_system *coding, else insert_1_both ((char *) coding->source + from, chars, bytes, 0, 0, 0); - if (EQ (src_object, dst_object)) + if (same_buffer) { set_buffer_internal (XBUFFER (src_object)); saved_pt = PT, saved_pt_byte = PT_BYTE; @@ -8329,7 +8365,7 @@ encode_coding_object (struct coding_system *coding, { code_conversion_save (0, 0); set_buffer_internal (XBUFFER (src_object)); - if (EQ (src_object, dst_object)) + if (same_buffer) { saved_pt = PT, saved_pt_byte = PT_BYTE; coding->src_object = del_range_1 (from, to, 1, 1); commit 00fdf80e21909366fcba0eab84fe68c803a3a3eb Author: Michalis V Date: Tue Aug 17 14:20:57 2021 +0200 Improve `forward-sexp' in *Help* buffers * lisp/help-mode.el (help-mode-syntax-table): New variable (bug#39134). (help-make-xrefs): Use it to make picking out symbols in curved quotes work reliably. (help-xref-on-pp): Ditto. diff --git a/lisp/help-mode.el b/lisp/help-mode.el index e2d8ee0f59..b53d00d0fb 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -140,6 +140,15 @@ The format is (FUNCTION ARGS...).") (setq-default help-xref-stack nil help-xref-stack-item nil) (setq-default help-xref-forward-stack nil help-xref-forward-stack-item nil) +(defvar help-mode-syntax-table + (let ((table (make-syntax-table emacs-lisp-mode-syntax-table))) + ;; treat single quotes as parens so that forward-sexp does not + ;; break when quoted string contains punctuation + (modify-syntax-entry ?‘ "(’ " table) + (modify-syntax-entry ?’ ")‘ " table) + table) + "Syntax table used in `help-mode'.") + (defcustom help-mode-hook nil "Hook run by `help-mode'." :type 'hook @@ -520,7 +529,7 @@ that." (let ((stab (syntax-table)) (case-fold-search t) (inhibit-read-only t)) - (set-syntax-table emacs-lisp-mode-syntax-table) + (set-syntax-table help-mode-syntax-table) ;; The following should probably be abstracted out. (unwind-protect (progn @@ -673,7 +682,7 @@ See `help-make-xrefs'." (defun help-xref-on-pp (from to) "Add xrefs for symbols in `pp's output between FROM and TO." (if (> (- to from) 5000) nil - (with-syntax-table emacs-lisp-mode-syntax-table + (with-syntax-table help-mode-syntax-table (save-excursion (save-restriction (narrow-to-region from to) commit e6fb7e44cc7da97f7c29246dbff89009de9a4633 Author: João Távora Date: Tue Aug 17 13:06:06 2021 +0100 Bind and in icomplete-vertical-mode Suggested by Ergus * lisp/icomplete.el (icomplete-vertical-mode-minibuffer-map): Bind and diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 96b7e0f201..81fc6ff03c 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -624,6 +624,8 @@ Usually run by inclusion in `minibuffer-setup-hook'." (let ((map (make-sparse-keymap))) (define-key map (kbd "C-n") 'icomplete-forward-completions) (define-key map (kbd "C-p") 'icomplete-backward-completions) + (define-key map (kbd "") 'icomplete-forward-completions) + (define-key map (kbd "") 'icomplete-backward-completions) (define-key map (kbd "M-<") 'icomplete-vertical-goto-first) (define-key map (kbd "M->") 'icomplete-vertical-goto-last) map) commit 96bbd6f0a7f20ae77bcd8a477b54b11ba5b42cc6 Author: João Távora Date: Tue Aug 17 12:48:37 2021 +0100 Jump to first,last completion with M-<, M-> in icomplete-vertical-mode Fixes: bug#49005 Co-authored-by: Simon Lang * lisp/icomplete.el (icomplete-backward-completions): Return non-nil iff something was stepped. Ajust docstring. (icomplete-forward-completions): Adjust docstring. (icomplete-vertical-goto-first, icomplete-vertical-goto-last): New commands. (icomplete-vertical-mode-minibuffer-map): Bind new commands to M-< and M->. diff --git a/lisp/icomplete.el b/lisp/icomplete.el index e06b33e43b..96b7e0f201 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -249,7 +249,8 @@ the default otherwise." (defun icomplete-forward-completions () "Step forward completions by one entry. Second entry becomes the first and can be selected with -`icomplete-force-complete-and-exit'." +`icomplete-force-complete-and-exit'. +Return non-nil iff something was stepped." (interactive) (let* ((beg (icomplete--field-beg)) (end (icomplete--field-end)) @@ -266,21 +267,35 @@ Second entry becomes the first and can be selected with (defun icomplete-backward-completions () "Step backward completions by one entry. Last entry becomes the first and can be selected with -`icomplete-force-complete-and-exit'." +`icomplete-force-complete-and-exit'. +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-but-one) - (cond ((and icomplete-scroll icomplete--scrolled-past) - (push (pop icomplete--scrolled-past) comps) - (setq icomplete--scrolled-completions comps)) - ((and (not icomplete-scroll) - (consp (cdr (setq last-but-one (last comps 2))))) - ;; At least two elements in comps - (push (car (cdr last-but-one)) comps) - (setcdr last-but-one (cdr (cdr last-but-one))))) - (completion--cache-all-sorted-completions beg end comps))) + last-but-one) + (prog1 + (cond ((and icomplete-scroll icomplete--scrolled-past) + (push (pop icomplete--scrolled-past) comps) + (setq icomplete--scrolled-completions comps)) + ((and (not icomplete-scroll) + (consp (cdr (setq last-but-one (last comps 2))))) + ;; At least two elements in comps + (push (car (cdr last-but-one)) comps) + (setcdr last-but-one (cdr (cdr last-but-one))))) + (completion--cache-all-sorted-completions beg end comps)))) + +(defun icomplete-vertical-goto-first () + "Go to first completions entry when `icomplete-scroll' is non-nil." + (interactive) + (unless icomplete-scroll (error "Only works with `icomplete-scroll'")) + (while (icomplete-backward-completions))) + +(defun icomplete-vertical-goto-last () + "Go to last completions entry when `icomplete-scroll' is non-nil." + (interactive) + (unless icomplete-scroll (error "Only works with `icomplete-scroll'")) + (while (icomplete-forward-completions))) ;;;_* Helpers for `fido-mode' (or `ido-mode' emulation) @@ -609,6 +624,8 @@ Usually run by inclusion in `minibuffer-setup-hook'." (let ((map (make-sparse-keymap))) (define-key map (kbd "C-n") 'icomplete-forward-completions) (define-key map (kbd "C-p") 'icomplete-backward-completions) + (define-key map (kbd "M-<") 'icomplete-vertical-goto-first) + (define-key map (kbd "M->") 'icomplete-vertical-goto-last) map) "Keymap used by `icomplete-vertical-mode' in the minibuffer.")