From: Eli Zaretskii Date: Sat, 9 Dec 2023 12:25:21 +0000 (-0500) Subject: Merge from origin/emacs-29 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=486094126ba77e45c50acb87f5ad3e4147608446;p=emacs.git Merge from origin/emacs-29 0f361cc985d ; Minor copyedits in description of ':box' face property 46fe7a17f53 Fix dragging mode line on text terminals with a mouse (bu... 12daf386f37 ; * doc/lispref/processes.texi (Network): Fix wording and... 037d858dc1a (rust-ts-mode): Set electric-indent-chars dc9b733ab88 js-ts-mode: Highlight function parameters inside destruct... 4a72f13bdfb js-ts-mode: Highlight property shorthands in assignments 83ed9018ede (js--treesit-font-lock-settings): Highlight parameters in... ad0f87bb4c3 (js--treesit-font-lock-settings): Remove some duplicates 71c5f3694fd ; Another fix of doc string of 'message-mail-user-agent' ... 04a39353bae ; * lisp/gnus/message.el (message-mail-user-agent): Doc f... 82ddcf37ec6 ; * doc/lispref/files.texi (Changing Files): Fix last cha... 89068516b3e Don't claim to signal an error when deleting a nonexistin... 4fd254e1830 * lisp/indent.el (indent-rigidly): Improve prompt (bug#67... 5f923ff1a6a ; Fix typos a1f88963f5d rust-ts-mode--comment-docstring: Handle block doc comments a547b0e2e83 rust-ts-mode--comment-docstring: Fix/improve the previous... --- 486094126ba77e45c50acb87f5ad3e4147608446 diff --cc doc/misc/modus-themes.org index 5a53426dfee,db7655e692c..554c76b0107 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@@ -3554,7 -3972,102 +3554,101 @@@ With those in place, PDFs have a distin buffers with major-mode as ~pdf-view-mode~ automatically switches to dark mode when ~modus-themes-toggle~ is called. - ** Toggle themes without reloading them + ** Decrease mode line height + :properties: + :custom_id: h:03be4438-dae1-4961-9596-60a307c070b5 + :end: + #+cindex: Decrease mode line height + + By default, the mode line of the Modus themes is set to 1 pixel width + for its =:box= attribute. In contrast, the mode line of stock Emacs is -1 + pixel. This small difference is considered necessary for the purposes + of accessibility as our out-of-the-box design has a prominent color + around the mode line (a border) to make its boundaries clear. With a + negative width the border and the text on the mode line can feel a bit + more difficult to read under certain scenaria. + + Furthermore, the user option ~modus-themes-mode-line~ ([[#h:27943af6-d950-42d0-bc23-106e43f50a24][Mode line]]) does not + allow for such a negative value because there are many edge cases that + simply make for a counter-intuitive set of possibilities, such as a =0= + value not being acceptable by the underlying face infrastructure, and + negative values greater than =-2= not being particularly usable. + + For these reasons, users who wish to decrease the overall height of the + mode line must handle things on their own by implementing the methods + for face customization documented herein. + + [[#h:1487c631-f4fe-490d-8d58-d72ffa3bd474][Basic face customization]]. + + One such method is to create a function that configures the desired + faces and hook it to ~modus-themes-after-load-theme-hook~ so that it + persists while switching between the Modus themes with the command + ~modus-themes-toggle~. + + This one simply disables the box altogether, which will reduce the + height of the mode lines, but also remove their border: + + #+begin_src emacs-lisp + (defun my-modus-themes-custom-faces () + (set-face-attribute 'mode-line nil :box nil) + (set-face-attribute 'mode-line-inactive nil :box nil)) + + (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces) + #+end_src + + The above relies on the ~set-face-attribute~ function, though users who + plan to reuse colors from the theme and do so at scale are better off + with the more streamlined combination of the ~modus-themes-with-colors~ + macro and ~custom-set-faces~. + + [[#h:51ba3547-b8c8-40d6-ba5a-4586477fd4ae][Face customization at scale]]. + + As explained before in this document, this approach has a syntax that is + consistent with the source code of the themes, so it probably is easier + to reuse parts of the design. + + The following emulates the stock Emacs style, while still using the + colors of the Modus themes (whichever attribute is not explicitly stated + is inherited from the underlying theme): + + #+begin_src emacs-lisp + (defun my-modus-themes-custom-faces () + (modus-themes-with-colors + (custom-set-faces + `(mode-line ((,class :box (:line-width -1 :style released-button)))) + `(mode-line-inactive ((,class :box (:line-width -1 :color ,bg-region))))))) + + (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces) + #+end_src + + And this one is like the out-of-the-box style of the Modus themes, but + with the -1 height instead of 1: + + #+begin_src emacs-lisp + (defun my-modus-themes-custom-faces () + (modus-themes-with-colors + (custom-set-faces + `(mode-line ((,class :box (:line-width -1 :color ,fg-alt)))) + `(mode-line-inactive ((,class :box (:line-width -1 :color ,bg-region))))))) + + (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces) + #+end_src + + Finally, to also change the background color of the active mode line, + such as that it looks like the "accented" variant which is possible via + the user option ~modus-themes-mode-line~, the =:background= attribute needs + to be specified as well: + + #+begin_src emacs-lisp + (defun my-modus-themes-custom-faces () + (modus-themes-with-colors + (custom-set-faces + `(mode-line ((,class :box (:line-width -1 :color ,fg-alt) :background ,bg-active-accent))) + `(mode-line-inactive ((,class :box (:line-width -1 :color ,bg-region))))))) + + (add-hook 'modus-themes-after-load-theme-hook #'my-modus-themes-custom-faces) + #+end_src + -** Toggle themes without reloading them :properties: :custom_id: h:b40aca50-a3b2-4c43-be58-2c26fcd14237 :end: diff --cc lisp/loadup.el index 03ed2186392,8f884108d9a..1f959464b23 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@@ -506,23 -476,23 +506,23 @@@ lost after dumping")) ;; At this point, we're ready to resume undo recording for scratch. (buffer-enable-undo "*scratch*") -(defvar comp-subr-arities-h) -(when (featurep 'native-compile) - ;; Save the arity for all primitives so the compiler can always - ;; retrieve it even in case of redefinition. - (mapatoms (lambda (f) - (when (subr-primitive-p (symbol-function f)) - (puthash f (func-arity f) comp-subr-arities-h)))) - ;; Fix the compilation unit filename to have it working when - ;; installed or if the source directory got moved. This is set to be - ;; a pair in the form of: - ;; (rel-filename-from-install-bin . rel-filename-from-local-bin). - (let ((bin-dest-dir (cadr (member "--bin-dest" command-line-args))) - (eln-dest-dir (cadr (member "--eln-dest" command-line-args)))) - (when (and bin-dest-dir eln-dest-dir) +(defvar load--bin-dest-dir nil + "Store the original value passed by \"--bin-dest\" during dump. +Internal use only.") +(defvar load--eln-dest-dir nil + "Store the original value passed by \"--eln-dest\" during dump. +Internal use only.") + +(defun load--fixup-all-elns () + "Fix all compilation unit filename. +This to have it working when installed or if Emacs source +directory got moved. This is set to be a pair in the form of: +\(rel-filename-from-install-bin . rel-filename-from-local-bin)." + (when (and load--bin-dest-dir load--eln-dest-dir) - (setq eln-dest-dir + (setq eln-dest-dir - (concat eln-dest-dir "native-lisp/" comp-native-version-dir "/")) + (concat load--eln-dest-dir "native-lisp/" comp-native-version-dir "/")) - (maphash (lambda (_ cu) + (maphash (lambda (_ cu) + (when (stringp (native-comp-unit-file cu)) (let* ((file (native-comp-unit-file cu)) (preloaded (equal (substring (file-name-directory file) -10 -1) @@@ -539,20 -509,10 +539,20 @@@ (file-name-nondirectory file) eln-dest-dir-eff) - bin-dest-dir) + load--bin-dest-dir) ;; Relative filename from the built uninstalled binary. - (file-relative-name file invocation-directory))))) - comp-loaded-comp-units-h))) + (file-relative-name file invocation-directory)))))) + comp-loaded-comp-units-h))) + +(defvar comp-subr-arities-h) +(when (featurep 'native-compile) + ;; Save the arity for all primitives so the compiler can always - ;; retrive it even in case of redefinition. ++ ;; retrieve it even in case of redefinition. + (mapatoms (lambda (f) + (when (subr-primitive-p (symbol-function f)) + (puthash f (func-arity f) comp-subr-arities-h)))) + (setq load--bin-dest-dir (cadr (member "--bin-dest" command-line-args))) + (setq load--eln-dest-dir (cadr (member "--eln-dest" command-line-args))) ;; Set up the mechanism to allow inhibiting native-comp via ;; file-local variables. (defvar comp--no-native-compile (make-hash-table :test #'equal))) diff --cc lisp/net/sieve-manage.el index 81f50e74987,733b235bedf..cfc748c9387 --- a/lisp/net/sieve-manage.el +++ b/lisp/net/sieve-manage.el @@@ -168,19 -168,25 +168,19 @@@ Valid states are `closed', `initial', ` ;; Internal utility functions (defun sieve-manage--append-to-log (&rest args) - "Append ARGS to `sieve-manage-log' buffer. + "Append ARGS to sieve-manage log buffer. ARGS can be a string or a list of strings. - The buffer to use for logging is specifified via - `sieve-manage-log'. If it is nil, logging is disabled." + The buffer to use for logging is specified via `sieve-manage-log'. -If it is nil, logging is disabled. - -When the `sieve-manage-log' buffer doesn't exist, it gets created (and -configured with some initial settings)." ++If it is nil, logging is disabled." (when sieve-manage-log - (let* ((existing-log-buffer (get-buffer sieve-manage-log)) - (log-buffer (or existing-log-buffer - (get-buffer-create sieve-manage-log)))) - (with-current-buffer log-buffer - (unless existing-log-buffer - ;; Do this only once, when creating the log buffer. - (set-buffer-multibyte nil) - (buffer-disable-undo)) - (goto-char (point-max)) - (apply #'insert args))))) + (with-current-buffer (or (get-buffer sieve-manage-log) + (with-current-buffer + (get-buffer-create sieve-manage-log) + (set-buffer-multibyte nil) + (buffer-disable-undo))) + (goto-char (point-max)) + (apply #'insert args)))) (defun sieve-manage--message (format-string &rest args) "Wrapper around `message' which also logs to sieve manage log. diff --cc lisp/progmodes/cperl-mode.el index ab624a08646,f67518185bd..02185972bfe --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@@ -1452,18 -1327,9 +1452,18 @@@ Covers packages and classes, subroutine ) +(defun cperl-declaration-header-p (pos) + "Return t if POS is in the header of a declaration. +Perl syntax can have various constructs between a +keyword (e.g. \"sub\") and its associated block of code, and +these can span several lines. These blocks are identified and +marked with a text-property in `cperl-find-pods-heres'. This +function tests that property." + (equal (get-text-property pos 'syntax-type) 'sub-decl)) + (defun cperl-block-declaration-p () "Test whether the following ?\\{ opens a declaration block. - Returns the column where the declarating keyword is found, or nil + Returns the column where the declaring keyword is found, or nil if this isn't a declaration block. Declaration blocks are named subroutines, packages and the like. They start with a keyword and a name, to be followed by various descriptive items which are diff --cc test/lisp/progmodes/perl-mode-tests.el index a47a6722e20,3b22c5d8750..e72bdf30711 --- a/test/lisp/progmodes/perl-mode-tests.el +++ b/test/lisp/progmodes/perl-mode-tests.el @@@ -28,24 -28,7 +28,24 @@@ (font-lock-ensure (point-min) (point-max)) (should (equal (get-text-property 4 'face) 'font-lock-variable-name-face)))) +(ert-deftest perl-test-bug-34245 () + "Test correct indentation after a hanging paren, with and without comments." + (with-temp-buffer + (perl-mode) + (insert "my @foo = (\n\"bar\",\n\"baz\",\n);") + (insert "\n\n") + (insert "my @ofoo = (\t\t# A comment.\n\"obar\",\n\"obaz\",\n);") + (indent-region (point-min) (point-max)) + (goto-char (point-min)) + (forward-line) + (skip-chars-forward " \t") + (should (equal (current-column) perl-indent-level)) + (search-forward "# A comment.") + (forward-line) + (skip-chars-forward " \t") + (should (equal (current-column) perl-indent-level)))) + - ;;;; Re-use cperl-mode tests + ;;;; Reuse cperl-mode tests (defvar cperl-test-mode) (setq cperl-test-mode #'perl-mode)