commit eac3f2a80778b3904c55ae7b65ff862a79eebf2a (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Thu Jan 11 22:12:34 2024 -0500 sh-script.el: Add support for `case FOO {...}` (bug#55764) * lisp/progmodes/sh-script.el (sh-font-lock-paren): Also recognize `FOO)` after `{`. (sh-smie-sh-rules): Make `for` rule apply to `case FOO { ...}` as well. * test/manual/indent/shell.sh: Add new test case. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 0562415b4e5..2a650fe0ea6 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1054,7 +1054,8 @@ subshells can nest." ;; a normal command rather than the real `in' keyword. ;; I.e. we should look back to try and find the ;; corresponding `case'. - (and (looking-at ";\\(?:;&?\\|[&|]\\)\\|\\_ Date: Thu Jan 11 15:50:08 2024 -0600 Eglot: Simplify overlay handling in manual example * doc/misc/eglot.texi (Extending Eglot): Simplify. Copyright-paperwork-exempt: yes diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index a5c3a967af1..85fef6be553 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1405,8 +1405,6 @@ The remainder of the implementation consists of standard Elisp techniques to loop over arrays, manage buffers and overlays. @lisp -(defvar-local eglot-clangd-inactive-region-overlays '()) - (cl-defmethod eglot-handle-notification (_server (_method (eql textDocument/inactiveRegions)) &key regions textDocument &allow-other-keys) @@ -1414,14 +1412,14 @@ techniques to loop over arrays, manage buffers and overlays. (cl-getf textDocument :uri)))) (buffer (find-buffer-visiting path))) (with-current-buffer buffer - (mapc #'delete-overlay eglot-clangd-inactive-region-overlays) + (remove-overlays nil nil 'inactive-code t) (cl-loop for r across regions for (beg . end) = (eglot-range-region r) for ov = (make-overlay beg end) do (overlay-put ov 'face 'shadow) - (push ov eglot-clangd-inactive-region-overlays))))) + (overlay-put ov 'inactive-code t))))) @end lisp @end itemize commit e4e89e2cb663c730fd563d89228fe3a9a34e63e5 Author: Alyssa Ross Date: Thu Nov 9 15:46:30 2023 +0100 Add autoload cookie to vc-git-grep * lisp/vc/vc-git.el (vc-git-grep): Add autoload cookie. (Bug#67018) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index fed15ae2033..456417e566e 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1982,6 +1982,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"." (defvar compilation-environment) ;; Derived from `lgrep'. +;;;###autoload (defun vc-git-grep (regexp &optional files dir) "Run git grep, searching for REGEXP in FILES in directory DIR. The search is limited to file names matching shell pattern FILES. commit a66069c50c8eaf4a3ee253e7b7e47af48e721585 Author: john muhl Date: Sat Jan 6 09:36:33 2024 -0600 Support indented continuation lines in lua-ts-mode * lisp/progmodes/lua-ts-mode.el (lua-ts--simple-indent-rules): Add a rule to indent multi-line assignments and if statements. (lua-ts-indent-continuation-lines): New user option. * test/lisp/progmodes/lua-ts-mode-resources/indent.erts: Add tests. (Bug#68279) diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 3b600f59521..05a3ff6d7c6 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -122,6 +122,28 @@ :group 'lua-ts :version "30.1") +(defcustom lua-ts-indent-continuation-lines t + "Controls how multi-line if/else statements are aligned. + +If t, then continuation lines are indented by `lua-ts-indent-offset': + + if a + and b then + print(1) + end + +If nil, then continuation lines are aligned with the beginning of +the statement: + + if a + and b then + print(1) + end" + :type 'boolean + :safe 'booleanp + :group 'lua-ts + :version "30.1") + (defvar lua-ts--builtins '("assert" "bit32" "collectgarbage" "coroutine" "debug" "dofile" "error" "getmetatable" "io" "ipairs" "load" "loadfile" @@ -329,6 +351,17 @@ values of OVERRIDE." ((or (match "end" "function_definition") (node-is "end")) standalone-parent 0) + ((n-p-gp "expression_list" "assignment_statement" "variable_declaration") + lua-ts--variable-declaration-continuation-anchor + lua-ts-indent-offset) + ((and (parent-is "binary_expression") + lua-ts--variable-declaration-continuation) + lua-ts--variable-declaration-continuation-anchor + lua-ts-indent-offset) + ((and (lambda (&rest _) lua-ts-indent-continuation-lines) + (parent-is "binary_expression")) + standalone-parent lua-ts-indent-offset) + ((parent-is "binary_expression") standalone-parent 0) ((or (parent-is "function_declaration") (parent-is "function_definition") (parent-is "do_statement") @@ -415,6 +448,22 @@ values of OVERRIDE." (treesit-induce-sparse-tree parent #'lua-ts--function-definition-p))) (= 1 (length (cadr sparse-tree))))) +(defun lua-ts--variable-declaration-continuation (node &rest _) + "Matches if NODE is part of a multi-line variable declaration." + (treesit-parent-until node + (lambda (p) + (equal "variable_declaration" + (treesit-node-type p))))) + +(defun lua-ts--variable-declaration-continuation-anchor (node &rest _) + "Return the start position of the variable declaration for NODE." + (save-excursion + (goto-char (treesit-node-start + (lua-ts--variable-declaration-continuation node))) + (when (looking-back (rx bol (* whitespace)) + (line-beginning-position)) + (point)))) + (defvar lua-ts--syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?+ "." table) diff --git a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts index 9797467bbe5..48184160b4d 100644 --- a/test/lisp/progmodes/lua-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/lua-ts-mode-resources/indent.erts @@ -529,6 +529,58 @@ local Other = { } =-=-= +Name: Continuation Indent + +=-= +local very_long_variable_name = +"ok".. + "ok" +local n = a + +b * +c / +1 +local x = "A".. +"B" +.."C" +if a + and b + and c then + if x + and y then + local x = 1 + +2 * + 3 + end +elseif a + or b + or c then +end +=-= +local very_long_variable_name = + "ok".. + "ok" +local n = a + + b * + c / + 1 +local x = "A".. + "B" + .."C" +if a + and b + and c then + if x + and y then + local x = 1 + + 2 * + 3 + end +elseif a + or b + or c then +end +=-=-= + Code: (lambda () (setq indent-tabs-mode nil) @@ -677,3 +729,57 @@ function e (n, t) end)(i(...)) end end end =-=-= + +Code: + (lambda () + (setq indent-tabs-mode nil) + (setq lua-ts-indent-continuation-lines nil) + (setq lua-ts-indent-offset 2) + (lua-ts-mode) + (indent-region (point-min) (point-max))) + +Name: Unaligned Continuation Indent + +=-= +local n = a + + b * + c / + 1 +if a + and b +and c then + if x + and y then + local x = 1 + + 2 * + 3 + end +elseif a + or b + or c then + if x + or y + end +end +=-= +local n = a + + b * + c / + 1 +if a +and b +and c then + if x + and y then + local x = 1 + + 2 * + 3 + end +elseif a +or b +or c then + if x + or y + end +end +=-=-= commit 07bb8dc0afaef5ec7a7e194df42cc019ce8604d4 Author: Alan Mackenzie Date: Thu Jan 11 17:54:47 2024 +0000 Bind cross-buffer buffer-local variable correctly. This fixes bug#68200. * lisp/emacs-lisp/bytecomp.el (byte-compile-output-docform): Note that let-binding a buffer local variable leaves it buffer local, hence to transfer the binding of byte-compile-dynamic-docstrings to the output buffer, an intermediate variable is needed. Implement this. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 2bc8d54ba77..ea9298c6646 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2605,9 +2605,10 @@ list that represents a doc string reference. `defvaralias', `autoload' and `custom-declare-variable' need that." ;; We need to examine byte-compile-dynamic-docstrings ;; in the input buffer (now current), not in the output buffer. - (let ((byte-compile-dynamic-docstrings byte-compile-dynamic-docstrings)) + (let ((dynamic-docstrings byte-compile-dynamic-docstrings)) (with-current-buffer byte-compile--outbuffer - (let ((position (point)) + (let ((byte-compile-dynamic-docstrings dynamic-docstrings) + (position (point)) (print-continuous-numbering t) print-number-table ;; FIXME: The bindings below are only needed for when we're commit fbc4a3c7de60d766c4b7c639985fecddc4f60604 Author: Eli Zaretskii Date: Thu Jan 11 17:27:04 2024 +0200 Fix man-tests.el * test/lisp/man-tests.el (man-tests-Man-translate-references): Fix test for MS-Windows and MS-DOS. diff --git a/test/lisp/man-tests.el b/test/lisp/man-tests.el index 11f5f805e43..ecda189b6b2 100644 --- a/test/lisp/man-tests.el +++ b/test/lisp/man-tests.el @@ -163,15 +163,21 @@ DESCRIPTION (ert-deftest man-tests-Man-translate-references () (should (equal (Man-translate-references "basename") - "basename")) + (if (memq system-type '(ms-dos windows-nt)) + "\"basename\"" + "basename"))) (should (equal (Man-translate-references "basename(3)") "3 basename")) (should (equal (Man-translate-references "basename(3v)") "3v basename")) (should (equal (Man-translate-references ";id") - "\\;id")) + (if (memq system-type '(ms-dos windows-nt)) + "\";id\"" + "\\;id"))) (should (equal (Man-translate-references "-k basename") - "-k basename"))) + (if (memq system-type '(ms-dos windows-nt)) + "\"-k\" \"basename\"" + "-k basename")))) (provide 'man-tests) commit aa26852f31984c4354a8348ac778904fb8e52640 Author: Stephen Berman Date: Thu Jan 11 15:12:00 2024 +0100 Revert "Fix typo in lispref 'Creating Strings' section" This reverts commit b825962ea840348bbde0c834ca398458a06fbb8b which was mistakenly installed in master instead of emacs-29. diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 4fe94f78cba..7097de49064 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -43,7 +43,7 @@ integer is a character or not is determined only by how it is used. Emacs. A string is a fixed sequence of characters. It is a type of -sequence called an @dfn{array}, meaning that its length is fixed and +sequence called a @dfn{array}, meaning that its length is fixed and cannot be altered once it is created (@pxref{Sequences Arrays Vectors}). Unlike in C, Emacs Lisp strings are @emph{not} terminated by a distinguished character code. commit b825962ea840348bbde0c834ca398458a06fbb8b Author: Xiyue Deng Date: Thu Jan 11 14:41:41 2024 +0100 Fix typo in lispref "Creating Strings" section * doc/lispref/strings.texi (String Basics): Fix typo. diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 7097de49064..4fe94f78cba 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -43,7 +43,7 @@ integer is a character or not is determined only by how it is used. Emacs. A string is a fixed sequence of characters. It is a type of -sequence called a @dfn{array}, meaning that its length is fixed and +sequence called an @dfn{array}, meaning that its length is fixed and cannot be altered once it is created (@pxref{Sequences Arrays Vectors}). Unlike in C, Emacs Lisp strings are @emph{not} terminated by a distinguished character code. commit 5df57f1792ee31fd3a00734dd754cc11bba9dd9c Author: Michael Albinus Date: Thu Jan 11 12:45:03 2024 +0100 Adapt test names in auth-source-tests.el * test/lisp/auth-source-tests.el (auth-source-test-netrc-credentials) (auth-source-test-netrc-credentials-2) (auth-source-test-macos-keychain-search): Adapt test names. diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el index 2ff76977174..0a3c1cce590 100644 --- a/test/lisp/auth-source-tests.el +++ b/test/lisp/auth-source-tests.el @@ -411,7 +411,7 @@ machine c1 port c2 user c3 password c4\n" ;; this is actually the same as `auth-source-search'. (should (equal found expected))))) -(ert-deftest test-netrc-credentials () +(ert-deftest auth-source-test-netrc-credentials () (let ((data (auth-source-netrc-parse-all (ert-resource-file "authinfo")))) (should data) (let ((imap (seq-find (lambda (elem) @@ -427,7 +427,7 @@ machine c1 port c2 user c3 password c4\n" (should (equal (cdr (assoc "login" imap)) "jrh")) (should (equal (cdr (assoc "password" imap)) "*baz*"))))) -(ert-deftest test-netrc-credentials-2 () +(ert-deftest auth-source-test-netrc-credentials-2 () (let ((data (auth-source-netrc-parse-all (ert-resource-file "netrc-folding")))) (should @@ -435,7 +435,7 @@ machine c1 port c2 user c3 password c4\n" '((("machine" . "XM") ("login" . "XL") ("password" . "XP")) (("machine" . "YM") ("login" . "YL") ("password" . "YP"))))))) -(ert-deftest test-macos-keychain-search () +(ert-deftest auth-source-test-macos-keychain-search () "Test if the constructed command line arglist is correct." (let ((auth-sources '(macos-keychain-internet macos-keychain-generic))) ;; Redefine `call-process' to check command line arguments. commit ef08f94cbec1a9fb98bc1bbfcc88cd399b7ff8d0 Author: Michael Albinus Date: Thu Jan 11 12:30:05 2024 +0100 Support numeric port numbers in auth-source-macos-keychain * lisp/auth-source.el (auth-source-macos-keychain-search): Support numeric port numbers (bug#68376). (auth-source-macos-keychain-search-items): Make regexp more robust. * test/lisp/auth-source-tests.el (test-macos-keychain-search): Extend test. diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 369cf4dca2e..cf93cb05fba 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -1946,18 +1946,20 @@ entries for git.gnus.org: (returned-keys (delete-dups (append '(:host :login :port :secret) search-keys))) - ;; Extract host and port from spec + ;; Extract host, port and user from spec (hosts (plist-get spec :host)) - (hosts (if (and hosts (listp hosts)) hosts `(,hosts))) + (hosts (if (consp hosts) hosts `(,hosts))) (ports (plist-get spec :port)) - (ports (if (and ports (listp ports)) ports `(,ports))) + (ports (if (consp ports) ports `(,ports))) (users (plist-get spec :user)) - (users (if (and users (listp users)) users `(,users))) + (users (if (consp users) users `(,users))) ;; Loop through all combinations of host/port and pass each of these to - ;; auth-source-macos-keychain-search-items + ;; auth-source-macos-keychain-search-items. Convert numeric port to + ;; string (bug#68376). (items (catch 'match (dolist (host hosts) (dolist (port ports) + (when (numberp port) (setq port (number-to-string port))) (dolist (user users) (let ((items (apply #'auth-source-macos-keychain-search-items @@ -2019,7 +2021,7 @@ entries for git.gnus.org: (when port (if keychain-generic (setq args (append args (list "-s" port))) - (setq args (append args (if (string-match "[0-9]+" port) + (setq args (append args (if (string-match-p "\\`[[:digit:]]+\\'" port) (list "-P" port) (list "-r" (substring (format "%-4s" port) diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el index 5452501b861..2ff76977174 100644 --- a/test/lisp/auth-source-tests.el +++ b/test/lisp/auth-source-tests.el @@ -442,18 +442,26 @@ machine c1 port c2 user c3 password c4\n" (cl-letf (((symbol-function 'call-process) (lambda (_program _infile _destination _display &rest args) - ;; Arguments must be all strings + ;; Arguments must be all strings. (should (cl-every #'stringp args)) - ;; Argument number should be even + ;; Argument number should be even. (should (cl-evenp (length args))) - (should (cond ((string= (car args) "find-internet-password") - (let ((protocol (cl-member "-r" args :test #'string=))) - (if protocol - (= 4 (length (cadr protocol))) - t))) - ((string= (car args) "find-generic-password") - t)))))) - (auth-source-search :user '("a" "b") :host '("example.org") :port '("irc" "ftp" "https"))))) + (should + (cond + ((string= (car args) "find-internet-password") + (let ((protocol-r (cl-member "-r" args :test #'string=)) + (protocol-P (cl-member "-P" args :test #'string=))) + (cond (protocol-r + (= 4 (length (cadr protocol-r)))) + (protocol-P + (string-match-p + "\\`[[:digit:]]+\\'" (cadr protocol-P))) + (t)))) + ((string= (car args) "find-generic-password") + t)))))) + (auth-source-search + :user '("a" "b") :host '("example.org") + :port '("irc" "ftp" "https" 123))))) (provide 'auth-source-tests) ;;; auth-source-tests.el ends here commit c7aa5c6d2b838e2fd84db4cbdafdbd546dd87832 Author: Jared Finder Date: Mon Jan 8 13:20:25 2024 -0800 Populate tool-bar bindings on text terminals * lisp/tool-bar.el (tool-bar-make-keymap-1): Populate on text terminals. (Bug#68334) diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el index 4ca81fb01e0..96b61c7b229 100644 --- a/lisp/tool-bar.el +++ b/lisp/tool-bar.el @@ -165,6 +165,8 @@ color capability and based on the available image libraries." base-keymap) base-keymap))) +;; This function should return binds even if images can not be +;; displayed so the tool bar can still be displayed on terminals. (defun tool-bar-make-keymap-1 (&optional map) "Generate an actual keymap from `tool-bar-map', without caching. MAP is either a keymap to use as a source for menu items, or nil, @@ -180,15 +182,14 @@ in which case the value of `tool-bar-map' is used instead." (consp image-exp) (not (eq (car image-exp) 'image)) (fboundp (car image-exp))) - (if (not (display-images-p)) - (setq bind nil) - (let ((image (eval image-exp))) - (unless (and image (image-mask-p image)) - (setq image (append image '(:mask heuristic)))) - (setq bind (copy-sequence bind) - plist (nthcdr (if (consp (nth 4 bind)) 5 4) - bind)) - (plist-put plist :image image)))) + (let ((image (and (display-images-p) + (eval image-exp)))) + (unless (and image (image-mask-p image)) + (setq image (append image '(:mask heuristic)))) + (setq bind (copy-sequence bind) + plist (nthcdr (if (consp (nth 4 bind)) 5 4) + bind)) + (plist-put plist :image image))) bind)) (or map tool-bar-map)))