diff options
| author | Stefan Kangas | 2022-12-21 02:37:17 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2022-12-21 02:37:17 +0100 |
| commit | 2bbc554db63cc5cc140ade5bfcbbf53ecd18f5ae (patch) | |
| tree | 044d6aa99d0ef54ace6c01583231c1ae286c8865 | |
| parent | 1424342225ef5b18c630364dd88e004f4ebb1c7f (diff) | |
| parent | d3a76db88b4357fe1c92f240796ea9b522b97a8e (diff) | |
| download | emacs-2bbc554db63cc5cc140ade5bfcbbf53ecd18f5ae.tar.gz emacs-2bbc554db63cc5cc140ade5bfcbbf53ecd18f5ae.zip | |
Merge from origin/emacs-29
d3a76db88b4 * lisp/repeat.el: Fix repeat-keep-prefix to allow customi...
8ef3777d544 Correct capitalization of Lisp in the manual (bug#60222)
d03ea893780 eglot.el: Add vscode-json-languageserver to eglot-server-...
8550a993785 ; * src/emacs-module.h.in (enum emacs_funcall_exit): Fix ...
fb7f3999c59 ; Fix ruby-method-params-indent's :version value
cfbfd393b45 * lisp/progmodes/project.el (project--read-file-cpd-relat...
2b1fdbffcb5 ruby-method-params-indent: New user option
b9e813f79f2 ; ruby-indent-level: Improve the docstring
399433cc2b9 * lisp/progmodes/project.el: Filter out empty strings fro...
23f7c9c2a92 Fix storing email into nnmail by Gnus
63cdbd986bb ; Really respect browse-url var in erc-compat
64163618d21 whitespace: Fix unintended change in buffer modification ...
a75d1da911c Make emacsclient add abbreviated file names to file-name-...
b3e7768a0ee Repair setopt test after error demotion to warning
| -rw-r--r-- | doc/lispref/compile.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/erc/erc-compat.el | 10 | ||||
| -rw-r--r-- | lisp/erc/erc.el | 12 | ||||
| -rw-r--r-- | lisp/gnus/nnml.el | 13 | ||||
| -rw-r--r-- | lisp/progmodes/eglot.el | 1 | ||||
| -rw-r--r-- | lisp/progmodes/project.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 28 | ||||
| -rw-r--r-- | lisp/repeat.el | 117 | ||||
| -rw-r--r-- | lisp/server.el | 2 | ||||
| -rw-r--r-- | lisp/whitespace.el | 28 | ||||
| -rw-r--r-- | src/emacs-module.h.in | 2 | ||||
| -rw-r--r-- | test/lisp/cus-edit-tests.el | 11 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-resources/ruby-method-params-indent.rb | 18 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-resources/ruby.rb | 4 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el | 24 | ||||
| -rw-r--r-- | test/lisp/repeat-tests.el | 30 | ||||
| -rw-r--r-- | test/lisp/whitespace-tests.el | 10 |
18 files changed, 214 insertions, 105 deletions
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index 3e397349995..ae4905bb1f9 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi | |||
| @@ -930,7 +930,7 @@ used by Emacs to natively-compile any Lisp file or byte-compiled Lisp | |||
| 930 | file that is loaded into Emacs, when no natively-compiled file for it | 930 | file that is loaded into Emacs, when no natively-compiled file for it |
| 931 | is available. Note that because of this use of a subprocess, native | 931 | is available. Note that because of this use of a subprocess, native |
| 932 | compilation may produce warning and errors which byte-compilation does | 932 | compilation may produce warning and errors which byte-compilation does |
| 933 | not, and lisp code may thus need to be modified to work correctly. See | 933 | not, and Lisp code may thus need to be modified to work correctly. See |
| 934 | @code{native-comp-async-report-warnings-errors} in @pxref{Native-Compilation | 934 | @code{native-comp-async-report-warnings-errors} in @pxref{Native-Compilation |
| 935 | Variables} for more details. | 935 | Variables} for more details. |
| 936 | 936 | ||
| @@ -71,6 +71,9 @@ switches for shortlogs, such as the one produced by 'C-x v L'. | |||
| 71 | You can now configure how to display the "*buffer-selection*" buffer | 71 | You can now configure how to display the "*buffer-selection*" buffer |
| 72 | using this new option. (Or set 'display-buffer-alist' directly.) | 72 | using this new option. (Or set 'display-buffer-alist' directly.) |
| 73 | 73 | ||
| 74 | --- | ||
| 75 | *** New user option 'ruby-method-params-indent'. | ||
| 76 | |||
| 74 | ** Eshell | 77 | ** Eshell |
| 75 | 78 | ||
| 76 | +++ | 79 | +++ |
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el index 77625398abd..fdcb146d42a 100644 --- a/lisp/erc/erc-compat.el +++ b/lisp/erc/erc-compat.el | |||
| @@ -391,11 +391,11 @@ If START or END is negative, it counts from the end." | |||
| 391 | 391 | ||
| 392 | (cond ((fboundp 'browse-url-irc)) ; 29 | 392 | (cond ((fboundp 'browse-url-irc)) ; 29 |
| 393 | ((boundp 'browse-url-default-handlers) ; 28 | 393 | ((boundp 'browse-url-default-handlers) ; 28 |
| 394 | (setf (alist-get "\\`irc6?s?://" browse-url-default-handlers | 394 | (add-to-list 'browse-url-default-handlers |
| 395 | nil nil (lambda (a _) | 395 | '("\\`irc6?s?://" . erc-compat--29-browse-url-irc) |
| 396 | (and (stringp a) | 396 | nil (lambda (_ a) |
| 397 | (string-match-p a "irc://localhost")))) | 397 | (and (stringp (car-safe a)) |
| 398 | #'erc-compat--29-browse-url-irc)) | 398 | (string-match-p (car a) "irc://localhost"))))) |
| 399 | ((boundp 'browse-url-browser-function) ; 27 | 399 | ((boundp 'browse-url-browser-function) ; 27 |
| 400 | (require 'browse-url) | 400 | (require 'browse-url) |
| 401 | (let ((existing browse-url-browser-function)) | 401 | (let ((existing browse-url-browser-function)) |
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 6cfc39c4bda..6a5e0018964 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el | |||
| @@ -1765,8 +1765,7 @@ all channel buffers on all servers." | |||
| 1765 | ;; to, it was never realized. | 1765 | ;; to, it was never realized. |
| 1766 | ;; | 1766 | ;; |
| 1767 | ;; New library code should use the `erc--target' struct instead. | 1767 | ;; New library code should use the `erc--target' struct instead. |
| 1768 | ;; Third-party code can continue to use this until a getter for | 1768 | ;; Third-party code can continue to use this and `erc-default-target'. |
| 1769 | ;; `erc--target' (or whatever replaces it) is exported. | ||
| 1770 | (defvar-local erc-default-recipients nil | 1769 | (defvar-local erc-default-recipients nil |
| 1771 | "List of default recipients of the current buffer.") | 1770 | "List of default recipients of the current buffer.") |
| 1772 | 1771 | ||
| @@ -6012,13 +6011,14 @@ See also `erc-downcase'." | |||
| 6012 | ;; While `erc-default-target' happens to return nil in channel buffers | 6011 | ;; While `erc-default-target' happens to return nil in channel buffers |
| 6013 | ;; you've parted or from which you've been kicked, using it to detect | 6012 | ;; you've parted or from which you've been kicked, using it to detect |
| 6014 | ;; whether a channel is currently joined may become unreliable in the | 6013 | ;; whether a channel is currently joined may become unreliable in the |
| 6015 | ;; future. For now, new code should consider using | 6014 | ;; future. For now, third-party code can use |
| 6016 | ;; | 6015 | ;; |
| 6017 | ;; (erc-get-channel-user (erc-current-nick)) | 6016 | ;; (erc-get-channel-user (erc-current-nick)) |
| 6018 | ;; | 6017 | ;; |
| 6019 | ;; and expect a nicer option eventually. For retrieving a target | 6018 | ;; A predicate may be provided eventually. For retrieving a target's |
| 6020 | ;; regardless of subscription or connection status, use replacements | 6019 | ;; name regardless of subscription or connection status, new library |
| 6021 | ;; based on `erc--target' instead. See also `erc--default-target'. | 6020 | ;; code should use `erc--default-target'. Third-party code should |
| 6021 | ;; continue to use `erc-default-target'. | ||
| 6022 | 6022 | ||
| 6023 | (defun erc-default-target () | 6023 | (defun erc-default-target () |
| 6024 | "Return the current default target (as a character string) or nil if none." | 6024 | "Return the current default target (as a character string) or nil if none." |
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el index 40e4b9ea828..7aa445e6646 100644 --- a/lisp/gnus/nnml.el +++ b/lisp/gnus/nnml.el | |||
| @@ -776,17 +776,22 @@ article number. This function is called narrowed to an article." | |||
| 776 | (nnml--encode-headers headers) | 776 | (nnml--encode-headers headers) |
| 777 | headers)))) | 777 | headers)))) |
| 778 | 778 | ||
| 779 | ;; RFC2047-encode Subject and From, but leave invalid headers unencoded. | ||
| 779 | (defun nnml--encode-headers (headers) | 780 | (defun nnml--encode-headers (headers) |
| 780 | (let ((subject (mail-header-subject headers)) | 781 | (let ((subject (mail-header-subject headers)) |
| 781 | (rfc2047-encoding-type 'mime)) | 782 | (rfc2047-encoding-type 'mime)) |
| 782 | (unless (string-match "\\`[[:ascii:]]*\\'" subject) | 783 | (unless (string-match "\\`[[:ascii:]]*\\'" subject) |
| 783 | (setf (mail-header-subject headers) | 784 | (let ((encoded-subject |
| 784 | (mail-encode-encoded-word-string subject t)))) | 785 | (ignore-errors (mail-encode-encoded-word-string subject t)))) |
| 786 | (if encoded-subject | ||
| 787 | (setf (mail-header-subject headers) encoded-subject))))) | ||
| 785 | (let ((from (mail-header-from headers)) | 788 | (let ((from (mail-header-from headers)) |
| 786 | (rfc2047-encoding-type 'address-mime)) | 789 | (rfc2047-encoding-type 'address-mime)) |
| 787 | (unless (string-match "\\`[[:ascii:]]*\\'" from) | 790 | (unless (string-match "\\`[[:ascii:]]*\\'" from) |
| 788 | (setf (mail-header-from headers) | 791 | (let ((encoded-from |
| 789 | (rfc2047-encode-string from t))))) | 792 | (ignore-errors (rfc2047-encode-string from t)))) |
| 793 | (if encoded-from | ||
| 794 | (setf (mail-header-from headers) encoded-from)))))) | ||
| 790 | 795 | ||
| 791 | (defun nnml-get-nov-buffer (group &optional incrementalp) | 796 | (defun nnml-get-nov-buffer (group &optional incrementalp) |
| 792 | (let ((buffer (gnus-get-buffer-create | 797 | (let ((buffer (gnus-get-buffer-create |
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index ce4ca4f3d92..0f1bfd0447d 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -190,6 +190,7 @@ chosen (interactively or automatically)." | |||
| 190 | '("pylsp" "pyls" ("pyright-langserver" "--stdio") "jedi-language-server"))) | 190 | '("pylsp" "pyls" ("pyright-langserver" "--stdio") "jedi-language-server"))) |
| 191 | ((js-json-mode json-mode json-ts-mode) | 191 | ((js-json-mode json-mode json-ts-mode) |
| 192 | . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") | 192 | . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") |
| 193 | ("vscode-json-languageserver" "--stdio") | ||
| 193 | ("json-languageserver" "--stdio")))) | 194 | ("json-languageserver" "--stdio")))) |
| 194 | ((js-mode js-ts-mode tsx-ts-mode typescript-ts-mode typescript-mode) | 195 | ((js-mode js-ts-mode tsx-ts-mode typescript-ts-mode typescript-mode) |
| 195 | . ("typescript-language-server" "--stdio")) | 196 | . ("typescript-language-server" "--stdio")) |
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 559da6dd649..c2633798473 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el | |||
| @@ -1040,12 +1040,14 @@ by the user at will." | |||
| 1040 | (setq substrings (cons "./" substrings)))) | 1040 | (setq substrings (cons "./" substrings)))) |
| 1041 | (new-collection (project--file-completion-table substrings)) | 1041 | (new-collection (project--file-completion-table substrings)) |
| 1042 | (abbr-cpd (abbreviate-file-name common-parent-directory)) | 1042 | (abbr-cpd (abbreviate-file-name common-parent-directory)) |
| 1043 | (abbr-cpd-length (length abbr-cpd)) | ||
| 1043 | (relname (cl-letf ((history-add-new-input nil) | 1044 | (relname (cl-letf ((history-add-new-input nil) |
| 1044 | ((symbol-value hist) | 1045 | ((symbol-value hist) |
| 1045 | (mapcan | 1046 | (mapcan |
| 1046 | (lambda (s) | 1047 | (lambda (s) |
| 1047 | (and (string-prefix-p abbr-cpd s) | 1048 | (and (string-prefix-p abbr-cpd s) |
| 1048 | (list (substring s (length abbr-cpd))))) | 1049 | (not (eq abbr-cpd-length (length s))) |
| 1050 | (list (substring s abbr-cpd-length)))) | ||
| 1049 | (symbol-value hist)))) | 1051 | (symbol-value hist)))) |
| 1050 | (project--completing-read-strict prompt | 1052 | (project--completing-read-strict prompt |
| 1051 | new-collection | 1053 | new-collection |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index fa51597697f..1f3e9b6ae7b 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -212,7 +212,7 @@ It should match the part after \"def\" and until \"=\".") | |||
| 212 | :safe 'booleanp) | 212 | :safe 'booleanp) |
| 213 | 213 | ||
| 214 | (defcustom ruby-indent-level 2 | 214 | (defcustom ruby-indent-level 2 |
| 215 | "Indentation of Ruby statements." | 215 | "Number of spaces for each indentation step in `ruby-mode'." |
| 216 | :type 'integer | 216 | :type 'integer |
| 217 | :safe 'integerp) | 217 | :safe 'integerp) |
| 218 | 218 | ||
| @@ -268,6 +268,23 @@ Only has effect when `ruby-use-smie' is t." | |||
| 268 | :safe 'booleanp | 268 | :safe 'booleanp |
| 269 | :version "24.4") | 269 | :version "24.4") |
| 270 | 270 | ||
| 271 | (defcustom ruby-method-params-indent t | ||
| 272 | "Indentation of multiline method parameters. | ||
| 273 | |||
| 274 | When t, the parameters list is indented to the method name. | ||
| 275 | |||
| 276 | When a number, indent the parameters list this many columns | ||
| 277 | against the beginning of the method (the \"def\" keyword). | ||
| 278 | |||
| 279 | The value nil means the same as 0. | ||
| 280 | |||
| 281 | Only has effect when `ruby-use-smie' is t." | ||
| 282 | :type '(choice (const :tag "Indent to the method name" t) | ||
| 283 | (number :tag "Indent specified number of columns against def") | ||
| 284 | (const :tag "Indent to def" nil)) | ||
| 285 | :safe (lambda (val) (or (memq val '(t nil)) (numberp val))) | ||
| 286 | :version "29.1") | ||
| 287 | |||
| 271 | (defcustom ruby-deep-arglist t | 288 | (defcustom ruby-deep-arglist t |
| 272 | "Deep indent lists in parenthesis when non-nil. | 289 | "Deep indent lists in parenthesis when non-nil. |
| 273 | Also ignores spaces after parenthesis when `space'. | 290 | Also ignores spaces after parenthesis when `space'. |
| @@ -660,9 +677,12 @@ This only affects the output of the command `ruby-toggle-block'." | |||
| 660 | (unless (or (eolp) (forward-comment 1)) | 677 | (unless (or (eolp) (forward-comment 1)) |
| 661 | (cons 'column (current-column))))) | 678 | (cons 'column (current-column))))) |
| 662 | ('(:before . " @ ") | 679 | ('(:before . " @ ") |
| 663 | (save-excursion | 680 | (if (or (eq ruby-method-params-indent t) |
| 664 | (skip-chars-forward " \t") | 681 | (not (smie-rule-parent-p "def" "def="))) |
| 665 | (cons 'column (current-column)))) | 682 | (save-excursion |
| 683 | (skip-chars-forward " \t") | ||
| 684 | (cons 'column (current-column))) | ||
| 685 | (smie-rule-parent (or ruby-method-params-indent 0)))) | ||
| 666 | ('(:before . "do") (ruby-smie--indent-to-stmt)) | 686 | ('(:before . "do") (ruby-smie--indent-to-stmt)) |
| 667 | ('(:before . ".") | 687 | ('(:before . ".") |
| 668 | (if (smie-rule-sibling-p) | 688 | (if (smie-rule-sibling-p) |
diff --git a/lisp/repeat.el b/lisp/repeat.el index 33e8d98ce33..3b3a444ee24 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el | |||
| @@ -368,6 +368,13 @@ This property can override the value of this variable." | |||
| 368 | (defcustom repeat-keep-prefix nil | 368 | (defcustom repeat-keep-prefix nil |
| 369 | "Whether to keep the prefix arg of the previous command when repeating." | 369 | "Whether to keep the prefix arg of the previous command when repeating." |
| 370 | :type 'boolean | 370 | :type 'boolean |
| 371 | :initialize #'custom-initialize-default | ||
| 372 | :set (lambda (sym val) | ||
| 373 | (set-default sym val) | ||
| 374 | (when repeat-mode | ||
| 375 | (if repeat-keep-prefix | ||
| 376 | (add-hook 'pre-command-hook 'repeat-pre-hook) | ||
| 377 | (remove-hook 'pre-command-hook 'repeat-pre-hook)))) | ||
| 371 | :group 'repeat | 378 | :group 'repeat |
| 372 | :version "28.1") | 379 | :version "28.1") |
| 373 | 380 | ||
| @@ -419,7 +426,11 @@ When Repeat mode is enabled, and the command symbol has the property named | |||
| 419 | See `describe-repeat-maps' for a list of all repeatable commands." | 426 | See `describe-repeat-maps' for a list of all repeatable commands." |
| 420 | :global t :group 'repeat | 427 | :global t :group 'repeat |
| 421 | (if (not repeat-mode) | 428 | (if (not repeat-mode) |
| 422 | (remove-hook 'post-command-hook 'repeat-post-hook) | 429 | (progn |
| 430 | (remove-hook 'pre-command-hook 'repeat-pre-hook) | ||
| 431 | (remove-hook 'post-command-hook 'repeat-post-hook)) | ||
| 432 | (when repeat-keep-prefix | ||
| 433 | (add-hook 'pre-command-hook 'repeat-pre-hook)) | ||
| 423 | (add-hook 'post-command-hook 'repeat-post-hook) | 434 | (add-hook 'post-command-hook 'repeat-post-hook) |
| 424 | (let* ((keymaps nil) | 435 | (let* ((keymaps nil) |
| 425 | (commands (all-completions | 436 | (commands (all-completions |
| @@ -431,15 +442,21 @@ See `describe-repeat-maps' for a list of all repeatable commands." | |||
| 431 | (length commands) | 442 | (length commands) |
| 432 | (length (delete-dups keymaps)))))) | 443 | (length (delete-dups keymaps)))))) |
| 433 | 444 | ||
| 434 | (defvar repeat--prev-mb '(0) | ||
| 435 | "Previous minibuffer state.") | ||
| 436 | |||
| 437 | (defun repeat--command-property (property) | 445 | (defun repeat--command-property (property) |
| 438 | (or (and (symbolp this-command) | 446 | (or (and (symbolp this-command) |
| 439 | (get this-command property)) | 447 | (get this-command property)) |
| 440 | (and (symbolp real-this-command) | 448 | (and (symbolp real-this-command) |
| 441 | (get real-this-command property)))) | 449 | (get real-this-command property)))) |
| 442 | 450 | ||
| 451 | (defun repeat-get-map () | ||
| 452 | "Return a transient map for keys repeatable after the current command." | ||
| 453 | (when repeat-mode | ||
| 454 | (let ((rep-map (or repeat-map (repeat--command-property 'repeat-map)))) | ||
| 455 | (when rep-map | ||
| 456 | (when (and (symbolp rep-map) (boundp rep-map)) | ||
| 457 | (setq rep-map (symbol-value rep-map))) | ||
| 458 | rep-map)))) | ||
| 459 | |||
| 443 | (defun repeat-check-key (key map) | 460 | (defun repeat-check-key (key map) |
| 444 | "Check if the last key is suitable to activate the repeating MAP." | 461 | "Check if the last key is suitable to activate the repeating MAP." |
| 445 | (let* ((prop (repeat--command-property 'repeat-check-key)) | 462 | (let* ((prop (repeat--command-property 'repeat-check-key)) |
| @@ -449,50 +466,61 @@ See `describe-repeat-maps' for a list of all repeatable commands." | |||
| 449 | ;; Try without modifiers: | 466 | ;; Try without modifiers: |
| 450 | (lookup-key map (vector (event-basic-type key)))))) | 467 | (lookup-key map (vector (event-basic-type key)))))) |
| 451 | 468 | ||
| 469 | (defvar repeat--prev-mb '(0) | ||
| 470 | "Previous minibuffer state.") | ||
| 471 | |||
| 472 | (defun repeat-check-map (map) | ||
| 473 | "Decides whether MAP can be used for the next command." | ||
| 474 | (and map | ||
| 475 | ;; Detect changes in the minibuffer state to allow repetitions | ||
| 476 | ;; in the same minibuffer, but not when the minibuffer is activated | ||
| 477 | ;; in the middle of repeating sequence (bug#47566). | ||
| 478 | (or (< (minibuffer-depth) (car repeat--prev-mb)) | ||
| 479 | (eq current-minibuffer-command (cdr repeat--prev-mb))) | ||
| 480 | (repeat-check-key last-command-event map) | ||
| 481 | t)) | ||
| 482 | |||
| 483 | (defun repeat-pre-hook () | ||
| 484 | "Function run before commands to handle repeatable keys." | ||
| 485 | (when (and repeat-mode repeat-keep-prefix repeat-in-progress | ||
| 486 | (not prefix-arg) current-prefix-arg) | ||
| 487 | (let ((map (repeat-get-map))) | ||
| 488 | ;; Only when repeat-post-hook will activate the same map | ||
| 489 | (when (repeat-check-map map) | ||
| 490 | ;; Optimize to use less logic in the function `repeat-get-map' | ||
| 491 | ;; for the next call: when called again from `repeat-post-hook' | ||
| 492 | ;; it will use the variable `repeat-map'. | ||
| 493 | (setq repeat-map map) | ||
| 494 | ;; Preserve universal argument | ||
| 495 | (setq prefix-arg current-prefix-arg))))) | ||
| 496 | |||
| 452 | (defun repeat-post-hook () | 497 | (defun repeat-post-hook () |
| 453 | "Function run after commands to set transient keymap for repeatable keys." | 498 | "Function run after commands to set transient keymap for repeatable keys." |
| 454 | (let ((was-in-progress repeat-in-progress)) | 499 | (let ((was-in-progress repeat-in-progress)) |
| 455 | (setq repeat-in-progress nil) | 500 | (setq repeat-in-progress nil) |
| 456 | (when repeat-mode | 501 | (let ((map (repeat-get-map))) |
| 457 | (let ((rep-map (or repeat-map (repeat--command-property 'repeat-map)))) | 502 | (when (repeat-check-map map) |
| 458 | (when rep-map | 503 | ;; Messaging |
| 459 | (when (and (symbolp rep-map) (boundp rep-map)) | 504 | (funcall repeat-echo-function map) |
| 460 | (setq rep-map (symbol-value rep-map))) | 505 | |
| 461 | (let ((map (copy-keymap rep-map))) | 506 | ;; Adding an exit key |
| 462 | 507 | (when repeat-exit-key | |
| 463 | (when (and | 508 | (setq map (copy-keymap map)) |
| 464 | ;; Detect changes in the minibuffer state to allow repetitions | 509 | (define-key map (if (key-valid-p repeat-exit-key) |
| 465 | ;; in the same minibuffer, but not when the minibuffer is activated | 510 | (kbd repeat-exit-key) |
| 466 | ;; in the middle of repeating sequence (bug#47566). | 511 | repeat-exit-key) |
| 467 | (or (< (minibuffer-depth) (car repeat--prev-mb)) | 512 | 'ignore)) |
| 468 | (eq current-minibuffer-command (cdr repeat--prev-mb))) | 513 | |
| 469 | (or (not repeat-keep-prefix) prefix-arg) | 514 | (setq repeat-in-progress t) |
| 470 | (repeat-check-key last-command-event map)) | 515 | (repeat--exit) |
| 471 | 516 | (let ((exitfun (set-transient-map map))) | |
| 472 | ;; Messaging | 517 | (setq repeat-exit-function exitfun) |
| 473 | (unless prefix-arg | 518 | |
| 474 | (funcall repeat-echo-function map)) | 519 | (let* ((prop (repeat--command-property 'repeat-exit-timeout)) |
| 475 | 520 | (timeout (unless (eq prop 'no) (or prop repeat-exit-timeout)))) | |
| 476 | ;; Adding an exit key | 521 | (when timeout |
| 477 | (when repeat-exit-key | 522 | (setq repeat-exit-timer |
| 478 | (define-key map (if (key-valid-p repeat-exit-key) | 523 | (run-with-idle-timer timeout nil #'repeat-exit))))))) |
| 479 | (kbd repeat-exit-key) | ||
| 480 | repeat-exit-key) | ||
| 481 | 'ignore)) | ||
| 482 | |||
| 483 | (when (and repeat-keep-prefix (not prefix-arg)) | ||
| 484 | (setq prefix-arg current-prefix-arg)) | ||
| 485 | |||
| 486 | (setq repeat-in-progress t) | ||
| 487 | (let ((exitfun (set-transient-map map))) | ||
| 488 | (repeat--exit) | ||
| 489 | (setq repeat-exit-function exitfun) | ||
| 490 | |||
| 491 | (let* ((prop (repeat--command-property 'repeat-exit-timeout)) | ||
| 492 | (timeout (unless (eq prop 'no) (or prop repeat-exit-timeout)))) | ||
| 493 | (when timeout | ||
| 494 | (setq repeat-exit-timer | ||
| 495 | (run-with-idle-timer timeout nil #'repeat-exit)))))))))) | ||
| 496 | 524 | ||
| 497 | (setq repeat-map nil) | 525 | (setq repeat-map nil) |
| 498 | (setq repeat--prev-mb (cons (minibuffer-depth) current-minibuffer-command)) | 526 | (setq repeat--prev-mb (cons (minibuffer-depth) current-minibuffer-command)) |
| @@ -582,6 +610,7 @@ Used in `repeat-mode'." | |||
| 582 | (push s (alist-get (get s 'repeat-map) keymaps))))) | 610 | (push s (alist-get (get s 'repeat-map) keymaps))))) |
| 583 | (with-help-window (help-buffer) | 611 | (with-help-window (help-buffer) |
| 584 | (with-current-buffer standard-output | 612 | (with-current-buffer standard-output |
| 613 | (setq-local outline-regexp "[*]+") | ||
| 585 | (insert "A list of keymaps used by commands with the symbol property `repeat-map'.\n") | 614 | (insert "A list of keymaps used by commands with the symbol property `repeat-map'.\n") |
| 586 | 615 | ||
| 587 | (dolist (keymap (sort keymaps (lambda (a b) | 616 | (dolist (keymap (sort keymaps (lambda (a b) |
diff --git a/lisp/server.el b/lisp/server.el index 8f4ca4cbc6c..8bd622346e7 100644 --- a/lisp/server.el +++ b/lisp/server.el | |||
| @@ -1502,7 +1502,7 @@ so don't mark these buffers specially, just visit them normally." | |||
| 1502 | minibuffer-auto-raise)) | 1502 | minibuffer-auto-raise)) |
| 1503 | (filen (car file)) | 1503 | (filen (car file)) |
| 1504 | (obuf (get-file-buffer filen))) | 1504 | (obuf (get-file-buffer filen))) |
| 1505 | (add-to-history 'file-name-history filen) | 1505 | (file-name-history--add filen) |
| 1506 | (if (null obuf) | 1506 | (if (null obuf) |
| 1507 | (progn | 1507 | (progn |
| 1508 | (run-hooks 'pre-command-hook) | 1508 | (run-hooks 'pre-command-hook) |
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 25ea07e9db7..9bc6ad9db46 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -2268,10 +2268,11 @@ Highlighting those lines can be distracting.)" | |||
| 2268 | (save-excursion (goto-char whitespace-point) | 2268 | (save-excursion (goto-char whitespace-point) |
| 2269 | (line-beginning-position))))) | 2269 | (line-beginning-position))))) |
| 2270 | (when (= p 1) | 2270 | (when (= p 1) |
| 2271 | ;; See the comment in `whitespace--update-bob-eob' for why this | 2271 | (with-silent-modifications |
| 2272 | ;; text property is added here. | 2272 | ;; See the comment in `whitespace--update-bob-eob' for why |
| 2273 | (put-text-property 1 whitespace-bob-marker | 2273 | ;; this text property is added here. |
| 2274 | 'font-lock-multiline t)) | 2274 | (put-text-property 1 whitespace-bob-marker |
| 2275 | 'font-lock-multiline t))) | ||
| 2275 | (when (< p e) | 2276 | (when (< p e) |
| 2276 | (set-match-data (list p e)) | 2277 | (set-match-data (list p e)) |
| 2277 | (goto-char e)))) | 2278 | (goto-char e)))) |
| @@ -2292,10 +2293,11 @@ about to start typing, and if they do, that line and previous | |||
| 2292 | empty lines will no longer be EoB empty lines. Highlighting | 2293 | empty lines will no longer be EoB empty lines. Highlighting |
| 2293 | those lines can be distracting.)" | 2294 | those lines can be distracting.)" |
| 2294 | (when (= limit (1+ (buffer-size))) | 2295 | (when (= limit (1+ (buffer-size))) |
| 2295 | ;; See the comment in `whitespace--update-bob-eob' for why this | 2296 | (with-silent-modifications |
| 2296 | ;; text property is added here. | 2297 | ;; See the comment in `whitespace--update-bob-eob' for why this |
| 2297 | (put-text-property whitespace-eob-marker limit | 2298 | ;; text property is added here. |
| 2298 | 'font-lock-multiline t)) | 2299 | (put-text-property whitespace-eob-marker limit |
| 2300 | 'font-lock-multiline t))) | ||
| 2299 | (let ((b (max (point) whitespace-eob-marker | 2301 | (let ((b (max (point) whitespace-eob-marker |
| 2300 | whitespace-bob-marker ; See comment in the bob func. | 2302 | whitespace-bob-marker ; See comment in the bob func. |
| 2301 | (save-excursion (goto-char whitespace-point) | 2303 | (save-excursion (goto-char whitespace-point) |
| @@ -2437,8 +2439,9 @@ purposes)." | |||
| 2437 | (save-match-data | 2439 | (save-match-data |
| 2438 | (when (looking-at whitespace-empty-at-bob-regexp) | 2440 | (when (looking-at whitespace-empty-at-bob-regexp) |
| 2439 | (set-marker whitespace-bob-marker (match-end 1)) | 2441 | (set-marker whitespace-bob-marker (match-end 1)) |
| 2440 | (put-text-property (match-beginning 1) (match-end 1) | 2442 | (with-silent-modifications |
| 2441 | 'font-lock-multiline t)))) | 2443 | (put-text-property (match-beginning 1) (match-end 1) |
| 2444 | 'font-lock-multiline t))))) | ||
| 2442 | (when (or (null end) | 2445 | (when (or (null end) |
| 2443 | (>= end (save-excursion | 2446 | (>= end (save-excursion |
| 2444 | (goto-char whitespace-eob-marker) | 2447 | (goto-char whitespace-eob-marker) |
| @@ -2451,8 +2454,9 @@ purposes)." | |||
| 2451 | (when (whitespace--looking-back | 2454 | (when (whitespace--looking-back |
| 2452 | whitespace-empty-at-eob-regexp) | 2455 | whitespace-empty-at-eob-regexp) |
| 2453 | (set-marker whitespace-eob-marker (match-beginning 1)) | 2456 | (set-marker whitespace-eob-marker (match-beginning 1)) |
| 2454 | (put-text-property (match-beginning 1) (match-end 1) | 2457 | (with-silent-modifications |
| 2455 | 'font-lock-multiline t))))))))) | 2458 | (put-text-property (match-beginning 1) (match-end 1) |
| 2459 | 'font-lock-multiline t)))))))))) | ||
| 2456 | 2460 | ||
| 2457 | 2461 | ||
| 2458 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2462 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in index d485de5aa18..c51d482d8a2 100644 --- a/src/emacs-module.h.in +++ b/src/emacs-module.h.in | |||
| @@ -116,7 +116,7 @@ enum emacs_funcall_exit | |||
| 116 | /* Function has signaled an error using `signal'. */ | 116 | /* Function has signaled an error using `signal'. */ |
| 117 | emacs_funcall_exit_signal = 1, | 117 | emacs_funcall_exit_signal = 1, |
| 118 | 118 | ||
| 119 | /* Function has exit using `throw'. */ | 119 | /* Function has exited using `throw'. */ |
| 120 | emacs_funcall_exit_throw = 2 | 120 | emacs_funcall_exit_throw = 2 |
| 121 | }; | 121 | }; |
| 122 | 122 | ||
diff --git a/test/lisp/cus-edit-tests.el b/test/lisp/cus-edit-tests.el index 0ef5168109b..31ba68b4107 100644 --- a/test/lisp/cus-edit-tests.el +++ b/test/lisp/cus-edit-tests.el | |||
| @@ -83,7 +83,14 @@ | |||
| 83 | (ert-deftest test-setopt () | 83 | (ert-deftest test-setopt () |
| 84 | (should (= (setopt cus-edit-test-foo1 1) 1)) | 84 | (should (= (setopt cus-edit-test-foo1 1) 1)) |
| 85 | (should (= cus-edit-test-foo1 1)) | 85 | (should (= cus-edit-test-foo1 1)) |
| 86 | (should-error (setopt cus-edit-test-foo1 :foo))) | 86 | (let* ((text-quoting-style 'grave) |
| 87 | 87 | (warn-txt | |
| 88 | (with-current-buffer (get-buffer-create "*Warnings*") | ||
| 89 | (let ((inhibit-read-only t)) | ||
| 90 | (erase-buffer)) | ||
| 91 | (setopt cus-edit-test-foo1 :foo) | ||
| 92 | (buffer-substring-no-properties (point-min) (point-max))))) | ||
| 93 | (should (string-search "Value `:foo' does not match type number" | ||
| 94 | warn-txt)))) | ||
| 88 | (provide 'cus-edit-tests) | 95 | (provide 'cus-edit-tests) |
| 89 | ;;; cus-edit-tests.el ends here | 96 | ;;; cus-edit-tests.el ends here |
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby-method-params-indent.rb b/test/lisp/progmodes/ruby-mode-resources/ruby-method-params-indent.rb new file mode 100644 index 00000000000..2b665797397 --- /dev/null +++ b/test/lisp/progmodes/ruby-mode-resources/ruby-method-params-indent.rb | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | class C | ||
| 2 | def self.foo( | ||
| 3 | baz, | ||
| 4 | bar | ||
| 5 | ) = | ||
| 6 | what | ||
| 7 | |||
| 8 | def foo=( | ||
| 9 | baz, | ||
| 10 | bar | ||
| 11 | ) | ||
| 12 | hello | ||
| 13 | end | ||
| 14 | end | ||
| 15 | |||
| 16 | # Local Variables: | ||
| 17 | # ruby-method-params-indent: 0 | ||
| 18 | # End: | ||
diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb index 2451edaee22..6a69d9db78a 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb | |||
| @@ -538,3 +538,7 @@ class Bar | |||
| 538 | baz | 538 | baz |
| 539 | end | 539 | end |
| 540 | end | 540 | end |
| 541 | |||
| 542 | # Local Variables: | ||
| 543 | # ruby-method-params-indent: t | ||
| 544 | # End: | ||
diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 9be01dc78f9..560f780285a 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el | |||
| @@ -943,16 +943,20 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 943 | "Blub#bye" | 943 | "Blub#bye" |
| 944 | "Blub#hiding"))))) | 944 | "Blub#hiding"))))) |
| 945 | 945 | ||
| 946 | (ert-deftest ruby--indent/converted-from-manual-test () | 946 | (defmacro ruby-deftest-indent (file) |
| 947 | :tags '(:expensive-test) | 947 | `(ert-deftest ,(intern (format "ruby-indent-test/%s" file)) () |
| 948 | ;; Converted from manual test. | 948 | ;; :tags '(:expensive-test) |
| 949 | (let ((buf (find-file-noselect (ert-resource-file "ruby.rb")))) | 949 | (let ((buf (find-file-noselect (ert-resource-file ,file)))) |
| 950 | (unwind-protect | 950 | (unwind-protect |
| 951 | (with-current-buffer buf | 951 | (with-current-buffer buf |
| 952 | (let ((orig (buffer-string))) | 952 | (let ((orig (buffer-string))) |
| 953 | (indent-region (point-min) (point-max)) | 953 | ;; Indent and check that we get the original text. |
| 954 | (should (equal (buffer-string) orig)))) | 954 | (indent-region (point-min) (point-max)) |
| 955 | (kill-buffer buf)))) | 955 | (should (equal (buffer-string) orig)))) |
| 956 | (kill-buffer buf))))) | ||
| 957 | |||
| 958 | (ruby-deftest-indent "ruby.rb") | ||
| 959 | (ruby-deftest-indent "ruby-method-params-indent.rb") | ||
| 956 | 960 | ||
| 957 | (ert-deftest ruby--test-chained-indentation () | 961 | (ert-deftest ruby--test-chained-indentation () |
| 958 | (with-temp-buffer | 962 | (with-temp-buffer |
diff --git a/test/lisp/repeat-tests.el b/test/lisp/repeat-tests.el index 1382d003599..06c6f748a2a 100644 --- a/test/lisp/repeat-tests.el +++ b/test/lisp/repeat-tests.el | |||
| @@ -76,27 +76,27 @@ | |||
| 76 | "C-x w a b a c" | 76 | "C-x w a b a c" |
| 77 | '((1 a) (1 b) (1 a)) "c") | 77 | '((1 a) (1 b) (1 a)) "c") |
| 78 | (repeat-tests--check | 78 | (repeat-tests--check |
| 79 | "M-C-a b a c" | 79 | "C-M-a b a c" |
| 80 | '((1 a) (1 b) (1 a)) "c") | 80 | '((1 a) (1 b) (1 a)) "c") |
| 81 | (repeat-tests--check | 81 | (repeat-tests--check |
| 82 | "M-C-z b a c" | 82 | "C-M-z b a c" |
| 83 | '((1 a)) "bac") | 83 | '((1 a)) "bac") |
| 84 | (unwind-protect | 84 | (unwind-protect |
| 85 | (progn | 85 | (progn |
| 86 | (put 'repeat-tests-call-a 'repeat-check-key 'no) | 86 | (put 'repeat-tests-call-a 'repeat-check-key 'no) |
| 87 | (repeat-tests--check | 87 | (repeat-tests--check |
| 88 | "M-C-z b a c" | 88 | "C-M-z b a c" |
| 89 | '((1 a) (1 b) (1 a)) "c")) | 89 | '((1 a) (1 b) (1 a)) "c")) |
| 90 | (put 'repeat-tests-call-a 'repeat-check-key nil))) | 90 | (put 'repeat-tests-call-a 'repeat-check-key nil))) |
| 91 | (let ((repeat-check-key nil)) | 91 | (let ((repeat-check-key nil)) |
| 92 | (repeat-tests--check | 92 | (repeat-tests--check |
| 93 | "M-C-z b a c" | 93 | "C-M-z b a c" |
| 94 | '((1 a) (1 b) (1 a)) "c") | 94 | '((1 a) (1 b) (1 a)) "c") |
| 95 | (unwind-protect | 95 | (unwind-protect |
| 96 | (progn | 96 | (progn |
| 97 | (put 'repeat-tests-call-a 'repeat-check-key t) | 97 | (put 'repeat-tests-call-a 'repeat-check-key t) |
| 98 | (repeat-tests--check | 98 | (repeat-tests--check |
| 99 | "M-C-z b a c" | 99 | "C-M-z b a c" |
| 100 | '((1 a)) "bac")) | 100 | '((1 a)) "bac")) |
| 101 | (put 'repeat-tests-call-a 'repeat-check-key nil)))))) | 101 | (put 'repeat-tests-call-a 'repeat-check-key nil)))))) |
| 102 | 102 | ||
| @@ -125,15 +125,17 @@ | |||
| 125 | (repeat-tests--check | 125 | (repeat-tests--check |
| 126 | "C-2 C-x w a C-3 c" | 126 | "C-2 C-x w a C-3 c" |
| 127 | '((2 a)) "ccc")) | 127 | '((2 a)) "ccc")) |
| 128 | ;; TODO: fix and uncomment | 128 | ;; Fixed in bug#51281 and bug#55986 |
| 129 | ;; (let ((repeat-keep-prefix t)) | 129 | (let ((repeat-keep-prefix t)) |
| 130 | ;; (repeat-tests--check | 130 | ;; Re-enable to take effect. |
| 131 | ;; "C-2 C-x w a b a b c" | 131 | (repeat-mode -1) (repeat-mode +1) |
| 132 | ;; '((2 a) (2 b) (2 a) (2 b)) "c") | 132 | (repeat-tests--check |
| 133 | ;; (repeat-tests--check | 133 | "C-2 C-x w a b a b c" |
| 134 | ;; "C-2 C-x w a C-1 C-2 b a C-3 C-4 b c" | 134 | '((2 a) (2 b) (2 a) (2 b)) "c") |
| 135 | ;; '((2 a) (12 b) (12 a) (34 b)) "c")) | 135 | ;; (repeat-tests--check |
| 136 | ))) | 136 | ;; "C-2 C-x w a C-1 C-2 b a C-3 C-4 b c" |
| 137 | ;; '((2 a) (12 b) (12 a) (34 b)) "c") | ||
| 138 | )))) | ||
| 137 | 139 | ||
| 138 | ;; TODO: :tags '(:expensive-test) for repeat-exit-timeout | 140 | ;; TODO: :tags '(:expensive-test) for repeat-exit-timeout |
| 139 | 141 | ||
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el index fb53543c9e1..3e94d7e921b 100644 --- a/test/lisp/whitespace-tests.el +++ b/test/lisp/whitespace-tests.el | |||
| @@ -327,6 +327,16 @@ buffer's content." | |||
| 327 | "«:whitespace-empty:\n" | 327 | "«:whitespace-empty:\n" |
| 328 | "»"))))) | 328 | "»"))))) |
| 329 | 329 | ||
| 330 | (ert-deftest whitespace-tests--empty-bob-eob-modified () | ||
| 331 | "Regression test for Bug#60066." | ||
| 332 | (whitespace-tests--with-test-buffer '() | ||
| 333 | (insert "\nx\n\n") | ||
| 334 | (goto-char 2) | ||
| 335 | (set-buffer-modified-p nil) | ||
| 336 | (let ((whitespace-style '(face empty))) | ||
| 337 | (whitespace-mode 1) | ||
| 338 | (should (not (buffer-modified-p)))))) | ||
| 339 | |||
| 330 | (provide 'whitespace-tests) | 340 | (provide 'whitespace-tests) |
| 331 | 341 | ||
| 332 | ;;; whitespace-tests.el ends here | 342 | ;;; whitespace-tests.el ends here |