From b3d0f53b296a0876ec7a55ae840868e65ed54e14 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 11 Oct 2021 21:20:55 +0200 Subject: [PATCH 1/5] * lisp/progmodes/python.el: Bump package version to 0.28. --- lisp/progmodes/python.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index de6cfcb1ce1..1b55db09503 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4,7 +4,7 @@ ;; Author: Fabián E. Gallina ;; URL: https://github.com/fgallina/python.el -;; Version: 0.27.1 +;; Version: 0.28 ;; Package-Requires: ((emacs "24.2") (cl-lib "1.0")) ;; Maintainer: emacs-devel@gnu.org ;; Created: Jul 2010 From cf1409db71152926767da189bf044c3a63e77128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 11 Oct 2021 22:19:51 +0100 Subject: [PATCH 2/5] Don't apply shorthands to punctuation-only symbols (bug#51089) This includes symbols used for arithmetic functions such as -, /=, etc. Using "-" or "/=" is still possible but doing so won't shadow those functions. * doc/lispref/symbols.texi (Shorthand, Exceptions): New subsubsection. * src/lread.c (read1): Exempt punctionation-only symbols from oblookup_considering_shorthand. * test/lisp/progmodes/elisp-mode-tests.el (elisp-dont-shadow-punctuation-only-symbols): Tweak test. --- doc/lispref/symbols.texi | 17 +++++++++++++++++ src/lread.c | 7 ++++++- test/lisp/progmodes/elisp-mode-tests.el | 5 ++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index 9c33e2c8ec2..ed7dce1c091 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -735,3 +735,20 @@ instead of @code{snu-}. ;; ("sns-" . "some-nice-string-utils-")) ;; End: @end example + +@subsection Exceptions + +There are two exceptions to rules governing Shorthand transformations: + +@itemize @bullet +@item +Symbol forms comprised entirely of symbol constituents (@pxref{Syntax +Class Table}) are exempt not transform. For example, it's possible to +use @code{-} or @code{/=} as shorthand prefixes, but that won't shadow +the arithmetic @emph{functions} that have exactly that prefix as their +full name.; + +@item +Symbol forms whose name starts with the the characters @code{#_} are +also exempted. +@end itemize diff --git a/src/lread.c b/src/lread.c index 07580d11d13..128b46aefef 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3805,7 +3805,12 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) ptrdiff_t longhand_bytes = 0; Lisp_Object tem; - if (skip_shorthand) + if (skip_shorthand || + /* The following ASCII characters are used in the + only "core" Emacs Lisp symbols that are + exclusively comprised of 'symbol constituent' + syntax. */ + strspn(read_buffer, "^*+-/<=>_|") >= nbytes) tem = oblookup (obarray, read_buffer, nchars, nbytes); else tem = oblookup_considering_shorthand (obarray, read_buffer, diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el index e816d3c1b02..400c76c187f 100644 --- a/test/lisp/progmodes/elisp-mode-tests.el +++ b/test/lisp/progmodes/elisp-mode-tests.el @@ -1094,9 +1094,8 @@ evaluation of BODY." (should (unintern "f-test4---")))) (ert-deftest elisp-dont-shadow-punctuation-only-symbols () - :expected-result :failed ; bug#51089 - (let* ((shorthanded-form '(- 42 (-foo 42))) - (expected-longhand-form '(- 42 (fooey-foo 42))) + (let* ((shorthanded-form '(/= 42 (-foo 42))) + (expected-longhand-form '(/= 42 (fooey-foo 42))) (observed (let ((read-symbol-shorthands '(("-" . "fooey-")))) (car (read-from-string From 5deb0ec14f304658bce12809b5c4d97c62eca858 Mon Sep 17 00:00:00 2001 From: Stephen Gildea Date: Mon, 11 Oct 2021 18:19:18 -0700 Subject: [PATCH 3/5] * lisp/mh-e/mh-show.el (mh-junk-whitelist): Custom obsolescence message. --- lisp/mh-e/mh-junk.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/mh-e/mh-junk.el b/lisp/mh-e/mh-junk.el index 467667f5afd..2097bcbe1e8 100644 --- a/lisp/mh-e/mh-junk.el +++ b/lisp/mh-e/mh-junk.el @@ -110,8 +110,15 @@ message(s) as specified by the option `mh-junk-disposition'." ;;;###mh-autoload (defun mh-junk-whitelist (range) "Old name for `mh-junk-allowlist'; use \\[mh-junk-allowlist] instead." - (declare (obsolete mh-junk-allowlist "28.1")) (interactive (list (mh-interactive-range "Allowlist"))) + ;; We do our own message here instead of using "declare obsolete" + ;; in order to talk about keys instead of function names. Also, it + ;; lets us bind "J w" to this without the Emacs 29 compiler complaining. + (when (not (get 'mh-junk-whitelist 'command-execute-obsolete-warned)) + (message "%s is an obsolete key (as of 28.1); use %s instead" + (substitute-command-keys "\\[mh-junk-whitelist]") + (substitute-command-keys "\\[mh-junk-allowlist]")) + (put 'mh-junk-whitelist 'command-execute-obsolete-warned t)) (mh-junk-allowlist range)) ;;;###mh-autoload From 3832b983cfbb7163616041e68f5f46d094137e79 Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Tue, 12 Oct 2021 09:25:57 +0200 Subject: [PATCH 4/5] In Fdelete_other_windows_internal fix new total window sizes (Bug#51007) * src/window.c (Fdelete_other_windows_internal): Assign the new total sizes of windows _after_ the new window configuration is in place (Bug#51007). --- src/window.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/window.c b/src/window.c index ec3c941c3bf..9845fbb876b 100644 --- a/src/window.c +++ b/src/window.c @@ -3199,8 +3199,10 @@ function in a program gives strange scrolling, make sure the window-start value is reasonable when this function is called. */) (Lisp_Object window, Lisp_Object root) { - struct window *w, *r, *s; - struct frame *f; + struct window *w = decode_valid_window (window); + struct window *r, *s; + Lisp_Object frame = w->frame; + struct frame *f = XFRAME (frame); Lisp_Object sibling, pwindow, delta; Lisp_Object swindow UNINIT; ptrdiff_t startpos UNINIT, startbyte UNINIT; @@ -3208,9 +3210,7 @@ window-start value is reasonable when this function is called. */) int new_top; bool resize_failed = false; - w = decode_valid_window (window); XSETWINDOW (window, w); - f = XFRAME (w->frame); if (NILP (root)) /* ROOT is the frame's root window. */ @@ -3250,7 +3250,7 @@ window-start value is reasonable when this function is called. */) /* Make sure WINDOW is the frame's selected window. */ if (!EQ (window, FRAME_SELECTED_WINDOW (f))) { - if (EQ (selected_frame, w->frame)) + if (EQ (selected_frame, frame)) Fselect_window (window, Qnil); else /* Do not clear f->select_mini_window_flag here. If the @@ -3283,7 +3283,7 @@ window-start value is reasonable when this function is called. */) if (!EQ (swindow, FRAME_SELECTED_WINDOW (f))) { - if (EQ (selected_frame, w->frame)) + if (EQ (selected_frame, frame)) Fselect_window (swindow, Qnil); else fset_selected_window (f, swindow); @@ -3318,18 +3318,12 @@ window-start value is reasonable when this function is called. */) w->top_line = r->top_line; resize_root_window (window, delta, Qnil, Qnil, Qt); if (window_resize_check (w, false)) - { - window_resize_apply (w, false); - window_pixel_to_total (w->frame, Qnil); - } + window_resize_apply (w, false); else { resize_root_window (window, delta, Qnil, Qt, Qt); if (window_resize_check (w, false)) - { - window_resize_apply (w, false); - window_pixel_to_total (w->frame, Qnil); - } + window_resize_apply (w, false); else resize_failed = true; } @@ -3342,18 +3336,12 @@ window-start value is reasonable when this function is called. */) XSETINT (delta, r->pixel_width - w->pixel_width); resize_root_window (window, delta, Qt, Qnil, Qt); if (window_resize_check (w, true)) - { - window_resize_apply (w, true); - window_pixel_to_total (w->frame, Qt); - } + window_resize_apply (w, true); else { resize_root_window (window, delta, Qt, Qt, Qt); if (window_resize_check (w, true)) - { - window_resize_apply (w, true); - window_pixel_to_total (w->frame, Qt); - } + window_resize_apply (w, true); else resize_failed = true; } @@ -3395,6 +3383,12 @@ window-start value is reasonable when this function is called. */) } replace_window (root, window, true); + /* Assign new total sizes to all windows on FRAME. We can't do that + _before_ WINDOW replaces ROOT since 'window--pixel-to-total' works + on the whole frame and thus would work on the frame's old window + configuration (Bug#51007). */ + window_pixel_to_total (frame, Qnil); + window_pixel_to_total (frame, Qt); /* This must become SWINDOW anyway ....... */ if (BUFFERP (w->contents) && !resize_failed) From 66b8dfd0602c2175a0296ce6a844d77c94813429 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 12 Oct 2021 16:20:47 +0300 Subject: [PATCH 5/5] ; Fix last change related to shorthands * src/lread.c (read1): Minor stylistic fixes of the last change, including the wording of the comment. * doc/lispref/symbols.texi (Shorthands): Fix wording and typos. --- doc/lispref/symbols.texi | 13 ++++++------- src/lread.c | 11 ++++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi index ed7dce1c091..32590d4f99e 100644 --- a/doc/lispref/symbols.texi +++ b/doc/lispref/symbols.texi @@ -742,13 +742,12 @@ There are two exceptions to rules governing Shorthand transformations: @itemize @bullet @item -Symbol forms comprised entirely of symbol constituents (@pxref{Syntax -Class Table}) are exempt not transform. For example, it's possible to -use @code{-} or @code{/=} as shorthand prefixes, but that won't shadow -the arithmetic @emph{functions} that have exactly that prefix as their -full name.; +Symbol forms comprised entirely of symbol and punctuation characters +(@pxref{Syntax Class Table}) are not transformed. For example, +it's possible to use @code{-} or @code{/=} as shorthand prefixes, but +that won't shadow the arithmetic @emph{functions} of those names. @item -Symbol forms whose name starts with the the characters @code{#_} are -also exempted. +Symbol forms whose names start with @samp{#} or @samp{_} are not +transformed. @end itemize diff --git a/src/lread.c b/src/lread.c index 128b46aefef..b3f9e6ff527 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3805,12 +3805,13 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) ptrdiff_t longhand_bytes = 0; Lisp_Object tem; - if (skip_shorthand || + if (skip_shorthand /* The following ASCII characters are used in the - only "core" Emacs Lisp symbols that are - exclusively comprised of 'symbol constituent' - syntax. */ - strspn(read_buffer, "^*+-/<=>_|") >= nbytes) + only "core" Emacs Lisp symbols that are comprised + entirely of characters that have the 'symbol + constituent' syntax. We exempt them from + transforming according to shorthands. */ + || strspn (read_buffer, "^*+-/<=>_|") >= nbytes) tem = oblookup (obarray, read_buffer, nchars, nbytes); else tem = oblookup_considering_shorthand (obarray, read_buffer,