commit 7822fcbebd1edba3654eaf5c1113f9d4049e0462 (HEAD, refs/remotes/origin/master) Author: Sean Whitton Date: Sat Dec 31 22:55:42 2022 -0700 vc-git-dir-extra-headers: Improve detection of rebases * lisp/vc/vc-git.el (vc-git--cmds-in-progress): New function. (vc-git-dir-extra-headers): Use it. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 92d2eb7f410..918a210cee9 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -776,13 +776,32 @@ vc-git-stash-menu-map :help "Show the contents of the current stash")) map)) +(defun vc-git--cmds-in-progress () + "Return a list of Git commands in progress in this worktree." + (let ((gitdir (vc-git--git-path)) + cmds) + ;; See contrib/completion/git-prompt.sh in git.git. + (when (or (file-directory-p + (expand-file-name "rebase-merge" gitdir)) + (file-exists-p + (expand-file-name "rebase-apply/rebasing" gitdir))) + (push 'rebase cmds)) + (when (file-exists-p + (expand-file-name "rebase-apply/applying" gitdir)) + (push 'am cmds)) + (when (file-exists-p (expand-file-name "MERGE_HEAD" gitdir)) + (push 'merge cmds)) + (when (file-exists-p (expand-file-name "BISECT_START" gitdir)) + (push 'bisect cmds)) + cmds)) + (defun vc-git-dir-extra-headers (dir) (let ((str (with-output-to-string (with-current-buffer standard-output (vc-git--out-ok "symbolic-ref" "HEAD")))) (stash-list (vc-git-stash-list)) (default-directory dir) - (gitdir (vc-git--git-path)) + (in-progress (vc-git--cmds-in-progress)) branch remote remote-url stash-button stash-string) (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) @@ -857,9 +876,9 @@ vc-git-dir-extra-headers (propertize remote-url 'face 'vc-dir-header-value))) ;; For now just a heading, key bindings can be added later for various bisect actions - (when (file-exists-p (expand-file-name "BISECT_START" gitdir)) + (when (memq 'bisect in-progress) (propertize "\nBisect : in progress" 'face 'vc-dir-status-warning)) - (when (file-exists-p (expand-file-name "rebase-apply" gitdir)) + (when (memq 'rebase in-progress) (propertize "\nRebase : in progress" 'face 'vc-dir-status-warning)) (if stash-list (concat commit e4669e0f77bd982bd9254eaf6f4660181dc0b490 Author: Sean Whitton Date: Sat Dec 31 22:45:10 2022 -0700 vc-git: Don't assume .git is a directory * lisp/vc/vc-git.el (vc-git--git-path): New function. (vc-git-dir-extra-headers) (vc-git-merge-branch) (vc-git-resolve-when-done): Use it. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 671be66bbef..92d2eb7f410 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -315,6 +315,23 @@ vc-git--program-version (string-trim-right (match-string 1 version-string) "\\.") "0"))))) +(defun vc-git--git-path (&optional path) + "Resolve .git/PATH for the current working tree. +In particular, handle the case where this is a linked working +tree, such that .git is a plain file. + +See the --git-dir and --git-path options to git-rev-parse(1)." + (if (and path (not (string-empty-p path))) + ;; Canonicalize in this branch because --git-dir always returns + ;; an absolute file name. + (expand-file-name + (string-trim-right + (vc-git--run-command-string nil "rev-parse" + "--git-path" path))) + (concat (string-trim-right + (vc-git--run-command-string nil "rev-parse" "--git-dir")) + "/"))) + (defun vc-git--git-status-to-vc-state (code-list) "Convert CODE-LIST to a VC status. @@ -765,6 +782,7 @@ vc-git-dir-extra-headers (vc-git--out-ok "symbolic-ref" "HEAD")))) (stash-list (vc-git-stash-list)) (default-directory dir) + (gitdir (vc-git--git-path)) branch remote remote-url stash-button stash-string) (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str) @@ -839,9 +857,9 @@ vc-git-dir-extra-headers (propertize remote-url 'face 'vc-dir-header-value))) ;; For now just a heading, key bindings can be added later for various bisect actions - (when (file-exists-p (expand-file-name ".git/BISECT_START" (vc-git-root dir))) + (when (file-exists-p (expand-file-name "BISECT_START" gitdir)) (propertize "\nBisect : in progress" 'face 'vc-dir-status-warning)) - (when (file-exists-p (expand-file-name ".git/rebase-apply" (vc-git-root dir))) + (when (file-exists-p (expand-file-name "rebase-apply" gitdir)) (propertize "\nRebase : in progress" 'face 'vc-dir-status-warning)) (if stash-list (concat @@ -1286,8 +1304,7 @@ vc-git-merge-branch (completing-read "Merge from branch: " (if (or (member "FETCH_HEAD" branches) (not (file-readable-p - (expand-file-name ".git/FETCH_HEAD" - root)))) + (vc-git--git-path "FETCH_HEAD")))) branches (cons "FETCH_HEAD" branches)) nil t))) @@ -1332,8 +1349,7 @@ vc-git-resolve-when-done (unless (or (not (eq vc-git-resolve-conflicts 'unstage-maybe)) ;; Doing a merge, so bug#20292 doesn't apply. - (file-exists-p (expand-file-name ".git/MERGE_HEAD" - (vc-git-root buffer-file-name))) + (file-exists-p (vc-git--git-path "MERGE_HEAD")) (vc-git-conflicted-files (vc-git-root buffer-file-name))) (vc-git-command nil 0 nil "reset")) (vc-resynch-buffer buffer-file-name t t) commit 652d805156e2e459f4ea92ba283c73b02afb1482 Author: Stefan Kangas Date: Sun Jan 1 06:01:59 2023 +0100 Update publicsuffix.txt from upstream * etc/publicsuffix.txt: Update from https://publicsuffix.org/list/public_suffix_list.dat dated 2022-12-19 14:09:50 UTC. diff --git a/etc/publicsuffix.txt b/etc/publicsuffix.txt index 60d72fd0d53..54988c7187c 100644 --- a/etc/publicsuffix.txt +++ b/etc/publicsuffix.txt @@ -7171,7 +7171,7 @@ org.zw // newGTLDs -// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2022-11-29T15:14:18Z +// List of new gTLDs imported from https://www.icann.org/resources/registries/gtlds/v2/gtlds.json on 2022-12-07T15:13:11Z // This list is auto-generated, don't edit it manually. // aaa : 2015-02-26 American Automobile Association, Inc. aaa @@ -10461,9 +10461,6 @@ xin // xn--jlq480n2rg : 2019-12-19 Amazon Registry Services, Inc. 亚马逊 -// xn--jlq61u9w7b : 2015-01-08 Nokia Corporation -诺基亚 - // xn--jvr189m : 2015-02-26 Amazon Registry Services, Inc. 食品 commit b898875100773cb4c85472ad8feb64961f140d43 Author: Stefan Kangas Date: Sun Jan 1 05:08:28 2023 +0100 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 2639c5cceb4..c21955c3f06 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -4631,7 +4631,7 @@ "cmacexp" ;;; Generated autoloads from progmodes/cmake-ts-mode.el -(add-to-list 'auto-mode-alist '("\\(?:CMakeLists\\.txt\\|\\.cmake\\)$" . cmake-ts-mode)) +(add-to-list 'auto-mode-alist '("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode)) (autoload 'cmake-ts-mode "cmake-ts-mode" "\ Major mode for editing CMake files, powered by tree-sitter. @@ -8673,9 +8673,9 @@ "semantic/ede-grammar" (defvar edebug-all-defs nil "\ If non-nil, evaluating defining forms instruments for Edebug. -This applies to `eval-defun', `eval-region', `eval-buffer', and -`eval-current-buffer'. `eval-region' is also called by -`eval-last-sexp', and `eval-print-last-sexp'. +This applies to `eval-defun', `eval-region' and `eval-buffer'. +`eval-region' is also called by `eval-last-sexp', and +`eval-print-last-sexp'. You can use the command `edebug-all-defs' to toggle the value of this variable. You may wish to make it local to each buffer with @@ -9136,7 +9136,7 @@ "edt-vt100" ;;; Generated autoloads from progmodes/eglot.el -(push (purecopy '(eglot 1 9)) package--builtin-versions) +(push (purecopy '(eglot 1 10)) package--builtin-versions) (autoload 'eglot "eglot" "\ Start LSP server in support of PROJECT's buffers under MANAGED-MAJOR-MODE. @@ -9394,10 +9394,11 @@ "elec-pair" (autoload 'elide-head "elide-head" "\ Hide header material in buffer according to `elide-head-headers-to-hide'. -The header is made invisible with an overlay. With a prefix arg, show -an elided material again. +The header is made invisible with an overlay. With a prefix +argument ARG, show an elided material again. -This is suitable as an entry on `find-file-hook' or appropriate mode hooks. +This is suitable as an entry on `find-file-hook' or appropriate +mode hooks. (fn &optional ARG)" t) (make-obsolete 'elide-head 'elide-head-mode "29.1") @@ -10118,9 +10119,7 @@ "epg-config" whereas `erc-compute-port' and `erc-compute-nick' will be invoked for the values of the other parameters. -When present, ID should be an opaque object used to identify the -connection unequivocally. This is rarely needed and not available -interactively. +See `erc-tls' for the meaning of ID. (fn &key (SERVER (erc-compute-server)) (PORT (erc-compute-port)) (NICK (erc-compute-nick)) (USER (erc-compute-user)) PASSWORD (FULL-NAME (erc-compute-full-name)) ID)" t) (defalias 'erc-select #'erc) @@ -10135,6 +10134,7 @@ 'erc-select (server (erc-compute-server)) (port (erc-compute-port)) (nick (erc-compute-nick)) + (user (erc-compute-user)) password (full-name (erc-compute-full-name)) client-certificate @@ -10163,11 +10163,11 @@ 'erc-select \\='(\"/home/bandali/my-cert.key\" \"/home/bandali/my-cert.crt\")) -When present, ID should be an opaque object for identifying the -connection unequivocally. (In most cases, this would be a string or a -symbol composed of letters from the Latin alphabet.) This option is -generally unneeded, however. See info node `(erc) Connecting' for use -cases. Not available interactively. +When present, ID should be a symbol or a string to use for naming +the server buffer and identifying the connection unequivocally. +See info node `(erc) Network Identifier' for details. Like USER +and CLIENT-CERTIFICATE, this parameter cannot be specified +interactively. (fn &key (SERVER (erc-compute-server)) (PORT (erc-compute-port \\='ircs-u)) (NICK (erc-compute-nick)) (USER (erc-compute-user)) PASSWORD (FULL-NAME (erc-compute-full-name)) CLIENT-CERTIFICATE ID)" t) (autoload 'erc-handle-irc-url "erc" "\ @@ -14342,6 +14342,21 @@ "gnus-win" (register-definition-prefixes "gnutls" '("gnutls-" "open-gnutls-stream")) + +;;; Generated autoloads from progmodes/go-ts-mode.el + +(add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode)) +(autoload 'go-ts-mode "go-ts-mode" "\ +Major mode for editing Go, powered by tree-sitter. + +(fn)" t) +(add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode)) +(autoload 'go-mod-ts-mode "go-ts-mode" "\ +Major mode for editing go.mod files, powered by tree-sitter. + +(fn)" t) +(register-definition-prefixes "go-ts-mode" '("go-")) + ;;; Generated autoloads from play/gomoku.el @@ -18624,7 +18639,7 @@ "json-ts-mode" ;;; Generated autoloads from jsonrpc.el -(push (purecopy '(jsonrpc 1 0 15)) package--builtin-versions) +(push (purecopy '(jsonrpc 1 0 16)) package--builtin-versions) (register-definition-prefixes "jsonrpc" '("jsonrpc-")) @@ -23399,6 +23414,11 @@ 'package-list-packages (defcustom package-quickstart-file (locate-user-emacs-file "package-quickstart.el") "\ Location of the file used to speed up activation of packages at startup." :type 'file :group 'applications :initialize #'custom-initialize-delay :version "27.1") (custom-autoload 'package-quickstart-file "package" t) +(autoload 'package-report-bug "package" "\ +Prepare a message to send to the maintainers of a package. +DESC must be a `package-desc' object. + +(fn DESC)" '(package-menu-mode)) (register-definition-prefixes "package" '("bad-signature" "define-package" "describe-package-1" "package-")) @@ -23480,7 +23500,7 @@ package-vc-selected-packages Note that by default, a VC package will be prioritized over a regular package, but it will not remove a VC package. -(fn PACKAGE &optional NAME REV BACKEND)" t) +(fn PACKAGE &optional REV BACKEND)" t) (autoload 'package-vc-checkout "package-vc" "\ Clone the sources for PKG-DESC into DIRECTORY and visit that directory. Unlike `package-vc-install', this does not yet set up the package @@ -27334,6 +27354,16 @@ ruler-mode (fn &optional ARG)" t) (register-definition-prefixes "ruler-mode" '("ruler-")) + +;;; Generated autoloads from progmodes/rust-ts-mode.el + +(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-ts-mode)) +(autoload 'rust-ts-mode "rust-ts-mode" "\ +Major mode for editing Rust, powered by tree-sitter. + +(fn)" t) +(register-definition-prefixes "rust-ts-mode" '("rust-ts-mode-")) + ;;; Generated autoloads from emacs-lisp/rx.el @@ -29548,7 +29578,8 @@ "spook" Run PRODUCT interpreter as an inferior process. If buffer `*SQL*' exists but no process is running, make a new process. -If buffer exists and a process is running, just switch to buffer `*SQL*'. +If buffer exists and a process is running, just make sure buffer `*SQL*' +is displayed. To specify the SQL product, prefix the call with \\[universal-argument]. To set the buffer name as well, prefix @@ -30191,7 +30222,10 @@ string-blank-p (fn STRING)") (autoload 'string-glyph-split "subr-x" "\ Split STRING into a list of strings representing separate glyphs. -This takes into account combining characters and grapheme clusters. +This takes into account combining characters and grapheme clusters: +if compositions are enbaled, each sequence of characters composed +on display into a single grapheme cluster is treated as a single +indivisible unit. (fn STRING)") (autoload 'add-display-text-property "subr-x" "\ @@ -32372,6 +32406,16 @@ "tmm" (fn)" t) (register-definition-prefixes "todo-mode" '("todo-")) + +;;; Generated autoloads from textmodes/toml-ts-mode.el + +(add-to-list 'auto-mode-alist '("\\.toml\\'" . toml-ts-mode)) +(autoload 'toml-ts-mode "toml-ts-mode" "\ +Major mode for editing TOML, powered by tree-sitter. + +(fn)" t) +(register-definition-prefixes "toml-ts-mode" '("toml-ts-mode-")) + ;;; Generated autoloads from tool-bar.el @@ -34386,7 +34430,7 @@ 'vc-update When invoked with a numerical prefix argument, use the last N revisions. When invoked interactively in a Log View buffer with -marked revisions, use those these. +marked revisions, use those. (fn ADDRESSEE SUBJECT REVISIONS)" t) (register-definition-prefixes "vc" '("vc-" "with-vc-properties")) @@ -34655,7 +34699,7 @@ "vera-mode" ;;; Generated autoloads from progmodes/verilog-mode.el -(push (purecopy '(verilog-mode 2021 10 14 127365406)) package--builtin-versions) +(push (purecopy '(verilog-mode 2022 12 18 181110314)) package--builtin-versions) (autoload 'verilog-mode "verilog-mode" "\ Major mode for editing Verilog code. \\ @@ -34689,6 +34733,11 @@ "vera-mode" function keyword. `verilog-indent-level-directive' (default 1) Indentation of \\=`ifdef/\\=`endif blocks. + `verilog-indent-ignore-multiline-defines' (default t) + Non-nil means ignore indentation on lines that are part of a multiline + define. + `verilog-indent-ignore-regexp' (default nil + Regexp that matches lines that should be ignored for indentation. `verilog-cexp-indent' (default 1) Indentation of Verilog statements broken across lines i.e.: if (a) @@ -34712,6 +34761,9 @@ "vera-mode" otherwise you get: if (a) begin + `verilog-indent-class-inside-pkg' (default t) + Non-nil means indent classes inside packages. + Otherwise, classes have zero indentation. `verilog-auto-endcomments' (default t) Non-nil means a comment /* ... */ is set after the ends which ends cases, tasks, functions and modules. @@ -34721,6 +34773,17 @@ "vera-mode" will be inserted. Setting this variable to zero results in every end acquiring a comment; the default avoids too many redundant comments in tight quarters. + `verilog-align-decl-expr-comments' (default t) + Non-nil means align declaration and expressions comments. + `verilog-align-comment-distance' (default 1) + Distance (in spaces) between longest declaration and comments. + Only works if `verilog-align-decl-expr-comments' is non-nil. + `verilog-align-assign-expr' (default nil) + Non-nil means align expressions of continuous assignments. + `verilog-align-typedef-regexp' (default nil) + Regexp that matches user typedefs for declaration alignment. + `verilog-align-typedef-words' (default nil) + List of words that match user typedefs for declaration alignment. `verilog-auto-lineup' (default `declarations') List of contexts where auto lineup of code should be done. @@ -34744,17 +34807,20 @@ "vera-mode" \\[verilog-mark-defun] Mark function. \\[verilog-beg-of-defun] Move to beginning of current function. \\[verilog-end-of-defun] Move to end of current function. - \\[verilog-label-be] Label matching begin ... end, fork ... join, etc statements. + \\[verilog-label-be] Label matching begin ... end, fork ... join, etc + statements. \\[verilog-comment-region] Put marked area in a comment. - \\[verilog-uncomment-region] Uncomment an area commented with \\[verilog-comment-region]. + \\[verilog-uncomment-region] Uncomment an area commented with + \\[verilog-comment-region]. \\[verilog-insert-block] Insert begin ... end. \\[verilog-star-comment] Insert /* ... */. \\[verilog-sk-always] Insert an always @(AS) begin .. end block. \\[verilog-sk-begin] Insert a begin .. end block. \\[verilog-sk-case] Insert a case block, prompting for details. - \\[verilog-sk-for] Insert a for (...) begin .. end block, prompting for details. + \\[verilog-sk-for] Insert a for (...) begin .. end block, prompting for + details. \\[verilog-sk-generate] Insert a generate .. endgenerate block. \\[verilog-sk-header] Insert a header block at the top of file. \\[verilog-sk-initial] Insert an initial begin .. end block. @@ -34777,14 +34843,17 @@ "vera-mode" \\[verilog-sk-else-if] Insert an else if (..) begin .. end block. \\[verilog-sk-comment] Insert a comment block. \\[verilog-sk-assign] Insert an assign .. = ..; statement. - \\[verilog-sk-function] Insert a function .. begin .. end endfunction block. + \\[verilog-sk-function] Insert a function .. begin .. end endfunction + block. \\[verilog-sk-input] Insert an input declaration, prompting for details. \\[verilog-sk-output] Insert an output declaration, prompting for details. - \\[verilog-sk-state-machine] Insert a state machine definition, prompting for details. + \\[verilog-sk-state-machine] Insert a state machine definition, prompting + for details. \\[verilog-sk-inout] Insert an inout declaration, prompting for details. \\[verilog-sk-wire] Insert a wire declaration, prompting for details. \\[verilog-sk-reg] Insert a register declaration, prompting for details. - \\[verilog-sk-define-signal] Define signal under point as a register at the top of the module. + \\[verilog-sk-define-signal] Define signal under point as a register at + the top of the module. All key bindings can be seen in a Verilog-buffer with \\[describe-bindings]. Key bindings specific to `verilog-mode-map' are: @@ -35903,6 +35972,7 @@ "which-func" it is disabled. (fn &optional ARG)" t) +(put 'global-whitespace-mode 'globalized-minor-mode t) (defvar global-whitespace-mode nil "\ Non-nil if Global Whitespace mode is enabled. See the `global-whitespace-mode' command @@ -35912,25 +35982,18 @@ global-whitespace-mode or call the function `global-whitespace-mode'.") (custom-autoload 'global-whitespace-mode "whitespace" nil) (autoload 'global-whitespace-mode "whitespace" "\ -Toggle whitespace visualization globally (Global Whitespace mode). - -See also `whitespace-style', `whitespace-newline' and -`whitespace-display-mappings'. - -This is a global minor mode. If called interactively, toggle the -`Global Whitespace mode' mode. If the prefix argument is -positive, enable the mode, and if it is zero or negative, disable -the mode. +Toggle Whitespace mode in all buffers. +With prefix ARG, enable Global Whitespace mode if ARG is positive; +otherwise, disable it. -If called from Lisp, toggle the mode if ARG is `toggle'. Enable -the mode if ARG is nil, omitted, or is a positive number. +If called from Lisp, toggle the mode if ARG is `toggle'. +Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. -To check whether the minor mode is enabled in the current buffer, -evaluate `(default-value \\='global-whitespace-mode)'. +Whitespace mode is enabled in all buffers where +`whitespace-turn-on-if-enabled' would do it. -The mode's hook is called both when the mode is enabled and when -it is disabled. +See `whitespace-mode' for more information on Whitespace mode. (fn &optional ARG)" t) (defvar global-whitespace-newline-mode nil "\ @@ -36893,6 +36956,16 @@ "xt-mouse" (fn BOOKMARK)") (register-definition-prefixes "xwidget" '("xwidget-")) + +;;; Generated autoloads from textmodes/yaml-ts-mode.el + +(add-to-list 'auto-mode-alist '("\\.ya?ml\\'" . yaml-ts-mode)) +(autoload 'yaml-ts-mode "yaml-ts-mode" "\ +Major mode for editing YAML, powered by tree-sitter. + +(fn)" t) +(register-definition-prefixes "yaml-ts-mode" '("yaml-ts-mode--")) + ;;; Generated autoloads from yank-media.el commit f59d012af7e607448fdb435fcb4becb6a6ebe665 Author: Richard Hansen Date: Sat Dec 10 00:57:15 2022 -0500 whitespace: Use `define-globalized-minor-mode' for global mode * lisp/whitespace.el (global-whitespace-mode): Fix interoperability between `whitespace-mode' and `global-whitespace-mode' by using `define-globalized-minor-mode'. (Bug#60334) * test/lisp/whitespace-tests.el (whitespace-tests--global): Add a regression test. diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 558be1841ab..7a30274a330 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1014,34 +1014,11 @@ whitespace-newline-mode ;;;###autoload -(define-minor-mode global-whitespace-mode - "Toggle whitespace visualization globally (Global Whitespace mode). - -See also `whitespace-style', `whitespace-newline' and -`whitespace-display-mappings'." - :lighter " WS" +(define-globalized-minor-mode global-whitespace-mode + whitespace-mode + whitespace-turn-on-if-enabled :init-value nil - :global t - :group 'whitespace - (cond - (noninteractive ; running a batch job - (setq global-whitespace-mode nil)) - (global-whitespace-mode ; global-whitespace-mode on - (save-current-buffer - (add-hook 'find-file-hook 'whitespace-turn-on-if-enabled) - (add-hook 'after-change-major-mode-hook 'whitespace-turn-on-if-enabled) - (dolist (buffer (buffer-list)) ; adjust all local mode - (set-buffer buffer) - (unless whitespace-mode - (whitespace-turn-on-if-enabled))))) - (t ; global-whitespace-mode off - (save-current-buffer - (remove-hook 'find-file-hook 'whitespace-turn-on-if-enabled) - (remove-hook 'after-change-major-mode-hook 'whitespace-turn-on-if-enabled) - (dolist (buffer (buffer-list)) ; adjust all local mode - (set-buffer buffer) - (unless whitespace-mode - (whitespace-turn-off))))))) + :group 'whitespace) (defvar whitespace-enable-predicate (lambda () @@ -1067,7 +1044,7 @@ whitespace-enable-predicate (defun whitespace-turn-on-if-enabled () (when (funcall whitespace-enable-predicate) - (whitespace-turn-on))) + (whitespace-mode))) ;;;###autoload (define-minor-mode global-whitespace-newline-mode @@ -2511,7 +2488,7 @@ whitespace-display-char-on (setq whitespace-display-table-was-local t) ;; Save the old table so we can restore it when ;; `whitespace-mode' is switched off again. - (when (or whitespace-mode global-whitespace-mode) + (when whitespace-mode (setq whitespace-display-table (copy-sequence buffer-display-table))) ;; Assure `buffer-display-table' is unique diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el index d72748cd0c9..3a53e025036 100644 --- a/test/lisp/whitespace-tests.el +++ b/test/lisp/whitespace-tests.el @@ -57,6 +57,24 @@ whitespace-tests--cleanup-string (whitespace-cleanup) (buffer-string))) +(ert-deftest whitespace-tests--global () + (let ((backup global-whitespace-mode) + (noninteractive nil) + (whitespace-enable-predicate (lambda () t))) + (unwind-protect + (progn + (global-whitespace-mode 1) + (ert-with-test-buffer-selected () + (normal-mode) + (should whitespace-mode) + (global-whitespace-mode -1) + (should (null whitespace-mode)) + (whitespace-mode 1) + (should whitespace-mode) + (global-whitespace-mode 1) + (should whitespace-mode))) + (global-whitespace-mode (if backup 1 -1))))) + (ert-deftest whitespace-cleanup-eob () (let ((whitespace-style '(empty))) (should (equal (whitespace-tests--cleanup-string "a\n")