commit c522021a3019fa8f8598319a867326ec59b2bfaf (HEAD, refs/remotes/origin/master) Author: Lars Ingebrigtsen Date: Thu Oct 13 09:00:17 2022 +0200 Fix misleading "File exists, but cannot be read" in browse-url-emacs * src/fileio.c (Finsert_file_contents): Don't signal an error about not being able to open the file when we're fetching things via handlers -- in that case, modtime isn't necessarily set, and if there's a handler, it should take care of this (bug#42431). diff --git a/src/fileio.c b/src/fileio.c index dd7f85ec97..a238889803 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5000,7 +5000,7 @@ by calling `format-decode', which see. */) unbind_to (count1, Qnil); } - if (!NILP (visit) && current_buffer->modtime.tv_nsec < 0) + if (NILP (handler) && !NILP (visit) && current_buffer->modtime.tv_nsec < 0) { /* Signal an error if visiting a file that could not be opened. */ report_file_errno ("Opening input file", orig_filename, save_errno); commit 2b7fefdef148f4d5deee3ea1ed63e8999010c9c3 Merge: da752c0466 4b4b093ab3 Author: Stefan Kangas Date: Thu Oct 13 06:31:52 2022 +0200 Merge from origin/emacs-28 4b4b093ab3 ; * admin/make-tarball.txt: Fix typo. commit 4b4b093ab387fb0f0f0c588831d0c4fc2bd097f3 (refs/remotes/origin/emacs-28) Author: Stefan Kangas Date: Thu Oct 13 04:46:32 2022 +0200 ; * admin/make-tarball.txt: Fix typo. diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index ad2aacb57a..3aee05c3d0 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -389,7 +389,7 @@ Next, regenerate the various manuals in HTML, PDF, and PS formats: Now change to the 'manual' directory and invoke upload-manuals: - ../admin/updload-manuals /path/to/webpages/cvs/checkout + ../admin/upload-manuals /path/to/webpages/cvs/checkout where /path/to/webpages/cvs/checkout is the place where you have the CVS checkout of the Emacs Web pages, with subdirectories 'manual' commit da752c04664c0e22a2f6b4a41dfa1fed4d5276ff Author: Stefan Monnier Date: Wed Oct 12 17:06:33 2022 -0400 src/frame.c (do_switch_frame): Fix bug#58343 * src/frame.c (do_switch_frame): Move call to `get-mru-window` outside of the "critical region" where (selected-window) != (frame-selected-window). * src/minibuf.c (move_minibuffers_onto_frame): Add arg `frame`. Use it instead of `selected_frame`. Adjust all callers. * src/lisp.h (move_minibuffers_onto_frame): Adjust declaration. diff --git a/src/frame.c b/src/frame.c index 91b9bec82c..f076a5ba54 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1503,17 +1503,7 @@ do_switch_frame (Lisp_Object frame, int for_deletion, Lisp_Object norecord) sf->select_mini_window_flag = MINI_WINDOW_P (XWINDOW (sf->selected_window)); - selected_frame = frame; - - move_minibuffers_onto_frame (sf, for_deletion); - - if (f->select_mini_window_flag - && !NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt))) - f->selected_window = f->minibuffer_window; - f->select_mini_window_flag = false; - - if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) - last_nonminibuf_frame = XFRAME (selected_frame); + move_minibuffers_onto_frame (sf, frame, for_deletion); /* If the selected window in the target frame is its mini-window, we move to a different window, the most recently used one, unless there is a @@ -1528,6 +1518,20 @@ do_switch_frame (Lisp_Object frame, int for_deletion, Lisp_Object norecord) Fset_frame_selected_window (frame, w, Qnil); } + /* After setting `selected_frame`, we're temporarily in an inconsistent + state where (selected-window) != (frame-selected-window). Until this + invariant is restored we should be very careful not to run ELisp code. + (bug#58343) */ + selected_frame = frame; + + if (f->select_mini_window_flag + && !NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt))) + f->selected_window = f->minibuffer_window; + f->select_mini_window_flag = false; + + if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) + last_nonminibuf_frame = XFRAME (selected_frame); + Fselect_window (f->selected_window, norecord); /* We want to make sure that the next event generates a frame-switch @@ -2110,7 +2114,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) else /* Ensure any minibuffers on FRAME are moved onto the selected frame. */ - move_minibuffers_onto_frame (f, true); + move_minibuffers_onto_frame (f, selected_frame, true); /* Don't let echo_area_window to remain on a deleted frame. */ if (EQ (f->minibuffer_window, echo_area_window)) diff --git a/src/lisp.h b/src/lisp.h index 56f24d8281..5f6721595c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4792,7 +4792,7 @@ extern void clear_regexp_cache (void); extern Lisp_Object Vminibuffer_list; extern Lisp_Object last_minibuf_string; -extern void move_minibuffers_onto_frame (struct frame *, bool); +extern void move_minibuffers_onto_frame (struct frame *, Lisp_Object, bool); extern bool is_minibuffer (EMACS_INT, Lisp_Object); extern EMACS_INT this_minibuffer_depth (Lisp_Object); extern EMACS_INT minibuf_level; diff --git a/src/minibuf.c b/src/minibuf.c index bedc564480..3f34b1b083 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -187,13 +187,15 @@ zip_minibuffer_stacks (Lisp_Object dest_window, Lisp_Object source_window) /* If `minibuffer_follows_selected_frame' is t, or we're about to delete a frame which potentially "contains" minibuffers, move them - from the old frame to the selected frame. This function is + from the old frame to the to-be-selected frame. This function is intended to be called from `do_switch_frame' in frame.c. OF is the - old frame, FOR_DELETION is true if OF is about to be deleted. */ + old frame, FRAME is the to-be-selected frame, and FOR_DELETION is true + if OF is about to be deleted. */ void -move_minibuffers_onto_frame (struct frame *of, bool for_deletion) +move_minibuffers_onto_frame (struct frame *of, Lisp_Object frame, + bool for_deletion) { - struct frame *f = XFRAME (selected_frame); + struct frame *f = XFRAME (frame); minibuf_window = f->minibuffer_window; if (!(minibuf_level @@ -206,7 +208,7 @@ move_minibuffers_onto_frame (struct frame *of, bool for_deletion) { zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window); if (for_deletion && XFRAME (MB_frame) != of) - MB_frame = selected_frame; + MB_frame = frame; } } commit 5a94a2e5b054f6866762f6eb7f7bbafd24bf02de Author: Lars Ingebrigtsen Date: Wed Oct 12 14:59:25 2022 +0200 Clarify Native-Compilation Variables slightly * doc/lispref/compile.texi (Native-Compilation Variables): Clarify trampoline bit (bug#58429). diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 7ccee08e53..70e0f98f44 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -985,7 +985,7 @@ too late. While setting this variable disables automatic compilation of Lisp files, the compiler may still be invoked to install @dfn{trampolines} if any built-in functions are redefined. However, these trampolines -will not get written to disk. +will not get written to your cache directory. You can also use the @samp{EMACS_INHIBIT_AUTOMATIC_NATIVE_COMPILATION} environment variable to disable native compilation. commit 1e961eda7275802f88d855fccf097b4081d21b18 Author: Po Lu Date: Wed Oct 12 20:40:03 2022 +0800 Improve makefile-imake-mode * lisp/progmodes/make-mode.el (makefile-imake-font-lock-keywords): Give Imake priority over CPP keywords, and don't require comments to start at BOL. (makefile-imake-mode): Set comment-start to some sensible value. diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index cbbcf1c2b7..5f26521299 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -488,17 +488,12 @@ not be enclosed in { } or ( )." (defconst makefile-imake-font-lock-keywords - (append - (makefile-make-font-lock-keywords - makefile-var-use-regex - makefile-statements - t - nil - '("^XCOMM.*$" . font-lock-comment-face) - '("XVAR\\(?:use\\|def\\)[0-9]" 0 font-lock-keyword-face prepend) - '("@@" . font-lock-preprocessor-face) - ) - cpp-font-lock-keywords)) + (append (list '("XCOMM.*$" . font-lock-comment-face) + '("XVAR\\(?:use\\|def\\)[0-9]" 0 + font-lock-keyword-face prepend) + '("@@" . font-lock-preprocessor-face)) + cpp-font-lock-keywords + makefile-font-lock-keywords)) (defconst makefile-syntax-propertize-function @@ -932,7 +927,9 @@ Makefile mode can be configured by modifying the following variables: :syntax-table makefile-imake-mode-syntax-table (setq-local syntax-propertize-function nil) (setq font-lock-defaults - `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults)))) + `(makefile-imake-font-lock-keywords ,@(cdr font-lock-defaults))) + (setq-local comment-start "XCOMM") + (setq-local comment-start-skip "XCOMM[ \t]*")) commit 820e6f399d0af56ebfdc581f68424f4cb9cbe53b Author: Lars Ingebrigtsen Date: Wed Oct 12 13:40:51 2022 +0200 Fix thinko in read-string-from-buffer * lisp/textmodes/string-edit.el (string-edit-done): Return an empty string when the user has entered no text. diff --git a/lisp/textmodes/string-edit.el b/lisp/textmodes/string-edit.el index 562ab60d13..3270050ca4 100644 --- a/lisp/textmodes/string-edit.el +++ b/lisp/textmodes/string-edit.el @@ -119,9 +119,7 @@ This will kill the current buffer." (interactive) (goto-char (point-min)) ;; Skip past the help text. - (when-let ((match (text-property-search-forward - 'string-edit--prompt nil t))) - (goto-char (prop-match-beginning match))) + (text-property-search-forward 'string-edit--prompt) (let ((string (buffer-substring (point) (point-max))) (callback string-edit--success-callback)) (quit-window 'kill) commit aa559c15537a59147bb01617b4a1f9eee20af3a1 Author: kobarity Date: Wed Oct 12 13:14:33 2022 +0200 Fix Python completion when point in shell buffer is before prompt * lisp/progmodes/python.el (python-shell-completion-at-point): Limit prompt boundaries check to shell buffer. * test/lisp/progmodes/python-tests.el (python-shell-completion-2): (python-shell-completion-native-2): New tests (bug#58441). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 680b57fc3e..0de76b0bde 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4069,7 +4069,8 @@ With argument MSG show activation/deactivation message." Optional argument PROCESS forces completions to be retrieved using that one instead of current buffer's process." (setq process (or process (get-buffer-process (current-buffer)))) - (let* ((line-start (if (derived-mode-p 'inferior-python-mode) + (let* ((is-shell-buffer (derived-mode-p 'inferior-python-mode)) + (line-start (if is-shell-buffer ;; Working on a shell buffer: use prompt end. (cdr (python-util-comint-last-prompt)) (line-beginning-position))) @@ -4100,7 +4101,8 @@ using that one instead of current buffer's process." (completion-fn (with-current-buffer (process-buffer process) (cond ((or (null prompt) - (< (point) (cdr prompt-boundaries))) + (and is-shell-buffer + (< (point) (cdr prompt-boundaries)))) #'ignore) ((or (not python-shell-completion-native-enable) ;; Even if native completion is enabled, for diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 60ff9bb613..9ad2d16930 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -4411,6 +4411,22 @@ import abc (insert "A") (should (completion-at-point))))) +(ert-deftest python-shell-completion-2 () + "Should work regardless of the point in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (python-shell-with-shell-buffer + (goto-char (point-min))) + (goto-char (point-max)) + (insert "abc.") + (should (completion-at-point))))) + (ert-deftest python-shell-completion-native-1 () (skip-unless (executable-find python-tests-shell-interpreter)) (python-tests-with-temp-buffer-with-shell @@ -4427,6 +4443,23 @@ import abc (insert "A") (should (completion-at-point))))) +(ert-deftest python-shell-completion-native-2 () + "Should work regardless of the point in the Shell buffer." + (skip-unless (executable-find python-tests-shell-interpreter)) + (python-tests-with-temp-buffer-with-shell + " +import abc +" + (let ((inhibit-message t)) + (python-shell-completion-native-turn-on) + (python-shell-send-buffer) + (python-tests-shell-wait-for-prompt) + (python-shell-with-shell-buffer + (goto-char (point-min))) + (goto-char (point-max)) + (insert "abc.") + (should (completion-at-point))))) + (ert-deftest python-shell-completion-native-with-ffap-1 () (skip-unless (executable-find python-tests-shell-interpreter)) (python-tests-with-temp-buffer-with-shell