From 752c526585fe3f10e064b9ddaca6ae6cdeaa0004 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 23 Jan 2023 02:27:15 +0100 Subject: [PATCH 1/5] ; Fix typos --- lisp/net/tramp.el | 2 +- lisp/org/ChangeLog.1 | 2 +- lisp/progmodes/c-ts-mode.el | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 04b683a8a24..1916d50af03 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4873,7 +4873,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for :command (append `(,login-program) login-args command) :coding coding :noquery noquery :connection-type connection-type :sentinel sentinel :stderr stderr)) - ;; Set filter. Prior Emacs 29.1, it doesn't work reliable + ;; Set filter. Prior Emacs 29.1, it doesn't work reliably ;; to provide it as `make-process' argument when filter is ;; t. See Bug#51177. (when filter diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1 index eb126df6334..a4eae350d98 100644 --- a/lisp/org/ChangeLog.1 +++ b/lisp/org/ChangeLog.1 @@ -30500,7 +30500,7 @@ * org.el (org-make-tags-matcher): Never use IDO for completing the tags matcher match string. - (org-completing-read): Also remove the special biding for "?". + (org-completing-read): Also remove the special binding for "?". * org-attach.el (org-attach-allow-inheritance): New option. (org-attach-inherited): New variable. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 788c911f86b..eb2be9b792b 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -319,7 +319,7 @@ PARENT is NODE's parent." (save-excursion (goto-char (treesit-node-start node)) ;; Add an extra level if the opening bracket is on its own - ;; line, except (1) it's at top-level, or (2) it's immedate + ;; line, except (1) it's at top-level, or (2) it's immediate ;; parent is another block. (cond ((bolp) nil) ; Case (1). ((let ((parent-type (treesit-node-type From fd145499bbd7650d915c6e5e1ac95fd89738a6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= Date: Thu, 26 Jan 2023 19:54:27 +0100 Subject: [PATCH 2/5] Fix fontification TypeScript of import-statements (bug#61081) Currently typescript-ts-mode and tsx-ts-mode handles imports with aliases incorrectly. Consider the following case: import { someFunc as someAlias } from "module"; In this case the entire import ("someFunc as someAlias") will be highlighted as a variable name. "as" is also highlighted as a variable, rather than a reserved keyword. To be consistent with how we otherwise do things, we should only highlight the variable which is new and/or introduced, in this case "someAlias". Attached is a patch which fontifies import-declarations somewhat more correctly. The following cases have been tested and all fontify properly: import gnu from "fsf"; // highlights gnu import { gnu2 } from "fsf2"; // highlights gnu2 import { gnu as gnu3 } from "fsf3"; // highlights gnu3 import * as gnu4 from "fsf4"; // highlights gnu4 * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Tweak import_clause rules to adhere to the comment above. --- lisp/progmodes/typescript-ts-mode.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 25cc327d05f..561b90deedd 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -196,8 +196,18 @@ Argument LANGUAGE is either `typescript' or `tsx'." (catch_clause parameter: (identifier) @font-lock-variable-name-face) + ;; full module imports (import_clause (identifier) @font-lock-variable-name-face) - (import_clause (named_imports (import_specifier (identifier)) @font-lock-variable-name-face))) + ;; named imports with aliasing + (import_clause (named_imports (import_specifier + alias: (identifier) @font-lock-variable-name-face))) + ;; named imports without aliasing + (import_clause (named_imports (import_specifier + !alias + name: (identifier) @font-lock-variable-name-face))) + + ;; full namespace import (* as alias) + (import_clause (namespace_import (identifier) @font-lock-variable-name-face))) :language language :feature 'identifier From 00629c039643a0471143205c70e8a078fc3a9d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= Date: Thu, 26 Jan 2023 20:32:18 +0100 Subject: [PATCH 3/5] Fix errors in fontification of JavaScript import-statements (bug#61083) Currently js-ts-mode handles imports with aliases incorrectly. To be consistent with how we otherwise do things, we should only highlight the variable which is new and/or introduced, in this case "someAlias". Attached is a patch which fontifies import-declarations somewhat more correctly. The following cases have been tested and all fontify properly: import gnu from "fsf"; // highlights gnu import { gnu2 } from "fsf2"; // highlights gnu2 import { gnu as gnu3 } from "fsf3"; // highlights gnu3 import * as gnu4 from "fsf4"; // highlights gnu4 * lisp/progmodes/js.el (js--treesit-font-lock-settings): Add new import_clause rules that adhere to the comment above. --- lisp/progmodes/js.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index b5c912b8b0d..05d69c314bb 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3546,9 +3546,18 @@ This function is intended for use in `after-change-functions'." (identifier) @font-lock-function-name-face) value: (array (number) (function))) + ;; full module imports (import_clause (identifier) @font-lock-variable-name-face) - (import_clause (named_imports (import_specifier (identifier)) - @font-lock-variable-name-face))) + ;; named imports with aliasing + (import_clause (named_imports (import_specifier + alias: (identifier) @font-lock-variable-name-face))) + ;; named imports without aliasing + (import_clause (named_imports (import_specifier + !alias + name: (identifier) @font-lock-variable-name-face))) + + ;; full namespace import (* as alias) + (import_clause (namespace_import (identifier) @font-lock-variable-name-face))) :language 'javascript :feature 'property From 194bc97879d2b57545eda17dbeb0b2e46b215617 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 27 Jan 2023 19:01:49 +0200 Subject: [PATCH 4/5] Improve documentation of 'shell-command-dont-erase-buffer' * doc/emacs/misc.texi (Single Shell): * lisp/simple.el (shell-command, shell-command-on-region): Document that non-nil value of 'shell-command-dont-erase-buffer' affects what is displayed in the echo area after the command. (Bug#61100) --- doc/emacs/misc.texi | 6 ++++++ lisp/simple.el | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index e2764c34482..80a1b3f55ed 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -751,6 +751,8 @@ Command Output*"} (@code{shell-command-buffer-name}) buffer (if the output is long). The variables @code{resize-mini-windows} and @code{max-mini-window-height} (@pxref{Minibuffer Edit}) control when Emacs should consider the output to be too long for the echo area. +Note that customizing @code{shell-command-dont-erase-buffer}, +described below, can affect what is displayed in the echo area. For instance, one way to decompress a file named @file{foo.gz} is to type @kbd{M-! gunzip foo.gz @key{RET}}. That shell command normally @@ -867,6 +869,10 @@ Restores the position of point as it was before inserting the shell-command output. @end table +Note that if this option is non-@code{nil}, the output shown in the +echo area could be from more than just the last command, since the +echo area just displays a portion of the output buffer. + In case the output buffer is not the current buffer, shell command output is appended at the end of this buffer. diff --git a/lisp/simple.el b/lisp/simple.el index aaad3217982..861fe193fb8 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4547,6 +4547,9 @@ If the output is short enough to display in the echo area \(determined by the variable `max-mini-window-height' if `resize-mini-windows' is non-nil), it is shown there. Otherwise, the buffer containing the output is displayed. +Note that if `shell-command-dont-erase-buffer' is non-nil, +the echo area could display more than just the output of the +last command. If there is output and an error, and you did not specify \"insert it in the current buffer\", a message about the error goes at the end @@ -4829,6 +4832,9 @@ If the output is short enough to display in the echo area `resize-mini-windows' is non-nil), it is shown there. Otherwise it is displayed in the buffer named by `shell-command-buffer-name'. The output is available in that buffer in both cases. +Note that if `shell-command-dont-erase-buffer' is non-nil, +the echo area could display more than just the output of the +last command. If there is output and an error, a message about the error appears at the end of the output. From 128a999bfe7ebafd78e2b463586156fc6972181d Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 28 Jan 2023 03:17:39 +0200 Subject: [PATCH 5/5] Make project-current not error out inside non-existent dirs * lisp/progmodes/project.el (project-try-vc): Use condition-case to catch 'file-missing' (bug#61107). * test/lisp/progmodes/project-tests.el (project-vc-nonexistent-directory-no-error): New test. --- lisp/progmodes/project.el | 7 +++++-- test/lisp/progmodes/project-tests.el | 10 ++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 59270070484..2343adf4698 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1,7 +1,7 @@ ;;; project.el --- Operations on the current project -*- lexical-binding: t; -*- ;; Copyright (C) 2015-2023 Free Software Foundation, Inc. -;; Version: 0.9.5 +;; Version: 0.9.6 ;; Package-Requires: ((emacs "26.1") (xref "1.4.0")) ;; This is a GNU ELPA :core package. Avoid using functionality that @@ -530,7 +530,10 @@ project backend implementation of `project-external-roots'.") dir (lambda (d) ;; Maybe limit count to 100 when we can drop Emacs < 28. - (setq last-matches (directory-files d nil marker-re t))))) + (setq last-matches + (condition-case nil + (directory-files d nil marker-re t) + (file-missing nil)))))) (backend (cl-find-if (lambda (b) diff --git a/test/lisp/progmodes/project-tests.el b/test/lisp/progmodes/project-tests.el index aea0666629d..5a206b67db1 100644 --- a/test/lisp/progmodes/project-tests.el +++ b/test/lisp/progmodes/project-tests.el @@ -152,4 +152,14 @@ When `project-ignores' includes a name matching project dir." (should (equal '(".dir-locals.el" "foo") (mapcar #'file-name-nondirectory (project-files project)))))) +(ert-deftest project-vc-nonexistent-directory-no-error () + "Check that is doesn't error out when the current dir does not exist." + (skip-unless (eq (vc-responsible-backend default-directory) 'Git)) + (let* ((dir (expand-file-name "foo-456/bar/" (ert-resource-directory))) + (_ (vc-file-clearprops dir)) + (project-vc-extra-root-markers '(".dir-locals.el")) + (project (project-current nil dir))) + (should-not (null project)) + (should (string-match-p "/test/lisp/progmodes/project-resources/\\'" (project-root project))))) + ;;; project-tests.el ends here