diff --git a/admin/merge-gnulib b/admin/merge-gnulib index ae852401eaf..7474a0a4a57 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -48,10 +48,10 @@ GNULIB_MODULES=' qcopy-acl readlink readlinkat realloc-posix regex sig2str sigdescr_np socklen stat-time std-gnu11 stdc_bit_width stdc_count_ones stdc_trailing_zeros - stdckdint-h stddef-h stdio-h - stpcpy strnlen strnlen strtoimax symlink sys_stat-h sys_time-h + stdckdint-h stddef-h stdio-h stdio-windows + stpcpy stringeq strnlen strtoimax symlink sys_stat-h sys_time-h tempname time-h time_r time_rz timegm timer-time timespec-add timespec-sub - update-copyright unlocked-io utimensat + unlocked-io update-copyright utimensat vla warnings year2038 ' diff --git a/admin/tree-sitter/treesit-admin.el b/admin/tree-sitter/treesit-admin.el index 1f1fa1ce752..a76e105e908 100644 --- a/admin/tree-sitter/treesit-admin.el +++ b/admin/tree-sitter/treesit-admin.el @@ -193,7 +193,7 @@ queries that has problems with latest grammar." (all-queries-valid t)) (dolist (setting settings) (let* ((query (treesit-font-lock-setting-query setting)) - (language (treesit-query-language query)) + (language (treesit-font-lock-setting-language setting)) (feature (treesit-font-lock-setting-feature setting))) ;; Record that MODE uses LANGUAGE. (unless (memq language (alist-get mode mode-language-alist)) @@ -299,7 +299,7 @@ Return non-nil if all queries are valid, nil otherwise." (dolist (setting settings) ;; `treesit-font-lock-setting-query' isn't available in Emacs 30. (let* ((query (car setting)) - (language (treesit-query-language query))) + (language (treesit-font-lock-setting-language setting))) ;; Validate query. (when (and (eq lang language) (not (treesit-query-valid-p language query))) @@ -322,9 +322,7 @@ Return non-nil if all queries are valid, nil otherwise." treesit-font-lock-settings))) (all-queries-valid t)) (cl-remove-duplicates - (mapcar #'treesit-query-language - (mapcar #'treesit-font-lock-setting-query - settings))))) + (mapcar #'treesit-font-lock-setting-language settings)))) (defun treesit-admin--find-latest-compatible-revision (mode language source-alist grammar-dir revision-type diff --git a/configure.ac b/configure.ac index 1c8219b5804..77139284a5b 100644 --- a/configure.ac +++ b/configure.ac @@ -49,11 +49,6 @@ if test "$XCONFIGURE" = "android"; then CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=32" enable_largefile=no enable_year2038=no]) - # Gnulib should not attempt not to reimplement tzalloc, as strftime - # attempts to link with symbols that are only present in the Gnulib - # replacement. - AS_IF([test "$ANDROID_SDK" -ge "35"], - [gl_cv_onwards_func_tzalloc="future OS version"]) fi dnl Set emacs_config_options to the options of 'configure', quoted for the shell, diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index 7ff43a3c4ac..599c0308cec 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi @@ -136,15 +136,57 @@ options (that is, single characters) requiring no arguments, and long options (starting with @samp{--}) whose arguments are specified with @samp{=}. - Dired does not handle files that have names with embedded newline -characters well. If you have many such files, you may consider adding -@samp{-b} to @code{dired-listing-switches}. This will quote all -special characters and allow Dired to handle them better. (You can -also use the @kbd{C-u C-x d} command to add @samp{-b} temporarily.) +You can declare @code{dired-listing-switches} as a connection-local +variable in order to adjust its value to match what a remote system +expects (@pxref{Connection Variables}). -@code{dired-listing-switches} can be declared as connection-local -variable to adjust it to match what a remote system expects -(@pxref{Connection Variables}). +@cindex file names with newline character in Dired +@cindex newline character in file names in Dired +@anchor{File names with newline} + When a file name contains a newline character, Dired displays it by +default as a literal newline, so the display of this file name occupies +more than one line in the Dired buffer. If you invoke a Dired operation +on such a file listing, in many cases it will fail and signal an error. +For this reason, when Dired displays a file name containing a literal +newline, Emacs recognizes this and automatically pops up a buffer with +an informative warning. For such file names, Dired offers an +alternative display, using the @command{ls} switch @samp{-b}, in which +newline characters are represented by @samp{\n} and the Dired listing of +the file occupies one line as usual, so you can execute all applicable +Dired operations on it.@footnote{Note that with the @samp{-b} switch +Dired displays tab characters in file names as @samp{\t} and escapes +other control characters and also spaces in file names with @samp{\}.} + + Emacs provides two different ways to make Dired use the @samp{-b} +switch: + +@itemize @bullet +@item +You can add @samp{-b} to @code{dired-listing-switches} before invoking +@code{dired}. Since this variable is a user option, you can alter its +value persistently either by using the Customization interface +(@pxref{Saving Customizations}) or by using the @code{setopt} macro in +your initialization file (@pxref{Examining}).@footnote{If +@code{dired-listing-switches} contains @samp{-b} when you invoke dired +on a directory containing a file name with a newline, the newline is +displayed as @samp{\n}, so Emacs will not pop up a warning.} You can +also add @samp{-b} just for the next @code{dired} invocation by typing +@kbd{C-u C-x d}. + +@item +@vindex dired-auto-toggle-b-switch +If you enable the user option @code{dired-auto-toggle-b-switch}, then +when you visit a directory containing a file whose name has a newline, +Emacs will automatically add the @samp{-b} switch and redisplay the +directory in Dired to show @samp{\n} in the file name. If you edit the +file name and remove the @samp{\n} character, then on completing the +edit Emacs automatically removes the @samp{-b} switch and redisplays the +Dired buffer, so that file names with tab or space characters now show +literal spaces without a backslash. If you enable or disable +@code{dired-auto-toggle-b-switch} after visiting a directory containing +a file name with a newline, Emacs will add or remove the @samp{-b} +switch as appropriate and automatically redisplay the Dired buffer. +@end itemize @vindex dired-switches-in-mode-line Dired displays in the mode line an indication of what were the diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 22c326d33f5..5b11af2b17f 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi @@ -528,51 +528,55 @@ frames by specifying @dfn{frame parameters}. @xref{Frame Parameters}. The following commands are used to delete and operate on frames: @table @kbd -@item C-x 5 0 @kindex C-x 5 0 @findex delete-frame +@item C-x 5 0 Delete the selected frame (@code{delete-frame}). This signals an error if there is only one frame. -@item C-x 5 u @kindex C-x 5 u @findex undelete-frame @findex undelete-frame-mode +@item C-x 5 u When @code{undelete-frame-mode} is enabled, undelete one of the 16 most recently deleted frames. Without a prefix argument, undelete the most recently deleted frame. With a numerical prefix argument between 1 and 16, where 1 is the most recently deleted frame, undelete the corresponding deleted frame. -@item C-z @kindex C-z @r{(X windows)} +@item C-z Minimize (or iconify) the selected Emacs frame (@code{suspend-frame}). @xref{Exiting}. -@item C-x 5 o @kindex C-x 5 o @findex other-frame +@item C-x 5 o Select another frame, and raise it. If you repeat this command, it cycles through all the frames on your terminal. -@item C-x 5 1 @kindex C-x 5 1 @findex delete-other-frames +@item C-x 5 1 Delete all frames on the current terminal, except the selected one. -@item M-@key{F10} @kindex M-F10 @findex toggle-frame-maximized +@item M-@key{F10} Toggle the maximization state of the current frame. When a frame is maximized, it fills the screen. -@item @key{F11} @kindex F11 @findex toggle-frame-fullscreen +@vindex alter-fullscreen-frames +@cindex resizing full-screen frames +@item @key{F11} Toggle full-screen mode for the current frame. (The difference between full-screen and maximized is normally that the former hides window manager decorations, giving slightly more screen space to -Emacs itself.) +Emacs itself.) Note that whether resizing of full-screen frames is +allowed and how Emacs handles that is controlled by the user option +@code{alter-fullscreen-frames}. @end table @vindex frame-resize-pixelwise diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 6ea7b5783c2..b2cd7f19e71 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -716,8 +716,17 @@ use @kbd{C-h l} (@code{view-lossage}). @kbd{C-h l} displays your last input keystrokes and the commands they invoked. By default, Emacs stores the last 300 keystrokes; if you wish, you can change this number with the command @code{lossage-size}. -If you see commands that you are not familiar with, you can use @kbd{C-h k} or -@kbd{C-h f} to find out what they do. +If you see commands that you are not familiar with, use +@kbd{C-h k}, or press @kbd{RET} or click on them to find out what they do. + +@vindex view-lossage-auto-refresh +By default, once the lossage buffer is displayed, it will not show the +keystroke and commands you will type after displaying it. But if you +set the variable @code{view-lossage-auto-refresh} to the value @code{t}, +the lossage buffer will be continuously refreshed as you type further +commands. Alternatively, you can invoke @code{view-lossage} with a +prefix argument, as in @kbd{C-u C-h l}, to display the lossage buffer +and have it auto-refresh thereafter. @kindex C-h e @findex view-echo-area-messages diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 2c2c710eea4..6c700869182 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2024,8 +2024,8 @@ server file, as the default @code{server-auth-dir} is hard-coded in relative filenames. @node Invoking emacsclient -@subsection Invoking @code{emacsclient} -@cindex @code{emacsclient} invocation +@subsection Invoking @command{emacsclient} +@cindex @command{emacsclient} invocation The simplest way to use the @command{emacsclient} program is to run the shell command @samp{emacsclient @var{file}}, where @var{file} is a @@ -2193,8 +2193,9 @@ option sometimes requires elaborate escaping of characters special to the shell. To avoid this, you can pass arguments to Lisp functions in your expression as additional separate arguments to @command{emacsclient}, and use @var{server-eval-args-left} in the -expression to access those arguments. Be careful to have your -expression remove the processed arguments from +expression to access those arguments. If empty string arguments are +passed to @command{emacsclient}, those are included as well. Be careful +to have your expression remove the processed arguments from @var{server-eval-args-left} regardless of whether your code succeeds, for example by using @code{pop}, otherwise Emacs will attempt to evaluate those arguments as separate Lisp expressions. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 22968ea878b..f08a3834c17 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1688,8 +1688,9 @@ row). Just what constitutes a block depends on the major mode. In C mode and related modes, blocks are delimited by braces, while in Lisp mode they are delimited by parentheses. Multi-line comments also count as blocks. +@vindex hs-prefix-map - Hideshow mode provides the following commands: + Hideshow mode provides the following commands (defined in @code{hs-prefix-map}): @findex hs-hide-all @findex hs-hide-block @@ -1734,7 +1735,7 @@ Hide all blocks @var{n} levels below this block @vindex hs-indicator-type @vindex hs-indicator-maximum-buffer-size @vindex hs-isearch-open -@vindex hs-special-modes-alist +@vindex hs-hide-block-behavior These variables can be used to customize Hideshow mode: @table @code @@ -1742,6 +1743,12 @@ Hide all blocks @var{n} levels below this block If non-@code{nil}, @kbd{C-c @@ C-M-h} (@code{hs-hide-all}) hides comments too. +@item hs-hide-block-behavior +This variable controls how @code{hs-hide-block} and +@code{hs-toggle-hiding} should hide a block. The possible values can be +'after-bol', hide the innermost block to which the current line belongs; +or 'after-cursor', hide the block after cursor position. + @item hs-display-lines-hidden If non-@code{nil}, display the number of hidden lines next to the ellipsis. diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 6345b1b8988..70bb6b04abd 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -1125,6 +1125,18 @@ ends of the range in upper case, or both in lower case, or both should be non-letters. The behavior of a mixed-case range such as @samp{A-z} is somewhat ill-defined, and it may change in future Emacs versions. +To search for raw bytes (@pxref{International Chars}) using regular +expressions, specify their codepoints in the bracket expression, as in +@w{@kbd{C-M-s [ C-x 8 @key{RET} 3fff80 @key{RET} - C-x 8 @key{RET} +3fffff @key{RET} ]}}. Emacs will show the equivalent + +@example +Regexp I-search: [\200-\377] +@end example + +@noindent +in the echo area. + @item @kbd{[^ @dots{} ]} @samp{[^} begins a @dfn{complemented character set}, which matches any character except the ones specified. Thus, @samp{[^a-z0-9A-Z]} matches diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 98af4a6f6c5..e020a36407b 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -387,7 +387,6 @@ revisions or branches (@pxref{Branches}) checked out simultaneously, in different working trees, but with all revision history, branches, tags and other metadata shared. -@indentedblock Suppose your project has a trunk where you're developing the new version 3 of your software, and a stable release branch from which you make point releases of version 2. Someone sends you a patch fixing a bug @@ -406,7 +405,6 @@ use @kbd{C-x v m} (@pxref{Merging}) to merge the branch you have checked out in the other working tree. Now your version of the trunk has all of version 2's fixes merged into it, but you haven't pushed it yet because you're still refactoring. You'll use @kbd{C-x v P} later. -@end indentedblock Ordinary VC commands like @kbd{C-x v v} (@pxref{Basic VC Editing}) and @kbd{C-x v d} (@pxref{VC Directory Mode}) don't work any differently diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index b11e61a40fe..0286a563464 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -3668,15 +3668,18 @@ character, or for keyboard-quit. @end defun @defun read-multiple-choice prompt choices &optional help-string show-help long-form -Ask user a multiple choice question. @var{prompt} should be a string -that will be displayed as the prompt. +Ask user a multiple-choice question and return user's choice. +@var{prompt} should be a string to display as the prompt. @var{choices} is an alist where the first element in each entry is a -character to be entered, the second element is a short name for the +character the user can type, the second element is a short name for the entry to be displayed while prompting (if there's room, it might be shortened), and the third, optional entry is a longer explanation that will be displayed in a help buffer if the user requests more help. +The return value is the entry from @var{choices} that matches the +character the user types. + If optional argument @var{help-string} is non-@code{nil}, it should be a string with a more detailed description of all choices. It will be displayed in a help buffer instead of the default auto-generated @@ -3691,7 +3694,10 @@ will have to type in long-form answers (using @code{completing-read}) instead of hitting a single key. The answers must be among the second elements of the values in the @var{choices} list. -The return value is the matching value from @var{choices}. +By default, this function uses @code{read-from-minibuffer} (@pxref{Text +from Minibuffer}) to read user input, but if the variable +@code{read-char-choice-use-read-key} is non-@code{nil}, it uses +@code{read-key} instead. @lisp (read-multiple-choice diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index fc0a56ee6d5..b7b2d40caee 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -317,8 +317,8 @@ following way instead: (do-something result2)) @end example -There's a number of variations on this theme, and they're briefly -described below. +There's a number of variations on this theme, and they're described +below. @defmac if-let* varlist then-form else-forms... Evaluate each binding in @var{varlist}, stopping if a binding value is @@ -376,6 +376,22 @@ Some Lisp programmers follow the convention that @code{and} and @code{when} and @code{when-let*} are for forms evaluated for side-effect with returned values ignored. +There is no @code{cond-let*} macro because extending the structure +shared by @code{if-let*}, @code{when-let*} and @code{and-let*} to the +case of @code{cond} is not simple.@footnote{The problem is that there +are multiple ways to do it that are all useful but not compatible. In +addition, the resulting macro is complicated, and so tricky to learn how +to read and write.} However, you can use the @code{cond*} macro's +@code{bind-and*} clauses (@pxref{cond* Macro}) to achieve something +similar: + +@example +(cond* ((bind-and* (result1 (do-computation)) + (result2 (do-more result1))) + (do-something result2)) + ...) +@end example + A similar macro exists to run a loop until one binding evaluates to @code{nil}: @@ -1503,6 +1519,14 @@ the bindings list in @code{let*}, @pxref{Local Variables}) for the body of the clause, and all subsequent clauses. As a condition, it counts as true if the first binding's value is non-@code{nil}. +@findex bind-and* +@code{(bind-and* @var{bindings}@dots{})} means to bind @var{bindings} +(like the bindings list in @code{if-let*}, @pxref{Conditionals}) for +only the body of the clause. As a condition, it counts as true if none +of the bindings evaluate to @code{nil}. In addition, if any binding +evaluates to @code{nil}, the expressions for the values of subsequent +bindings are not evaluated. + @findex match* @findex pcase* @code{(match* @var{pattern} @var{datum})} means to match @var{datum} diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 2c6f02a088c..2d124bd7e8d 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi @@ -354,8 +354,8 @@ values are legitimate, and how to display the value (@pxref{Customization Types}). Every @code{defcustom} should specify a value for this keyword. -@item :options @var{value-list} @kindex options@r{, @code{defcustom} keyword} +@item :options @var{value-list} Specify the list of reasonable values for use in this option. The user is not restricted to using only these values, but they are offered as convenient alternatives. @@ -368,8 +368,8 @@ Re-evaluating a @code{defcustom} form with a different @code{:options} value does not clear the values added by previous evaluations, or added by calls to @code{custom-add-frequent-value} (see below). -@item :set @var{setfunction} @kindex set@r{, @code{defcustom} keyword} +@item :set @var{setfunction} Specify @var{setfunction} as the way to change the value of this option when using the Customize interface. The function @var{setfunction} should take two arguments, a symbol (the option @@ -389,8 +389,8 @@ should describe how to do the same job in hand-written Lisp code, either by invoking @var{setfunction} directly or by using @code{setopt}. -@item :get @var{getfunction} @kindex get@r{, @code{defcustom} keyword} +@item :get @var{getfunction} Specify @var{getfunction} as the way to extract the value of this option. The function @var{getfunction} should take one argument, a symbol, and should return whatever customize should use as the @@ -403,8 +403,8 @@ Custom as variables but are not actually stored in Lisp variables. It is almost surely a mistake to specify @var{getfunction} for a value that really is stored in a Lisp variable. -@item :initialize @var{function} @kindex initialize@r{, @code{defcustom} keyword} +@item :initialize @var{function} @var{function} should be a function used to initialize the variable when the @code{defcustom} is evaluated. It should take two arguments, the option name (a symbol) and the value. Here are some predefined @@ -434,18 +434,24 @@ Use the @code{:set} function to initialize the variable, if it is already set or has been customized; otherwise, just use @code{set-default-toplevel-value}. -@item custom-initialize-delay +@item custom-initialize-after-file-load This function behaves like @code{custom-initialize-set}, but it -delays the actual initialization to the next Emacs start. This should -be used in files that are preloaded (or for autoloaded variables), so -that the initialization is done in the run-time context rather than -the build-time context. This also has the side-effect that the -(delayed) initialization is performed with the @code{:set} function. -@xref{Building Emacs}. +delays the actual initialization until after the containing file is loaded. +This can be useful to break the common dependency where the setter +is (or uses) a function which needs to be defined after the variable, +such as when a global minor mode has a non-@code{nil} @code{:init-value}. + +@item custom-initialize-delay +This function behaves like @code{custom-initialize-set}, but it delays +the actual initialization to the next Emacs start. This should be used +in Lisp files that are preloaded (loaded when Emacs is built), when it +is important to ensure that the initialization is performed in the +run-time context (which could be on a different system or programming +environment). @xref{Building Emacs, custom-initialize-delay}. @end table -@item :local @var{value} @kindex local@r{, @code{defcustom} keyword} +@item :local @var{value} If the @var{value} is @code{t}, mark @var{option} as automatically buffer-local; if the value is @code{permanent}, also set @var{option}s @code{permanent-local} property to @code{t}. Finally, if the value is @@ -453,18 +459,18 @@ buffer-local; if the value is @code{permanent}, also set @var{option}s to @code{t} without marking it as automatically buffer-local. @xref{Creating Buffer-Local}. -@item :risky @var{value} @kindex risky@r{, @code{defcustom} keyword} +@item :risky @var{value} Set the variable's @code{risky-local-variable} property to @var{value} (@pxref{File Local Variables}). -@item :safe @var{function} @kindex safe@r{, @code{defcustom} keyword} +@item :safe @var{function} Set the variable's @code{safe-local-variable} property to @var{function} (@pxref{File Local Variables}). -@item :set-after @var{variables} @kindex set-after@r{, @code{defcustom} keyword} +@item :set-after @var{variables} When setting variables according to saved customizations, make sure to set the variables @var{variables} before this one; i.e., delay setting this variable until after those others have been handled. Use diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 9e83e4a9bcc..eb3f7fd5feb 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5816,8 +5816,7 @@ something changed since the last display cycle. A buffer can have blank areas called @dfn{display margins} on the left and on the right. Ordinary text never appears in these areas, but you can put things into the display margins using the -@code{display} property. There is currently no way to make text or -images in the margin mouse-sensitive. +@code{display} property. The way to display something in the margins is to specify it in a margin display specification in the @code{display} property of some diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 740ea43a90f..c053d8c5543 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -1234,6 +1234,37 @@ bottom corner of the frame. The parameters @code{min-width} and @code{min-height} (@pxref{Size Parameters}) can be used to obtain a similar behavior when changing the frame size from within Emacs. +When a frame is in a fullscreen state (@pxref{Size Parameters}), +requests to change the frame size via one of these functions may be +supported or refused either by Emacs itself or by the window manager. +The following variable provides more control of the resulting behavior. + +@cindex altering the size of fullscreen frames +@cindex resizing fullscreen frames +@defopt alter-fullscreen-frames +This options controls how to handle requests to alter fullscreen frames. +Emacs consults it when asked to resize a fullscreen frame via functions +like @code{set-frame-size} or when setting the @code{width} or +@code{height} parameter of a frame. The following values are provided: + +@table @code +@item nil +This will forward the resize request to the window manager and leave it +to the latter how to proceed. + +@item t +This will first reset the fullscreen status and then forward the resize +request on to the window manager. + +@item inhibit +This will reject the resize request and leave the fullscreen status +unchanged. +@end table + +The default is @code{inhibit} on NS builds and @code{nil} everywhere +else. +@end defopt + @cindex tracking frame size changes The abnormal hook @code{window-size-change-functions} (@pxref{Window Hooks}) tracks all changes of the inner size of a frame including those diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 1b2a21e160c..2721c2ce4a0 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2609,7 +2609,9 @@ as a compiler macro. The function will accept the argument list If present, @var{doc} should be the function's documentation string (@pxref{Function Documentation}); @var{declare}, if present, should be a @code{declare} form (@pxref{Declare Form}) specifying the function's -metadata. +metadata. In addition to the usual declarations, @var{declare} +can include @code{(noinline @var{NOINLINE})} when a non-@code{nil} +@var{NOINLINE} prevents Emacs from inlining the defined function. @end defmac Functions defined via @code{define-inline} have several advantages diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 81edcc63d5b..37ef8d46525 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -387,6 +387,61 @@ not just rely on the truncation effect unless @var{n} is known to be positive. @end defun +@defun drop-while pred list +This function skips leading list elements for which the predicate @var{pred} +returns non-@code{nil}, and returns the rest. + +@example +@group +(drop-while #'numberp '(1 2 a b 3 4)) + @result{} (a b 3 4) +@end group +@end example +@end defun + +@defun take-while pred list +This function returns the leading list elements for which the predicate +@var{pred} returns non-@code{nil}, and ignores the rest. + +In general, +@code{(append (take-while @var{p} @var{list}) (drop-while @var{p} @var{list}))} +will return a list equal to @var{list}. + +@example +@group +(take-while #'numberp '(1 2 a b 3 4)) + @result{} (1 2) +@end group +@end example +@end defun + +@defun all pred list +This function returns @code{t} if @var{pred} is true for all elements in +@var{list}. + +@example +@group +(all #'numberp '(1 2 3 4)) @result{} t +(all #'numberp '(1 2 a b 3 4)) @result{} nil +(all #'numberp '()) @result{} t +@end group +@end example +@end defun + +@defun any pred list +This function returns non-@code{nil} if @var{pred} is true for at least +one element in @var{list}. The returned value is the longest @var{list} +suffix whose first element satisfies @var{pred}. + +@example +@group +(any #'symbolp '(1 2 3 4)) @result{} nil +(any #'symbolp '(1 2 a b 3 4)) @result{} (a b 3 4) +(any #'symbolp '()) @result{} nil +@end group +@end example +@end defun + @defun last list &optional n This function returns the last link of @var{list}. The @code{car} of this link is the list's last element. If @var{list} is null, diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index f6a3a0e2c26..acbe98ed84c 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -1320,6 +1320,11 @@ This macro arranges to evaluate @var{body} at the end of loading the file @var{library}, each time @var{library} is loaded. If @var{library} is already loaded, it evaluates @var{body} right away. +Usually @var{library} is a feature (i.e., a symbol), in which case +@var{body} is evaluated at the end of any file where +@code{(provide @var{library})} is called. + +@var{library} can be also a file name (i.e., a string). You don't need to give a directory or extension in the file name @var{library}. Normally, you just give a bare file name, like this: @@ -1329,8 +1334,8 @@ You don't need to give a directory or extension in the file name To restrict which files can trigger the evaluation, include a directory or an extension or both in @var{library}. Only a file whose -absolute true name (i.e., the name with all symbolic links chased out) -matches all the given name components will match. In the following +absolute name matches all the given name components will match. +In the following example, @file{my_inst.elc} or @file{my_inst.elc.gz} in some directory @code{..../foo/bar} will trigger the evaluation, but not @file{my_inst.el}: @@ -1339,10 +1344,6 @@ example, @file{my_inst.elc} or @file{my_inst.elc.gz} in some directory (with-eval-after-load "foo/bar/my_inst.elc" @dots{}) @end example -@var{library} can also be a feature (i.e., a symbol), in which case -@var{body} is evaluated at the end of any file where -@code{(provide @var{library})} is called. - An error in @var{body} does not undo the load, but does prevent execution of the rest of @var{body}. @end defmac diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 8c8cbf32b61..668205d5c04 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -1868,18 +1868,19 @@ marking the @code{define-minor-mode} form as autoloaded. @item :init-value @var{init-value} This is the value to which the @var{mode} variable is initialized. Except in unusual circumstances (see below), this value must be -@code{nil}. If the mode is global (see below) and preloaded, and the -initial value is @code{t}, i.e., the mode is turned on by default, you -should consider forcing Emacs to run the mode function at startup, like -this: +@code{nil}. Note that @code{define-minor-mode} does not automatically +run the body of the minor mode to ensure the mode is really enabled +according to this value, so if the mode is global (see above) and the +initial value is non-@code{nil}, you should consider forcing Emacs to +run the mode function when loading the mode, like this: @lisp - :initialize #'custom-initialize-delay + :initialize #'custom-initialize-after-file-load @end lisp @noindent -otherwise, the minor mode might not appear in the @file{*Help*} buffer -generated by @kbd{C-h m} (@pxref{Mode Help}). +otherwise, the minor mode might say it's enabled even though it has not +been properly set up. @item :lighter @var{lighter} The string @var{lighter} says what to display in the mode line @@ -4117,16 +4118,17 @@ table in special cases. @xref{Syntax Properties}. @defvar font-lock-keywords-only If the value of this variable is non-@code{nil}, Font Lock does not do syntactic fontification, only search-based fontification based on -@code{font-lock-keywords}. It is normally set by Font Lock mode based -on the @var{keywords-only} element in @code{font-lock-defaults}. If -the value is @code{nil}, Font Lock will call @code{jit-lock-register} -(@pxref{Other Font Lock Variables}) to set up for automatic -refontification of buffer text following a modified line to reflect -the new syntactic context due to the change. +@code{font-lock-keywords}; this will usually have the effect of not +fontifying comments and strings. This variable is normally set by Font +Lock mode based on the @var{keywords-only} element in +@code{font-lock-defaults}. If the value is @code{nil}, Font Lock will +call @code{jit-lock-register} (@pxref{Other Font Lock Variables}) to set +up for automatic refontification of buffer text following a modified +line to reflect the new syntactic context due to the change. -To use only syntactic fontification, this variable should -be non-@code{nil}, while @code{font-lock-keywords} should be set to -@code{nil} (@pxref{Font Lock Basics}). +To use only syntactic fontification, both this variable and +@code{font-lock-keywords} should be set to @code{nil} (@pxref{Font Lock +Basics}). @end defvar @defvar font-lock-syntax-table diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index a752a2125b4..aa8bca84dab 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -2370,54 +2370,49 @@ non-@code{nil} (@pxref{Symbols with Position}). @example @group -(eq 'foo 'foo) - @result{} t +(eq 'abc 'abc) @result{} t +(eq 'abc 'ABC) @result{} nil +(eq ?A ?A) @result{} t +(eq 3 3) @result{} t @end group +@end example +Equal non-fixnum numbers may or may not be the same object: + +@example @group -(eq ?A ?A) - @result{} t +(eq 3.0 3.0) @result{} t @r{or} nil +(eq (expt 10 50) (expt 10 50)) @result{} t @r{or} nil @end group +@end example +Newly created mutable objects are distinct: + +@example @group -(eq 3.0 3.0) - @result{} t @r{or} nil -;; @r{Equal floats may or may not be the same object.} +(eq (list 1 2 3) (list 1 2 3)) @result{} nil +(eq (point-marker) (point-marker)) @result{} nil @end group +@end example +Equal constants of other types may or may not be the same object: + +@example @group -(eq (make-string 3 ?A) (make-string 3 ?A)) - @result{} nil +(eq "abc" "abc") @result{} t @r{or} nil +(eq '(1 2 3) '(1 2 3)) @result{} t @r{or} nil +(eq [1 2 3] [1 2 3]) @result{} t @r{or} nil @end group +@end example -@group -(eq "asdf" "asdf") - @result{} t @r{or} nil -;; @r{Equal string constants or may not be the same object.} -@end group +@noindent +unless they are the same literal constant: +@example @group -(eq '(1 (2 (3))) '(1 (2 (3)))) - @result{} nil -@end group - -@group -(setq foo '(1 (2 (3)))) - @result{} (1 (2 (3))) -(eq foo foo) - @result{} t -(eq foo '(1 (2 (3)))) - @result{} nil -@end group - -@group -(eq [(1 2) 3] [(1 2) 3]) - @result{} nil -@end group - -@group -(eq (point-marker) (point-marker)) - @result{} nil +(let ((x "abc")) (eq x x)) @result{} t +(let ((x '(1 2 3))) (eq x x)) @result{} t +(let ((x [1 2 3])) (eq x x)) @result{} t @end group @end example @@ -2473,38 +2468,21 @@ the converse is not always true. (equal "asdf" "asdf") @result{} t @end group -@group -(eq "asdf" "asdf") - @result{} nil -@end group @group (equal '(1 (2 (3))) '(1 (2 (3)))) @result{} t @end group -@group -(eq '(1 (2 (3))) '(1 (2 (3)))) - @result{} nil -@end group @group (equal [(1 2) 3] [(1 2) 3]) @result{} t @end group -@group -(eq [(1 2) 3] [(1 2) 3]) - @result{} nil -@end group @group (equal (point-marker) (point-marker)) @result{} t @end group - -@group -(eq (point-marker) (point-marker)) - @result{} nil -@end group @end example The @code{equal} function compares strings and bool-vectors by value. @@ -2546,8 +2524,10 @@ returns @code{t} if and only if both the expressions below return @code{t}: @example +@group (equal (car @var{x}) (car @var{y})) (equal (cdr @var{x}) (cdr @var{y})) +@end group @end example Comparing circular lists may therefore cause deep recursion that leads diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 585ae678842..44dd3bbb63c 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi @@ -146,7 +146,7 @@ the tool bar even if the current frame is not a graphical one, since a graphical frame may be created later on. @item -It use @code{custom-reevaluate-setting} to re-initialize the members +It uses @code{custom-reevaluate-setting} to re-initialize the members of the list @code{custom-delayed-init-variables}. These are any pre-loaded user options whose default value depends on the run-time, rather than build-time, context. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 5734fcf8094..08f5c310a24 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -1473,7 +1473,7 @@ example, with the following pattern: @group ( (array :anchor (_) @@first (_) @@last :anchor) - (:equal @@first @@last) + (:eq? @@first @@last) ) @end group @end example @@ -1482,24 +1482,32 @@ example, with the following pattern: tree-sitter only matches arrays where the first element is equal to the last element. To attach a predicate to a pattern, we need to group them together. Currently there are three predicates: -@code{:equal}, @code{:match}, and @code{:pred}. +@code{:eq?}, @code{:match?}, and @code{:pred?}. -@deffn Predicate :equal arg1 arg2 +@deffn Predicate :eq? arg1 arg2 Matches if @var{arg1} is equal to @var{arg2}. Arguments can be either strings or capture names. Capture names represent the text that the -captured node spans in the buffer. +captured node spans in the buffer. Note that this is more like +@code{equal} in Elisp, but @code{eq?} is the convention used by +tree-sitter. Previously we supported the @code{:equal} predicate but +it's now considered deprecated. @end deffn -@deffn Predicate :match regexp capture-name +@deffn Predicate :match? capture-name regexp Matches if the text that @var{capture-name}'s node spans in the buffer matches regular expression @var{regexp}, given as a string literal. -Matching is case-sensitive. +Matching is case-sensitive. The ordering of the arguments doesn't +matter. Previously we supported the @code{:match} predicate but it's +now considered deprecated. @end deffn -@deffn Predicate :pred fn &rest nodes +@deffn Predicate :pred? fn &rest nodes Matches if function @var{fn} returns non-@code{nil} when passed each node in @var{nodes} as arguments. The function runs with the current -buffer set to the buffer of node being queried. +buffer set to the buffer of node being queried. Be very careful when +using this predicate, since it can be expensive when used in a tight +loop. Previously we supported the @code{:pred} predicate but it's now +considered deprecated. @end deffn Note that a predicate can only refer to capture names that appear in @@ -1554,9 +1562,9 @@ Anchor @code{:anchor} is written as @samp{.}. @item @samp{:+} is written as @samp{+}. @item -@code{:equal}, @code{:match} and @code{:pred} are written as -@code{#equal}, @code{#match} and @code{#pred}, respectively. -In general, predicates change their @samp{:} to @samp{#}. +@code{:eq?}, @code{:match?} and @code{:pred?} are written as +@code{#eq?}, @code{#match?} and @code{#pred?}, respectively. In +general, predicates change the @samp{:} to @samp{#}. @end itemize For example, @@ -1565,7 +1573,7 @@ For example, @group '(( (compound_expression :anchor (_) @@first (_) :* @@rest) - (:match "love" @@first) + (:match? "love" @@first) )) @end group @end example @@ -1577,7 +1585,7 @@ is written in string form as @group "( (compound_expression . (_) @@first (_)* @@rest) - (#match \"love\" @@first) + (#match? \"love\" @@first) )" @end group @end example diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 9481782d552..a1354d30c07 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -444,6 +444,12 @@ Representations}), or if the range start is ASCII and the end is a raw byte (as in @samp{[a-\377]}), the range will match only ASCII characters and raw 8-bit bytes, but not non-ASCII characters. This feature is intended for searching text in unibyte buffers and strings. + +@cindex raw bytes, regexps for searching +@item +To search for @dfn{raw bytes}, which are characters belonging to the +@code{eight-bit} character set (@pxref{Character Sets}), you can use +@samp{[\200-\377]} or @samp{[\x3fff80-\x3fffff]} @end enumerate Some kinds of bracket expressions are not the best style even diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index a1246b11a8a..6400fc6ece4 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -796,6 +796,7 @@ facts are true or false. @menu * Type Predicates:: @code{cl-typep}, @code{cl-deftype}, and @code{cl-coerce}. +* Derived Types:: @code{cl-deftype}. * Equality Predicates:: @code{cl-equalp}. @end menu @@ -888,8 +889,8 @@ floats. In all other circumstances, @code{cl-coerce} signals an error. @end defun -@node Derived types -@subsection Derived types +@node Derived Types +@section Derived Types @defmac cl-deftype name arglist [docstring] [decls] forms@dots{} This macro defines a new type called @var{name}. diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi index 5c24364286d..74e12485eec 100644 --- a/doc/misc/efaq-w32.texi +++ b/doc/misc/efaq-w32.texi @@ -196,7 +196,7 @@ in the Emacs source distribution. If you need to build or run Emacs on MS Windows before Windows 7, you have to use the MinGW port of GCC and the MSYS suite of tools. The file @file{nt/INSTALL} in Emacs source distribution contains the -details. +details. @xref{MinGW}. Support for displaying images, as well as XML/HTML rendering and TLS networking requires external libraries, the headers and import @@ -2245,21 +2245,27 @@ software. This includes all the optional libraries used by Emacs Hunspell, Gawk, GNU Make, Groff, GDB. @node MinGW -@section MinGW and MSYS +@section mingw.org's MinGW and MSYS @cindex mingw tools @cindex msys environment @cindex subprocesses, mingw and msys @uref{https://osdn.net/projects/mingw/} -MinGW is another set of development tools that produce native Windows -executables, not dependent on Cygwin's POSIX emulation DLLs. +MinGW from @code{mingw.org} is another set of development tools that +produce native Windows executables, not dependent on Cygwin's POSIX +emulation DLLs. This is the original MinGW project, nowadays no longer +actively developed. Its files can currently be found only via the WWW +archive site known as the @dfn{Wayback Machine}. The latest MinGW +release files can be found here: +@uref{https://web.archive.org/web/20210410172202/https://osdn.net/projects/mingw/releases/}. -MSYS is a POSIX shell and minimal set of tools that are commonly used in -configure scripts. Like Cygwin, this environment uses a non-native -filesystem mapping to appear more POSIX like to the scripts that it -runs. This is intended to complement the MinGW tools to make it easier -to port software to Windows. +MSYS, which is part of @code{mingw.org}s MinGW, is a POSIX shell and +minimal set of tools that are commonly used in configure scripts. Like +Cygwin, this environment uses a non-native filesystem mapping to appear +more POSIX like to the scripts that it runs. This is intended to +complement the MinGW tools to make it easier to port software to +Windows. @node GnuWin32 @section GnuWin32 diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index fac90562f6b..93268ce7c15 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -449,7 +449,7 @@ command (@pxref{Eglot Commands}). On-the-fly succinct informative annotations, so-called @dfn{inlay hints}. Eglot adds special intangible text nearby certain identifiers, be it the type of a variable, or the name of a formal parameter in a -function call. @xref{Eglot Commands} and the +function call. @xref{Eglot Commands}, and the @code{eglot-inlay-hints-mode} minor mode. @item @@ -1287,14 +1287,24 @@ To apply this to Eglot, and assuming you chose the @end lisp @noindent -This sets the value of @code{eglot-workspace-configuration} in all the -buffers inside the project; each server will use only the section of the -parameters intended for that server, and ignore the rest. Note how -alists are used for associating Emacs mode names with alists associating -variable names with variable values. Then notice how plists are used -inside the value of @code{eglot-workspace-configuration}. +Note how alists are used for associating Emacs mode names with other +alists, associating variable names with variable values. Then, pay +special attention to how the value of +@code{eglot-workspace-configuration} is a plist and @emph{not} an alist. -This following form may also be used: +The above form sets the value of @code{eglot-workspace-configuration} in +all the buffers inside the project; each language server will then use +only the section of the parameters intended for it, and ignore the rest. +In our example, @command{pylsp} and @command{gopls} are solely +interested in the @code{:pylsp} and @code{:gopls} parameter section +names, respectively. However, section names don't have to match the +server name and some servers may be even interested in multiple +sections: the @command{typescript-language-server} server is known to be +interested in the @code{:javascript} and @code{:typescript} section +names. + +To avoid sending whole configuration sections to servers who are +decidedly not interested in them, the following form may also be used: @lisp ((python-base-mode @@ -1316,11 +1326,11 @@ buffers. @code{python-base-mode} buffers will have the variable set to @code{(:pylsp (:plugins ...))}. @code{go-mode} buffers will have the variable set to @code{(:gopls (:usePlaceholders t))}. -Some servers will issue workspace configuration for specific files -inside your project. For example, if you know @code{gopls} is asking -about specific files in the @code{src/imported} subdirectory and you -want to set a different option for @code{gopls.usePlaceholders} , you -may use something like: +Some servers will issue workspace configuration for specific source +files inside your project. For example, if you know @code{gopls} is +asking about specific files in the @code{src/imported} subdirectory and +you want to set a different option for @code{gopls.usePlaceholders} , +you may use something like: @lisp ((python-base-mode @@ -1340,10 +1350,10 @@ may use something like: Finally, if one needs to determine the workspace configuration based on some dynamic context, @code{eglot-workspace-configuration} can be set to -a function. The function is called with the @code{eglot-lsp-server} -instance of the connected server (if any) and with -@code{default-directory} set to the root of the project. The function -should return a plist suitable for use as the variable's value. +a function instead of a plist. The function is called with the +@code{eglot-lsp-server} instance of the connected server (if any) and +with @code{default-directory} set to the root of the project. The +function should return a plist suitable for use as the variable's value. @node User-specific configuration @section User-specific configuration diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi index c47747a5b1f..8ef027c8f04 100644 --- a/doc/misc/erc.texi +++ b/doc/misc/erc.texi @@ -2,7 +2,7 @@ @c %**start of header @setfilename ../../info/erc.info @settitle ERC Manual -@set ERCVER 5.6.1 +@set ERCVER 5.6.2 @set ERCDIST as distributed with Emacs @value{EMACSVER} @include docstyle.texi @syncodeindex fn cp diff --git a/doc/misc/modus-themes.org b/doc/misc/modus-themes.org index 286f580ebc6..43983505576 100644 --- a/doc/misc/modus-themes.org +++ b/doc/misc/modus-themes.org @@ -4,9 +4,9 @@ #+language: en #+options: ':t toc:nil author:t email:t num:t #+startup: content -#+macro: stable-version 4.8.0 -#+macro: release-date 2025-06-11 -#+macro: development-version 4.9.0-dev +#+macro: stable-version 5.1.0 +#+macro: release-date 2025-11-07 +#+macro: development-version 5.2.0-dev #+macro: file @@texinfo:@file{@@$1@@texinfo:}@@ #+macro: space @@texinfo:@: @@ #+macro: kbd @@texinfo:@kbd{@@$1@@texinfo:}@@ @@ -143,10 +143,10 @@ and covers everything that goes into every tagged release of the themes. :custom_id: h:1af85373-7f81-4c35-af25-afcef490c111 :end: -The Modus themes are distributed with Emacs starting with version 28.1. -On older versions of Emacs, they can be installed using Emacs' package -manager or manually from their code repository. There also exist -packages for distributions of GNU/Linux. +The Modus themes are distributed with Emacs starting with version +28.1. On Emacs 27, they can be installed using Emacs' package manager +or manually from their code repository. There also exist packages for +distributions of GNU/Linux. Emacs 28 ships with ~modus-themes~ version =1.6.0=. Emacs 29 includes version =3.0.0=. Emacs 30 provides a newer, refactored version that @@ -365,7 +365,11 @@ customizations ([[#h:f4651d55-8c07-46aa-b52b-bed1e53463bb][Advanced customizatio #+findex: modus-themes-toggle #+findex: modus-themes-select -The commands ~modus-themes-toggle~ and ~modus-themes-select~ use +#+findex: modus-themes-rotate +#+findex: modus-themes-load-random +#+findex: modus-themes-select +The commands ~modus-themes-toggle~, ~modus-themes-rotate~, +~modus-themes-load-random~, and ~modus-themes-select~ use ~modus-themes-load-theme~ internally ([[#h:4fbfed66-5a89-447a-a07d-a03f6819c5bd][Option for which themes to toggle]]). The aforementioned hold true for them as well. @@ -386,10 +390,6 @@ function must be used in this case as a replacement. For example: (setq modus-themes-bold-constructs t modus-themes-italic-constructs t) -;; Maybe define some palette overrides, such as by using our presets -(setq modus-themes-common-palette-overrides - modus-themes-preset-overrides-intense) - ;; Load the theme of choice (built-in themes are always "safe" so they ;; do not need the `no-require' argument of `load-theme'). (load-theme 'modus-operandi) @@ -397,7 +397,7 @@ function must be used in this case as a replacement. For example: (define-key global-map (kbd "") #'modus-themes-toggle) #+end_src -** Sample configuration with and without use-package +** Sample configuration :properties: :custom_id: h:e979734c-a9e1-4373-9365-0f2cd36107b8 :end: @@ -413,19 +413,15 @@ package configurations in their setup. We use this as an example: #+begin_src emacs-lisp ;;; For the built-in themes which cannot use `require'. (use-package emacs - :config + :init (require-theme 'modus-themes) ; `require-theme' is ONLY for the built-in Modus themes - + :config ;; Add all your customizations prior to loading the themes (setq modus-themes-italic-constructs t modus-themes-bold-constructs nil) - ;; Maybe define some palette overrides, such as by using our presets - (setq modus-themes-common-palette-overrides - modus-themes-preset-overrides-intense) - ;; Load the theme of your choice. - (load-theme 'modus-operandi) + (modus-themes-load-theme 'modus-operandi) (define-key global-map (kbd "") #'modus-themes-toggle)) @@ -439,12 +435,8 @@ package configurations in their setup. We use this as an example: (setq modus-themes-italic-constructs t modus-themes-bold-constructs nil) - ;; Maybe define some palette overrides, such as by using our presets - (setq modus-themes-common-palette-overrides - modus-themes-preset-overrides-intense) - ;; Load the theme of your choice. - (load-theme 'modus-operandi) + (modus-themes-load-theme 'modus-operandi) (define-key global-map (kbd "") #'modus-themes-toggle)) #+end_src @@ -458,12 +450,8 @@ The same without ~use-package~: (setq modus-themes-italic-constructs t modus-themes-bold-constructs nil) -;; Maybe define some palette overrides, such as by using our presets -(setq modus-themes-common-palette-overrides - modus-themes-preset-overrides-intense) - ;; Load the theme of your choice: -(load-theme 'modus-operandi :no-confirm) +(modus-themes-load-theme 'modus-operandi :no-confirm) (define-key global-map (kbd "") #'modus-themes-toggle) #+end_src @@ -516,7 +504,7 @@ session, are better off using something like this: [[#h:b40aca50-a3b2-4c43-be58-2c26fcd14237][Toggle themes without reloading them]]. -[[#h:e979734c-a9e1-4373-9365-0f2cd36107b8][Sample configuration with and without use-package]]. +[[#h:e979734c-a9e1-4373-9365-0f2cd36107b8][Sample configuration]]. With the above granted, other sections of the manual discuss how to configure custom faces, where ~load-theme~ is expected, though @@ -548,7 +536,6 @@ reloaded for changes to take effect. modus-themes-bold-constructs nil modus-themes-mixed-fonts t modus-themes-variable-pitch-ui nil - modus-themes-custom-auto-reload t modus-themes-disable-other-themes t ;; Options for `modus-themes-prompts' are either nil (the @@ -585,34 +572,6 @@ reloaded for changes to take effect. ;; document extensively in this manual. #+end_src -** Option for reloading the theme on custom change -:properties: -:alt_title: Custom reload theme -:description: Toggle auto-reload of the theme when setting custom variables -:custom_id: h:9001527a-4e2c-43e0-98e8-3ef72d770639 -:end: -#+vindex: modus-themes-custom-auto-reload - -Brief: Toggle reloading of the active theme when an option is changed -through the Custom UI. - -Symbol: ~modus-themes-custom-auto-reload~ (=boolean= type) - -Possible values: - -1. ~nil~ -2. ~t~ (default) - -All theme user options take effect when a theme is loaded. Any -subsequent changes require the theme to be reloaded. - -When this variable has a non-~nil~ value, any change made via the Custom -UI or related functions such as ~customize-set-variable~ and ~setopt~ -(Emacs 29), will trigger a reload automatically. - -With a ~nil~ value, changes to user options have no further consequences: -the user must manually reload the theme ([[#h:3f3c3728-1b34-437d-9d0c-b110f5b161a9][Enable and load]]). - ** Option for disabling other themes while loading Modus :properties: :alt_title: Disable other themes @@ -630,10 +589,16 @@ Possible values: 1. ~nil~ 2. ~t~ (default) -When the value is non-~nil~, the commands ~modus-themes-toggle~ and +#+findex: modus-themes-toggle +#+findex: modus-themes-rotate +#+findex: modus-themes-load-random +#+findex: modus-themes-select +#+findex: modus-themes-load-theme +When the value is non-~nil~, the commands ~modus-themes-toggle~, +~modus-themes-rotate~, ~modus-themes-load-random~, and ~modus-themes-select~, as well as the ~modus-themes-load-theme~ function, will disable all other themes while loading the specified -Modus theme ([[#h:4fbfed66-5a89-447a-a07d-a03f6819c5bd][Option for which themes to toggle]]). This is done to +Modus theme ([[#h:4fbfed66-5a89-447a-a07d-a03f6819c5bd][Option for which themes to toggle]]). This is done to ensure that Emacs does not blend two or more themes: such blends lead to awkward results that undermine the work of the designer. @@ -734,24 +699,27 @@ Possible values: :END: #+findex: modus-themes-rotate -Brief: Specify which themes to rotate among when using the command +Brief: Specify which themes to rotate through when using the command ~modus-themes-rotate~. #+vindex: modus-themes-to-rotate Symbol: ~modus-themes-to-rotate~ (=list= type) -Default value: =modus-themes-items= (which includes all the Modus themes) +Default value: nil Possible values: -- ~modus-operandi~ -- ~modus-operandi-tinted~ -- ~modus-operandi-deuteranopia~ -- ~modus-operandi-tritanopia~ -- ~modus-vivendi~ -- ~modus-vivendi-tinted~ -- ~modus-vivendi-deuteranopia~ -- ~modus-vivendi-tritanopia~ +#+vindex: modus-themes-items +- Any of the themes listed in the value of the variable ~modus-themes-items~. +#+findex: modus-themes-get-themes +- Any of the themes returned by the function ~modus-themes-get-themes~ + ([[#h:86eb375b-9be4-43ce-879a-0686a524a63b][Build on top of the Modus themes]]). + +When the value is a list of themes, ~modus-themes-rotate~ will go +through them from left to right. With an optional prefix argument +({{{kbd(C-u)}}} by default), it will move in reverse. If the value is +~nil~, the command will perform the same action for all the themes +returned by the function ~modus-themes-get-themes~. ** Option for font mixing :properties: @@ -1195,8 +1163,8 @@ a cyan hue to keywords: (keyword cyan-cooler))) #+end_src -Changes take effect upon theme reload ([[#h:9001527a-4e2c-43e0-98e8-3ef72d770639][Custom reload theme]]). -Overrides are removed by setting their variable to a ~nil~ value. +Changes take effect upon theme reload. Overrides are removed by +setting their variable to a ~nil~ value. The common accented foregrounds in each palette follow a predictable naming scheme: =HUE{,-warmer,-cooler,-faint,-intense}=. =HUE= is one @@ -1309,13 +1277,13 @@ Examples demonstrating how to use the aforementioned: #+findex: modus-themes-list-colors The command ~modus-themes-list-colors~ uses minibuffer completion to select an item from the Modus themes and then produces a buffer with -previews of all of its color palette entries. +previews of all of its color palette entries ([[#h:4952cd81-8a9a-4a4e-9867-3e63b9ef2f7e][Commands for the preview palette buffer]]). #+findex: modus-themes-list-colors-current The command ~modus-themes-list-colors-current~ skips the minibuffer selection process to produce a preview for the current Modus theme. -When called with a prefix argument (=C-u= with the default key +When called with a prefix argument {{{kbd(C-u)}}} with the default key bindings), these commands will show a preview of the palette's semantic color mappings instead of the full palette ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]). @@ -1336,6 +1304,51 @@ contents are, such as =*modus-operandi-list-all*= for the entirety of the palette (named colors as well as semantic color mappings) and ==*modus-operandi-list-mappings*= for the mappings only. +** Commands for the preview palette buffer +:PROPERTIES: +:CUSTOM_ID: h:4952cd81-8a9a-4a4e-9867-3e63b9ef2f7e +:END: + +#+findex: modus-themes-preview-mode +#+vindex: modus-themes-preview-mode-map +The palette preview buffer uses the major mode ~modus-themes-preview-mode~, +which provides the ~modus-themes-preview-mode-map~ ([[#h:f4d4b71b-2ca5-4c3d-b0b4-9bfd7aa7fb4d][Preview theme colors]]). +The following key bindings are available by default: + +| Default key binding | Name of the command | +|---------------------+----------------------------------------| +| =w= | ~modus-themes-preview-mode-copy-color~ | +| =W= | ~modus-themes-preview-mode-copy-entry~ | +| =m= | ~modus-themes-preview-mode-mark~ | +| =M= | ~modus-themes-preview-mode-mark-all~ | +| =u= | ~modus-themes-preview-mode-unmark~ | +| =U= | ~modus-themes-preview-mode-unmark-all~ | + +#+findex: modus-themes-preview-mode-copy-color +The command ~modus-themes-preview-mode-copy-color~ copies the resolved +color value of the entry at point or of all the marked entries. This +means that it always returns a string with the value of the color, not +a symbolic representation of it. For example, if =cursor= is mapped to +=red-warmer=, this command will return ="#972500"= while previewing +the palette of the ~modus-operandi~ theme. + +#+findex: modus-themes-preview-mode-copy-entry +The command ~modus-themes-preview-mode-copy-entry~ copies the palette +entry as such. This is how the entry is in the underlying palette +definition. For example, it will return =(magenta-cooler "#531ab6")= +or =(keybind blue-warmer)=. Copying those is useful as a starting +point for writing palette overrides ([[#h:34c7a691-19bb-4037-8d2f-67a07edab150][Option for palette overrides]]). + +#+findex: modus-themes-preview-mode-mark +#+findex: modus-themes-preview-mode-mark-all +#+findex: modus-themes-preview-mode-unmark +#+findex: modus-themes-preview-mode-unmark-all +The commands ~modus-themes-preview-mode-mark~, ~modus-themes-preview-mode-mark-all~, +~modus-themes-preview-mode-unmark~, and ~modus-themes-preview-mode-unmark-all~, +will add or remove a marker from the current or affected lines. These +marks influence the result of the aforementioned commands for copying +colors and palette entries. + * Use colors from the Modus themes palette :PROPERTIES: :CUSTOM_ID: h:33460ae8-984b-40fd-8baa-383cc5fc2698 @@ -4141,6 +4154,246 @@ In this document, we cover ~modus-themes-after-load-theme-hook~ though the user can replace it with ~after-enable-theme-hook~ should they need to (provided they understand the implications). +* Build on top of the Modus themes +:PROPERTIES: +:CUSTOM_ID: h:86eb375b-9be4-43ce-879a-0686a524a63b +:END: + +This section concerns package developers or advanced users. + +The Modus themes can be used as the basis for another theme. The +~ef-themes~ and ~standard-themes~ packages (also by Protesilaos), are +two such case. Developers may do so to benefit from the extensive +customization of the Modus themes and the fact that they are part of +core Emacs. + +#+findex: modus-themes-theme +#+vindex: modus-themes-registered-items +A new theme exists in a file whose directory is in the ~custom-theme-load-path~. +The theme file is named =NAME-theme.el=. For example, the ~modus-operandi~ +theme is in the file =modus-operandi-theme.el=. A theme object can be +instantiated with the function ~modus-themes-theme~. This function takes care to +(i) declare the theme, (ii) add to it relevant ~theme-properties~, (iii) register +it in the ~modus-themes-registered-items~, (iv) make it work with all the faces +and customizations documented in this manual, and (v) ~provide-theme~ the theme. + +Concretely, ~modus-themes-theme~ expects the following mandatory arguments: + +- =NAME= :: The name of the new theme as a symbol, like ~modus-operandi~. +- =FAMILY= :: The collection this theme is a member of as a symbol, + like ~modus-themes~. +- =DESCRIPTION= :: A string describing the theme. +- =BACKGROUND-MODE= :: The symbol =dark= or =light=, in reference to + the theme's background color. +- =CORE-PALETTE= :: The symbol of a variable containing a palette with + named colors and semantic mappings, like ~modus-operandi-palette~. A + palette that does not have at least all the entries of a default + Modus palette will eventually not work properly because some face + definition will expect a given color. Though the macro does not + impose any check in this regard. +- =USER-PALETTE= :: The symbol of a user-defined extension to the + =CORE-PALETTE=, commensurate with it, though with arbitrary entries. + This can be nil, a fully fledged palette, or a short list of + entries. Any colors defined therein are treated the same as the + =CORE-PALETTE= and can, in practice, be used to apply distinct + styles to the =CUSTOM-FACES= and =CUSTOM-VARIABLES= (more below). +- =OVERRIDES-PALETTE= :: The symbol of a palette that contains + overrides for the above two palettes. It is functionally equivalent + to the =USER-PALETTE=, except it is meant to be customized by the + end user. Its value can also be nil. +#+vindex: modus-themes-faces +- Optional =CUSTOM-FACES= :: The symbol of a variable with list of + face definitions like those in ~modus-themes-faces~, to extend or + modify what core Modus defines. If provided, they override whatever + definition is present in ~modus-themes-faces~ in case of a conflict. + Derivative themes can thus deviate from the style of core Modus, + wherever necessary. +#+vindex: modus-themes-custom-variables +- Optional =CUSTOM-VARIABLES= :: The symbol of a variable with a list + of custom variables (typically user options) like those defined in + ~modus-themes-custom-variables~. They also override the core Modus + definitions in case of a conflict. + +This is an example of a theme that builds on top of ~modus-operandi~, +passing all the mandatory arguments, but not the optional ones: + +#+begin_src emacs-lisp +(modus-themes-theme + 'ef-summer + 'ef-themes + "Legible light warm pink theme with magenta, purple, gold, cyan colors." + 'light + 'modus-operandi-palette + 'ef-summer-palette + 'ef-summer-palette-overrides) +#+end_src + +Here we notice how ~ef-summer~ has ~modus-operandi-palette~ as its +=CORE-PALETTE=. This means that if the ~ef-summer-palette~ lacks some +entry, the theme will still work and it will inherit the style of +~modus-operandi~ for that specific element. + +The ~modus-themes-theme~ macro does not try to be smart about the +arguments it is given. It will thus not make any attempt to test if +the variables are bound, nor will it declare any customization +options. In the above example, the ~ef-summer-palette-overrides~ is a +user option that is declared in that theme's file. + +In addition to defining their own colors, themes can provide an +entirely custom list of face definitions and customization options. +This mirrors the style of ~modus-themes-faces~ and +~modus-themes-custom-variables~, as already noted. For example, the +~standard-themes~ have a pseudo-3D style for their active mode line. +They are declared in this way: + +#+begin_src emacs-lisp +(modus-themes-theme + 'standard-dark + 'standard-themes + "Like the unthemed dark Emacs, but more consistent." + 'dark + 'modus-vivendi-palette + 'standard-dark-palette + 'standard-dard-palette-overrides + 'standard-themes-custom-faces) ; NOTE the additional optional argument +#+end_src + +The ~standard-themes-custom-faces~ in this example specifies a list of +face definitions like this: + +#+begin_src emacs-lisp +;; Simplified example for illustration purposes +(defconst standard-themes-custom-faces + '( + `(mode-line ((,c :box (:style released-button :color ,border-mode-line-active)))))) +#+end_src + +Custom faces passed in this way can still define their semantic +palette mappings, as illustrated herein where ~border-mode-line-active~ +corresponds to some named color in the palette of the active theme. + +** Determine what counts as a Modus theme +:PROPERTIES: +:CUSTOM_ID: h:412e3017-81fe-4a95-97a6-225de1867757 +:END: + +#+findex: modus-themes-get-all-known-themes +Once the theme is instantiated, it will be listed in the return value +of the function ~modus-themes-get-all-known-themes~. This function +accepts an optional argument to filter themes by their given family, +as specified at the time of the theme's reification ([[#h:86eb375b-9be4-43ce-879a-0686a524a63b][Build on top of the Modus themes]]). + +#+findex: modus-themes-get-themes +The generic function ~modus-themes-get-themes~ is how developers/users +can affect what counts as a "Modus" theme. By default, +~modus-themes-get-themes~ essentially calls the following, to only +return the themes whose family is =modus-themes=: + +#+begin_src emacs-lisp +(modus-themes-get-all-known-themes 'modus-themes) +#+end_src + +A new method can be declared with ~cl-defmethod~ to do something else +instead. When exactly should that method come into effect is up to the +developer/user. In the ~ef-themes~, this is done via a minor mode, +that users must opt in to. Here is the complete example: + +#+begin_src emacs-lisp +(define-minor-mode ef-themes-take-over-modus-themes-mode + "When enabled, all Modus themes commands consider only Ef themes." + :global t + :init-value nil) + +(cl-defmethod modus-themes-get-themes (&context (ef-themes-take-over-modus-themes-mode (eql t))) + (if-let* ((themes (modus-themes-get-all-known-themes 'ef-themes)) + (sorted-themes (modus-themes-sort themes 'light))) + sorted-themes + ef-themes-items)) +#+end_src + +The ~define-minor-mode~ does not need to do anything else here. Its +corresponding function simply takes care to toggle the variable of the +same name (i.e. ~ef-themes-take-over-modus-themes-mode~) between ~nil~ +and non-~nil~. The method will take effect when the minor mode is +enabled. In this scenario, "Modus" themes are only those whose family +is =ef-themes=. All the Modus commands that switch between themes will +thus only work with those Ef themes. + +#+findex: modus-themes-include-derivatives-mode +For our part, we define the ~modus-themes-include-derivatives-mode~. +It is how users can opt in to the all-inclusive conception of "Modus". +In this scenario, every theme that is declared with the aforementioned +~modus-themes-theme~ will count as "Modus" and be available to all the +relevant commands for switching themes, previewing their palette, and +so on. + +#+begin_src emacs-lisp +(define-minor-mode modus-themes-include-derivatives-mode + "When enabled, all Modus themes commands cover derivatives as well. +Otherwise, they only consider the `modus-themes-items'. + +Derivative theme projects can implement the equivalent of this minor +mode plus a method for `modus-themes-get-themes' to filter themes +accordingly." + :global t + :init-value nil) + +(cl-defmethod modus-themes-get-themes (&context (modus-themes-include-derivatives-mode (eql t))) + (if-let* ((themes (modus-themes-get-all-known-themes nil)) + (sorted-themes (modus-themes-sort themes 'light))) + sorted-themes + modus-themes-items)) +#+end_src + +** Create convenience commands to load a derivative theme +:PROPERTIES: +:CUSTOM_ID: h:6bfbb4d6-2f23-4d06-827a-8b9a91507a02 +:END: + +#+findex: modus-themes-define-derivative-command +In the previous section, we explored the mechanics of the +~modus-themes-get-themes~ ([[#h:412e3017-81fe-4a95-97a6-225de1867757][Determine what counts as a Modus theme]]). +Independent of that method, developers can use the macro +~modus-themes-define-derivative-command~ to define small wrappers for +Modus commands that load a theme only for a specific family of Modus +derivatives ([[#h:86eb375b-9be4-43ce-879a-0686a524a63b][Build on top of the Modus themes]]). + +The ~modus-themes-define-derivative-command~ takes two mandatory +arguments: + +- =FAMILY= :: the family of the Modus themes derivatives, such as ~ef-themes~. + +#+vindex: ~modus-themes-define-derivative-command-known-suffixes~ +- =SUFFIX= :: the suffix of the command-to-be-defined. It is one among + the symbols listed in ~modus-themes-define-derivative-command-known-suffixes~. + +The suffix is appended to =FAMILY= to derive the symbol of the +command. For example, if =SUFFIX= is =rotate= and =FAMILY= is +~ef-themes~, then the symbol is ~ef-themes-rotate~. + +Here is how it actually looks in the source code of the Ef themes: + +#+begin_src emacs-lisp +;;;###autoload (autoload 'ef-themes-rotate "ef-themes") +(modus-themes-define-derivative-command ef-themes rotate) +#+end_src + +This is what the macroexpanded form looks like: + +#+begin_src emacs-lisp +(defun ef-themes-rotate () + "Like `modus-themes-rotate' but only consider members of the `ef-themes'" + (interactive) + (cl-letf (((symbol-function 'modus-themes-get-themes) + (lambda () (modus-themes-get-all-known-themes 'ef-themes)))) + (call-interactively 'modus-themes-rotate))) +#+end_src + +Sometimes, it makes no sense to re-use an existing Modus command (e.g. +because the developer wants to introduce a user option to affect what +the command is doing), though this approach with the ~cl-letf~ can +still prove useful. + * Face coverage :properties: :custom_id: h:a9c8f29d-7f72-4b54-b74b-ddefe15d6a19 @@ -4165,7 +4418,6 @@ have lots of extensions, so the "full support" may not be 100% true… + abbrev + ace-window -+ agda2-mode + all-the-icons + all-the-icons-dired + all-the-icons-ibuffer @@ -4230,11 +4482,11 @@ have lots of extensions, so the "full support" may not be 100% true… + eldoc-box + elfeed + elfeed-score ++ elisp (Emacs Lisp semantic highlighting) + elpher + embark + ement + emms -+ enh-ruby-mode (enhanced-ruby-mode) + epa + erc + ert @@ -4265,6 +4517,7 @@ have lots of extensions, so the "full support" may not be 100% true… + golden-ratio-scroll-screen + helpful + hexl-mode ++ hideshow + highlight-numbers + highlight-parentheses ([[#h:24bab397-dcb2-421d-aa6e-ec5bd622b913][Note on highlight-parentheses.el]]) + highlight-thing @@ -4280,7 +4533,6 @@ have lots of extensions, so the "full support" may not be 100% true… + iflipb + image-dired + imenu-list -+ indium + info + info+ (info-plus) + info-colors @@ -5696,55 +5948,57 @@ The Modus themes are a collective effort. Every bit of work matters. + Contributions to code or documentation :: Aleksei Gusev, Alex Griffin, Anders Johansson, Antonio Ruiz, Basil L.{{{space()}}} Contovounesios, Björn Lindström, Carlo Zancanaro, Christian Tietze, - Daniel Mendler, David Edmondson, Eli Zaretskii, Fritz Grabo, Gautier - Ponsinet, Illia Ostapyshyn, Jacob S.{{{space()}}} Gordon, Jared - Finder, Kévin Le Gouguec, Koen van Greevenbroek, Kostadin Ninev, - Leilei332, Madhavan Krishnan, Manuel Giraud, Markus Beppler, Matthew - Stevenson, Mauro Aranda, Nacho Barrientos, Niall Dooley, Nicolas De - Jaeghere, Paul David, Pavel Novichkov, Philip Kaludercic, Pierre - Téchoueyres, Rahul M.{{{space()}}} Juliato, Rudolf Adamkovič, - Sergey Nichiporchik, Shreyas Ragavan, Stefan Kangas, Stephen Berman, - Stephen Gildea, Steve Downey, Thanos Apollo, Tomasz Hołubowicz, - Utkarsh Singh, Vincent Murphy, Xinglu Chen, Yuanchen Xie, fluentpwn, - okamsn. + Daniel Mendler, David Edmondson, Eli Zaretskii, Eric Ottosson, + Frédéric Giquel, Fritz Grabo, Gautier Ponsinet, Illia Ostapyshyn, + Jacob S.{{{space()}}} Gordon, Jared Finder, Jimmy Yuen Ho Wong, + Kevin Fleming, Kévin Le Gouguec, Koen van Greevenbroek, Kostadin + Ninev, Leilei332, Madhavan Krishnan, Manuel Giraud, Markus Beppler, + Matthew Stevenson, Mauro Aranda, Nacho Barrientos, Niall Dooley, + Nicolas De Jaeghere, Paul David, Pavel Novichkov, Philip Kaludercic, + Pierre Téchoueyres, Rahul M.{{{space()}}} Juliato, Rudolf Adamkovič, + Sergey Nichiporchik, Shreyas Ragavan, Stefan x Kangas, Stephen + Berman, Stephen Gildea, Steve Downey, Suleyman Boyar, Thanos Apollo, + Tomasz Hołubowicz, Utkarsh Singh, Vincent Murphy, Xinglu Chen, + Yuanchen Xie, fluentpwn, okamsn. + Ideas and user feedback :: Aaron Jensen, Adam Porter, Adam Spiers, Adrian Manea, Aleksei Pirogov, Alex Griffin, Alex Koen, Alex Peitsinis, Alexandr Semenov, Alexey Shmalko, Alok Singh, Anders Johansson, André Alexandre Gomes, Andrew Tropin, Antonio Hernández - Blas, Arif Rezai, Augusto Stoffel, Basil L.{{{space()}}} - Contovounesios, Bernd Rellermeyer, Burgess Chang, Charlotte Van - Petegem, Christian Tietze, Christopher Dimech, Christopher League, - Damien Cassou, Daniel Mendler, Dario Gjorgjevski, David Edmondson, - Davor Rotim, Divan Santana, Eliraz Kedmi, Emanuele Michele Alberto - Monterosso, Farasha Euker, Feng Shu, Filippo Argiolas, Gautier - Ponsinet, Gerry Agbobada, Gianluca Recchia, Gonçalo Marrafa, - Guilherme Semente, Gustavo Barros, Hörmetjan Yiltiz, Ilja Kocken, - Imran Khan, Iris Garcia, Ivan Popovych, Jabir Ali Ouassou, James - Ferguson, Jeremy Friesen, Jerry Zhang, Johannes Grødem, John Haman, - John Wick, Jonas Collberg, Jorge Morais, Joshua O'Connor, Julio C. - Villasante, Kenta Usami, Kevin Fleming, Kévin Le Gouguec, Kevin - Kainan Li, Kostadin Ninev, Laith Bahodi, Lasse Lindner, Len Trigg, - Lennart C.{{{space()}}} Karssen, Luis Miguel Castañeda, Magne Hov, - Manuel Giraud, Manuel Uberti, Mark Bestley, Mark Burton, Mark - Simpson, Marko Kocic, Markus Beppler, Matt Armstrong, Matthias - Fuchs, Mattias Engdegård, Mauro Aranda, Maxime Tréca, Michael - Goldenberg, Morgan Smith, Morgan Willcock, Murilo Pereira, Nicky van - Foreest, Nicolas De Jaeghere, Nicolas Semrau, Olaf Meeuwissen, - Oliver Epper, Pablo Stafforini, Paul Poloskov, Pengji Zhang, Pete - Kazmier, Peter Wu, Philip Kaludercic, Pierre Téchoueyres, Przemysław - Kryger, Robert Hepple, Roman Rudakov, Russell Sim, Ryan Phillips, - Rytis Paškauskas, Rudolf Adamkovič, Sam Kleinman, Samuel Culpepper, - Saša Janiška, Shreyas Ragavan, Simon Pugnet, Steve Downey, Tassilo + Blas, Arif Rezai, Ashton Wiersdorf, Augusto Stoffel, Basil + L.{{{space()}}} Contovounesios, Bernd Rellermeyer, Burgess Chang, + Charlotte Van Petegem, Christian Tietze, Christopher Dimech, + Christopher League, Damien Cassou, Daniel Mendler, Dario + Gjorgjevski, David Edmondson, Davor Rotim, Divan Santana, Eliraz + Kedmi, Emanuele Michele Alberto Monterosso, Eshel Yaron, Farasha + Euker, Feng Shu, Filippo Argiolas, Gautier Ponsinet, Gerry Agbobada, + Gianluca Recchia, Gonçalo Marrafa, Guilherme Semente, Gustavo + Barros, Hörmetjan Yiltiz, Ilja Kocken, Imran Khan, Iris Garcia, Ivan + Popovych, Jabir Ali Ouassou, James Ferguson, Jeremy Friesen, Jerry + Zhang, Johannes Grødem, John Haman, John Sullivan, John Wick, Jonas + Collberg, Jorge Morais, Joshua O'Connor, Julio C. Villasante, Kenta + Usami, Kevin Fleming, Kévin Le Gouguec, Kevin Kainan Li, Kostadin + Ninev, Laith Bahodi, Lasse Lindner, Len Trigg, Lennart + C.{{{space()}}} Karssen, Luis Miguel Castañeda, Magne Hov, Manuel + Giraud, Manuel Uberti, Mark Bestley, Mark Burton, Mark Simpson, + Marko Kocic, Markus Beppler, Matt Armstrong, Matthias Fuchs, Mattias + Engdegård, Mauro Aranda, Maxime Tréca, Michael Goldenberg, Morgan + Smith, Morgan Willcock, Murilo Pereira, Nicky van Foreest, Nicolas + De Jaeghere, Nicolas Semrau, Olaf Meeuwissen, Oliver Epper, Pablo + Stafforini, Paul Poloskov, Pengji Zhang, Pete Kazmier, Peter Wu, + Philip Kaludercic, Pierre Téchoueyres, Przemysław Kryger, Robert + Hepple, Roman Rudakov, Russell Sim, Ryan Phillips, Rytis Paškauskas, + Rudolf Adamkovič, Sam Kleinman, Samuel Culpepper, Saša Janiška, + Shreyas Ragavan, Simon Pugnet, Stéphane Marks, Steve Downey, Tassilo Horn, Thanos Apollo, Thibaut Verron, Thomas Heartman, Togan Muftuoglu, Tony Zorman, Trey Merkley, Tomasz Hołubowicz, Toon Claes, Uri Sharf, Utkarsh Singh, Vincent Foley, Zoltan Kiraly. As well as users: Ben, CsBigDataHub1, Emacs Contrib, Eugene, Fourchaux, Fredrik, Moesasji, Nick, Summer Emacs, TheBlob42, TitusMu, Trey, - ZharMeny, bepolymathe, bit9tream, bangedorrunt, derek-upham, doolio, - fleimgruber, gitrj95, iSeeU, jixiuf, ltmsyvag, okamsn, - pedro-nonfree, pRot0ta1p, shipmints, soaringbird, tumashu, - wakamenod. + bepolymathe, bit9tream, bangedorrunt, case-lambda, chainedghost, + derek-upham, doolio, fleimgruber, gitrj95, iSeeU, jixiuf, ltmsyvag, + okamsn, pedro-nonfree, pRot0ta1p, shimeike, shipmints, soaringbird, + tumashu, wakamenod. + Packaging :: Basil L.{{{space()}}} Contovounesios, Eli Zaretskii, Glenn Morris, Mauro Aranda, Richard Stallman, Stefan Kangas (core diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 64dddad8290..d432325279c 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2025-07-31.19} +\def\texinfoversion{2025-10-25.20} % % Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc. % @@ -9952,7 +9952,7 @@ % node and anchor labels. And \xrdef uses it to construct the % lists of floats. % - \edef\tmp{\noexpand\setref{\floatlabel}{Yfloat}% + \edef\tmp{\noexpand\setref{\noexpand\floatlabel}{Yfloat}% {\floatmagic=\safefloattype}}% \tmp }% diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 7b3a4808a45..77f73196383 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -678,7 +678,10 @@ not auto loaded by Emacs. All examples require @value{tramp} to be installed and loaded: @lisp +@group +(require 'tramp) (customize-set-variable 'tramp-verbose 6 "Enable remote command traces") +@end group @end lisp For functions used to configure @value{tramp}, the following clause @@ -5363,7 +5366,7 @@ The package works successfully on @w{Emacs 28}, @w{Emacs 29}, @w{Emacs While Unix and Unix-like systems are the primary remote targets, @value{tramp} has equal success connecting to other platforms, such as -MS Windows 7/8/10. +MS Windows 10/11. @item @@ -5378,7 +5381,8 @@ responsiveness slows down. Some suggestions within the scope of @itemize @minus @item Use an external method, such as @option{scp}, which are faster than -internal methods for large files. +internal methods for large files. Set +@code{tramp-use-scp-direct-remote-copying} to non-@code{nil}. @item Keep the file @code{tramp-persistency-file-name}, which is where @@ -6844,6 +6848,11 @@ they are kept. Example: @end lisp @end defun +@findex tramp-expand-script +Shell scripts intended for the @code{tramp-sh} backend are used as a +format string. They must observe the restrictions for format +specifiers, as documented in @code{tramp-expand-script}. + @node Traces and Profiles @chapter How to Customize Traces diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 23104edd5d6..628fb741571 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -18,7 +18,7 @@ to look up issue github#1234, go to https://github.com/joaotavora/eglot/issues/1234. -* Changes in upcoming Eglot +* Changes in Eglot 1.19 (23/10/2025) ** Support for call and type hierarchies @@ -36,9 +36,9 @@ performance. ** Suggests code actions at point A commonly requested feature, Eglot will use ElDoc to ask the server for -code actions available at point, indicating to the user, who may use -execute them quickly via the usual 'eglot-code-actions' command. -Customize with 'eglot-code-action-indications' and +code actions available at point. This is indicated to the user, who may +quickly execute via the usual 'eglot-code-actions' command or with the +mouse. Customize with 'eglot-code-action-indications' and 'eglot-code-action-indicator'. ** Mode line is customizable @@ -49,10 +49,10 @@ or removing symbols and strings from the customizable variable ** Improved diagnostic-reporting performance and bugfixes (bug#77588) -Eglot remembers the LSP document version to which diagonstics reported -by the LSP server pertain. This helps in skipping useless or harmful -updates, avoiding flakiness with code actions and flickering overlays -when the buffer is changed. +Eglot remembers the LSP document version pertaining to the diagnostics +reported by the LSP server. This helps in skipping useless or confusing +diagnostic updates, avoids flakiness with code actions and prevents +flickering overlays when the buffer is changed. ** Markdown links migrating to *eldoc* buffer now clickable (bug#79552) @@ -60,6 +60,12 @@ Eglot now preserves crucial properties in the Markdown documentation provided by the LSP server, fixing a longstanding bug with clickable hyperlinks. See also github#1238. +** Compliant shutdown requests (bug#79653, bug#66144, github#1540) + +Eglot now complies with the latest LSP spec, which mandates that the +shutdown request mustn't have any parameters. This should fix problems +with some servers. + * Changes in Eglot 1.18 (20/1/2025) diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS index 513ed8f706d..932b7a58aa7 100644 --- a/etc/ERC-NEWS +++ b/etc/ERC-NEWS @@ -11,6 +11,20 @@ This file is about changes in ERC, the powerful, modular, and extensible IRC (Internet Relay Chat) client distributed with GNU Emacs since Emacs version 22.1. + +* Changes in ERC 5.6.2 + +** Changes in the library API. + +*** Accessors like 'erc-channel-user-voice' may ignore assignments. +ERC now silently ignores attempts to enable certain status flags on +'erc-channel-user' objects if the connection's "PREFIX" parameter omits +them. In the future, ERC will likely signal an error if such an attempt +is made. Users can preview this potentially disruptive behavior by +setting the new variable 'erc-channel-user-signal-if-status-unknown' to +t. This change stems from a bug fix for a regression affecting ERC 5.6 +and 5.6.1 in which these accessors mishandled unsupported flags. + * Changes in ERC 5.6.1 diff --git a/etc/NEWS b/etc/NEWS index 126a17ceb8a..7168cc5bb92 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -277,6 +277,15 @@ minibuffer window using the 'minibuffer-nonselected' face in case when the minibuffer window is no longer selected, but the minibuffer is still waiting for input. ++++ +*** 'read-multiple-choice' now uses the minibuffer to read a character. +It still can use 'read-key' when the variable +'read-char-choice-use-read-key' is non-nil. + +*** 'map-y-or-n-p' now uses the minibuffer to read a character. +It still can use 'read-key' when the variable +'y-or-n-p-use-read-key' is non-nil. + ** Mouse *** New mode 'mouse-shift-adjust-mode' extends selection with 'S-'. @@ -435,6 +444,21 @@ This will inhibit implied resizing while a new frame is made and can be useful on tiling window managers where the initial frame size should be specified by external means. ++++ +*** New option 'alter-fullscreen-frames'. +This option is useful to maintain a consistent state when attempting to +resize fullscreen frames. It defaults to 'inhibit' on NS builds which +means that a fullscreen frame would not change size. It defaults to nil +everywhere else which means that the window manager is supposed to +either resize the frame and change the fullscreen status accordingly or +keep the frame size unchanged. The value t means to first reset the +fullscreen status and then resize the frame. + +--- +*** Frames can now be renamed to F on text terminals. +Unlike with other frame names, an attempt to rename to F throws +an error when a frame of that name already exists. + ** Mode Line +++ @@ -666,6 +690,12 @@ or strings. If set to 'on-mismatch', mismatched parens inside comments and strings will not be highlighted. If set to nil (the default), highlight the parens wherever they are. ++++ +** New user option 'view-lossage-auto-refresh'. +If this option is non-nil, the lossage buffer in 'view-lossage' will be +refreshed automatically for each new input keystroke and command +performed. + ** Change in SVG foreground color handling. SVG images no longer have the 'fill' attribute set to the value of ':foreground' or the current text foreground color. The 'currentcolor' @@ -685,6 +715,12 @@ debugger and show the backtrace. If 'debug-on-error' is nil, these errors will be sent to 'emacsclient', as before, and will be displayed on the terminal from which 'emacsclient' was invoked. ++++ +** Empty string arguments to emacsclient are no longer ignored. +Emacs previously discarded arguments to emacsclient of zero length, such +as in 'emacsclient --eval "(length (pop server-eval-args-left))" ""'. +These are no longer discarded. + * Editing Changes in Emacs 31.1 @@ -1025,6 +1061,18 @@ Now 'treesit-explore-mode' (or 'treesit-explore') prompts for a parser rather than a language, and it is now possible to select a local parser at point to explore. ++++ +*** Tree-sitter query predicate :equal, :match, and :pred are deprecated +Use :eq?, :match?, :pred? instead. The change is because newer +tree-sitter library mandates query predicates to end with question mark. +Emacs will transparently converts :equal, :match and :pred to :eq?, +:match? and :pred?, respectively, so existing queries still work fine +with latest tree-sitter library. Predicate :equal is changed to :eq? to +better follow tree-sitter’s convention. Also, the :match? predicates +can now take the regexp as either the first or second argument, so it +works with both tree-sitter convention (regexp arg second) and Emacs +convention (regexp arg first). + ** Hideshow +++ @@ -1057,6 +1105,21 @@ The new icons 'hs-indicator-show' and 'hs-indicator-hide' can be used to customize the indicators appearance only if 'hs-indicator-type' is set to 'margin' or nil. ++++ +*** New user option 'hs-hide-block-behavior'. +This user option controls how 'hs-hide-block' and 'hs-toggle-hiding' +should hide a block. If set to 'after-bol', hide the innermost block to +which the current line belongs. If set to 'after-cursor', hide the block +after cursor position. By default this is set to 'after-bol'. + ++++ +*** The variable 'hs-special-modes-alist' is now obsolete. +Instead of customizing Hideshow for a mode by setting the elements of +'hs-special-modes-alist', such as START, COMMENT-START, +FORWARD-SEXP-FUNC, etc., major mode authors should set the corresponding +buffer-local variables 'hs-block-start-regexp', 'hs-c-start-regexp', +'hs-forward-sexp-function', etc. + ** C-ts mode +++ @@ -1928,6 +1991,10 @@ the Tramp manual. ** Diff +--- +*** 'diff-mode' now refrains from automatically refining big hunks. +What is big is defined by the new 'diff-refine-threshold' variable. + --- *** New command 'diff-kill-ring-save'. This command copies to the 'kill-ring' a region of text modified @@ -1963,6 +2030,13 @@ They suggest the previous revision as the default for REV1, not the last one as before. This makes them different from 'vc-diff' and 'vc-root-diff' when those are called without a prefix argument. ++++ +*** 'diff-apply-buffer' now considers the region and can reverse-apply. +If the region is active, this command now applies all hunks that the +region overlaps; otherwise, it applies all hunks. +With a prefix argument, it now reverse-applies the hunks. +This matches the existing prefix argument to 'diff-apply-hunk'. + ** Ediff +++ @@ -2035,6 +2109,24 @@ name of the directory now reverts the Dired buffer. With a new value of the prefix argument (1), this command copies file names relative to the root directory of the current project. ++++ +*** Warning when Dired displays a file name with a literal newline. +On visiting a directory that contains a file whose name has a newline, +and Dired displays that character as a literal newline, Emacs now +automatically pops up a buffer warning that such a display can be +problematic for Dired and showing a way to change the display to use the +unproblematic character '\n'. + ++++ +*** New user option 'dired-auto-toggle-b-switch'. +When this user option is non-nil and 'dired-listing-switches' does not +include the '-b' switch, then on visiting a directory containing a file +whose name has a newline, Emacs automatically adds the '-b' switch and +redisplays the directory in Dired to show '\n' in the file name instead +of a literal newline. This prevents executing many Dired operations on +such a file from failing and signaling an error. The default value of +this user option is nil. + ** Grep +++ @@ -2445,15 +2537,6 @@ View mode, copies to the kill ring the ID of the revision at point in the log entry. If there are marked revisions, it copies the IDs of those, instead. -** Diff mode - -+++ -*** 'diff-apply-buffer' now considers the region and can reverse-apply. -If the region is active, this command now applies all hunks that the -region overlaps; otherwise, it applies all hunks. -With a prefix argument, it now reverse-applies the hunks. -This matches the existing prefix argument to 'diff-apply-hunk'. - ** Package +++ @@ -2610,7 +2693,7 @@ Meant to be given a global binding convenient to the user. Example: - 'speedbar-prefer-window' tells 'speedbar' to open a side window instead of a frame. -- 'speedbar-dedicated-window' defines whether the 'speedbar' is +- 'speedbar-window-dedicated-window' defines whether 'speedbar' is displayed in a dedicated window. - 'speedbar-window-default-width' defines the initial width of the 'speedbar-window'. @@ -2644,6 +2727,13 @@ New faces have been added to 'icomplete-vertical-mode': ** Customize ++++ +*** New function 'custom-initialize-after-file-load'. +Useful to delay initialization to the end of the file, so it can use +functions defined later than the variable, as is common for minor modes. +'define-globalized-minor-mode' now automatically uses it if the +init-value is non-nil. + --- *** New major mode 'Customize-dirlocals-mode'. This is intended for customizing directory-local variables in the @@ -2792,6 +2882,10 @@ The tabulated listings produced by 'flymake-show-buffer-diagnostics' and 'flymake-show-project-diagnostics' now automatically adjust their column widths based on content, optimizing display space and readability. +*** New value 'auto' of user option 'flymake-indicator-type'. +This value set by default tries to use fringes if possible, +otherwise falls back to margins. + *** New user option 'elisp-flymake-byte-compile-executable'. This allows customizing the Emacs executable used for Flymake byte compilation in 'emacs-lisp-mode'. This option should be set when editing @@ -2913,6 +3007,92 @@ CPerl mode creates imenu entries for ":writer" generated accessors and recognizes the new functions "all" and "any". See https://perldoc.perl.org/5.42.0/perldelta for details. +** Zone +Zone can scramble multiple windows across multiple frames; it may also +reorganize frames to be a single window. As before, when a key or mouse +event occurs, all of the frames and windows are restored to their +original state. This is controlled by three new customization flags +which control the use of frames and windows beyond the currently active +ones. It is identifies suitable buffers for zoning out so that +potentially important buffer contents are not exposed. + +When a zone program encounters an error, it will apologize for a minute +and then start a new round of zoning. Previously, it just kept +apologizing. Finally, zone does not pollute the *Messages* buffer with +extraneous messages. + +**** New function 'zone-add-program' +This function accepts a symbol, whose name starts with "zone-pgm-", that +runs a zone program when 'zone' is invoked. It adds the program to the +'zone-programs' vector if it is not already present.'' + +**** New functipon 'zone-remove-program' +This function removes a program from the 'zone-programs' vector. If the +parameter is a symbol, and the symbol is present in the vector, it is +removed. If the parameter is a string, it is a regular expression that +will remove any programs whose name matches the parameter pattern. + +*** Multi-window and -frame customization options +Prior to this update, zone would only (safely) scramble the contents of +the current window on the current frame. Now, with the use of these +three options, it is possible to scramble to contents of all windows +across all frames. It is also possible to make frames single window +displays while zoning. But when zoning is interrupted by a key- or +mouse-press, the original window layout across all frames is restored. + +**** New user option 'zone-delete-other-windows' +When non-nil, the frame is made into a single full frame window to hold +the zoned buffer. If all frames were to be used (`zone-all-frames' set +to non-nil), then all frames are converted to single window frames. + +**** New user option 'zone-all-frames' +When non-nil, zone will appear on all visible frames. While the buffer +scrambling will appear on each frame, it will be the same buffer so they +will all behave the same way. + +**** New user option 'zone-all-windows-in-frame' +When non-nil, the zoned buffer will be mapped to all of the windows +present on the frame. If the option is nil, then only the selected +window will show the zoned buffer. Note, however, that each window +holding the zoned buffer is showing the same zoned buffer. + +*** Selecting source buffers suitable for zoning +When the idle timer, or the user, invokes `zone', the current buffer may +not be appropriate as the source of the zone buffer. For example, +encrypted buffers, empty buffers, or specialized buffers like +`*Messages*' probably shouldn't have their content splashed across zoned +windows. So the selection of a suitable buffer for zoning can be controlled with a variable that identifies buffers with concerns. + +**** New variable 'zone-ignored-buffers' +The variable is a list of criteria for excluding a buffer from +consideration as the source of zoning. The list has entries that are +tested against each buffer until a suitable one is found. The criteria +can be a symbol that ends in `-mode' which excludes buffers that are in +a mode derived from the specified mode. It may also be a function-bound +symbol or lambda expression that is called with a buffer that returns a +non-nil value if it should not be the zone source. Finally, an entry +can also be a regular expression string that must not match the buffer's +name. + +Initially, the list excludes buffers in a special-mode, in an +image-mode, contains an encrypted file, is an empty buffer, is a hidden +buffer, or is the `*scratch*' buffer. If it cannot locate any +acceptable buffers, it will begrudgingly use the scratch buffer. + +*** Zone hooks +Hooks have been added to notify programs of the start and end of zone activity. For example, you may want to credit time spent zoning as a Pomodoro break. + +**** New hook 'zone-start-hook' +This hook contains functions that are invoked when zoning is about to begin. + +**** New hook 'zone-finish-hook' +This hook contains functions that are invoked when zoning has finished. + +**** New variable 'zone-time-elapsed-while-zoning' +This is the elapsed time between the start and finish hooks. So this +represents how long Emacs was zoning. Zone calculates this so that the +finish hook can communicate this to other modes if necessary. + * New Modes and Packages in Emacs 31.1 @@ -2965,6 +3145,16 @@ Other functions that use 'aset' to modify string data, such as 'subst-char-in-string' with a non-nil INPLACE argument, will signal an error if called with arguments that would violate these rules. ++++ +** More program constants are combined by the compiler. +The compiler now unifies more constants that are 'equal' for better code +generation. This does not affect correct programs but may expose some +coding mistakes. For example, + + (eq (cdr '(1 2 3)) '(2 3))) + +may return either nil or t. + ** Nested backquotes are not supported any more in Pcase patterns. --- @@ -3071,6 +3261,16 @@ See the new argument in 'make-thread'. The default value allows the thread's current buffer to be killed by another thread. This does not apply to the main thread's buffer. +--- +** Defining or modifying a face so that it inherits from itself signals error. +Calling any function that defines or modifies a face in a way that +causes cyclical inheritance (i.e., the face inherits from itself, either +directly or indirectly) now signals an error. Previously, Lisp programs +could get away with this, and the problem would either be detected at +display time or even cause Emacs to hang trying to display such a face. +Affected APIs include 'defface', 'set-face-attribute', their callers, +and other similar functions. + * Lisp Changes in Emacs 31.1 @@ -3134,6 +3334,15 @@ and signal an error if they are given a non-number. They return non-nil if an integer is odd or even, respectively, and signal an error if they are given a non-integer. ++++ +** New functions 'drop-while' and 'take-while'. +These work like 'drop' and 'take' but use a predicate instead of counting. + ++++ +** New functions 'any' and 'all'. +These return non-nil for lists where any and all elements, respectively, +satisfy a given predicate. + +++ ** The 'defvar-local' macro second argument is now optional. This means that you can now call it with just one argument, like @@ -3340,6 +3549,12 @@ This is an abbreviation for using the name of the keymap as the prefix command name. E.g., '(defvar-keymap foo-map :prefix t)' is equivalent to '(defvar-keymap foo-map :prefix 'foo-map)'. +--- +** Emacs PGTK toolkit respects dark and light modes. +Emacs when built with the pure GTK toolkit now respects desktop +dark and light modes for drawing a GTK toolbar and widgets, +automatically toggling between them. + * Changes in Emacs 31.1 on Non-Free Operating Systems diff --git a/etc/PROBLEMS b/etc/PROBLEMS index be023b3d5ce..ff9c0105cb3 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1304,7 +1304,7 @@ Emacs will select some other font instead. The only workaround is not to choose such font variants as the default font when running Emacs on MS-Windows. -** On OpenBSD, color Emoji are not supported by default. +** On OpenBSD before version 7.8, color Emoji are not supported by default. The system's FreeType library is not built with libpng support, so it can't display color emoji. This is due to the fact that, on OpenBSD, @@ -1324,6 +1324,7 @@ following those steps: 5. Build and install Xenocara (also, see release(8)). Note that this support will be gone after each OpenBSD's system upgrade. +Also note that upgrading to OpenBSD 7.8 solves this whole issue. * Internationalization problems diff --git a/etc/TODO b/etc/TODO index 0700452b757..40cfbbb85d7 100644 --- a/etc/TODO +++ b/etc/TODO @@ -547,6 +547,34 @@ One way of doing this is to start with fx's dynamic loading, and use it to implement things like auto-loaded buffer parsers and database access in cases which need more than Lisp. +** In Info, support image files generated from @math expressions +See this discussion on the Texinfo mailing list for the details: + + https://lists.gnu.org/archive/html/bug-texinfo/2024-12/msg00061.html + https://lists.gnu.org/archive/html/bug-texinfo/2025-01/msg00004.html + https://lists.gnu.org/archive/html/bug-texinfo/2025-11/msg00002.html + +The job here is to figure out the image attributes that will produce +good-looking display of math formulas in images created by LaTeX from +Texinfo @math elements. The above discussion concluded that just +showing these images as any other image sometimes produces misaligned +display and sometimes the size of the image needs tweaking to make it +similar to the default face's font used for showing the text in Info +buffers. The assumption is that using some non-default attributes of +image specs, like :ascent, :margin, and :height, and perhaps also using +:scale with the value 'auto', should be able to improve the display. +The conclusions should be communicated to the Texinfo developers, so +that 'makeinfo' could embed the necessary image attributes in the Info +output it produces from @math. + +The function in info.el which handles image display is +'Info-display-images-node'. + +The message below in Texinfo mailing list archives includes files that +could be used to work in this feature: + + https://lists.gnu.org/archive/html/bug-texinfo/2025-11/msg00012.html + ** Imenu could be extended into a file-structure browsing mechanism This could use code like that of customize-groups. diff --git a/etc/themes/modus-operandi-deuteranopia-theme.el b/etc/themes/modus-operandi-deuteranopia-theme.el index 2d6d4120f70..1617b933676 100644 --- a/etc/themes/modus-operandi-deuteranopia-theme.el +++ b/etc/themes/modus-operandi-deuteranopia-theme.el @@ -26,490 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-operandi-deuteranopia - "Deuteranopia-optimized theme with a white background. -This variant is optimized for users with red-green color -deficiency (deuteranopia). It conforms with the highest -legibility standard for color contrast between background and -foreground in any given piece of text, which corresponds to a -minimum contrast in relative luminance of 7:1 (WCAG AAA -standard)." - :background-mode 'light - :kind 'color-scheme - :family 'modus) - - (defconst modus-operandi-deuteranopia-palette - '( -;;; Basic values - - (bg-main "#ffffff") - (bg-dim "#f2f2f2") - (fg-main "#000000") - (fg-dim "#595959") - (fg-alt "#193668") - (bg-active "#c4c4c4") - (bg-inactive "#e0e0e0") - (border "#9f9f9f") - -;;; Common accent foregrounds - - (red "#a60000") - (red-warmer "#972500") - (red-cooler "#a0132f") - (red-faint "#7f0000") - (red-intense "#d00000") - (green "#006800") - (green-warmer "#316500") - (green-cooler "#00663f") - (green-faint "#2a5045") - (green-intense "#008900") - (yellow "#695500") - (yellow-warmer "#973300") - (yellow-cooler "#77492f") - (yellow-faint "#624416") - (yellow-intense "#808000") - (blue "#0031a9") - (blue-warmer "#3548cf") - (blue-cooler "#0000b0") - (blue-faint "#003497") - (blue-intense "#0000ff") - (magenta "#721045") - (magenta-warmer "#8f0075") - (magenta-cooler "#531ab6") - (magenta-faint "#7c318f") - (magenta-intense "#dd22dd") - (cyan "#005e8b") - (cyan-warmer "#3f578f") - (cyan-cooler "#005f5f") - (cyan-faint "#005077") - (cyan-intense "#008899") - -;;; Uncommon accent foregrounds - - (rust "#8a290f") - (gold "#80601f") - (olive "#56692d") - (slate "#2f3f83") - (indigo "#4a3a8a") - (maroon "#731c52") - (pink "#7b435c") - -;;; Common accent backgrounds - - (bg-red-intense "#ff8f88") - (bg-green-intense "#8adf80") - (bg-yellow-intense "#f3d000") - (bg-blue-intense "#bfc9ff") - (bg-magenta-intense "#dfa0f0") - (bg-cyan-intense "#a4d5f9") - - (bg-red-subtle "#ffcfbf") - (bg-green-subtle "#b3fabf") - (bg-yellow-subtle "#fff576") - (bg-blue-subtle "#ccdfff") - (bg-magenta-subtle "#ffddff") - (bg-cyan-subtle "#bfefff") - - (bg-red-nuanced "#ffe8e8") - (bg-green-nuanced "#e0f6e0") - (bg-yellow-nuanced "#f8f0d0") - (bg-blue-nuanced "#ecedff") - (bg-magenta-nuanced "#f8e6f5") - (bg-cyan-nuanced "#e0f2fa") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#f1c8b5") - (fg-clay "#63192a") - - (bg-ochre "#f0e3c0") - (fg-ochre "#573a30") - - (bg-lavender "#dfcdfa") - (fg-lavender "#443379") - - (bg-sage "#c0e7d4") - (fg-sage "#124b41") - -;;; Graphs - - (bg-graph-red-0 "#d0b029") - (bg-graph-red-1 "#e0cab4") - (bg-graph-green-0 "#8ac050") - (bg-graph-green-1 "#afdfa5") - (bg-graph-yellow-0 "#ffcf00") - (bg-graph-yellow-1 "#f9ff00") - (bg-graph-blue-0 "#7f9fff") - (bg-graph-blue-1 "#afd0ff") - (bg-graph-magenta-0 "#b0b0d0") - (bg-graph-magenta-1 "#d0dfdf") - (bg-graph-cyan-0 "#6faad9") - (bg-graph-cyan-1 "#bfe0ff") - -;;; Special purpose - - (bg-completion "#c0deff") - (bg-hover "#b2e4dc") - (bg-hover-secondary "#e5d7a0") - (bg-hl-line "#dae5ec") - (bg-region "#bdbdbd") - (fg-region "#000000") - - (bg-mode-line-active "#d0d6ff") - (fg-mode-line-active "#0f0f0f") - (border-mode-line-active "#4f4f74") - (bg-mode-line-inactive "#e6e6e6") - (fg-mode-line-inactive "#585858") - (border-mode-line-inactive "#a3a3a3") - - (modeline-err "#603a00") - (modeline-warning "#454500") - (modeline-info "#023d92") - - (bg-tab-bar "#dfdfdf") - (bg-tab-current "#ffffff") - (bg-tab-other "#c2c2c2") - -;;; Diffs - - (bg-added "#d5d7ff") - (bg-added-faint "#e6e6ff") - (bg-added-refine "#babcef") - (bg-added-fringe "#275acc") - (fg-added "#303099") - (fg-added-intense "#0303cc") - - (bg-changed "#eecfdf") - (bg-changed-faint "#f0dde5") - (bg-changed-refine "#e0b0d0") - (bg-changed-fringe "#9f6ab0") - (fg-changed "#6f1343") - (fg-changed-intense "#7f0f9f") - - (bg-removed "#f4f099") - (bg-removed-faint "#f6f6b7") - (bg-removed-refine "#ede06f") - (bg-removed-fringe "#c0b200") - (fg-removed "#553d00") - (fg-removed-intense "#7f6f00") - - (bg-diff-context "#f3f3f3") - -;;; Paren match - - (bg-paren-match "#5fcfff") - (fg-paren-match fg-main) - (bg-paren-expression "#efd3f5") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor blue-intense) - - (keybind blue-cooler) - (name blue-cooler) - (identifier yellow-faint) - - (err yellow-warmer) - (warning yellow) - (info blue) - - (underline-err yellow-intense) - (underline-warning magenta-faint) - (underline-note cyan) - - (bg-prominent-err bg-yellow-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-magenta-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-yellow-nuanced) - (fg-active-argument yellow-warmer) - (bg-active-value bg-blue-nuanced) - (fg-active-value blue-warmer) - -;;;; Code mappings - - (bracket fg-main) - (builtin yellow) - (comment yellow-cooler) - (constant blue-faint) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring green-faint) - (fnname yellow-warmer) - (keyword blue-cooler) - (number fg-main) - (operator fg-main) - (preprocessor magenta-cooler) - (property cyan) - (punctuation fg-main) - (rx-backslash blue-cooler) - (rx-construct yellow-cooler) - (string blue-warmer) - (type cyan-cooler) - (variable cyan) - -;;;; Accent mappings - - (accent-0 blue-warmer) - (accent-1 yellow-warmer) - (accent-2 cyan) - (accent-3 yellow-cooler) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 blue-warmer) - (fg-completion-match-1 yellow-warmer) - (fg-completion-match-2 cyan) - (fg-completion-match-3 yellow-cooler) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan) - (date-deadline yellow-warmer) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday yellow-warmer) - (date-holiday-other blue) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled yellow-cooler) - (date-scheduled-subtle yellow-faint) - (date-weekday cyan) - (date-weekend blue-cooler) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link blue-warmer) - (bg-link unspecified) - (underline-link blue-warmer) - - (fg-link-symbolic cyan) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan) - - (fg-link-visited yellow-faint) - (bg-link-visited unspecified) - (underline-link-visited yellow-faint) - -;;;; Mail mappings - - (mail-cite-0 blue-warmer) - (mail-cite-1 yellow) - (mail-cite-2 cyan-faint) - (mail-cite-3 yellow-faint) - (mail-part blue) - (mail-recipient blue) - (mail-subject yellow-cooler) - (mail-other cyan-faint) - -;;;; Mark mappings - - (bg-mark-delete bg-yellow-subtle) - (fg-mark-delete yellow) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-magenta-subtle) - (fg-mark-other magenta) - -;;;; Prompt mappings - - (fg-prompt blue) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan-cooler) - - (bg-prose-macro unspecified) - (fg-prose-macro magenta-cooler) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim yellow) - - (prose-done blue) - (prose-todo yellow-warmer) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula yellow-warmer) - - (prose-tag fg-alt) - -;;;; Rainbow mappings - - (rainbow-0 blue) - (rainbow-1 yellow) - (rainbow-2 blue-warmer) - (rainbow-3 yellow-cooler) - (rainbow-4 blue-cooler) - (rainbow-5 yellow-warmer) - (rainbow-6 blue-faint) - (rainbow-7 yellow-faint) - (rainbow-8 cyan) - -;;;; Search mappings - - (bg-search-current bg-yellow-intense) - (bg-search-lazy bg-blue-intense) - (bg-search-replace bg-yellow-intense) - - (bg-search-rx-group-0 bg-cyan-intense) - (bg-search-rx-group-1 bg-magenta-intense) - (bg-search-rx-group-2 bg-blue-subtle) - (bg-search-rx-group-3 bg-yellow-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-yellow-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 yellow-faint) - (fg-heading-3 blue-faint) - (fg-heading-4 green-faint) - (fg-heading-5 magenta-cooler) - (fg-heading-6 yellow-cooler) - (fg-heading-7 cyan) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-operandi-deuteranopia' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-operandi-deuteranopia-palette-user nil - "Like the `modus-operandi-deuteranopia-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-operandi-deuteranopia-palette-user nil + "Like the `modus-operandi-deuteranopia-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-operandi-deuteranopia-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-operandi-deuteranopia-palette-overrides nil - "Overrides for `modus-operandi-deuteranopia-palette'. +(defcustom modus-operandi-deuteranopia-palette-overrides nil + "Overrides for `modus-operandi-deuteranopia-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -523,18 +68,25 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-operandi-deuteranopia - modus-operandi-deuteranopia-palette - modus-operandi-deuteranopia-palette-overrides) - - (provide-theme 'modus-operandi-deuteranopia)) +(modus-themes-theme + 'modus-operandi-deuteranopia + 'modus-themes + "Deuteranopia-optimized theme with a white background. +This variant is optimized for users with red-green color +deficiency (deuteranopia). It conforms with the highest +legibility standard for color contrast between background and +foreground in any given piece of text, which corresponds to a +minimum contrast in relative luminance of 7:1 (WCAG AAA +standard)." + 'light + 'modus-themes-operandi-deuteranopia-palette + 'modus-operandi-deuteranopia-palette-user + 'modus-operandi-deuteranopia-palette-overrides) ;;; modus-operandi-deuteranopia-theme.el ends here diff --git a/etc/themes/modus-operandi-theme.el b/etc/themes/modus-operandi-theme.el index 2de59012e44..e9eb67c2a93 100644 --- a/etc/themes/modus-operandi-theme.el +++ b/etc/themes/modus-operandi-theme.el @@ -26,488 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-operandi - "Elegant, highly legible theme with a white background. -Conforms with the highest legibility standard for color contrast -between background and foreground in any given piece of text, -which corresponds to a minimum contrast in relative luminance of -7:1 (WCAG AAA standard)." - :background-mode 'light - :kind 'color-scheme - :family 'modus) - - (defconst modus-operandi-palette - '( -;;; Basic values - - (bg-main "#ffffff") - (bg-dim "#f2f2f2") - (fg-main "#000000") - (fg-dim "#595959") - (fg-alt "#193668") - (bg-active "#c4c4c4") - (bg-inactive "#e0e0e0") - (border "#9f9f9f") - -;;; Common accent foregrounds - - (red "#a60000") - (red-warmer "#972500") - (red-cooler "#a0132f") - (red-faint "#7f0000") - (red-intense "#d00000") - (green "#006800") - (green-warmer "#316500") - (green-cooler "#00663f") - (green-faint "#2a5045") - (green-intense "#008900") - (yellow "#6f5500") - (yellow-warmer "#884900") - (yellow-cooler "#7a4f2f") - (yellow-faint "#624416") - (yellow-intense "#808000") - (blue "#0031a9") - (blue-warmer "#3548cf") - (blue-cooler "#0000b0") - (blue-faint "#003497") - (blue-intense "#0000ff") - (magenta "#721045") - (magenta-warmer "#8f0075") - (magenta-cooler "#531ab6") - (magenta-faint "#7c318f") - (magenta-intense "#dd22dd") - (cyan "#005e8b") - (cyan-warmer "#3f578f") - (cyan-cooler "#005f5f") - (cyan-faint "#005077") - (cyan-intense "#008899") - -;;; Uncommon accent foregrounds - - (rust "#8a290f") - (gold "#80601f") - (olive "#56692d") - (slate "#2f3f83") - (indigo "#4a3a8a") - (maroon "#731c52") - (pink "#7b435c") - -;;; Common accent backgrounds - - (bg-red-intense "#ff8f88") - (bg-green-intense "#8adf80") - (bg-yellow-intense "#f3d000") - (bg-blue-intense "#bfc9ff") - (bg-magenta-intense "#dfa0f0") - (bg-cyan-intense "#a4d5f9") - - (bg-red-subtle "#ffcfbf") - (bg-green-subtle "#b3fabf") - (bg-yellow-subtle "#fff576") - (bg-blue-subtle "#ccdfff") - (bg-magenta-subtle "#ffddff") - (bg-cyan-subtle "#bfefff") - - (bg-red-nuanced "#ffe8e8") - (bg-green-nuanced "#e0f6e0") - (bg-yellow-nuanced "#f8f0d0") - (bg-blue-nuanced "#ecedff") - (bg-magenta-nuanced "#f8e6f5") - (bg-cyan-nuanced "#e0f2fa") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#f1c8b5") - (fg-clay "#63192a") - - (bg-ochre "#f0e3c0") - (fg-ochre "#573a30") - - (bg-lavender "#dfcdfa") - (fg-lavender "#443379") - - (bg-sage "#c0e7d4") - (fg-sage "#124b41") - -;;; Graphs - - (bg-graph-red-0 "#ef7969") - (bg-graph-red-1 "#ffaab4") - (bg-graph-green-0 "#45c050") - (bg-graph-green-1 "#75ef30") - (bg-graph-yellow-0 "#ffcf00") - (bg-graph-yellow-1 "#f9ff00") - (bg-graph-blue-0 "#7f90ff") - (bg-graph-blue-1 "#a6c0ff") - (bg-graph-magenta-0 "#e07fff") - (bg-graph-magenta-1 "#fad0ff") - (bg-graph-cyan-0 "#70d3f0") - (bg-graph-cyan-1 "#afefff") - -;;; Special purpose - - (bg-completion "#c0deff") - (bg-hover "#b2e4dc") - (bg-hover-secondary "#f5d0a0") - (bg-hl-line "#dae5ec") - (bg-region "#bdbdbd") - (fg-region "#000000") - - (bg-mode-line-active "#c8c8c8") - (fg-mode-line-active "#000000") - (border-mode-line-active "#5a5a5a") - (bg-mode-line-inactive "#e6e6e6") - (fg-mode-line-inactive "#585858") - (border-mode-line-inactive "#a3a3a3") - - (modeline-err "#7f0000") - (modeline-warning "#5f0070") - (modeline-info "#002580") - - (bg-tab-bar "#dfdfdf") - (bg-tab-current "#ffffff") - (bg-tab-other "#c2c2c2") - -;;; Diffs - - (bg-added "#c1f2d1") - (bg-added-faint "#d8f8e1") - (bg-added-refine "#aee5be") - (bg-added-fringe "#6cc06c") - (fg-added "#005000") - (fg-added-intense "#006700") - - (bg-changed "#ffdfa9") - (bg-changed-faint "#ffefbf") - (bg-changed-refine "#fac090") - (bg-changed-fringe "#d7c20a") - (fg-changed "#553d00") - (fg-changed-intense "#655000") - - (bg-removed "#ffd8d5") - (bg-removed-faint "#ffe9e9") - (bg-removed-refine "#f3b5af") - (bg-removed-fringe "#d84a4f") - (fg-removed "#8f1313") - (fg-removed-intense "#aa2222") - - (bg-diff-context "#f3f3f3") - -;;; Paren match - - (bg-paren-match "#5fcfff") - (fg-paren-match fg-main) - (bg-paren-expression "#efd3f5") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor fg-main) - - (keybind blue-cooler) - (name magenta) - (identifier yellow-cooler) - - (err red) - (warning yellow-warmer) - (info cyan-cooler) - - (underline-err red-intense) - (underline-warning yellow-intense) - (underline-note cyan-intense) - - (bg-prominent-err bg-red-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-yellow-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-yellow-nuanced) - (fg-active-argument yellow-warmer) - (bg-active-value bg-cyan-nuanced) - (fg-active-value cyan-warmer) - -;;;; Code mappings - - (bracket fg-main) - (builtin magenta-warmer) - (comment fg-dim) - (constant blue-cooler) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring green-faint) - (fnname magenta) - (keyword magenta-cooler) - (number fg-main) - (operator fg-main) - (preprocessor red-cooler) - (property cyan) - (punctuation fg-main) - (rx-backslash magenta) - (rx-construct green-cooler) - (string blue-warmer) - (type cyan-cooler) - (variable cyan) - -;;;; Accent mappings - - (accent-0 blue) - (accent-1 magenta-warmer) - (accent-2 cyan) - (accent-3 red) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 blue) - (fg-completion-match-1 magenta-warmer) - (fg-completion-match-2 cyan) - (fg-completion-match-3 red) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan) - (date-deadline red-cooler) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday red) - (date-holiday-other blue) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled yellow) - (date-scheduled-subtle yellow-faint) - (date-weekday cyan) - (date-weekend magenta) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link blue-warmer) - (bg-link unspecified) - (underline-link blue-warmer) - - (fg-link-symbolic cyan) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan) - - (fg-link-visited magenta) - (bg-link-visited unspecified) - (underline-link-visited magenta) - -;;;; Mail mappings - - (mail-cite-0 blue-faint) - (mail-cite-1 yellow-warmer) - (mail-cite-2 cyan-cooler) - (mail-cite-3 red-cooler) - (mail-part cyan) - (mail-recipient magenta-cooler) - (mail-subject magenta-warmer) - (mail-other magenta-faint) - -;;;; Mark mappings - - (bg-mark-delete bg-red-subtle) - (fg-mark-delete red) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-yellow-subtle) - (fg-mark-other yellow) - -;;;; Prompt mappings - - (fg-prompt cyan-cooler) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan-cooler) - - (bg-prose-macro unspecified) - (fg-prose-macro magenta-cooler) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim magenta-warmer) - - (prose-done green) - (prose-todo red) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula magenta-warmer) - - (prose-tag magenta-faint) - -;;;; Rainbow mappings - - (rainbow-0 fg-main) - (rainbow-1 magenta-intense) - (rainbow-2 cyan-intense) - (rainbow-3 red-warmer) - (rainbow-4 yellow-intense) - (rainbow-5 magenta-cooler) - (rainbow-6 green-intense) - (rainbow-7 blue-warmer) - (rainbow-8 magenta-warmer) - -;;;; Search mappings - - (bg-search-current bg-yellow-intense) - (bg-search-lazy bg-cyan-intense) - (bg-search-replace bg-red-intense) - - (bg-search-rx-group-0 bg-blue-intense) - (bg-search-rx-group-1 bg-green-intense) - (bg-search-rx-group-2 bg-red-subtle) - (bg-search-rx-group-3 bg-magenta-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-red-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 yellow-faint) - (fg-heading-3 fg-alt) - (fg-heading-4 magenta) - (fg-heading-5 green-faint) - (fg-heading-6 red-faint) - (fg-heading-7 cyan-warmer) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-operandi' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-operandi-palette-user nil - "Like the `modus-operandi-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-operandi-palette-user nil + "Like the `modus-operandi-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-operandi-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-operandi-palette-overrides nil - "Overrides for `modus-operandi-palette'. +(defcustom modus-operandi-palette-overrides nil + "Overrides for `modus-operandi-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -521,18 +68,23 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-operandi - modus-operandi-palette - modus-operandi-palette-overrides) - - (provide-theme 'modus-operandi)) +(modus-themes-theme + 'modus-operandi + 'modus-themes + "Elegant, highly legible theme with a white background. +Conforms with the highest legibility standard for color contrast +between background and foreground in any given piece of text, +which corresponds to a minimum contrast in relative luminance of +7:1 (WCAG AAA standard)." + 'light + 'modus-themes-operandi-palette + 'modus-operandi-palette-user + 'modus-operandi-palette-overrides) ;;; modus-operandi-theme.el ends here diff --git a/etc/themes/modus-operandi-tinted-theme.el b/etc/themes/modus-operandi-tinted-theme.el index 297b9784ca2..c5ddbbe4e9c 100644 --- a/etc/themes/modus-operandi-tinted-theme.el +++ b/etc/themes/modus-operandi-tinted-theme.el @@ -26,488 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-operandi-tinted - "Elegant, highly legible theme with a light ochre background. -Conforms with the highest legibility standard for color contrast -between background and foreground in any given piece of text, -which corresponds to a minimum contrast in relative luminance of -7:1 (WCAG AAA standard)." - :background-mode 'light - :kind 'color-scheme - :family 'modus) - - (defconst modus-operandi-tinted-palette - '( -;;; Basic values - - (bg-main "#fbf7f0") - (bg-dim "#efe9dd") - (fg-main "#000000") - (fg-dim "#595959") - (fg-alt "#193668") - (bg-active "#c9b9b0") - (bg-inactive "#dfd5cf") - (border "#9f9690") - -;;; Common accent foregrounds - - (red "#a60000") - (red-warmer "#972500") - (red-cooler "#a0132f") - (red-faint "#7f0000") - (red-intense "#d00000") - (green "#006300") - (green-warmer "#306010") - (green-cooler "#00603f") - (green-faint "#2a5045") - (green-intense "#008900") - (yellow "#6d5000") - (yellow-warmer "#894000") - (yellow-cooler "#602938") - (yellow-faint "#574316") - (yellow-intense "#808000") - (blue "#0031a9") - (blue-warmer "#3546c2") - (blue-cooler "#0000b0") - (blue-faint "#003497") - (blue-intense "#0000ff") - (magenta "#721045") - (magenta-warmer "#8f0075") - (magenta-cooler "#531ab6") - (magenta-faint "#7c318f") - (magenta-intense "#dd22dd") - (cyan "#00598b") - (cyan-warmer "#32548f") - (cyan-cooler "#005f5f") - (cyan-faint "#304463") - (cyan-intense "#008899") - -;;; Uncommon accent foregrounds - - (rust "#8a290f") - (gold "#80601f") - (olive "#56692d") - (slate "#2f3f83") - (indigo "#4a3a8a") - (maroon "#731c52") - (pink "#7b435c") - -;;; Common accent backgrounds - - (bg-red-intense "#ff8f88") - (bg-green-intense "#8adf80") - (bg-yellow-intense "#f3d000") - (bg-blue-intense "#bfc9ff") - (bg-magenta-intense "#dfa0f0") - (bg-cyan-intense "#a4d5f9") - - (bg-red-subtle "#ffcfbf") - (bg-green-subtle "#b3fabf") - (bg-yellow-subtle "#fff576") - (bg-blue-subtle "#ccdfff") - (bg-magenta-subtle "#ffddff") - (bg-cyan-subtle "#bfefff") - - (bg-red-nuanced "#ffe8e8") - (bg-green-nuanced "#e0f6e0") - (bg-yellow-nuanced "#f8f0d0") - (bg-blue-nuanced "#ecedff") - (bg-magenta-nuanced "#f8e6f5") - (bg-cyan-nuanced "#e0f2fa") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#f1c8b5") - (fg-clay "#63192a") - - (bg-ochre "#f0e3c0") - (fg-ochre "#573a30") - - (bg-lavender "#dfcdfa") - (fg-lavender "#443379") - - (bg-sage "#c0e7d4") - (fg-sage "#124b41") - -;;; Graphs - - (bg-graph-red-0 "#ef7969") - (bg-graph-red-1 "#ffaab4") - (bg-graph-green-0 "#45c050") - (bg-graph-green-1 "#75ef30") - (bg-graph-yellow-0 "#ffcf00") - (bg-graph-yellow-1 "#f9ff00") - (bg-graph-blue-0 "#7f90ff") - (bg-graph-blue-1 "#a6c0ff") - (bg-graph-magenta-0 "#e07fff") - (bg-graph-magenta-1 "#fad0ff") - (bg-graph-cyan-0 "#70d3f0") - (bg-graph-cyan-1 "#afefff") - -;;; Special purpose - - (bg-completion "#f0c1cf") - (bg-hover "#b2e4dc") - (bg-hover-secondary "#dfe09f") - (bg-hl-line "#f1d5d0") - (bg-region "#c2bcb5") - (fg-region "#000000") - - (bg-mode-line-active "#cab9b2") - (fg-mode-line-active "#000000") - (border-mode-line-active "#545454") - (bg-mode-line-inactive "#dfd9cf") - (fg-mode-line-inactive "#585858") - (border-mode-line-inactive "#a59a94") - - (modeline-err "#7f0000") - (modeline-warning "#5f0070") - (modeline-info "#002580") - - (bg-tab-bar "#e0d4ce") - (bg-tab-current "#fbf7f0") - (bg-tab-other "#c8b8b2") - -;;; Diffs - - (bg-added "#c3ebc1") - (bg-added-faint "#dcf8d1") - (bg-added-refine "#acd6a5") - (bg-added-fringe "#6cc06c") - (fg-added "#005000") - (fg-added-intense "#006700") - - (bg-changed "#ffdfa9") - (bg-changed-faint "#ffefbf") - (bg-changed-refine "#fac090") - (bg-changed-fringe "#c0b200") - (fg-changed "#553d00") - (fg-changed-intense "#655000") - - (bg-removed "#f4d0cf") - (bg-removed-faint "#ffe9e5") - (bg-removed-refine "#f3b5a7") - (bg-removed-fringe "#d84a4f") - (fg-removed "#8f1313") - (fg-removed-intense "#aa2222") - - (bg-diff-context "#efe9df") - -;;; Paren match - - (bg-paren-match "#7fdfcf") - (fg-paren-match fg-main) - (bg-paren-expression "#efd3f5") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor red-intense) - - (keybind red) - (name magenta) - (identifier yellow-faint) - - (err red) - (warning yellow) - (info green) - - (underline-err red-intense) - (underline-warning yellow-intense) - (underline-note cyan-intense) - - (bg-prominent-err bg-red-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-yellow-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-yellow-nuanced) - (fg-active-argument yellow-warmer) - (bg-active-value bg-cyan-nuanced) - (fg-active-value cyan-warmer) - -;;;; Code mappings - - (bracket fg-main) - (builtin magenta) - (comment red-faint) - (constant magenta-cooler) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring cyan-faint) - (fnname yellow-cooler) - (keyword blue) - (number fg-main) - (operator fg-main) - (preprocessor yellow-warmer) - (property green-cooler) - (punctuation fg-main) - (rx-backslash magenta-warmer) - (rx-construct magenta-cooler) - (string cyan) - (type green-warmer) - (variable green-cooler) - -;;;; Accent mappings - - (accent-0 red-cooler) - (accent-1 cyan) - (accent-2 magenta-cooler) - (accent-3 yellow-warmer) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 blue) - (fg-completion-match-1 magenta-warmer) - (fg-completion-match-2 cyan) - (fg-completion-match-3 red) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan) - (date-deadline red-cooler) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday red) - (date-holiday-other blue) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled yellow) - (date-scheduled-subtle yellow-faint) - (date-weekday cyan) - (date-weekend magenta) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link blue-warmer) - (bg-link unspecified) - (underline-link blue-warmer) - - (fg-link-symbolic cyan) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan) - - (fg-link-visited magenta) - (bg-link-visited unspecified) - (underline-link-visited magenta) - -;;;; Mail mappings - - (mail-cite-0 cyan) - (mail-cite-1 yellow) - (mail-cite-2 green-warmer) - (mail-cite-3 red-cooler) - (mail-part green-cooler) - (mail-recipient blue-warmer) - (mail-subject magenta-warmer) - (mail-other magenta) - -;;;; Mark mappings - - (bg-mark-delete bg-red-subtle) - (fg-mark-delete red) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-yellow-subtle) - (fg-mark-other yellow) - -;;;; Prompt mappings - - (fg-prompt green-cooler) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code green-cooler) - - (bg-prose-macro unspecified) - (fg-prose-macro blue-cooler) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim yellow-warmer) - - (prose-done green) - (prose-todo red) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula magenta-warmer) - - (prose-tag magenta-faint) - -;;;; Rainbow mappings - - (rainbow-0 fg-main) - (rainbow-1 magenta-intense) - (rainbow-2 cyan-intense) - (rainbow-3 red-warmer) - (rainbow-4 yellow-intense) - (rainbow-5 magenta-cooler) - (rainbow-6 green-intense) - (rainbow-7 blue-warmer) - (rainbow-8 magenta-warmer) - -;;;; Search mappings - - (bg-search-current bg-yellow-intense) - (bg-search-lazy bg-cyan-intense) - (bg-search-replace bg-red-intense) - - (bg-search-rx-group-0 bg-blue-intense) - (bg-search-rx-group-1 bg-green-intense) - (bg-search-rx-group-2 bg-red-subtle) - (bg-search-rx-group-3 bg-magenta-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-red-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 green-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 yellow-faint) - (fg-heading-3 fg-alt) - (fg-heading-4 magenta) - (fg-heading-5 green-faint) - (fg-heading-6 red-faint) - (fg-heading-7 cyan-warmer) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-operandi-tinted' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-operandi-tinted-palette-user nil - "Like the `modus-operandi-tinted-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-operandi-tinted-palette-user nil + "Like the `modus-operandi-tinted-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-operandi-tinted-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-operandi-tinted-palette-overrides nil - "Overrides for `modus-operandi-tinted-palette'. +(defcustom modus-operandi-tinted-palette-overrides nil + "Overrides for `modus-operandi-tinted-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -521,18 +68,23 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-operandi-tinted - modus-operandi-tinted-palette - modus-operandi-tinted-palette-overrides) - - (provide-theme 'modus-operandi-tinted)) +(modus-themes-theme + 'modus-operandi-tinted + 'modus-themes + "Elegant, highly legible theme with a light ochre background. +Conforms with the highest legibility standard for color contrast +between background and foreground in any given piece of text, +which corresponds to a minimum contrast in relative luminance of +7:1 (WCAG AAA standard)." + 'light + 'modus-themes-operandi-tinted-palette + 'modus-operandi-tinted-palette-user + 'modus-operandi-tinted-palette-overrides) ;;; modus-operandi-tinted-theme.el ends here diff --git a/etc/themes/modus-operandi-tritanopia-theme.el b/etc/themes/modus-operandi-tritanopia-theme.el index fd256ea3514..dfbdc1e1772 100644 --- a/etc/themes/modus-operandi-tritanopia-theme.el +++ b/etc/themes/modus-operandi-tritanopia-theme.el @@ -26,490 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-operandi-tritanopia - "Tritanopia-optimized theme with a white background. -This variant is optimized for users with blue-yellow color -deficiency (tritanopia). It conforms with the highest -legibility standard for color contrast between background and -foreground in any given piece of text, which corresponds to a -minimum contrast in relative luminance of 7:1 (WCAG AAA -standard)." - :background-mode 'light - :kind 'color-scheme - :family 'modus) - - (defconst modus-operandi-tritanopia-palette - '( -;;; Basic values - - (bg-main "#ffffff") - (bg-dim "#f2f2f2") - (fg-main "#000000") - (fg-dim "#595959") - (fg-alt "#024960") - (bg-active "#c4c4c4") - (bg-inactive "#e0e0e0") - (border "#9f9f9f") - -;;; Common accent foregrounds - - (red "#a60000") - (red-warmer "#b21100") - (red-cooler "#a0132f") - (red-faint "#702000") - (red-intense "#d00000") - (green "#006800") - (green-warmer "#316500") - (green-cooler "#00663f") - (green-faint "#2a5045") - (green-intense "#008900") - (yellow "#695500") - (yellow-warmer "#973300") - (yellow-cooler "#77492f") - (yellow-faint "#624416") - (yellow-intense "#808000") - (blue "#0031a9") - (blue-warmer "#3548cf") - (blue-cooler "#0000b0") - (blue-faint "#003497") - (blue-intense "#0000ff") - (magenta "#721045") - (magenta-warmer "#8f0075") - (magenta-cooler "#531ab6") - (magenta-faint "#7c318f") - (magenta-intense "#cd22bd") - (cyan "#005e8b") - (cyan-warmer "#3f578f") - (cyan-cooler "#005f5f") - (cyan-faint "#004f5f") - (cyan-intense "#008899") - -;;; Uncommon accent foregrounds - - (rust "#8a290f") - (gold "#80601f") - (olive "#56692d") - (slate "#2f3f83") - (indigo "#4a3a8a") - (maroon "#731c52") - (pink "#7b435c") - -;;; Common accent backgrounds - - (bg-red-intense "#ff8f88") - (bg-green-intense "#8adf80") - (bg-yellow-intense "#f3d000") - (bg-blue-intense "#bfc9ff") - (bg-magenta-intense "#dfa0f0") - (bg-cyan-intense "#a4d5f9") - - (bg-red-subtle "#ffcfbf") - (bg-green-subtle "#b3fabf") - (bg-yellow-subtle "#fff576") - (bg-blue-subtle "#ccdfff") - (bg-magenta-subtle "#ffddff") - (bg-cyan-subtle "#bfefff") - - (bg-red-nuanced "#ffe8e8") - (bg-green-nuanced "#e0f6e0") - (bg-yellow-nuanced "#f8f0d0") - (bg-blue-nuanced "#ecedff") - (bg-magenta-nuanced "#f8e6f5") - (bg-cyan-nuanced "#e0f2fa") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#f1c8b5") - (fg-clay "#63192a") - - (bg-ochre "#f0e3c0") - (fg-ochre "#573a30") - - (bg-lavender "#dfcdfa") - (fg-lavender "#443379") - - (bg-sage "#c0e7d4") - (fg-sage "#124b41") - -;;; Graphs - - (bg-graph-red-0 "#ef7969") - (bg-graph-red-1 "#ffaab4") - (bg-graph-green-0 "#68c0a0") - (bg-graph-green-1 "#a5dfd0") - (bg-graph-yellow-0 "#d99f9f") - (bg-graph-yellow-1 "#ffb58f") - (bg-graph-blue-0 "#80a0df") - (bg-graph-blue-1 "#a8cfff") - (bg-graph-magenta-0 "#efafcf") - (bg-graph-magenta-1 "#ffdaef") - (bg-graph-cyan-0 "#7fd3ed") - (bg-graph-cyan-1 "#afefff") - -;;; Special purpose - - (bg-completion "#afdfef") - (bg-hover "#ffafbc") - (bg-hover-secondary "#abdfdd") - (bg-hl-line "#dfeaec") - (bg-region "#bdbdbd") - (fg-region "#000000") - - (bg-mode-line-active "#afe0f2") - (fg-mode-line-active "#0f0f0f") - (border-mode-line-active "#2f4f44") - (bg-mode-line-inactive "#e6e6e6") - (fg-mode-line-inactive "#585858") - (border-mode-line-inactive "#a3a3a3") - - (modeline-err "#8f0000") - (modeline-warning "#6f306f") - (modeline-info "#00445f") - - (bg-tab-bar "#dfdfdf") - (bg-tab-current "#ffffff") - (bg-tab-other "#c2c2c2") - -;;; Diffs - - (bg-added "#b5e7ff") - (bg-added-faint "#c6f6ff") - (bg-added-refine "#9adcef") - (bg-added-fringe "#1782cc") - (fg-added "#005079") - (fg-added-intense "#0043aa") - - (bg-changed "#eecfdf") - (bg-changed-faint "#f0dde5") - (bg-changed-refine "#e0b0d0") - (bg-changed-fringe "#9f6ab0") - (fg-changed "#6f1343") - (fg-changed-intense "#7f0f9f") - - (bg-removed "#ffd8d5") - (bg-removed-faint "#ffe9e9") - (bg-removed-refine "#f3b5af") - (bg-removed-fringe "#d84a4f") - (fg-removed "#8f1313") - (fg-removed-intense "#aa2222") - - (bg-diff-context "#f3f3f3") - -;;; Paren match - - (bg-paren-match "#5fcfff") - (fg-paren-match fg-main) - (bg-paren-expression "#efd3f5") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor red-intense) - - (keybind red) - (name red-cooler) - (identifier red-faint) - - (err red-warmer) - (warning magenta) - (info cyan) - - (underline-err red-intense) - (underline-warning magenta-intense) - (underline-note cyan-intense) - - (bg-prominent-err bg-red-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-magenta-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-red-nuanced) - (fg-active-argument red-warmer) - (bg-active-value bg-cyan-nuanced) - (fg-active-value cyan) - -;;;; Code mappings - - (bracket fg-main) - (builtin magenta) - (comment red-faint) - (constant green-cooler) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring fg-alt) - (fnname cyan-warmer) - (keyword red-cooler) - (number fg-main) - (operator fg-main) - (preprocessor red-warmer) - (property cyan-cooler) - (punctuation fg-main) - (rx-backslash magenta) - (rx-construct red) - (string cyan) - (type blue-warmer) - (variable cyan-cooler) - -;;;; Accent mappings - - (accent-0 cyan) - (accent-1 red-warmer) - (accent-2 cyan-cooler) - (accent-3 magenta) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 cyan) - (fg-completion-match-1 red-warmer) - (fg-completion-match-2 magenta) - (fg-completion-match-3 cyan-cooler) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan-cooler) - (date-deadline red) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday red) - (date-holiday-other cyan) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled magenta) - (date-scheduled-subtle magenta-faint) - (date-weekday cyan) - (date-weekend magenta-warmer) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link cyan) - (bg-link unspecified) - (underline-link cyan) - - (fg-link-symbolic cyan-cooler) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan-cooler) - - (fg-link-visited magenta) - (bg-link-visited unspecified) - (underline-link-visited magenta) - -;;;; Mail mappings - - (mail-cite-0 cyan-faint) - (mail-cite-1 red-faint) - (mail-cite-2 magenta-warmer) - (mail-cite-3 cyan-warmer) - (mail-part cyan-cooler) - (mail-recipient cyan) - (mail-subject red-cooler) - (mail-other cyan) - -;;;; Mark mappings - - (bg-mark-delete bg-red-subtle) - (fg-mark-delete red) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-magenta-subtle) - (fg-mark-other magenta) - -;;;; Prompt mappings - - (fg-prompt cyan-cooler) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan) - - (bg-prose-macro unspecified) - (fg-prose-macro red-warmer) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim magenta-warmer) - - (prose-done cyan) - (prose-todo red) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula red-cooler) - - (prose-tag fg-alt) - -;;;; Rainbow mappings - - (rainbow-0 cyan) - (rainbow-1 red) - (rainbow-2 cyan-warmer) - (rainbow-3 red-cooler) - (rainbow-4 cyan-cooler) - (rainbow-5 magenta) - (rainbow-6 cyan-faint) - (rainbow-7 magenta-faint) - (rainbow-8 red-faint) - -;;;; Search mappings - - (bg-search-current bg-red-intense) - (bg-search-lazy bg-cyan-intense) - (bg-search-replace bg-magenta-intense) - - (bg-search-rx-group-0 bg-blue-intense) - (bg-search-rx-group-1 bg-magenta-intense) - (bg-search-rx-group-2 bg-cyan-subtle) - (bg-search-rx-group-3 bg-red-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-red-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 red-faint) - (fg-heading-3 cyan-faint) - (fg-heading-4 magenta) - (fg-heading-5 green-faint) - (fg-heading-6 magenta-faint) - (fg-heading-7 cyan-warmer) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-operandi-tritanopia' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-operandi-tritanopia-palette-user nil - "Like the `modus-operandi-tritanopia-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-operandi-tritanopia-palette-user nil + "Like the `modus-operandi-tritanopia-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-operandi-tritanopia-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-operandi-tritanopia-palette-overrides nil - "Overrides for `modus-operandi-tritanopia-palette'. +(defcustom modus-operandi-tritanopia-palette-overrides nil + "Overrides for `modus-operandi-tritanopia-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -523,18 +68,25 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-operandi-tritanopia - modus-operandi-tritanopia-palette - modus-operandi-tritanopia-palette-overrides) - - (provide-theme 'modus-operandi-tritanopia)) +(modus-themes-theme + 'modus-operandi-tritanopia + 'modus-themes + "Tritanopia-optimized theme with a white background. +This variant is optimized for users with blue-yellow color +deficiency (tritanopia). It conforms with the highest +legibility standard for color contrast between background and +foreground in any given piece of text, which corresponds to a +minimum contrast in relative luminance of 7:1 (WCAG AAA +standard)." + 'light + 'modus-themes-operandi-tritanopia-palette + 'modus-operandi-tritanopia-palette-user + 'modus-operandi-tritanopia-palette-overrides) ;;; modus-operandi-tritanopia-theme.el ends here diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el index 535c1a51055..3bcc190b174 100644 --- a/etc/themes/modus-themes.el +++ b/etc/themes/modus-themes.el @@ -5,7 +5,7 @@ ;; Author: Protesilaos Stavrou ;; Maintainer: Protesilaos Stavrou ;; URL: https://github.com/protesilaos/modus-themes -;; Version: 4.8.0 +;; Version: 5.1.0 ;; Package-Requires: ((emacs "28.1")) ;; Keywords: faces, theme, accessibility @@ -28,15 +28,18 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-when-compile (require 'subr-x)) +(eval-when-compile + (require 'subr-x) + (require 'cl-lib)) (defgroup modus-themes () "User options for the Modus themes. @@ -67,94 +70,81 @@ deficiency (deuteranopia or tritanopia, respectively)." ;;;; Custom faces +;; NOTE 2025-10-25: I could not find the `make-obsolete' equivalent for faces. +(define-obsolete-face-alias 'modus-themes-fg-blue nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-blue-cooler nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-blue-faint nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-blue-intense nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-blue-warmer nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-cyan nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-cyan-cooler nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-cyan-faint nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-cyan-intense nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-cyan-warmer nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-green nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-green-cooler nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-green-faint nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-green-intense nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-green-warmer nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-magenta nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-magenta-cooler nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-magenta-faint nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-magenta-intense nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-magenta-warmer nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-red nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-red-cooler nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-red-faint nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-red-intense nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-red-warmer nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-yellow nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-yellow-cooler nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-yellow-faint nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-yellow-intense nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-fg-yellow-warmer nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-intense-blue nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-intense-cyan nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-intense-green nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-intense-magenta nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-intense-red nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-intense-yellow nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-key-binding nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-lang-error nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-lang-note nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-lang-warning nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-mark-alt nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-mark-del nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-mark-sel nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-nuanced-blue nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-nuanced-cyan nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-nuanced-green nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-nuanced-magenta nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-nuanced-red nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-nuanced-yellow nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-prominent-error nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-prominent-note nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-prominent-warning nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-prose-code nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-prose-macro nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-prose-verbatim nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-current nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-lazy nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-replace nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-rx-group-0 nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-rx-group-1 nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-rx-group-2 nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-rx-group-3 nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-search-static nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-subtle-blue nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-subtle-cyan nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-subtle-green nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-subtle-magenta nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-subtle-red nil "5.0.0") +(define-obsolete-face-alias 'modus-themes-subtle-yellow nil "5.0.0") + ;; These faces are used internally to ensure consistency between various ;; groups and to streamline the evaluation of relevant customization ;; options. -(dolist (color '( red green blue yellow magenta cyan - red-warmer green-warmer blue-warmer yellow-warmer magenta-warmer cyan-warmer - red-cooler green-cooler blue-cooler yellow-cooler magenta-cooler cyan-cooler - red-faint green-faint blue-faint yellow-faint magenta-faint cyan-faint - red-intense green-intense blue-intense yellow-intense magenta-intense cyan-intense)) - (custom-declare-face - (intern (format "modus-themes-fg-%s" color)) - nil (format "Face with %s foreground." color) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (color '(red green yellow blue magenta cyan)) - (custom-declare-face - (intern (format "modus-themes-nuanced-%s" color)) - nil (format "Nuanced %s background." color) - :package-version '(modus-themes . "4.1.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (color '(red green yellow blue magenta cyan)) - (custom-declare-face - (intern (format "modus-themes-subtle-%s" color)) - nil (format "Subtle %s background." color) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (color '(red green yellow blue magenta cyan)) - (custom-declare-face - (intern (format "modus-themes-intense-%s" color)) - nil (format "Intense %s background." color) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (scope '(alt del sel)) - (custom-declare-face - (intern (format "modus-themes-mark-%s" scope)) - nil (format "Mark of type %s." scope) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (scope '(note warning error)) - (custom-declare-face - (intern (format "modus-themes-lang-%s" scope)) - nil (format "Linter or spell check of type %s." scope) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (scope '(note warning error)) - (custom-declare-face - (intern (format "modus-themes-prominent-%s" scope)) - nil (format "Prominent notification of type %s." scope) - :package-version '(modus-themes . "4.2.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (scope '(current lazy replace)) - (custom-declare-face - (intern (format "modus-themes-search-%s" scope)) - nil (format "Search of type %s." scope) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dotimes (n 4) - (custom-declare-face - (intern (format "modus-themes-search-rx-group-%s" n)) - nil (format "Search regexp group number %s." n) - :package-version '(modus-themes . "4.4.0") - :version "30.1" - :group 'modus-themes-faces)) - -(dolist (scope '(code macro verbatim)) - (custom-declare-face - (intern (format "modus-themes-prose-%s" scope)) - nil (format "Construct of type %s for prose." scope) - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces)) - (dotimes (n 9) (custom-declare-face (intern (format "modus-themes-heading-%d" n)) @@ -177,12 +167,6 @@ This behaves in accordance with `modus-themes-italic-constructs'." :version "30.1" :group 'modus-themes-faces) -(defface modus-themes-key-binding nil - "Face for key bindings." - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :group 'modus-themes-faces) - (defface modus-themes-fixed-pitch nil "Face for `fixed-pitch' if `modus-themes-mixed-fonts' is non-nil." :package-version '(modus-themes . "4.0.0") @@ -207,14 +191,14 @@ text should not be underlined as well) yet still blend in." "Generic face for command prompts." :group 'modus-themes-faces) -(defface modus-themes-completion-selected nil - "Face for current selection in completion UIs." - :group 'modus-themes-faces) - (defface modus-themes-button nil "Face for graphical buttons." :group 'modus-themes-faces) +(defface modus-themes-completion-selected nil + "Face for current selection in completion UIs." + :group 'modus-themes-faces) + (dotimes (n 4) (custom-declare-face (intern (format "modus-themes-completion-match-%d" n)) @@ -227,38 +211,10 @@ text should not be underlined as well) yet still blend in." ;;;; Customization variables -(defcustom modus-themes-custom-auto-reload t - "Automatically reload theme after setting options with Customize. - -All theme user options take effect when a theme is loaded. Any -subsequent changes require the theme to be reloaded. - -When this variable has a non-nil value, any change made via the -Custom UI or related functions such as `customize-set-variable' -and `setopt' (Emacs 29), will trigger a reload automatically. - -With a nil value, changes to user options have no further -consequences. The user must manually reload the theme." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type 'boolean - :link '(info-link "(modus-themes) Custom reload theme")) - -(defun modus-themes--set-option (sym val) - "Custom setter for theme related user options. -Will set SYM to VAL, and reload the current theme, unless -`modus-themes-custom-auto-reload' is nil." - (set-default sym val) - (when (and modus-themes-custom-auto-reload - ;; Check if a theme is being loaded, in which case we - ;; don't want to reload a theme if the setter is - ;; invoked. `custom--inhibit-theme-enable' is set to nil - ;; by `enable-theme'. - (bound-and-true-p custom--inhibit-theme-enable)) - (when-let* ((modus-themes-custom-auto-reload t) - (theme (modus-themes--current-theme))) - (modus-themes-load-theme theme)))) +(make-obsolete-variable + 'modus-themes-custom-auto-reload + "reload the theme manually for changes to take effect" + "5.0.0") (defcustom modus-themes-disable-other-themes t "Disable all other themes when loading a Modus theme. @@ -319,12 +275,19 @@ the same as using the command `modus-themes-select'." :version "30.1" :group 'modus-themes) -(defcustom modus-themes-to-rotate modus-themes-items - "List of Modus themes to rotate among, per `modus-themes-rotate'." +(defcustom modus-themes-to-rotate nil + "List of Modus themes to rotate, per `modus-themes-rotate'. +If the value is nil, then rotation applies to all themes returned by +`modus-themes-get-themes'." :type `(repeat (choice :tag "A theme among the `modus-themes-items'" - ,@(mapcar (lambda (theme) (list 'const theme)) modus-themes-items))) - :package-version '(modus-themes . "4.6.0") + ,@(mapcar + (lambda (theme) + (list 'const theme)) + (if (fboundp 'modus-themes-get-themes) + (modus-themes-get-themes) + modus-themes-items)))) + :package-version '(modus-themes . "5.0.0") :version "31.1" :group 'modus-themes) @@ -349,8 +312,6 @@ This is used by the commands `modus-themes-toggle', :package-version '(modus-themes . "1.5.0") :version "28.1" :type 'boolean - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Italic constructs")) (defcustom modus-themes-bold-constructs nil @@ -359,8 +320,6 @@ This is used by the commands `modus-themes-toggle', :package-version '(modus-themes . "1.0.0") :version "28.1" :type 'boolean - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Bold constructs")) (defcustom modus-themes-variable-pitch-ui nil @@ -370,8 +329,6 @@ This includes the mode line, header line, tab bar, and tab line." :package-version '(modus-themes . "1.1.0") :version "28.1" :type 'boolean - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) UI typeface")) (defcustom modus-themes-mixed-fonts nil @@ -389,8 +346,6 @@ Protesilaos))." :package-version '(modus-themes . "1.7.0") :version "29.1" :type 'boolean - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Mixed fonts")) (defconst modus-themes--weight-widget @@ -521,12 +476,8 @@ and related user options." '(0 1 2 3 4 5 6 7 8 t agenda-date agenda-structure)) :key-type symbol :value-type ,modus-themes--headings-widget) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Heading styles")) -(make-obsolete-variable 'modus-themes-org-blocks nil "4.4.0: Use palette overrides") - (defcustom modus-themes-completions nil "Control the style of completion user interfaces. @@ -608,8 +559,6 @@ Is the same as: ,modus-themes--weight-widget (const :tag "Italic font (oblique or slanted forms)" italic) (const :tag "Underline" underline)))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Completion UIs")) (defcustom modus-themes-prompts nil @@ -644,8 +593,6 @@ In user configuration files the form may look like this: :type `(set :tag "Properties" :greedy t (const :tag "Italic font slant" italic) ,modus-themes--weight-widget) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Command prompts")) @@ -658,8 +605,6 @@ used in combination with palette overrides (see :group 'modus-themes :package-version '(modus-themes . "4.5.0") :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Extend the palette for use with overrides")) (defcustom modus-themes-common-palette-overrides nil @@ -686,30 +631,2786 @@ represents." :package-version '(modus-themes . "4.0.0") :version "30.1" :type '(repeat (list symbol (choice symbol string))) - ;; ;; NOTE 2023-01-07: The following is a functioning version of the - ;; ;; intended :type. However, I think the Custom UI is really - ;; ;; awkward for this specific case. Maybe the generic type I have - ;; ;; above is better, as it encourages the user to write out the - ;; ;; code and read the manual. Counter-arguments are welcome. - ;; - ;; :type `(repeat (list (radio :tag "Palette key to override" - ;; ,@(mapcar (lambda (x) - ;; (list 'const x)) - ;; (mapcar #'car (modus-themes--current-theme-palette)))) - ;; (choice :tag "Value to assign" :value unspecified - ;; (const :tag "`unspecified' (remove the original color)" unspecified) - ;; (string :tag "String with color name (e.g. \"gray50\") or hex RGB (e.g. \"#123456\")" - ;; :match-inline (color-supported-p val)) - ;; (radio :tag "Palette key to map to" - ;; ,@(mapcar (lambda (x) - ;; (list 'const x)) - ;; (mapcar #'car (modus-themes--current-theme-palette))))))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default :link '(info-link "(modus-themes) Palette overrides")) +;;;; Theme palettes + +(define-obsolete-variable-alias 'modus-operandi-palette 'modus-themes-operandi-palette "5.0.0") +(define-obsolete-variable-alias 'modus-operandi-tinted-palette 'modus-themes-operandi-tinted-palette "5.0.0") +(define-obsolete-variable-alias 'modus-operandi-deuteranopia-palette 'modus-themes-operandi-deuteranopia-palette "5.0.0") +(define-obsolete-variable-alias 'modus-operandi-tritanopia-palette 'modus-themes-operandi-tritanopia-palette "5.0.0") +(define-obsolete-variable-alias 'modus-vivendi-palette 'modus-themes-vivendi-palette "5.0.0") +(define-obsolete-variable-alias 'modus-vivendi-tinted-palette 'modus-themes-vivendi-tinted-palette "5.0.0") +(define-obsolete-variable-alias 'modus-vivendi-deuteranopia-palette 'modus-themes-vivendi-deuteranopia-palette "5.0.0") +(define-obsolete-variable-alias 'modus-vivendi-tritanopia-palette 'modus-themes-vivendi-tritanopia-palette "5.0.0") + +(defconst modus-themes-common-palette-mappings + '((fringe bg-dim) + + ;; Button mappings + + (fg-button-active fg-main) + (fg-button-inactive fg-dim) + (bg-button-active bg-active) + (bg-button-inactive bg-dim) + + ;; Code mappings + + (bracket fg-main) + (delimiter fg-main) + (docmarkup magenta-faint) + (number fg-main) + (operator fg-main) + (punctuation fg-main) + + ;; Completion mappings + + (bg-completion-match-0 unspecified) + (bg-completion-match-1 unspecified) + (bg-completion-match-2 unspecified) + (bg-completion-match-3 unspecified) + + ;; Date mappings + + (date-now fg-main) + + ;; Line number mappings + + (fg-line-number-inactive fg-dim) + (fg-line-number-active fg-main) + (bg-line-number-inactive bg-dim) + (bg-line-number-active bg-active) + + ;; Link mappings + + (bg-link unspecified) + (bg-link-symbolic unspecified) + (bg-link-visited unspecified) + + ;; Paren match + + (fg-paren-match fg-main) + (underline-paren-match unspecified) + + ;; Prompt mappings + + (bg-prompt unspecified) + + ;; Prose mappings + + (bg-prose-block-delimiter bg-dim) + (fg-prose-block-delimiter fg-dim) + (bg-prose-block-contents bg-dim) + (bg-prose-code unspecified) + (bg-prose-macro unspecified) + (bg-prose-verbatim unspecified) + + ;; Space mappings + + (bg-space unspecified) + (fg-space border) + (bg-space-err bg-red-intense) + + ;; Terminal mappings + + (bg-term-black "#000000") + (fg-term-black "#000000") + (bg-term-black-bright "#595959") + (fg-term-black-bright "#595959") + + (bg-term-red red) + (fg-term-red red) + (bg-term-red-bright red-warmer) + (fg-term-red-bright red-warmer) + + (bg-term-green green) + (fg-term-green green) + (bg-term-green-bright green-cooler) + (fg-term-green-bright green-cooler) + + (bg-term-yellow yellow) + (fg-term-yellow yellow) + (bg-term-yellow-bright yellow-warmer) + (fg-term-yellow-bright yellow-warmer) + + (bg-term-blue blue) + (fg-term-blue blue) + (bg-term-blue-bright blue-warmer) + (fg-term-blue-bright blue-warmer) + + (bg-term-magenta magenta) + (fg-term-magenta magenta) + (bg-term-magenta-bright magenta-cooler) + (fg-term-magenta-bright magenta-cooler) + + (bg-term-cyan cyan) + (fg-term-cyan cyan) + + (bg-term-cyan-bright cyan-cooler) + (fg-term-cyan-bright cyan-cooler) + + (bg-term-white "#a6a6a6") + (fg-term-white "#a6a6a6") + (bg-term-white-bright "#ffffff") + (fg-term-white-bright "#ffffff") + + ;; Heading mappings + + (bg-heading-0 unspecified) + (bg-heading-1 unspecified) + (bg-heading-2 unspecified) + (bg-heading-3 unspecified) + (bg-heading-4 unspecified) + (bg-heading-5 unspecified) + (bg-heading-6 unspecified) + (bg-heading-7 unspecified) + (bg-heading-8 unspecified) + + (overline-heading-0 unspecified) + (overline-heading-1 unspecified) + (overline-heading-2 unspecified) + (overline-heading-3 unspecified) + (overline-heading-4 unspecified) + (overline-heading-5 unspecified) + (overline-heading-6 unspecified) + (overline-heading-7 unspecified) + (overline-heading-8 unspecified))) + +;; FIXME 2025-10-29: Can we not autoload these palettes? I would +;; rather have them in their respective files. I tried to declare them +;; with `defcustom'/`defvar' and do `custom-autoload' plus `provide' +;; the feature of the file. No matter how I do it and where I call +;; `custom-autoload' from, it does not have the desired effect: the +;; palette is always void if the feature is not explicitly `require'd. + +(defconst modus-themes-operandi-palette + (append + '( + ;; Basic values + + (bg-main "#ffffff") + (bg-dim "#f2f2f2") + (fg-main "#000000") + (fg-dim "#595959") + (fg-alt "#193668") + (bg-active "#c4c4c4") + (bg-inactive "#e0e0e0") + (border "#9f9f9f") + + ;; Common accent foregrounds + + (red "#a60000") + (red-warmer "#972500") + (red-cooler "#a0132f") + (red-faint "#7f0000") + (red-intense "#d00000") + (green "#006800") + (green-warmer "#316500") + (green-cooler "#00663f") + (green-faint "#2a5045") + (green-intense "#008900") + (yellow "#6f5500") + (yellow-warmer "#884900") + (yellow-cooler "#7a4f2f") + (yellow-faint "#624416") + (yellow-intense "#808000") + (blue "#0031a9") + (blue-warmer "#3548cf") + (blue-cooler "#0000b0") + (blue-faint "#003497") + (blue-intense "#0000ff") + (magenta "#721045") + (magenta-warmer "#8f0075") + (magenta-cooler "#531ab6") + (magenta-faint "#7c318f") + (magenta-intense "#dd22dd") + (cyan "#005e8b") + (cyan-warmer "#3f578f") + (cyan-cooler "#005f5f") + (cyan-faint "#005077") + (cyan-intense "#008899") + + ;; Uncommon accent foregrounds + + (rust "#8a290f") + (gold "#6c501c") + (olive "#4c6000") + (slate "#2f3f83") + (indigo "#4a3a8a") + (maroon "#731c52") + (pink "#7b435c") + + ;; Common accent backgrounds + + (bg-red-intense "#ff8f88") + (bg-green-intense "#8adf80") + (bg-yellow-intense "#f3d000") + (bg-blue-intense "#bfc9ff") + (bg-magenta-intense "#dfa0f0") + (bg-cyan-intense "#a4d5f9") + + (bg-red-subtle "#ffcfbf") + (bg-green-subtle "#b3fabf") + (bg-yellow-subtle "#fff576") + (bg-blue-subtle "#ccdfff") + (bg-magenta-subtle "#ffddff") + (bg-cyan-subtle "#bfefff") + + (bg-red-nuanced "#ffe8e8") + (bg-green-nuanced "#e0f6e0") + (bg-yellow-nuanced "#f8f0d0") + (bg-blue-nuanced "#ecedff") + (bg-magenta-nuanced "#f8e6f5") + (bg-cyan-nuanced "#e0f2fa") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#f1c8b5") + (fg-clay "#63192a") + + (bg-ochre "#f0e3c0") + (fg-ochre "#573a30") + + (bg-lavender "#dfcdfa") + (fg-lavender "#443379") + + (bg-sage "#c0e7d4") + (fg-sage "#124b41") + + ;; Graphs + + (bg-graph-red-0 "#ef7969") + (bg-graph-red-1 "#ffaab4") + (bg-graph-green-0 "#45c050") + (bg-graph-green-1 "#75ef30") + (bg-graph-yellow-0 "#ffcf00") + (bg-graph-yellow-1 "#f9ff00") + (bg-graph-blue-0 "#7f90ff") + (bg-graph-blue-1 "#a6c0ff") + (bg-graph-magenta-0 "#e07fff") + (bg-graph-magenta-1 "#fad0ff") + (bg-graph-cyan-0 "#70d3f0") + (bg-graph-cyan-1 "#afefff") + + ;; Special purpose + + (bg-completion "#c0deff") + (bg-hover "#b2e4dc") + (bg-hover-secondary "#f5d0a0") + (bg-hl-line "#dae5ec") + (bg-region "#bdbdbd") + (fg-region "#000000") + + (bg-mode-line-active "#c8c8c8") + (fg-mode-line-active "#000000") + (border-mode-line-active "#5a5a5a") + (bg-mode-line-inactive "#e6e6e6") + (fg-mode-line-inactive "#585858") + (border-mode-line-inactive "#a3a3a3") + + (modeline-err "#7f0000") + (modeline-warning "#5f0070") + (modeline-info "#002580") + + (bg-tab-bar "#dfdfdf") + (bg-tab-current "#ffffff") + (bg-tab-other "#c2c2c2") + + ;; Diffs + + (bg-added "#c1f2d1") + (bg-added-faint "#d8f8e1") + (bg-added-refine "#aee5be") + (bg-added-fringe "#6cc06c") + (fg-added "#005000") + (fg-added-intense "#006700") + + (bg-changed "#ffdfa9") + (bg-changed-faint "#ffefbf") + (bg-changed-refine "#fac090") + (bg-changed-fringe "#d7c20a") + (fg-changed "#553d00") + (fg-changed-intense "#655000") + + (bg-removed "#ffd8d5") + (bg-removed-faint "#ffe9e9") + (bg-removed-refine "#f3b5af") + (bg-removed-fringe "#d84a4f") + (fg-removed "#8f1313") + (fg-removed-intense "#aa2222") + + (bg-diff-context "#f3f3f3") + + ;; Paren match + + (bg-paren-match "#5fcfff") + (bg-paren-expression "#efd3f5") + (underline-paren-match unspecified) + + ;; General mappings + + (cursor fg-main) + (keybind blue-cooler) + (name magenta) + (identifier yellow-cooler) + + (err red) + (warning yellow-warmer) + (info cyan-cooler) + + (underline-err red-intense) + (underline-warning yellow-intense) + (underline-note cyan-intense) + + (bg-prominent-err bg-red-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-yellow-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-yellow-nuanced) + (fg-active-argument yellow-warmer) + (bg-active-value bg-cyan-nuanced) + (fg-active-value cyan-warmer) + + ;; Code mappings + + (builtin magenta-warmer) + (comment fg-dim) + (constant blue-cooler) + (docstring green-faint) + (fnname magenta) + (fnname-call pink) + (keyword magenta-cooler) + (preprocessor red-cooler) + (property cyan) + (rx-backslash magenta) + (rx-construct green-cooler) + (string blue-warmer) + (type cyan-cooler) + (variable cyan) + (variable-use slate) + + ;; Accent mappings + + (accent-0 blue) + (accent-1 magenta-warmer) + (accent-2 cyan) + (accent-3 red) + + ;; Completion mappings + + (fg-completion-match-0 blue) + (fg-completion-match-1 magenta-warmer) + (fg-completion-match-2 cyan) + (fg-completion-match-3 red) + + ;; Date mappings + + (date-common cyan) + (date-deadline red-cooler) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday red) + (date-holiday-other blue) + (date-range fg-alt) + (date-scheduled yellow) + (date-scheduled-subtle yellow-faint) + (date-weekday cyan) + (date-weekend magenta) + + ;; Link mappings + + (fg-link blue-warmer) + (underline-link blue-warmer) + (fg-link-symbolic cyan) + (underline-link-symbolic cyan) + (fg-link-visited magenta) + (underline-link-visited magenta) + + ;; Mail mappings + + (mail-cite-0 blue-faint) + (mail-cite-1 yellow-warmer) + (mail-cite-2 cyan-cooler) + (mail-cite-3 red-cooler) + (mail-part cyan) + (mail-recipient magenta-cooler) + (mail-subject magenta-warmer) + (mail-other magenta-faint) + + ;; Mark mappings + + (bg-mark-delete bg-red-subtle) + (fg-mark-delete red) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-yellow-subtle) + (fg-mark-other yellow) + + ;; Prompt mappings + + (fg-prompt cyan-cooler) + + ;; Prose mappings + + + (fg-prose-code cyan-cooler) + (fg-prose-macro magenta-cooler) + (fg-prose-verbatim magenta-warmer) + (prose-done green) + (prose-todo red) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula magenta-warmer) + (prose-tag magenta-faint) + + ;; Rainbow mappings + + (rainbow-0 fg-main) + (rainbow-1 magenta-intense) + (rainbow-2 cyan-intense) + (rainbow-3 red-warmer) + (rainbow-4 yellow-intense) + (rainbow-5 magenta-cooler) + (rainbow-6 green-intense) + (rainbow-7 blue-warmer) + (rainbow-8 magenta-warmer) + + ;; Search mappings + + (bg-search-current bg-yellow-intense) + (bg-search-lazy bg-cyan-intense) + (bg-search-static bg-magenta-subtle) + (bg-search-replace bg-red-intense) + + (bg-search-rx-group-0 bg-blue-intense) + (bg-search-rx-group-1 bg-green-intense) + (bg-search-rx-group-2 bg-red-subtle) + (bg-search-rx-group-3 bg-magenta-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 yellow-faint) + (fg-heading-3 fg-alt) + (fg-heading-4 magenta) + (fg-heading-5 green-faint) + (fg-heading-6 red-faint) + (fg-heading-7 cyan-warmer) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-operandi' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-operandi-tinted-palette + (append + '( + ;; Basic values + + (bg-main "#fbf7f0") + (bg-dim "#efe9dd") + (fg-main "#000000") + (fg-dim "#595959") + (fg-alt "#193668") + (bg-active "#c9b9b0") + (bg-inactive "#dfd5cf") + (border "#9f9690") + + ;; Common accent foregrounds + + (red "#a60000") + (red-warmer "#972500") + (red-cooler "#a0132f") + (red-faint "#7f0000") + (red-intense "#d00000") + (green "#006300") + (green-warmer "#306010") + (green-cooler "#00603f") + (green-faint "#2a5045") + (green-intense "#008900") + (yellow "#6d5000") + (yellow-warmer "#894000") + (yellow-cooler "#602938") + (yellow-faint "#574316") + (yellow-intense "#808000") + (blue "#0031a9") + (blue-warmer "#3546c2") + (blue-cooler "#0000b0") + (blue-faint "#003497") + (blue-intense "#0000ff") + (magenta "#721045") + (magenta-warmer "#8f0075") + (magenta-cooler "#531ab6") + (magenta-faint "#7c318f") + (magenta-intense "#dd22dd") + (cyan "#00598b") + (cyan-warmer "#32548f") + (cyan-cooler "#005f5f") + (cyan-faint "#304463") + (cyan-intense "#008899") + + ;; Uncommon accent foregrounds + + (rust "#8a290f") + (gold "#6c501c") + (olive "#425d00") + (slate "#2f3f83") + (indigo "#4a3a8a") + (maroon "#731c52") + (pink "#7b435c") + + ;; Common accent backgrounds + + (bg-red-intense "#ff8f88") + (bg-green-intense "#8adf80") + (bg-yellow-intense "#f3d000") + (bg-blue-intense "#bfc9ff") + (bg-magenta-intense "#dfa0f0") + (bg-cyan-intense "#a4d5f9") + + (bg-red-subtle "#ffcfbf") + (bg-green-subtle "#b3fabf") + (bg-yellow-subtle "#fff576") + (bg-blue-subtle "#ccdfff") + (bg-magenta-subtle "#ffddff") + (bg-cyan-subtle "#bfefff") + + (bg-red-nuanced "#ffe8e8") + (bg-green-nuanced "#e0f6e0") + (bg-yellow-nuanced "#f8f0d0") + (bg-blue-nuanced "#ecedff") + (bg-magenta-nuanced "#f8e6f5") + (bg-cyan-nuanced "#e0f2fa") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#f1c8b5") + (fg-clay "#63192a") + + (bg-ochre "#f0e3c0") + (fg-ochre "#573a30") + + (bg-lavender "#dfcdfa") + (fg-lavender "#443379") + + (bg-sage "#c0e7d4") + (fg-sage "#124b41") + + ;; Graphs + + (bg-graph-red-0 "#ef7969") + (bg-graph-red-1 "#ffaab4") + (bg-graph-green-0 "#45c050") + (bg-graph-green-1 "#75ef30") + (bg-graph-yellow-0 "#ffcf00") + (bg-graph-yellow-1 "#f9ff00") + (bg-graph-blue-0 "#7f90ff") + (bg-graph-blue-1 "#a6c0ff") + (bg-graph-magenta-0 "#e07fff") + (bg-graph-magenta-1 "#fad0ff") + (bg-graph-cyan-0 "#70d3f0") + (bg-graph-cyan-1 "#afefff") + + ;; Special purpose + + (bg-completion "#f0c1cf") + (bg-hover "#b2e4dc") + (bg-hover-secondary "#dfe09f") + (bg-hl-line "#f1d5d0") + (bg-region "#c2bcb5") + (fg-region "#000000") + + (bg-mode-line-active "#cab9b2") + (fg-mode-line-active "#000000") + (border-mode-line-active "#545454") + (bg-mode-line-inactive "#dfd9cf") + (fg-mode-line-inactive "#585858") + (border-mode-line-inactive "#a59a94") + + (modeline-err "#7f0000") + (modeline-warning "#5f0070") + (modeline-info "#002580") + + (bg-tab-bar "#e0d4ce") + (bg-tab-current "#fbf7f0") + (bg-tab-other "#c8b8b2") + + ;; Diffs + + (bg-added "#c3ebc1") + (bg-added-faint "#dcf8d1") + (bg-added-refine "#acd6a5") + (bg-added-fringe "#6cc06c") + (fg-added "#005000") + (fg-added-intense "#006700") + + (bg-changed "#ffdfa9") + (bg-changed-faint "#ffefbf") + (bg-changed-refine "#fac090") + (bg-changed-fringe "#c0b200") + (fg-changed "#553d00") + (fg-changed-intense "#655000") + + (bg-removed "#f4d0cf") + (bg-removed-faint "#ffe9e5") + (bg-removed-refine "#f3b5a7") + (bg-removed-fringe "#d84a4f") + (fg-removed "#8f1313") + (fg-removed-intense "#aa2222") + + (bg-diff-context "#efe9df") + + ;; Paren match + + (bg-paren-match "#7fdfcf") + (bg-paren-expression "#efd3f5") + + ;; General mappings + + (cursor red-intense) + (keybind red) + (name magenta) + (identifier yellow-faint) + + (err red) + (warning yellow) + (info green) + + (underline-err red-intense) + (underline-warning yellow-intense) + (underline-note cyan-intense) + + (bg-prominent-err bg-red-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-yellow-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-yellow-nuanced) + (fg-active-argument yellow-warmer) + (bg-active-value bg-cyan-nuanced) + (fg-active-value cyan-warmer) + + ;; Code mappings + + (builtin magenta) + (comment red-faint) + (constant magenta-cooler) + (docstring cyan-faint) + (fnname yellow-cooler) + (fnname-call pink) + (keyword blue) + (preprocessor yellow-warmer) + (property green-cooler) + (rx-backslash magenta-warmer) + (rx-construct magenta-cooler) + (string cyan) + (type green-warmer) + (variable green-cooler) + (variable-use green-faint) + + ;; Accent mappings + + (accent-0 red-cooler) + (accent-1 cyan) + (accent-2 magenta-cooler) + (accent-3 yellow-warmer) + + ;; Completion mappings + + (fg-completion-match-0 blue) + (fg-completion-match-1 magenta-warmer) + (fg-completion-match-2 cyan) + (fg-completion-match-3 red) + + ;; Date mappings + + (date-common cyan) + (date-deadline red-cooler) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday red) + (date-holiday-other blue) + (date-range fg-alt) + (date-scheduled yellow) + (date-scheduled-subtle yellow-faint) + (date-weekday cyan) + (date-weekend magenta) + + ;; Link mappings + + (fg-link blue-warmer) + (underline-link blue-warmer) + (fg-link-symbolic cyan) + (underline-link-symbolic cyan) + (fg-link-visited magenta) + (underline-link-visited magenta) + + ;; Mail mappings + + (mail-cite-0 cyan) + (mail-cite-1 yellow) + (mail-cite-2 green-warmer) + (mail-cite-3 red-cooler) + (mail-part green-cooler) + (mail-recipient blue-warmer) + (mail-subject magenta-warmer) + (mail-other magenta) + + ;; Mark mappings + + (bg-mark-delete bg-red-subtle) + (fg-mark-delete red) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-yellow-subtle) + (fg-mark-other yellow) + + ;; Prompt mappings + + (fg-prompt green-cooler) + + ;; Prose mappings + + (fg-prose-code green-cooler) + (fg-prose-macro blue-cooler) + (fg-prose-verbatim yellow-warmer) + (prose-done green) + (prose-todo red) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula magenta-warmer) + (prose-tag magenta-faint) + + ;; Rainbow mappings + + (rainbow-0 fg-main) + (rainbow-1 magenta-intense) + (rainbow-2 cyan-intense) + (rainbow-3 red-warmer) + (rainbow-4 yellow-intense) + (rainbow-5 magenta-cooler) + (rainbow-6 green-intense) + (rainbow-7 blue-warmer) + (rainbow-8 magenta-warmer) + + ;; Search mappings + + (bg-search-current bg-yellow-intense) + (bg-search-lazy bg-cyan-intense) + (bg-search-static bg-magenta-subtle) + (bg-search-replace bg-red-intense) + + (bg-search-rx-group-0 bg-blue-intense) + (bg-search-rx-group-1 bg-green-intense) + (bg-search-rx-group-2 bg-red-subtle) + (bg-search-rx-group-3 bg-magenta-subtle) + + ;; Heading mappings + + (fg-heading-0 green-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 yellow-faint) + (fg-heading-3 fg-alt) + (fg-heading-4 magenta) + (fg-heading-5 green-faint) + (fg-heading-6 red-faint) + (fg-heading-7 cyan-warmer) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-operandi-tinted' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-operandi-deuteranopia-palette + (append + '( + ;; Basic values + + (bg-main "#ffffff") + (bg-dim "#f2f2f2") + (fg-main "#000000") + (fg-dim "#595959") + (fg-alt "#193668") + (bg-active "#c4c4c4") + (bg-inactive "#e0e0e0") + (border "#9f9f9f") + + ;; Common accent foregrounds + + (red "#a60000") + (red-warmer "#972500") + (red-cooler "#a0132f") + (red-faint "#7f0000") + (red-intense "#d00000") + (green "#006800") + (green-warmer "#316500") + (green-cooler "#00663f") + (green-faint "#2a5045") + (green-intense "#008900") + (yellow "#695500") + (yellow-warmer "#973300") + (yellow-cooler "#77492f") + (yellow-faint "#624416") + (yellow-intense "#808000") + (blue "#0031a9") + (blue-warmer "#3548cf") + (blue-cooler "#0000b0") + (blue-faint "#003497") + (blue-intense "#0000ff") + (magenta "#721045") + (magenta-warmer "#8f0075") + (magenta-cooler "#531ab6") + (magenta-faint "#7c318f") + (magenta-intense "#dd22dd") + (cyan "#005e8b") + (cyan-warmer "#3f578f") + (cyan-cooler "#005f5f") + (cyan-faint "#005077") + (cyan-intense "#008899") + + ;; Uncommon accent foregrounds + + (rust "#8a290f") + (gold "#70550f") + (olive "#4c6000") + (slate "#2f3f83") + (indigo "#4a3a8a") + (maroon "#731c52") + (pink "#7b435c") + + ;; Common accent backgrounds + + (bg-red-intense "#ff8f88") + (bg-green-intense "#8adf80") + (bg-yellow-intense "#f3d000") + (bg-blue-intense "#bfc9ff") + (bg-magenta-intense "#dfa0f0") + (bg-cyan-intense "#a4d5f9") + + (bg-red-subtle "#ffcfbf") + (bg-green-subtle "#b3fabf") + (bg-yellow-subtle "#fff576") + (bg-blue-subtle "#ccdfff") + (bg-magenta-subtle "#ffddff") + (bg-cyan-subtle "#bfefff") + + (bg-red-nuanced "#ffe8e8") + (bg-green-nuanced "#e0f6e0") + (bg-yellow-nuanced "#f8f0d0") + (bg-blue-nuanced "#ecedff") + (bg-magenta-nuanced "#f8e6f5") + (bg-cyan-nuanced "#e0f2fa") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#f1c8b5") + (fg-clay "#63192a") + + (bg-ochre "#f0e3c0") + (fg-ochre "#573a30") + + (bg-lavender "#dfcdfa") + (fg-lavender "#443379") + + (bg-sage "#c0e7d4") + (fg-sage "#124b41") + + ;; Graphs + + (bg-graph-red-0 "#d0b029") + (bg-graph-red-1 "#e0cab4") + (bg-graph-green-0 "#8ac050") + (bg-graph-green-1 "#afdfa5") + (bg-graph-yellow-0 "#ffcf00") + (bg-graph-yellow-1 "#f9ff00") + (bg-graph-blue-0 "#7f9fff") + (bg-graph-blue-1 "#afd0ff") + (bg-graph-magenta-0 "#b0b0d0") + (bg-graph-magenta-1 "#d0dfdf") + (bg-graph-cyan-0 "#6faad9") + (bg-graph-cyan-1 "#bfe0ff") + + ;; Special purpose + + (bg-completion "#c0deff") + (bg-hover "#b2e4dc") + (bg-hover-secondary "#e5d7a0") + (bg-hl-line "#dae5ec") + (bg-region "#bdbdbd") + (fg-region "#000000") + + (bg-mode-line-active "#d0d6ff") + (fg-mode-line-active "#0f0f0f") + (border-mode-line-active "#4f4f74") + (bg-mode-line-inactive "#e6e6e6") + (fg-mode-line-inactive "#585858") + (border-mode-line-inactive "#a3a3a3") + + (modeline-err "#603a00") + (modeline-warning "#454500") + (modeline-info "#023d92") + + (bg-tab-bar "#dfdfdf") + (bg-tab-current "#ffffff") + (bg-tab-other "#c2c2c2") + + ;; Diffs + + (bg-added "#d5d7ff") + (bg-added-faint "#e6e6ff") + (bg-added-refine "#babcef") + (bg-added-fringe "#275acc") + (fg-added "#303099") + (fg-added-intense "#0303cc") + + (bg-changed "#eecfdf") + (bg-changed-faint "#f0dde5") + (bg-changed-refine "#e0b0d0") + (bg-changed-fringe "#9f6ab0") + (fg-changed "#6f1343") + (fg-changed-intense "#7f0f9f") + + (bg-removed "#f4f099") + (bg-removed-faint "#f6f6b7") + (bg-removed-refine "#ede06f") + (bg-removed-fringe "#c0b200") + (fg-removed "#553d00") + (fg-removed-intense "#7f6f00") + + (bg-diff-context "#f3f3f3") + + ;; Paren match + + (bg-paren-match "#5fcfff") + + (bg-paren-expression "#efd3f5") + (underline-paren-match unspecified) + + ;; General mappings + + (cursor blue-intense) + (keybind blue-cooler) + (name blue-cooler) + (identifier yellow-faint) + + (err yellow-warmer) + (warning yellow) + (info blue) + + (underline-err yellow-intense) + (underline-warning magenta-faint) + (underline-note cyan) + + (bg-prominent-err bg-yellow-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-magenta-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-yellow-nuanced) + (fg-active-argument yellow-warmer) + (bg-active-value bg-blue-nuanced) + (fg-active-value blue-warmer) + + ;; Code mappings + + (builtin yellow) + (comment yellow-cooler) + (constant blue-faint) + (docstring green-faint) + (fnname yellow-warmer) + (fnname-call gold) + (keyword blue-cooler) + (preprocessor magenta-cooler) + (property cyan) + (rx-backslash blue-cooler) + (rx-construct yellow-cooler) + (string blue-warmer) + (type cyan-cooler) + (variable cyan) + (variable-use indigo) + + ;; Accent mappings + + (accent-0 blue-warmer) + (accent-1 yellow-warmer) + (accent-2 cyan) + (accent-3 yellow-cooler) + + ;; Completion mappings + + (fg-completion-match-0 blue-warmer) + (fg-completion-match-1 yellow-warmer) + (fg-completion-match-2 cyan) + (fg-completion-match-3 yellow-cooler) + + ;; Date mappings + + (date-common cyan) + (date-deadline yellow-warmer) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday yellow-warmer) + (date-holiday-other blue) + (date-range fg-alt) + (date-scheduled yellow-cooler) + (date-scheduled-subtle yellow-faint) + (date-weekday cyan) + (date-weekend blue-cooler) + + ;; Link mappings + + (fg-link blue-warmer) + (underline-link blue-warmer) + (fg-link-symbolic cyan) + (underline-link-symbolic cyan) + (fg-link-visited yellow-faint) + (underline-link-visited yellow-faint) + + ;; Mail mappings + + (mail-cite-0 blue-warmer) + (mail-cite-1 yellow) + (mail-cite-2 cyan-faint) + (mail-cite-3 yellow-faint) + (mail-part blue) + (mail-recipient blue) + (mail-subject yellow-cooler) + (mail-other cyan-faint) + + ;; Mark mappings + + (bg-mark-delete bg-yellow-subtle) + (fg-mark-delete yellow) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-magenta-subtle) + (fg-mark-other magenta) + + ;; Prompt mappings + + (fg-prompt blue) + + ;; Prose mappings + + (fg-prose-code cyan-cooler) + (fg-prose-macro magenta-cooler) + (fg-prose-verbatim yellow) + (prose-done blue) + (prose-todo yellow-warmer) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula yellow-warmer) + (prose-tag fg-alt) + + ;; Rainbow mappings + + (rainbow-0 blue) + (rainbow-1 yellow) + (rainbow-2 blue-warmer) + (rainbow-3 yellow-cooler) + (rainbow-4 blue-cooler) + (rainbow-5 yellow-warmer) + (rainbow-6 blue-faint) + (rainbow-7 yellow-faint) + (rainbow-8 cyan) + + ;; Search mappings + + (bg-search-current bg-yellow-intense) + (bg-search-lazy bg-blue-intense) + (bg-search-static bg-cyan-subtle) + (bg-search-replace bg-yellow-intense) + + (bg-search-rx-group-0 bg-cyan-intense) + (bg-search-rx-group-1 bg-magenta-intense) + (bg-search-rx-group-2 bg-blue-subtle) + (bg-search-rx-group-3 bg-yellow-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 yellow-faint) + (fg-heading-3 blue-faint) + (fg-heading-4 green-faint) + (fg-heading-5 magenta-cooler) + (fg-heading-6 yellow-cooler) + (fg-heading-7 cyan) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-operandi-deuteranopia' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-operandi-tritanopia-palette + (append + '( + ;; Basic values + + (bg-main "#ffffff") + (bg-dim "#f2f2f2") + (fg-main "#000000") + (fg-dim "#595959") + (fg-alt "#224960") + (bg-active "#c4c4c4") + (bg-inactive "#e0e0e0") + (border "#9f9f9f") + + ;; Common accent foregrounds + + (red "#a60000") + (red-warmer "#b21100") + (red-cooler "#a0132f") + (red-faint "#702000") + (red-intense "#d00000") + (green "#006800") + (green-warmer "#316500") + (green-cooler "#00663f") + (green-faint "#2a5045") + (green-intense "#008900") + (yellow "#695500") + (yellow-warmer "#973300") + (yellow-cooler "#77492f") + (yellow-faint "#624416") + (yellow-intense "#808000") + (blue "#0031a9") + (blue-warmer "#3548cf") + (blue-cooler "#0000b0") + (blue-faint "#003497") + (blue-intense "#0000ff") + (magenta "#721045") + (magenta-warmer "#8f0075") + (magenta-cooler "#531ab6") + (magenta-faint "#7c318f") + (magenta-intense "#cd22bd") + (cyan "#005e8b") + (cyan-warmer "#3f578f") + (cyan-cooler "#005f5f") + (cyan-faint "#004f5f") + (cyan-intense "#008899") + + ;; Uncommon accent foregrounds + + (rust "#8a290f") + (gold "#70550f") + (olive "#4c6000") + (slate "#104860") + (indigo "#4a3a8a") + (maroon "#731c52") + (pink "#7b435c") + + ;; Common accent backgrounds + + (bg-red-intense "#ff8f88") + (bg-green-intense "#8adf80") + (bg-yellow-intense "#f3d000") + (bg-blue-intense "#bfc9ff") + (bg-magenta-intense "#dfa0f0") + (bg-cyan-intense "#a4d5f9") + + (bg-red-subtle "#ffcfbf") + (bg-green-subtle "#b3fabf") + (bg-yellow-subtle "#fff576") + (bg-blue-subtle "#ccdfff") + (bg-magenta-subtle "#ffddff") + (bg-cyan-subtle "#bfefff") + + (bg-red-nuanced "#ffe8e8") + (bg-green-nuanced "#e0f6e0") + (bg-yellow-nuanced "#f8f0d0") + (bg-blue-nuanced "#ecedff") + (bg-magenta-nuanced "#f8e6f5") + (bg-cyan-nuanced "#e0f2fa") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#f1c8b5") + (fg-clay "#63192a") + + (bg-ochre "#f0e3c0") + (fg-ochre "#573a30") + + (bg-lavender "#dfcdfa") + (fg-lavender "#443379") + + (bg-sage "#c0e7d4") + (fg-sage "#124b41") + + ;; Graphs + + (bg-graph-red-0 "#ef7969") + (bg-graph-red-1 "#ffaab4") + (bg-graph-green-0 "#68c0a0") + (bg-graph-green-1 "#a5dfd0") + (bg-graph-yellow-0 "#d99f9f") + (bg-graph-yellow-1 "#ffb58f") + (bg-graph-blue-0 "#80a0df") + (bg-graph-blue-1 "#a8cfff") + (bg-graph-magenta-0 "#efafcf") + (bg-graph-magenta-1 "#ffdaef") + (bg-graph-cyan-0 "#7fd3ed") + (bg-graph-cyan-1 "#afefff") + + ;; Special purpose + + (bg-completion "#afdfef") + (bg-hover "#ffafbc") + (bg-hover-secondary "#abdfdd") + (bg-hl-line "#dfeaec") + (bg-region "#bdbdbd") + (fg-region "#000000") + + (bg-mode-line-active "#afe0f2") + (fg-mode-line-active "#0f0f0f") + (border-mode-line-active "#2f4f44") + (bg-mode-line-inactive "#e6e6e6") + (fg-mode-line-inactive "#585858") + (border-mode-line-inactive "#a3a3a3") + + (modeline-err "#8f0000") + (modeline-warning "#6f306f") + (modeline-info "#00445f") + + (bg-tab-bar "#dfdfdf") + (bg-tab-current "#ffffff") + (bg-tab-other "#c2c2c2") + + ;; Diffs + + (bg-added "#b5e7ff") + (bg-added-faint "#c6f6ff") + (bg-added-refine "#9adcef") + (bg-added-fringe "#1782cc") + (fg-added "#005079") + (fg-added-intense "#0043aa") + + (bg-changed "#eecfdf") + (bg-changed-faint "#f0dde5") + (bg-changed-refine "#e0b0d0") + (bg-changed-fringe "#9f6ab0") + (fg-changed "#6f1343") + (fg-changed-intense "#7f0f9f") + + (bg-removed "#ffd8d5") + (bg-removed-faint "#ffe9e9") + (bg-removed-refine "#f3b5af") + (bg-removed-fringe "#d84a4f") + (fg-removed "#8f1313") + (fg-removed-intense "#aa2222") + + (bg-diff-context "#f3f3f3") + + ;; Paren match + + (bg-paren-match "#5fcfff") + (bg-paren-expression "#efd3f5") + + ;; General mappings + + (cursor red-intense) + (keybind red) + (name red-cooler) + (identifier red-faint) + + (err red-warmer) + (warning magenta) + (info cyan) + + (underline-err red-intense) + (underline-warning magenta-intense) + (underline-note cyan-intense) + + (bg-prominent-err bg-red-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-magenta-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-red-nuanced) + (fg-active-argument red-warmer) + (bg-active-value bg-cyan-nuanced) + (fg-active-value cyan) + + ;; Code mappings + + (builtin magenta) + (comment red-faint) + (constant green-cooler) + (docstring fg-alt) + (fnname cyan-warmer) + (fnname-call indigo) + (keyword red-cooler) + (preprocessor red-warmer) + (property cyan-cooler) + (rx-backslash magenta) + (rx-construct red) + (string cyan) + (type blue-warmer) + (variable cyan-cooler) + (variable-use slate) + + ;; Accent mappings + + (accent-0 cyan) + (accent-1 red-warmer) + (accent-2 cyan-cooler) + (accent-3 magenta) + + ;; Completion mappings + + (fg-completion-match-0 cyan) + (fg-completion-match-1 red-warmer) + (fg-completion-match-2 magenta) + (fg-completion-match-3 cyan-cooler) + + ;; Date mappings + + (date-common cyan-cooler) + (date-deadline red) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday red) + (date-holiday-other cyan) + (date-range fg-alt) + (date-scheduled magenta) + (date-scheduled-subtle magenta-faint) + (date-weekday cyan) + (date-weekend magenta-warmer) + + ;; Link mappings + + (fg-link cyan) + (underline-link cyan) + (fg-link-symbolic cyan-cooler) + (underline-link-symbolic cyan-cooler) + (fg-link-visited magenta) + (underline-link-visited magenta) + + ;; Mail mappings + + (mail-cite-0 cyan-faint) + (mail-cite-1 red-faint) + (mail-cite-2 magenta-warmer) + (mail-cite-3 cyan-warmer) + (mail-part cyan-cooler) + (mail-recipient cyan) + (mail-subject red-cooler) + (mail-other cyan) + + ;; Mark mappings + + (bg-mark-delete bg-red-subtle) + (fg-mark-delete red) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-magenta-subtle) + (fg-mark-other magenta) + + ;; Prompt mappings + + (fg-prompt cyan-cooler) + + ;; Prose mappings + + (fg-prose-code cyan) + (fg-prose-macro red-warmer) + (fg-prose-verbatim magenta-warmer) + (prose-done cyan) + (prose-todo red) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula red-cooler) + (prose-tag fg-alt) + + ;; Rainbow mappings + + (rainbow-0 cyan) + (rainbow-1 red) + (rainbow-2 cyan-warmer) + (rainbow-3 red-cooler) + (rainbow-4 cyan-cooler) + (rainbow-5 magenta) + (rainbow-6 cyan-faint) + (rainbow-7 magenta-faint) + (rainbow-8 red-faint) + + ;; Search mappings + + (bg-search-current bg-red-intense) + (bg-search-lazy bg-cyan-intense) + (bg-search-static bg-magenta-subtle) + (bg-search-replace bg-magenta-intense) + + (bg-search-rx-group-0 bg-blue-intense) + (bg-search-rx-group-1 bg-magenta-intense) + (bg-search-rx-group-2 bg-cyan-subtle) + (bg-search-rx-group-3 bg-red-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 red-faint) + (fg-heading-3 cyan-faint) + (fg-heading-4 magenta) + (fg-heading-5 green-faint) + (fg-heading-6 magenta-faint) + (fg-heading-7 cyan-warmer) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-operandi-tritanopia' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-vivendi-palette + (append + '( + ;; Basic values + + (bg-main "#000000") + (bg-dim "#1e1e1e") + (fg-main "#ffffff") + (fg-dim "#989898") + (fg-alt "#c6daff") + (bg-active "#535353") + (bg-inactive "#303030") + (border "#646464") + + ;; Common accent foregrounds + + (red "#ff5f59") + (red-warmer "#ff6b55") + (red-cooler "#ff7f86") + (red-faint "#ff9580") + (red-intense "#ff5f5f") + (green "#44bc44") + (green-warmer "#70b900") + (green-cooler "#00c06f") + (green-faint "#88ca9f") + (green-intense "#44df44") + (yellow "#d0bc00") + (yellow-warmer "#fec43f") + (yellow-cooler "#dfaf7a") + (yellow-faint "#d2b580") + (yellow-intense "#efef00") + (blue "#2fafff") + (blue-warmer "#79a8ff") + (blue-cooler "#00bcff") + (blue-faint "#82b0ec") + (blue-intense "#338fff") + (magenta "#feacd0") + (magenta-warmer "#f78fe7") + (magenta-cooler "#b6a0ff") + (magenta-faint "#caa6df") + (magenta-intense "#ff66ff") + (cyan "#00d3d0") + (cyan-warmer "#4ae2f0") + (cyan-cooler "#6ae4b9") + (cyan-faint "#9ac8e0") + (cyan-intense "#00eff0") + + ;; Uncommon accent foregrounds + + (rust "#db7b5f") + (gold "#c0965b") + (olive "#9cbd6f") + (slate "#76afbf") + (indigo "#9099d9") + (maroon "#cf7fa7") + (pink "#d09dc0") + + ;; Common accent backgrounds + + (bg-red-intense "#9d1f1f") + (bg-green-intense "#2f822f") + (bg-yellow-intense "#7a6100") + (bg-blue-intense "#1640b0") + (bg-magenta-intense "#7030af") + (bg-cyan-intense "#2266ae") + + (bg-red-subtle "#620f2a") + (bg-green-subtle "#00422a") + (bg-yellow-subtle "#4a4000") + (bg-blue-subtle "#242679") + (bg-magenta-subtle "#552f5f") + (bg-cyan-subtle "#004065") + + (bg-red-nuanced "#3a0c14") + (bg-green-nuanced "#092f1f") + (bg-yellow-nuanced "#381d0f") + (bg-blue-nuanced "#12154a") + (bg-magenta-nuanced "#2f0c3f") + (bg-cyan-nuanced "#042837") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#49191a") + (fg-clay "#f1b090") + + (bg-ochre "#462f20") + (fg-ochre "#e0d38c") + + (bg-lavender "#38325c") + (fg-lavender "#dfc0f0") + + (bg-sage "#143e32") + (fg-sage "#c3e7d4") + + ;; Graphs + + (bg-graph-red-0 "#b52c2c") + (bg-graph-red-1 "#702020") + (bg-graph-green-0 "#0fed00") + (bg-graph-green-1 "#007800") + (bg-graph-yellow-0 "#f1e00a") + (bg-graph-yellow-1 "#b08940") + (bg-graph-blue-0 "#2fafef") + (bg-graph-blue-1 "#1f2f8f") + (bg-graph-magenta-0 "#bf94fe") + (bg-graph-magenta-1 "#5f509f") + (bg-graph-cyan-0 "#47dfea") + (bg-graph-cyan-1 "#00808f") + + ;; Special purpose + + (bg-completion "#2f447f") + (bg-hover "#45605e") + (bg-hover-secondary "#654a39") + (bg-hl-line "#2f3849") + (bg-region "#5a5a5a") + (fg-region "#ffffff") + + (bg-mode-line-active "#505050") + (fg-mode-line-active "#ffffff") + (border-mode-line-active "#959595") + (bg-mode-line-inactive "#2d2d2d") + (fg-mode-line-inactive "#969696") + (border-mode-line-inactive "#606060") + + (modeline-err "#ffa9bf") + (modeline-warning "#dfcf43") + (modeline-info "#9fefff") + + (bg-tab-bar "#313131") + (bg-tab-current "#000000") + (bg-tab-other "#545454") + + ;; Diffs + + (bg-added "#00381f") + (bg-added-faint "#002910") + (bg-added-refine "#034f2f") + (bg-added-fringe "#237f3f") + (fg-added "#a0e0a0") + (fg-added-intense "#80e080") + + (bg-changed "#363300") + (bg-changed-faint "#2a1f00") + (bg-changed-refine "#4a4a00") + (bg-changed-fringe "#8a7a00") + (fg-changed "#efef80") + (fg-changed-intense "#c0b05f") + + (bg-removed "#4f1119") + (bg-removed-faint "#380a0f") + (bg-removed-refine "#781a1f") + (bg-removed-fringe "#b81a1f") + (fg-removed "#ffbfbf") + (fg-removed-intense "#ff9095") + + (bg-diff-context "#1a1a1a") + + ;; Paren match + + (bg-paren-match "#2f7f9f") + (bg-paren-expression "#453040") + + ;; General mappings + + (cursor fg-main) + (keybind blue-cooler) + (name magenta) + (identifier yellow-faint) + + (err red) + (warning yellow-warmer) + (info cyan-cooler) + + (underline-err red-intense) + (underline-warning yellow) + (underline-note cyan) + + (bg-prominent-err bg-red-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-yellow-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-yellow-nuanced) + (fg-active-argument yellow-cooler) + (bg-active-value bg-cyan-nuanced) + (fg-active-value cyan-cooler) + + ;; Code mappings + + (builtin magenta-warmer) + (comment fg-dim) + (constant blue-cooler) + (docstring cyan-faint) + (fnname magenta) + (fnname-call pink) + (keyword magenta-cooler) + (preprocessor red-cooler) + (property cyan) + (rx-backslash magenta) + (rx-construct green-cooler) + (string blue-warmer) + (type cyan-cooler) + (variable cyan) + (variable-use slate) + + ;; Accent mappings + + (accent-0 blue-cooler) + (accent-1 magenta-warmer) + (accent-2 cyan-cooler) + (accent-3 yellow) + + ;; Completion mappings + + (fg-completion-match-0 blue-cooler) + (fg-completion-match-1 magenta-warmer) + (fg-completion-match-2 cyan-cooler) + (fg-completion-match-3 yellow) + + ;; Date mappings + + (date-common cyan) + (date-deadline red-cooler) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday magenta-warmer) + (date-holiday-other blue) + (date-range fg-alt) + (date-scheduled yellow-cooler) + (date-scheduled-subtle yellow-faint) + (date-weekday cyan) + (date-weekend magenta) + + ;; Link mappings + + (fg-link blue-warmer) + (underline-link blue-warmer) + (fg-link-symbolic cyan) + (underline-link-symbolic cyan) + (fg-link-visited magenta) + (underline-link-visited magenta) + + ;; Mail mappings + + (mail-cite-0 blue-warmer) + (mail-cite-1 yellow-cooler) + (mail-cite-2 cyan-cooler) + (mail-cite-3 red-cooler) + (mail-part blue) + (mail-recipient magenta-cooler) + (mail-subject magenta-warmer) + (mail-other magenta-faint) + + ;; Mark mappings + + (bg-mark-delete bg-red-subtle) + (fg-mark-delete red-cooler) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-yellow-subtle) + (fg-mark-other yellow) + + ;; Prompt mappings + + (fg-prompt cyan-cooler) + + ;; Prose mappings + + (fg-prose-code cyan-cooler) + (fg-prose-macro magenta-cooler) + (fg-prose-verbatim magenta-warmer) + (prose-done green) + (prose-todo red) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula magenta-warmer) + (prose-tag magenta-faint) + + ;; Rainbow mappings + + (rainbow-0 fg-main) + (rainbow-1 magenta-intense) + (rainbow-2 cyan-intense) + (rainbow-3 red-warmer) + (rainbow-4 yellow-intense) + (rainbow-5 magenta-cooler) + (rainbow-6 green-intense) + (rainbow-7 blue-warmer) + (rainbow-8 magenta-warmer) + + ;; Search mappings + + (bg-search-current bg-yellow-intense) + (bg-search-lazy bg-cyan-intense) + (bg-search-static bg-magenta-subtle) + (bg-search-replace bg-red-intense) + + (bg-search-rx-group-0 bg-blue-intense) + (bg-search-rx-group-1 bg-green-intense) + (bg-search-rx-group-2 bg-red-subtle) + (bg-search-rx-group-3 bg-magenta-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 yellow-faint) + (fg-heading-3 blue-faint) + (fg-heading-4 magenta) + (fg-heading-5 green-faint) + (fg-heading-6 red-faint) + (fg-heading-7 cyan-faint) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-vivendi' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-vivendi-tinted-palette + (append + '( + ;; Basic values + + (bg-main "#0d0e1c") + (bg-dim "#1d2235") + (fg-main "#ffffff") + (fg-dim "#989898") + (fg-alt "#c6daff") + (bg-active "#4a4f69") + (bg-inactive "#2b3045") + (border "#61647a") + + ;; Common accent foregrounds + + (red "#ff5f59") + (red-warmer "#ff6b55") + (red-cooler "#ff7f86") + (red-faint "#ef8386") + (red-intense "#ff5f5f") + (green "#44bc44") + (green-warmer "#75c13e") + (green-cooler "#11c777") + (green-faint "#88ca9f") + (green-intense "#44df44") + (yellow "#d0bc00") + (yellow-warmer "#fec43f") + (yellow-cooler "#dfaf7a") + (yellow-faint "#d2b580") + (yellow-intense "#efef00") + (blue "#2fafff") + (blue-warmer "#79a8ff") + (blue-cooler "#00bcff") + (blue-faint "#82b0ec") + (blue-intense "#338fff") + (magenta "#feacd0") + (magenta-warmer "#f78fe7") + (magenta-cooler "#b6a0ff") + (magenta-faint "#caa6df") + (magenta-intense "#ff66ff") + (cyan "#00d3d0") + (cyan-warmer "#4ae2f0") + (cyan-cooler "#6ae4b9") + (cyan-faint "#9ac8e0") + (cyan-intense "#00eff0") + + ;; Uncommon accent foregrounds + + (rust "#db8b3f") + (gold "#c0965b") + (olive "#9cbd6f") + (slate "#76afbf") + (indigo "#9099d9") + (maroon "#cf7fa7") + (pink "#d09dc0") + + ;; Common accent backgrounds + + (bg-red-intense "#9d1f1f") + (bg-green-intense "#2f822f") + (bg-yellow-intense "#7a6100") + (bg-blue-intense "#1640b0") + (bg-magenta-intense "#7030af") + (bg-cyan-intense "#2266ae") + + (bg-red-subtle "#620f2a") + (bg-green-subtle "#00422a") + (bg-yellow-subtle "#4a4000") + (bg-blue-subtle "#242679") + (bg-magenta-subtle "#552f5f") + (bg-cyan-subtle "#004065") + + (bg-red-nuanced "#3a0c14") + (bg-green-nuanced "#092f1f") + (bg-yellow-nuanced "#381d0f") + (bg-blue-nuanced "#12154a") + (bg-magenta-nuanced "#2f0c3f") + (bg-cyan-nuanced "#042837") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#49191a") + (fg-clay "#f1b090") + + (bg-ochre "#462f20") + (fg-ochre "#e0d09c") + + (bg-lavender "#38325c") + (fg-lavender "#dfc0f0") + + (bg-sage "#143e32") + (fg-sage "#83d7ac") + + ;; Graphs + + (bg-graph-red-0 "#b52c2c") + (bg-graph-red-1 "#702020") + (bg-graph-green-0 "#0fed00") + (bg-graph-green-1 "#007800") + (bg-graph-yellow-0 "#f1e00a") + (bg-graph-yellow-1 "#b08940") + (bg-graph-blue-0 "#2fafef") + (bg-graph-blue-1 "#1f2f8f") + (bg-graph-magenta-0 "#bf94fe") + (bg-graph-magenta-1 "#5f509f") + (bg-graph-cyan-0 "#47dfea") + (bg-graph-cyan-1 "#00808f") + + ;; Special purpose + + (bg-completion "#483d8a") + (bg-hover "#45605e") + (bg-hover-secondary "#64404f") + (bg-hl-line "#303a6f") + (bg-region "#555a66") + (fg-region "#ffffff") + + (bg-mode-line-active "#484d67") + (fg-mode-line-active "#ffffff") + (border-mode-line-active "#979797") + (bg-mode-line-inactive "#292d48") + (fg-mode-line-inactive "#969696") + (border-mode-line-inactive "#606270") + + (modeline-err "#ffa9bf") + (modeline-warning "#dfcf43") + (modeline-info "#9fefff") + + (bg-tab-bar "#2c3045") + (bg-tab-current "#0d0e1c") + (bg-tab-other "#4a4f6a") + + ;; Diffs + + (bg-added "#003a2f") + (bg-added-faint "#002922") + (bg-added-refine "#035542") + (bg-added-fringe "#23884f") + (fg-added "#a0e0a0") + (fg-added-intense "#80e080") + + (bg-changed "#363300") + (bg-changed-faint "#2a1f00") + (bg-changed-refine "#4a4a00") + (bg-changed-fringe "#8f7a30") + (fg-changed "#efef80") + (fg-changed-intense "#c0b05f") + + (bg-removed "#4f1127") + (bg-removed-faint "#380a19") + (bg-removed-refine "#781a3a") + (bg-removed-fringe "#b81a26") + (fg-removed "#ffbfbf") + (fg-removed-intense "#ff9095") + + (bg-diff-context "#1a1f30") + + ;; Paren match + + (bg-paren-match "#4f7f9f") + (bg-paren-expression "#453040") + + ;; General mappings + + (cursor magenta-intense) + (keybind magenta-cooler) + (name magenta) + (identifier yellow-faint) + + (err red) + (warning yellow) + (info green-cooler) + + (underline-err red-intense) + (underline-warning yellow) + (underline-note cyan) + + (bg-prominent-err bg-red-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-yellow-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-yellow-nuanced) + (fg-active-argument yellow-cooler) + (bg-active-value bg-cyan-nuanced) + (fg-active-value cyan-cooler) + + ;; Code mappings + + (builtin magenta) + (comment red-faint) + (constant magenta-cooler) + (docstring cyan-faint) + (fnname magenta-warmer) + (fnname-call pink) + (keyword blue-warmer) + (preprocessor red-cooler) + (property cyan-warmer) + (rx-backslash magenta-warmer) + (rx-construct magenta-cooler) + (string blue) + (type green-cooler) + (variable cyan-warmer) + (variable-use slate) + + ;; Accent mappings + + (accent-0 magenta-cooler) + (accent-1 cyan) + (accent-2 magenta-warmer) + (accent-3 yellow-warmer) + + ;; Completion mappings + + (fg-completion-match-0 blue-cooler) + (fg-completion-match-1 magenta-warmer) + (fg-completion-match-2 cyan-cooler) + (fg-completion-match-3 yellow) + + ;; Date mappings + + (date-common cyan) + (date-deadline red-cooler) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday magenta-warmer) + (date-holiday-other blue) + (date-range fg-alt) + (date-scheduled yellow-cooler) + (date-scheduled-subtle yellow-faint) + (date-weekday cyan) + (date-weekend magenta) + + ;; Link mappings + + (fg-link blue-warmer) + (underline-link blue-warmer) + (fg-link-symbolic cyan) + (underline-link-symbolic cyan) + (fg-link-visited magenta) + (underline-link-visited magenta) + + ;; Mail mappings + + (mail-cite-0 blue-faint) + (mail-cite-1 yellow-cooler) + (mail-cite-2 cyan-cooler) + (mail-cite-3 red-cooler) + (mail-part blue) + (mail-recipient blue-warmer) + (mail-subject magenta-warmer) + (mail-other magenta) + + ;; Mark mappings + + (bg-mark-delete bg-red-subtle) + (fg-mark-delete red-cooler) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-yellow-subtle) + (fg-mark-other yellow) + + ;; Prompt mappings + + (fg-prompt cyan-warmer) + + ;; Prose mappings + + (fg-prose-code cyan-cooler) + (fg-prose-macro magenta-cooler) + (fg-prose-verbatim magenta-warmer) + (prose-done green) + (prose-todo red) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula magenta-warmer) + (prose-tag magenta-faint) + + ;; Rainbow mappings + + (rainbow-0 fg-main) + (rainbow-1 magenta-intense) + (rainbow-2 cyan-intense) + (rainbow-3 red-warmer) + (rainbow-4 yellow-intense) + (rainbow-5 magenta-cooler) + (rainbow-6 green-intense) + (rainbow-7 blue-warmer) + (rainbow-8 magenta-warmer) + + ;; Search mappings + + (bg-search-current bg-yellow-intense) + (bg-search-lazy bg-cyan-intense) + (bg-search-static bg-magenta-subtle) + (bg-search-replace bg-red-intense) + + (bg-search-rx-group-0 bg-blue-intense) + (bg-search-rx-group-1 bg-green-intense) + (bg-search-rx-group-2 bg-red-subtle) + (bg-search-rx-group-3 bg-magenta-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 yellow-faint) + (fg-heading-3 blue-faint) + (fg-heading-4 magenta) + (fg-heading-5 green-faint) + (fg-heading-6 red-faint) + (fg-heading-7 cyan-faint) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-vivendi-tinted' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-vivendi-deuteranopia-palette + (append + '( + ;; Basic values + + (bg-main "#000000") + (bg-dim "#1e1e1e") + (fg-main "#ffffff") + (fg-dim "#989898") + (fg-alt "#c6daff") + (bg-active "#535353") + (bg-inactive "#303030") + (border "#646464") + + ;; Common accent foregrounds + + (red "#ff5f59") + (red-warmer "#ff6b55") + (red-cooler "#ff7f86") + (red-faint "#ff9580") + (red-intense "#ff5f5f") + (green "#44bc44") + (green-warmer "#70b900") + (green-cooler "#00c06f") + (green-faint "#88ca9f") + (green-intense "#44df44") + (yellow "#cabf00") + (yellow-warmer "#ffa00f") + (yellow-cooler "#d8af7a") + (yellow-faint "#d2b580") + (yellow-intense "#efef00") + (blue "#2fafff") + (blue-warmer "#79a8ff") + (blue-cooler "#00bcff") + (blue-faint "#82b0ec") + (blue-intense "#338fff") + (magenta "#feacd0") + (magenta-warmer "#f78fe7") + (magenta-cooler "#b6a0ff") + (magenta-faint "#caa6df") + (magenta-intense "#ff66ff") + (cyan "#00d3d0") + (cyan-warmer "#4ae2f0") + (cyan-cooler "#6ae4b9") + (cyan-faint "#9ac8e0") + (cyan-intense "#00eff0") + + ;; Uncommon accent foregrounds + + (rust "#db7b5f") + (gold "#c0965b") + (olive "#9cbd6f") + (slate "#76afbf") + (indigo "#9099d9") + (maroon "#cf7fa7") + (pink "#d09dc0") + + ;; Common accent backgrounds + + (bg-red-intense "#9d1f1f") + (bg-green-intense "#2f822f") + (bg-yellow-intense "#7a6100") + (bg-blue-intense "#1640b0") + (bg-magenta-intense "#7030af") + (bg-cyan-intense "#2266ae") + + (bg-red-subtle "#620f2a") + (bg-green-subtle "#00422a") + (bg-yellow-subtle "#4a4000") + (bg-blue-subtle "#242679") + (bg-magenta-subtle "#552f5f") + (bg-cyan-subtle "#004065") + + (bg-red-nuanced "#3a0c14") + (bg-green-nuanced "#092f1f") + (bg-yellow-nuanced "#381d0f") + (bg-blue-nuanced "#12154a") + (bg-magenta-nuanced "#2f0c3f") + (bg-cyan-nuanced "#042837") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#49191a") + (fg-clay "#f1b090") + + (bg-ochre "#462f20") + (fg-ochre "#e0d09c") + + (bg-lavender "#38325c") + (fg-lavender "#dfc0f0") + + (bg-sage "#143e32") + (fg-sage "#c3e7d4") + + ;; Graphs + + (bg-graph-red-0 "#bf6000") + (bg-graph-red-1 "#733500") + (bg-graph-green-0 "#6fbf8f") + (bg-graph-green-1 "#2f5f4f") + (bg-graph-yellow-0 "#c1c00a") + (bg-graph-yellow-1 "#7f6640") + (bg-graph-blue-0 "#0f90ef") + (bg-graph-blue-1 "#1f2f8f") + (bg-graph-magenta-0 "#7f7f8e") + (bg-graph-magenta-1 "#4f4f5f") + (bg-graph-cyan-0 "#376f9a") + (bg-graph-cyan-1 "#00404f") + + ;; Special purpose + + (bg-completion "#2f447f") + (bg-hover "#45605e") + (bg-hover-secondary "#604c30") + (bg-hl-line "#2f3849") + (bg-region "#5a5a5a") + (fg-region "#ffffff") + + (bg-mode-line-active "#2a2a6a") + (fg-mode-line-active "#f0f0f0") + (border-mode-line-active "#8080a7") + (bg-mode-line-inactive "#2d2d2d") + (fg-mode-line-inactive "#969696") + (border-mode-line-inactive "#606060") + + (modeline-err "#e5bf00") + (modeline-warning "#c0cf35") + (modeline-info "#abeadf") + + (bg-tab-bar "#313131") + (bg-tab-current "#000000") + (bg-tab-other "#545454") + + ;; Diffs + + (bg-added "#003066") + (bg-added-faint "#001a4f") + (bg-added-refine "#0f4a77") + (bg-added-fringe "#006fff") + (fg-added "#c4d5ff") + (fg-added-intense "#8080ff") + + (bg-changed "#2f123f") + (bg-changed-faint "#1f022f") + (bg-changed-refine "#3f325f") + (bg-changed-fringe "#7f55a0") + (fg-changed "#e3cfff") + (fg-changed-intense "#cf9fe2") + + (bg-removed "#3d3d00") + (bg-removed-faint "#281f00") + (bg-removed-refine "#555500") + (bg-removed-fringe "#d0c03f") + (fg-removed "#d4d48f") + (fg-removed-intense "#d0b05f") + + (bg-diff-context "#1a1a1a") + + ;; Paren match + + (bg-paren-match "#2f7f9f") + (bg-paren-expression "#453040") + + ;; General mappings + + (cursor yellow-intense) + (keybind blue-cooler) + (name blue-cooler) + (identifier yellow-faint) + + (err yellow-warmer) + (warning yellow) + (info blue) + + (underline-err yellow-intense) + (underline-warning magenta-faint) + (underline-note cyan) + + (bg-prominent-err bg-yellow-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-magenta-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-yellow-nuanced) + (fg-active-argument yellow-warmer) + (bg-active-value bg-blue-nuanced) + (fg-active-value blue-warmer) + + ;; Code mappings + + (builtin yellow) + (comment yellow-cooler) + (constant blue-faint) + (docstring cyan-faint) + (fnname yellow-warmer) + (fnname-call gold) + (keyword blue-cooler) + (preprocessor magenta-cooler) + (property cyan) + (rx-backslash blue-cooler) + (rx-construct yellow-cooler) + (string blue-warmer) + (type cyan-cooler) + (variable cyan) + (variable-use slate) + + ;; Accent mappings + + (accent-0 blue-warmer) + (accent-1 yellow) + (accent-2 cyan-cooler) + (accent-3 yellow-cooler) + + ;; Completion mappings + + (fg-completion-match-0 blue-cooler) + (fg-completion-match-1 yellow) + (fg-completion-match-2 cyan-cooler) + (fg-completion-match-3 yellow-cooler) + + ;; Date mappings + + (date-common cyan) + (date-deadline yellow-warmer) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday yellow-warmer) + (date-holiday-other blue) + (date-range fg-alt) + (date-scheduled yellow-cooler) + (date-scheduled-subtle yellow-faint) + (date-weekday cyan) + (date-weekend magenta-cooler) + + ;; Link mappings + + (fg-link blue-warmer) + (underline-link blue-warmer) + (fg-link-symbolic cyan) + (underline-link-symbolic cyan) + (fg-link-visited yellow-faint) + (underline-link-visited yellow-faint) + + ;; Mail mappings + + (mail-cite-0 blue-warmer) + (mail-cite-1 yellow-cooler) + (mail-cite-2 cyan-faint) + (mail-cite-3 yellow) + (mail-part blue) + (mail-recipient blue) + (mail-subject yellow-warmer) + (mail-other cyan-faint) + + ;; Mark mappings + + (bg-mark-delete bg-yellow-subtle) + (fg-mark-delete yellow) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-magenta-subtle) + (fg-mark-other magenta-warmer) + + ;; Prompt mappings + + (fg-prompt blue) + + ;; Prose mappings + + (fg-prose-code cyan-cooler) + (fg-prose-macro magenta-cooler) + (fg-prose-verbatim yellow) + (prose-done blue) + (prose-todo yellow-warmer) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula yellow-warmer) + (prose-tag fg-alt) + + ;; Rainbow mappings + + (rainbow-0 yellow-warmer) + (rainbow-1 blue) + (rainbow-2 yellow-cooler) + (rainbow-3 blue-warmer) + (rainbow-4 yellow) + (rainbow-5 cyan-warmer) + (rainbow-6 yellow-faint) + (rainbow-7 blue-faint) + (rainbow-8 magenta-faint) + + ;; Search mappings + + (bg-search-current bg-yellow-intense) + (bg-search-lazy bg-blue-intense) + (bg-search-static bg-cyan-subtle) + (bg-search-replace bg-yellow-intense) + + (bg-search-rx-group-0 bg-cyan-intense) + (bg-search-rx-group-1 bg-magenta-intense) + (bg-search-rx-group-2 bg-blue-subtle) + (bg-search-rx-group-3 bg-yellow-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 yellow-faint) + (fg-heading-3 blue-faint) + (fg-heading-4 green-faint) + (fg-heading-5 magenta-cooler) + (fg-heading-6 yellow-cooler) + (fg-heading-7 cyan) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-vivendi-deuteranopia' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + +(defconst modus-themes-vivendi-tritanopia-palette + (append + '( + ;; Basic values + + (bg-main "#000000") + (bg-dim "#1e1e1e") + (fg-main "#ffffff") + (fg-dim "#989898") + (fg-alt "#a0d7f2") + (bg-active "#535353") + (bg-inactive "#303030") + (border "#646464") + + ;; Common accent foregrounds + + (red "#ff5f59") + (red-warmer "#ff6740") + (red-cooler "#ff7f86") + (red-faint "#ff9070") + (red-intense "#ff5f5f") + (green "#44bc44") + (green-warmer "#70b900") + (green-cooler "#00c06f") + (green-faint "#88ca9f") + (green-intense "#44df44") + (yellow "#cabf00") + (yellow-warmer "#ffa00f") + (yellow-cooler "#d8af7a") + (yellow-faint "#d2b580") + (yellow-intense "#efef00") + (blue "#2fafff") + (blue-warmer "#79a8ff") + (blue-cooler "#00bcff") + (blue-faint "#82b0ec") + (blue-intense "#338fff") + (magenta "#feacd0") + (magenta-warmer "#f78fe7") + (magenta-cooler "#b6a0ff") + (magenta-faint "#caa6df") + (magenta-intense "#ef7fff") + (cyan "#00d3d0") + (cyan-warmer "#4ae2ff") + (cyan-cooler "#6ae4b9") + (cyan-faint "#7fdbdf") + (cyan-intense "#00eff0") + + ;; Uncommon accent foregrounds + + (rust "#db7b5f") + (gold "#c0965b") + (olive "#9cbd6f") + (slate "#76afbf") + (indigo "#9099d9") + (maroon "#cf7fa7") + (pink "#d09dc0") + + ;; Common accent backgrounds + + (bg-red-intense "#9d1f1f") + (bg-green-intense "#2f822f") + (bg-yellow-intense "#7a6100") + (bg-blue-intense "#1640b0") + (bg-magenta-intense "#7030af") + (bg-cyan-intense "#2266ae") + + (bg-red-subtle "#620f2a") + (bg-green-subtle "#00422a") + (bg-yellow-subtle "#4a4000") + (bg-blue-subtle "#242679") + (bg-magenta-subtle "#552f5f") + (bg-cyan-subtle "#004065") + + (bg-red-nuanced "#3a0c14") + (bg-green-nuanced "#092f1f") + (bg-yellow-nuanced "#381d0f") + (bg-blue-nuanced "#12154a") + (bg-magenta-nuanced "#2f0c3f") + (bg-cyan-nuanced "#042837") + + ;; Uncommon accent background and foreground pairs + + (bg-clay "#49191a") + (fg-clay "#f1b090") + + (bg-ochre "#462f20") + (fg-ochre "#e0d09c") + + (bg-lavender "#38325c") + (fg-lavender "#dfc0f0") + + (bg-sage "#143e32") + (fg-sage "#c3e7d4") + + ;; Graphs + + (bg-graph-red-0 "#b52c2c") + (bg-graph-red-1 "#702020") + (bg-graph-green-0 "#afd1c0") + (bg-graph-green-1 "#607a8f") + (bg-graph-yellow-0 "#facfd6") + (bg-graph-yellow-1 "#b57b85") + (bg-graph-blue-0 "#4f9fdf") + (bg-graph-blue-1 "#004559") + (bg-graph-magenta-0 "#b6427f") + (bg-graph-magenta-1 "#7f506f") + (bg-graph-cyan-0 "#57dfea") + (bg-graph-cyan-1 "#00808f") + + ;; Special purpose + + (bg-completion "#004253") + (bg-hover "#8e3e3b") + (bg-hover-secondary "#204853") + (bg-hl-line "#2f3849") + (bg-region "#5a5a5a") + (fg-region "#ffffff") + + (bg-mode-line-active "#003c52") + (fg-mode-line-active "#f0f0f0") + (border-mode-line-active "#5f8fb4") + (bg-mode-line-inactive "#2d2d2d") + (fg-mode-line-inactive "#969696") + (border-mode-line-inactive "#606060") + + (modeline-err "#ff7fbf") + (modeline-warning "#df9f93") + (modeline-info "#4fcfef") + + (bg-tab-bar "#313131") + (bg-tab-current "#000000") + (bg-tab-other "#545454") + + ;; Diffs + + (bg-added "#004254") + (bg-added-faint "#003042") + (bg-added-refine "#004f7f") + (bg-added-fringe "#008fcf") + (fg-added "#9fdfdf") + (fg-added-intense "#50c0ef") + + (bg-changed "#2f123f") + (bg-changed-faint "#1f022f") + (bg-changed-refine "#3f325f") + (bg-changed-fringe "#7f55a0") + (fg-changed "#e3cfff") + (fg-changed-intense "#cf9fe2") + + (bg-removed "#4f1119") + (bg-removed-faint "#380a0f") + (bg-removed-refine "#781a1f") + (bg-removed-fringe "#b81a1f") + (fg-removed "#ffbfbf") + (fg-removed-intense "#ff9095") + + (bg-diff-context "#1a1a1a") + + ;; Paren match + + (bg-paren-match "#2f7f9f") + + (bg-paren-expression "#453040") + + ;; General mappings + + (cursor red-intense) + + (keybind red) + (name red-cooler) + (identifier red-faint) + + (err red-warmer) + (warning magenta) + (info cyan) + + (underline-err red-intense) + (underline-warning magenta-intense) + (underline-note cyan-intense) + + (bg-prominent-err bg-red-intense) + (fg-prominent-err fg-main) + (bg-prominent-warning bg-magenta-intense) + (fg-prominent-warning fg-main) + (bg-prominent-note bg-cyan-intense) + (fg-prominent-note fg-main) + + (bg-active-argument bg-red-nuanced) + (fg-active-argument red-warmer) + (bg-active-value bg-cyan-nuanced) + (fg-active-value cyan) + + ;; Code mappings + + (builtin magenta) + (comment red-faint) + (constant green-faint) + (docstring fg-alt) + (fnname cyan-warmer) + (fnname-call indigo) + (keyword red-cooler) + (preprocessor red-warmer) + (property cyan-cooler) + (rx-backslash magenta) + (rx-construct red) + (string cyan) + (type blue-warmer) + (variable cyan-cooler) + (variable-use slate) + + ;; Accent mappings + + (accent-0 cyan) + (accent-1 red-warmer) + (accent-2 cyan-cooler) + (accent-3 magenta) + + ;; Completion mappings + + (fg-completion-match-0 cyan) + (fg-completion-match-1 red-warmer) + (fg-completion-match-2 magenta) + (fg-completion-match-3 cyan-cooler) + + ;; Date mappings + + (date-common cyan-cooler) + (date-deadline red) + (date-deadline-subtle red-faint) + (date-event fg-alt) + (date-holiday red-intense) + (date-holiday-other cyan-warmer) + (date-range fg-alt) + (date-scheduled magenta) + (date-scheduled-subtle magenta-faint) + (date-weekday cyan) + (date-weekend magenta-warmer) + + ;; Link mappings + + (fg-link cyan) + (underline-link cyan) + + (fg-link-symbolic cyan-cooler) + (underline-link-symbolic cyan-cooler) + + (fg-link-visited magenta) + (underline-link-visited magenta) + + ;; Mail mappings + + (mail-cite-0 cyan-faint) + (mail-cite-1 red-faint) + (mail-cite-2 magenta-warmer) + (mail-cite-3 cyan-warmer) + (mail-part cyan-cooler) + (mail-recipient cyan) + (mail-subject red-cooler) + (mail-other cyan) + + ;; Mark mappings + + (bg-mark-delete bg-red-subtle) + (fg-mark-delete red) + (bg-mark-select bg-cyan-subtle) + (fg-mark-select cyan) + (bg-mark-other bg-magenta-subtle) + (fg-mark-other magenta-warmer) + + ;; Prompt mappings + + (fg-prompt cyan-cooler) + + ;; Prose mappings + + (fg-prose-code cyan) + (fg-prose-macro red-warmer) + (fg-prose-verbatim magenta-warmer) + (prose-done cyan) + (prose-todo red) + (prose-metadata fg-dim) + (prose-metadata-value fg-alt) + (prose-table fg-alt) + (prose-table-formula red-cooler) + (prose-tag fg-alt) + + ;; Rainbow mappings + + (rainbow-0 cyan) + (rainbow-1 red) + (rainbow-2 cyan-warmer) + (rainbow-3 red-cooler) + (rainbow-4 cyan-cooler) + (rainbow-5 magenta) + (rainbow-6 cyan-faint) + (rainbow-7 magenta-faint) + (rainbow-8 red-faint) + + ;; Search mappings + + (bg-search-current bg-red-intense) + (bg-search-lazy bg-cyan-intense) + (bg-search-static bg-magenta-subtle) + (bg-search-replace bg-magenta-intense) + + (bg-search-rx-group-0 bg-blue-intense) + (bg-search-rx-group-1 bg-magenta-intense) + (bg-search-rx-group-2 bg-cyan-subtle) + (bg-search-rx-group-3 bg-red-subtle) + + ;; Heading mappings + + (fg-heading-0 cyan-cooler) + (fg-heading-1 fg-main) + (fg-heading-2 red-faint) + (fg-heading-3 cyan-faint) + (fg-heading-4 magenta) + (fg-heading-5 green-faint) + (fg-heading-6 magenta-faint) + (fg-heading-7 cyan-faint) + (fg-heading-8 fg-dim)) + modus-themes-common-palette-mappings) + "The entire palette of the `modus-vivendi-tritanopia' theme. + +Named colors have the form (COLOR-NAME HEX-VALUE) with the former +as a symbol and the latter as a string. + +Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) +with both as symbols. The latter is a named color that already +exists in the palette and is associated with a HEX-VALUE.") + + + ;;;; Presets of palette overrides (defvar modus-themes-preset-overrides-faint @@ -755,7 +3456,6 @@ represents." (date-deadline red-faint) (date-event fg-alt) (date-holiday magenta) - (date-now fg-main) (date-scheduled yellow-faint) (date-weekday fg-dim) (date-weekend fg-dim) @@ -1062,83 +3762,151 @@ C1 and C2 are color values written in hexadecimal RGB." (+ (modus-themes-wcag-formula c2) 0.05)))) (max ct (/ ct)))) -(defun modus-themes--modus-p (theme) - "Return non-nil if THEME name has a modus- prefix." - (string-prefix-p "modus-" (symbol-name theme))) +(defvar modus-themes-registered-items nil + "List of defined themes. +This list is instantiated by the `modus-themes-theme' macro. Themes +that build on top of Modus but for some reason cannot use that macro +must define theme properties to include those that the macro specifies. -(defun modus-themes--list-enabled-themes () - "Return list of `custom-enabled-themes' with modus- prefix." - (seq-filter #'modus-themes--modus-p custom-enabled-themes)) +Also see `modus-themes-get-themes'.") -(defun modus-themes--load-no-enable (theme) - "Load but do not enable THEME if it belongs to `custom-known-themes'." - (unless (memq theme custom-known-themes) - (load-theme theme :no-confirm :no-enable))) +(defvar modus-themes--activated-themes nil + "List of themes that `modus-themes--activate' operated on.") -(defun modus-themes--enable-themes () - "Enable the Modus themes." - (mapc #'modus-themes--load-no-enable modus-themes-items)) +(defun modus-themes--activate (theme) + "Load THEME if it is not defined but do not activate it." + ;; NOTE 2025-09-29: We need to do this instead of pushing to the + ;; `custom-known-themes' because loading the theme has the desired + ;; side effect of adding the relevant `theme-properties' to it. + (unless (and (memq theme modus-themes--activated-themes) + (custom-theme-p theme)) + (load-theme theme t t) + (add-to-list 'modus-themes--activated-themes theme))) -(defun modus-themes--list-known-themes () - "Return list of `custom-known-themes' with modus- prefix." - (modus-themes--enable-themes) - (seq-filter #'modus-themes--modus-p custom-known-themes)) +(defun modus-themes--belongs-to-family-p (theme family) + "Return non-nil if THEME has FAMILY property." + (when-let* ((properties (get theme 'theme-properties)) + (theme-family (plist-get properties :family))) + (eq theme-family family))) -(defun modus-themes--current-theme () - "Return first enabled Modus theme." - (car (or (modus-themes--list-enabled-themes) - (modus-themes--list-known-themes)))) +(defun modus-themes-get-all-known-themes (&optional theme-family no-enable) + "Return all known Modus themes or derivatives, enabling them if needed. +With optional THEME-FAMILY, operate only on the themes whose :family +property is that. Else consider the Modus themes as well as all their +derivatives. -(defun modus-themes--palette-symbol (theme &optional suffix) - "Return THEME palette as a symbol of the form THEME-palette. -With optional SUFFIX, return THEME-palette-SUFFIX as a symbol." - (when theme - (intern - (if suffix - (format "%s-palette-%s" theme suffix) - (format "%s-palette" theme))))) +With optional NO-ENABLE, do not try to enable the themes. -(defun modus-themes--palette-value (theme &optional overrides) - "Return palette value of THEME with optional OVERRIDES." - (let* ((core-palette (symbol-value (modus-themes--palette-symbol theme))) - (user-palette (symbol-value (modus-themes--palette-symbol theme "user"))) - (base-value (append user-palette modus-themes-common-palette-user core-palette))) - (if overrides - (append (symbol-value (modus-themes--palette-symbol theme "overrides")) - modus-themes-common-palette-overrides - base-value) - base-value))) +Also see `modus-themes-sort'." + (let ((themes (pcase theme-family + ('modus-themes modus-themes-items) + ((pred (not null)) modus-themes-registered-items) + (_ (seq-union modus-themes-items modus-themes-registered-items))))) + (unless no-enable + (mapc #'modus-themes--activate themes)) + (if theme-family + (seq-filter + (lambda (theme) + (modus-themes--belongs-to-family-p theme theme-family)) + themes) + themes))) -(defun modus-themes--current-theme-palette (&optional overrides) - "Return palette value of active Modus theme, else produce `user-error'. -With optional OVERRIDES return palette value plus whatever -overrides." - (if-let* ((theme (modus-themes--current-theme))) - (if overrides - (modus-themes--palette-value theme :overrides) - (modus-themes--palette-value theme)) - (user-error "No enabled Modus theme could be found"))) +(defun modus-themes--background-p (theme background-mode) + "Return non-nil if THEME has BACKGROUND-MODE :background-mode property." + (when-let* ((properties (get theme 'theme-properties)) + (background (plist-get properties :background-mode))) + (eq background background-mode))) + +(defun modus-themes-sort (themes background-mode) + "Reorder THEMES so that those with BACKGROUND-MODE come first. +BACKGROUND-MODE is either `dark' or `light'." + (unless (memq background-mode '(dark light)) + (error "The BACKGROUND-MODE can be either `dark' or `light'")) + (sort + themes + (lambda (theme1 theme2) + (and (modus-themes--background-p theme1 background-mode) + (modus-themes--background-p theme2 (if (eq background-mode 'dark) 'light 'dark)))))) + +(cl-defgeneric modus-themes-get-themes () + "Return a list of all themes with `modus-themes' :family property. +Use `modus-themes-sort' to sort by light and then dark background." + (if-let* ((themes (modus-themes-get-all-known-themes 'modus-themes)) + (sorted-themes (modus-themes-sort themes 'light))) + sorted-themes + modus-themes-items)) + +(defun modus-themes-known-p (themes) + "Return THEMES if they are among `modus-themes-get-themes' else nil. +THEMES is either a list of symbols, like `modus-themes-items' or a +symbol. + +With optional SHOW-ERROR, throw an error instead of returning nil." + (let ((known-themes (modus-themes-get-all-known-themes))) + (cond + ((symbolp themes) + (memq themes known-themes)) + ((listp themes) + (when (seq-every-p (lambda (theme) (memq theme known-themes)) themes) + themes)) + (t + (error "Themes `%S' is not a symbol or a list of symbols" themes))))) + +(defun modus-themes-get-current-theme (&optional no-enable) + "Return current enabled Modus theme. +With optional NO-ENABLE, do not try to enable any themes." + (let ((current (car custom-enabled-themes))) + (when (memq current (modus-themes-get-all-known-themes nil no-enable)) + current))) + +(defun modus-themes--get-theme-palette-subr (theme with-overrides with-user-palette) + "Get THEME palette without `modus-themes-known-p'. +WITH-OVERRIDES and WITH-USER-PALETTE are described in +`modus-themes-get-theme-palette'. + +If THEME does not have at least a `:modus-core-palette' among its +`theme-properties', return nil." + (when-let* ((properties (get theme 'theme-properties)) + (core-palette (symbol-value (plist-get properties :modus-core-palette)))) + (let* ((user-palette (when with-user-palette (symbol-value (plist-get properties :modus-user-palette)))) + (overrides-palette (when with-overrides (symbol-value (plist-get properties :modus-overrides-palette)))) + (all-overrides (when with-overrides (append overrides-palette modus-themes-common-palette-overrides)))) + (append all-overrides user-palette core-palette)))) + +(defun modus-themes-get-theme-palette (&optional theme with-overrides with-user-palette) + "Return palette value of active `modus-themes-get-themes' THEME. +If THEME is nil, use the return value of `modus-themes-get-current-theme'. +With WITH-OVERRIDES, include all overrides in the combined palette. +With WITH-USER-PALETTE do the same for the user-defined palette +extension. + +If THEME is unknown, return nil." + (modus-themes--get-theme-palette-subr + (or theme (modus-themes-get-current-theme)) + with-overrides + with-user-palette)) (defun modus-themes--disable-themes () "Disable themes per `modus-themes-disable-other-themes'." - (mapc #'disable-theme - (if modus-themes-disable-other-themes - custom-enabled-themes - (modus-themes--list-known-themes)))) + (mapc + #'disable-theme + (if modus-themes-disable-other-themes + custom-enabled-themes + (modus-themes-get-themes)))) -(defun modus-themes-load-theme (theme) +(defun modus-themes-load-theme (theme &optional hook) "Load THEME while disabling other themes. Which themes are disabled is determined by the user option `modus-themes-disable-other-themes'. Run the `modus-themes-after-load-theme-hook' as the final step -after loading the THEME. +after loading the THEME. If HOOK, then call that instead. Return THEME." (modus-themes--disable-themes) (load-theme theme :no-confirm) - (run-hooks 'modus-themes-after-load-theme-hook) + (run-hooks (or hook 'modus-themes-after-load-theme-hook)) theme) (defun modus-themes--retrieve-palette-value (color palette) @@ -1162,7 +3930,8 @@ This function is used in the macros `modus-themes-theme', (t 'unspecified)))) -(defun modus-themes-get-color-value (color &optional overrides theme) +;; NOTE 2025-09-29: We keep THEME at that position for backward-compatibility. +(defun modus-themes-get-color-value (color &optional with-overrides theme) "Return color value of named COLOR for current Modus theme. COLOR is a symbol that represents a named color entry in the @@ -1172,17 +3941,17 @@ If the value is the name of another color entry in the palette (so a mapping), recur until you find the underlying color value. -With optional OVERRIDES as a non-nil value, account for palette +With optional WITH-OVERRIDES as a non-nil value, include palette overrides. Else use the default palette. -With optional THEME as a symbol among `modus-themes-items', use -the palette of that item. Else use the current Modus theme. +With optional THEME among `modus-themes-get-themes', use the palette of +that item. Else use the current theme. If COLOR is not present in the palette, return the `unspecified' symbol, which is safe when used as a face attribute's value." - (if-let* ((palette (if theme - (modus-themes--palette-value theme overrides) - (modus-themes--current-theme-palette overrides))) + (when theme + (modus-themes--activate theme)) + (if-let* ((palette (modus-themes-get-theme-palette theme with-overrides :with-user-palette)) (value (modus-themes--retrieve-palette-value color palette))) value 'unspecified)) @@ -1192,7 +3961,7 @@ symbol, which is safe when used as a face attribute's value." ;;;;; Select a theme with completion (defvar modus-themes--select-theme-history nil - "Minibuffer history of `modus-themes--select-prompt'.") + "Minibuffer history of `modus-themes-select-prompt'.") (defun modus-themes--annotate-theme (theme) "Return completion annotation for THEME." @@ -1210,39 +3979,31 @@ symbol, which is safe when used as a face attribute's value." (complete-with-action action candidates string pred)))) (defun modus-themes--completion-table-candidates () - "Render `modus-themes--list-known-themes' as completion with theme category." - (modus-themes--completion-table 'theme (modus-themes--list-known-themes))) + "Render `modus-themes-get-themes' as a completion table." + (modus-themes--completion-table 'theme (modus-themes-get-themes))) -(defun modus-themes--select-prompt (&optional prompt) +(defun modus-themes-select-prompt (&optional prompt) "Minibuffer prompt to select a Modus theme. -With optional PROMPT string, use it. Else use a generic prompt." +With optional PROMPT string, use it as the first argument of +`format-prompt'. Else use a generic prompt." (let ((completion-extra-properties `(:annotation-function ,#'modus-themes--annotate-theme))) (intern (completing-read - (or prompt "Select Modus theme: ") + (format-prompt (or prompt "Select theme") nil) (modus-themes--completion-table-candidates) - nil t nil 'modus-themes--select-theme-history)))) + nil t nil + 'modus-themes--select-theme-history)))) ;;;###autoload (defun modus-themes-select (theme) "Load a Modus THEME using minibuffer completion. Run `modus-themes-after-load-theme-hook' after loading the theme. Disable other themes per `modus-themes-disable-other-themes'." - (interactive (list (modus-themes--select-prompt))) + (interactive (list (modus-themes-select-prompt))) (modus-themes-load-theme theme)) ;;;;; Toggle between two themes -(defun modus-themes--toggle-theme-p () - "Return non-nil if `modus-themes-to-toggle' are valid." - (condition-case nil - (dolist (theme modus-themes-to-toggle) - (or (memq theme modus-themes-items) - (memq theme (modus-themes--list-known-themes)) - (error "`%s' is not part of `modus-themes-items'" theme))) - (error nil) - (:success modus-themes-to-toggle))) - ;;;###autoload (defun modus-themes-toggle () "Toggle between the two `modus-themes-to-toggle'. @@ -1254,23 +4015,27 @@ Run `modus-themes-after-load-theme-hook' after loading the theme. Disable other themes per `modus-themes-disable-other-themes'." (declare (interactive-only t)) (interactive) - (if-let* ((themes (modus-themes--toggle-theme-p)) + (if-let* ((themes (modus-themes-known-p modus-themes-to-toggle)) (one (car themes)) (two (cadr themes))) (modus-themes-load-theme (if (eq (car custom-enabled-themes) one) two one)) - (modus-themes-load-theme (modus-themes--select-prompt)))) + (modus-themes-load-theme (modus-themes-select-prompt "No valid theme to toggle; select other")))) ;;;;; Rotate through a list of themes -(defun modus-themes--next-in-rotation (themes &optional reverse) - "Return a new theme among THEMES if it is possible to rotate to it. -The argument REVERSE controls the direction of rotation." - (if-let* ((index (seq-position themes (modus-themes--current-theme))) - (offset (mod (if reverse (1- index) (1+ index)) - (length themes))) - (new-theme (nth offset themes))) - new-theme - (error "Cannot determine a theme among `%s'" themes))) +(defun modus-themes-rotate-subr (themes &optional reverse) + "Return a new theme for `modus-themes-rotate'. +The theme is the next among THEMES if it is possible to rotate to it. +When REVERSE is non-nil, move to the left, else to the right." + (if-let* ((valid-themes (modus-themes-known-p themes))) + (if-let* ((index (or (seq-position valid-themes (modus-themes-get-current-theme)) -1)) + (offset (mod + (if reverse (1- index) (1+ index)) + (length valid-themes))) + (new-theme (nth offset valid-themes))) + new-theme + (modus-themes-select-prompt "Cannot determine next rotation; select other")) + (modus-themes-select-prompt "No valid theme to rotate; select other"))) ;;;###autoload (defun modus-themes-rotate (themes &optional reverse) @@ -1283,15 +4048,83 @@ after. The rotation is performed rightwards if REVERSE is nil (the default), and leftwards if REVERSE is non-nil. Perform the rotation such that the current element in the list becomes the last. Do not modify THEMES in the process." - (interactive (list modus-themes-to-rotate current-prefix-arg)) - (unless (proper-list-p themes) - "This is not a list of themes: `%s'" themes) - (let ((candidate (modus-themes--next-in-rotation themes reverse))) - (if (modus-themes--modus-p candidate) - (progn - (message "Rotating to `%s'" (propertize (symbol-name candidate) 'face 'success)) - (modus-themes-load-theme candidate)) - (user-error "`%s' is not part of the Modus collection" candidate)))) + (interactive + (list + (or modus-themes-to-rotate (modus-themes-get-themes)) + current-prefix-arg)) + (let ((theme (modus-themes-rotate-subr themes reverse))) + (message "Rotating to `%s'" theme) + (modus-themes-load-theme theme))) + +;;;;; Load a random theme + +(defun modus-themes-filter-by-background-mode (themes background-mode) + "Return list of THEMES by BACKGROUND-MODE property. +BACKGROUND-MODE is the symbol `dark' or `light'. It corresponds to the +theme property of :background-mode. Any other value means to use all +THEMES." + (if background-mode + (progn + (unless (memq background-mode '(dark light)) + (error "The BACKGROUND-MODE can be either `dark' or `light'")) + (seq-filter + (lambda (theme) + (modus-themes--background-p theme background-mode)) + themes)) + themes)) + +(defun modus-themes-background-mode-prompt () + "Select `dark' or `light' and return it as a symbol." + (intern + (cadr + (read-multiple-choice + "Variant" + '((?d "dark" "Load a random dark theme") + (?l "light" "Load a random light theme")) + "Limit to the dark or light subset of the themes.")))) + +(defun modus-themes-load-random-subr (background-mode) + "Return theme for `modus-themes-load-random' given BACKGROUND-MODE." + (let* ((themes (modus-themes-filter-by-background-mode + (modus-themes-get-themes) + background-mode)) + (current (modus-themes-get-current-theme)) + (themes-minus-current (delete current (copy-sequence themes)))) + (or (nth (random (length themes-minus-current)) themes-minus-current) + (car themes-minus-current)))) + +;;;###autoload +(defun modus-themes-load-random (&optional background-mode) + "Load a Modus theme at random, excluding the current one. + +With optional BACKGROUND-MODE as a prefix argument, prompt to limit the set of +themes to either dark or light variants. When called from Lisp, BACKGROUND-MODE +is either the `dark' or `light' symbol. + +Run `modus-themes-after-load-theme-hook' after loading a theme." + (interactive + (list + (when current-prefix-arg + (modus-themes-background-mode-prompt)))) + (if-let* ((theme (modus-themes-load-random-subr background-mode))) + (progn + (message "Loading `%s'" theme) + (modus-themes-load-theme theme)) + (error "Could not find a theme to load at random"))) + +;;;###autoload +(defun modus-themes-load-random-dark () + "Load a random dark theme." + (declare (interactive-only t)) + (interactive) + (modus-themes-load-random 'dark)) + +;;;###autoload +(defun modus-themes-load-random-light () + "Load a random light theme." + (declare (interactive-only t)) + (interactive) + (modus-themes-load-random 'light)) ;;;;; Preview a theme palette @@ -1305,29 +4138,31 @@ PALETTE is the value of a variable like `modus-operandi-palette'." (defun modus-themes--list-colors-tabulated (theme &optional mappings) "Return a data structure of THEME palette or MAPPINGS for tabulated list." - (let* ((current-palette (modus-themes--palette-value theme mappings)) + (let* ((current-palette (modus-themes-get-theme-palette theme :with-overrides :with-user-palette)) (palette (if mappings (modus-themes--list-colors-get-mappings current-palette) current-palette))) - (mapcar (lambda (cell) - (pcase-let* ((`(,name ,value) cell) - (name-string (format "%s" name)) - (value-string (format "%s" value)) - (value-string-padded (string-pad value-string 30)) - (color (modus-themes-get-color-value name mappings theme))) ; resolve a semantic mapping - (list name - (vector - (if (and (symbolp value) - (not (eq value 'unspecified))) - "Yes" - "") - name-string - (propertize value-string 'face `( :foreground ,color)) - (propertize value-string-padded 'face (list :background color - :foreground (if (string= color "unspecified") - (readable-foreground-color (modus-themes-get-color-value 'bg-main nil theme)) - (readable-foreground-color color)))))))) - palette))) + (mapcar + (lambda (entry) + (pcase-let* ((`(,name ,value) entry) + (name-string (format "%s" name)) + (value-string (format "%s" value)) + (value-string-padded (format "%-30s" value-string)) + (color (modus-themes-get-color-value name :with-overrides theme))) ; resolve a semantic mapping + (list + (cons entry color) + (vector + (pcase value + ('unspecified "---") + ((pred symbolp) "Yes") + (_ "")) + name-string + (propertize value-string 'face `( :foreground ,color)) + (propertize value-string-padded 'face `( :background ,color + :foreground ,(if (string= color "unspecified") + (readable-foreground-color (modus-themes-get-color-value 'bg-main nil theme)) + (readable-foreground-color color)))))))) + palette))) (defvar modus-themes-current-preview nil) (defvar modus-themes-current-preview-show-mappings nil) @@ -1343,11 +4178,12 @@ With optional prefix argument for MAPPINGS preview only the semantic color mappings instead of the complete palette." (interactive (let ((prompt (if current-prefix-arg - "Preview palette mappings of THEME: " - "Preview palette of THEME: "))) + "Preview palette mappings of THEME" + "Preview palette of THEME"))) (list - (modus-themes--select-prompt prompt) + (modus-themes-select-prompt prompt) current-prefix-arg))) + (modus-themes--activate theme) (let ((buffer (get-buffer-create (format (if mappings "*%s-list-mappings*" "*%s-list-all*") theme)))) (with-current-buffer buffer (let ((modus-themes-current-preview theme) @@ -1361,14 +4197,113 @@ color mappings instead of the complete palette." (defun modus-themes-list-colors-current (&optional mappings) "Like `modus-themes-list-colors' with optional MAPPINGS for the current theme." (interactive "P") - (modus-themes-list-colors (modus-themes--current-theme) mappings)) + (modus-themes-list-colors (modus-themes-get-current-theme) mappings)) (defalias 'modus-themes-preview-colors-current 'modus-themes-list-colors-current "Alias for `modus-themes-list-colors-current'.") +(defvar-local modus-themes-preview-mode--marked-entries nil + "List of entries marked in the `modus-themes-list-colors' buffer.") + +(defun modus-themes-preview-mode-mark () + "Mark a palette entry in the `modus-themes-list-colors' buffer." + (declare (interactive-only t)) + (interactive nil modus-themes-preview-mode) + (unless (derived-mode-p 'modus-themes-preview-mode) + (user-error "Only use this command inside the `modus-themes-preview-mode'")) + (when-let* ((id-at-point (tabulated-list-get-id))) + (add-to-list 'modus-themes-preview-mode--marked-entries id-at-point) + (tabulated-list-put-tag "*" t))) + +(defun modus-themes-preview-mode-mark-all () + "Mark all palette entries in the `modus-themes-list-colors' buffer." + (declare (interactive-only t)) + (interactive nil modus-themes-preview-mode) + (unless (derived-mode-p 'modus-themes-preview-mode) + (user-error "Only use this command inside the `modus-themes-preview-mode'")) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward (format "^\s\\{%d,\\}" tabulated-list-padding) nil t) + (call-interactively 'modus-themes-preview-mode-mark)))) + +(defun modus-themes-preview-mode-unmark () + "Unmark a palette entry in the `modus-themes-list-colors' buffer." + (declare (interactive-only t)) + (interactive nil modus-themes-preview-mode) + (unless (derived-mode-p 'modus-themes-preview-mode) + (user-error "Only use this command inside the `modus-themes-preview-mode'")) + (when-let* ((id-at-point (tabulated-list-get-id))) + (setq-local modus-themes-preview-mode--marked-entries (delq id-at-point modus-themes-preview-mode--marked-entries)) + (tabulated-list-put-tag " " t))) + +(defun modus-themes-preview-mode-unmark-all () + "Unmark all palette entries in the `modus-themes-list-colors' buffer." + (declare (interactive-only t)) + (interactive nil modus-themes-preview-mode) + (unless (derived-mode-p 'modus-themes-preview-mode) + (user-error "Only use this command inside the `modus-themes-preview-mode'")) + (setq-local modus-themes-preview-mode--marked-entries nil) + (tabulated-list-clear-all-tags)) + +(defun modus-themes-preview-mode-copy-entry () + "Copy marked entries or entry at point in the `modus-themes-list-colors' buffer. +Each entry is of the form that appears is the underlying palette. This +is useful as a starting point for writing palette overrides. + +Also see `modus-themes-preview-mode-copy-color'." + (declare (interactive-only t)) + (interactive nil modus-themes-preview-mode) + (unless (derived-mode-p 'modus-themes-preview-mode) + (user-error "Only use this command inside the `modus-themes-preview-mode'")) + (cond + (modus-themes-preview-mode--marked-entries + (let* ((entries (copy-sequence modus-themes-preview-mode--marked-entries)) + (colors (mapcar #'car (nreverse entries)))) + (kill-new (format "%S" colors)) + (message "Copied all marked entries: `%S'" colors))) + ((when-let* ((color (car (tabulated-list-get-id))) + (string (format "%S" color))) + (kill-new string) + (message "Copied palette entry: `%s'" (propertize string 'face 'success)))) + (t + (user-error "Nothing to copy")))) + +(defun modus-themes-preview-mode-copy-color () + "Copy marked colors or colors at point in the `modus-themes-list-colors' buffer. +Each color is a string. Also see `modus-themes-preview-mode-copy-entry'." + (declare (interactive-only t)) + (interactive nil modus-themes-preview-mode) + (unless (derived-mode-p 'modus-themes-preview-mode) + (user-error "Only use this command inside the `modus-themes-preview-mode'")) + (cond + (modus-themes-preview-mode--marked-entries + (let* ((entries (copy-sequence modus-themes-preview-mode--marked-entries)) + (colors (mapcar #'cdr (nreverse entries)))) + (kill-new (format "%S" colors)) + (message "Copied all marked entries: `%S'" colors))) + ((when-let* ((color (cdr (tabulated-list-get-id))) + (string (format "%S" color))) + (kill-new string) + (message "Copied palette entry: `%s'" (propertize string 'face 'success)))) + (t + (user-error "Nothing to copy")))) + +(defvar modus-themes-preview-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "m") #'modus-themes-preview-mode-mark) + (define-key map (kbd "M") #'modus-themes-preview-mode-mark-all) + (define-key map (kbd "u") #'modus-themes-preview-mode-unmark) + (define-key map (kbd "U") #'modus-themes-preview-mode-unmark-all) + (define-key map (kbd "w") #'modus-themes-preview-mode-copy-color) + (define-key map (kbd "W") #'modus-themes-preview-mode-copy-entry) + map) + "Key map for `modus-themes-preview-mode'.") + (define-derived-mode modus-themes-preview-mode tabulated-list-mode "Modus palette" "Major mode to display a Modus themes palette." :interactive nil + (setq-local modus-themes-preview-mode--marked-entries nil) + (setq-local tabulated-list-padding 2) (setq-local tabulated-list-format [("Mapping?" 10 t) ("Symbol name" 30 t) @@ -1552,63 +4487,6 @@ FG and BG are the main colors." '( ;;;; custom faces ;; these bespoke faces are inherited by other constructs below -;;;;; just the foregrounds - `(modus-themes-fg-red ((,c :foreground ,red))) - `(modus-themes-fg-red-warmer ((,c :foreground ,red-warmer))) - `(modus-themes-fg-red-cooler ((,c :foreground ,red-cooler))) - `(modus-themes-fg-red-faint ((,c :foreground ,red-faint))) - `(modus-themes-fg-red-intense ((,c :foreground ,red-intense))) - `(modus-themes-fg-green ((,c :foreground ,green))) - `(modus-themes-fg-green-warmer ((,c :foreground ,green-warmer))) - `(modus-themes-fg-green-cooler ((,c :foreground ,green-cooler))) - `(modus-themes-fg-green-faint ((,c :foreground ,green-faint))) - `(modus-themes-fg-green-intense ((,c :foreground ,green-intense))) - `(modus-themes-fg-yellow ((,c :foreground ,yellow))) - `(modus-themes-fg-yellow-warmer ((,c :foreground ,yellow-warmer))) - `(modus-themes-fg-yellow-cooler ((,c :foreground ,yellow-cooler))) - `(modus-themes-fg-yellow-faint ((,c :foreground ,yellow-faint))) - `(modus-themes-fg-yellow-intense ((,c :foreground ,yellow-intense))) - `(modus-themes-fg-blue ((,c :foreground ,blue))) - `(modus-themes-fg-blue-warmer ((,c :foreground ,blue-warmer))) - `(modus-themes-fg-blue-cooler ((,c :foreground ,blue-cooler))) - `(modus-themes-fg-blue-faint ((,c :foreground ,blue-faint))) - `(modus-themes-fg-blue-intense ((,c :foreground ,blue-intense))) - `(modus-themes-fg-magenta ((,c :foreground ,magenta))) - `(modus-themes-fg-magenta-warmer ((,c :foreground ,magenta-warmer))) - `(modus-themes-fg-magenta-cooler ((,c :foreground ,magenta-cooler))) - `(modus-themes-fg-magenta-faint ((,c :foreground ,magenta-faint))) - `(modus-themes-fg-magenta-intense ((,c :foreground ,magenta-intense))) - `(modus-themes-fg-cyan ((,c :foreground ,cyan))) - `(modus-themes-fg-cyan-warmer ((,c :foreground ,cyan-warmer))) - `(modus-themes-fg-cyan-cooler ((,c :foreground ,cyan-cooler))) - `(modus-themes-fg-cyan-faint ((,c :foreground ,cyan-faint))) - `(modus-themes-fg-cyan-intense ((,c :foreground ,cyan-intense))) -;;;;; nuanced colored backgrounds - `(modus-themes-nuanced-red ((,c :background ,bg-red-nuanced :extend t))) - `(modus-themes-nuanced-green ((,c :background ,bg-green-nuanced :extend t))) - `(modus-themes-nuanced-yellow ((,c :background ,bg-yellow-nuanced :extend t))) - `(modus-themes-nuanced-blue ((,c :background ,bg-blue-nuanced :extend t))) - `(modus-themes-nuanced-magenta ((,c :background ,bg-magenta-nuanced :extend t))) - `(modus-themes-nuanced-cyan ((,c :background ,bg-cyan-nuanced :extend t))) -;;;;; subtle colored backgrounds - `(modus-themes-subtle-red ((,c :background ,bg-red-subtle :foreground ,fg-main))) - `(modus-themes-subtle-green ((,c :background ,bg-green-subtle :foreground ,fg-main))) - `(modus-themes-subtle-yellow ((,c :background ,bg-yellow-subtle :foreground ,fg-main))) - `(modus-themes-subtle-blue ((,c :background ,bg-blue-subtle :foreground ,fg-main))) - `(modus-themes-subtle-magenta ((,c :background ,bg-magenta-subtle :foreground ,fg-main))) - `(modus-themes-subtle-cyan ((,c :background ,bg-cyan-subtle :foreground ,fg-main))) -;;;;; intense colored backgrounds - `(modus-themes-intense-red ((,c :background ,bg-red-intense :foreground ,fg-main))) - `(modus-themes-intense-green ((,c :background ,bg-green-intense :foreground ,fg-main))) - `(modus-themes-intense-yellow ((,c :background ,bg-yellow-intense :foreground ,fg-main))) - `(modus-themes-intense-blue ((,c :background ,bg-blue-intense :foreground ,fg-main))) - `(modus-themes-intense-magenta ((,c :background ,bg-magenta-intense :foreground ,fg-main))) - `(modus-themes-intense-cyan ((,c :background ,bg-cyan-intense :foreground ,fg-main))) -;;;;; mark indicators - ;; color combinations intended for Dired, Ibuffer, or equivalent - `(modus-themes-mark-alt ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) - `(modus-themes-mark-del ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) - `(modus-themes-mark-sel ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) ;;;;; heading levels ;; styles for regular headings used in Org, Markdown, Info, etc. `(modus-themes-heading-0 ((,c ,@(modus-themes--heading 0 fg-heading-0 bg-heading-0 overline-heading-0)))) @@ -1620,27 +4498,6 @@ FG and BG are the main colors." `(modus-themes-heading-6 ((,c ,@(modus-themes--heading 6 fg-heading-6 bg-heading-6 overline-heading-6)))) `(modus-themes-heading-7 ((,c ,@(modus-themes--heading 7 fg-heading-7 bg-heading-7 overline-heading-7)))) `(modus-themes-heading-8 ((,c ,@(modus-themes--heading 8 fg-heading-8 bg-heading-8 overline-heading-8)))) -;;;;; language checkers - `(modus-themes-lang-error ((,c :underline (:style wave :color ,underline-err)))) - `(modus-themes-lang-note ((,c :underline (:style wave :color ,underline-note)))) - `(modus-themes-lang-warning ((,c :underline (:style wave :color ,underline-warning)))) -;;;;; prominent semantic notes - `(modus-themes-prominent-error ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) - `(modus-themes-prominent-note ((,c :background ,bg-prominent-note :foreground ,fg-prominent-note))) - `(modus-themes-prominent-warning ((,c :background ,bg-prominent-warning :foreground ,fg-prominent-warning))) -;;;;; markup - `(modus-themes-prose-code ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) - `(modus-themes-prose-macro ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-macro :foreground ,fg-prose-macro))) - `(modus-themes-prose-verbatim ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) -;;;;; search - `(modus-themes-search-current ((,c :background ,bg-search-current :foreground ,fg-main))) - `(modus-themes-search-lazy ((,c :background ,bg-search-lazy :foreground ,fg-main))) - `(modus-themes-search-replace ((,c :background ,bg-search-replace :foreground ,fg-main))) -;;;;; search regexp groups - `(modus-themes-search-rx-group-0 ((,c :background ,bg-search-rx-group-0 :foreground ,fg-main))) - `(modus-themes-search-rx-group-1 ((,c :background ,bg-search-rx-group-1 :foreground ,fg-main))) - `(modus-themes-search-rx-group-2 ((,c :background ,bg-search-rx-group-2 :foreground ,fg-main))) - `(modus-themes-search-rx-group-3 ((,c :background ,bg-search-rx-group-3 :foreground ,fg-main))) ;;;;; completion frameworks `(modus-themes-completion-match-0 ((,c ,@(modus-themes--completion-match fg-completion-match-0 bg-completion-match-0)))) `(modus-themes-completion-match-1 ((,c ,@(modus-themes--completion-match fg-completion-match-1 bg-completion-match-1)))) @@ -1653,11 +4510,11 @@ FG and BG are the main colors." `(modus-themes-slant ((,c ,@(modus-themes--slant)))) `(modus-themes-ui-variable-pitch ((,c ,@(modus-themes--variable-pitch-ui)))) ;;;;; other custom faces - `(modus-themes-button ((,c :inherit variable-pitch - :box (:line-width 1 :color ,border :style released-button) - :background ,bg-button-active - :foreground ,fg-button-active))) - `(modus-themes-key-binding ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(modus-themes-button + ((default :inherit variable-pitch :background ,bg-button-active :foreground ,fg-button-active) + (((supports :box t)) + :box (:line-width 1 :color ,border :style released-button)) + (t :underline ,border))) `(modus-themes-prompt ((,c ,@(modus-themes--prompt fg-prompt bg-prompt)))) `(modus-themes-reset-soft ((,c :background ,bg-main :foreground ,fg-main :weight normal :slant normal :strike-through nil @@ -1665,6 +4522,10 @@ FG and BG are the main colors." ;;;; standard faces ;;;;; absolute essentials `(default ((,c :background ,bg-main :foreground ,fg-main))) + `(bold ((,c :weight bold))) + `(bold-italic ((,c :inherit (bold italic)))) + `(underline ((,c :underline ,fg-dim))) + `(italic ((,c :slant italic))) `(cursor ((,c :background ,cursor))) `(fringe ((,c :background ,fringe :foreground ,fg-main))) `(menu ((,c :background ,bg-dim :foreground ,fg-main))) @@ -1672,67 +4533,63 @@ FG and BG are the main colors." `(tool-bar ((,c :background ,bg-dim :foreground ,fg-main))) `(vertical-border ((,c :foreground ,border))) ;;;;; basic and/or ungrouped styles - `(abbrev-table-name ((,c :inherit bold))) - `(appt-notification ((,c :inherit bold :foreground ,modeline-err))) + `(abbrev-table-name ((,c :inherit modus-themes-heading-1))) + `(appt-notification ((,c :inherit modus-themes-bold :foreground ,modeline-err))) `(blink-matching-paren-offscreen ((,c :background ,bg-paren-match))) - `(bold ((,c :weight bold))) - `(bold-italic ((,c :inherit (bold italic)))) - `(underline ((,c :underline ,fg-dim))) - `(buffer-menu-buffer ((,c :inherit bold))) + `(buffer-menu-buffer ((,c :foreground ,name))) `(child-frame-border ((,c :background ,border))) - `(comint-highlight-input ((,c :inherit bold))) + `(comint-highlight-input ((,c :inherit modus-themes-bold))) `(comint-highlight-prompt ((,c :inherit modus-themes-prompt))) - `(confusingly-reordered ((,c :inherit modus-themes-lang-error))) - `(edmacro-label ((,c :inherit bold :foreground ,accent-0))) - `(elisp-shorthand-font-lock-face ((,c :inherit (italic font-lock-preprocessor-face)))) - `(error ((,c :inherit bold :foreground ,err))) - `(escape-glyph ((,c :foreground ,err))) - `(file-name-shadow ((,c :inherit shadow))) + `(confusingly-reordered ((,c :underline (:style wave :color ,underline-err)))) + `(edmacro-label ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(error ((,c :inherit modus-themes-bold :foreground ,err))) + `(escape-glyph ((,c :inherit modus-themes-bold :foreground ,keybind))) + `(file-name-shadow ((,c :foreground ,fg-dim))) `(header-line ((,c :inherit modus-themes-ui-variable-pitch :background ,bg-dim))) - `(header-line-inactive ((,c :inherit (modus-themes-ui-variable-pitch shadow)))) + `(header-line-inactive ((,c :inherit modus-themes-ui-variable-pitch :background ,bg-dim :foreground ,fg-dim))) `(header-line-highlight ((,c :background ,bg-hover :foreground ,fg-main :box ,fg-main))) `(help-argument-name ((,c :inherit modus-themes-slant :foreground ,variable))) - `(help-key-binding ((,c :inherit modus-themes-key-binding))) + `(help-key-binding ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) `(highlight ((,c :background ,bg-hover :foreground ,fg-main))) `(homoglyph ((,c :foreground ,warning))) `(ibuffer-locked-buffer ((,c :foreground ,warning))) `(icon-button ((,c :inherit modus-themes-button))) - `(italic ((,c :slant italic))) `(nobreak-hyphen ((,c :foreground ,err))) `(nobreak-space ((,c :foreground ,err :underline t))) `(menu ((,c :inverse-video unspecified :background ,bg-active :foreground ,fg-main))) `(minibuffer-prompt ((,c :inherit modus-themes-prompt))) + `(minibuffer-nonselected ((,c :inverse-video t))) `(mm-command-output ((,c :foreground ,mail-part))) `(mm-uu-extract ((,c :foreground ,mail-part))) - `(next-error ((,c :inherit modus-themes-prominent-error :extend t))) - `(pgtk-im-0 ((,c :inherit modus-themes-prominent-note))) - `(read-multiple-choice-face ((,c :inherit modus-themes-mark-sel))) - `(rectangle-preview ((,c :inherit secondary-selection))) + `(next-error ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) + `(pgtk-im-0 ((,c :background ,bg-prominent-note :foreground ,fg-prominent-note))) + `(read-multiple-choice-face ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(rectangle-preview ((,c :background ,bg-active :foreground ,fg-main))) `(region ((,c :background ,bg-region :foreground ,fg-region))) `(secondary-selection ((,c :background ,bg-hover-secondary :foreground ,fg-main))) `(separator-line ((,c :underline ,bg-active))) `(shadow ((,c :foreground ,fg-dim))) - `(success ((,c :inherit bold :foreground ,info))) + `(success ((,c :inherit modus-themes-bold :foreground ,info))) `(trailing-whitespace ((,c :background ,bg-space-err))) ;; NOTE 2024-06-22: I use `list' here to suppress a bogus warning ;; from the compiler: it says I should depend on Emacs 29 to use ;; vtable. (list 'vtable `((,c :inherit modus-themes-fixed-pitch))) - `(warning ((,c :inherit bold :foreground ,warning))) + `(warning ((,c :inherit modus-themes-bold :foreground ,warning))) ;;;;; buttons, links, widgets `(button ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) - `(link ((,c :inherit button))) + `(link ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(link-visited ((,c :background ,bg-link-visited :foreground ,fg-link-visited :underline ,underline-link-visited))) `(tooltip ((,c :background ,bg-active :foreground ,fg-main))) ;;;;; adoc-mode - `(adoc-code-face ((,c :inherit font-lock-constant-face))) - `(adoc-command-face ((,c :inherit modus-themes-prose-macro))) - `(adoc-complex-replacement-face ((,c :background ,bg-magenta-subtle :foreground ,magenta))) - `(adoc-emphasis-face ((t (:inherit bold)))) - `(adoc-gen-face ((,c :foreground ,blue))) + `(adoc-code-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) + `(adoc-command-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-macro :foreground ,fg-prose-macro))) + `(adoc-complex-replacement-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-macro :foreground ,fg-prose-macro))) + `(adoc-emphasis-face ((,c :inherit bold))) + `(adoc-gen-face ((,c :foreground ,fg-alt))) `(adoc-meta-face ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata))) `(adoc-meta-hide-face ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata))) - `(adoc-replacement-face ((,c :inherit font-lock-escape-face))) + `(adoc-replacement-face ((,c :foreground ,warning))) `(adoc-secondary-text-face ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata-value))) `(adoc-table-face ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-table))) `(adoc-title-0-face ((,c :inherit modus-themes-heading-0))) @@ -1741,39 +4598,8 @@ FG and BG are the main colors." `(adoc-title-3-face ((,c :inherit modus-themes-heading-3))) `(adoc-title-4-face ((,c :inherit modus-themes-heading-4))) `(adoc-title-5-face ((,c :inherit modus-themes-heading-5))) - `(adoc-typewriter-face ((,c :inherit modus-themes-prose-verbatim))) - `(adoc-verbatim-face ((,c :inherit modus-themes-prose-verbatim))) -;;;;; agda2-mode - `(agda2-highlight-bound-variable-face ((,c :inherit font-lock-variable-name-face))) - `(agda2-highlight-catchall-clause-face ((,c :background ,bg-inactive))) - `(agda2-highlight-coinductive-constructor-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-coverage-problem-face ((,c :inherit modus-themes-lang-error))) - `(agda2-highlight-datatype-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-deadcode-face ((,c :background ,bg-active))) - `(agda2-highlight-dotted-face ((,c :inherit font-lock-variable-name-face))) - `(agda2-highlight-error-face ((,c :inherit modus-themes-lang-error))) - `(agda2-highlight-field-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-function-face ((,c :inherit font-lock-function-name-face))) - `(agda2-highlight-generalizable-variable-face ((,c :inherit font-lock-variable-name-face))) - `(agda2-highlight-incomplete-pattern-face ((,c :inherit modus-themes-lang-warning))) - `(agda2-highlight-inductive-constructor-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-keyword-face ((,c :inherit font-lock-keyword-face))) - `(agda2-highlight-macro-face ((,c :inherit font-lock-keyword-face))) - `(agda2-highlight-module-face ((,c :inherit font-lock-variable-name-face))) - `(agda2-highlight-number-face ((,c :inherit shadow))) - `(agda2-highlight-operator-face ((,c :inherit font-lock-variable-name-face))) - `(agda2-highlight-positivity-problem-face ((,c :inherit modus-themes-lang-warning))) - `(agda2-highlight-postulate-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-pragma-face ((,c :inherit font-lock-preprocessor-face))) - `(agda2-highlight-primitive-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-primitive-type-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-record-face ((,c :inherit font-lock-type-face))) - `(agda2-highlight-string-face ((,c :inherit font-lock-string-face))) - `(agda2-highlight-symbol-face ((,c :inherit font-lock-constant-face))) - `(agda2-highlight-termination-problem-face ((,c :inherit modus-themes-lang-warning))) - `(agda2-highlight-typechecks-face ((,c :inherit font-lock-warning-face))) - `(agda2-highlight-unsolved-constraint-face ((,c :inherit modus-themes-lang-warning))) - `(agda2-highlight-unsolved-meta-face ((,c :inherit modus-themes-lang-warning))) + `(adoc-typewriter-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(adoc-verbatim-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) ;;;;; all-the-icons `(all-the-icons-blue ((,c :foreground ,blue-cooler))) `(all-the-icons-blue-alt ((,c :foreground ,blue-warmer))) @@ -1817,8 +4643,8 @@ FG and BG are the main colors." `(all-the-icons-ibuffer-mode-face ((,c :foreground ,type))) `(all-the-icons-ibuffer-size-face ((,c :foreground ,variable))) ;;;;; annotate - `(annotate-annotation ((,c :inherit modus-themes-subtle-blue))) - `(annotate-annotation-secondary ((,c :inherit modus-themes-subtle-magenta))) + `(annotate-annotation ((,c :background ,bg-blue-subtle :foreground ,fg-main))) + `(annotate-annotation-secondary ((,c :background ,bg-magenta-subtle :foreground ,fg-main))) `(annotate-highlight ((,c :background ,bg-blue-subtle :underline ,blue-intense))) `(annotate-highlight-secondary ((,c :background ,bg-magenta-subtle :underline ,magenta-intense))) ;;;;; ansi-color @@ -1841,83 +4667,86 @@ FG and BG are the main colors." `(ansi-color-white ((,c :background ,bg-term-white :foreground ,fg-term-white))) `(ansi-color-yellow ((,c :background ,bg-term-yellow :foreground ,fg-term-yellow))) ;;;;; anzu - `(anzu-match-1 ((,c :inherit modus-themes-subtle-cyan))) - `(anzu-match-2 ((,c :inherit modus-themes-search-current))) - `(anzu-match-3 ((,c :inherit modus-themes-subtle-yellow))) - `(anzu-mode-line ((,c :inherit bold))) - `(anzu-mode-line-no-match ((,c :inherit error))) - `(anzu-replace-highlight ((,c :inherit modus-themes-search-replace))) - `(anzu-replace-to ((,c :inherit modus-themes-search-current))) + `(anzu-match-1 ((,c :background ,bg-search-rx-group-0 :foreground ,fg-main))) + `(anzu-match-2 ((,c :background ,bg-search-rx-group-1 :foreground ,fg-main))) + `(anzu-match-3 ((,c :background ,bg-search-rx-group-2 :foreground ,fg-main))) + `(anzu-mode-line ((,c modus-themes-bold bold))) + `(anzu-mode-line-no-match ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(anzu-replace-highlight ((,c :background ,bg-search-replace :foreground ,fg-main))) + `(anzu-replace-to ((,c :background ,bg-search-current :foreground ,fg-main))) ;;;;; auctex and Tex `(font-latex-bold-face ((,c :inherit bold))) - `(font-latex-doctex-documentation-face ((,c :inherit font-lock-doc-face))) - `(font-latex-doctex-preprocessor-face ((,c :inherit font-lock-preprocessor-face))) + `(font-latex-doctex-documentation-face ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(font-latex-doctex-preprocessor-face ((,c :foreground ,preprocessor))) `(font-latex-italic-face ((,c :inherit italic))) - `(font-latex-math-face ((,c :inherit font-lock-constant-face))) - `(font-latex-script-char-face ((,c :inherit font-lock-builtin-face))) - `(font-latex-sectioning-5-face ((,c :inherit bold :foreground ,fg-alt))) - `(font-latex-sedate-face ((,c :inherit font-lock-keyword-face))) + `(font-latex-math-face ((,c :foreground ,constant))) + `(font-latex-script-char-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(font-latex-sectioning-5-face ((,c :inherit modus-themes-bold :foreground ,fg-alt))) + `(font-latex-sedate-face ((,c :inherit mouds-themes-bold :foreground ,keyword))) `(font-latex-slide-title-face ((,c :inherit modus-themes-heading-1))) - `(font-latex-string-face ((,c :inherit font-lock-string-face))) - `(font-latex-subscript-face ((,c :height 0.95))) - `(font-latex-superscript-face ((,c :height 0.95))) + `(font-latex-string-face ((,c :foreground ,string))) + `(font-latex-subscript-face ((,c :height 0.9))) + `(font-latex-superscript-face ((,c :height 0.9))) `(font-latex-underline-face ((,c :inherit underline))) - `(font-latex-verbatim-face ((,c :inherit modus-themes-prose-verbatim))) - `(font-latex-warning-face ((,c :inherit font-lock-warning-face))) - `(tex-verbatim ((,c :inherit modus-themes-prose-verbatim))) + `(font-latex-verbatim-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(font-latex-warning-face ((,c :inherit modus-themes-bold :foreground ,warning))) + `(tex-verbatim ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) ;; `(texinfo-heading ((,c :foreground ,magenta))) - `(TeX-error-description-error ((,c :inherit error))) - `(TeX-error-description-help ((,c :inherit success))) - `(TeX-error-description-tex-said ((,c :inherit success))) - `(TeX-error-description-warning ((,c :inherit warning))) + `(TeX-error-description-error ((,c :foreground ,err))) + `(TeX-error-description-help ((,c :foreground ,info))) + `(TeX-error-description-tex-said ((,c :foreground ,info))) + `(TeX-error-description-warning ((,c :foreground ,warning))) ;;;;; auto-dim-other-buffers `(auto-dim-other-buffers-face ((,c :background ,bg-inactive))) `(auto-dim-other-buffers-hide-face ((,c :foreground ,bg-inactive :background ,bg-inactive))) ;;;;; avy `(avy-background-face ((,c :background ,bg-dim :foreground ,fg-dim :extend t))) - `(avy-goto-char-timer-face ((,c :inherit (bold modus-themes-search-lazy modus-themes-reset-soft)))) - `(avy-lead-face ((,c :inherit (bold modus-themes-search-current modus-themes-reset-soft)))) - `(avy-lead-face-0 ((,c :inherit (bold modus-themes-search-current modus-themes-reset-soft)))) - `(avy-lead-face-1 ((,c :inherit (bold modus-themes-search-current modus-themes-reset-soft)))) - `(avy-lead-face-2 ((,c :inherit (bold modus-themes-search-current modus-themes-reset-soft)))) + `(avy-goto-char-timer-face ((,c :inherit (bold modus-themes-reset-soft) :background ,bg-search-lazy :foreground ,fg-main))) + `(avy-lead-face ((,c :inherit (bold modus-themes-reset-soft) :background ,bg-search-current :foreground ,fg-main))) + `(avy-lead-face-0 ((,c :inherit (bold modus-themes-reset-soft) :background ,bg-search-current :foreground ,fg-main))) + `(avy-lead-face-1 ((,c :inherit (bold modus-themes-reset-soft) :background ,bg-search-current :foreground ,fg-main))) + `(avy-lead-face-2 ((,c :inherit (bold modus-themes-reset-soft) :background ,bg-search-current :foreground ,fg-main))) ;;;;; aw (ace-window) `(aw-background-face ((,c :foreground "gray50"))) - `(aw-key-face ((,c :inherit modus-themes-key-binding))) - `(aw-leading-char-face ((,c :inherit (bold modus-themes-reset-soft) :height 1.5 :foreground ,red-intense))) - `(aw-minibuffer-leading-char-face ((,c :inherit modus-themes-key-binding))) - `(aw-mode-line-face ((,c :inherit bold))) + `(aw-key-face ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(aw-leading-char-face ((,c :inherit (bold modus-themes-reset-soft) :height 1.5 :foreground ,err))) ; same as `switch-window-label' + `(aw-minibuffer-leading-char-face ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(aw-mode-line-face ((,c :inherit modus-themes-bold))) ;;;;; binder `(binder-sidebar-highlight ((,c :inherit modus-themes-hl-line))) - `(binder-sidebar-marked ((,c :inherit modus-themes-mark-sel))) - `(binder-sidebar-missing ((,c :inherit modus-themes-mark-del))) + `(binder-sidebar-marked ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(binder-sidebar-missing ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) `(binder-sidebar-tags ((,c :foreground ,variable))) ;;;;; breadcrumb `(breadcrumb-face ((,c :foreground ,fg-alt))) - `(breadcrumb-imenu-leaf-face ((,c :inherit bold :foreground ,modeline-info))) ; same as `which-func' - `(breadcrumb-project-leaf-face ((,c :inherit bold))) + `(breadcrumb-imenu-leaf-face ((,c :inherit modus-themes-bold :foreground ,modeline-info))) ; same as `which-func' + `(breadcrumb-project-leaf-face ((,c :inherit modus-themes-bold))) ;;;;; bongo `(bongo-album-title (( ))) `(bongo-artist ((,c :foreground ,accent-0))) - `(bongo-currently-playing-track ((,c :inherit bold))) + `(bongo-currently-playing-track ((,c :inherit modus-themes-bold))) `(bongo-elapsed-track-part ((,c :background ,bg-inactive :underline t))) `(bongo-filled-seek-bar ((,c :background ,bg-hover))) - `(bongo-marked-track ((,c :inherit modus-themes-mark-alt))) + `(bongo-marked-track ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) `(bongo-marked-track-line ((,c :background ,bg-dim))) - `(bongo-played-track ((,c :inherit shadow :strike-through t))) - `(bongo-track-length ((,c :inherit shadow))) + `(bongo-played-track ((,c :foreground ,fg-dim :strike-through t))) + `(bongo-track-length ((,c :foreground ,fg-dim))) `(bongo-track-title ((,c :foreground ,accent-1))) `(bongo-unfilled-seek-bar ((,c :background ,bg-dim))) ;;;;; boon - `(boon-modeline-cmd ((,c :inherit modus-themes-intense-blue))) - `(boon-modeline-ins ((,c :inherit modus-themes-intense-red))) - `(boon-modeline-off ((,c :inherit modus-themes-intense-yellow))) - `(boon-modeline-spc ((,c :inherit modus-themes-intense-green))) + `(boon-modeline-cmd ((,c :background ,bg-blue-intense :foreground ,fg-main))) + `(boon-modeline-ins ((,c :background ,bg-red-intense :foreground ,fg-main))) + `(boon-modeline-off ((,c :background ,bg-yellow-intense :foreground ,fg-main))) + `(boon-modeline-spc ((,c :background ,bg-green-intense :foreground ,fg-main))) ;;;;; bookmark - `(bookmark-face ((,c :inherit success))) - `(bookmark-menu-bookmark ((,c :inherit bold))) + `(bookmark-face ((,c :foreground ,info))) + `(bookmark-menu-bookmark ((,c :foreground ,name))) ;;;;; calendar and diary - `(calendar-month-header ((,c :inherit bold))) - `(calendar-today ((,c :inherit bold :underline t))) + `(calendar-month-header ((,c :inherit modus-themes-bold))) + `(calendar-today + ((default :foreground ,date-common :inverse-video t) + (((supports :box t)) + :box (:line-width (-1 . -1) :color ,fg-main)))) `(calendar-weekday-header ((,c :foreground ,date-weekday))) `(calendar-weekend-header ((,c :foreground ,date-weekend))) `(diary ((,c :foreground ,date-common))) @@ -1931,105 +4760,105 @@ FG and BG are the main colors." ;; depends on an external program). `(calibredb-archive-face ((,c :foreground ,accent-3))) `(calibredb-author-face ((,c :foreground ,name))) - `(calibredb-comment-face ((,c :inherit shadow))) + `(calibredb-comment-face ((,c :foreground ,comment))) `(calibredb-date-face ((,c :foreground ,date-common))) - `(calibredb-edit-annotation-header-title-face ((,c :inherit bold))) - `(calibredb-favorite-face ((,c :foreground ,red-warmer))) + `(calibredb-edit-annotation-header-title-face ((,c :inherit modus-themes-bold))) + `(calibredb-favorite-face ((,c :inherit modus-themes-bold))) `(calibredb-file-face (( ))) `(calibredb-format-face ((,c :foreground ,fg-alt))) - `(calibredb-highlight-face ((,c :inherit success))) + `(calibredb-highlight-face ((,c :foreground ,info))) `(calibredb-id-face (( ))) `(calibredb-ids-face (( ))) `(calibredb-search-header-highlight-face ((,c :background ,bg-hl-line :extend t))) `(calibredb-search-header-library-name-face ((,c :foreground ,accent-2))) - `(calibredb-search-header-library-path-face ((,c :inherit bold))) - `(calibredb-search-header-sort-face ((,c :inherit bold :foreground ,accent-1))) - `(calibredb-search-header-total-face ((,c :inherit bold :foreground ,accent-0))) - `(calibredb-search-header-filter-face ((,c :inherit bold))) - `(calibredb-mark-face ((,c :inherit modus-themes-mark-sel))) + `(calibredb-search-header-library-path-face ((,c :inherit modus-themes-bold))) + `(calibredb-search-header-sort-face ((,c :inherit modus-themes-bold :foreground ,accent-1))) + `(calibredb-search-header-total-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(calibredb-search-header-filter-face ((,c :inherit modus-themes-bold))) + `(calibredb-mark-face ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) `(calibredb-size-face (( ))) `(calibredb-tag-face ((,c :foreground ,fg-alt))) ;;;;; centaur-tabs - `(centaur-tabs-active-bar-face ((,c :background ,blue))) - `(centaur-tabs-close-mouse-face ((,c :inherit bold :foreground ,red :underline t))) - `(centaur-tabs-close-selected ((,c :inherit centaur-tabs-selected))) - `(centaur-tabs-close-unselected ((,c :inherit centaur-tabs-unselected))) - `(centaur-tabs-modified-marker-selected ((,c :inherit centaur-tabs-selected))) - `(centaur-tabs-modified-marker-unselected ((,c :inherit centaur-tabs-unselected))) + `(centaur-tabs-active-bar-face ((,c :background ,blue))) ; special case like `doom-modeline-bar' + `(centaur-tabs-close-mouse-face ((,c :inherit modus-themes-bold :foreground ,warning :underline t))) + `(centaur-tabs-close-selected ((,c :inherit modus-themes-bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) + `(centaur-tabs-close-unselected ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) + `(centaur-tabs-modified-marker-selected ((,c :inherit modus-themes-bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) + `(centaur-tabs-modified-marker-unselected ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) `(centaur-tabs-default ((,c :background ,bg-main))) - `(centaur-tabs-selected ((,c :inherit bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) - `(centaur-tabs-selected-modified ((,c :inherit (italic centaur-tabs-selected)))) + `(centaur-tabs-selected ((,c :inherit modus-themes-bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) + `(centaur-tabs-selected-modified ((,c :inherit italic :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) `(centaur-tabs-unselected ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) - `(centaur-tabs-unselected-modified ((,c :inherit (italic centaur-tabs-unselected)))) + `(centaur-tabs-unselected-modified ((,c :inherit italic :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) ;;;;; change-log and log-view (`vc-print-log' and `vc-print-root-log') `(change-log-acknowledgment ((,c :foreground ,identifier))) - `(change-log-conditionals ((,c :inherit error))) + `(change-log-conditionals ((,c :foreground ,err))) `(change-log-date ((,c :foreground ,date-common))) `(change-log-email ((,c :foreground ,fg-alt))) - `(change-log-file ((,c :inherit bold))) - `(change-log-function ((,c :inherit warning))) - `(change-log-list ((,c :inherit bold))) + `(change-log-file ((,c :inherit modus-themes-bold))) + `(change-log-function ((,c :foreground ,warning))) + `(change-log-list ((,c :inherit modus-themes-bold))) `(change-log-name ((,c :foreground ,name))) - `(log-edit-header ((,c :inherit bold))) + `(log-edit-header ((,c :inherit modus-themes-bold))) `(log-edit-headers-separator ((,c :height 1 :background ,border :extend t))) - `(log-edit-summary ((,c :inherit success))) - `(log-edit-unknown-header ((,c :inherit shadow))) + `(log-edit-summary ((,c :inherit modus-themes-bold :foreground ,fg-alt))) + `(log-edit-unknown-header ((,c :foreground ,fg-dim))) `(log-view-commit-body (( ))) - `(log-view-file ((,c :inherit bold))) + `(log-view-file ((,c :inherit modus-themes-bold))) `(log-view-message ((,c :foreground ,identifier))) ;;;;; cider - `(cider-deprecated-face ((,c :inherit warning))) + `(cider-deprecated-face ((,c :foreground ,warning))) `(cider-enlightened-face ((,c :box ,warning))) - `(cider-enlightened-local-face ((,c :inherit warning))) - `(cider-error-highlight-face ((,c :inherit modus-themes-lang-error))) + `(cider-enlightened-local-face ((,c :foreground ,warning))) + `(cider-error-highlight-face ((,c :underline (:style wave :color ,underline-err)))) `(cider-fringe-good-face ((,c :foreground ,info))) `(cider-instrumented-face ((,c :box ,err))) - `(cider-reader-conditional-face ((,c :inherit font-lock-type-face))) - `(cider-repl-prompt-face ((,c :inherit minibuffer-prompt))) + `(cider-reader-conditional-face ((,c :inherit modus-themes-bold :foreground ,type))) + `(cider-repl-prompt-face ((,c :inherit modus-themes-prompt))) `(cider-repl-stderr-face ((,c :foreground ,err))) `(cider-repl-stdout-face (( ))) - `(cider-warning-highlight-face ((,c :inherit modus-themes-lang-warning))) + `(cider-warning-highlight-face ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; circe (and lui) - `(circe-fool-face ((,c :inherit shadow))) - `(circe-highlight-nick-face ((,c :inherit error))) + `(circe-fool-face ((,c :foreground ,fg-dim))) + `(circe-highlight-nick-face ((,c :foreground ,err))) `(circe-prompt-face ((,c :inherit modus-themes-prompt))) - `(circe-server-face ((,c :inherit shadow))) - `(lui-button-face ((,c :inherit button))) - `(lui-highlight-face ((,c :inherit error))) + `(circe-server-face ((,c :foreground ,fg-dim))) + `(lui-button-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(lui-highlight-face ((,c :foreground ,err))) `(lui-time-stamp-face ((,c :foreground ,date-common))) ;;;;; citar - `(citar ((,c :inherit shadow))) + `(citar ((,c :foreground ,fg-dim))) `(citar-highlight (( ))) ;;;;; clojure-mode - `(clojure-keyword-face ((,c :inherit font-lock-builtin-face))) + `(clojure-keyword-face ((,c :inherit modus-themes-bold :foreground ,keyword))) ;;;;; column-enforce-mode - `(column-enforce-face ((,c :inherit modus-themes-prominent-error))) + `(column-enforce-face ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) ;;;;; company-mode `(company-echo-common ((,c :inherit modus-themes-completion-match-0))) `(company-preview ((,c :background ,bg-dim :foreground ,fg-dim))) - `(company-preview-common ((,c :inherit company-echo-common))) + `(company-preview-common ((,c :inherit modus-themes-completion-match-0))) `(company-preview-search ((,c :background ,bg-yellow-intense))) `(company-scrollbar-bg ((,c :background ,bg-active))) `(company-scrollbar-fg ((,c :background ,fg-main))) `(company-template-field ((,c :background ,bg-active))) `(company-tooltip ((,c :inherit modus-themes-fixed-pitch :background ,bg-dim))) - `(company-tooltip-annotation ((,c :inherit completions-annotations))) - `(company-tooltip-common ((,c :inherit company-echo-common))) - `(company-tooltip-deprecated ((,c :inherit company-tooltip :strike-through t))) - `(company-tooltip-mouse ((,c :inherit highlight))) + `(company-tooltip-annotation ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(company-tooltip-common ((,c :inherit modus-themes-completion-match-0))) + `(company-tooltip-deprecated ((,c :inherit modus-themes-fixed-pitch :background ,bg-dim :strike-through t))) + `(company-tooltip-mouse ((,c :background ,bg-hover :foreground ,fg-main))) `(company-tooltip-scrollbar-thumb ((,c :background ,fg-alt))) `(company-tooltip-scrollbar-track ((,c :background ,bg-inactive))) - `(company-tooltip-search ((,c :inherit secondary-selection))) - `(company-tooltip-search-selection ((,c :inherit secondary-selection :underline t))) + `(company-tooltip-search ((,c :background ,bg-hover-secondary :foreground ,fg-main))) + `(company-tooltip-search-selection ((,c :background ,bg-hover-secondary :foreground ,fg-main :underline t))) `(company-tooltip-selection ((,c :inherit modus-themes-completion-selected))) ;;;;; compilation - `(compilation-column-number ((,c :inherit compilation-line-number))) + `(compilation-column-number ((,c :foreground ,fg-dim))) `(compilation-error ((,c :inherit modus-themes-bold :foreground ,err))) `(compilation-info ((,c :inherit modus-themes-bold :foreground ,info))) - `(compilation-line-number ((,c :inherit shadow))) - `(compilation-mode-line-exit ((,c :inherit bold))) - `(compilation-mode-line-fail ((,c :inherit bold :foreground ,modeline-err))) - `(compilation-mode-line-run ((,c :inherit bold :foreground ,modeline-warning))) + `(compilation-line-number ((,c :foreground ,fg-dim))) + `(compilation-mode-line-exit ((,c :inherit modus-themes-bold))) + `(compilation-mode-line-fail ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(compilation-mode-line-run ((,c :inherit modus-themes-bold :foreground ,modeline-warning))) `(compilation-warning ((,c :inherit modus-themes-bold :foreground ,warning))) ;;;;; completions `(completions-annotations ((,c :inherit modus-themes-slant :foreground ,docstring))) @@ -2037,12 +4866,14 @@ FG and BG are the main colors." `(completions-first-difference ((,c :inherit modus-themes-completion-match-1))) `(completions-highlight ((,c :inherit modus-themes-completion-selected))) ;;;;; consult - `(consult-async-split ((,c :inherit error))) + `(consult-async-split ((,c :foreground ,err))) `(consult-file ((,c :inherit modus-themes-bold :foreground ,info))) - `(consult-key ((,c :inherit modus-themes-key-binding))) - `(consult-imenu-prefix ((,c :inherit shadow))) - `(consult-line-number ((,c :inherit shadow))) - `(consult-line-number-prefix ((,c :inherit shadow))) + `(consult-highlight-mark ((,c :background ,bg-search-static :foreground ,fg-main))) + `(consult-highlight-match ((,c :background ,bg-search-static :foreground ,fg-main))) + `(consult-imenu-prefix ((,c :foreground ,fg-dim))) + `(consult-key ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(consult-line-number ((,c :foreground ,fg-dim))) + `(consult-line-number-prefix ((,c :foreground ,fg-dim))) `(consult-preview-insertion ((,c :background ,bg-dim))) ;;;;; corfu `(corfu-current ((,c :inherit modus-themes-completion-selected))) @@ -2050,20 +4881,20 @@ FG and BG are the main colors." `(corfu-border ((,c :background ,bg-active))) `(corfu-default ((,c :inherit modus-themes-fixed-pitch :background ,bg-dim))) ;;;;; corfu-candidate-overlay - `(corfu-candidate-overlay-face ((t :inherit shadow))) + `(corfu-candidate-overlay-face ((,c :foreground ,fg-dim))) ;;;;; corfu-quick - `(corfu-quick1 ((,c :inherit (bold modus-themes-search-current)))) - `(corfu-quick2 ((,c :inherit (bold modus-themes-search-current)))) + `(corfu-quick1 ((,c :inherit bold :background ,bg-search-current :foreground ,fg-main))) + `(corfu-quick2 ((,c :inherit bold :background ,bg-search-current :foreground ,fg-main))) ;;;;; counsel `(counsel-active-mode ((,c :foreground ,keyword))) `(counsel-application-name ((,c :foreground ,name))) - `(counsel-key-binding ((,c :inherit modus-themes-key-binding))) + `(counsel-key-binding ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) `(counsel-outline-default ((,c :foreground ,fg-main))) - `(counsel-variable-documentation ((,c :inherit font-lock-doc-face))) + `(counsel-variable-documentation ((,c :inherit modus-themes-slant :foreground ,docstring))) ;;;;; cperl-mode `(cperl-nonoverridable-face ((,c :foreground unspecified))) - `(cperl-array-face ((,c :inherit font-lock-keyword-face))) - `(cperl-hash-face ((,c :inherit font-lock-variable-name-face))) + `(cperl-array-face ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(cperl-hash-face ((,c :foreground ,variable))) ;;;;; crontab-mode `(crontab-minute ((,c :foreground ,string))) `(crontab-hour ((,c :foreground ,keyword))) @@ -2072,130 +4903,138 @@ FG and BG are the main colors." `(crontab-week-day ((,c :foreground ,variable))) `(crontab-predefined ((,c :foreground ,string))) ;;;;; csv-mode - `(csv-separator-face ((,c :foreground ,red-intense))) + `(csv-separator-face (( ))) ;;;;; ctrlf - `(ctrlf-highlight-active ((,c :inherit modus-themes-search-current))) + `(ctrlf-highlight-active ((,c :background ,bg-search-current :foreground ,fg-main))) `(ctrlf-highlight-line ((,c :background ,bg-hl-line :extend t))) - `(ctrlf-highlight-passive ((,c :inherit modus-themes-search-lazy))) + `(ctrlf-highlight-passive ((,c :background ,bg-search-lazy :foreground ,fg-main))) ;;;;; custom (M-x customize) `(custom-button ((,c :inherit modus-themes-button))) - `(custom-button-mouse ((,c :inherit (highlight custom-button)))) - `(custom-button-pressed ((,c :inherit (secondary-selection custom-button)))) + `(custom-button-mouse + ((default :inherit variable-pitch :background ,bg-hover :foreground ,fg-main) + (((supports :box t)) + :box (:line-width 1 :color ,border :style released-button)) + (t :underline ,border))) + `(custom-button-pressed + ((default :inherit variable-pitch :background ,bg-main :foreground ,fg-main) + (((supports :box t)) + :box (:line-width 1 :color ,border :style pressed-button)) + (t :underline ,border))) `(custom-changed ((,c :background ,bg-changed))) - `(custom-comment ((,c :inherit shadow))) - `(custom-comment-tag ((,c :inherit (bold shadow)))) - `(custom-invalid ((,c :inherit error :strike-through t))) - `(custom-modified ((,c :inherit custom-changed))) - `(custom-rogue ((,c :inherit custom-invalid))) - `(custom-set ((,c :inherit success))) + `(custom-comment ((,c :foreground ,comment))) + `(custom-comment-tag ((,c :inherit modus-themes-bold :foreground ,comment))) + `(custom-invalid ((,c :foreground ,err :strike-through t))) + `(custom-modified ((,c :background ,bg-changed))) + `(custom-rogue ((,c :foreground ,err :strike-through t))) + `(custom-set ((,c :foreground ,info))) `(custom-state ((,c :foreground ,warning))) - `(custom-themed ((,c :inherit custom-changed))) - `(custom-variable-obsolete ((,c :inherit shadow))) - `(custom-face-tag ((,c :inherit bold :foreground ,type))) - `(custom-group-tag ((,c :inherit bold :foreground ,builtin))) - `(custom-group-tag-1 ((,c :inherit bold :foreground ,constant))) - `(custom-variable-tag ((,c :inherit bold :foreground ,variable))) + `(custom-themed ((,c :background ,bg-changed))) + `(custom-variable-obsolete ((,c :foreground ,fg-dim))) + `(custom-face-tag ((,c :inherit modus-themes-bold :foreground ,type))) + `(custom-group-tag ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(custom-group-tag-1 ((,c :inherit modus-themes-bold :foreground ,constant))) + `(custom-variable-tag ((,c :inherit modus-themes-bold :foreground ,variable))) ;;;;; dashboard `(dashboard-heading ((,c :foreground ,name))) `(dashboard-items-face (( ))) ; use the underlying style of all-the-icons ;;;;; deadgrep - `(deadgrep-filename-face ((,c :inherit bold :foreground ,name))) - `(deadgrep-match-face ((,c :inherit match))) - `(deadgrep-meta-face ((,c :inherit shadow))) - `(deadgrep-regexp-metachar-face ((,c :inherit font-lock-regexp-grouping-construct))) - `(deadgrep-search-term-face ((,c :inherit success))) + `(deadgrep-filename-face ((,c :inherit modus-themes-bold :foreground ,name))) + `(deadgrep-match-face ((,c :background ,bg-search-static :foreground ,fg-main))) + `(deadgrep-meta-face ((,c :foreground ,fg-dim))) + `(deadgrep-regexp-metachar-face ((,c :inherit modus-themes-bold :foreground ,rx-construct))) + `(deadgrep-search-term-face ((,c :foreground ,info))) ;;;;; debbugs `(debbugs-gnu-archived ((,c :background ,bg-inactive :foreground ,fg-dim))) - `(debbugs-gnu-done ((,c :inherit success))) - `(debbugs-gnu-forwarded ((,c :inherit modus-themes-slant :foreground ,info))) + `(debbugs-gnu-done ((,c :foreground ,info))) + `(debbugs-gnu-forwarded ((,c :inherit modus-themes-slant))) `(debbugs-gnu-handled (( ))) - `(debbugs-gnu-marked ((,c :inherit modus-themes-mark-sel))) - `(debbugs-gnu-marked-stale ((,c :inherit modus-themes-mark-alt))) - `(debbugs-gnu-new ((,c :inherit error))) - `(debbugs-gnu-pending ((,c :inherit modus-themes-slant :foreground ,fg-alt))) - `(debbugs-gnu-stale-1 ((,c :foreground ,red-cooler))) - `(debbugs-gnu-stale-2 ((,c :foreground ,yellow-warmer))) - `(debbugs-gnu-stale-3 ((,c :foreground ,magenta-warmer))) - `(debbugs-gnu-stale-4 ((,c :foreground ,magenta-cooler))) - `(debbugs-gnu-stale-5 ((,c :foreground ,cyan-faint))) - `(debbugs-gnu-tagged ((,c :inherit modus-themes-mark-alt))) - `(debbugs-gnu-title ((,c :inherit bold))) + `(debbugs-gnu-marked ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(debbugs-gnu-marked-stale ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) + `(debbugs-gnu-new ((,c :inherit modus-themes-bold :foreground ,err))) + `(debbugs-gnu-pending ((,c :inherit bold-italic :foreground ,warning))) + `(debbugs-gnu-stale-1 ((,c :foreground ,err))) + `(debbugs-gnu-stale-2 ((,c :foreground ,warning))) + `(debbugs-gnu-stale-3 ((,c :foreground ,info))) + `(debbugs-gnu-stale-4 ((,c :foreground ,fg-alt))) + `(debbugs-gnu-stale-5 ((,c :foreground ,fg-dim))) + `(debbugs-gnu-tagged ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) + `(debbugs-gnu-title ((,c :inherit modus-themes-heading-1))) ;;;;; deft - `(deft-filter-string-face ((,c :inherit success))) - `(deft-header-face ((,c :inherit shadow))) - `(deft-separator-face ((,c :foreground "gray50"))) - `(deft-summary-face ((,c :inherit (shadow modus-themes-slant)))) + `(deft-filter-string-face ((,c :foreground ,info))) + `(deft-header-face ((,c :foreground ,fg-dim))) + `(deft-separator-face ((,c :foreground ,border))) + `(deft-summary-face ((,c :inherit modus-themes-slant :foreground ,fg-dim))) `(deft-time-face ((,c :foreground ,date-common))) - `(deft-title-face ((,c :inherit bold))) + `(deft-title-face ((,c :inherit modus-themes-heading-1))) ;;;;; denote `(denote-faces-date ((,c :foreground ,date-common))) - `(denote-faces-delimiter ((,c :inherit shadow))) - `(denote-faces-extension ((,c :inherit shadow))) + `(denote-faces-delimiter ((,c :foreground ,fg-dim))) + `(denote-faces-extension ((,c :foreground ,fg-dim))) `(denote-faces-keywords ((,c :inherit modus-themes-bold :foreground ,keyword))) - `(denote-faces-link ((,c :inherit link))) + `(denote-faces-link ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(denote-faces-prompt-current-name ((,c :inherit modus-themes-slant :foreground ,fg-changed-intense))) `(denote-faces-prompt-new-name ((,c :inherit modus-themes-slant :foreground ,fg-added-intense))) `(denote-faces-prompt-old-name ((,c :inherit modus-themes-slant :foreground ,fg-removed-intense))) `(denote-faces-signature ((,c :inherit modus-themes-bold :foreground ,string))) `(denote-faces-subdirectory ((,c :inherit modus-themes-bold :foreground ,fg-alt))) - `(denote-faces-time ((,c :inherit denote-faces-date))) - `(denote-faces-time-delimiter ((,c :inherit shadow))) + `(denote-faces-time ((,c :foreground ,date-common))) + `(denote-faces-time-delimiter ((,c :foreground ,fg-dim))) `(denote-faces-title (( ))) ;;;;; devdocs `(devdocs-code-block ((,c :inherit modus-themes-fixed-pitch :background ,bg-dim :extend t))) ;;;;; dictionary - `(dictionary-button-face ((,c :inherit bold))) - `(dictionary-reference-face ((,c :inherit link))) + `(dictionary-button-face ((,c :inherit modus-themes-bold))) + `(dictionary-reference-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(dictionary-word-definition-face (( ))) - `(dictionary-word-entry-face ((,c :inherit font-lock-comment-face))) + `(dictionary-word-entry-face ((,c :inherit modus-themes-slant :foreground ,comment))) ;;;;; diff-hl `(diff-hl-change ((,c :background ,bg-changed-fringe))) `(diff-hl-delete ((,c :background ,bg-removed-fringe))) `(diff-hl-insert ((,c :background ,bg-added-fringe))) `(diff-hl-reverted-hunk-highlight ((,c :background ,fg-main :foreground ,bg-main))) ;;;;; diff-mode - `(diff-added ((,c :background ,bg-added :foreground ,fg-added))) + `(diff-added ((,c :background ,bg-added :foreground ,fg-added :extend t))) `(diff-changed ((,c :background ,bg-changed :foreground ,fg-changed :extend t))) - `(diff-changed-unspecified ((,c :inherit diff-changed))) - `(diff-removed ((,c :background ,bg-removed :foreground ,fg-removed))) + `(diff-changed-unspecified ((,c :background ,bg-changed :foreground ,fg-changed :extend t))) + `(diff-removed ((,c :background ,bg-removed :foreground ,fg-removed :extend t))) `(diff-refine-added ((,c :background ,bg-added-refine :foreground ,fg-added))) `(diff-refine-changed ((,c :background ,bg-changed-refine :foreground ,fg-changed))) `(diff-refine-removed ((,c :background ,bg-removed-refine :foreground ,fg-removed))) - `(diff-indicator-added ((,c :inherit diff-added :foreground ,fg-added-intense))) - `(diff-indicator-changed ((,c :inherit diff-changed :foreground ,fg-changed-intense))) - `(diff-indicator-removed ((,c :inherit diff-removed :foreground ,fg-removed-intense))) + `(diff-indicator-added ((,c :background ,bg-added :foreground ,fg-added-intense))) + `(diff-indicator-changed ((,c :background ,bg-changed :foreground ,fg-changed-intense))) + `(diff-indicator-removed ((,c :background ,bg-removed :foreground ,fg-removed-intense))) `(diff-context (( ))) - `(diff-error ((,c :inherit error))) - `(diff-file-header ((,c :inherit bold))) + `(diff-error ((,c :foreground ,err))) + `(diff-file-header ((,c :inherit modus-themes-bold))) `(diff-function ((,c :background ,bg-inactive))) `(diff-header (( ))) - `(diff-hunk-header ((,c :inherit bold :background ,bg-inactive))) - `(diff-index ((,c :inherit italic))) - `(diff-nonexistent ((,c :inherit bold))) + `(diff-hunk-header ((,c :inherit modus-themes-bold :background ,bg-inactive))) + `(diff-index ((,c :inherit modus-themes-slant))) + `(diff-nonexistent ((,c :inherit modus-themes-bold))) ;;;;; dim-autoload - `(dim-autoload-cookie-line ((,c :inherit font-lock-comment-face))) + `(dim-autoload-cookie-line ((,c :inherit modus-themes-slant :foreground ,comment))) ;;;;; dired - `(dired-broken-symlink ((,c :inherit button :foreground ,err))) + `(dired-broken-symlink ((,c :foreground ,err :underline t))) `(dired-directory ((,c :foreground ,accent-0))) - `(dired-flagged ((,c :inherit modus-themes-mark-del))) - `(dired-header ((,c :inherit bold))) - `(dired-ignored ((,c :inherit shadow))) - `(dired-mark ((,c :inherit bold))) - `(dired-marked ((,c :inherit modus-themes-mark-sel))) - `(dired-perm-write ((,c :inherit shadow))) - `(dired-symlink ((,c :inherit button :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) - `(dired-warning ((,c :inherit warning))) + `(dired-flagged ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) + `(dired-header ((,c :inherit modus-themes-bold))) + `(dired-ignored ((,c :foreground ,fg-dim))) + `(dired-mark ((,c :inherit modus-themes-bold))) + `(dired-marked ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(dired-perm-write ((,c :foreground ,fg-dim))) + `(dired-symlink ((,c :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) + `(dired-warning ((,c :foreground ,warning))) ;;;;; dired-async - `(dired-async-failures ((,c :inherit error))) - `(dired-async-message ((,c :inherit bold))) - `(dired-async-mode-message ((,c :inherit bold))) + `(dired-async-failures ((,c :foreground ,err))) + `(dired-async-message ((,c :inherit modus-themes-bold))) + `(dired-async-mode-message ((,c :inherit modus-themes-bold))) ;;;;; dired-git - `(dired-git-branch-else ((,c :inherit bold :foreground ,accent-0))) - `(dired-git-branch-master ((,c :inherit bold :foreground ,accent-1))) + `(dired-git-branch-else ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(dired-git-branch-master ((,c :inherit modus-themes-bold :foreground ,accent-1))) ;;;;; dired-git-info `(dgi-commit-message-face ((,c :foreground ,docstring))) ;;;;; dired-narrow - `(dired-narrow-blink ((,c :inherit (modus-themes-prominent-warning bold)))) + `(dired-narrow-blink ((,c :background ,bg-prominent-warning :foreground ,fg-prominent-warning))) ;;;;; dired-subtree ;; remove backgrounds from dired-subtree faces, else they break ;; dired-{flagged,marked} and any other face that sets a background @@ -2212,70 +5051,70 @@ FG and BG are the main colors." `(diredfl-compressed-file-name ((,c :foreground ,warning))) `(diredfl-compressed-file-suffix ((,c :foreground ,err))) `(diredfl-date-time ((,c :foreground ,date-common))) - `(diredfl-deletion ((,c :inherit dired-flagged))) - `(diredfl-deletion-file-name ((,c :inherit diredfl-deletion))) - `(diredfl-dir-heading ((,c :inherit bold))) - `(diredfl-dir-name ((,c :inherit dired-directory))) - `(diredfl-dir-priv ((,c :inherit dired-directory))) + `(diredfl-deletion ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) + `(diredfl-deletion-file-name ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) + `(diredfl-dir-heading ((,c :inherit modus-themes-bold))) + `(diredfl-dir-name ((,c :foreground ,accent-0))) + `(diredfl-dir-priv ((,c :foreground ,accent-0))) `(diredfl-exec-priv ((,c :foreground ,accent-1))) - `(diredfl-executable-tag ((,c :inherit diredfl-exec-priv))) + `(diredfl-executable-tag ((,c :foreground ,accent-1))) `(diredfl-file-name ((,c :foreground ,fg-main))) `(diredfl-file-suffix ((,c :foreground ,variable))) - `(diredfl-flag-mark ((,c :inherit dired-marked))) - `(diredfl-flag-mark-line ((,c :inherit dired-marked))) - `(diredfl-ignored-file-name ((,c :inherit shadow))) + `(diredfl-flag-mark ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(diredfl-flag-mark-line ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(diredfl-ignored-file-name ((,c :foreground ,fg-dim))) `(diredfl-link-priv ((,c :foreground ,fg-link))) - `(diredfl-no-priv ((,c :inherit shadow))) - `(diredfl-number ((,c :inherit shadow))) + `(diredfl-no-priv ((,c :foreground ,fg-dim))) + `(diredfl-number ((,c :foreground ,fg-dim))) `(diredfl-other-priv ((,c :foreground ,accent-2))) `(diredfl-rare-priv ((,c :foreground ,accent-3))) `(diredfl-read-priv ((,c :foreground ,fg-main))) - `(diredfl-symlink ((,c :inherit dired-symlink))) - `(diredfl-tagged-autofile-name ((,c :inherit (diredfl-autofile-name dired-marked)))) + `(diredfl-symlink ((,c :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) + `(diredfl-tagged-autofile-name ((,c :background ,bg-inactive))) `(diredfl-write-priv ((,c :foreground ,accent-0))) ;;;;; disk-usage - `(disk-usage-inaccessible ((,c :inherit error))) + `(disk-usage-inaccessible ((,c :foreground ,err))) `(disk-usage-percent ((,c :foreground ,accent-0))) `(disk-usage-size ((,c :foreground ,accent-1))) - `(disk-usage-symlink ((,c :inherit dired-symlink))) - `(disk-usage-symlink-directory ((,c :inherit dired-symlink))) + `(disk-usage-symlink ((,c :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) + `(disk-usage-symlink-directory ((,c :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) ;;;;; display-fill-column-indicator-mode `(fill-column-indicator ((,c :height 1 :background ,bg-active :foreground ,bg-active))) ;;;;; doom-modeline - `(doom-modeline-bar ((,c :background ,blue))) + `(doom-modeline-bar ((,c :background ,blue))) ; special case like `centaur-tabs-active-bar-face' `(doom-modeline-bar-inactive ((,c :background ,border))) `(doom-modeline-battery-charging ((,c :foreground ,modeline-info))) `(doom-modeline-battery-critical ((,c :underline t :foreground ,modeline-err))) `(doom-modeline-battery-error ((,c :underline t :foreground ,modeline-err))) `(doom-modeline-battery-full (( ))) - `(doom-modeline-battery-warning ((,c :inherit warning))) - `(doom-modeline-buffer-file ((,c :inherit bold))) + `(doom-modeline-battery-warning ((,c :foreground ,warning))) + `(doom-modeline-buffer-file ((,c :inherit modus-themes-bold))) `(doom-modeline-buffer-major-mode (( ))) `(doom-modeline-buffer-minor-mode (( ))) `(doom-modeline-buffer-modified ((,c :foreground ,modeline-err))) `(doom-modeline-buffer-path (( ))) - `(doom-modeline-evil-emacs-state ((,c :inherit italic))) + `(doom-modeline-evil-emacs-state ((,c :inherit modus-themes-slant))) `(doom-modeline-evil-insert-state ((,c :foreground ,modeline-info))) `(doom-modeline-evil-motion-state (( ))) `(doom-modeline-evil-normal-state (( ))) - `(doom-modeline-evil-operator-state ((,c :inherit bold))) - `(doom-modeline-evil-replace-state ((,c :inherit error))) - `(doom-modeline-evil-visual-state ((,c :inherit warning))) - `(doom-modeline-info ((,c :inherit success))) + `(doom-modeline-evil-operator-state ((,c :inherit modus-themes-bold))) + `(doom-modeline-evil-replace-state ((,c :foreground ,err))) + `(doom-modeline-evil-visual-state ((,c :foreground ,warning))) + `(doom-modeline-info ((,c :foreground ,info))) `(doom-modeline-input-method (( ))) - `(doom-modeline-lsp-error ((,c :inherit bold))) + `(doom-modeline-lsp-error ((,c :inherit modus-themes-bold))) `(doom-modeline-lsp-running (( ))) - `(doom-modeline-lsp-success ((,c :inherit success))) - `(doom-modeline-lsp-warning ((,c :inherit warning))) - `(doom-modeline-notification ((,c :inherit error))) + `(doom-modeline-lsp-success ((,c :foreground ,info))) + `(doom-modeline-lsp-warning ((,c :foreground ,warning))) + `(doom-modeline-notification ((,c :foreground ,err))) `(doom-modeline-project-dir (( ))) `(doom-modeline-project-parent-dir (( ))) `(doom-modeline-project-root-dir (( ))) - `(doom-modeline-repl-success ((,c :inherit success))) - `(doom-modeline-repl-warning ((,c :inherit warning))) + `(doom-modeline-repl-success ((,c :foreground ,info))) + `(doom-modeline-repl-warning ((,c :foreground ,warning))) `(doom-modeline-time (( ))) - `(doom-modeline-urgent ((,c :inherit bold :foreground ,modeline-err))) - `(doom-modeline-warning ((,c :inherit warning))) + `(doom-modeline-urgent ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(doom-modeline-warning ((,c :foreground ,warning))) ;;;;; ediff `(ediff-current-diff-A ((,c :background ,bg-removed :foreground ,fg-removed))) `(ediff-current-diff-Ancestor ((,c :background ,bg-region))) @@ -2286,203 +5125,244 @@ FG and BG are the main colors." `(ediff-even-diff-B ((,c :background ,bg-diff-context))) `(ediff-even-diff-C ((,c :background ,bg-diff-context))) `(ediff-fine-diff-A ((,c :background ,bg-removed-refine :foreground ,fg-removed))) - `(ediff-fine-diff-Ancestor ((,c :inherit modus-themes-subtle-cyan))) + `(ediff-fine-diff-Ancestor ((,c :background ,bg-active :foreground ,fg-main))) `(ediff-fine-diff-B ((,c :background ,bg-added-refine :foreground ,fg-added))) `(ediff-fine-diff-C ((,c :background ,bg-changed-refine :foreground ,fg-changed))) - `(ediff-odd-diff-A ((,c :inherit ediff-even-diff-A))) - `(ediff-odd-diff-Ancestor ((,c :inherit ediff-even-diff-Ancestor))) - `(ediff-odd-diff-B ((,c :inherit ediff-even-diff-B))) - `(ediff-odd-diff-C ((,c :inherit ediff-even-diff-C))) + `(ediff-odd-diff-A ((,c :background ,bg-diff-context))) + `(ediff-odd-diff-Ancestor ((,c :background ,bg-diff-context))) + `(ediff-odd-diff-B ((,c :background ,bg-diff-context))) + `(ediff-odd-diff-C ((,c :background ,bg-diff-context))) ;;;;; ein (Emacs IPython Notebook) `(ein:basecell-input-area-face ((,c :background ,bg-dim :extend t))) `(ein:cell-output-area (( ))) `(ein:cell-output-area-error ((,c :background ,bg-removed :extend t))) `(ein:cell-output-stderr ((,c :background ,bg-removed :extend t))) `(ein:markdowncell-input-area-face (( ))) - `(ein:notification-tab-normal ((,c :underline t))) + `(ein:notification-tab-normal ((,c :inherit underline))) ;;;;; eglot + `(eglot-highlight-symbol-face ((,c :underline ,border))) `(eglot-mode-line ((,c :inherit modus-themes-bold :foreground ,modeline-info))) - `(eglot-diagnostic-tag-unnecessary-face ((,c :inherit modus-themes-lang-note))) + `(eglot-diagnostic-tag-unnecessary-face ((,c :underline (:style wave :color ,underline-note)))) ;;;;; el-search - `(el-search-highlight-in-prompt-face ((,c :inherit italic))) - `(el-search-match ((,c :inherit modus-themes-search-current))) - `(el-search-other-match ((,c :inherit modus-themes-search-lazy))) - `(el-search-occur-match ((,c :inherit match))) + `(el-search-highlight-in-prompt-face ((,c :inherit modus-themes-slant))) + `(el-search-match ((,c :background ,bg-search-current :foreground ,fg-main))) + `(el-search-other-match ((,c :background ,bg-search-lazy :foreground ,fg-main))) + `(el-search-occur-match ((,c :background ,bg-search-static :foreground ,fg-main))) ;;;;; eldoc ;; NOTE: see https://github.com/purcell/package-lint/issues/187 - (list 'eldoc-highlight-function-argument `((,c :inherit bold :background ,bg-active-argument :foreground ,fg-active-argument))) + (list 'eldoc-highlight-function-argument `((,c :inherit modus-themes-bold :background ,bg-active-argument :foreground ,fg-active-argument))) ;;;;; eldoc-box `(eldoc-box-body ((,c :background ,bg-dim :foreground ,fg-main))) `(eldoc-box-border ((,c :background ,border))) ;;;;; elfeed - `(elfeed-log-date-face ((,c :inherit elfeed-search-date-face))) - `(elfeed-log-debug-level-face ((,c :inherit elfeed-search-filter-face))) - `(elfeed-log-error-level-face ((,c :inherit error))) - `(elfeed-log-info-level-face ((,c :inherit success))) - `(elfeed-log-warn-level-face ((,c :inherit warning))) + `(elfeed-log-date-face ((,c :foreground ,date-common))) + `(elfeed-log-debug-level-face ((,c :inherit modus-themes-bold))) + `(elfeed-log-error-level-face ((,c :foreground ,err))) + `(elfeed-log-info-level-face ((,c :foreground ,info))) + `(elfeed-log-warn-level-face ((,c :foreground ,warning))) `(elfeed-search-date-face ((,c :foreground ,date-common))) `(elfeed-search-feed-face ((,c :foreground ,accent-1))) - `(elfeed-search-filter-face ((,c :inherit bold))) - `(elfeed-search-last-update-face ((,c :inherit bold :foreground ,date-common))) + `(elfeed-search-filter-face ((,c :inherit modus-themes-bold))) + `(elfeed-search-last-update-face ((,c :inherit modus-themes-bold :foreground ,date-common))) `(elfeed-search-tag-face ((,c :foreground ,accent-0))) `(elfeed-search-title-face ((,c :foreground ,fg-dim))) `(elfeed-search-unread-count-face (( ))) `(elfeed-search-unread-title-face ((,c :inherit bold :foreground ,fg-main))) ;;;;; elfeed-score `(elfeed-score-date-face ((,c :foreground ,date-common))) - `(elfeed-score-debug-level-face ((,c :inherit bold))) - `(elfeed-score-error-level-face ((,c :inherit error))) - `(elfeed-score-info-level-face ((,c :inherit success))) - `(elfeed-score-warn-level-face ((,c :inherit warning))) + `(elfeed-score-debug-level-face ((,c :inherit modus-themes-bold))) + `(elfeed-score-error-level-face ((,c :foreground ,err))) + `(elfeed-score-info-level-face ((,c :foreground ,info))) + `(elfeed-score-warn-level-face ((,c :foreground ,warning))) +;;;;; elisp semantic highlighting + `(elisp-ampersand ((,c :inherit modus-themes-bold :foreground ,type))) + `(elisp-binding-variable (( ))) + `(elisp-bound-variable ((,c :foreground ,variable-use))) + `(elisp-charset (( ))) + `(elisp-coding (( ))) + `(elisp-completion-category (( ))) + `(elisp-completion-category-definition ((,c :foreground ,constant))) + `(elisp-condition ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(elisp-constant (( ))) + `(elisp-defcharset ((,c :foreground ,type))) + `(elisp-defcoding ((,c :foreground ,type))) + `(elisp-defface ((,c :foreground ,type))) + `(elisp-deficon ((,c :foreground ,type))) + `(elisp-defmacro ((,c :foreground ,fnname))) + `(elisp-defoclosure ((,c :foreground ,type))) + `(elisp-defun ((,c :foreground ,fnname))) + `(elisp-defvar ((,c :foreground ,variable))) + `(elisp-face (( ))) + `(elisp-feature ((,c :foreground ,constant))) + `(elisp-free-variable (( ))) + `(elisp-function ((,c :foreground ,fnname-call))) + `(elisp-function-property-declaration ((,c :foreground ,builtin))) + `(elisp-group (( ))) + `(elisp-icon (( ))) + `(elisp-macro ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(elisp-major-mode-name ((,c :foreground ,type))) + `(elisp-nnoo-backend ((,c :foreground ,type))) + `(elisp-non-local-exit ((,c :inherit modus-themes-bold :foreground ,warning))) + `(elisp-oclosure (( ))) + `(elisp-rx ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(elisp-shadowed-variable ((,c :foreground ,variable-use))) + `(elisp-shadowing-variable (( ))) + `(elisp-shorthand-font-lock-face ((,c :inherit modus-themes-slant :foreground ,preprocessor))) + `(elisp-slot ((,c :foreground ,builtin))) + `(elisp-special-form ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(elisp-special-variable-declaration (( ))) + `(elisp-symbol-at-mouse ((,c :background ,bg-hover :foreground ,fg-main))) + `(elisp-symbol-role (( ))) + `(elisp-symbol-role-definition ((,c :foreground ,type))) + `(elisp-theme (( ))) + `(elisp-thing (( ))) + `(elisp-throw-tag ((,c :inherit modus-themes-bold :foreground ,fg-main))) + `(elisp-type (( ))) + `(elisp-unknown-call ((,c :inherit modus-themes-slant :foreground ,fnname-call))) + `(elisp-variable-at-point ((,c :underline ,border))) + `(elisp-warning-type ((,c :foreground ,warning))) + `(elisp-widget-type (( ))) ;;;;; elpher `(elpher-gemini-heading1 ((,c :inherit modus-themes-heading-1))) `(elpher-gemini-heading2 ((,c :inherit modus-themes-heading-2))) `(elpher-gemini-heading3 ((,c :inherit modus-themes-heading-3))) ;;;;; embark - `(embark-collect-group-title ((,c :inherit bold :foreground ,name))) - `(embark-keybinding ((,c :inherit modus-themes-key-binding))) - `(embark-keybinding-repeat ((,c :inherit bold))) - `(embark-selected ((,c :inherit modus-themes-mark-sel))) + `(embark-collect-group-title ((,c :inherit modus-themes-bold :foreground ,name))) + `(embark-keybinding ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(embark-keybinding-repeat ((,c :inherit modus-themes-bold))) + `(embark-selected ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) ;;;;; ement (ement.el) - `(ement-room-fully-read-marker ((,c :inherit success))) - `(ement-room-membership ((,c :inherit shadow))) - `(ement-room-mention ((,c :inherit highlight))) - `(ement-room-name ((,c :inherit bold))) - `(ement-room-reactions ((,c :inherit shadow))) - `(ement-room-read-receipt-marker ((,c :inherit match))) - `(ement-room-self ((,c :inherit bold :foreground ,accent-1))) + `(ement-room-fully-read-marker ((,c :foreground ,info))) + `(ement-room-membership ((,c :foreground ,fg-dim))) + `(ement-room-mention ((,c :background ,bg-hover :foreground ,fg-main))) + `(ement-room-name ((,c :inherit modus-themes-bold))) + `(ement-room-reactions ((,c :foreground ,fg-dim))) + `(ement-room-read-receipt-marker ((,c :background ,bg-search-static :foreground ,fg-main))) + `(ement-room-self ((,c :inherit modus-themes-bold :foreground ,accent-1))) `(ement-room-self-message ((,c :foreground ,fg-alt))) - `(ement-room-timestamp ((,c :inherit shadow))) - `(ement-room-timestamp-header ((,c :inherit bold :foreground ,date-common))) - `(ement-room-user ((,c :inherit bold :foreground ,accent-0))) + `(ement-room-timestamp ((,c :foreground ,fg-dim))) + `(ement-room-timestamp-header ((,c :inherit modus-themes-bold :foreground ,date-common))) + `(ement-room-user ((,c :inherit modus-themes-bold :foreground ,accent-0))) ;;;;; emms `(emms-browser-album-face ((,c :foreground ,keyword))) `(emms-browser-artist-face ((,c :foreground ,variable))) `(emms-browser-composer-face ((,c :foreground ,builtin))) - `(emms-browser-performer-face ((,c :inherit emms-browser-artist-face))) - `(emms-browser-track-face ((,c :inherit emms-playlist-track-face))) + `(emms-browser-performer-face ((,c :foreground ,variable))) + `(emms-browser-track-face ((,c :foreground ,string))) `(emms-browser-year/genre-face ((,c :foreground ,type))) `(emms-playlist-track-face ((,c :foreground ,string))) - `(emms-playlist-selected-face ((,c :inherit bold :foreground ,constant))) - `(emms-metaplaylist-mode-current-face ((,c :inherit emms-playlist-selected-face))) + `(emms-playlist-selected-face ((,c :inherit modus-themes-bold :foreground ,constant))) + `(emms-metaplaylist-mode-current-face ((,c :inherit modus-themes-bold :foreground ,constant))) `(emms-metaplaylist-mode-face ((,c :foreground ,variable))) -;;;;; enh-ruby-mode (enhanced-ruby-mode) - `(enh-ruby-heredoc-delimiter-face ((,c :inherit font-lock-constant-face))) - `(enh-ruby-op-face ((,c :foreground ,fg-main))) - `(enh-ruby-regexp-delimiter-face ((,c :inherit font-lock-regexp-grouping-construct))) - `(enh-ruby-regexp-face ((,c :inherit font-lock-string-face))) - `(enh-ruby-string-delimiter-face ((,c :inherit font-lock-string-face))) - `(erm-syn-errline ((,c :inherit modus-themes-lang-error))) - `(erm-syn-warnline ((,c :inherit modus-themes-lang-warning))) ;;;;; epa `(epa-field-body (( ))) - `(epa-field-name ((,c :inherit bold :foreground ,fg-dim))) - `(epa-mark ((,c :inherit bold))) + `(epa-field-name ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(epa-mark ((,c :inherit modus-themes-bold))) `(epa-string ((,c :foreground ,string))) `(epa-validity-disabled ((,c :foreground ,err))) - `(epa-validity-high ((,c :inherit success))) - `(epa-validity-low ((,c :inherit shadow))) + `(epa-validity-high ((,c :foreground ,info))) + `(epa-validity-low ((,c :foreground ,fg-dim))) `(epa-validity-medium ((,c :foreground ,info))) ;;;;; erc `(erc-action-face ((,c :foreground ,accent-2))) `(erc-bold-face ((,c :inherit bold))) - `(erc-button ((,c :inherit button))) - `(erc-command-indicator-face ((,c :inherit bold :foreground ,accent-3))) - `(erc-current-nick-face ((,c :inherit match))) - `(erc-dangerous-host-face ((,c :inherit error))) - `(erc-direct-msg-face ((,c :inherit shadow))) - `(erc-error-face ((,c :inherit error))) + `(erc-button ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(erc-command-indicator-face ((,c :inherit modus-themes-bold :foreground ,accent-3))) + `(erc-current-nick-face ((,c :background ,bg-search-static :foreground ,fg-main))) + `(erc-dangerous-host-face ((,c :foreground ,err))) + `(erc-direct-msg-face ((,c :foreground ,fg-dim))) + `(erc-error-face ((,c :foreground ,err))) `(erc-fill-wrap-merge-indicator-face ((,c :foreground ,fg-dim))) - `(erc-fool-face ((,c :inherit shadow))) + `(erc-fool-face ((,c :foreground ,fg-dim))) `(erc-input-face ((,c :foreground ,fnname))) `(erc-inverse-face ((,c :inherit erc-default-face :inverse-video t))) `(erc-keep-place-indicator-arrow ((,c :foreground ,info))) - `(erc-keyword-face ((,c :inherit bold :foreground ,keyword))) - `(erc-my-nick-face ((,c :inherit bold :foreground ,name))) - `(erc-my-nick-prefix-face ((,c :inherit erc-my-nick-face))) - `(erc-nick-default-face ((,c :inherit bold :foreground ,accent-0))) - `(erc-nick-msg-face ((,c :inherit warning))) + `(erc-keyword-face ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(erc-my-nick-face ((,c :inherit modus-themes-bold :foreground ,name))) + `(erc-my-nick-prefix-face ((,c :inherit modus-themes-bold :foreground ,name))) + `(erc-nick-default-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(erc-nick-msg-face ((,c :foreground ,warning))) `(erc-nick-prefix-face ((,c :inherit erc-nick-default-face))) - `(erc-notice-face ((,c :inherit font-lock-comment-face))) - `(erc-pal-face ((,c :inherit bold :foreground ,accent-1))) + `(erc-notice-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(erc-pal-face ((,c :inherit modus-themes-bold :foreground ,accent-1))) `(erc-prompt-face ((,c :inherit modus-themes-prompt))) `(erc-timestamp-face ((,c :foreground ,date-common))) - `(erc-underline-face ((,c :underline t))) + `(erc-underline-face ((,c :inherit underline))) ;;;;; ert - `(ert-test-result-expected ((,c :inherit modus-themes-prominent-note))) - `(ert-test-result-unexpected ((,c :inherit modus-themes-prominent-error))) + `(ert-test-result-expected ((,c :background ,bg-prominent-note :foreground ,fg-prominent-note))) + `(ert-test-result-unexpected ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) ;;;;; erts-mode - `(erts-mode-end-test ((,c :inherit error))) - `(erts-mode-specification-name ((,c :inherit bold))) + `(erts-mode-end-test ((,c :foreground ,err))) + `(erts-mode-specification-name ((,c :inherit modus-themes-bold))) `(erts-mode-specification-value ((,c :foreground ,string))) - `(erts-mode-start-test ((,c :inherit success))) + `(erts-mode-start-test ((,c :foreground ,info))) ;;;;; eshell `(eshell-ls-archive ((,c :foreground ,accent-2))) - `(eshell-ls-backup ((,c :inherit shadow))) - `(eshell-ls-clutter ((,c :inherit shadow))) + `(eshell-ls-backup ((,c :foreground ,fg-dim))) + `(eshell-ls-clutter ((,c :foreground ,fg-dim))) `(eshell-ls-directory ((,c :foreground ,accent-0))) `(eshell-ls-executable ((,c :foreground ,accent-1))) - `(eshell-ls-missing ((,c :inherit error))) - `(eshell-ls-product ((,c :inherit shadow))) + `(eshell-ls-missing ((,c :foreground ,err))) + `(eshell-ls-product ((,c :foreground ,fg-dim))) `(eshell-ls-readonly ((,c :foreground ,warning))) `(eshell-ls-special ((,c :foreground ,accent-3))) - `(eshell-ls-symlink ((,c :inherit link))) - `(eshell-ls-unreadable ((,c :inherit shadow))) + `(eshell-ls-symlink ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(eshell-ls-unreadable ((,c :foreground ,fg-dim))) `(eshell-prompt ((,c :inherit modus-themes-prompt))) ;;;;; eshell-fringe-status - `(eshell-fringe-status-failure ((,c :inherit error))) - `(eshell-fringe-status-success ((,c :inherit success))) + `(eshell-fringe-status-failure ((,c :foreground ,err))) + `(eshell-fringe-status-success ((,c :foreground ,info))) ;;;;; evil-mode - `(evil-ex-commands ((,c :inherit font-lock-keyword-face))) - `(evil-ex-info ((,c :inherit font-lock-type-face))) - `(evil-ex-lazy-highlight ((,c :inherit modus-themes-search-lazy))) - `(evil-ex-search ((,c :inherit modus-themes-search-current))) - `(evil-ex-substitute-matches ((,c :inherit modus-themes-search-replace))) - `(evil-ex-substitute-replacement ((,c :inherit modus-themes-search-current))) + `(evil-ex-commands ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(evil-ex-info ((,c :inherit modus-themes-bold :foreground ,type))) + `(evil-ex-lazy-highlight ((,c :background ,bg-search-lazy :foreground ,fg-main))) + `(evil-ex-search ((,c :background ,bg-search-current :foreground ,fg-main))) + `(evil-ex-substitute-matches ((,c :background ,bg-search-replace :foreground ,fg-main))) + `(evil-ex-substitute-replacement ((,c :background ,bg-search-current :foreground ,fg-main))) ;;;;; eww `(eww-invalid-certificate ((,c :foreground ,err))) `(eww-valid-certificate ((,c :foreground ,info))) - `(eww-form-checkbox ((,c :inherit eww-form-text))) - `(eww-form-file ((,c :inherit eww-form-submit))) - `(eww-form-select ((,c :inherit eww-form-submit))) + `(eww-form-checkbox ((,c :background ,bg-button-inactive :foreground ,fg-button-active))) + `(eww-form-file ((,c :inherit modus-themes-button))) + `(eww-form-select ((,c :inherit modus-themes-button))) `(eww-form-submit ((,c :inherit modus-themes-button))) - `(eww-form-text ((,c :inherit widget-field))) - `(eww-form-textarea ((,c :inherit eww-form-text))) + `(eww-form-text ((,c :background ,bg-button-inactive :foreground ,fg-button-active :extend nil :underline (:position t)))) + `(eww-form-textarea ((,c :background ,bg-button-inactive :foreground ,fg-button-active :extend nil :underline (:position t)))) ;;;;; eyebrowse - `(eyebrowse-mode-line-active ((,c :inherit mode-line-emphasis))) + `(eyebrowse-mode-line-active ((,c :inherit italic :foreground ,modeline-info))) ;;;;; flycheck - `(flycheck-error ((,c :inherit modus-themes-lang-error))) - `(flycheck-fringe-error ((,c :inherit modus-themes-prominent-error))) - `(flycheck-fringe-info ((,c :inherit modus-themes-prominent-note))) - `(flycheck-fringe-warning ((,c :inherit modus-themes-prominent-warning))) - `(flycheck-info ((,c :inherit modus-themes-lang-note))) - `(flycheck-warning ((,c :inherit modus-themes-lang-warning))) + `(flycheck-error ((,c :underline (:style wave :color ,underline-err)))) + `(flycheck-fringe-error ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) + `(flycheck-fringe-info ((,c :background ,bg-prominent-note :foreground ,fg-prominent-note))) + `(flycheck-fringe-warning ((,c :background ,bg-prominent-warning :foreground ,fg-prominent-warning))) + `(flycheck-info ((,c :underline (:style wave :color ,underline-note)))) + `(flycheck-warning ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; flycheck-color-mode-line - `(flycheck-color-mode-line-error-face ((,c :inherit flycheck-fringe-error))) - `(flycheck-color-mode-line-info-face ((,c :inherit flycheck-fringe-info))) - `(flycheck-color-mode-line-running-face ((,c :inherit italic))) - `(flycheck-color-mode-line-info-face ((,c :inherit flycheck-fringe-warning))) + `(flycheck-color-mode-line-error-face ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) + `(flycheck-color-mode-line-info-face ((,c :background ,bg-prominent-note :foreground ,fg-prominent-note))) + `(flycheck-color-mode-line-running-face ((,c :inherit modus-themes-slant))) + `(flycheck-color-mode-line-info-face ((,c :background ,bg-prominent-warning :foreground ,fg-prominent-warning))) ;;;;; flycheck-indicator `(flycheck-indicator-disabled ((,c :inherit modus-themes-slant :foreground ,fg-dim))) - `(flycheck-indicator-error ((,c :inherit error))) - `(flycheck-indicator-info ((,c :inherit bold))) + `(flycheck-indicator-error ((,c :foreground ,err))) + `(flycheck-indicator-info ((,c :inherit modus-themes-bold))) `(flycheck-indicator-running ((,c :inherit modus-themes-slant))) - `(flycheck-indicator-success ((,c :inherit success))) - `(flycheck-indicator-warning ((,c :inherit warning))) + `(flycheck-indicator-success ((,c :foreground ,info))) + `(flycheck-indicator-warning ((,c :foreground ,warning))) ;;;;; flymake `(flymake-end-of-line-diagnostics-face ((,c :inherit modus-themes-slant :height 0.85 :box ,border))) - `(flymake-error ((,c :inherit modus-themes-lang-error))) - `(flymake-error-echo ((,c :inherit error))) - `(flymake-error-echo-at-eol ((,c :inherit flymake-end-of-line-diagnostics-face :foreground ,err))) - `(flymake-note ((,c :inherit modus-themes-lang-note))) - `(flymake-note-echo ((,c :inherit success))) - `(flymake-note-echo-at-eol ((,c :inherit flymake-end-of-line-diagnostics-face :foreground ,info))) - `(flymake-warning ((,c :inherit modus-themes-lang-warning))) - `(flymake-warning-echo ((,c :inherit warning))) - `(flymake-note-echo-at-eol ((,c :inherit flymake-end-of-line-diagnostics-face :foreground ,warning))) + `(flymake-error ((,c :underline (:style wave :color ,underline-err)))) + `(flymake-error-echo ((,c :foreground ,err))) + `(flymake-error-echo-at-eol ((,c :inherit modus-themes-slant :foreground ,err :height 0.85 :box ,border))) + `(flymake-note ((,c :underline (:style wave :color ,underline-note)))) + `(flymake-note-echo ((,c :foreground ,info))) + `(flymake-note-echo-at-eol ((,c :inherit modus-themes-slant :foreground ,info :height 0.85 :box ,border))) + `(flymake-warning ((,c :underline (:style wave :color ,underline-warning)))) + `(flymake-warning-echo ((,c :foreground ,warning))) + `(flymake-warning-echo-at-eol ((,c :inherit modus-themes-slant :foreground ,warning :height 0.85 :box ,border))) ;;;;; flyspell - `(flyspell-duplicate ((,c :inherit modus-themes-lang-warning))) - `(flyspell-incorrect ((,c :inherit modus-themes-lang-error))) + `(flyspell-duplicate ((,c :underline (:style wave :color ,underline-warning)))) + `(flyspell-incorrect ((,c :underline (:style wave :color ,underline-err)))) ;;;;; flx `(flx-highlight-face ((,c :inherit modus-themes-completion-match-0))) ;;;;; focus @@ -2492,15 +5372,16 @@ FG and BG are the main colors." ;;;;; font-lock `(font-lock-bracket-face ((,c :foreground ,bracket))) `(font-lock-builtin-face ((,c :inherit modus-themes-bold :foreground ,builtin))) - `(font-lock-comment-delimiter-face ((,c :inherit font-lock-comment-face))) + `(font-lock-comment-delimiter-face ((,c :inherit modus-themes-slant :foreground ,comment))) `(font-lock-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) `(font-lock-constant-face ((,c :foreground ,constant))) `(font-lock-delimiter-face ((,c :foreground ,delimiter))) `(font-lock-doc-face ((,c :inherit modus-themes-slant :foreground ,docstring))) `(font-lock-doc-markup-face ((,c :inherit modus-themes-slant :foreground ,docmarkup))) + `(font-lock-function-call-face ((,c :foreground ,fnname-call))) `(font-lock-function-name-face ((,c :foreground ,fnname))) `(font-lock-keyword-face ((,c :inherit modus-themes-bold :foreground ,keyword))) - `(font-lock-negation-char-face ((,c :inherit error))) + `(font-lock-negation-char-face ((,c :foreground ,err))) `(font-lock-number-face ((,c :foreground ,number))) `(font-lock-operator-face ((,c :foreground ,operator))) `(font-lock-preprocessor-face ((,c :foreground ,preprocessor))) @@ -2511,141 +5392,142 @@ FG and BG are the main colors." `(font-lock-string-face ((,c :foreground ,string))) `(font-lock-type-face ((,c :inherit modus-themes-bold :foreground ,type))) `(font-lock-variable-name-face ((,c :foreground ,variable))) + `(font-lock-variable-use-face ((,c :foreground ,variable-use))) `(font-lock-warning-face ((,c :inherit modus-themes-bold :foreground ,warning))) ;;;;; forge - `(forge-dimmed ((,c :inherit shadow))) - `(forge-issue-completed ((,c :inherit shadow))) + `(forge-dimmed ((,c :foreground ,fg-dim))) + `(forge-issue-completed ((,c :foreground ,fg-dim))) `(forge-issue-open (( ))) - `(forge-issue-unplanned ((,c :inherit forge-dimmed :strike-through t))) - `(forge-post-author ((,c :inherit bold :foreground ,name))) - `(forge-post-date ((,c :inherit bold :foreground ,date-common))) + `(forge-issue-unplanned ((,c :foreground ,fg-dim :strike-through t))) + `(forge-post-author ((,c :inherit modus-themes-bold :foreground ,name))) + `(forge-post-date ((,c :inherit modus-themes-bold :foreground ,date-common))) `(forge-pullreq-merged ((,c :foreground ,fg-alt))) `(forge-pullreq-open ((,c :foreground ,info))) `(forge-pullreq-rejected ((,c :foreground ,err :strike-through t))) `(forge-topic-done (( ))) - `(forge-topic-pending ((,c :inherit italic))) - `(forge-topic-slug-completed ((,c :inherit forge-dimmed))) - `(forge-topic-slug-open ((,c :inherit forge-dimmed))) - `(forge-topic-slug-saved ((,c :inherit success))) - `(forge-topic-slug-unplanned ((,c :inherit forge-dimmed :strike-through t))) + `(forge-topic-pending ((,c :inherit modus-themes-slant))) + `(forge-topic-slug-completed ((,c :foreground ,fg-dim))) + `(forge-topic-slug-open ((,c :foreground ,fg-dim))) + `(forge-topic-slug-saved ((,c :foreground ,info))) + `(forge-topic-slug-unplanned ((,c :foreground ,fg-dim :strike-through t))) `(forge-topic-unread ((,c :inherit bold))) ;;;;; geiser - `(geiser-font-lock-autodoc-current-arg ((,c :inherit bold :background ,bg-active-argument :foreground ,fg-active-argument))) + `(geiser-font-lock-autodoc-current-arg ((,c :inherit modus-themes-bold :background ,bg-active-argument :foreground ,fg-active-argument))) `(geiser-font-lock-autodoc-identifier ((,c :foreground ,docstring))) - `(geiser-font-lock-doc-button ((,c :inherit button))) - `(geiser-font-lock-doc-link ((,c :inherit button))) - `(geiser-font-lock-error-link ((,c :inherit button :foreground ,err))) - `(geiser-font-lock-image-button ((,c :inherit button :foreground ,info))) - `(geiser-font-lock-repl-input ((,c :inherit bold))) - `(geiser-font-lock-repl-output ((,c :inherit font-lock-keyword-face))) + `(geiser-font-lock-doc-button ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(geiser-font-lock-doc-link ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(geiser-font-lock-error-link ((,c :foreground ,err :underline t))) + `(geiser-font-lock-image-button ((,c :foreground ,info :underline t))) + `(geiser-font-lock-repl-input ((,c :inherit modus-themes-bold))) + `(geiser-font-lock-repl-output ((,c :inherit modus-themes-bold :foreground ,keyword))) `(geiser-font-lock-repl-prompt ((,c :inherit modus-themes-prompt))) - `(geiser-font-lock-xref-header ((,c :inherit bold))) - `(geiser-font-lock-xref-link ((,c :inherit button))) + `(geiser-font-lock-xref-header ((,c :inherit modus-themes-bold))) + `(geiser-font-lock-xref-link ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) ;;;;; git-commit - `(git-commit-comment-action ((,c :inherit font-lock-comment-face))) - `(git-commit-comment-branch-local ((,c :inherit (bold font-lock-comment-face) :foreground ,accent-0))) - `(git-commit-comment-branch-remote ((,c :inherit (bold font-lock-comment-face) :foreground ,accent-1))) - `(git-commit-comment-heading ((,c :inherit (bold font-lock-comment-face)))) - `(git-commit-comment-file ((,c :inherit font-lock-comment-face :foreground ,accent-2))) ; like `magit-filename' + `(git-commit-comment-action ((,c :inherit modus-themes-slant :foreground ,comment))) + `(git-commit-comment-branch-local ((,c :inherit modus-themes-slant :foreground ,accent-0))) + `(git-commit-comment-branch-remote ((,c :inherit modus-themes-slant :foreground ,accent-1))) + `(git-commit-comment-heading ((,c :inherit (modus-themes-bold modus-themes-slant) :foreground ,comment))) + `(git-commit-comment-file ((,c :inherit modus-themes-slant :foreground ,accent-2))) ; like `magit-filename' `(git-commit-keyword ((,c :foreground ,keyword))) - `(git-commit-nonempty-second-line ((,c :inherit error))) - `(git-commit-overlong-summary ((,c :inherit warning))) - `(git-commit-summary ((,c :inherit success))) + `(git-commit-nonempty-second-line ((,c :foreground ,err))) + `(git-commit-overlong-summary ((,c :foreground ,warning))) + `(git-commit-summary ((,c :inherit modus-themes-bold :foreground ,fg-alt))) ;;;;; git-gutter `(git-gutter:added ((,c :background ,bg-added-fringe))) `(git-gutter:deleted ((,c :background ,bg-removed-fringe))) `(git-gutter:modified ((,c :background ,bg-changed-fringe))) - `(git-gutter:separator ((,c :inherit modus-themes-intense-cyan))) - `(git-gutter:unchanged ((,c :inherit modus-themes-intense-magenta))) + `(git-gutter:separator (( ))) + `(git-gutter:unchanged (( ))) ;;;;; git-gutter-fr `(git-gutter-fr:added ((,c :background ,bg-added-fringe))) `(git-gutter-fr:deleted ((,c :background ,bg-removed-fringe))) `(git-gutter-fr:modified ((,c :background ,bg-changed-fringe))) ;;;;; git-rebase - `(git-rebase-comment-hash ((,c :inherit (bold font-lock-comment-face) :foreground ,identifier))) - `(git-rebase-comment-heading ((,c :inherit (bold font-lock-comment-face)))) + `(git-rebase-comment-hash ((,c :inherit (modus-themes-bold modus-themes-slant) :foreground ,identifier))) + `(git-rebase-comment-heading ((,c :inherit (modus-themes-bold modus-themes-slant) :foreground ,comment))) `(git-rebase-description ((,c :foreground ,fg-main))) `(git-rebase-hash ((,c :foreground ,identifier))) ;;;;; git-timemachine - `(git-timemachine-commit ((,c :inherit warning))) + `(git-timemachine-commit ((,c :foreground ,warning))) `(git-timemachine-minibuffer-author-face ((,c :foreground ,name))) `(git-timemachine-minibuffer-detail-face ((,c :foreground ,fg-main))) ;;;;; gnus - `(gnus-button ((,c :inherit button :underline nil))) - `(gnus-cite-1 ((,c :inherit message-cited-text-1))) - `(gnus-cite-2 ((,c :inherit message-cited-text-2))) - `(gnus-cite-3 ((,c :inherit message-cited-text-3))) - `(gnus-cite-4 ((,c :inherit message-cited-text-4))) - `(gnus-cite-5 ((,c :inherit message-cited-text-1))) - `(gnus-cite-6 ((,c :inherit message-cited-text-2))) - `(gnus-cite-7 ((,c :inherit message-cited-text-3))) - `(gnus-cite-8 ((,c :inherit message-cited-text-4))) - `(gnus-cite-9 ((,c :inherit message-cited-text-1))) - `(gnus-cite-10 ((,c :inherit message-cited-text-2))) - `(gnus-cite-11 ((,c :inherit message-cited-text-3))) - `(gnus-cite-attribution ((,c :inherit italic))) - `(gnus-emphasis-bold ((,c :inherit bold))) + `(gnus-button ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(gnus-cite-1 ((,c :foreground ,mail-cite-0))) + `(gnus-cite-2 ((,c :foreground ,mail-cite-1))) + `(gnus-cite-3 ((,c :foreground ,mail-cite-2))) + `(gnus-cite-4 ((,c :foreground ,mail-cite-3))) + `(gnus-cite-5 ((,c :foreground ,mail-cite-0))) + `(gnus-cite-6 ((,c :foreground ,mail-cite-1))) + `(gnus-cite-7 ((,c :foreground ,mail-cite-2))) + `(gnus-cite-8 ((,c :foreground ,mail-cite-3))) + `(gnus-cite-9 ((,c :foreground ,mail-cite-0))) + `(gnus-cite-10 ((,c :foreground ,mail-cite-1))) + `(gnus-cite-11 ((,c :foreground ,mail-cite-2))) + `(gnus-cite-attribution ((,c :inherit modus-themes-slant))) + `(gnus-emphasis-bold ((,c :inherit modus-themes-bold))) `(gnus-emphasis-bold-italic ((,c :inherit bold-italic))) - `(gnus-emphasis-highlight-words ((,c :inherit warning))) + `(gnus-emphasis-highlight-words ((,c :foreground ,warning))) `(gnus-emphasis-italic ((,c :inherit italic))) `(gnus-emphasis-underline-bold ((,c :inherit gnus-emphasis-bold :underline t))) `(gnus-emphasis-underline-bold-italic ((,c :inherit gnus-emphasis-bold-italic :underline t))) `(gnus-emphasis-underline-italic ((,c :inherit gnus-emphasis-italic :underline t))) - `(gnus-group-mail-1 ((,c :inherit (bold gnus-group-mail-1-empty)))) + `(gnus-group-mail-1 ((,c :inherit bold :foreground ,magenta-warmer))) `(gnus-group-mail-1-empty ((,c :foreground ,magenta-warmer))) - `(gnus-group-mail-2 ((,c :inherit (bold gnus-group-mail-2-empty)))) + `(gnus-group-mail-2 ((,c :inherit modus-themes-bold :foreground ,magenta-warmer))) `(gnus-group-mail-2-empty ((,c :foreground ,magenta))) - `(gnus-group-mail-3 ((,c :inherit (bold gnus-group-mail-3-empty)))) + `(gnus-group-mail-3 ((,c :inherit modus-themes-bold :foreground ,magenta))) `(gnus-group-mail-3-empty ((,c :foreground ,magenta-cooler))) - `(gnus-group-mail-low ((,c :inherit (bold gnus-group-mail-low-empty)))) + `(gnus-group-mail-low ((,c :inherit modus-themes-bold :foreground ,magenta-cooler))) `(gnus-group-mail-low-empty ((,c :foreground ,fg-dim))) - `(gnus-group-news-1 ((,c :inherit (bold gnus-group-news-1-empty)))) + `(gnus-group-news-1 ((,c :inherit modus-themes-bold :foreground ,green))) `(gnus-group-news-1-empty ((,c :foreground ,green))) - `(gnus-group-news-2 ((,c :inherit (bold gnus-group-news-2-empty)))) + `(gnus-group-news-2 ((,c :inherit modus-themes-bold :foreground ,cyan))) `(gnus-group-news-2-empty ((,c :foreground ,cyan))) - `(gnus-group-news-3 ((,c :inherit (bold gnus-group-news-3-empty)))) + `(gnus-group-news-3 ((,c :inherit modus-themes-bold :foreground ,yellow-faint))) `(gnus-group-news-3-empty ((,c :foreground ,yellow-faint))) - `(gnus-group-news-4 ((,c :inherit (bold gnus-group-news-4-empty)))) + `(gnus-group-news-4 ((,c :inherit modus-themes-bold :foreground ,magenta-faint))) `(gnus-group-news-4-empty ((,c :foreground ,magenta-faint))) - `(gnus-group-news-5 ((,c :inherit (bold gnus-group-news-5-empty)))) + `(gnus-group-news-5 ((,c :inherit modus-themes-bold :foreground ,fg-alt))) `(gnus-group-news-5-empty ((,c :foreground ,fg-alt))) - `(gnus-group-news-6 ((,c :inherit (bold gnus-group-news-6-empty)))) + `(gnus-group-news-6 ((,c :inherit modus-themes-bold :foreground ,fg-dim))) `(gnus-group-news-6-empty ((,c :foreground ,fg-dim))) - `(gnus-group-news-low ((,c :inherit (bold gnus-group-news-low-empty)))) + `(gnus-group-news-low ((,c :inherit modus-themes-bold :foreground ,fg-dim))) `(gnus-group-news-low-empty ((,c :foreground ,fg-dim))) - `(gnus-header-content ((,c :inherit message-header-other))) - `(gnus-header-from ((,c :inherit message-header-to :underline nil))) - `(gnus-header-name ((,c :inherit message-header-name))) - `(gnus-header-newsgroups ((,c :inherit message-header-newsgroups))) - `(gnus-header-subject ((,c :inherit message-header-subject))) - `(gnus-server-agent ((,c :inherit bold))) - `(gnus-server-closed ((,c :inherit italic))) - `(gnus-server-cloud ((,c :inherit bold :foreground ,fg-alt))) - `(gnus-server-cloud-host ((,c :inherit bold :foreground ,fg-alt :underline t))) - `(gnus-server-denied ((,c :inherit error))) - `(gnus-server-offline ((,c :inherit shadow))) - `(gnus-server-opened ((,c :inherit success))) - `(gnus-summary-cancelled ((,c :inherit italic :foreground ,warning))) - `(gnus-summary-high-ancient ((,c :inherit bold :foreground ,fg-alt))) - `(gnus-summary-high-read ((,c :inherit bold :foreground ,fg-dim))) - `(gnus-summary-high-ticked ((,c :inherit bold :foreground ,err))) - `(gnus-summary-high-undownloaded ((,c :inherit bold-italic :foreground ,warning))) + `(gnus-header-content ((,c :foreground ,mail-other))) + `(gnus-header-from ((,c :inherit modus-themes-bold :foreground ,mail-recipient))) + `(gnus-header-name ((,c :inherit modus-themes-bold))) + `(gnus-header-newsgroups ((,c :foreground ,mail-other))) + `(gnus-header-subject ((,c :inherit modus-themes-bold :foreground ,mail-subject))) + `(gnus-server-agent ((,c :inherit modus-themes-bold))) + `(gnus-server-closed ((,c :inherit modus-themes-slant))) + `(gnus-server-cloud ((,c :inherit modus-themes-bold :foreground ,fg-alt))) + `(gnus-server-cloud-host ((,c :inherit modus-themes-bold :foreground ,fg-alt :underline t))) + `(gnus-server-denied ((,c :foreground ,err))) + `(gnus-server-offline ((,c :foreground ,fg-dim))) + `(gnus-server-opened ((,c :foreground ,info))) + `(gnus-summary-cancelled ((,c :inherit modus-themes-slant :foreground ,warning))) + `(gnus-summary-high-ancient ((,c :inherit modus-themes-bold :foreground ,fg-alt))) + `(gnus-summary-high-read ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(gnus-summary-high-ticked ((,c :inherit modus-themes-bold :foreground ,err))) + `(gnus-summary-high-undownloaded ((,c :inherit modus-themes-bold :foreground ,warning))) `(gnus-summary-high-unread ((,c :inherit bold))) - `(gnus-summary-low-ancient ((,c :inherit italic))) - `(gnus-summary-low-read ((,c :inherit (shadow italic)))) - `(gnus-summary-low-ticked ((,c :inherit italic :foreground ,err))) - `(gnus-summary-low-undownloaded ((,c :inherit italic :foreground ,warning))) - `(gnus-summary-low-unread ((,c :inherit italic))) - `(gnus-summary-normal-ancient ((,c :inherit shadow))) - `(gnus-summary-normal-read ((,c :inherit shadow))) + `(gnus-summary-low-ancient ((,c :inherit modus-themes-slant))) + `(gnus-summary-low-read ((,c :inherit modus-themes-slant :foreground ,fg-dim))) + `(gnus-summary-low-ticked ((,c :inherit modus-themes-slant :foreground ,err))) + `(gnus-summary-low-undownloaded ((,c :inherit modus-themes-slant :foreground ,warning))) + `(gnus-summary-low-unread ((,c :inherit modus-themes-slant))) + `(gnus-summary-normal-ancient ((,c :foreground ,fg-dim))) + `(gnus-summary-normal-read ((,c :foreground ,fg-dim))) `(gnus-summary-normal-ticked ((,c :foreground ,err))) `(gnus-summary-normal-undownloaded ((,c :foreground ,warning))) `(gnus-summary-normal-unread (( ))) - `(gnus-summary-selected ((,c :inherit highlight))) + `(gnus-summary-selected ((,c :background ,bg-hover :foreground ,fg-main))) ;;;;; gotest - `(go-test--ok-face ((,c :inherit success))) - `(go-test--error-face ((,c :inherit error))) - `(go-test--warning-face ((,c :inherit warning))) + `(go-test--ok-face ((,c :foreground ,info))) + `(go-test--error-face ((,c :foreground ,err))) + `(go-test--warning-face ((,c :foreground ,warning))) `(go-test--pointer-face ((,c :foreground ,accent-0))) `(go-test--standard-face (( ))) ;;;;; golden-ratio-scroll-screen @@ -2655,77 +5537,50 @@ FG and BG are the main colors." ;;;;; hexl-mode `(hexl-address-region ((,c :foreground ,constant))) `(hexl-ascii-region ((,c :foreground ,variable))) +;;;;; hideshow + `(hs-ellipsis (( ))) ;;;;; highlight region or ad-hoc regexp - ;; HACK 2022-06-23: The :inverse-video prevents hl-line-mode from - ;; overriding the background. Such an override really defeats the - ;; purpose of setting those highlights. - ;; - ;; NOTE 2022-10-04: We do not use the ,c here but instead - ;; hardcode color values. We have to do this as the themes lack - ;; entries in their palette for such an edge case. Defining those - ;; entries is not appropriate. - `(hi-aquamarine ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#227f9f" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#66cbdc" :inverse-video t))) - `(hi-black-b ((,c :inverse-video t))) - `(hi-black-hb ((,c :background ,bg-main :foreground ,fg-dim :inverse-video t))) - `(hi-blue ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#3366dd" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#aaccff" :inverse-video t))) - `(hi-blue-b ((,c :inherit (bold hi-blue)))) - `(hi-green ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#008a00" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#66dd66" :inverse-video t))) - `(hi-green-b ((,c :inherit (bold hi-green)))) - `(hi-pink ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#bd30aa" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#ff88ee" :inverse-video t))) - `(hi-red-b ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#dd0000" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#f06666" :inverse-video t))) - `(hi-salmon ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#bf555a" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#e08a50" :inverse-video t))) - `(hi-yellow ((((class color) (min-colors 88) (background light)) - :background "#ffffff" :foreground "#af6400" :inverse-video t) - (((class color) (min-colors 88) (background dark)) - :background "#000000" :foreground "#faea00" :inverse-video t))) + `(hi-aquamarine ((,c :background ,bg-cyan-intense :foreground ,fg-main))) + `(hi-black-b ((,c :background ,fg-main :foreground ,bg-main))) + `(hi-black-hb ((,c :background ,fg-alt :foreground ,bg-main))) + `(hi-blue ((,c :background ,bg-blue-subtle :foreground ,fg-main))) + `(hi-blue-b ((,c :background ,bg-blue-intense :foreground ,fg-main))) + `(hi-green ((,c :background ,bg-green-subtle :foreground ,fg-main))) + `(hi-green-b ((,c :background ,bg-green-intense :foreground ,fg-main))) + `(hi-pink ((,c :background ,bg-magenta-intense :foreground ,fg-main))) + `(hi-red-b ((,c :background ,bg-red-intense :foreground ,fg-main))) + `(hi-salmon ((,c :background ,bg-clay :foreground ,fg-clay))) + `(hi-yellow ((,c :background ,bg-yellow-intense :foreground ,fg-main))) `(highlight-changes ((,c :foreground ,warning :underline nil))) `(highlight-changes-delete ((,c :foreground ,err :underline t))) `(hl-line ((,c :background ,bg-hl-line :extend t))) ;;;;; highlight-numbers `(highlight-numbers-number ((,c :foreground ,constant))) ;;;;; highlight-thing - `(highlight-thing ((,c :inherit match))) + `(highlight-thing ((,c :background ,bg-search-static :foreground ,fg-main))) ;;;;; hl-fill-column `(hl-fill-column-face ((,c :background ,bg-active))) ;;;;; hl-todo - `(hl-todo ((,c :inherit (bold font-lock-comment-face) :foreground ,err))) + `(hl-todo ((,c :inherit modus-themes-slant :foreground ,prose-todo))) ;;;;; howm - `(action-lock-face ((,c :inherit button))) + `(action-lock-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(howm-mode-keyword-face (( ))) - `(howm-mode-ref-face ((,c :inherit link))) + `(howm-mode-ref-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(howm-mode-title-face ((,c :inherit modus-themes-heading-0))) - `(howm-mode-wiki-face ((,c :inherit link))) + `(howm-mode-wiki-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(howm-reminder-deadline-face ((,c :foreground ,date-deadline))) - `(howm-reminder-late-deadline-face ((,c :inherit bold :foreground ,date-deadline))) + `(howm-reminder-late-deadline-face ((,c :inherit modus-themes-bold :foreground ,date-deadline))) `(howm-reminder-defer-face ((,c :foreground ,date-scheduled))) `(howm-reminder-scheduled-face ((,c :foreground ,date-scheduled))) `(howm-reminder-done-face ((,c :foreground ,prose-done))) `(howm-reminder-todo-face ((,c :foreground ,prose-todo))) `(howm-reminder-normal-face ((,c :foreground ,date-common))) - `(howm-reminder-today-face ((,c :inherit bold :foreground ,date-common))) - `(howm-reminder-tomorrow-face ((,c :inherit bold :foreground ,date-scheduled))) - `(howm-simulate-todo-mode-line-face ((,c :inherit bold))) + `(howm-reminder-today-face ((,c :inherit modus-themes-bold :foreground ,date-common))) + `(howm-reminder-tomorrow-face ((,c :inherit modus-themes-bold :foreground ,date-scheduled))) + `(howm-simulate-todo-mode-line-face ((,c :inherit modus-themes-bold))) `(howm-view-empty-face (( ))) - `(howm-view-hilit-face ((,c :inherit match))) - `(howm-view-name-face ((,c :inherit bold))) + `(howm-view-hilit-face ((,c :background ,bg-search-static :foreground ,fg-main))) + `(howm-view-name-face ((,c :inherit modus-themes-bold))) `(iigrep-counts-face1 ((,c :foreground ,rainbow-1))) `(iigrep-counts-face2 ((,c :foreground ,rainbow-2))) `(iigrep-counts-face3 ((,c :foreground ,rainbow-3))) @@ -2741,119 +5596,111 @@ FG and BG are the main colors." `(hbut-item-face ((,c :foreground ,info))) `(hbut-face ((,c :inherit modus-themes-button))) `(hbut-flash ((,c :background ,bg-search-replace))) - `(ibut-face ((,c :inherit button :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) + `(ibut-face ((,c :background ,bg-link-symbolic :foreground ,fg-link-symbolic :underline ,underline-link-symbolic))) ;;;;; icomplete `(icomplete-first-match ((,c :inherit modus-themes-completion-match-0))) - `(icomplete-vertical-selected-prefix-indicator-face ((,c :inherit bold :foreground ,keybind))) - `(icomplete-vertical-unselected-prefix-indicator-face ((,c :inherit shadow))) + `(icomplete-vertical-selected-prefix-indicator-face ((,c :inherit modus-themes-bold :foreground ,keybind))) + `(icomplete-vertical-unselected-prefix-indicator-face ((,c :foreground ,fg-dim))) `(icomplete-selected-match ((,c :inherit modus-themes-completion-selected))) ;;;;; ido-mode `(ido-first-match ((,c :inherit modus-themes-completion-match-0))) - `(ido-incomplete-regexp ((,c :inherit error))) - `(ido-indicator ((,c :inherit bold))) - `(ido-only-match ((,c :inherit ido-first-match))) + `(ido-incomplete-regexp ((,c :foreground ,err))) + `(ido-indicator ((,c :inherit modus-themes-bold))) + `(ido-only-match ((,c :inherit modus-themes-completion-match-0))) `(ido-subdir ((,c :foreground ,keyword))) `(ido-virtual ((,c :foreground ,warning))) ;;;;; iedit - `(iedit-occurrence ((,c :inherit modus-themes-search-lazy))) - `(iedit-read-only-occurrence ((,c :inherit modus-themes-search-current))) + `(iedit-occurrence ((,c :background ,bg-search-lazy :foreground ,fg-main))) + `(iedit-read-only-occurrence ((,c :background ,bg-search-current :foreground ,fg-main))) ;;;;; iflipb - `(iflipb-current-buffer-face ((,c :inherit bold :foreground ,name))) - `(iflipb-other-buffer-face ((,c :inherit shadow))) + `(iflipb-current-buffer-face ((,c :inherit modus-themes-bold :foreground ,name))) + `(iflipb-other-buffer-face ((,c :foreground ,fg-dim))) ;;;;; image-dired - `(image-dired-thumb-flagged ((,c :inherit modus-themes-mark-del :box (:line-width -3)))) - `(image-dired-thumb-header-file-name ((,c :inherit bold))) + `(image-dired-thumb-flagged ((,c :background ,bg-mark-delete :foreground ,fg-mark-delete :box (:line-width -3)))) + `(image-dired-thumb-header-file-name ((,c :inherit modus-themes-bold))) `(image-dired-thumb-header-file-size ((,c :foreground ,constant))) - `(image-dired-thumb-mark ((,c :inherit modus-themes-mark-sel :box (:line-width -3)))) + `(image-dired-thumb-mark ((,c :background ,bg-mark-select :foreground ,fg-mark-select :box (:line-width -3)))) ;;;;; imenu-list `(imenu-list-entry-face-0 ((,c :foreground ,fg-heading-1))) `(imenu-list-entry-face-1 ((,c :foreground ,fg-heading-2))) `(imenu-list-entry-face-2 ((,c :foreground ,fg-heading-3))) `(imenu-list-entry-face-3 ((,c :foreground ,fg-heading-4))) - `(imenu-list-entry-subalist-face-0 ((,c :inherit bold :foreground ,fg-heading-1 :underline t))) - `(imenu-list-entry-subalist-face-1 ((,c :inherit bold :foreground ,fg-heading-2 :underline t))) - `(imenu-list-entry-subalist-face-2 ((,c :inherit bold :foreground ,fg-heading-3 :underline t))) - `(imenu-list-entry-subalist-face-3 ((,c :inherit bold :foreground ,fg-heading-4 :underline t))) -;;;;; indium - `(indium-breakpoint-face ((,c :foreground ,err))) - `(indium-frame-url-face ((,c :inherit (shadow button)))) - `(indium-keyword-face ((,c :inherit font-lock-keyword-face))) - `(indium-litable-face ((,c :inherit modus-themes-slant))) - `(indium-repl-error-face ((,c :inherit error))) - `(indium-repl-prompt-face ((,c :inherit modus-themes-prompt))) - `(indium-repl-stdout-face (( ))) + `(imenu-list-entry-subalist-face-0 ((,c :inherit modus-themes-bold :foreground ,fg-heading-1 :underline t))) + `(imenu-list-entry-subalist-face-1 ((,c :inherit modus-themes-bold :foreground ,fg-heading-2 :underline t))) + `(imenu-list-entry-subalist-face-2 ((,c :inherit modus-themes-bold :foreground ,fg-heading-3 :underline t))) + `(imenu-list-entry-subalist-face-3 ((,c :inherit modus-themes-bold :foreground ,fg-heading-4 :underline t))) ;;;;; info - `(Info-quoted ((,c :inherit modus-themes-prose-verbatim))) ; the capitalization is canonical - `(info-header-node ((,c :inherit (shadow bold)))) + `(Info-quoted ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) ; the capitalization is canonical + `(info-header-node ((,c :inherit modus-themes-bold :foreground ,fg-dim))) `(info-header-xref ((,c :foreground ,fg-link))) - `(info-index-match ((,c :inherit match))) - `(info-menu-header ((,c :inherit bold))) - `(info-menu-star ((,c :inherit error))) - `(info-node ((,c :inherit bold))) + `(info-index-match ((,c :background ,bg-search-static :foreground ,fg-main))) + `(info-menu-header ((,c :inherit modus-themes-heading-5))) + `(info-menu-star ((,c :foreground ,err))) + `(info-node ((,c :inherit modus-themes-bold))) `(info-title-1 ((,c :inherit modus-themes-heading-1))) `(info-title-2 ((,c :inherit modus-themes-heading-2))) `(info-title-3 ((,c :inherit modus-themes-heading-3))) `(info-title-4 ((,c :inherit modus-themes-heading-4))) ;;;;; info+ (info-plus) - `(info-command-ref-item ((,c :inherit font-lock-function-name-face))) - `(info-constant-ref-item ((,c :inherit font-lock-constant-face))) - `(info-custom-delimited ((,c :inherit modus-themes-prose-verbatim))) - `(info-double-quoted-name ((,c :inherit font-lock-string-face))) + `(info-command-ref-item ((,c :foreground ,fnname))) + `(info-constant-ref-item ((,c :foreground ,constant))) + `(info-custom-delimited ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(info-double-quoted-name ((,c :foreground ,string))) `(info-file (( ))) - `(info-function-ref-item ((,c :inherit font-lock-function-name-face))) + `(info-function-ref-item ((,c :foreground ,fnname))) `(info-glossary-word ((,c :inherit modus-themes-button))) `(info-indented-text (( ))) `(info-isolated-backquote (( ))) `(info-isolated-quote (( ))) - `(info-macro-ref-item ((,c :inherit font-lock-keyword-face))) - `(info-menu ((,c :inherit bold))) - `(info-quoted-name ((,c :inherit modus-themes-prose-verbatim))) - `(info-reference-item ((,c :inherit bold))) - `(info-special-form-ref-item ((,c :inherit warning))) - `(info-string ((,c :inherit font-lock-string-face))) - `(info-syntax-class-item ((,c :inherit modus-themes-prose-code))) - `(info-user-option-ref-item ((,c :inherit font-lock-variable-name-face))) - `(info-variable-ref-item ((,c :inherit font-lock-variable-name-face))) + `(info-macro-ref-item ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(info-menu ((,c :inherit modus-themes-bold))) + `(info-quoted-name ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(info-reference-item ((,c :inherit modus-themes-bold))) + `(info-special-form-ref-item ((,c :foreground ,warning))) + `(info-string ((,c :foreground ,string))) + `(info-syntax-class-item ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) + `(info-user-option-ref-item ((,c :foreground ,variable))) + `(info-variable-ref-item ((,c :foreground ,variable))) ;;;;; info-colors `(info-colors-lisp-code-block ((,c :inherit modus-themes-fixed-pitch))) - `(info-colors-ref-item-command ((,c :inherit font-lock-function-name-face))) - `(info-colors-ref-item-constant ((,c :inherit font-lock-constant-face))) - `(info-colors-ref-item-function ((,c :inherit font-lock-function-name-face))) - `(info-colors-ref-item-macro ((,c :inherit font-lock-keyword-face))) - `(info-colors-ref-item-other ((,c :inherit font-lock-doc-face))) - `(info-colors-ref-item-special-form ((,c :inherit font-lock-keyword-face))) - `(info-colors-ref-item-syntax-class ((,c :inherit font-lock-builtin-face))) - `(info-colors-ref-item-type ((,c :inherit font-lock-type-face))) - `(info-colors-ref-item-user-option ((,c :inherit font-lock-variable-name-face))) - `(info-colors-ref-item-variable ((,c :inherit font-lock-variable-name-face))) + `(info-colors-ref-item-command ((,c :foreground ,fnname))) + `(info-colors-ref-item-constant ((,c :foreground ,constant))) + `(info-colors-ref-item-function ((,c :foreground ,fnname))) + `(info-colors-ref-item-macro ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(info-colors-ref-item-other ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(info-colors-ref-item-special-form ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(info-colors-ref-item-syntax-class ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(info-colors-ref-item-type ((,c :inherit modus-themes-bold :foreground ,type))) + `(info-colors-ref-item-user-option ((,c :foreground ,variable))) + `(info-colors-ref-item-variable ((,c :foreground ,variable))) ;;;;; ioccur `(ioccur-cursor ((,c :foreground ,fg-main))) - `(ioccur-invalid-regexp ((,c :inherit error))) - `(ioccur-match-face ((,c :inherit match))) + `(ioccur-invalid-regexp ((,c :foreground ,err))) + `(ioccur-match-face ((,c :background ,bg-search-static :foreground ,fg-main))) `(ioccur-match-overlay-face ((,c :background ,bg-inactive :extend t))) - `(ioccur-num-line-face ((,c :inherit shadow))) + `(ioccur-num-line-face ((,c :foreground ,fg-dim))) `(ioccur-overlay-face ((,c :background ,bg-hl-line :extend t))) - `(ioccur-regexp-face ((,c :inherit (modus-themes-search-current bold)))) - `(ioccur-title-face ((,c :inherit bold :foreground ,name))) + `(ioccur-regexp-face ((,c :background ,bg-search-current :foreground ,fg-main))) + `(ioccur-title-face ((,c :inherit modus-themes-bold :foreground ,name))) ;;;;; isearch, occur, and the like - `(isearch ((,c :inherit modus-themes-search-current))) - `(isearch-fail ((,c :inherit modus-themes-prominent-error))) - `(isearch-group-1 ((,c :inherit modus-themes-search-rx-group-0))) - `(isearch-group-2 ((,c :inherit modus-themes-search-rx-group-1))) - `(lazy-highlight ((,c :inherit modus-themes-search-lazy))) - `(match ((,c :background ,bg-magenta-subtle :foreground ,fg-main))) - `(query-replace ((,c :inherit modus-themes-search-replace))) + `(isearch ((,c :background ,bg-search-current :foreground ,fg-main))) + `(isearch-fail ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) + `(isearch-group-1 ((,c :background ,bg-search-rx-group-0 :foreground ,fg-main))) + `(isearch-group-2 ((,c :background ,bg-search-rx-group-1 :foreground ,fg-main))) + `(lazy-highlight ((,c :background ,bg-search-lazy :foreground ,fg-main))) + `(match ((,c :background ,bg-search-static :foreground ,fg-main))) + `(query-replace ((,c :background ,bg-search-replace :foreground ,fg-main))) ;;;;; ivy - `(ivy-action ((,c :inherit modus-themes-key-binding))) - `(ivy-confirm-face ((,c :inherit success))) + `(ivy-action ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(ivy-confirm-face ((,c :foreground ,info))) `(ivy-current-match ((,c :inherit modus-themes-completion-selected))) - `(ivy-match-required-face ((,c :inherit error))) + `(ivy-match-required-face ((,c :foreground ,err))) `(ivy-minibuffer-match-face-1 (( ))) `(ivy-minibuffer-match-face-2 ((,c :inherit modus-themes-completion-match-0))) `(ivy-minibuffer-match-face-3 ((,c :inherit modus-themes-completion-match-1))) `(ivy-minibuffer-match-face-4 ((,c :inherit modus-themes-completion-match-2))) - `(ivy-remote ((,c :inherit italic))) - `(ivy-separator ((,c :inherit shadow))) + `(ivy-remote ((,c :inherit modus-themes-slant))) + `(ivy-separator ((,c :foreground ,fg-dim))) `(ivy-subdir ((,c :foreground ,keyword))) `(ivy-virtual ((,c :foreground ,warning))) ;;;;; ivy-posframe @@ -2861,86 +5708,86 @@ FG and BG are the main colors." `(ivy-posframe-cursor ((,c :background ,fg-main :foreground ,bg-main))) ;;;;; jabber `(jabber-activity-face ((,c :foreground ,modeline-info))) - `(jabber-roster-user-away ((,c :foreground ,red-faint))) - `(jabber-roster-user-xa ((,c :foreground ,magenta :italic t))) - `(jabber-roster-user-dnd ((,c :foreground ,red :bold t))) - `(jabber-roster-user-chatty ((,c :foreground ,cyan-intense))) - `(jabber-roster-user-error ((,c :inherit error))) - `(jabber-roster-user-offline ((,c :foreground ,fg-dim :italic t))) - `(jabber-roster-user-online ((,c :foreground ,cyan :weight bold))) - `(jabber-chat-prompt-foreign ((,c :foreground ,red :weight bold))) - `(jabber-chat-prompt-system ((,c :foreground ,green))) - `(jabber-chat-prompt-local ((,c :foreground ,cyan))) - `(jabber-chat-error ((,c :inherit error))) - `(jabber-activity-personal-face ((,c :foreground ,blue-intense))) - `(jabber-rare-time-face ((,c :foreground ,green-faint :underline t))) - `(jabber-title-small ((,c :weight bold :height 1.0 :foreground ,fg-heading-3))) - `(jabber-title-medium ((,c :weight bold :width expanded :height 2.0 :foreground ,fg-heading-2))) - `(jabber-title-large ((,c :weight bold :width ultra-expanded :height 3.0 :foreground ,fg-heading-1))) + `(jabber-roster-user-away ((,c :foreground ,fg-dim))) + `(jabber-roster-user-xa ((,c :foreground ,fg-alt))) + `(jabber-roster-user-dnd ((,c :foreground ,warning))) + `(jabber-roster-user-chatty ((,c :foreground ,warning))) + `(jabber-roster-user-error ((,c :foreground ,err))) + `(jabber-roster-user-offline ((,c :foreground ,fg-dim))) + `(jabber-roster-user-online ((,c :inherit modus-themes-bold :foreground ,info))) + `(jabber-chat-prompt-foreign ((,c :inherit modus-themes-bold :foreground ,err))) + `(jabber-chat-prompt-system ((,c :foreground ,warning))) + `(jabber-chat-prompt-local ((,c :foreground ,info))) + `(jabber-chat-error ((,c :foreground ,err))) + `(jabber-activity-personal-face ((,c :foreground ,modeline-info))) + `(jabber-rare-time-face ((,c :foreground ,date-common))) + `(jabber-title-small ((,c :inherit modus-themes-heading-3))) + `(jabber-title-medium ((,c :inherit modus-themes-heading-2))) + `(jabber-title-large ((,c :inherit modus-themes-heading-1))) ;;;;; japanese-holidays `(japanese-holiday-saturday ((,c :foreground ,date-holiday-other))) ;;;;; jira (org-jira) `(jiralib-comment-face ((,c :background ,bg-inactive))) - `(jiralib-comment-header-face ((,c :inherit bold))) + `(jiralib-comment-header-face ((,c :inherit modus-themes-bold))) `(jiralib-issue-info-face ((,c :background ,bg-inactive))) - `(jiralib-issue-info-header-face ((,c :inherit bold :background ,bg-inactive))) - `(jiralib-issue-summary-face ((,c :inherit bold))) - `(jiralib-link-filter-face ((,c :underline t))) - `(jiralib-link-issue-face ((,c :underline t))) - `(jiralib-link-project-face ((,c :underline t))) + `(jiralib-issue-info-header-face ((,c :inherit modus-themes-bold :background ,bg-inactive))) + `(jiralib-issue-summary-face ((,c :inherit modus-themes-bold))) + `(jiralib-link-filter-face ((,c :inherit underline))) + `(jiralib-link-issue-face ((,c :inherit underline))) + `(jiralib-link-project-face ((,c :inherit underline))) ;;;;; jit-spell - `(jit-spell-misspelling ((,c :inherit modus-themes-lang-error))) + `(jit-spell-misspelling ((,c :underline (:style wave :color ,underline-err)))) ;;;;; jinx - `(jinx-misspelled ((,c :inherit modus-themes-lang-warning))) + `(jinx-misspelled ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; journalctl-mode - `(journalctl-error-face ((,c :inherit error))) - `(journalctl-finished-face ((,c :inherit success))) + `(journalctl-error-face ((,c :foreground ,err))) + `(journalctl-finished-face ((,c :foreground ,info))) `(journalctl-host-face ((,c :foreground ,name))) `(journalctl-process-face ((,c :foreground ,warning))) `(journalctl-starting-face ((,c :foreground ,info))) `(journalctl-timestamp-face ((,c :foreground ,date-common))) - `(journalctl-warning-face ((,c :inherit warning))) + `(journalctl-warning-face ((,c :foreground ,warning))) ;;;;; js2-mode - `(js2-error ((,c :inherit modus-themes-lang-error))) - `(js2-external-variable ((,c :inherit font-lock-variable-name-face))) - `(js2-function-call ((,c :inherit font-lock-function-name-face))) - `(js2-function-param ((,c :inherit font-lock-constant-face))) - `(js2-instance-member ((,c :inherit font-lock-keyword-face))) + `(js2-error ((,c :underline (:style wave :color ,underline-err)))) + `(js2-external-variable ((,c :foreground ,variable))) + `(js2-function-call ((,c :foreground ,fnname))) + `(js2-function-param ((,c :foreground ,constant))) + `(js2-instance-member ((,c :inherit modus-themes-bold :foreground ,keyword))) `(js2-jsdoc-html-tag-delimiter ((,c :foreground ,fg-main))) - `(js2-jsdoc-html-tag-name ((,c :inherit font-lock-function-name-face))) - `(js2-jsdoc-tag ((,c :inherit (font-lock-builtin-face font-lock-comment-face) :weight normal))) - `(js2-jsdoc-type ((,c :inherit (font-lock-type-face font-lock-comment-face) :weight normal))) - `(js2-jsdoc-value ((,c :inherit (font-lock-constant-face font-lock-comment-face) :weight normal))) + `(js2-jsdoc-html-tag-name ((,c :foreground ,fnname))) + `(js2-jsdoc-tag ((,c :inherit modus-themes-slant :foreground ,builtin))) + `(js2-jsdoc-type ((,c :inherit modus-themes-slant :foreground ,type))) + `(js2-jsdoc-value ((,c :inherit modus-themes-slant :foreground ,string))) `(js2-object-property ((,c :foreground ,fg-main))) `(js2-object-property-access ((,c :foreground ,fg-main))) - `(js2-private-function-call ((,c :inherit font-lock-preprocessor-face))) - `(js2-private-member ((,c :inherit font-lock-warning-face))) - `(js2-warning ((,c :inherit modus-themes-lang-warning))) + `(js2-private-function-call ((,c :foreground ,preprocessor))) + `(js2-private-member ((,c :inherit modus-themes-bold :foreground ,warning))) + `(js2-warning ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; julia - `(julia-macro-face ((,c :inherit font-lock-builtin-face))) - `(julia-quoted-symbol-face ((,c :inherit font-lock-constant-face))) + `(julia-macro-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(julia-quoted-symbol-face ((,c :foreground ,constant))) ;;;;; kaocha-runner - `(kaocha-runner-error-face ((,c :inherit error))) - `(kaocha-runner-success-face ((,c :inherit success))) - `(kaocha-runner-warning-face ((,c :inherit warning))) + `(kaocha-runner-error-face ((,c :foreground ,err))) + `(kaocha-runner-success-face ((,c :foreground ,info))) + `(kaocha-runner-warning-face ((,c :foreground ,warning))) ;;;;; keycast `(keycast-command ((,c :inherit bold))) `(keycast-key ((,c :inherit modus-themes-bold :background ,keybind :foreground ,bg-main))) ;;;;; kmacro-menu ;; Use `list' here to avoid a spurious warning about `kmacro-menu-mark'. - (list 'kmacro-menu-mark `((,c :inherit bold))) - `(kmacro-menu-marked ((,c :inherit modus-themes-mark-sel))) - `(kmacro-menu-flagged ((,c :inherit modus-themes-mark-del))) + (list 'kmacro-menu-mark `((,c :inherit modus-themes-bold))) + `(kmacro-menu-marked ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(kmacro-menu-flagged ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) ;;;;; ledger-mode - `(ledger-font-auto-xact-face ((,c :inherit font-lock-builtin-face))) + `(ledger-font-auto-xact-face ((,c :inherit modus-themes-bold :foreground ,builtin))) `(ledger-font-account-name-face ((,c :foreground ,name))) - `(ledger-font-directive-face ((,c :inherit font-lock-keyword-face))) + `(ledger-font-directive-face ((,c :inherit modus-themes-bold :foreground ,keyword))) `(ledger-font-posting-date-face ((,c :inherit modus-themes-bold :foreground ,date-common))) - `(ledger-font-periodic-xact-face ((,c :inherit font-lock-variable-name-face))) - `(ledger-font-posting-amount-face ((,c :inherit font-lock-constant-face))) - `(ledger-font-payee-cleared-face ((,c :inherit success))) - `(ledger-font-payee-pending-face ((,c :inherit warning))) - `(ledger-font-payee-uncleared-face ((,c :inherit error))) + `(ledger-font-periodic-xact-face ((,c :foreground ,variable))) + `(ledger-font-posting-amount-face ((,c :foreground ,constant))) + `(ledger-font-payee-cleared-face ((,c :foreground ,info))) + `(ledger-font-payee-pending-face ((,c :foreground ,warning))) + `(ledger-font-payee-uncleared-face ((,c :foreground ,err))) `(ledger-font-xact-highlight-face ((,c :background ,bg-hl-line :extend t))) ;;;;; leerzeichen `(leerzeichen ((,c :background ,bg-inactive))) @@ -2949,92 +5796,130 @@ FG and BG are the main colors." ;; fall back to `default' otherwise line numbers do not scale when ;; using `text-scale-adjust'. `(line-number ((,c :inherit ,(if modus-themes-mixed-fonts '(fixed-pitch default) 'default) :background ,bg-line-number-inactive :foreground ,fg-line-number-inactive))) - `(line-number-current-line ((,c :inherit (bold line-number) :background ,bg-line-number-active :foreground ,fg-line-number-active))) - `(line-number-major-tick ((,c :inherit line-number :foreground ,err))) - `(line-number-minor-tick ((,c :inherit line-number :foreground ,fg-alt))) + `(line-number-current-line ((,c :inherit ,(if modus-themes-mixed-fonts '(bold fixed-pitch default) '(bold default)) :background ,bg-line-number-active :foreground ,fg-line-number-active))) + `(line-number-major-tick ((,c :inherit ,(if modus-themes-mixed-fonts '(fixed-pitch default) 'default) :background ,bg-line-number-inactive :foreground ,accent-0))) + `(line-number-minor-tick ((,c :inherit ,(if modus-themes-mixed-fonts '(fixed-pitch default) 'default) :background ,bg-line-number-inactive :foreground ,accent-1))) +;;;;; lsp + `(lsp-details-face ((,c :height 0.9 :foreground ,fg-dim))) + `(lsp-face-rename ((,c :background ,bg-search-replace :foreground ,fg-main))) + `(lsp-headerline-breadcrumb-separator-face ((,c :foreground ,fg-dim))) + `(lsp-headerline-breadcrumb-path-face ((,c :foreground ,string))) + `(lsp-headerline-breadcrumb-path-error-face ((,c :underline (:style wave :color ,underline-err)))) + `(lsp-headerline-breadcrumb-path-warning-face ((,c :underline (:style wave :color ,underline-warning)))) + `(lsp-headerline-breadcrumb-path-info-face ((,c :underline (:style wave :color ,underline-note)))) + `(lsp-headerline-breadcrumb-path-hint-face ((,c :underline (:style wave :color ,underline-note)))) + `(lsp-headerline-breadcrumb-project-prefix-face ((,c :inherit modus-themes-bold :foreground ,name))) + `(lsp-headerline-breadcrumb-unknown-project-prefix-face ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(lsp-headerline-breadcrumb-symbols-face ((,c :inherit modus-themes-bold :foreground ,docstring))) + `(lsp-headerline-breadcrumb-symbols-error-face ((,c :underline (:style wave :color ,underline-err)))) + `(lsp-headerline-breadcrumb-symbols-warning-face ((,c :underline (:style wave :color ,underline-warning)))) + `(lsp-headerline-breadcrumb-symbols-info-face ((,c :underline (:style wave :color ,underline-note)))) + `(lsp-headerline-breadcrumb-symbols-hint-face ((,c :underline (:style wave :color ,underline-note)))) + `(lsp-installation-buffer-face ((,c :foreground ,info))) + `(lsp-installation-finished-buffer-face ((,c :foreground ,info))) + `(lsp-lens-mouse-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link :height 0.9))) + `(lsp-modeline-code-actions-face ((,c :foreground ,modeline-warning))) + `(lsp-modeline-code-actions-preferred-face ((,c :foreground ,modeline-warning))) + `(lsp-signature-posframe ((,c :background ,bg-dim :foreground ,fg-main))) + (list 'lsp-signature-highlight-function-argument `((,c :inherit modus-themes-bold :background ,bg-active-argument :foreground ,fg-active-argument))) +;;;;; lsp-ui + `(lsp-ui-doc-background ((,c :background ,bg-dim))) + `(lsp-ui-doc-header ((,c :inherit modus-themes-bold))) + `(lsp-ui-peek-peek ((,c :background ,bg-dim))) + `(lsp-ui-peek-list ((,c :background ,bg-dim))) + `(lsp-ui-peek-filename ((,c :inherit modus-themes-bold :foreground ,name))) + `(lsp-ui-peek-line-number ((,c :foreground ,fg-dim))) + `(lsp-ui-peek-highlight ((,c :background ,bg-dim :box (:line-width -1 :color ,border)))) + `(lsp-ui-peek-header ((,c :inherit modus-themes-bold))) + `(lsp-ui-peek-selection ((,c :background ,bg-region :foreground ,fg-region))) + `(lsp-ui-sideline-symbol ((,c :foreground ,fg-dim :box (:line-width -1 :color ,border)))) + `(lsp-ui-sideline-current-symbol ((,c :inherit modus-themes-bold :foreground ,fg-main :box (:line-width -1 :color ,border)))) + `(lsp-ui-sideline-code-action ((,c :foreground ,modeline-warning))) + `(lsp-ui-sideline-symbol-info ((,c :inherit modus-themes-slant))) ;;;;; magit - `(magit-bisect-bad ((,c :inherit error))) - `(magit-bisect-good ((,c :inherit success))) - `(magit-bisect-skip ((,c :inherit warning))) + `(magit-bisect-bad ((,c :foreground ,err))) + `(magit-bisect-good ((,c :foreground ,info))) + `(magit-bisect-skip ((,c :foreground ,warning))) `(magit-blame-date (( ))) - `(magit-blame-dimmed ((,c :inherit shadow))) + `(magit-blame-dimmed ((,c :foreground ,fg-dim))) `(magit-blame-hash (( ))) `(magit-blame-highlight ((,c :background ,bg-active :foreground ,fg-main))) `(magit-blame-name (( ))) `(magit-blame-summary (( ))) `(magit-branch-local ((,c :foreground ,accent-0))) `(magit-branch-remote ((,c :foreground ,accent-1))) - `(magit-branch-upstream ((,c :inherit italic))) - `(magit-branch-warning ((,c :inherit warning))) - `(magit-cherry-equivalent ((,c :foreground ,magenta))) - `(magit-cherry-unmatched ((,c :foreground ,cyan))) + `(magit-branch-upstream ((,c :inherit modus-themes-slant))) + `(magit-branch-warning ((,c :foreground ,warning))) + `(magit-cherry-equivalent (( ))) + `(magit-cherry-unmatched ((,c :foreground ,err))) `(magit-diff-added ((,c :background ,bg-added-faint :foreground ,fg-added))) `(magit-diff-added-highlight ((,c :background ,bg-added :foreground ,fg-added))) `(magit-diff-base ((,c :background ,bg-changed-faint :foreground ,fg-changed))) `(magit-diff-base-highlight ((,c :background ,bg-changed :foreground ,fg-changed))) - `(magit-diff-context ((,c :inherit shadow))) + `(magit-diff-context ((,c :foreground ,fg-dim))) `(magit-diff-context-highlight ((,c :background ,bg-diff-context))) - `(magit-diff-file-heading ((,c :inherit bold :foreground ,accent-0))) - `(magit-diff-file-heading-highlight ((,c :inherit magit-diff-file-heading :background ,bg-inactive))) - `(magit-diff-file-heading-selection ((,c :inherit bold :background ,bg-hover-secondary))) + `(magit-diff-file-heading ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(magit-diff-file-heading-highlight ((,c :inherit modus-themes-bold :background ,bg-inactive :foreground ,accent-0))) + `(magit-diff-file-heading-selection ((,c :inherit modus-themes-bold :background ,bg-hover-secondary))) `(magit-diff-hunk-heading ((,c :background ,bg-inactive))) - `(magit-diff-hunk-heading-highlight ((,c :inherit bold :background ,bg-active))) - `(magit-diff-hunk-heading-selection ((,c :inherit bold :background ,bg-hover-secondary))) - `(magit-diff-hunk-region ((,c :inherit bold))) + `(magit-diff-hunk-heading-highlight ((,c :inherit modus-themes-bold :background ,bg-active))) + `(magit-diff-hunk-heading-selection ((,c :inherit modus-themes-bold :background ,bg-hover-secondary))) + `(magit-diff-hunk-region ((,c :inherit modus-themes-bold))) `(magit-diff-lines-boundary ((,c :background ,fg-main))) `(magit-diff-lines-heading ((,c :background ,fg-dim :foreground ,bg-main))) `(magit-diff-removed ((,c :background ,bg-removed-faint :foreground ,fg-removed))) `(magit-diff-removed-highlight ((,c :background ,bg-removed :foreground ,fg-removed))) `(magit-diffstat-added ((,c :foreground ,fg-added-intense))) `(magit-diffstat-removed ((,c :foreground ,fg-removed-intense))) - `(magit-dimmed ((,c :inherit shadow))) + `(magit-dimmed ((,c :foreground ,fg-dim))) `(magit-filename ((,c :foreground ,accent-2))) `(magit-hash ((,c :foreground ,identifier))) - `(magit-head ((,c :inherit magit-branch-local))) - `(magit-header-line ((,c :inherit bold))) - `(magit-header-line-key ((,c :inherit modus-themes-key-binding))) - `(magit-header-line-log-select ((,c :inherit bold))) + `(magit-head ((,c :foreground ,accent-0))) + `(magit-header-line ((,c :inherit modus-themes-bold))) + `(magit-header-line-key ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(magit-header-line-log-select ((,c :inherit modus-themes-bold))) `(magit-keyword ((,c :foreground ,keyword))) - `(magit-keyword-squash ((,c :inherit bold :foreground ,warning))) + `(magit-keyword-squash ((,c :inherit modus-themes-bold :foreground ,warning))) `(magit-log-author ((,c :foreground ,name))) `(magit-log-date ((,c :foreground ,date-common))) - `(magit-log-graph ((,c :inherit shadow))) - `(magit-mode-line-process ((,c :inherit bold :foreground ,modeline-info))) - `(magit-mode-line-process-error ((,c :inherit bold :foreground ,modeline-err))) - `(magit-process-ng ((,c :inherit error))) - `(magit-process-ok ((,c :inherit success))) - `(magit-reflog-amend ((,c :inherit warning))) - `(magit-reflog-checkout ((,c :inherit bold :foreground ,blue))) - `(magit-reflog-cherry-pick ((,c :inherit success))) - `(magit-reflog-commit ((,c :inherit bold))) - `(magit-reflog-merge ((,c :inherit success))) - `(magit-reflog-other ((,c :inherit bold :foreground ,cyan))) - `(magit-reflog-rebase ((,c :inherit bold :foreground ,magenta))) - `(magit-reflog-remote ((,c :inherit (bold magit-branch-remote)))) - `(magit-reflog-reset ((,c :inherit error))) - `(magit-refname ((,c :inherit shadow))) - `(magit-refname-pullreq ((,c :inherit shadow))) - `(magit-refname-stash ((,c :inherit shadow))) - `(magit-refname-wip ((,c :inherit shadow))) + `(magit-log-graph ((,c :foreground ,fg-dim))) + `(magit-mode-line-process ((,c :inherit modus-themes-bold :foreground ,modeline-info))) + `(magit-mode-line-process-error ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(magit-process-ng ((,c :foreground ,err))) + `(magit-process-ok ((,c :foreground ,info))) + `(magit-reflog-amend ((,c :foreground ,warning))) + `(magit-reflog-checkout ((,c :inherit modus-themes-bold))) + `(magit-reflog-cherry-pick ((,c :foreground ,info))) + `(magit-reflog-commit ((,c :inherit modus-themes-bold))) + `(magit-reflog-merge ((,c :foreground ,info))) + `(magit-reflog-other ((,c :inherit modus-themes-bold :foreground ,accent-3))) + `(magit-reflog-rebase ((,c :inherit modus-themes-bold :foreground ,accent-2))) + `(magit-reflog-remote ((,c :inherit modus-themes-bold :foreground ,accent-1))) + `(magit-reflog-reset ((,c :foreground ,err))) + `(magit-refname ((,c :foreground ,fg-dim))) + `(magit-refname-pullreq ((,c :foreground ,fg-dim))) + `(magit-refname-stash ((,c :foreground ,fg-dim))) + `(magit-refname-wip ((,c :foreground ,fg-dim))) `(magit-section ((,c :background ,bg-dim :foreground ,fg-main))) - `(magit-section-heading ((,c :inherit bold))) - `(magit-section-heading-selection ((,c :inherit bold :background ,bg-hover-secondary))) + `(magit-section-heading ((,c :inherit modus-themes-bold :foreground ,fg-alt))) + `(magit-section-heading-selection ((,c :inherit modus-themes-bold :background ,bg-hover-secondary))) `(magit-section-highlight ((,c :background ,bg-dim))) - `(magit-sequence-done ((,c :inherit success))) - `(magit-sequence-drop ((,c :inherit error))) - `(magit-sequence-exec ((,c :inherit bold :foreground ,magenta))) - `(magit-sequence-head ((,c :inherit bold :foreground ,cyan))) - `(magit-sequence-onto ((,c :inherit (bold shadow)))) - `(magit-sequence-part ((,c :inherit warning))) - `(magit-sequence-pick ((,c :inherit bold))) - `(magit-sequence-stop ((,c :inherit error))) - `(magit-signature-bad ((,c :inherit error))) - `(magit-signature-error ((,c :inherit error))) - `(magit-signature-expired ((,c :inherit warning))) + `(magit-section-secondary-heading ((,c :inherit modus-themes-bold))) + `(magit-sequence-done ((,c :foreground ,info))) + `(magit-sequence-drop ((,c :foreground ,err))) + `(magit-sequence-exec ((,c :inherit modus-themes-bold))) + `(magit-sequence-head ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(magit-sequence-onto ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(magit-sequence-part ((,c :foreground ,warning))) + `(magit-sequence-pick ((,c :inherit modus-themes-bold))) + `(magit-sequence-stop ((,c :foreground ,err))) + `(magit-signature-bad ((,c :foreground ,err))) + `(magit-signature-error ((,c :foreground ,err))) + `(magit-signature-expired ((,c :foreground ,warning))) `(magit-signature-expired-key ((,c :foreground ,warning))) - `(magit-signature-good ((,c :inherit success))) - `(magit-signature-revoked ((,c :inherit bold :foreground ,warning))) - `(magit-signature-untrusted ((,c :inherit (bold shadow)))) + `(magit-signature-good ((,c :foreground ,info))) + `(magit-signature-revoked ((,c :inherit modus-themes-bold :foreground ,warning))) + `(magit-signature-untrusted ((,c :inherit modus-themes-bold :foreground ,fg-dim))) `(magit-tag ((,c :foreground ,accent-3))) ; compare with branches ;;;;; make-mode (makefiles) `(makefile-makepp-perl ((,c :background ,bg-dim))) @@ -3048,34 +5933,34 @@ FG and BG are the main colors." `(marginalia-date ((,c :foreground ,date-common))) `(marginalia-documentation ((,c :inherit modus-themes-slant :foreground ,docstring))) `(marginalia-file-name (( ))) - `(marginalia-file-owner ((,c :inherit shadow))) + `(marginalia-file-owner ((,c :foreground ,fg-dim))) `(marginalia-file-priv-dir ((,c :foreground ,accent-0))) `(marginalia-file-priv-exec ((,c :foreground ,accent-1))) `(marginalia-file-priv-link ((,c :foreground ,fg-link))) - `(marginalia-file-priv-no ((,c :inherit shadow))) + `(marginalia-file-priv-no ((,c :foreground ,fg-dim))) `(marginalia-file-priv-other ((,c :foreground ,accent-2))) `(marginalia-file-priv-rare ((,c :foreground ,accent-3))) `(marginalia-file-priv-read ((,c :foreground ,fg-main))) `(marginalia-file-priv-write ((,c :foreground ,accent-0))) `(marginalia-function ((,c :foreground ,fnname))) - `(marginalia-key ((,c :inherit modus-themes-key-binding))) - `(marginalia-lighter ((,c :inherit shadow))) - `(marginalia-liqst ((,c :inherit shadow))) + `(marginalia-key ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(marginalia-lighter ((,c :foreground ,fg-dim))) + `(marginalia-liqst ((,c :foreground ,fg-dim))) `(marginalia-mode ((,c :foreground ,constant))) - `(marginalia-modified ((,c :inherit warning))) - `(marginalia-null ((,c :inherit shadow))) + `(marginalia-modified ((,c :foreground ,warning))) + `(marginalia-null ((,c :foreground ,fg-dim))) `(marginalia-number ((,c :foreground ,constant))) `(marginalia-size ((,c :foreground ,variable))) `(marginalia-string ((,c :foreground ,string))) `(marginalia-symbol ((,c :foreground ,builtin))) `(marginalia-true (( ))) `(marginalia-type ((,c :foreground ,type))) - `(marginalia-value ((,c :inherit shadow))) + `(marginalia-value ((,c :foreground ,fg-dim))) `(marginalia-version ((,c :foreground ,date-common))) ;;;;; markdown-mode - `(markdown-blockquote-face ((,c :inherit font-lock-doc-face))) + `(markdown-blockquote-face ((,c :inherit modus-themes-slant :foreground ,docstring))) `(markdown-bold-face ((,c :inherit bold))) - `(markdown-code-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-dim :extend t))) + `(markdown-code-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-contents :extend t))) `(markdown-gfm-checkbox-face ((,c :foreground ,warning))) `(markdown-header-face (( ))) `(markdown-header-face-1 ((,c :inherit modus-themes-heading-1))) @@ -3084,38 +5969,38 @@ FG and BG are the main colors." `(markdown-header-face-4 ((,c :inherit modus-themes-heading-4))) `(markdown-header-face-5 ((,c :inherit modus-themes-heading-5))) `(markdown-header-face-6 ((,c :inherit modus-themes-heading-6))) - `(markdown-highlighting-face ((,c :inherit secondary-selection))) - `(markdown-inline-code-face ((,c :inherit modus-themes-prose-code))) + `(markdown-highlighting-face ((,c :background ,bg-hover-secondary :foreground ,fg-main))) + `(markdown-inline-code-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) `(markdown-italic-face ((,c :inherit italic))) `(markdown-language-keyword-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-delimiter :foreground ,fg-prose-block-delimiter))) - `(markdown-line-break-face ((,c :inherit nobreak-space))) - `(markdown-link-face ((,c :inherit link))) - `(markdown-markup-face ((,c :inherit shadow))) - `(markdown-metadata-key-face ((,c :inherit bold))) + `(markdown-line-break-face ((,c :foreground ,err :underline t))) + `(markdown-link-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(markdown-markup-face ((,c :foreground ,fg-dim))) + `(markdown-metadata-key-face ((,c :inherit modus-themes-bold))) `(markdown-metadata-value-face ((,c :foreground ,string))) - `(markdown-missing-link-face ((,c :inherit warning))) - `(markdown-pre-face ((,c :inherit markdown-code-face))) + `(markdown-missing-link-face ((,c :foreground ,warning))) + `(markdown-pre-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-contents :extend t))) `(markdown-table-face ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-table))) `(markdown-url-face ((,c :foreground ,fg-alt))) ;;;;; markup-faces (`adoc-mode') - `(markup-attribute-face ((,c :inherit (modus-themes-slant markup-meta-face)))) + `(markup-attribute-face ((,c :inherit modus-themes-fixed-pitch :foreground ,fg-dim))) `(markup-bold-face ((,c :inherit bold))) - `(markup-code-face ((,c :inherit modus-themes-prose-code))) - `(markup-comment-face ((,c :inherit font-lock-comment-face))) - `(markup-complex-replacement-face ((,c :inherit modus-themes-prose-macro))) + `(markup-code-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) + `(markup-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(markup-complex-replacement-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-macro :foreground ,fg-prose-macro))) `(markup-emphasis-face ((,c :inherit markup-italic-face))) - `(markup-error-face ((,c :inherit error))) - `(markup-gen-face ((,c :inherit modus-themes-prose-verbatim))) - `(markup-internal-reference-face ((,c :inherit (shadow modus-themes-slant)))) - `(markup-italic-face ((,c :inherit italic))) + `(markup-error-face ((,c :foreground ,err))) + `(markup-gen-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(markup-internal-reference-face ((,c :inherit modus-themes-slant :foreground ,fg-dim))) + `(markup-italic-face ((,c :inherit modus-themes-slant))) `(markup-list-face ((,c :background ,bg-inactive))) - `(markup-meta-face ((,c :inherit (modus-themes-fixed-pitch shadow)))) + `(markup-meta-face ((,c :inherit modus-themes-fixed-pitch :foreground ,fg-dim))) `(markup-meta-hide-face ((,c :foreground "gray50"))) `(markup-reference-face ((,c :inherit modus-themes-slant :foreground ,fg-alt))) `(markup-replacement-face ((,c :inherit modus-themes-fixed-pitch :foreground ,err))) `(markup-secondary-text-face ((,c :height 0.9 :foreground ,fg-alt))) - `(markup-small-face ((,c :inherit markup-gen-face :height 0.9))) - `(markup-strong-face ((,c :inherit markup-bold-face))) + `(markup-small-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim :height 0.9))) + `(markup-strong-face ((,c :inherit bold))) `(markup-subscript-face ((,c :height 0.9 :foreground ,fg-alt))) `(markup-superscript-face ((,c :height 0.9 :foreground ,fg-alt))) `(markup-table-cell-face (( ))) @@ -3127,9 +6012,9 @@ FG and BG are the main colors." `(markup-title-3-face ((,c :inherit modus-themes-heading-4))) `(markup-title-4-face ((,c :inherit modus-themes-heading-5))) `(markup-title-5-face ((,c :inherit modus-themes-heading-6))) - `(markup-verbatim-face ((,c :inherit modus-themes-prose-verbatim))) + `(markup-verbatim-face ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) ;;;;; mbdepth - `(minibuffer-depth-indicator ((,c :inherit modus-themes-mark-alt))) + `(minibuffer-depth-indicator ((,c :inverse-video t))) ;;;;; mct `(mct-highlight-candidate ((,c :inherit modus-themes-completion-selected))) ;;;;; messages @@ -3137,12 +6022,12 @@ FG and BG are the main colors." `(message-cited-text-2 ((,c :foreground ,mail-cite-1))) `(message-cited-text-3 ((,c :foreground ,mail-cite-2))) `(message-cited-text-4 ((,c :foreground ,mail-cite-3))) - `(message-header-name ((,c :inherit bold))) - `(message-header-newsgroups ((,c :inherit message-header-other))) - `(message-header-to ((,c :inherit bold :foreground ,mail-recipient))) + `(message-header-name ((,c :inherit modus-themes-bold))) + `(message-header-newsgroups ((,c :foreground ,mail-other))) + `(message-header-to ((,c :inherit modus-themes-bold :foreground ,mail-recipient))) `(message-header-cc ((,c :foreground ,mail-recipient))) - `(message-header-subject ((,c :inherit bold :foreground ,mail-subject))) - `(message-header-xheader ((,c :inherit message-header-other))) + `(message-header-subject ((,c :inherit modus-themes-bold :foreground ,mail-subject))) + `(message-header-xheader ((,c :foreground ,mail-other))) `(message-header-other ((,c :foreground ,mail-other))) `(message-mml ((,c :foreground ,mail-part))) `(message-separator ((,c :background ,bg-inactive :foreground ,fg-main))) @@ -3150,73 +6035,89 @@ FG and BG are the main colors." `(minimap-active-region-background ((,c :background ,bg-active))) `(minimap-current-line-face ((,c :background ,bg-cyan-intense :foreground ,fg-main))) ;;;;; mode-line - `(mode-line ((,c :inherit modus-themes-ui-variable-pitch - :box ,border-mode-line-active - :background ,bg-mode-line-active - :foreground ,fg-mode-line-active))) - `(mode-line-active ((,c :inherit mode-line))) + `(mode-line + ((default :inherit modus-themes-ui-variable-pitch + :background ,bg-mode-line-active + :foreground ,fg-mode-line-active) + (((supports :box t)) + :box ,border-mode-line-active) + (t :underline ,border-mode-line-active))) + `(mode-line-active + ((default :inherit modus-themes-ui-variable-pitch + :background ,bg-mode-line-active + :foreground ,fg-mode-line-active) + (((supports :box t)) + :box ,border-mode-line-active) + (t :underline ,border-mode-line-active))) `(mode-line-buffer-id ((,c :inherit bold))) - `(mode-line-emphasis ((,c :inherit bold :foreground ,modeline-info))) - `(mode-line-highlight ((,c :background ,bg-hover :foreground ,fg-main :box ,fg-main))) - `(mode-line-inactive ((,c :inherit modus-themes-ui-variable-pitch - :box ,border-mode-line-inactive - :background ,bg-mode-line-inactive - :foreground ,fg-mode-line-inactive))) + `(mode-line-emphasis ((,c :inherit italic :foreground ,modeline-info))) + `(mode-line-highlight + ((default :background ,bg-hover :foreground ,fg-main) + (((supports :box t)) + :box ,fg-main) + (t :underline ,fg-main))) + `(mode-line-inactive + ((default :inherit modus-themes-ui-variable-pitch + :background ,bg-mode-line-inactive + :foreground ,fg-mode-line-inactive) + (((supports :box t)) + :box ,border-mode-line-inactive) + (t :underline ,border-mode-line-inactive))) ;;;;; mood-line - `(mood-line-modified ((,c :inherit italic))) - `(mood-line-status-error ((,c :inherit error))) + `(mood-line-modified ((,c :inherit modus-themes-slant))) + `(mood-line-status-error ((,c :foreground ,err))) `(mood-line-status-info ((,c :foreground ,info))) `(mood-line-status-neutral (( ))) - `(mood-line-status-success ((,c :inherit success))) - `(mood-line-status-warning ((,c :inherit warning))) - `(mood-line-unimportant ((,c :inherit shadow))) + `(mood-line-status-success ((,c :foreground ,info))) + `(mood-line-status-warning ((,c :foreground ,warning))) + `(mood-line-unimportant ((,c :foreground ,fg-dim))) ;;;;; mpdel `(mpdel-browser-directory-face ((,c :foreground ,accent-0))) - `(mpdel-playlist-current-song-face ((,c :inherit bold :foreground ,accent-0))) + `(mpdel-playlist-current-song-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) ;;;;; mu4e - `(mu4e-attach-number-face ((,c :inherit bold :foreground ,fg-dim))) - `(mu4e-cited-1-face ((,c :inherit message-cited-text-1))) - `(mu4e-cited-2-face ((,c :inherit message-cited-text-2))) - `(mu4e-cited-3-face ((,c :inherit message-cited-text-3))) - `(mu4e-cited-4-face ((,c :inherit message-cited-text-4))) - `(mu4e-cited-5-face ((,c :inherit message-cited-text-1))) - `(mu4e-cited-6-face ((,c :inherit message-cited-text-2))) - `(mu4e-cited-7-face ((,c :inherit message-cited-text-3))) - `(mu4e-compose-header-face ((,c :inherit mu4e-compose-separator-face))) - `(mu4e-compose-separator-face ((,c :inherit message-separator))) - `(mu4e-contact-face ((,c :inherit message-header-to))) - `(mu4e-context-face ((,c :inherit bold))) + `(mu4e-attach-number-face ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(mu4e-cited-1-face ((,c :foreground ,mail-cite-0))) + `(mu4e-cited-2-face ((,c :foreground ,mail-cite-1))) + `(mu4e-cited-3-face ((,c :foreground ,mail-cite-2))) + `(mu4e-cited-4-face ((,c :foreground ,mail-cite-3))) + `(mu4e-cited-5-face ((,c :foreground ,mail-cite-0))) + `(mu4e-cited-6-face ((,c :foreground ,mail-cite-1))) + `(mu4e-cited-7-face ((,c :foreground ,mail-cite-2))) + `(mu4e-compose-header-face ((,c :background ,bg-inactive :foreground ,fg-main))) + `(mu4e-compose-separator-face ((,c :background ,bg-inactive :foreground ,fg-main))) + `(mu4e-contact-face ((,c :inherit modus-themes-bold :foreground ,mail-recipient))) + `(mu4e-context-face ((,c :inherit modus-themes-bold))) `(mu4e-draft-face ((,c :foreground ,warning))) `(mu4e-flagged-face ((,c :foreground ,keyword))) - `(mu4e-footer-face ((,c :inherit italic :foreground ,fg-alt))) - `(mu4e-forwarded-face ((,c :inherit italic :foreground ,info))) - `(mu4e-header-face ((,c :inherit shadow))) + `(mu4e-footer-face ((,c :inherit modus-themes-slant :foreground ,fg-alt))) + `(mu4e-forwarded-face ((,c :inherit modus-themes-slant :foreground ,info))) + `(mu4e-header-face ((,c :foreground ,fg-dim))) `(mu4e-header-highlight-face ((,c :background ,bg-hl-line :extend t))) - `(mu4e-header-key-face ((,c :inherit message-header-name))) - `(mu4e-header-marks-face ((,c :inherit mu4e-special-header-value-face))) + `(mu4e-header-key-face ((,c :inherit modus-themes-bold))) + `(mu4e-header-marks-face ((,c :inherit modus-themes-bold :foreground ,mail-subject))) `(mu4e-header-title-face ((,c :foreground ,fg-alt))) - `(mu4e-header-value-face ((,c :inherit message-header-other))) - `(mu4e-highlight-face ((,c :inherit modus-themes-key-binding))) - `(mu4e-link-face ((,c :inherit link))) + `(mu4e-header-value-face ((,c :foreground ,mail-other))) + `(mu4e-highlight-face ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(mu4e-link-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(mu4e-modeline-face (( ))) - `(mu4e-moved-face ((,c :inherit italic :foreground ,warning))) - `(mu4e-ok-face ((,c :inherit success))) + `(mu4e-moved-face ((,c :inherit modus-themes-slant :foreground ,warning))) + `(mu4e-ok-face ((,c :foreground ,info))) `(mu4e-region-code ((,c :foreground ,builtin))) - `(mu4e-related-face ((,c :inherit (italic shadow)))) + `(mu4e-related-face ((,c :inherit modus-themes-slant :foreground ,fg-dim))) `(mu4e-replied-face ((,c :foreground ,info))) - `(mu4e-special-header-value-face ((,c :inherit message-header-subject))) - `(mu4e-system-face ((,c :inherit italic))) + `(mu4e-special-header-value-face ((,c :inherit modus-themes-bold :foreground ,mail-subject))) + `(mu4e-system-face ((,c :inherit modus-themes-slant))) `(mu4e-thread-fold-face ((,c :foreground ,border))) `(mu4e-title-face (( ))) `(mu4e-trashed-face ((,c :foreground ,err))) `(mu4e-unread-face ((,c :inherit bold))) - `(mu4e-url-number-face ((,c :inherit shadow))) + `(mu4e-url-number-face ((,c :foreground ,fg-dim))) `(mu4e-view-body-face (( ))) - `(mu4e-warning-face ((,c :inherit warning))) + `(mu4e-warning-face ((,c :foreground ,warning))) ;;;;; multiple-cursors `(mc/cursor-bar-face ((,c :height 1 :foreground ,fg-main :background ,bg-main))) `(mc/cursor-face ((,c :inverse-video t))) - `(mc/region-face ((,c :inherit region))) + `(mc/region-face ((,c :background ,bg-region :foreground ,fg-region))) ;;;;; nerd-icons `(nerd-icons-blue ((,c :foreground ,blue-cooler))) `(nerd-icons-blue-alt ((,c :foreground ,blue-warmer))) @@ -3263,38 +6164,41 @@ FG and BG are the main colors." `(nerd-icons-ibuffer-size-face ((,c :foreground ,variable))) ;;;;; neotree `(neo-banner-face ((,c :foreground ,accent-0))) - `(neo-button-face ((,c :inherit button))) + `(neo-button-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(neo-dir-link-face (( ))) `(neo-expand-btn-face (( ))) `(neo-file-link-face (( ))) - `(neo-header-face ((,c :inherit bold))) - `(neo-root-dir-face ((,c :inherit bold :foreground ,accent-0))) - `(neo-vc-added-face ((,c :inherit success))) - `(neo-vc-conflict-face ((,c :inherit error))) + `(neo-header-face ((,c :inherit modus-themes-bold))) + `(neo-root-dir-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(neo-vc-added-face ((,c :foreground ,info))) + `(neo-vc-conflict-face ((,c :foreground ,err))) `(neo-vc-default-face (( ))) - `(neo-vc-edited-face ((,c :inherit italic))) - `(neo-vc-ignored-face ((,c :inherit shadow))) - `(neo-vc-missing-face ((,c :inherit error))) - `(neo-vc-needs-merge-face ((,c :inherit italic))) - `(neo-vc-needs-update-face ((,c :underline t))) + `(neo-vc-edited-face ((,c :inherit modus-themes-slant))) + `(neo-vc-ignored-face ((,c :foreground ,fg-dim))) + `(neo-vc-missing-face ((,c :foreground ,err))) + `(neo-vc-needs-merge-face ((,c :inherit modus-themes-slant))) + `(neo-vc-needs-update-face ((,c :inherit underline))) `(neo-vc-removed-face ((,c :strike-through t))) - `(neo-vc-unlocked-changes-face ((,c :inherit success))) + `(neo-vc-unlocked-changes-face ((,c :foreground ,info))) `(neo-vc-up-to-date-face (( ))) - `(neo-vc-user-face ((,c :inherit warning))) + `(neo-vc-user-face ((,c :foreground ,warning))) ;;;;; notmuch - `(notmuch-crypto-decryption ((,c :inherit bold))) + `(notmuch-crypto-decryption ((,c :inherit modus-themes-bold))) `(notmuch-crypto-part-header ((,c :foreground ,mail-part))) ; like `message-mml' - `(notmuch-crypto-signature-bad ((,c :inherit error))) - `(notmuch-crypto-signature-good ((,c :inherit success))) - `(notmuch-crypto-signature-good-key ((,c :inherit success))) - `(notmuch-crypto-signature-unknown ((,c :inherit warning))) - `(notmuch-jump-key ((,c :inherit modus-themes-key-binding))) - `(notmuch-message-summary-face ((,c :inherit bold :background ,bg-inactive))) + `(notmuch-crypto-signature-bad ((,c :foreground ,err))) + `(notmuch-crypto-signature-good ((,c :foreground ,info))) + `(notmuch-crypto-signature-good-key ((,c :foreground ,info))) + `(notmuch-crypto-signature-unknown ((,c :foreground ,warning))) + `(notmuch-jump-key ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(notmuch-message-summary-face + ((default :inherit modus-themes-bold :background ,bg-inactive) + (((supports :overline t)) + :overline ,border))) `(notmuch-search-count ((,c :foreground ,fg-dim))) `(notmuch-search-date ((,c :foreground ,date-common))) `(notmuch-search-flagged-face ((,c :foreground ,keyword))) `(notmuch-search-matching-authors ((,c :foreground ,mail-recipient))) - `(notmuch-search-non-matching-authors ((,c :inherit shadow))) + `(notmuch-search-non-matching-authors ((,c :foreground ,fg-dim))) `(notmuch-search-subject ((,c :foreground ,fg-main))) `(notmuch-search-unread-face ((,c :inherit bold))) `(notmuch-tag-added ((,c :underline ,info))) @@ -3302,43 +6206,43 @@ FG and BG are the main colors." `(notmuch-tag-face ((,c :foreground ,accent-0))) `(notmuch-tag-flagged ((,c :foreground ,keyword))) `(notmuch-tag-unread ((,c :foreground ,accent-1))) - `(notmuch-tree-match-author-face ((,c :inherit notmuch-search-matching-authors))) - `(notmuch-tree-match-date-face ((,c :inherit notmuch-search-date))) + `(notmuch-tree-match-author-face ((,c :foreground ,mail-recipient))) + `(notmuch-tree-match-date-face ((,c :foreground ,date-common))) `(notmuch-tree-match-face ((,c :foreground ,fg-dim))) `(notmuch-tree-match-subject-face ((,c :foreground ,fg-main))) - `(notmuch-tree-match-tag-face ((,c :inherit notmuch-tag-face))) - `(notmuch-tree-no-match-face ((,c :inherit shadow))) - `(notmuch-tree-no-match-date-face ((,c :inherit shadow))) - `(notmuch-wash-cited-text ((,c :inherit message-cited-text-1))) + `(notmuch-tree-match-tag-face ((,c :foreground ,accent-0))) + `(notmuch-tree-no-match-face ((,c :foreground ,fg-dim))) + `(notmuch-tree-no-match-date-face ((,c :foreground ,fg-dim))) + `(notmuch-wash-cited-text ((,c :foreground ,mail-cite-0))) `(notmuch-wash-toggle-button ((,c :background ,bg-dim))) ;;;;; num3-mode - `(num3-face-even ((,c :inherit bold :background ,bg-inactive))) + `(num3-face-even ((,c :inherit modus-themes-bold :background ,bg-inactive))) ;;;;; nxml-mode `(nxml-attribute-colon ((,c :foreground ,fg-main))) - `(nxml-attribute-local-name ((,c :inherit font-lock-variable-name-face))) - `(nxml-attribute-prefix ((,c :inherit font-lock-type-face))) - `(nxml-attribute-value ((,c :inherit font-lock-constant-face))) - `(nxml-cdata-section-CDATA ((,c :inherit error))) - `(nxml-cdata-section-delimiter ((,c :inherit error))) - `(nxml-char-ref-delimiter ((,c :inherit shadow))) - `(nxml-char-ref-number ((,c :inherit (shadow modus-themes-bold)))) - `(nxml-delimited-data ((,c :inherit (shadow modus-themes-slant)))) + `(nxml-attribute-local-name ((,c :foreground ,variable))) + `(nxml-attribute-prefix ((,c :inherit modus-themes-bold :foreground ,type))) + `(nxml-attribute-value ((,c :foreground ,constant))) + `(nxml-cdata-section-CDATA ((,c :foreground ,err))) + `(nxml-cdata-section-delimiter ((,c :foreground ,err))) + `(nxml-char-ref-delimiter ((,c :foreground ,fg-dim))) + `(nxml-char-ref-number ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(nxml-delimited-data ((,c :inherit modus-themes-slant :foreground ,fg-dim))) `(nxml-delimiter ((,c :foreground ,fg-dim))) `(nxml-element-colon ((,c :foreground ,fg-main))) - `(nxml-element-local-name ((,c :inherit font-lock-function-name-face))) - `(nxml-element-prefix ((,c :inherit font-lock-builtin-face))) - `(nxml-entity-ref-delimiter ((,c :inherit shadow))) - `(nxml-entity-ref-name ((,c :inherit (shadow modus-themes-bold)))) + `(nxml-element-local-name ((,c :foreground ,fnname))) + `(nxml-element-prefix ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(nxml-entity-ref-delimiter ((,c :foreground ,fg-dim))) + `(nxml-entity-ref-name ((,c :inherit modus-themes-bold :foreground ,fg-dim))) `(nxml-glyph ((,c :background ,bg-active :foreground ,fg-main))) - `(nxml-hash ((,c :inherit (bold font-lock-string-face)))) - `(nxml-heading ((,c :inherit bold))) - `(nxml-name ((,c :inherit font-lock-builtin-face))) + `(nxml-hash ((,c :inherit modus-themes-bold :foreground ,string))) + `(nxml-heading ((,c :inherit modus-themes-bold))) + `(nxml-name ((,c :inherit modus-themes-bold :foreground ,builtin))) `(nxml-namespace-attribute-colon ((,c :foreground ,fg-main))) - `(nxml-namespace-attribute-prefix ((,c :inherit font-lock-variable-name-face))) - `(nxml-processing-instruction-target ((,c :inherit font-lock-keyword-face))) - `(nxml-prolog-keyword ((,c :inherit font-lock-keyword-face))) - `(nxml-ref ((,c :inherit (shadow modus-themes-bold)))) - `(rng-error ((,c :inherit error))) + `(nxml-namespace-attribute-prefix ((,c :foreground ,variable))) + `(nxml-processing-instruction-target ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(nxml-prolog-keyword ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(nxml-ref ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(rng-error ((,c :foreground ,err))) ;;;;; olivetti `(olivetti-fringe ((,c :background ,fringe))) ;;;;; orderless @@ -3349,56 +6253,63 @@ FG and BG are the main colors." ;;;;; org `(org-agenda-calendar-daterange ((,c :foreground ,date-range))) `(org-agenda-calendar-event ((,c :foreground ,date-event))) - `(org-agenda-calendar-sexp ((,c :inherit (modus-themes-slant org-agenda-calendar-event)))) - `(org-agenda-clocking ((,c :inherit bold :background ,bg-active-argument :foreground ,fg-active-argument))) + `(org-agenda-calendar-sexp ((,c :inherit modus-themes-slant :foreground ,date-event))) + `(org-agenda-clocking ((,c :inherit modus-themes-bold :background ,bg-active-argument :foreground ,fg-active-argument))) `(org-agenda-column-dateline ((,c :background ,bg-inactive))) `(org-agenda-current-time ((,c :foreground ,date-now))) `(org-agenda-date ((,c ,@(modus-themes--heading 'agenda-date date-weekday)))) - `(org-agenda-date-today ((,c :inherit org-agenda-date :underline t))) - `(org-agenda-date-weekend ((,c :inherit org-agenda-date :foreground ,date-weekend))) - `(org-agenda-date-weekend-today ((,c :inherit org-agenda-date-today :foreground ,date-weekend))) - `(org-agenda-diary ((,c :inherit org-agenda-calendar-sexp))) - `(org-agenda-dimmed-todo-face ((,c :inherit shadow))) - `(org-agenda-done ((,c :inherit org-done))) - `(org-agenda-filter-category ((,c :inherit bold :foreground ,modeline-err))) - `(org-agenda-filter-effort ((,c :inherit bold :foreground ,modeline-err))) - `(org-agenda-filter-regexp ((,c :inherit bold :foreground ,modeline-err))) - `(org-agenda-filter-tags ((,c :inherit bold :foreground ,modeline-err))) + `(org-agenda-date-today ((,c ,@(modus-themes--heading 'agenda-date date-weekday) :underline t))) + `(org-agenda-date-weekend ((,c ,@(modus-themes--heading 'agenda-date date-weekend)))) + `(org-agenda-date-weekend-today ((,c ,@(modus-themes--heading 'agenda-date date-weekend) :underline t))) + `(org-agenda-diary ((,c :inherit modus-themes-slant :foreground ,date-event))) + `(org-agenda-dimmed-todo-face ((,c :foreground ,fg-dim))) + `(org-agenda-done ((,c :foreground ,prose-done))) + `(org-agenda-filter-category ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(org-agenda-filter-effort ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(org-agenda-filter-regexp ((,c :inherit modus-themes-bold :foreground ,modeline-err))) + `(org-agenda-filter-tags ((,c :inherit modus-themes-bold :foreground ,modeline-err))) `(org-agenda-restriction-lock ((,c :background ,bg-dim :foreground ,fg-dim))) `(org-agenda-structure ((,c ,@(modus-themes--heading 'agenda-structure fg-alt)))) - `(org-agenda-structure-filter ((,c :inherit org-agenda-structure :foreground ,warning))) - `(org-agenda-structure-secondary ((,c :inherit font-lock-doc-face))) + `(org-agenda-structure-filter ((,c ,@(modus-themes--heading 'agenda-structure warning)))) + `(org-agenda-structure-secondary ((,c :inherit modus-themes-slant :foreground ,docstring))) `(org-archived ((,c :background ,bg-inactive :foreground ,fg-main))) `(org-block ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-contents :extend t))) `(org-block-begin-line ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-delimiter :foreground ,fg-prose-block-delimiter :extend t))) - `(org-block-end-line ((,c :inherit org-block-begin-line))) + `(org-block-end-line ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-delimiter :foreground ,fg-prose-block-delimiter :extend t))) `(org-checkbox ((,c :inherit modus-themes-fixed-pitch :foreground ,warning))) - `(org-checkbox-statistics-done ((,c :inherit org-done))) - `(org-checkbox-statistics-todo ((,c :inherit org-todo))) - `(org-clock-overlay ((,c :inherit secondary-selection))) - `(org-code ((,c :inherit modus-themes-prose-code))) + `(org-checkbox-statistics-done ((,c :foreground ,prose-done))) + `(org-checkbox-statistics-todo ((,c :foreground ,prose-todo))) + `(org-clock-overlay ((,c :background ,bg-hover-secondary :foreground ,fg-main))) + `(org-code ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) `(org-column ((,c :inherit default :background ,bg-dim))) `(org-column-title ((,c :inherit (modus-themes-fixed-pitch bold default) :underline t :background ,bg-dim))) `(org-date ((,c :inherit modus-themes-fixed-pitch :foreground ,date-common))) - `(org-date-selected ((,c :foreground ,date-common :inverse-video t))) + `(org-date-selected + ((default :foreground ,date-common :inverse-video t) + (((supports :box t)) + :box (:line-width (-1 . -1) :color ,fg-main)))) ;; NOTE 2024-03-17: Normally we do not want to add this padding ;; with the :box, but I do it here because the keys are otherwise ;; very hard to read. The square brackets around them are not ;; colored, which is what is causing the problem. - `(org-dispatcher-highlight ((,c :inherit modus-themes-bold :box (:line-width 2 :color ,bg-hover-secondary) :background ,bg-hover-secondary :foreground ,fg-main))) + `(org-dispatcher-highlight + ((default :background ,bg-mark-select :foreground ,fg-main) + (((supports :box t)) + :box (:line-width 2 :color ,bg-mark-select)) + (t :underline ,border))) `(org-document-info ((,c :foreground ,prose-metadata-value))) `(org-document-info-keyword ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata))) `(org-document-title ((,c :inherit modus-themes-heading-0))) `(org-done ((,c :foreground ,prose-done))) `(org-drawer ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata))) `(org-ellipsis (( ))) ; inherits from the heading's color - `(org-footnote ((,c :inherit link))) + `(org-footnote ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(org-formula ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-table-formula))) - `(org-headline-done ((,c :inherit org-done))) - `(org-headline-todo ((,c :inherit org-todo))) + `(org-headline-done ((,c :foreground ,prose-done))) + `(org-headline-todo ((,c :foreground ,prose-todo))) `(org-hide ((,c :foreground ,bg-main))) - `(org-indent ((,c :inherit (fixed-pitch org-hide)))) - `(org-imminent-deadline ((,c :inherit bold :foreground ,date-deadline))) + `(org-indent ((,c :inherit fixed-pitch :foreground ,bg-main))) + `(org-imminent-deadline ((,c :inherit modus-themes-bold :foreground ,date-deadline))) `(org-latex-and-related ((,c :foreground ,type))) `(org-level-1 ((,c :inherit modus-themes-heading-1))) `(org-level-2 ((,c :inherit modus-themes-heading-2))) @@ -3408,65 +6319,66 @@ FG and BG are the main colors." `(org-level-6 ((,c :inherit modus-themes-heading-6))) `(org-level-7 ((,c :inherit modus-themes-heading-7))) `(org-level-8 ((,c :inherit modus-themes-heading-8))) - `(org-link ((,c :inherit link))) - `(org-list-dt ((,c :inherit bold))) - `(org-macro ((,c :inherit modus-themes-prose-macro))) + `(org-link ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(org-list-dt ((,c :inherit modus-themes-bold :foreground ,fg-alt))) + `(org-macro ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-macro :foreground ,fg-prose-macro))) `(org-meta-line ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata))) `(org-mode-line-clock (( ))) - `(org-mode-line-clock-overrun ((,c :inherit bold :foreground ,modeline-err))) + `(org-mode-line-clock-overrun ((,c :inherit modus-themes-bold :foreground ,modeline-err))) `(org-priority ((,c :foreground ,prose-tag))) `(org-property-value ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata-value))) - `(org-quote ((,c :inherit org-block))) + `(org-quote ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-contents :extend t))) `(org-scheduled ((,c :foreground ,date-scheduled-subtle))) `(org-scheduled-previously ((,c :inherit (bold org-scheduled-today)))) `(org-scheduled-today ((,c :foreground ,date-scheduled))) `(org-sexp-date ((,c :foreground ,date-common))) - `(org-special-keyword ((,c :inherit org-drawer))) + `(org-special-keyword ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-metadata))) `(org-table ((,c :inherit modus-themes-fixed-pitch :foreground ,prose-table))) - `(org-table-header ((,c :inherit (bold org-table)))) + `(org-table-header ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,prose-table))) `(org-tag ((,c :foreground ,prose-tag))) - `(org-tag-group ((,c :inherit (bold org-tag)))) - `(org-target ((,c :underline t))) + `(org-tag-group ((,c :inherit modus-themes-bold :foreground ,prose-tag))) + `(org-target ((,c :inherit underline))) `(org-time-grid ((,c :foreground ,fg-dim))) `(org-todo ((,c :foreground ,prose-todo))) `(org-upcoming-deadline ((,c :foreground ,date-deadline-subtle))) `(org-upcoming-distant-deadline ((,c :foreground ,fg-main))) - `(org-verbatim ((,c :inherit modus-themes-prose-verbatim))) - `(org-verse ((,c :inherit org-block))) - `(org-warning ((,c :inherit warning))) + `(org-verbatim ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(org-verse ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-block-contents :extend t))) + `(org-warning ((,c :foreground ,warning))) ;;;;; org-habit - `(org-habit-alert-face ((,c :background ,bg-graph-yellow-0 :foreground "#000000"))) ; fg is special case - `(org-habit-alert-future-face ((,c :background ,bg-graph-yellow-1))) - `(org-habit-clear-face ((,c :background ,bg-graph-blue-0 :foreground "#000000"))) ; fg is special case - `(org-habit-clear-future-face ((,c :background ,bg-graph-blue-1))) - `(org-habit-overdue-face ((,c :background ,bg-graph-red-0))) - `(org-habit-overdue-future-face ((,c :background ,bg-graph-red-1))) - `(org-habit-ready-face ((,c :background ,bg-graph-green-0 :foreground "#000000"))) ; fg is special case - `(org-habit-ready-future-face ((,c :background ,bg-graph-green-1))) + ;; NOTE 2025-10-24: All foregrounds here are a special case. + `(org-habit-alert-face ((,c :background ,bg-graph-yellow-0 :foreground ,(readable-foreground-color bg-graph-yellow-0)))) + `(org-habit-alert-future-face ((,c :background ,bg-graph-yellow-1 :foreground ,(readable-foreground-color bg-graph-yellow-1)))) + `(org-habit-clear-face ((,c :background ,bg-graph-blue-0 :foreground ,(readable-foreground-color bg-graph-blue-0)))) + `(org-habit-clear-future-face ((,c :background ,bg-graph-blue-1 :foreground ,(readable-foreground-color bg-graph-blue-1)))) + `(org-habit-overdue-face ((,c :background ,bg-graph-red-0 :foreground ,(readable-foreground-color bg-graph-red-0)))) + `(org-habit-overdue-future-face ((,c :background ,bg-graph-red-1 :foreground ,(readable-foreground-color bg-graph-red-1)))) + `(org-habit-ready-face ((,c :background ,bg-graph-green-0 :foreground ,(readable-foreground-color bg-graph-green-0)))) + `(org-habit-ready-future-face ((,c :background ,bg-graph-green-1 :foreground ,(readable-foreground-color bg-graph-green-1)))) ;;;;; org-journal `(org-journal-calendar-entry-face ((,c :inherit modus-themes-slant :foreground ,date-common))) - `(org-journal-calendar-scheduled-face ((,c :inherit (modus-themes-slant org-scheduled)))) + `(org-journal-calendar-scheduled-face ((,c :inherit modus-themes-slant :foreground ,date-scheduled-subtle))) `(org-journal-highlight ((,c :foreground ,err))) ;;;;; org-noter - `(org-noter-no-notes-exist-face ((,c :inherit error))) - `(org-noter-notes-exist-face ((,c :inherit success))) + `(org-noter-no-notes-exist-face ((,c :foreground ,err))) + `(org-noter-notes-exist-face ((,c :foreground ,info))) ;;;;; org-pomodoro `(org-pomodoro-mode-line ((,c :foreground ,err))) `(org-pomodoro-mode-line-break ((,c :foreground ,info))) - `(org-pomodoro-mode-line-overtime ((,c :inherit error))) + `(org-pomodoro-mode-line-overtime ((,c :foreground ,err))) ;;;;; org-recur `(org-recur ((,c :foreground ,fg-alt))) ;;;;; org-roam `(org-roam-dim ((,c :foreground "gray50"))) - `(org-roam-olp ((,c :inherit shadow))) + `(org-roam-olp ((,c :foreground ,fg-dim))) `(org-roam-preview-heading ((,c :background ,bg-inactive))) `(org-roam-preview-heading-highlight ((,c :background ,bg-active :foreground ,fg-main))) `(org-roam-preview-region ((,c :inherit bold))) - `(org-roam-title ((,c :inherit bold))) + `(org-roam-title ((,c :inherit modus-themes-bold))) ;;;;; org-superstar `(org-superstar-item ((,c :foreground ,fg-main))) ;;;;; org-tree-slide - `(org-tree-slide-header-overlay-face ((,c :inherit org-document-title))) + `(org-tree-slide-header-overlay-face ((,c :inherit modus-themes-heading-0))) ;;;;; origami `(origami-fold-header-face ((,c :background ,bg-dim :foreground ,fg-dim :box t))) `(origami-fold-replacement-face ((,c :background ,bg-inactive :foreground ,fg-dim))) @@ -3483,109 +6395,129 @@ FG and BG are the main colors." `(outline-minor-0 (())) ;;;;; package (M-x list-packages) `(package-description ((,c :foreground ,docstring))) - `(package-help-section-name ((,c :inherit bold))) - `(package-name ((,c :inherit link))) + `(package-help-section-name ((,c :inherit modus-themes-bold))) + `(package-mark-delete-line ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) + `(package-mark-install-line ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) + `(package-name ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) `(package-status-available ((,c :foreground ,date-common))) - `(package-status-avail-obso ((,c :inherit error))) + `(package-status-avail-obso ((,c :foreground ,err))) `(package-status-built-in ((,c :foreground ,builtin))) `(package-status-dependency ((,c :foreground ,warning))) - `(package-status-disabled ((,c :inherit error :strike-through t))) + `(package-status-disabled ((,c :foreground ,err :strike-through t))) `(package-status-from-source ((,c :foreground ,type))) `(package-status-held ((,c :foreground ,warning))) - `(package-status-incompat ((,c :inherit warning))) + `(package-status-incompat ((,c :foreground ,warning))) `(package-status-installed ((,c :foreground ,fg-alt))) - `(package-status-new ((,c :inherit success))) - `(package-status-unsigned ((,c :inherit error))) + `(package-status-new ((,c :foreground ,info))) + `(package-status-unsigned ((,c :foreground ,err))) ;;;;; page-break-lines `(page-break-lines ((,c :inherit default :foreground "gray50"))) ;;;;; pandoc-mode - `(pandoc-citation-key-face ((,c :inherit font-lock-builtin-face))) - `(pandoc-directive-@@-face ((,c :inherit font-lock-keyword-face))) - `(pandoc-directive-braces-face ((,c :inherit font-lock-constant-face))) - `(pandoc-directive-contents-face ((,c :inherit font-lock-string-face))) - `(pandoc-directive-type-face ((,c :inherit font-lock-type-face))) + `(pandoc-citation-key-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(pandoc-directive-@@-face ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(pandoc-directive-braces-face ((,c :foreground ,constant))) + `(pandoc-directive-contents-face ((,c :foreground ,string))) + `(pandoc-directive-type-face ((,c :inherit modus-themes-bold :foreground ,type))) ;;;;; paren-face - `(parenthesis ((,c :inherit shadow))) + `(parenthesis ((,c :foreground ,fg-dim))) ;;;;; pass - `(pass-mode-directory-face ((,c :inherit bold :foreground ,accent-0))) + `(pass-mode-directory-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) `(pass-mode-entry-face ((,c :background ,bg-main :foreground ,fg-main))) - `(pass-mode-header-face ((,c :inherit shadow))) + `(pass-mode-header-face ((,c :foreground ,fg-dim))) ;;;;; pdf-tools - `(pdf-links-read-link ((,c :background ,fg-main :foreground ,bg-magenta-intense :inherit bold))) ; Foreground is background and vice versa - `(pdf-occur-document-face ((,c :inherit shadow))) - `(pdf-occur-page-face ((,c :inherit shadow))) + `(pdf-links-read-link ((,c :inherit modus-themes-bold :background ,fg-main :foreground ,bg-magenta-intense))) ; Foreground is background and vice versa + `(pdf-occur-document-face ((,c :foreground ,fg-dim))) + `(pdf-occur-page-face ((,c :foreground ,fg-dim))) ;;;;; persp-mode - `(persp-face-lighter-buffer-not-in-persp ((,c :inherit error))) - `(persp-face-lighter-default ((,c :inherit bold :foreground ,name))) - `(persp-face-lighter-nil-persp ((,c :inherit bold))) + `(persp-face-lighter-buffer-not-in-persp ((,c :foreground ,err))) + `(persp-face-lighter-default ((,c :inherit modus-themes-bold :foreground ,name))) + `(persp-face-lighter-nil-persp ((,c :inherit modus-themes-bold))) ;;;;; perspective - `(persp-selected-face ((,c :inherit bold :foreground ,name))) + `(persp-selected-face ((,c :inherit modus-themes-bold :foreground ,name))) ;;;;; proced `(proced-cpu ((,c :foreground ,keyword))) `(proced-emacs-pid ((,c :foreground ,identifier :underline t))) `(proced-executable ((,c :foreground ,name))) - `(proced-interruptible-sleep-status-code ((,c :inherit shadow))) + `(proced-interruptible-sleep-status-code ((,c :foreground ,fg-dim))) `(proced-mem ((,c :foreground ,type))) `(proced-memory-high-usage ((,c :foreground ,err))) `(proced-memory-low-usage ((,c :foreground ,info))) `(proced-memory-medium-usage ((,c :foreground ,warning))) - `(proced-pgrp ((,c :inherit proced-pid))) + `(proced-pgrp ((,c :foreground ,identifier))) `(proced-pid ((,c :foreground ,identifier))) - `(proced-ppid ((,c :inherit proced-pid))) - `(proced-run-status-code ((,c :inherit success))) - `(proced-sess ((,c :inherit proced-pid))) - `(proced-session-leader-pid ((,c :inherit bold :foreground ,identifier))) + `(proced-ppid ((,c :foreground ,identifier))) + `(proced-run-status-code ((,c :foreground ,info))) + `(proced-sess ((,c :foreground ,identifier))) + `(proced-session-leader-pid ((,c :inherit modus-themes-bold :foreground ,identifier))) `(proced-time-colon (( ))) - `(proced-uninterruptible-sleep-status-code ((,c :inherit error))) + `(proced-uninterruptible-sleep-status-code ((,c :foreground ,err))) `(proced-user (( ))) ;;;;; popup `(popup-face ((,c :background ,bg-inactive :foreground ,fg-main))) - `(popup-isearch-match ((,c :inherit modus-themes-search-current))) - `(popup-menu-mouse-face ((,c :inherit highlight))) + `(popup-isearch-match ((,c :background ,bg-search-current :foreground ,fg-main))) + `(popup-menu-mouse-face ((,c :background ,bg-hover :foreground ,fg-main))) `(popup-menu-selection-face ((,c :inherit modus-themes-completion-selected))) `(popup-scroll-bar-background-face ((,c :background ,bg-active))) `(popup-scroll-bar-foreground-face (( ))) `(popup-summary-face ((,c :background ,bg-active :foreground ,fg-dim))) - `(popup-tip-face ((,c :inherit modus-themes-intense-yellow))) + `(popup-tip-face ((,c :background ,bg-yellow-intense :foreground ,fg-main))) ;;;;; powerline `(powerline-active0 ((,c :background ,fg-dim :foreground ,bg-main))) - `(powerline-active1 ((,c :inherit mode-line))) - `(powerline-active2 ((,c :inherit mode-line-inactive))) + `(powerline-active1 + ((default :inherit modus-themes-ui-variable-pitch + :background ,bg-mode-line-active + :foreground ,fg-mode-line-active) + (((supports :box t)) + :box ,border-mode-line-active) + (t :underline ,border-mode-line-active))) + `(powerline-active2 + ((default :inherit modus-themes-ui-variable-pitch + :background ,bg-mode-line-inactive + :foreground ,fg-mode-line-inactive) + (((supports :box t)) + :box ,border-mode-line-inactive) + (t :underline ,border-mode-line-inactive))) `(powerline-inactive0 ((,c :background ,bg-active :foreground ,fg-dim))) `(powerline-inactive1 ((,c :background ,bg-main :foreground ,fg-dim))) - `(powerline-inactive2 ((,c :inherit mode-line-inactive))) + `(powerline-inactive2 + ((default :inherit modus-themes-ui-variable-pitch + :background ,bg-mode-line-inactive + :foreground ,fg-mode-line-inactive) + (((supports :box t)) + :box ,border-mode-line-inactive) + (t :underline ,border-mode-line-inactive))) ;;;;; powerline-evil `(powerline-evil-base-face ((,c :background ,fg-main :foreground ,bg-main))) - `(powerline-evil-emacs-face ((,c :inherit bold :background ,bg-main))) - `(powerline-evil-insert-face ((,c :inherit success :background ,bg-main))) - `(powerline-evil-motion-face ((,c :inherit italic :background ,bg-main))) + `(powerline-evil-emacs-face ((,c :inherit modus-themes-bold :background ,bg-main))) + `(powerline-evil-insert-face ((,c :background ,bg-main :foreground ,info))) + `(powerline-evil-motion-face ((,c :inherit modus-themes-slant :background ,bg-main))) `(powerline-evil-normal-face ((,c :background ,bg-main :foreground ,fg-alt))) - `(powerline-evil-operator-face ((,c :inherit warning :background ,bg-main))) - `(powerline-evil-replace-face ((,c :inherit error :background ,bg-main))) - `(powerline-evil-visual-face ((,c :inherit bold :background ,bg-main))) + `(powerline-evil-operator-face ((,c :background ,bg-main :foreground ,warning))) + `(powerline-evil-replace-face ((,c :background ,bg-main :foreground ,err))) + `(powerline-evil-visual-face ((,c :inherit modus-themes-bold :background ,bg-main))) ;;;;; prescient `(prescient-primary-highlight ((,c :inherit modus-themes-completion-match-0))) `(prescient-secondary-highlight ((,c :inherit modus-themes-completion-match-1))) ;;;;; proced - `(proced-mark ((,c :inherit bold))) - `(proced-marked ((,c :inherit modus-themes-mark-alt))) - `(proced-sort-header ((,c :inherit bold :underline t))) + `(proced-mark ((,c :inherit modus-themes-bold))) + `(proced-marked ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) + `(proced-sort-header ((,c :inherit modus-themes-bold :underline t))) ;;;;; prodigy - `(prodigy-green-face ((,c :inherit success))) - `(prodigy-red-face ((,c :inherit error))) - `(prodigy-yellow-face ((,c :inherit warning))) + `(prodigy-green-face ((,c :foreground ,info))) + `(prodigy-red-face ((,c :foreground ,err))) + `(prodigy-yellow-face ((,c :foreground ,warning))) ;;;;; pulse `(pulse-highlight-start-face ((,c :background ,bg-blue-intense :extend t))) ;;;;; pyim `(pyim-page ((,c :background ,bg-active))) - `(pyim-page-selection ((,c :inherit bold :background ,bg-active :foreground ,info))) + `(pyim-page-selection ((,c :inherit modus-themes-bold :background ,bg-active :foreground ,info))) `(pyim-page-subword ((,c :background ,bg-inactive))) ;;;;; quick-peek `(quick-peek-background-face ((,c :background ,bg-inactive))) `(quick-peek-border-face ((,c :background ,border :height 1))) `(quick-peek-padding-face ((,c :background ,bg-inactive :height 0.15))) ;;;;; rainbow-delimiters - `(rainbow-delimiters-base-error-face ((,c :inherit modus-themes-prominent-error))) + `(rainbow-delimiters-base-error-face ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) `(rainbow-delimiters-base-face ((,c :foreground ,fg-main))) `(rainbow-delimiters-depth-1-face ((,c :foreground ,rainbow-0))) `(rainbow-delimiters-depth-2-face ((,c :foreground ,rainbow-1))) @@ -3596,50 +6528,50 @@ FG and BG are the main colors." `(rainbow-delimiters-depth-7-face ((,c :foreground ,rainbow-6))) `(rainbow-delimiters-depth-8-face ((,c :foreground ,rainbow-7))) `(rainbow-delimiters-depth-9-face ((,c :foreground ,rainbow-8))) - `(rainbow-delimiters-mismatched-face ((,c :inherit (bold modus-themes-prominent-warning)))) - `(rainbow-delimiters-unmatched-face ((,c :inherit (bold modus-themes-prominent-error)))) + `(rainbow-delimiters-mismatched-face ((,c :background ,bg-prominent-warning :foreground ,fg-prominent-warning))) + `(rainbow-delimiters-unmatched-face ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) ;;;;; rcirc - `(rcirc-bright-nick ((,c :inherit bold :foreground ,accent-2))) - `(rcirc-dim-nick ((,c :inherit shadow))) + `(rcirc-bright-nick ((,c :inherit modus-themes-bold :foreground ,accent-2))) + `(rcirc-dim-nick ((,c :foreground ,fg-dim))) `(rcirc-monospace-text ((,c :inherit fixed-pitch))) - `(rcirc-my-nick ((,c :inherit bold :foreground ,accent-1))) - `(rcirc-nick-in-message ((,c :inherit rcirc-my-nick))) - `(rcirc-nick-in-message-full-line ((,c :inherit rcirc-my-nick))) - `(rcirc-other-nick ((,c :inherit bold :foreground ,accent-0))) - `(rcirc-prompt ((,c :inherit minibuffer-prompt))) - `(rcirc-server ((,c :inherit font-lock-comment-face))) + `(rcirc-my-nick ((,c :inherit modus-themes-bold :foreground ,accent-1))) + `(rcirc-nick-in-message ((,c :inherit modus-themes-bold :foreground ,accent-1))) + `(rcirc-nick-in-message-full-line ((,c :inherit modus-themes-bold :foreground ,accent-1))) + `(rcirc-other-nick ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(rcirc-prompt ((,c :inherit modus-themes-prompt))) + `(rcirc-server ((,c :inherit modus-themes-slant :foreground ,comment))) `(rcirc-timestamp ((,c :foreground ,date-common))) - `(rcirc-track-keyword ((,c :inherit bold :foreground ,modeline-warning))) - `(rcirc-track-nick ((,c :inherit rcirc-my-nick))) - `(rcirc-url ((,c :inherit link))) + `(rcirc-track-keyword ((,c :inherit modus-themes-bold :foreground ,modeline-warning))) + `(rcirc-track-nick ((,c :inherit modus-themes-bold :foreground ,accent-1))) + `(rcirc-url ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) ;;;;; recursion-indicator `(recursion-indicator-general ((,c :foreground ,modeline-err))) `(recursion-indicator-minibuffer ((,c :foreground ,modeline-info))) ;;;;; regexp-builder (re-builder) - `(reb-match-0 ((,c :inherit modus-themes-search-rx-group-0))) - `(reb-match-1 ((,c :inherit modus-themes-search-rx-group-1))) - `(reb-match-2 ((,c :inherit modus-themes-search-rx-group-2))) - `(reb-match-3 ((,c :inherit modus-themes-search-rx-group-3))) - `(reb-regexp-grouping-backslash ((,c :inherit font-lock-regexp-grouping-backslash))) - `(reb-regexp-grouping-construct ((,c :inherit font-lock-regexp-grouping-construct))) + `(reb-match-0 ((,c :background ,bg-search-rx-group-0 :foreground ,fg-main))) + `(reb-match-1 ((,c :background ,bg-search-rx-group-1 :foreground ,fg-main))) + `(reb-match-2 ((,c :background ,bg-search-rx-group-2 :foreground ,fg-main))) + `(reb-match-3 ((,c :background ,bg-search-rx-group-3 :foreground ,fg-main))) + `(reb-regexp-grouping-backslash ((,c :inherit modus-themes-bold :foreground ,rx-backslash))) + `(reb-regexp-grouping-construct ((,c :inherit modus-themes-bold :foreground ,rx-construct))) ;;;;; rg (rg.el) - `(rg-column-number-face ((,c :inherit shadow))) - `(rg-context-face ((,c :inherit shadow))) - `(rg-error-face ((,c :inherit error))) - `(rg-file-tag-face ((,c :inherit font-lock-builtin-face))) - `(rg-filename-face ((,c :inherit bold :foreground ,name))) - `(rg-line-number-face ((,c :inherit shadow))) - `(rg-literal-face ((,c :inherit font-lock-constant-face))) - `(rg-match-face ((,c :inherit match))) + `(rg-column-number-face ((,c :foreground ,fg-dim))) + `(rg-context-face ((,c :foreground ,fg-dim))) + `(rg-error-face ((,c :foreground ,err))) + `(rg-file-tag-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(rg-filename-face ((,c :inherit modus-themes-bold :foreground ,name))) + `(rg-line-number-face ((,c :foreground ,fg-dim))) + `(rg-literal-face ((,c :foreground ,constant))) + `(rg-match-face ((,c :background ,bg-search-static :foreground ,fg-main))) `(rg-regexp-face ((,c :foreground ,name))) - `(rg-toggle-off-face ((,c :inherit (shadow bold)))) - `(rg-toggle-on-face ((,c :inherit success))) - `(rg-warning-face ((,c :inherit warning))) + `(rg-toggle-off-face ((,c :inherit modus-themes-bold :foreground ,fg-dim))) + `(rg-toggle-on-face ((,c :foreground ,info))) + `(rg-warning-face ((,c :foreground ,warning))) ;;;;; ripgrep - `(ripgrep-context-face ((,c :inherit shadow))) - `(ripgrep-error-face ((,c :inherit error))) - `(ripgrep-hit-face ((,c :inherit success))) - `(ripgrep-match-face ((,c :inherit match))) + `(ripgrep-context-face ((,c :foreground ,fg-dim))) + `(ripgrep-error-face ((,c :foreground ,err))) + `(ripgrep-hit-face ((,c :foreground ,info))) + `(ripgrep-match-face ((,c :background ,bg-search-static :foreground ,fg-main))) ;;;;; rmail `(rmail-header-name ((,c :inherit bold))) `(rmail-highlight ((,c :inherit bold :foreground ,mail-other))) @@ -3651,133 +6583,140 @@ FG and BG are the main colors." `(rst-level-5 ((,c :inherit modus-themes-heading-5))) `(rst-level-6 ((,c :inherit modus-themes-heading-6))) ;;;;; ruler-mode - `(ruler-mode-column-number ((,c :inherit ruler-mode-default))) - `(ruler-mode-comment-column ((,c :inherit ruler-mode-default :foreground ,red))) - `(ruler-mode-current-column ((,c :inherit ruler-mode-default :background ,bg-active :foreground ,fg-main))) + ;; NOTE 2025-10-24: All the faces of `ruler-mode' need to inherit + ;; from `default' to yield the expected results. Otherwise the + ;; ruler is shorter. I am not sure what is happening, but it + ;; seems important. Its default face definitions also inherit + ;; from `default' and then from `ruler-mode-default'. + `(ruler-mode-column-number ((,c :inherit default :background ,bg-dim :foreground ,fg-dim))) + `(ruler-mode-comment-column ((,c :inherit default :foreground ,info))) + `(ruler-mode-current-column ((,c :inherit default :background ,bg-active :foreground ,fg-main))) `(ruler-mode-default ((,c :inherit default :background ,bg-dim :foreground ,fg-dim))) - `(ruler-mode-fill-column ((,c :inherit ruler-mode-default :foreground ,green))) - `(ruler-mode-fringes ((,c :inherit ruler-mode-default :foreground ,cyan))) - `(ruler-mode-goal-column ((,c :inherit ruler-mode-default :foreground ,blue))) - `(ruler-mode-margins ((,c :inherit ruler-mode-default :foreground ,bg-main))) - `(ruler-mode-pad ((,c :inherit ruler-mode-default :background ,bg-inactive :foreground ,fg-dim))) - `(ruler-mode-tab-stop ((,c :inherit ruler-mode-default :foreground ,yellow))) + `(ruler-mode-fill-column ((,c :inherit default :foreground ,info))) + `(ruler-mode-fringes ((,c :inherit default :foreground ,fg-dim))) + `(ruler-mode-goal-column ((,c :inherit default :foreground ,info))) + `(ruler-mode-margins ((,c :inherit default :foreground ,bg-main))) + `(ruler-mode-pad ((,c :inherit default :background ,bg-inactive :foreground ,fg-dim))) + `(ruler-mode-tab-stop ((,c :inherit default :foreground ,warning))) ;;;;; sesman - `(sesman-browser-button-face ((,c :inherit button))) - `(sesman-browser-highligh-face ((,c :inherit highlight))) + `(sesman-browser-button-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(sesman-browser-highligh-face ((,c :background ,bg-hover :foreground ,fg-main))) `(sesman-buffer-face ((,c :foreground ,accent-1))) - `(sesman-directory-face ((,c :inherit bold :foreground ,accent-0))) - `(sesman-project-face ((,c :inherit bold :foreground ,accent-2))) + `(sesman-directory-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) + `(sesman-project-face ((,c :inherit modus-themes-bold :foreground ,accent-2))) ;;;;; shell-script-mode - `(sh-heredoc ((,c :inherit font-lock-string-face))) - `(sh-quoted-exec ((,c :inherit font-lock-builtin-face))) + `(sh-heredoc ((,c :foreground ,string))) + `(sh-quoted-exec ((,c :inherit modus-themes-bold :foreground ,builtin))) ;;;;; shortdoc - `(shortdoc-heading ((,c :inherit bold))) + `(shortdoc-heading ((,c :inherit modus-themes-heading-1))) `(shortdoc-section (())) ; remove the default's variable-pitch style ;;;;; show-paren-mode `(show-paren-match ((,c :background ,bg-paren-match :foreground ,fg-paren-match :underline ,underline-paren-match))) `(show-paren-match-expression ((,c :background ,bg-paren-expression))) - `(show-paren-mismatch ((,c :inherit modus-themes-prominent-error))) + `(show-paren-mismatch ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) ;;;;; shr - `(shr-abbreviation ((,c :inherit modus-themes-lang-note))) - `(shr-code ((,c :inherit modus-themes-prose-verbatim))) + `(shr-abbreviation ((,c :underline (:style wave :color ,underline-note)))) + `(shr-code ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) `(shr-h1 ((,c :inherit modus-themes-heading-1))) `(shr-h2 ((,c :inherit modus-themes-heading-2))) `(shr-h3 ((,c :inherit modus-themes-heading-3))) `(shr-h4 ((,c :inherit modus-themes-heading-4))) `(shr-h5 ((,c :inherit modus-themes-heading-5))) `(shr-h6 ((,c :inherit modus-themes-heading-6))) - `(shr-mark ((,c :inherit match))) - `(shr-selected-link ((,c :inherit modus-themes-mark-sel))) + `(shr-mark ((,c :background ,bg-search-static :foreground ,fg-main))) + `(shr-selected-link ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) ;;;;; side-notes `(side-notes ((,c :background ,bg-dim :foreground ,fg-dim))) ;;;;; sieve-mode - `(sieve-action-commands ((,c :inherit font-lock-builtin-face))) - `(sieve-control-commands ((,c :inherit font-lock-keyword-face))) - `(sieve-tagged-arguments ((,c :inherit font-lock-type-face))) - `(sieve-test-commands ((,c :inherit font-lock-function-name-face))) + `(sieve-action-commands ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(sieve-control-commands ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(sieve-tagged-arguments ((,c :inherit modus-themes-bold :foreground ,type))) + `(sieve-test-commands ((,c :foreground ,fnname))) ;;;;; skewer-mode - `(skewer-error-face ((,c :inherit modus-themes-lang-error))) + `(skewer-error-face ((,c :underline (:style wave :color ,underline-err)))) ;;;;; slime (sldb) - `(sldb-condition-face ((,c :inherit font-lock-preprocessor-face))) - `(sldb-restart-number-face ((,c :inherit bold))) - `(sldb-restart-type-face ((,c :inherit font-lock-type-face))) - `(sldb-restartable-frame-line-face ((,c :inherit success))) - `(sldb-section-face ((,c :inherit bold))) - `(slime-error-face ((,c :inherit modus-themes-lang-error))) - `(slime-note-face ((,c :underline t))) - `(slime-repl-input-face ((,c :inherit bold))) - `(slime-repl-inputed-output-face ((,c :inherit font-lock-string-face))) - `(slime-repl-output-mouseover-face ((,c :inherit highlight))) + `(sldb-condition-face ((,c :foreground ,preprocessor))) + `(sldb-restart-number-face ((,c :inherit modus-themes-bold))) + `(sldb-restart-type-face ((,c :inherit modus-themes-bold :foreground ,type))) + `(sldb-restartable-frame-line-face ((,c :foreground ,info))) + `(sldb-section-face ((,c :inherit modus-themes-bold))) + `(slime-error-face ((,c :underline (:style wave :color ,underline-err)))) + `(slime-note-face ((,c :inherit underline))) + `(slime-repl-input-face ((,c :inherit modus-themes-bold))) + `(slime-repl-inputed-output-face ((,c :foreground ,string))) + `(slime-repl-output-mouseover-face ((,c :background ,bg-hover :foreground ,fg-main))) `(slime-repl-prompt-face ((,c :inherit modus-themes-prompt))) - `(slime-style-warning-face ((,c :inherit modus-themes-lang-note))) - `(slime-warning-face ((,c :inherit modus-themes-lang-warning))) + `(slime-style-warning-face ((,c :underline (:style wave :color ,underline-note)))) + `(slime-warning-face ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; sly - `(sly-action-face ((,c :inherit font-lock-type-face))) - `(sly-db-condition-face ((,c :inherit font-lock-preprocessor-face))) - `(sly-db-restartable-frame-line-face ((,c :inherit success))) - `(sly-error-face ((,c :inherit modus-themes-lang-error))) - `(sly-mode-line ((,c :inherit mode-line-emphasis))) - `(sly-mrepl-output-face ((,c :inherit font-lock-string-face))) - `(sly-mrepl-output-face ((,c :inherit font-lock-string-face))) + `(sly-action-face ((,c :inherit modus-themes-bold :foreground ,type))) + `(sly-db-condition-face ((,c :foreground ,preprocessor))) + `(sly-db-restartable-frame-line-face ((,c :foreground ,info))) + `(sly-error-face ((,c :underline (:style wave :color ,underline-err)))) + `(sly-mode-line ((,c :inherit italic :foreground ,modeline-info))) + `(sly-mrepl-output-face ((,c :foreground ,string))) + `(sly-mrepl-output-face ((,c :foreground ,string))) `(sly-mrepl-prompt-face ((,c :inherit modus-themes-prompt))) - `(sly-note-face ((,c :inherit modus-themes-lang-note))) + `(sly-note-face ((,c :underline (:style wave :color ,underline-note)))) `(sly-stickers-placed-face ((,c :background ,bg-inactive))) - `(sly-style-warning-face ((,c :inherit modus-themes-lang-note))) - `(sly-warning-face ((,c :inherit modus-themes-lang-warning))) + `(sly-style-warning-face ((,c :underline (:style wave :color ,underline-note)))) + `(sly-warning-face ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; smart-mode-line `(sml/charging ((,c :foreground ,info))) `(sml/discharging ((,c :foreground ,err))) - `(sml/filename ((,c :inherit bold :foreground ,name))) + `(sml/filename ((,c :inherit modus-themes-bold :foreground ,name))) `(sml/folder (( ))) - `(sml/git ((,c :inherit success))) + `(sml/git ((,c :foreground ,info))) `(sml/global (( ))) - `(sml/line-number ((,c :inherit sml/global))) - `(sml/minor-modes ((,c :inherit sml/global))) - `(sml/modes ((,c :inherit bold))) - `(sml/modified ((,c :inherit italic))) - `(sml/mule-info ((,c :inherit sml/global))) - `(sml/name-filling ((,c :inherit warning))) - `(sml/not-modified ((,c :inherit sml/global))) - `(sml/numbers-separator ((,c :inherit sml/global))) - `(sml/outside-modified ((,c :inherit modus-themes-prominent-error))) - `(sml/position-percentage ((,c :inherit sml/global))) + `(sml/line-number (( ))) + `(sml/minor-modes (( ))) + `(sml/modes ((,c :inherit modus-themes-bold))) + `(sml/modified ((,c :inherit modus-themes-slant))) + `(sml/mule-info (( ))) + `(sml/name-filling ((,c :foreground ,warning))) + `(sml/not-modified (( ))) + `(sml/numbers-separator (( ))) + `(sml/outside-modified ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) + `(sml/position-percentage (( ))) `(sml/prefix ((,c :foreground ,fg-alt))) - `(sml/process ((,c :inherit sml/prefix))) - `(sml/projectile ((,c :inherit sml/git))) + `(sml/process ((,c :foreground ,fg-alt))) + `(sml/projectile ((,c :foreground ,info))) `(sml/read-only (( ))) - `(sml/remote ((,c :inherit sml/global))) - `(sml/sudo ((,c :inherit warning))) - `(sml/time ((,c :inherit sml/global))) - `(sml/vc ((,c :inherit sml/git))) - `(sml/vc-edited ((,c :inherit italic))) + `(sml/remote (( ))) + `(sml/sudo ((,c :foreground ,warning))) + `(sml/time (( ))) + `(sml/vc ((,c :foreground ,info))) + `(sml/vc-edited ((,c :inherit modus-themes-slant))) ;;;;; smerge - `(smerge-base ((,c :inherit diff-changed))) - `(smerge-lower ((,c :inherit diff-added))) - `(smerge-markers ((,c :inherit diff-header))) - `(smerge-refined-added ((,c :inherit diff-refine-added))) - `(smerge-refined-changed (())) - `(smerge-refined-removed ((,c :inherit diff-refine-removed))) - `(smerge-upper ((,c :inherit diff-removed))) + `(smerge-base ((,c :background ,bg-changed :foreground ,fg-changed :extend t))) + `(smerge-lower ((,c :background ,bg-added :foreground ,fg-added :extend t))) + `(smerge-markers (( ))) + `(smerge-refined-added ((,c :background ,bg-added-refine :foreground ,fg-added))) + `(smerge-refined-changed ((,c :background ,bg-changed-refine :foreground ,fg-changed))) + `(smerge-refined-removed ((,c :background ,bg-removed-refine :foreground ,fg-removed))) + `(smerge-upper ((,c :background ,bg-removed :foreground ,fg-removed :extend t))) ;;;;; spacious-padding + `(spacious-padding-line-active ((,c :foreground ,accent-0))) + `(spacious-padding-line-inactive ((,c :foreground ,border))) `(spacious-padding-subtle-mode-line-active ((,c :foreground ,accent-0))) `(spacious-padding-subtle-mode-line-inactive ((,c :foreground ,border))) ;;;;; speedbar - `(speedbar-button-face ((,c :inherit button))) - `(speedbar-directory-face ((,c :inherit bold :foreground ,accent-0))) + `(speedbar-button-face ((,c :background ,bg-link :foreground ,fg-link :underline ,underline-link))) + `(speedbar-directory-face ((,c :inherit modus-themes-bold :foreground ,accent-0))) `(speedbar-file-face ((,c :foreground ,fg-main))) - `(speedbar-highlight-face ((,c :inherit highlight))) - `(speedbar-selected-face ((,c :inherit modus-themes-mark-sel))) + `(speedbar-highlight-face ((,c :background ,bg-hover :foreground ,fg-main))) + `(speedbar-selected-face ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) `(speedbar-separator-face ((,c :background ,bg-active :foreground ,fg-main))) `(speedbar-tag-face ((,c :foreground ,accent-1))) ;;;;; spell-fu - `(spell-fu-incorrect-face ((,c :inherit modus-themes-lang-error))) + `(spell-fu-incorrect-face ((,c :underline (:style wave :color ,underline-err)))) ;;;;; stripes `(stripes ((,c :background ,bg-inactive))) ;;;;; suggest - `(suggest-heading ((,c :inherit warning))) + `(suggest-heading ((,c :foreground ,warning))) ;;;;; switch-window `(switch-window-background ((,c :background ,bg-inactive))) - `(switch-window-label ((,c :height 3.0 :foreground ,red-intense))) + `(switch-window-label ((,c :inherit (bold modus-themes-reset-soft) :height 1.5 :foreground ,err))) ; same as `aw-leading-char-face' ;;;;; swiper `(swiper-background-match-face-1 (( ))) `(swiper-background-match-face-2 ((,c :inherit modus-themes-completion-match-0))) @@ -3790,58 +6729,59 @@ FG and BG are the main colors." `(swiper-match-face-4 ((,c :inherit modus-themes-completion-match-2))) ;;;;; symbol-overlay `(symbol-overlay-default-face ((,c :background ,bg-inactive))) - `(symbol-overlay-face-1 ((,c :inherit modus-themes-intense-blue))) - `(symbol-overlay-face-2 ((,c :inherit modus-themes-intense-magenta))) - `(symbol-overlay-face-3 ((,c :inherit modus-themes-intense-yellow))) - `(symbol-overlay-face-4 ((,c :inherit modus-themes-intense-magenta))) - `(symbol-overlay-face-5 ((,c :inherit modus-themes-intense-red))) - `(symbol-overlay-face-6 ((,c :inherit modus-themes-intense-red))) - `(symbol-overlay-face-7 ((,c :inherit modus-themes-intense-cyan))) - `(symbol-overlay-face-8 ((,c :inherit modus-themes-intense-cyan))) + `(symbol-overlay-face-1 ((,c :background ,bg-blue-intense :foreground ,fg-main))) + `(symbol-overlay-face-2 ((,c :background ,bg-magenta-intense :foreground ,fg-main))) + `(symbol-overlay-face-3 ((,c :background ,bg-yellow-intense :foreground ,fg-main))) + `(symbol-overlay-face-4 ((,c :background ,bg-magenta-intense :foreground ,fg-main))) + `(symbol-overlay-face-5 ((,c :background ,bg-red-intense :foreground ,fg-main))) + `(symbol-overlay-face-6 ((,c :background ,bg-red-intense :foreground ,fg-main))) + `(symbol-overlay-face-7 ((,c :background ,bg-cyan-intense :foreground ,fg-main))) + `(symbol-overlay-face-8 ((,c :background ,bg-cyan-intense :foreground ,fg-main))) ;;;;; syslog-mode - `(syslog-debug ((,c :inherit italic))) - `(syslog-error ((,c :inherit error))) - `(syslog-file ((,c :inherit bold :foreground ,name))) + `(syslog-debug ((,c :inherit modus-themes-slant))) + `(syslog-error ((,c :foreground ,err))) + `(syslog-file ((,c :inherit modus-themes-bold :foreground ,name))) `(syslog-hide ((,c :background ,bg-main :foreground ,fg-main))) - `(syslog-hour ((,c :inherit bold :foreground ,date-common))) - `(syslog-info ((,c :inherit success))) - `(syslog-ip ((,c :inherit bold :foreground ,name :underline t))) - `(syslog-su ((,c :inherit error :underline t))) - `(syslog-warn ((,c :inherit warning))) + `(syslog-hour ((,c :inherit modus-themes-bold :foreground ,date-common))) + `(syslog-info ((,c :foreground ,info))) + `(syslog-ip ((,c :inherit modus-themes-bold :foreground ,name :underline t))) + `(syslog-su ((,c :foreground ,err :underline t))) + `(syslog-warn ((,c :foreground ,warning))) ;;;;; tab-bar-mode `(tab-bar ((,c :inherit modus-themes-ui-variable-pitch :background ,bg-tab-bar))) - `(tab-bar-tab-group-current ((,c :inherit bold :background ,bg-tab-current :box (:line-width -2 :color ,bg-tab-current) :foreground ,fg-alt))) + `(tab-bar-tab-group-current ((,c :inherit modus-themes-bold :background ,bg-tab-current :box (:line-width -2 :color ,bg-tab-current) :foreground ,fg-alt))) `(tab-bar-tab-group-inactive ((,c :background ,bg-tab-bar :box (:line-width -2 :color ,bg-tab-bar) :foreground ,fg-alt))) - `(tab-bar-tab ((,c :inherit bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) + `(tab-bar-tab ((,c :inherit modus-themes-bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) + `(tab-bar-tab-highlight ((,c :background ,bg-hover :foreground ,fg-main :box t))) `(tab-bar-tab-inactive ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) - `(tab-bar-tab-ungrouped ((,c :inherit tab-bar-tab-inactive))) + `(tab-bar-tab-ungrouped ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) ;;;;; tab-line-mode `(tab-line ((,c :inherit modus-themes-ui-variable-pitch :background ,bg-tab-bar :height 0.95))) `(tab-line-close-highlight ((,c :foreground ,err))) - `(tab-line-highlight ((,c :inherit highlight))) + `(tab-line-highlight ((,c :background ,bg-hover :foreground ,fg-main))) `(tab-line-tab (( ))) - `(tab-line-tab-current ((,c :inherit bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) + `(tab-line-tab-current ((,c :inherit modus-themes-bold :box (:line-width -2 :color ,bg-tab-current) :background ,bg-tab-current))) `(tab-line-tab-inactive ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other))) - `(tab-line-tab-inactive-alternate ((,c :inherit tab-line-tab-inactive :foreground ,fg-alt))) + `(tab-line-tab-inactive-alternate ((,c :box (:line-width -2 :color ,bg-tab-other) :background ,bg-tab-other :foreground ,fg-alt))) `(tab-line-tab-modified ((,c :foreground ,warning))) ;;;;; table (built-in table.el) `(table-cell ((,c :background ,bg-dim))) ;;;;; telega `(telega-button ((,c :box t :foreground ,fg-link))) `(telega-button-active ((,c :box ,fg-link :background ,fg-link :foreground ,bg-main))) - `(telega-button-highlight ((,c :inherit secondary-selection))) + `(telega-button-highlight ((,c :background ,bg-hover :foreground ,fg-main))) `(telega-chat-prompt ((,c :inherit modus-themes-prompt))) - `(telega-entity-type-code ((,c :inherit modus-themes-prose-verbatim))) - `(telega-entity-type-mention ((,c :foreground ,cyan))) - `(telega-entity-type-pre ((,c :inherit modus-themes-prose-code))) + `(telega-entity-type-code ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-verbatim :foreground ,fg-prose-verbatim))) + `(telega-entity-type-mention ((,c :foreground ,type))) + `(telega-entity-type-pre ((,c :inherit modus-themes-fixed-pitch :background ,bg-prose-code :foreground ,fg-prose-code))) `(telega-entity-type-spoiler ((,c :background ,fg-main :foreground ,fg-main))) `(telega-msg-heading ((,c :background ,bg-inactive))) - `(telega-msg-self-title ((,c :inherit bold))) + `(telega-msg-self-title ((,c :inherit modus-themes-bold))) `(telega-root-heading ((,c :background ,bg-inactive))) - `(telega-secret-title ((,c :foreground ,magenta-warmer))) - `(telega-unmuted-count ((,c :foreground ,blue-cooler))) - `(telega-user-online-status ((,c :foreground ,cyan))) - `(telega-username ((,c :foreground ,cyan-cooler))) + `(telega-secret-title ((,c :foreground ,warning))) + `(telega-unmuted-count ((,c :foreground ,number))) + `(telega-user-online-status ((,c :foreground ,info))) + `(telega-username ((,c :foreground ,name))) `(telega-webpage-chat-link ((,c :background ,bg-inactive))) `(telega-webpage-fixed ((,c :inherit modus-themes-fixed-pitch :height 0.85))) `(telega-webpage-header ((,c :height 1.3))) @@ -3864,36 +6804,36 @@ FG and BG are the main colors." `(term-color-red ((,c :background ,bg-term-red :foreground ,fg-term-red))) `(term-color-white ((,c :background ,bg-term-white-bright :foreground ,fg-term-white-bright))) `(term-color-yellow ((,c :background ,bg-term-yellow :foreground ,fg-term-yellow))) - `(term-underline ((,c :underline t))) + `(term-underline ((,c :inherit underline))) ;;;;; textsec `(textsec-suspicious (( ))) ;;;;; tldr `(tldr-code-block (( ))) - `(tldr-command-argument ((,c :inherit font-lock-string-face))) - `(tldr-command-itself ((,c :inherit font-lock-builtin-face))) - `(tldr-description ((,c :inherit font-lock-doc-face))) - `(tldr-introduction ((,c :inherit font-lock-comment-face))) - `(tldr-title ((,c :inherit bold))) + `(tldr-command-argument ((,c :foreground ,string))) + `(tldr-command-itself ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(tldr-description ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(tldr-introduction ((,c :inherit modus-themes-slant :foreground ,comment))) + `(tldr-title ((,c :inherit modus-themes-heading-1))) ;;;;; tmr - `(tmr-mode-line-active ((,c :inherit bold :foreground ,modeline-info))) - `(tmr-mode-line-soon ((,c :inherit bold :foreground ,modeline-warning))) - `(tmr-mode-line-urgent ((,c :inherit bold :foreground ,modeline-err))) + `(tmr-mode-line-active ((,c :inherit modus-themes-bold :foreground ,modeline-info))) + `(tmr-mode-line-soon ((,c :inherit modus-themes-bold :foreground ,modeline-warning))) + `(tmr-mode-line-urgent ((,c :inherit modus-themes-bold :foreground ,modeline-err))) `(tmr-tabulated-description ((,c :foreground ,docstring))) `(tmr-tabulated-end-time ((,c :foreground ,date-deadline))) `(tmr-tabulated-remaining-time ((,c :foreground ,date-scheduled))) `(tmr-tabulated-start-time ((,c :foreground ,date-common))) ;;;;; transient - `(transient-active-infix ((,c :inherit highlight))) + `(transient-active-infix ((,c :background ,bg-hover :foreground ,fg-main))) `(transient-amaranth ((,c :inherit bold :foreground ,yellow-warmer))) ;; Placate the compiler for what is a spurious warning. We also ;; have to do this with `eldoc-highlight-function-argument'. - (list 'transient-argument `((,c :inherit bold :background ,bg-active-argument :foreground ,fg-active-argument))) + (list 'transient-argument `((,c :inherit modus-themes-bold :background ,bg-active-argument :foreground ,fg-active-argument))) `(transient-blue ((,c :inherit bold :foreground ,blue))) - `(transient-disabled-suffix ((,c :inherit modus-themes-mark-del))) - `(transient-enabled-suffix ((,c :inherit modus-themes-subtle-cyan))) + `(transient-disabled-suffix ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) + `(transient-enabled-suffix ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) `(transient-heading ((,c :inherit bold :foreground ,fg-main))) - `(transient-inactive-argument ((,c :inherit shadow))) - `(transient-inactive-value ((,c :inherit shadow))) + `(transient-inactive-argument ((,c :foreground ,fg-dim))) + `(transient-inactive-value ((,c :foreground ,fg-dim))) ;; NOTE 2023-12-09 10:30:09 +0200: The new user option ;; `transient-semantic-coloring' is enabled by default. This is ;; not good for us, because we are making it harder for users who @@ -3901,164 +6841,146 @@ FG and BG are the main colors." ;; could set that user option to nil, but I think it is less ;; intrusive to enforce uniformity among the relevant faces. ;; Those who want semantic coloring can modify these faces. - `(transient-key ((,c :inherit modus-themes-key-binding))) - `(transient-key-exit ((,c :inherit modus-themes-key-binding))) - `(transient-key-noop ((,c :inherit (shadow modus-themes-key-binding)))) - `(transient-key-recurse ((,c :inherit modus-themes-key-binding))) - `(transient-key-return ((,c :inherit modus-themes-key-binding))) - `(transient-key-stack ((,c :inherit modus-themes-key-binding))) - `(transient-key-stay ((,c :inherit modus-themes-key-binding))) - `(transient-mismatched-key ((,c :underline t))) - `(transient-nonstandard-key ((,c :underline t))) + `(transient-key ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(transient-key-exit ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(transient-key-noop ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind :strike-through t))) + `(transient-key-recurse ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(transient-key-return ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(transient-key-stack ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(transient-key-stay ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) + `(transient-mismatched-key ((,c :inherit underline))) + `(transient-nonstandard-key ((,c :inherit underline))) `(transient-pink ((,c :inherit bold :foreground ,magenta))) `(transient-purple ((,c :inherit bold :foreground ,magenta-cooler))) `(transient-red ((,c :inherit bold :foreground ,red-faint))) `(transient-teal ((,c :inherit bold :foreground ,cyan-cooler))) - `(transient-unreachable ((,c :inherit shadow))) - `(transient-unreachable-key ((,c :inherit shadow))) - `(transient-value ((,c :inherit bold :background ,bg-active-value :foreground ,fg-active-value))) + `(transient-unreachable ((,c :foreground ,fg-dim))) + `(transient-unreachable-key ((,c :foreground ,fg-dim))) + `(transient-value ((,c :inherit modus-themes-bold :background ,bg-active-value :foreground ,fg-active-value))) ;;;;; trashed - `(trashed-deleted ((,c :inherit modus-themes-mark-del))) + `(trashed-deleted ((,c :inherit bold :background ,bg-mark-delete :foreground ,fg-mark-delete))) `(trashed-directory ((,c :foreground ,accent-0))) - `(trashed-mark ((,c :inherit bold))) - `(trashed-marked ((,c :inherit modus-themes-mark-alt))) - `(trashed-restored ((,c :inherit modus-themes-mark-sel))) + `(trashed-mark ((,c :inherit modus-themes-bold))) + `(trashed-marked ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) + `(trashed-restored ((,c :inherit bold :background ,bg-mark-select :foreground ,fg-mark-select))) ;;;;; treemacs `(treemacs-async-loading-face ((,c :foreground ,fg-main))) `(treemacs-directory-face ((,c :foreground ,accent-0))) `(treemacs-directory-collapsed-face ((,c :foreground ,accent-0))) `(treemacs-file-face ((,c :foreground ,fg-main))) `(treemacs-fringe-indicator-face ((,c :foreground ,fg-main))) - `(treemacs-git-added-face ((,c :inherit success))) + `(treemacs-git-added-face ((,c :foreground ,info))) `(treemacs-git-commit-diff-face ((,c :foreground ,err))) - `(treemacs-git-conflict-face ((,c :inherit error))) - `(treemacs-git-ignored-face ((,c :inherit shadow))) - `(treemacs-git-modified-face ((,c :inherit warning))) - `(treemacs-git-renamed-face ((,c :inherit italic))) + `(treemacs-git-conflict-face ((,c :foreground ,err))) + `(treemacs-git-ignored-face ((,c :foreground ,fg-dim))) + `(treemacs-git-modified-face ((,c :foreground ,warning))) + `(treemacs-git-renamed-face ((,c :inherit modus-themes-slant))) `(treemacs-git-unmodified-face ((,c :foreground ,fg-main))) - `(treemacs-git-untracked-face ((,c :inherit success))) + `(treemacs-git-untracked-face ((,c :foreground ,info))) `(treemacs-header-button-face ((,c :foreground ,fg-main))) `(treemacs-help-column-face ((,c :inherit modus-themes-bold :foreground ,keyword))) `(treemacs-help-title-face ((,c :foreground ,fg-main))) `(treemacs-hl-line-face ((,c :background ,bg-hl-line :extend t))) - `(treemacs-marked-file-face ((,c :inherit modus-themes-mark-alt))) + `(treemacs-marked-file-face ((,c :inherit bold :background ,bg-mark-other :foreground ,fg-mark-other))) `(treemacs-nerd-icons-face ((,c :foreground ,accent-0))) `(treemacs-on-failure-pulse-face ((,c :foreground ,fg-main))) `(treemacs-on-success-pulse-face ((,c :foreground ,fg-main))) `(treemacs-peek-mode-indicator-face ((,c :foreground ,fg-main))) `(treemacs-remote-face ((,c :foreground ,fg-main))) `(treemacs-root-face ((,c :foreground ,accent-0))) - `(treemacs-root-remote-disconnected-face ((,c :inherit warning))) - `(treemacs-root-remote-unreadable-face ((,c :inherit warning))) - `(treemacs-root-unreadable-face ((,c :inherit error))) + `(treemacs-root-remote-disconnected-face ((,c :foreground ,warning))) + `(treemacs-root-remote-unreadable-face ((,c :foreground ,warning))) + `(treemacs-root-unreadable-face ((,c :foreground ,err))) `(treemacs-tags-face ((,c :foreground ,fg-main))) `(treemacs-term-node-face ((,c :inherit modus-themes-bold :foreground ,keyword))) `(treemacs-window-background-face ((,c :background ,bg-main))) `(treemacs-nerd-icons-root-face ((,c :foreground ,accent-0))) `(treemacs-nerd-icons-file-face ((,c :foreground ,accent-0))) -;;;;; tree-sitter - `(tree-sitter-hl-face:attribute ((,c :inherit font-lock-variable-name-face))) - `(tree-sitter-hl-face:constant.builtin ((,c :inherit tree-sitter-hl-face:constant))) - `(tree-sitter-hl-face:escape ((,c :inherit font-lock-regexp-grouping-backslash))) - `(tree-sitter-hl-face:function ((,c :inherit font-lock-function-name-face))) - `(tree-sitter-hl-face:function.call ((,c :inherit tree-sitter-hl-face:function))) - `(tree-sitter-hl-face:label (( ))) - `(tree-sitter-hl-face:method.call (( ))) - `(tree-sitter-hl-face:operator ((,c :inherit modus-themes-bold))) - `(tree-sitter-hl-face:property (( ))) - `(tree-sitter-hl-face:property.definition ((,c :inherit font-lock-variable-name-face))) - `(tree-sitter-hl-face:punctuation (( ))) - `(tree-sitter-hl-face:punctuation.bracket (( ))) - `(tree-sitter-hl-face:punctuation.delimiter (( ))) - `(tree-sitter-hl-face:punctuation.special ((,c :inherit font-lock-regexp-grouping-construct))) - `(tree-sitter-hl-face:string.special ((,c :inherit tree-sitter-hl-face:string))) - `(tree-sitter-hl-face:tag ((,c :inherit font-lock-function-name-face))) - `(tree-sitter-hl-face:type.argument (( ))) ;;;;; tty-menu `(tty-menu-disabled-face ((,c :background ,bg-inactive :foreground ,fg-dim))) `(tty-menu-enabled-face ((,c :inherit bold :background ,bg-inactive :foreground ,fg-main))) - `(tty-menu-selected-face ((,c :inherit modus-themes-intense-blue))) + `(tty-menu-selected-face ((,c :background ,bg-blue-intense :foreground ,fg-main))) ;;;;; tuareg - `(caml-types-def-face ((,c :inherit modus-themes-subtle-red))) - `(caml-types-expr-face ((,c :inherit modus-themes-subtle-green))) - `(caml-types-occ-face ((,c :inherit modus-themes-subtle-green))) - `(caml-types-scope-face ((,c :inherit modus-themes-subtle-blue))) - `(caml-types-typed-face ((,c :inherit modus-themes-subtle-magenta))) - `(tuareg-font-double-semicolon-face ((,c :inherit font-lock-preprocessor-face))) - `(tuareg-font-lock-attribute-face ((,c :inherit font-lock-function-name-face))) + `(caml-types-def-face ((,c :background ,bg-red-subtle :foreground ,fg-main))) + `(caml-types-expr-face ((,c :background ,bg-green-subtle :foreground ,fg-main))) + `(caml-types-occ-face ((,c :background ,bg-green-subtle :foreground ,fg-main))) + `(caml-types-scope-face ((,c :background ,bg-blue-subtle :foreground ,fg-main))) + `(caml-types-typed-face ((,c :background ,bg-magenta-subtle :foreground ,fg-main))) + `(tuareg-font-double-semicolon-face ((,c :foreground ,preprocessor))) + `(tuareg-font-lock-attribute-face ((,c :foreground ,fnname))) `(tuareg-font-lock-constructor-face ((,c :foreground ,fg-main))) - `(tuareg-font-lock-error-face ((,c :inherit (modus-themes-intense-red bold)))) + `(tuareg-font-lock-error-face ((,c :background ,bg-prominent-err :foreground ,fg-prominent-err))) ;; `(tuareg-font-lock-extension-node-face ((,c :background ,bg-inactive :foreground ,magenta))) - `(tuareg-font-lock-governing-face ((,c :inherit bold :foreground ,fg-main))) - `(tuareg-font-lock-infix-extension-node-face ((,c :inherit font-lock-function-name-face))) - `(tuareg-font-lock-interactive-directive-face ((,c :inherit font-lock-preprocessor-face))) - `(tuareg-font-lock-interactive-error-face ((,c :inherit error))) - `(tuareg-font-lock-interactive-output-face ((,c :inherit font-lock-constant-face))) - `(tuareg-font-lock-label-face ((,c :inherit font-lock-type-face))) - `(tuareg-font-lock-line-number-face ((,c :inherit shadow))) - `(tuareg-font-lock-module-face ((,c :inherit font-lock-builtin-face))) + `(tuareg-font-lock-governing-face ((,c :inherit modus-themes-bold :foreground ,fg-main))) + `(tuareg-font-lock-infix-extension-node-face ((,c :foreground ,fnname))) + `(tuareg-font-lock-interactive-directive-face ((,c :foreground ,preprocessor))) + `(tuareg-font-lock-interactive-error-face ((,c :foreground ,err))) + `(tuareg-font-lock-interactive-output-face ((,c :foreground ,constant))) + `(tuareg-font-lock-label-face ((,c :inherit modus-themes-bold :foreground ,type))) + `(tuareg-font-lock-line-number-face ((,c :foreground ,fg-dim))) + `(tuareg-font-lock-module-face ((,c :inherit modus-themes-bold :foreground ,builtin))) ;; `(tuareg-font-lock-multistage-face ((,c :inherit bold :background ,bg-inactive :foreground ,blue))) - `(tuareg-font-lock-operator-face ((,c :inherit font-lock-preprocessor-face))) - `(tuareg-opam-error-face ((,c :inherit error))) - `(tuareg-opam-pkg-variable-name-face ((,c :inherit font-lock-variable-name-face))) + `(tuareg-font-lock-operator-face ((,c :foreground ,preprocessor))) + `(tuareg-opam-error-face ((,c :foreground ,err))) + `(tuareg-opam-pkg-variable-name-face ((,c :foreground ,variable))) ;;;;; typescript - `(typescript-jsdoc-tag ((,c :inherit (font-lock-builtin-face font-lock-comment-face) :weight normal))) - `(typescript-jsdoc-type ((,c :inherit (font-lock-type-face font-lock-comment-face) :weight normal))) - `(typescript-jsdoc-value ((,c :inherit (font-lock-constant-face font-lock-comment-face) :weight normal))) + `(typescript-jsdoc-tag ((,c :inherit modus-themes-slant :foreground ,builtin))) + `(typescript-jsdoc-type ((,c :inherit modus-themes-slant :foreground ,type))) + `(typescript-jsdoc-value ((,c :inherit modus-themes-slant :foreground ,string))) ;;;;; undo-tree - `(undo-tree-visualizer-active-branch-face ((,c :inherit bold :foreground ,fg-main))) - `(undo-tree-visualizer-current-face ((,c :foreground ,blue-intense))) - `(undo-tree-visualizer-default-face ((,c :inherit shadow))) - `(undo-tree-visualizer-register-face ((,c :foreground ,magenta-intense))) - `(undo-tree-visualizer-unmodified-face ((,c :foreground ,green-intense))) + `(undo-tree-visualizer-active-branch-face ((,c :inherit modus-themes-bold :foreground ,fg-main))) + `(undo-tree-visualizer-current-face ((,c :foreground ,err))) + `(undo-tree-visualizer-default-face ((,c :foreground ,fg-dim))) + `(undo-tree-visualizer-register-face ((,c :foreground ,info))) + `(undo-tree-visualizer-unmodified-face ((,c :foreground ,fg-dim))) ;;;;; vc (vc-dir.el, vc-hooks.el) `(vc-dir-directory (( ))) `(vc-dir-file ((,c :foreground ,name))) - `(vc-dir-header ((,c :inherit bold))) + `(vc-dir-header ((,c :inherit modus-themes-bold))) `(vc-dir-header-value ((,c :foreground ,string))) `(vc-dir-mark-indicator (( ))) - `(vc-dir-status-edited ((,c :inherit italic))) - `(vc-dir-status-ignored ((,c :inherit shadow))) + `(vc-dir-status-edited ((,c :inherit modus-themes-slant))) + `(vc-dir-status-ignored ((,c :foreground ,fg-dim))) `(vc-dir-status-up-to-date ((,c :foreground ,info))) - `(vc-dir-status-warning ((,c :inherit error))) - `(vc-conflict-state ((,c :inherit error))) - `(vc-edited-state ((,c :inherit italic))) - `(vc-git-log-edit-summary-max-warning ((,c :inherit error))) - `(vc-git-log-edit-summary-target-warning ((,c :inherit warning))) - `(vc-locally-added-state ((,c :inherit italic))) - `(vc-locked-state ((,c :inherit success))) - `(vc-missing-state ((,c :inherit error))) - `(vc-needs-update-state ((,c :inherit error))) - `(vc-removed-state ((,c :inherit error))) + `(vc-dir-status-warning ((,c :foreground ,err))) + `(vc-conflict-state ((,c :foreground ,err))) + `(vc-edited-state ((,c :inherit modus-themes-slant))) + `(vc-git-log-edit-summary-max-warning ((,c :foreground ,err))) + `(vc-git-log-edit-summary-target-warning ((,c :foreground ,warning))) + `(vc-locally-added-state ((,c :inherit modus-themes-slant))) + `(vc-locked-state ((,c :foreground ,info))) + `(vc-missing-state ((,c :foreground ,err))) + `(vc-needs-update-state ((,c :foreground ,err))) + `(vc-removed-state ((,c :foreground ,err))) `(vc-state-base (( ))) `(vc-up-to-date-state (( ))) ;;;;; vertico `(vertico-current ((,c :inherit modus-themes-completion-selected))) ;;;;; vertico-quick - `(vertico-quick1 ((,c :inherit (bold modus-themes-search-current)))) - `(vertico-quick2 ((,c :inherit (bold modus-themes-search-current)))) + `(vertico-quick1 ((,c :inherit bold :background ,bg-search-current :foreground ,fg-main))) + `(vertico-quick2 ((,c :inherit bold :background ,bg-search-current :foreground ,fg-main))) ;;;;; vimish-fold - `(vimish-fold-fringe ((,c :foreground ,cyan))) - `(vimish-fold-mouse-face ((,c :inherit modus-themes-intense-blue))) + `(vimish-fold-fringe ((,c :foreground ,info))) + `(vimish-fold-mouse-face ((,c :background ,bg-hover :foreground ,fg-main))) `(vimish-fold-overlay ((,c :background ,bg-inactive))) ;;;;; viper - `(viper-search ((,c :inherit modus-themes-search-current))) - `(viper-replace-overlay ((,c :inherit modus-themes-search-replace))) + `(viper-search ((,c :background ,bg-search-current :foreground ,fg-main))) + `(viper-replace-overlay ((,c :background ,bg-search-replace :foreground ,fg-main))) `(viper-minibuffer-emacs (( ))) `(viper-minibuffer-insert (( ))) `(viper-minibuffer-vi (( ))) ;;;;; visible-mark - `(visible-mark-active ((,c :background ,bg-blue-intense))) - `(visible-mark-face1 ((,c :background ,bg-cyan-intense))) - `(visible-mark-face2 ((,c :background ,bg-yellow-intense))) - `(visible-mark-forward-face1 ((,c :background ,bg-magenta-intense))) - `(visible-mark-forward-face2 ((,c :background ,bg-green-intense))) + `(visible-mark-active ((,c :background ,bg-search-static :foreground ,fg-main))) + `(visible-mark-face1 ((,c :background ,bg-search-rx-group-0 :foreground ,fg-main))) + `(visible-mark-face2 ((,c :background ,bg-search-rx-group-1 :foreground ,fg-main))) + `(visible-mark-forward-face1 ((,c :background ,bg-search-rx-group-2 :foreground ,fg-main))) + `(visible-mark-forward-face2 ((,c :background ,bg-search-rx-group-3 :foreground ,fg-main))) ;;;;; visual-regexp - `(vr/group-0 ((,c :inherit modus-themes-search-rx-group-0))) - `(vr/group-1 ((,c :inherit modus-themes-search-rx-group-1))) - `(vr/group-2 ((,c :inherit modus-themes-search-rx-group-2))) - `(vr/match-0 ((,c :inherit modus-themes-search-current))) - `(vr/match-1 ((,c :inherit modus-themes-search-lazy))) + `(vr/group-0 ((,c :background ,bg-search-rx-group-0 :foreground ,fg-main))) + `(vr/group-1 ((,c :background ,bg-search-rx-group-1 :foreground ,fg-main))) + `(vr/group-2 ((,c :background ,bg-search-rx-group-2 :foreground ,fg-main))) + `(vr/match-0 ((,c :background ,bg-search-current :foreground ,fg-main))) + `(vr/match-1 ((,c :background ,bg-search-lazy :foreground ,fg-main))) `(vr/match-separator-face ((,c :inherit bold :background ,bg-active))) ;;;;; vterm `(vterm-color-black ((,c :background ,bg-term-black :foreground ,fg-term-black))) @@ -4078,100 +7000,100 @@ FG and BG are the main colors." `(vterm-color-white ((,c :background ,bg-term-white :foreground ,fg-term-white))) `(vterm-color-bright-white ((,c :background ,bg-term-white-bright :foreground ,fg-term-white-bright))) `(vterm-color-inverse-video ((,c :background ,bg-main :inverse-video t))) - `(vterm-color-underline ((,c :underline t))) + `(vterm-color-underline ((,c :inherit underline))) ;;;;; vundo - `(vundo-default ((,c :inherit shadow))) - `(vundo-highlight ((,c :inherit (bold vundo-node) :foreground ,red))) - `(vundo-last-saved ((,c :inherit (bold vundo-node) :foreground ,blue))) - `(vundo-saved ((,c :inherit vundo-node :foreground ,blue-intense))) + `(vundo-default ((,c :foreground ,fg-dim))) + `(vundo-highlight ((,c :inherit modus-themes-bold :foreground ,err))) + `(vundo-last-saved ((,c :inherit modus-themes-bold :foreground ,info))) + `(vundo-saved ((,c :foreground ,info))) ;;;;; wcheck-mode - `(wcheck-default-face ((,c :foreground ,red :underline t))) + `(wcheck-default-face ((,c :foreground ,err :underline t))) ;;;;; web-mode - `(web-mode-annotation-face ((,c :inherit web-mode-comment-face))) - `(web-mode-annotation-html-face ((,c :inherit web-mode-comment-face))) - `(web-mode-annotation-tag-face ((,c :inherit web-mode-comment-face :underline t))) - `(web-mode-block-attr-name-face ((,c :inherit font-lock-constant-face))) - `(web-mode-block-attr-value-face ((,c :inherit font-lock-type-face))) - `(web-mode-block-comment-face ((,c :inherit web-mode-comment-face))) - `(web-mode-block-control-face ((,c :inherit font-lock-builtin-face))) + `(web-mode-annotation-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-annotation-html-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-annotation-tag-face ((,c :inherit modus-themes-slant :foreground ,comment :underline t))) + `(web-mode-block-attr-name-face ((,c :foreground ,constant))) + `(web-mode-block-attr-value-face ((,c :inherit modus-themes-bold :foreground ,type))) + `(web-mode-block-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-block-control-face ((,c :inherit modus-themes-bold :foreground ,builtin))) `(web-mode-block-delimiter-face ((,c :foreground ,fg-main))) `(web-mode-block-face ((,c :background ,bg-dim))) - `(web-mode-block-string-face ((,c :inherit web-mode-string-face))) + `(web-mode-block-string-face ((,c :foreground ,string))) `(web-mode-bold-face ((,c :inherit bold))) - `(web-mode-builtin-face ((,c :inherit font-lock-builtin-face))) - `(web-mode-comment-face ((,c :inherit font-lock-comment-face))) - `(web-mode-comment-keyword-face ((,c :inherit font-lock-warning-face))) - `(web-mode-constant-face ((,c :inherit font-lock-constant-face))) - `(web-mode-css-at-rule-face ((,c :inherit font-lock-constant-face))) - `(web-mode-css-color-face ((,c :inherit font-lock-builtin-face))) - `(web-mode-css-comment-face ((,c :inherit web-mode-comment-face))) - `(web-mode-css-function-face ((,c :inherit font-lock-builtin-face))) - `(web-mode-css-priority-face ((,c :inherit font-lock-warning-face))) - `(web-mode-css-property-name-face ((,c :inherit font-lock-keyword-face))) - `(web-mode-css-pseudo-class-face ((,c :inherit font-lock-doc-face))) - `(web-mode-css-selector-face ((,c :inherit font-lock-keyword-face))) - `(web-mode-css-string-face ((,c :inherit web-mode-string-face))) - `(web-mode-css-variable-face ((,c :inherit font-lock-variable-name-face))) + `(web-mode-builtin-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(web-mode-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-comment-keyword-face ((,c :inherit modus-themes-bold :foreground ,warning))) + `(web-mode-constant-face ((,c :foreground ,constant))) + `(web-mode-css-at-rule-face ((,c :foreground ,constant))) + `(web-mode-css-color-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(web-mode-css-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-css-function-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(web-mode-css-priority-face ((,c :inherit modus-themes-bold :foreground ,warning))) + `(web-mode-css-property-name-face ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(web-mode-css-pseudo-class-face ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(web-mode-css-selector-face ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(web-mode-css-string-face ((,c :foreground ,string))) + `(web-mode-css-variable-face ((,c :foreground ,variable))) `(web-mode-current-column-highlight-face ((,c :background ,bg-inactive))) - `(web-mode-current-element-highlight-face ((,c :inherit modus-themes-subtle-cyan))) - `(web-mode-doctype-face ((,c :inherit font-lock-doc-face))) - `(web-mode-error-face ((,c :inherit error))) - `(web-mode-filter-face ((,c :inherit font-lock-function-name-face))) - `(web-mode-folded-face ((,c :underline t))) - `(web-mode-function-call-face ((,c :inherit font-lock-function-name-face))) - `(web-mode-function-name-face ((,c :inherit font-lock-function-name-face))) - `(web-mode-html-attr-custom-face ((,c :inherit font-lock-variable-name-face))) + `(web-mode-current-element-highlight-face ((,c :background ,bg-paren-match :foreground ,fg-paren-match :underline ,underline-paren-match))) + `(web-mode-doctype-face ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(web-mode-error-face ((,c :foreground ,err))) + `(web-mode-filter-face ((,c :foreground ,fnname))) + `(web-mode-folded-face ((,c :inherit underline))) + `(web-mode-function-call-face ((,c :foreground ,fnname))) + `(web-mode-function-name-face ((,c :foreground ,fnname))) + `(web-mode-html-attr-custom-face ((,c :foreground ,variable))) `(web-mode-html-attr-engine-face ((,c :foreground ,fg-main))) `(web-mode-html-attr-equal-face ((,c :foreground ,fg-main))) - `(web-mode-html-attr-name-face ((,c :inherit font-lock-variable-name-face))) - `(web-mode-html-attr-value-face ((,c :inherit font-lock-constant-face))) - `(web-mode-html-entity-face ((,c :inherit font-lock-negation-char-face))) + `(web-mode-html-attr-name-face ((,c :foreground ,variable))) + `(web-mode-html-attr-value-face ((,c :foreground ,constant))) + `(web-mode-html-entity-face ((,c :foreground ,err))) `(web-mode-html-tag-bracket-face ((,c :foreground ,fg-dim))) - `(web-mode-html-tag-custom-face ((,c :inherit font-lock-function-name-face))) - `(web-mode-html-tag-face ((,c :inherit font-lock-function-name-face))) - `(web-mode-html-tag-namespaced-face ((,c :inherit font-lock-builtin-face))) - `(web-mode-html-tag-unclosed-face ((,c :inherit error :underline t))) + `(web-mode-html-tag-custom-face ((,c :foreground ,fnname))) + `(web-mode-html-tag-face ((,c :foreground ,fnname))) + `(web-mode-html-tag-namespaced-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(web-mode-html-tag-unclosed-face ((,c :foreground ,err :underline t))) `(web-mode-inlay-face ((,c :background ,bg-inactive))) `(web-mode-italic-face ((,c :inherit italic))) - `(web-mode-javascript-comment-face ((,c :inherit web-mode-comment-face))) - `(web-mode-javascript-string-face ((,c :inherit web-mode-string-face))) - `(web-mode-json-comment-face ((,c :inherit web-mode-comment-face))) - `(web-mode-json-context-face ((,c :inherit font-lock-builtin-face))) - `(web-mode-json-key-face ((,c :foreground ,blue-faint))) - `(web-mode-json-string-face ((,c :inherit web-mode-string-face))) - `(web-mode-keyword-face ((,c :inherit font-lock-keyword-face))) - `(web-mode-param-name-face ((,c :inherit font-lock-function-name-face))) - `(web-mode-part-comment-face ((,c :inherit web-mode-comment-face))) - `(web-mode-part-face ((,c :inherit web-mode-block-face))) - `(web-mode-part-string-face ((,c :inherit web-mode-string-face))) - `(web-mode-preprocessor-face ((,c :inherit font-lock-preprocessor-face))) - `(web-mode-script-face ((,c :inherit web-mode-part-face))) - `(web-mode-sql-keyword-face ((,c :inherit font-lock-negation-char-face))) - `(web-mode-string-face ((,c :inherit font-lock-string-face))) - `(web-mode-style-face ((,c :inherit web-mode-part-face))) - `(web-mode-symbol-face ((,c :inherit font-lock-constant-face))) - `(web-mode-type-face ((,c :inherit font-lock-builtin-face))) - `(web-mode-underline-face ((,c :underline t))) - `(web-mode-variable-name-face ((,c :inherit font-lock-variable-name-face))) - `(web-mode-warning-face ((,c :inherit warning))) + `(web-mode-javascript-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-javascript-string-face ((,c :foreground ,string))) + `(web-mode-json-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-json-context-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(web-mode-json-key-face ((,c :foreground ,string))) + `(web-mode-json-string-face ((,c :foreground ,string))) + `(web-mode-keyword-face ((,c :inherit modus-themes-bold :foreground ,keyword))) + `(web-mode-param-name-face ((,c :foreground ,fnname))) + `(web-mode-part-comment-face ((,c :inherit modus-themes-slant :foreground ,comment))) + `(web-mode-part-face ((,c :background ,bg-dim))) + `(web-mode-part-string-face ((,c :foreground ,string))) + `(web-mode-preprocessor-face ((,c :foreground ,preprocessor))) + `(web-mode-script-face ((,c :background ,bg-dim))) + `(web-mode-sql-keyword-face ((,c :foreground ,err))) + `(web-mode-string-face ((,c :foreground ,string))) + `(web-mode-style-face ((,c :background ,bg-dim))) + `(web-mode-symbol-face ((,c :foreground ,constant))) + `(web-mode-type-face ((,c :inherit modus-themes-bold :foreground ,builtin))) + `(web-mode-underline-face ((,c :inherit underline))) + `(web-mode-variable-name-face ((,c :foreground ,variable))) + `(web-mode-warning-face ((,c :foreground ,warning))) `(web-mode-whitespace-face ((,c :background ,bg-inactive))) ;;;;; wgrep - `(wgrep-delete-face ((,c :inherit warning))) - `(wgrep-done-face ((,c :inherit success))) + `(wgrep-delete-face ((,c :foreground ,warning))) + `(wgrep-done-face ((,c :foreground ,info))) `(wgrep-face ((,c :inherit bold))) `(wgrep-file-face ((,c :foreground ,fg-alt))) - `(wgrep-reject-face ((,c :inherit error))) + `(wgrep-reject-face ((,c :foreground ,err))) ;;;;; which-function-mode - `(which-func ((,c :inherit bold :foreground ,modeline-info))) ; same as `breadcrumb-imenu-leaf-face' + `(which-func ((,c :inherit modus-themes-bold :foreground ,modeline-info))) ; same as `breadcrumb-imenu-leaf-face' ;;;;; which-key `(which-key-command-description-face ((,c :foreground ,fg-main))) `(which-key-group-description-face ((,c :foreground ,type))) `(which-key-highlighted-command-face ((,c :foreground ,warning :underline t))) - `(which-key-key-face ((,c :inherit modus-themes-key-binding))) + `(which-key-key-face ((,c :inherit (bold modus-themes-fixed-pitch) :foreground ,keybind))) `(which-key-local-map-description-face ((,c :foreground ,fg-main))) - `(which-key-note-face ((,c :inherit shadow))) - `(which-key-separator-face ((,c :inherit shadow))) - `(which-key-special-key-face ((,c :inherit error))) + `(which-key-note-face ((,c :foreground ,fg-dim))) + `(which-key-separator-face ((,c :foreground ,fg-dim))) + `(which-key-special-key-face ((,c :foreground ,err))) ;;;;; whitespace-mode `(whitespace-big-indent ((,c :background ,bg-space-err))) `(whitespace-empty ((,c :background ,bg-space))) @@ -4180,8 +7102,8 @@ FG and BG are the main colors." `(whitespace-line ((,c :background ,bg-space :foreground ,warning))) `(whitespace-newline ((,c :background ,bg-space :foreground ,fg-space))) `(whitespace-space ((,c :background ,bg-space :foreground ,fg-space))) - `(whitespace-space-after-tab ((,c :inherit warning :background ,bg-space))) - `(whitespace-space-before-tab ((,c :inherit warning :background ,bg-space))) + `(whitespace-space-after-tab ((,c :background ,bg-space :foreground ,warning))) + `(whitespace-space-before-tab ((,c :background ,bg-space :foreground ,warning))) `(whitespace-tab ((,c :background ,bg-space :foreground ,fg-space))) `(whitespace-trailing ((,c :background ,bg-space-err))) ;;;;; window-divider-mode @@ -4190,45 +7112,45 @@ FG and BG are the main colors." `(window-divider-last-pixel ((,c :foreground ,bg-inactive))) ;;;;; window-tool-bar-mode `(window-tool-bar-button ((,c :inherit modus-themes-button))) - `(window-tool-bar-button-hover ((,c :inherit (highlight modus-themes-button)))) + `(window-tool-bar-button-hover ((,c :inherit modus-themes-button :background ,bg-hover :foreground ,fg-main))) `(window-tool-bar-button-disabled ((,c :inherit modus-themes-button :background ,bg-button-inactive :foreground ,fg-button-inactive))) ;;;;; widget - `(widget-button ((,c :inherit bold :foreground ,fg-link))) - `(widget-button-pressed ((,c :inherit widget-button :foreground ,fg-link-visited))) - `(widget-documentation ((,c :inherit font-lock-doc-face))) - `(widget-field ((,c :background ,bg-inactive :foreground ,fg-main :extend nil))) + `(widget-button ((,c :inherit modus-themes-bold :foreground ,fg-link))) + `(widget-button-pressed ((,c :inherit modus-themes-bold :foreground ,fg-link-visited))) + `(widget-documentation ((,c :inherit modus-themes-slant :foreground ,docstring))) + `(widget-field ((,c :background ,bg-button-inactive :foreground ,fg-button-active :extend nil :underline (:position t)))) `(widget-inactive ((,c :background ,bg-button-inactive :foreground ,fg-button-inactive))) - `(widget-single-line-field ((,c :inherit widget-field))) + `(widget-single-line-field ((,c :background ,bg-button-inactive :foreground ,fg-button-active :extend nil :underline (:position t)))) ;;;;; writegood-mode - `(writegood-duplicates-face ((,c :inherit modus-themes-lang-error))) - `(writegood-passive-voice-face ((,c :inherit modus-themes-lang-warning))) - `(writegood-weasels-face ((,c :inherit modus-themes-lang-warning))) + `(writegood-duplicates-face ((,c :underline (:style wave :color ,underline-err)))) + `(writegood-passive-voice-face ((,c :underline (:style wave :color ,underline-warning)))) + `(writegood-weasels-face ((,c :underline (:style wave :color ,underline-warning)))) ;;;;; woman `(woman-addition ((,c :foreground ,accent-2))) `(woman-bold ((,c :inherit bold :foreground ,accent-0))) `(woman-italic ((,c :inherit italic :foreground ,accent-1))) `(woman-unknown ((,c :foreground ,accent-3))) ;;;;; xah-elisp-mode - `(xah-elisp-at-symbol ((,c :inherit font-lock-warning-face))) - `(xah-elisp-cap-variable ((,c :inherit font-lock-preprocessor-face))) - `(xah-elisp-command-face ((,c :inherit font-lock-type-face))) - `(xah-elisp-dollar-symbol ((,c :inherit font-lock-variable-name-face))) + `(xah-elisp-at-symbol ((,c :inherit modus-themes-bold :foreground ,warning))) + `(xah-elisp-cap-variable ((,c :foreground ,preprocessor))) + `(xah-elisp-command-face ((,c :inherit modus-themes-bold :foreground ,type))) + `(xah-elisp-dollar-symbol ((,c :foreground ,variable))) ;;;;; yaml-mode `(yaml-tab-face ((,c :background ,bg-space-err))) ;;;;; yasnippet - `(yas-field-highlight-face ((,c :inherit highlight))) + `(yas-field-highlight-face ((,c :background ,bg-hover :foreground ,fg-main))) ;;;;; ztree - `(ztreep-arrow-face ((,c :inherit shadow))) + `(ztreep-arrow-face ((,c :foreground ,fg-dim))) `(ztreep-diff-header-face ((,c :inherit modus-themes-heading-0))) - `(ztreep-diff-header-small-face ((,c :inherit font-lock-doc-face))) + `(ztreep-diff-header-small-face ((,c :inherit modus-themes-slant :foreground ,docstring))) `(ztreep-diff-model-add-face ((,c :foreground ,info))) `(ztreep-diff-model-diff-face ((,c :foreground ,err))) `(ztreep-diff-model-ignored-face ((,c :foreground ,fg-dim :strike-through t))) `(ztreep-diff-model-normal-face (( ))) - `(ztreep-expand-sign-face ((,c :inherit shadow))) + `(ztreep-expand-sign-face ((,c :foreground ,fg-dim))) `(ztreep-header-face ((,c :inherit modus-themes-heading-0))) `(ztreep-leaf-face (( ))) - `(ztreep-node-count-children-face ((,c :inherit (shadow italic)))) + `(ztreep-node-count-children-face ((,c :inherit modus-themes-slant :foreground ,fg-dim))) `(ztreep-node-face ((,c :foreground ,accent-0)))) "Face specs for use with `modus-themes-theme'.") @@ -4243,17 +7165,11 @@ FG and BG are the main colors." ,bg-graph-red-1 ,bg-graph-green-1 ,bg-graph-yellow-1 ,bg-graph-blue-1 ,bg-graph-magenta-1 ,bg-graph-cyan-1)) ;;;; exwm `(exwm-floating-border-color ,border) -;;;; flymake fringe indicators - `(flymake-error-bitmap '(flymake-double-exclamation-mark modus-themes-prominent-error)) - `(flymake-warning-bitmap '(exclamation-mark modus-themes-prominent-warning)) - `(flymake-note-bitmap '(exclamation-mark modus-themes-prominent-note)) ;;;; highlight-changes `(highlight-changes-colors nil) `(highlight-changes-face-list '(success warning error bold bold-italic)) ;;;; ibuffer - `(ibuffer-deletion-face 'modus-themes-mark-del) `(ibuffer-filter-group-name-face 'bold) - `(ibuffer-marked-face 'modus-themes-mark-sel) `(ibuffer-title-face 'default) ;;;; hl-todo `(hl-todo-keyword-faces @@ -4277,38 +7193,6 @@ FG and BG are the main colors." ("DEPRECATED" . ,info))) ;;;; pdf-tools `(pdf-view-midnight-colors '(,fg-main . ,bg-dim)) -;;;; rcirc-color - `(rcirc-colors - '(modus-themes-fg-red - modus-themes-fg-green - modus-themes-fg-blue - modus-themes-fg-yellow - modus-themes-fg-magenta - modus-themes-fg-cyan - modus-themes-fg-red-warmer - modus-themes-fg-green-warmer - modus-themes-fg-blue-warmer - modus-themes-fg-yellow-warmer - modus-themes-fg-magenta-warmer - modus-themes-fg-cyan-warmer - modus-themes-fg-red-cooler - modus-themes-fg-green-cooler - modus-themes-fg-blue-cooler - modus-themes-fg-yellow-cooler - modus-themes-fg-magenta-cooler - modus-themes-fg-cyan-cooler - modus-themes-fg-red-faint - modus-themes-fg-green-faint - modus-themes-fg-blue-faint - modus-themes-fg-yellow-faint - modus-themes-fg-magenta-faint - modus-themes-fg-cyan-faint - modus-themes-fg-red-intense - modus-themes-fg-green-intense - modus-themes-fg-blue-intense - modus-themes-fg-yellow-intense - modus-themes-fg-magenta-intense - modus-themes-fg-cyan-intense)) ;;;; rustic-ansi-faces `(rustic-ansi-faces [,fg-term-black @@ -4348,49 +7232,176 @@ FG and BG are the main colors." ;;;; Instantiate a Modus theme -;;;###autoload -(defmacro modus-themes-theme (name palette &optional overrides) - "Bind NAME's color PALETTE around face specs and variables. -Face specifications are passed to `custom-theme-set-faces'. -While variables are handled by `custom-theme-set-variables'. -Those are stored in `modus-themes-faces' and -`modus-themes-custom-variables' respectively. +(defun modus-themes-declare (name family description background-mode core-palette user-palette overrides-palette) + "Declare NAME theme that belongs to FAMILY. +All of DESCRIPTION, BACKGROUND-MODE, CORE-PALETTE, USER-PALETTE, +OVERRIDES-PALETTE have the same meaning as in `modus-themes-theme'. -Optional OVERRIDES are appended to PALETTE, overriding -corresponding entries." - (declare (indent 0)) - (let ((sym (gensym)) - (colors (mapcar #'car (symbol-value palette)))) - `(let* ((c '((class color) (min-colors 256))) - (,sym (modus-themes--palette-value ',name ',overrides)) - ,@(mapcar (lambda (color) - (list color - `(modus-themes--retrieve-palette-value ',color ,sym))) - colors)) - (ignore c ,@colors) ; Silence unused variable warnings - (custom-theme-set-faces ',name ,@modus-themes-faces) - (custom-theme-set-variables ',name ,@modus-themes-custom-variables)))) +To simply register the theme, use `modus-themes-register'." + (custom-declare-theme + name (intern (format "%s-theme" name)) + description + (list :kind 'color-scheme :background-mode background-mode :family family + :modus-core-palette core-palette :modus-user-palette user-palette + :modus-overrides-palette overrides-palette))) + +(defun modus-themes-register (name) + "Add NAME theme to `modus-themes-registered-items'. +To actually declare a theme, instantiating with together with its +properties, use `modus-themes-declare'." + (add-to-list 'modus-themes-registered-items name)) + +;;;###autoload +(defun modus-themes-theme (name family description background-mode core-palette user-palette overrides-palette &optional custom-faces custom-variables) + "Define a Modus theme or derivative thereof. +NAME is the name of the new theme. FAMILY is the collection of themes +it belongs to. DESCRIPTION is its documentation string. +BACKGROUND-MODE is either `dark' or `light', in reference to the theme's +background color. The CORE-PALETTE, USER-PALETTE, and OVERRIDES-PALETTE +are symbols of variables which define palettes commensurate with +`modus-themes-operandi-palette'. + +The optional CUSTOM-FACES and CUSTOM-VARIABLES are joined together with +the `modus-themes-faces' and `modus-themes-custom-variables', +respectively. A derivative theme defining those is thus overriding what +the Modus themess have by default. + +Consult the manual for details on how to build a theme on top of the +`modus-themes': Info node `(modus-themes) Build on top of the Modus themes'." + (let ((theme-exists-p (custom-theme-p name)) + (faces (append + (symbol-value custom-faces) + modus-themes-faces)) + (variables (append + modus-themes-custom-variables + (symbol-value custom-variables) + (list `'(frame-background-mode ',background-mode))))) + (unless theme-exists-p + (modus-themes-declare + name family + description background-mode + core-palette user-palette overrides-palette)) + (let ((palette (modus-themes--get-theme-palette-subr name :with-overrides :with-user-palette))) + (eval + `(let* ((c '((class color) (min-colors 256))) + (palette (modus-themes--get-theme-palette-subr ',name :with-overrides :with-user-palette)) + ,@(mapcar + (lambda (entry) + (let ((name (car entry))) + (list name `(modus-themes--retrieve-palette-value ',name palette)))) + palette)) + (custom-theme-set-faces + ',name + ,@faces) + (custom-theme-set-variables + ',name + ,@variables)) + :lexical)) + (unless theme-exists-p + (provide-theme name)))) ;;;; Use theme colors +(defun modus-themes--with-colors-resolve-palette-sort (colors) + "Sort all COLORS in the theme's palette. +Put all named colors before semantic color mappings. A named color is a +symbol whose value is a string. A semantic color mapping is a symbol +whose value is another symbol, which ultimately resolves to a string or +`unspecified'." + (let ((named nil) + (semantic nil)) + (dolist (color colors) + (if (stringp (cadr color)) + (push color named) + (push color semantic))) + (seq-uniq + (nconc (nreverse named) (nreverse semantic)) + (lambda (elt1 elt2) + (eq (car elt1) (car elt2)))))) + +(defun modus-themes-with-colors-subr (expressions) + "Do the work of `modus-themes-with-colors' for EXPRESSIONS." + (condition-case data + (when-let* ((theme (modus-themes-get-current-theme :no-enable))) + (eval + `(let* ((c '((class color) (min-colors 256))) + (unspecified 'unspecified) + ,@(modus-themes--with-colors-resolve-palette-sort + (modus-themes--get-theme-palette-subr theme :with-overrides :with-user-palette))) + ,@expressions) + :lexical)) + (error (message "Error in `modus-themes-with-colors': %s" data)))) + (defmacro modus-themes-with-colors (&rest body) "Evaluate BODY with colors from current palette bound." (declare (indent 0)) - (let* ((sym (gensym)) - ;; NOTE 2022-08-23: We just give it a sample palette at this - ;; stage. It only needs to collect each car. Then we - ;; instantiate the actual theme's palette. We have to do this - ;; otherwise the macro does not work properly when called from - ;; inside a function. - (colors (mapcar #'car (modus-themes--current-theme-palette)))) - `(let* ((c '((class color) (min-colors 256))) - (,sym (modus-themes--current-theme-palette :overrides)) - ,@(mapcar (lambda (color) - (list color - `(modus-themes--retrieve-palette-value ',color ,sym))) - colors)) - (ignore c ,@colors) ; Silence unused variable warnings - ,@body))) + `(modus-themes-with-colors-subr ',body)) + +;;;; Declare all the Modus themes + +(defconst modus-themes-with-properties + '((modus-operandi-deuteranopia modus-themes "Deuteranopia-optimized theme with a white background." light modus-themes-operandi-deuteranopia-palette modus-operandi-deuteranopia-palette-user modus-operandi-deuteranopia-palette-overrides) + (modus-operandi modus-themes "Elegant, highly legible theme with a white background." light modus-themes-operandi-palette modus-operandi-palette-user modus-operandi-palette-overrides) + (modus-operandi-tinted modus-themes "Elegant, highly legible theme with a light ochre background." light modus-themes-operandi-tinted-palette modus-operandi-tinted-palette-user modus-operandi-tinted-palette-overrides) + (modus-operandi-tritanopia modus-themes "Tritanopia-optimized theme with a white background." light modus-themes-operandi-tritanopia-palette modus-operandi-tritanopia-palette-user modus-operandi-tritanopia-palette-overrides) + (modus-vivendi-deuteranopia modus-themes "Deuteranopia-optimized theme with a black background." dark modus-themes-vivendi-deuteranopia-palette modus-vivendi-deuteranopia-palette-user modus-vivendi-deuteranopia-palette-overrides) + (modus-vivendi modus-themes "Elegant, highly legible theme with a black background." dark modus-themes-vivendi-palette modus-vivendi-palette-user modus-vivendi-palette-overrides) + (modus-vivendi-tinted modus-themes "Elegant, highly legible theme with a night sky background." dark modus-themes-vivendi-tinted-palette modus-vivendi-tinted-palette-user modus-vivendi-tinted-palette-overrides) + (modus-vivendi-tritanopia modus-themes "Tritanopia-optimized theme with a black background." dark modus-themes-vivendi-tritanopia-palette modus-vivendi-tritanopia-palette-user modus-vivendi-tritanopia-palette-overrides))) + +(defvar modus-themes--declared-p nil) + +(defun modus-themes-declare-themes () + "Declare the Modus themes." + (unless modus-themes--declared-p + (dolist (theme modus-themes-with-properties) + (apply #'modus-themes-declare theme)) + (setq modus-themes--declared-p t))) + +(modus-themes-declare-themes) + +;;;; Accept all Modus themes and their derivatives + +;;;###autoload +(define-minor-mode modus-themes-include-derivatives-mode + "When enabled, all Modus themes commands cover derivatives as well. +Otherwise, they only consider the `modus-themes-items'. + +Derivative theme projects can implement the equivalent of this minor +mode plus a method for `modus-themes-get-themes' to filter themes +accordingly." + :global t + :init-value nil) + +(cl-defmethod modus-themes-get-themes (&context (modus-themes-include-derivatives-mode (eql t))) + "Return list of Modus themes per `modus-themes-include-derivatives-mode'." + (if-let* ((themes (modus-themes-get-all-known-themes nil)) + (sorted-themes (modus-themes-sort themes 'light))) + sorted-themes + modus-themes-items)) + +;;;; Let derivative themes create commands to load only their themes + +(defvar modus-themes-define-derivative-command-known-suffixes + '( toggle rotate select load-random load-random-dark + load-random-light list-colors list-colors-current) + "Command suffixes accepted by `modus-themes-define-derivative-command'.") + +(defmacro modus-themes-define-derivative-command (family suffix) + "Define convenience command with SUFFIX to load only FAMILY themes. +SUFFIX is a symbol among those listed in the variable +`modus-themes-define-derivative-command-known-suffixes'. The newly +defined command's symbol is FAMILY-SUFFIX, like `modus-themes-rotate'." + (unless (memq suffix modus-themes-define-derivative-command-known-suffixes) + (error "Cannot define command with unknown suffix `%s'" suffix)) + (let ((modus-command (intern (format "modus-themes-%s" suffix)))) + `(defun ,(intern (format "%s-%s" family suffix)) () + ,(format "Like `%s' but only consider members of the `%s'" modus-command family) + (interactive) + (cl-letf (((symbol-function 'modus-themes-get-themes) + (lambda () + (modus-themes-get-all-known-themes ',family)))) + (call-interactively ',modus-command))))) ;;;; Add themes from package to path diff --git a/etc/themes/modus-vivendi-deuteranopia-theme.el b/etc/themes/modus-vivendi-deuteranopia-theme.el index e9e617ccab5..5706676863d 100644 --- a/etc/themes/modus-vivendi-deuteranopia-theme.el +++ b/etc/themes/modus-vivendi-deuteranopia-theme.el @@ -26,490 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-vivendi-deuteranopia - "Deuteranopia-optimized theme with a black background. -This variant is optimized for users with red-green color -deficiency (deuteranopia). It conforms with the highest -legibility standard for color contrast between background and -foreground in any given piece of text, which corresponds to a -minimum contrast in relative luminance of 7:1 (WCAG AAA -standard)." - :background-mode 'dark - :kind 'color-scheme - :family 'modus) - - (defconst modus-vivendi-deuteranopia-palette - '( -;;; Basic values - - (bg-main "#000000") - (bg-dim "#1e1e1e") - (fg-main "#ffffff") - (fg-dim "#989898") - (fg-alt "#c6daff") - (bg-active "#535353") - (bg-inactive "#303030") - (border "#646464") - -;;; Common accent foregrounds - - (red "#ff5f59") - (red-warmer "#ff6b55") - (red-cooler "#ff7f86") - (red-faint "#ff9580") - (red-intense "#ff5f5f") - (green "#44bc44") - (green-warmer "#70b900") - (green-cooler "#00c06f") - (green-faint "#88ca9f") - (green-intense "#44df44") - (yellow "#cabf00") - (yellow-warmer "#ffa00f") - (yellow-cooler "#d8af7a") - (yellow-faint "#d2b580") - (yellow-intense "#efef00") - (blue "#2fafff") - (blue-warmer "#79a8ff") - (blue-cooler "#00bcff") - (blue-faint "#82b0ec") - (blue-intense "#338fff") - (magenta "#feacd0") - (magenta-warmer "#f78fe7") - (magenta-cooler "#b6a0ff") - (magenta-faint "#caa6df") - (magenta-intense "#ff66ff") - (cyan "#00d3d0") - (cyan-warmer "#4ae2f0") - (cyan-cooler "#6ae4b9") - (cyan-faint "#9ac8e0") - (cyan-intense "#00eff0") - -;;; Uncommon accent foregrounds - - (rust "#db7b5f") - (gold "#c0965b") - (olive "#9cbd6f") - (slate "#76afbf") - (indigo "#9099d9") - (maroon "#cf7fa7") - (pink "#d09dc0") - -;;; Common accent backgrounds - - (bg-red-intense "#9d1f1f") - (bg-green-intense "#2f822f") - (bg-yellow-intense "#7a6100") - (bg-blue-intense "#1640b0") - (bg-magenta-intense "#7030af") - (bg-cyan-intense "#2266ae") - - (bg-red-subtle "#620f2a") - (bg-green-subtle "#00422a") - (bg-yellow-subtle "#4a4000") - (bg-blue-subtle "#242679") - (bg-magenta-subtle "#552f5f") - (bg-cyan-subtle "#004065") - - (bg-red-nuanced "#3a0c14") - (bg-green-nuanced "#092f1f") - (bg-yellow-nuanced "#381d0f") - (bg-blue-nuanced "#12154a") - (bg-magenta-nuanced "#2f0c3f") - (bg-cyan-nuanced "#042837") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#49191a") - (fg-clay "#f1b090") - - (bg-ochre "#462f20") - (fg-ochre "#e0d09c") - - (bg-lavender "#38325c") - (fg-lavender "#dfc0f0") - - (bg-sage "#143e32") - (fg-sage "#c3e7d4") - -;;; Graphs - - (bg-graph-red-0 "#bf6000") - (bg-graph-red-1 "#733500") - (bg-graph-green-0 "#6fbf8f") - (bg-graph-green-1 "#2f5f4f") - (bg-graph-yellow-0 "#c1c00a") - (bg-graph-yellow-1 "#7f6640") - (bg-graph-blue-0 "#0f90ef") - (bg-graph-blue-1 "#1f2f8f") - (bg-graph-magenta-0 "#7f7f8e") - (bg-graph-magenta-1 "#4f4f5f") - (bg-graph-cyan-0 "#376f9a") - (bg-graph-cyan-1 "#00404f") - -;;; Special purpose - - (bg-completion "#2f447f") - (bg-hover "#45605e") - (bg-hover-secondary "#604c30") - (bg-hl-line "#2f3849") - (bg-region "#5a5a5a") - (fg-region "#ffffff") - - (bg-mode-line-active "#2a2a6a") - (fg-mode-line-active "#f0f0f0") - (border-mode-line-active "#8080a7") - (bg-mode-line-inactive "#2d2d2d") - (fg-mode-line-inactive "#969696") - (border-mode-line-inactive "#606060") - - (modeline-err "#e5bf00") - (modeline-warning "#c0cf35") - (modeline-info "#abeadf") - - (bg-tab-bar "#313131") - (bg-tab-current "#000000") - (bg-tab-other "#545454") - -;;; Diffs - - (bg-added "#003066") - (bg-added-faint "#001a4f") - (bg-added-refine "#0f4a77") - (bg-added-fringe "#006fff") - (fg-added "#c4d5ff") - (fg-added-intense "#8080ff") - - (bg-changed "#2f123f") - (bg-changed-faint "#1f022f") - (bg-changed-refine "#3f325f") - (bg-changed-fringe "#7f55a0") - (fg-changed "#e3cfff") - (fg-changed-intense "#cf9fe2") - - (bg-removed "#3d3d00") - (bg-removed-faint "#281f00") - (bg-removed-refine "#555500") - (bg-removed-fringe "#d0c03f") - (fg-removed "#d4d48f") - (fg-removed-intense "#d0b05f") - - (bg-diff-context "#1a1a1a") - -;;; Paren match - - (bg-paren-match "#2f7f9f") - (fg-paren-match fg-main) - (bg-paren-expression "#453040") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor yellow-intense) - - (keybind blue-cooler) - (name blue-cooler) - (identifier yellow-faint) - - (err yellow-warmer) - (warning yellow) - (info blue) - - (underline-err yellow-intense) - (underline-warning magenta-faint) - (underline-note cyan) - - (bg-prominent-err bg-yellow-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-magenta-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-yellow-nuanced) - (fg-active-argument yellow-warmer) - (bg-active-value bg-blue-nuanced) - (fg-active-value blue-warmer) - -;;;; Code mappings - - (bracket fg-main) - (builtin yellow) - (comment yellow-cooler) - (constant blue-faint) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring cyan-faint) - (fnname yellow-warmer) - (keyword blue-cooler) - (number fg-main) - (operator fg-main) - (preprocessor magenta-cooler) - (property cyan) - (punctuation fg-main) - (rx-backslash blue-cooler) - (rx-construct yellow-cooler) - (string blue-warmer) - (type cyan-cooler) - (variable cyan) - -;;;; Accent mappings - - (accent-0 blue-warmer) - (accent-1 yellow) - (accent-2 cyan-cooler) - (accent-3 yellow-cooler) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 blue-cooler) - (fg-completion-match-1 yellow) - (fg-completion-match-2 cyan-cooler) - (fg-completion-match-3 yellow-cooler) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan) - (date-deadline yellow-warmer) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday yellow-warmer) - (date-holiday-other blue) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled yellow-cooler) - (date-scheduled-subtle yellow-faint) - (date-weekday cyan) - (date-weekend magenta-cooler) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link blue-warmer) - (bg-link unspecified) - (underline-link blue-warmer) - - (fg-link-symbolic cyan) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan) - - (fg-link-visited yellow-faint) - (bg-link-visited unspecified) - (underline-link-visited yellow-faint) - -;;;; Mail mappings - - (mail-cite-0 blue-warmer) - (mail-cite-1 yellow-cooler) - (mail-cite-2 cyan-faint) - (mail-cite-3 yellow) - (mail-part blue) - (mail-recipient blue) - (mail-subject yellow-warmer) - (mail-other cyan-faint) - -;;;; Mark mappings - - (bg-mark-delete bg-yellow-subtle) - (fg-mark-delete yellow) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-magenta-subtle) - (fg-mark-other magenta-warmer) - -;;;; Prompt mappings - - (fg-prompt blue) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan-cooler) - - (bg-prose-macro unspecified) - (fg-prose-macro magenta-cooler) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim yellow) - - (prose-done blue) - (prose-todo yellow-warmer) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula yellow-warmer) - - (prose-tag fg-alt) - -;;;; Rainbow mappings - - (rainbow-0 yellow-warmer) - (rainbow-1 blue) - (rainbow-2 yellow-cooler) - (rainbow-3 blue-warmer) - (rainbow-4 yellow) - (rainbow-5 cyan-warmer) - (rainbow-6 yellow-faint) - (rainbow-7 blue-faint) - (rainbow-8 magenta-faint) - -;;;; Search mappings - - (bg-search-current bg-yellow-intense) - (bg-search-lazy bg-blue-intense) - (bg-search-replace bg-yellow-intense) - - (bg-search-rx-group-0 bg-cyan-intense) - (bg-search-rx-group-1 bg-magenta-intense) - (bg-search-rx-group-2 bg-blue-subtle) - (bg-search-rx-group-3 bg-yellow-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-yellow-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 yellow-faint) - (fg-heading-3 blue-faint) - (fg-heading-4 green-faint) - (fg-heading-5 magenta-cooler) - (fg-heading-6 yellow-cooler) - (fg-heading-7 cyan) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-vivendi-deuteranopia' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-vivendi-deuteranopia-palette-user nil - "Like the `modus-vivendi-deuteranopia-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-vivendi-deuteranopia-palette-user nil + "Like the `modus-vivendi-deuteranopia-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-vivendi-deuteranopia-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-vivendi-deuteranopia-palette-overrides nil - "Overrides for `modus-vivendi-deuteranopia-palette'. +(defcustom modus-vivendi-deuteranopia-palette-overrides nil + "Overrides for `modus-vivendi-deuteranopia-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -523,18 +68,25 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-vivendi-deuteranopia - modus-vivendi-deuteranopia-palette - modus-vivendi-deuteranopia-palette-overrides) - - (provide-theme 'modus-vivendi-deuteranopia)) +(modus-themes-theme + 'modus-vivendi-deuteranopia + 'modus-themes + "Deuteranopia-optimized theme with a black background. +This variant is optimized for users with red-green color +deficiency (deuteranopia). It conforms with the highest +legibility standard for color contrast between background and +foreground in any given piece of text, which corresponds to a +minimum contrast in relative luminance of 7:1 (WCAG AAA +standard)." + 'dark + 'modus-themes-vivendi-deuteranopia-palette + 'modus-vivendi-deuteranopia-palette-user + 'modus-vivendi-deuteranopia-palette-overrides) ;;; modus-vivendi-deuteranopia-theme.el ends here diff --git a/etc/themes/modus-vivendi-theme.el b/etc/themes/modus-vivendi-theme.el index 10b95ec9c43..27380f661ce 100644 --- a/etc/themes/modus-vivendi-theme.el +++ b/etc/themes/modus-vivendi-theme.el @@ -26,488 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-vivendi - "Elegant, highly legible theme with a black background. -Conforms with the highest legibility standard for color contrast -between background and foreground in any given piece of text, -which corresponds to a minimum contrast in relative luminance of -7:1 (WCAG AAA standard)." - :background-mode 'dark - :kind 'color-scheme - :family 'modus) - - (defconst modus-vivendi-palette - '( -;;; Basic values - - (bg-main "#000000") - (bg-dim "#1e1e1e") - (fg-main "#ffffff") - (fg-dim "#989898") - (fg-alt "#c6daff") - (bg-active "#535353") - (bg-inactive "#303030") - (border "#646464") - -;;; Common accent foregrounds - - (red "#ff5f59") - (red-warmer "#ff6b55") - (red-cooler "#ff7f86") - (red-faint "#ff9580") - (red-intense "#ff5f5f") - (green "#44bc44") - (green-warmer "#70b900") - (green-cooler "#00c06f") - (green-faint "#88ca9f") - (green-intense "#44df44") - (yellow "#d0bc00") - (yellow-warmer "#fec43f") - (yellow-cooler "#dfaf7a") - (yellow-faint "#d2b580") - (yellow-intense "#efef00") - (blue "#2fafff") - (blue-warmer "#79a8ff") - (blue-cooler "#00bcff") - (blue-faint "#82b0ec") - (blue-intense "#338fff") - (magenta "#feacd0") - (magenta-warmer "#f78fe7") - (magenta-cooler "#b6a0ff") - (magenta-faint "#caa6df") - (magenta-intense "#ff66ff") - (cyan "#00d3d0") - (cyan-warmer "#4ae2f0") - (cyan-cooler "#6ae4b9") - (cyan-faint "#9ac8e0") - (cyan-intense "#00eff0") - -;;; Uncommon accent foregrounds - - (rust "#db7b5f") - (gold "#c0965b") - (olive "#9cbd6f") - (slate "#76afbf") - (indigo "#9099d9") - (maroon "#cf7fa7") - (pink "#d09dc0") - -;;; Common accent backgrounds - - (bg-red-intense "#9d1f1f") - (bg-green-intense "#2f822f") - (bg-yellow-intense "#7a6100") - (bg-blue-intense "#1640b0") - (bg-magenta-intense "#7030af") - (bg-cyan-intense "#2266ae") - - (bg-red-subtle "#620f2a") - (bg-green-subtle "#00422a") - (bg-yellow-subtle "#4a4000") - (bg-blue-subtle "#242679") - (bg-magenta-subtle "#552f5f") - (bg-cyan-subtle "#004065") - - (bg-red-nuanced "#3a0c14") - (bg-green-nuanced "#092f1f") - (bg-yellow-nuanced "#381d0f") - (bg-blue-nuanced "#12154a") - (bg-magenta-nuanced "#2f0c3f") - (bg-cyan-nuanced "#042837") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#49191a") - (fg-clay "#f1b090") - - (bg-ochre "#462f20") - (fg-ochre "#e0d09c") - - (bg-lavender "#38325c") - (fg-lavender "#dfc0f0") - - (bg-sage "#143e32") - (fg-sage "#c3e7d4") - -;;; Graphs - - (bg-graph-red-0 "#b52c2c") - (bg-graph-red-1 "#702020") - (bg-graph-green-0 "#0fed00") - (bg-graph-green-1 "#007800") - (bg-graph-yellow-0 "#f1e00a") - (bg-graph-yellow-1 "#b08940") - (bg-graph-blue-0 "#2fafef") - (bg-graph-blue-1 "#1f2f8f") - (bg-graph-magenta-0 "#bf94fe") - (bg-graph-magenta-1 "#5f509f") - (bg-graph-cyan-0 "#47dfea") - (bg-graph-cyan-1 "#00808f") - -;;; Special purpose - - (bg-completion "#2f447f") - (bg-hover "#45605e") - (bg-hover-secondary "#654a39") - (bg-hl-line "#2f3849") - (bg-region "#5a5a5a") - (fg-region "#ffffff") - - (bg-mode-line-active "#505050") - (fg-mode-line-active "#ffffff") - (border-mode-line-active "#959595") - (bg-mode-line-inactive "#2d2d2d") - (fg-mode-line-inactive "#969696") - (border-mode-line-inactive "#606060") - - (modeline-err "#ffa9bf") - (modeline-warning "#dfcf43") - (modeline-info "#9fefff") - - (bg-tab-bar "#313131") - (bg-tab-current "#000000") - (bg-tab-other "#545454") - -;;; Diffs - - (bg-added "#00381f") - (bg-added-faint "#002910") - (bg-added-refine "#034f2f") - (bg-added-fringe "#237f3f") - (fg-added "#a0e0a0") - (fg-added-intense "#80e080") - - (bg-changed "#363300") - (bg-changed-faint "#2a1f00") - (bg-changed-refine "#4a4a00") - (bg-changed-fringe "#8a7a00") - (fg-changed "#efef80") - (fg-changed-intense "#c0b05f") - - (bg-removed "#4f1119") - (bg-removed-faint "#380a0f") - (bg-removed-refine "#781a1f") - (bg-removed-fringe "#b81a1f") - (fg-removed "#ffbfbf") - (fg-removed-intense "#ff9095") - - (bg-diff-context "#1a1a1a") - -;;; Paren match - - (bg-paren-match "#2f7f9f") - (fg-paren-match fg-main) - (bg-paren-expression "#453040") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor fg-main) - - (keybind blue-cooler) - (name magenta) - (identifier yellow-faint) - - (err red) - (warning yellow-warmer) - (info cyan-cooler) - - (underline-err red-intense) - (underline-warning yellow) - (underline-note cyan) - - (bg-prominent-err bg-red-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-yellow-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-yellow-nuanced) - (fg-active-argument yellow-cooler) - (bg-active-value bg-cyan-nuanced) - (fg-active-value cyan-cooler) - -;;;; Code mappings - - (bracket fg-main) - (builtin magenta-warmer) - (comment fg-dim) - (constant blue-cooler) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring cyan-faint) - (fnname magenta) - (keyword magenta-cooler) - (number fg-main) - (operator fg-main) - (preprocessor red-cooler) - (property cyan) - (punctuation fg-main) - (rx-backslash magenta) - (rx-construct green-cooler) - (string blue-warmer) - (type cyan-cooler) - (variable cyan) - -;;;; Accent mappings - - (accent-0 blue-cooler) - (accent-1 magenta-warmer) - (accent-2 cyan-cooler) - (accent-3 yellow) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 blue-cooler) - (fg-completion-match-1 magenta-warmer) - (fg-completion-match-2 cyan-cooler) - (fg-completion-match-3 yellow) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan) - (date-deadline red-cooler) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday magenta-warmer) - (date-holiday-other blue) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled yellow-cooler) - (date-scheduled-subtle yellow-faint) - (date-weekday cyan) - (date-weekend magenta) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link blue-warmer) - (bg-link unspecified) - (underline-link blue-warmer) - - (fg-link-symbolic cyan) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan) - - (fg-link-visited magenta) - (bg-link-visited unspecified) - (underline-link-visited magenta) - -;;;; Mail mappings - - (mail-cite-0 blue-warmer) - (mail-cite-1 yellow-cooler) - (mail-cite-2 cyan-cooler) - (mail-cite-3 red-cooler) - (mail-part blue) - (mail-recipient magenta-cooler) - (mail-subject magenta-warmer) - (mail-other magenta-faint) - -;;;; Mark mappings - - (bg-mark-delete bg-red-subtle) - (fg-mark-delete red-cooler) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-yellow-subtle) - (fg-mark-other yellow) - -;;;; Prompt mappings - - (fg-prompt cyan-cooler) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan-cooler) - - (bg-prose-macro unspecified) - (fg-prose-macro magenta-cooler) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim magenta-warmer) - - (prose-done green) - (prose-todo red) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula magenta-warmer) - - (prose-tag magenta-faint) - -;;;; Rainbow mappings - - (rainbow-0 fg-main) - (rainbow-1 magenta-intense) - (rainbow-2 cyan-intense) - (rainbow-3 red-warmer) - (rainbow-4 yellow-intense) - (rainbow-5 magenta-cooler) - (rainbow-6 green-intense) - (rainbow-7 blue-warmer) - (rainbow-8 magenta-warmer) - -;;;; Search mappings - - (bg-search-current bg-yellow-intense) - (bg-search-lazy bg-cyan-intense) - (bg-search-replace bg-red-intense) - - (bg-search-rx-group-0 bg-blue-intense) - (bg-search-rx-group-1 bg-green-intense) - (bg-search-rx-group-2 bg-red-subtle) - (bg-search-rx-group-3 bg-magenta-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-red-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 yellow-faint) - (fg-heading-3 blue-faint) - (fg-heading-4 magenta) - (fg-heading-5 green-faint) - (fg-heading-6 red-faint) - (fg-heading-7 cyan-faint) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-vivendi' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-vivendi-palette-user nil - "Like the `modus-vivendi--palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-vivendi-palette-user nil + "Like the `modus-vivendi--palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-vivendi--palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-vivendi-palette-overrides nil - "Overrides for `modus-vivendi-palette'. +(defcustom modus-vivendi-palette-overrides nil + "Overrides for `modus-vivendi-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -521,18 +68,23 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-vivendi - modus-vivendi-palette - modus-vivendi-palette-overrides) - - (provide-theme 'modus-vivendi)) +(modus-themes-theme + 'modus-vivendi + 'modus-themes + "Elegant, highly legible theme with a black background. +Conforms with the highest legibility standard for color contrast +between background and foreground in any given piece of text, +which corresponds to a minimum contrast in relative luminance of +7:1 (WCAG AAA standard)." + 'dark + 'modus-themes-vivendi-palette + 'modus-vivendi-palette-user + 'modus-vivendi-palette-overrides) ;;; modus-vivendi-theme.el ends here diff --git a/etc/themes/modus-vivendi-tinted-theme.el b/etc/themes/modus-vivendi-tinted-theme.el index f5e6d1d9584..f0927902642 100644 --- a/etc/themes/modus-vivendi-tinted-theme.el +++ b/etc/themes/modus-vivendi-tinted-theme.el @@ -26,488 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-vivendi-tinted - "Elegant, highly legible theme with a night sky background. -Conforms with the highest legibility standard for color contrast -between background and foreground in any given piece of text, -which corresponds to a minimum contrast in relative luminance of -7:1 (WCAG AAA standard)." - :background-mode 'dark - :kind 'color-scheme - :family 'modus) - - (defconst modus-vivendi-tinted-palette - '( -;;; Basic values - - (bg-main "#0d0e1c") - (bg-dim "#1d2235") - (fg-main "#ffffff") - (fg-dim "#989898") - (fg-alt "#c6daff") - (bg-active "#4a4f69") - (bg-inactive "#2b3045") - (border "#61647a") - -;;; Common accent foregrounds - - (red "#ff5f59") - (red-warmer "#ff6b55") - (red-cooler "#ff7f86") - (red-faint "#ef8386") - (red-intense "#ff5f5f") - (green "#44bc44") - (green-warmer "#75c13e") - (green-cooler "#11c777") - (green-faint "#88ca9f") - (green-intense "#44df44") - (yellow "#d0bc00") - (yellow-warmer "#fec43f") - (yellow-cooler "#dfaf7a") - (yellow-faint "#d2b580") - (yellow-intense "#efef00") - (blue "#2fafff") - (blue-warmer "#79a8ff") - (blue-cooler "#00bcff") - (blue-faint "#82b0ec") - (blue-intense "#338fff") - (magenta "#feacd0") - (magenta-warmer "#f78fe7") - (magenta-cooler "#b6a0ff") - (magenta-faint "#caa6df") - (magenta-intense "#ff66ff") - (cyan "#00d3d0") - (cyan-warmer "#4ae2f0") - (cyan-cooler "#6ae4b9") - (cyan-faint "#9ac8e0") - (cyan-intense "#00eff0") - -;;; Uncommon accent foregrounds - - (rust "#db7b5f") - (gold "#c0965b") - (olive "#9cbd6f") - (slate "#76afbf") - (indigo "#9099d9") - (maroon "#cf7fa7") - (pink "#d09dc0") - -;;; Common accent backgrounds - - (bg-red-intense "#9d1f1f") - (bg-green-intense "#2f822f") - (bg-yellow-intense "#7a6100") - (bg-blue-intense "#1640b0") - (bg-magenta-intense "#7030af") - (bg-cyan-intense "#2266ae") - - (bg-red-subtle "#620f2a") - (bg-green-subtle "#00422a") - (bg-yellow-subtle "#4a4000") - (bg-blue-subtle "#242679") - (bg-magenta-subtle "#552f5f") - (bg-cyan-subtle "#004065") - - (bg-red-nuanced "#3a0c14") - (bg-green-nuanced "#092f1f") - (bg-yellow-nuanced "#381d0f") - (bg-blue-nuanced "#12154a") - (bg-magenta-nuanced "#2f0c3f") - (bg-cyan-nuanced "#042837") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#49191a") - (fg-clay "#f1b090") - - (bg-ochre "#462f20") - (fg-ochre "#e0d09c") - - (bg-lavender "#38325c") - (fg-lavender "#dfc0f0") - - (bg-sage "#143e32") - (fg-sage "#c3e7d4") - -;;; Graphs - - (bg-graph-red-0 "#b52c2c") - (bg-graph-red-1 "#702020") - (bg-graph-green-0 "#0fed00") - (bg-graph-green-1 "#007800") - (bg-graph-yellow-0 "#f1e00a") - (bg-graph-yellow-1 "#b08940") - (bg-graph-blue-0 "#2fafef") - (bg-graph-blue-1 "#1f2f8f") - (bg-graph-magenta-0 "#bf94fe") - (bg-graph-magenta-1 "#5f509f") - (bg-graph-cyan-0 "#47dfea") - (bg-graph-cyan-1 "#00808f") - -;;; Special purpose - - (bg-completion "#483d8a") - (bg-hover "#45605e") - (bg-hover-secondary "#64404f") - (bg-hl-line "#303a6f") - (bg-region "#555a66") - (fg-region "#ffffff") - - (bg-mode-line-active "#484d67") - (fg-mode-line-active "#ffffff") - (border-mode-line-active "#979797") - (bg-mode-line-inactive "#292d48") - (fg-mode-line-inactive "#969696") - (border-mode-line-inactive "#606270") - - (modeline-err "#ffa9bf") - (modeline-warning "#dfcf43") - (modeline-info "#9fefff") - - (bg-tab-bar "#2c3045") - (bg-tab-current "#0d0e1c") - (bg-tab-other "#4a4f6a") - -;;; Diffs - - (bg-added "#003a2f") - (bg-added-faint "#002922") - (bg-added-refine "#035542") - (bg-added-fringe "#23884f") - (fg-added "#a0e0a0") - (fg-added-intense "#80e080") - - (bg-changed "#363300") - (bg-changed-faint "#2a1f00") - (bg-changed-refine "#4a4a00") - (bg-changed-fringe "#8f7a30") - (fg-changed "#efef80") - (fg-changed-intense "#c0b05f") - - (bg-removed "#4f1127") - (bg-removed-faint "#380a19") - (bg-removed-refine "#781a3a") - (bg-removed-fringe "#b81a26") - (fg-removed "#ffbfbf") - (fg-removed-intense "#ff9095") - - (bg-diff-context "#1a1f30") - -;;; Paren match - - (bg-paren-match "#4f7f9f") - (fg-paren-match fg-main) - (bg-paren-expression "#453040") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor magenta-intense) - - (keybind magenta-cooler) - (name magenta) - (identifier yellow-faint) - - (err red) - (warning yellow) - (info green-cooler) - - (underline-err red-intense) - (underline-warning yellow) - (underline-note cyan) - - (bg-prominent-err bg-red-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-yellow-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-yellow-nuanced) - (fg-active-argument yellow-cooler) - (bg-active-value bg-cyan-nuanced) - (fg-active-value cyan-cooler) - -;;;; Code mappings - - (bracket fg-main) - (builtin magenta) - (comment red-faint) - (constant magenta-cooler) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring cyan-faint) - (fnname magenta-warmer) - (keyword blue-warmer) - (number fg-main) - (operator fg-main) - (preprocessor red-cooler) - (property cyan-warmer) - (punctuation fg-main) - (rx-backslash magenta-warmer) - (rx-construct magenta-cooler) - (string blue) - (type green-cooler) - (variable cyan-warmer) - -;;;; Accent mappings - - (accent-0 magenta-cooler) - (accent-1 cyan) - (accent-2 magenta-warmer) - (accent-3 yellow-warmer) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 blue-cooler) - (fg-completion-match-1 magenta-warmer) - (fg-completion-match-2 cyan-cooler) - (fg-completion-match-3 yellow) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan) - (date-deadline red-cooler) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday magenta-warmer) - (date-holiday-other blue) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled yellow-cooler) - (date-scheduled-subtle yellow-faint) - (date-weekday cyan) - (date-weekend magenta) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link blue-warmer) - (bg-link unspecified) - (underline-link blue-warmer) - - (fg-link-symbolic cyan) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan) - - (fg-link-visited magenta) - (bg-link-visited unspecified) - (underline-link-visited magenta) - -;;;; Mail mappings - - (mail-cite-0 blue-faint) - (mail-cite-1 yellow-cooler) - (mail-cite-2 cyan-cooler) - (mail-cite-3 red-cooler) - (mail-part blue) - (mail-recipient blue-warmer) - (mail-subject magenta-warmer) - (mail-other magenta) - -;;;; Mark mappings - - (bg-mark-delete bg-red-subtle) - (fg-mark-delete red-cooler) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-yellow-subtle) - (fg-mark-other yellow) - -;;;; Prompt mappings - - (fg-prompt cyan-warmer) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan-cooler) - - (bg-prose-macro unspecified) - (fg-prose-macro magenta-cooler) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim magenta-warmer) - - (prose-done green) - (prose-todo red) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula magenta-warmer) - - (prose-tag magenta-faint) - -;;;; Rainbow mappings - - (rainbow-0 fg-main) - (rainbow-1 magenta-intense) - (rainbow-2 cyan-intense) - (rainbow-3 red-warmer) - (rainbow-4 yellow-intense) - (rainbow-5 magenta-cooler) - (rainbow-6 green-intense) - (rainbow-7 blue-warmer) - (rainbow-8 magenta-warmer) - -;;;; Search mappings - - (bg-search-current bg-yellow-intense) - (bg-search-lazy bg-cyan-intense) - (bg-search-replace bg-red-intense) - - (bg-search-rx-group-0 bg-blue-intense) - (bg-search-rx-group-1 bg-green-intense) - (bg-search-rx-group-2 bg-red-subtle) - (bg-search-rx-group-3 bg-magenta-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-red-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 yellow-faint) - (fg-heading-3 blue-faint) - (fg-heading-4 magenta) - (fg-heading-5 green-faint) - (fg-heading-6 red-faint) - (fg-heading-7 cyan-faint) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-vivendi-tinted' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-vivendi-tinted-palette-user nil - "Like the `modus-vivendi-tinted-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-vivendi-tinted-palette-user nil + "Like the `modus-vivendi-tinted-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-vivendi-tinted-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-vivendi-tinted-palette-overrides nil - "Overrides for `modus-vivendi-tinted-palette'. +(defcustom modus-vivendi-tinted-palette-overrides nil + "Overrides for `modus-vivendi-tinted-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -521,18 +68,23 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-vivendi-tinted - modus-vivendi-tinted-palette - modus-vivendi-tinted-palette-overrides) - - (provide-theme 'modus-vivendi-tinted)) +(modus-themes-theme + 'modus-vivendi-tinted + 'modus-themes + "Elegant, highly legible theme with a night sky background. +Conforms with the highest legibility standard for color contrast +between background and foreground in any given piece of text, +which corresponds to a minimum contrast in relative luminance of +7:1 (WCAG AAA standard)." + 'dark + 'modus-themes-vivendi-tinted-palette + 'modus-vivendi-tinted-palette-user + 'modus-vivendi-tinted-palette-overrides) ;;; modus-vivendi-tinted-theme.el ends here diff --git a/etc/themes/modus-vivendi-tritanopia-theme.el b/etc/themes/modus-vivendi-tritanopia-theme.el index d8027368848..aeecdeaf9be 100644 --- a/etc/themes/modus-vivendi-tritanopia-theme.el +++ b/etc/themes/modus-vivendi-tritanopia-theme.el @@ -26,490 +26,35 @@ ;; ;; The Modus themes conform with the highest standard for ;; color-contrast accessibility between background and foreground -;; values (WCAG AAA). Please refer to the official Info manual for -;; further documentation (distributed with the themes, or available -;; at: ). +;; values (WCAG AAA). They are also highly customizable and can even +;; be used as the basis for other themes. Please refer to the official +;; Info manual for further documentation (distributed with the themes, +;; or available at: ). ;;; Code: -(eval-and-compile - (unless (and (fboundp 'require-theme) - load-file-name - (equal (file-name-directory load-file-name) - (expand-file-name "themes/" data-directory)) - (require-theme 'modus-themes t)) - (require 'modus-themes)) - -;;;###theme-autoload - (deftheme modus-vivendi-tritanopia - "Tritanopia-optimized theme with a black background. -This variant is optimized for users with blue-yellow color -deficiency (tritanopia). It conforms with the highest -legibility standard for color contrast between background and -foreground in any given piece of text, which corresponds to a -minimum contrast in relative luminance of 7:1 (WCAG AAA -standard)." - :background-mode 'dark - :kind 'color-scheme - :family 'modus) - - (defconst modus-vivendi-tritanopia-palette - '( -;;; Basic values - - (bg-main "#000000") - (bg-dim "#1e1e1e") - (fg-main "#ffffff") - (fg-dim "#989898") - (fg-alt "#a0d7f2") - (bg-active "#535353") - (bg-inactive "#303030") - (border "#646464") - -;;; Common accent foregrounds - - (red "#ff5f59") - (red-warmer "#ff6740") - (red-cooler "#ff7f86") - (red-faint "#ff9070") - (red-intense "#ff5f5f") - (green "#44bc44") - (green-warmer "#70b900") - (green-cooler "#00c06f") - (green-faint "#88ca9f") - (green-intense "#44df44") - (yellow "#cabf00") - (yellow-warmer "#ffa00f") - (yellow-cooler "#d8af7a") - (yellow-faint "#d2b580") - (yellow-intense "#efef00") - (blue "#2fafff") - (blue-warmer "#79a8ff") - (blue-cooler "#00bcff") - (blue-faint "#82b0ec") - (blue-intense "#338fff") - (magenta "#feacd0") - (magenta-warmer "#f78fe7") - (magenta-cooler "#b6a0ff") - (magenta-faint "#caa6df") - (magenta-intense "#ef7fff") - (cyan "#00d3d0") - (cyan-warmer "#4ae2ff") - (cyan-cooler "#6ae4b9") - (cyan-faint "#7fdbdf") - (cyan-intense "#00eff0") - -;;; Uncommon accent foregrounds - - (rust "#db7b5f") - (gold "#c0965b") - (olive "#9cbd6f") - (slate "#76afbf") - (indigo "#9099d9") - (maroon "#cf7fa7") - (pink "#d09dc0") - -;;; Common accent backgrounds - - (bg-red-intense "#9d1f1f") - (bg-green-intense "#2f822f") - (bg-yellow-intense "#7a6100") - (bg-blue-intense "#1640b0") - (bg-magenta-intense "#7030af") - (bg-cyan-intense "#2266ae") - - (bg-red-subtle "#620f2a") - (bg-green-subtle "#00422a") - (bg-yellow-subtle "#4a4000") - (bg-blue-subtle "#242679") - (bg-magenta-subtle "#552f5f") - (bg-cyan-subtle "#004065") - - (bg-red-nuanced "#3a0c14") - (bg-green-nuanced "#092f1f") - (bg-yellow-nuanced "#381d0f") - (bg-blue-nuanced "#12154a") - (bg-magenta-nuanced "#2f0c3f") - (bg-cyan-nuanced "#042837") - -;;; Uncommon accent background and foreground pairs - - (bg-clay "#49191a") - (fg-clay "#f1b090") - - (bg-ochre "#462f20") - (fg-ochre "#e0d09c") - - (bg-lavender "#38325c") - (fg-lavender "#dfc0f0") - - (bg-sage "#143e32") - (fg-sage "#c3e7d4") - -;;; Graphs - - (bg-graph-red-0 "#b52c2c") - (bg-graph-red-1 "#702020") - (bg-graph-green-0 "#afd1c0") - (bg-graph-green-1 "#607a8f") - (bg-graph-yellow-0 "#facfd6") - (bg-graph-yellow-1 "#b57b85") - (bg-graph-blue-0 "#4f9fdf") - (bg-graph-blue-1 "#004559") - (bg-graph-magenta-0 "#b6427f") - (bg-graph-magenta-1 "#7f506f") - (bg-graph-cyan-0 "#57dfea") - (bg-graph-cyan-1 "#00808f") - -;;; Special purpose - - (bg-completion "#004253") - (bg-hover "#8e3e3b") - (bg-hover-secondary "#204853") - (bg-hl-line "#2f3849") - (bg-region "#5a5a5a") - (fg-region "#ffffff") - - (bg-mode-line-active "#003c52") - (fg-mode-line-active "#f0f0f0") - (border-mode-line-active "#5f8fb4") - (bg-mode-line-inactive "#2d2d2d") - (fg-mode-line-inactive "#969696") - (border-mode-line-inactive "#606060") - - (modeline-err "#ff7fbf") - (modeline-warning "#df9f93") - (modeline-info "#4fcfef") - - (bg-tab-bar "#313131") - (bg-tab-current "#000000") - (bg-tab-other "#545454") - -;;; Diffs - - (bg-added "#004254") - (bg-added-faint "#003042") - (bg-added-refine "#004f7f") - (bg-added-fringe "#008fcf") - (fg-added "#9fdfdf") - (fg-added-intense "#50c0ef") - - (bg-changed "#2f123f") - (bg-changed-faint "#1f022f") - (bg-changed-refine "#3f325f") - (bg-changed-fringe "#7f55a0") - (fg-changed "#e3cfff") - (fg-changed-intense "#cf9fe2") - - (bg-removed "#4f1119") - (bg-removed-faint "#380a0f") - (bg-removed-refine "#781a1f") - (bg-removed-fringe "#b81a1f") - (fg-removed "#ffbfbf") - (fg-removed-intense "#ff9095") - - (bg-diff-context "#1a1a1a") - -;;; Paren match - - (bg-paren-match "#2f7f9f") - (fg-paren-match fg-main) - (bg-paren-expression "#453040") - (underline-paren-match unspecified) - -;;; Mappings - -;;;; General mappings - - (fringe bg-dim) - (cursor red-intense) - - (keybind red) - (name red-cooler) - (identifier red-faint) - - (err red-warmer) - (warning magenta) - (info cyan) - - (underline-err red-intense) - (underline-warning magenta-intense) - (underline-note cyan-intense) - - (bg-prominent-err bg-red-intense) - (fg-prominent-err fg-main) - (bg-prominent-warning bg-magenta-intense) - (fg-prominent-warning fg-main) - (bg-prominent-note bg-cyan-intense) - (fg-prominent-note fg-main) - - (bg-active-argument bg-red-nuanced) - (fg-active-argument red-warmer) - (bg-active-value bg-cyan-nuanced) - (fg-active-value cyan) - -;;;; Code mappings - - (bracket fg-main) - (builtin magenta) - (comment red-faint) - (constant green-faint) - (delimiter fg-main) - (docmarkup magenta-faint) - (docstring fg-alt) - (fnname cyan-warmer) - (keyword red-cooler) - (number fg-main) - (operator fg-main) - (preprocessor red-warmer) - (property cyan-cooler) - (punctuation fg-main) - (rx-backslash magenta) - (rx-construct red) - (string cyan) - (type blue-warmer) - (variable cyan-cooler) - -;;;; Accent mappings - - (accent-0 cyan) - (accent-1 red-warmer) - (accent-2 cyan-cooler) - (accent-3 magenta) - -;;;; Button mappings - - (fg-button-active fg-main) - (fg-button-inactive fg-dim) - (bg-button-active bg-active) - (bg-button-inactive bg-dim) - -;;;; Completion mappings - - (fg-completion-match-0 cyan) - (fg-completion-match-1 red-warmer) - (fg-completion-match-2 magenta) - (fg-completion-match-3 cyan-cooler) - (bg-completion-match-0 unspecified) - (bg-completion-match-1 unspecified) - (bg-completion-match-2 unspecified) - (bg-completion-match-3 unspecified) - -;;;; Date mappings - - (date-common cyan-cooler) - (date-deadline red) - (date-deadline-subtle red-faint) - (date-event fg-alt) - (date-holiday red-intense) - (date-holiday-other cyan-warmer) - (date-now fg-main) - (date-range fg-alt) - (date-scheduled magenta) - (date-scheduled-subtle magenta-faint) - (date-weekday cyan) - (date-weekend magenta-warmer) - -;;;; Line number mappings - - (fg-line-number-inactive fg-dim) - (fg-line-number-active fg-main) - (bg-line-number-inactive bg-dim) - (bg-line-number-active bg-active) - -;;;; Link mappings - - (fg-link cyan) - (bg-link unspecified) - (underline-link cyan) - - (fg-link-symbolic cyan-cooler) - (bg-link-symbolic unspecified) - (underline-link-symbolic cyan-cooler) - - (fg-link-visited magenta) - (bg-link-visited unspecified) - (underline-link-visited magenta) - -;;;; Mail mappings - - (mail-cite-0 cyan-faint) - (mail-cite-1 red-faint) - (mail-cite-2 magenta-warmer) - (mail-cite-3 cyan-warmer) - (mail-part cyan-cooler) - (mail-recipient cyan) - (mail-subject red-cooler) - (mail-other cyan) - -;;;; Mark mappings - - (bg-mark-delete bg-red-subtle) - (fg-mark-delete red) - (bg-mark-select bg-cyan-subtle) - (fg-mark-select cyan) - (bg-mark-other bg-magenta-subtle) - (fg-mark-other magenta-warmer) - -;;;; Prompt mappings - - (fg-prompt cyan-cooler) - (bg-prompt unspecified) - -;;;; Prose mappings - - (bg-prose-block-delimiter bg-dim) - (fg-prose-block-delimiter fg-dim) - (bg-prose-block-contents bg-dim) - - (bg-prose-code unspecified) - (fg-prose-code cyan) - - (bg-prose-macro unspecified) - (fg-prose-macro red-warmer) - - (bg-prose-verbatim unspecified) - (fg-prose-verbatim magenta-warmer) - - (prose-done cyan) - (prose-todo red) - - (prose-metadata fg-dim) - (prose-metadata-value fg-alt) - - (prose-table fg-alt) - (prose-table-formula red-cooler) - - (prose-tag fg-alt) - -;;;; Rainbow mappings - - (rainbow-0 cyan) - (rainbow-1 red) - (rainbow-2 cyan-warmer) - (rainbow-3 red-cooler) - (rainbow-4 cyan-cooler) - (rainbow-5 magenta) - (rainbow-6 cyan-faint) - (rainbow-7 magenta-faint) - (rainbow-8 red-faint) - -;;;; Search mappings - - (bg-search-current bg-red-intense) - (bg-search-lazy bg-cyan-intense) - (bg-search-replace bg-magenta-intense) - - (bg-search-rx-group-0 bg-blue-intense) - (bg-search-rx-group-1 bg-magenta-intense) - (bg-search-rx-group-2 bg-cyan-subtle) - (bg-search-rx-group-3 bg-red-subtle) - -;;;; Space mappings - - (bg-space unspecified) - (fg-space border) - (bg-space-err bg-red-intense) - -;;;; Terminal mappings - - (bg-term-black "#000000") - (fg-term-black "#000000") - (bg-term-black-bright "#595959") - (fg-term-black-bright "#595959") - - (bg-term-red red) - (fg-term-red red) - (bg-term-red-bright red-warmer) - (fg-term-red-bright red-warmer) - - (bg-term-green green) - (fg-term-green green) - (bg-term-green-bright green-cooler) - (fg-term-green-bright green-cooler) - - (bg-term-yellow yellow) - (fg-term-yellow yellow) - (bg-term-yellow-bright yellow-warmer) - (fg-term-yellow-bright yellow-warmer) - - (bg-term-blue blue) - (fg-term-blue blue) - (bg-term-blue-bright blue-warmer) - (fg-term-blue-bright blue-warmer) - - (bg-term-magenta magenta) - (fg-term-magenta magenta) - (bg-term-magenta-bright magenta-cooler) - (fg-term-magenta-bright magenta-cooler) - - (bg-term-cyan cyan) - (fg-term-cyan cyan) - (bg-term-cyan-bright cyan-cooler) - (fg-term-cyan-bright cyan-cooler) - - (bg-term-white "#a6a6a6") - (fg-term-white "#a6a6a6") - (bg-term-white-bright "#ffffff") - (fg-term-white-bright "#ffffff") - -;;;; Heading mappings - - (fg-heading-0 cyan-cooler) - (fg-heading-1 fg-main) - (fg-heading-2 red-faint) - (fg-heading-3 cyan-faint) - (fg-heading-4 magenta) - (fg-heading-5 green-faint) - (fg-heading-6 magenta-faint) - (fg-heading-7 cyan-faint) - (fg-heading-8 fg-dim) - - (bg-heading-0 unspecified) - (bg-heading-1 unspecified) - (bg-heading-2 unspecified) - (bg-heading-3 unspecified) - (bg-heading-4 unspecified) - (bg-heading-5 unspecified) - (bg-heading-6 unspecified) - (bg-heading-7 unspecified) - (bg-heading-8 unspecified) - - (overline-heading-0 unspecified) - (overline-heading-1 unspecified) - (overline-heading-2 unspecified) - (overline-heading-3 unspecified) - (overline-heading-4 unspecified) - (overline-heading-5 unspecified) - (overline-heading-6 unspecified) - (overline-heading-7 unspecified) - (overline-heading-8 unspecified)) - "The entire palette of the `modus-vivendi-tritanopia' theme. - -Named colors have the form (COLOR-NAME HEX-VALUE) with the former -as a symbol and the latter as a string. - -Semantic color mappings have the form (MAPPING-NAME COLOR-NAME) -with both as symbols. The latter is a named color that already -exists in the palette and is associated with a HEX-VALUE.") - - (defcustom modus-vivendi-tritanopia-palette-user nil - "Like the `modus-vivendi-tritanopia-palette' for user-defined entries. +(unless (and (fboundp 'require-theme) + load-file-name + (equal (file-name-directory load-file-name) + (expand-file-name "themes/" data-directory)) + (require-theme 'modus-themes t)) + (require 'modus-themes)) + +(defcustom modus-vivendi-tritanopia-palette-user nil + "Like the `modus-vivendi-tritanopia-palette' for user-defined entries. This is meant to extend the palette with custom named colors and/or semantic palette mappings. Those may then be used in combination with palette overrides (also see `modus-themes-common-palette-overrides' and `modus-vivendi-tritanopia-palette-overrides')." - :group 'modus-themes - :package-version '(modus-themes . "4.5.0") - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.5.0") + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Option to extend the palette for use with overrides")) - (defcustom modus-vivendi-tritanopia-palette-overrides nil - "Overrides for `modus-vivendi-tritanopia-palette'. +(defcustom modus-vivendi-tritanopia-palette-overrides nil + "Overrides for `modus-vivendi-tritanopia-palette'. Mirror the elements of the aforementioned palette, overriding their value. @@ -523,18 +68,25 @@ mappings, such as to make the cursor red. Wherea theme-specific overrides can also be used to change the value of a named color, such as what hexadecimal RGB value the red-warmer symbol represents." - :group 'modus-themes - :package-version '(modus-themes . "4.0.0") - :version "30.1" - :type '(repeat (list symbol (choice symbol string))) - :set #'modus-themes--set-option - :initialize #'custom-initialize-default - :link '(info-link "(modus-themes) Palette overrides")) + :group 'modus-themes + :package-version '(modus-themes . "4.0.0") + :version "30.1" + :type '(repeat (list symbol (choice symbol string))) + :link '(info-link "(modus-themes) Palette overrides")) - (modus-themes-theme modus-vivendi-tritanopia - modus-vivendi-tritanopia-palette - modus-vivendi-tritanopia-palette-overrides) - - (provide-theme 'modus-vivendi-tritanopia)) +(modus-themes-theme + 'modus-vivendi-tritanopia + 'modus-themes + "Tritanopia-optimized theme with a black background. +This variant is optimized for users with blue-yellow color +deficiency (tritanopia). It conforms with the highest +legibility standard for color contrast between background and +foreground in any given piece of text, which corresponds to a +minimum contrast in relative luminance of 7:1 (WCAG AAA +standard)." + 'dark + 'modus-themes-vivendi-tritanopia-palette + 'modus-vivendi-tritanopia-palette-user + 'modus-vivendi-tritanopia-palette-overrides) ;;; modus-vivendi-tritanopia-theme.el ends here diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 61a45622933..391ca1151db 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -35,14 +35,6 @@ along with GNU Emacs. If not, see . */ enum { READ_CHUNK_SIZE = 100 * 1024 }; -/* Value is true if strings X and Y compare equal. */ - -static bool -streq (char const *x, char const *y) -{ - return strcmp (x, y) == 0; -} - static bool filename_eq (char const *x, char const *y) { diff --git a/lib-src/etags.c b/lib-src/etags.c index 6dde9c42e13..8c9d7336c8a 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -147,12 +147,6 @@ memcpyz (void *dest, void const *src, ptrdiff_t len) *e = '\0'; } -static bool -streq (char const *s, char const *t) -{ - return strcmp (s, t) == 0; -} - static bool strcaseeq (char const *s, char const *t) { diff --git a/lib/acl-internal.c b/lib/acl-internal.c index 6c50feacbb8..b8a6ed06c31 100644 --- a/lib/acl-internal.c +++ b/lib/acl-internal.c @@ -31,7 +31,7 @@ # include #endif -#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ +#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */ # if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */ @@ -45,7 +45,7 @@ acl_extended_nontrivial (acl_t acl) return (acl_entries (acl) > 0); } -# else /* Linux, FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */ +# else /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */ /* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS. Return 1 if the given ACL is non-trivial. @@ -118,9 +118,9 @@ acl_access_nontrivial (acl_t acl) - S-1-5-32-545 (group "Users") Cf. and look at the output of the 'mkgroup' command. */ - ignorable = (strcmp (group_sid, "S-1-5-18") == 0 - || strcmp (group_sid, "S-1-5-32-544") == 0 - || strcmp (group_sid, "S-1-5-32-545") == 0); + ignorable = (streq (group_sid, "S-1-5-18") + || streq (group_sid, "S-1-5-32-544") + || streq (group_sid, "S-1-5-32-545")); } } if (!ignorable) @@ -137,46 +137,6 @@ acl_access_nontrivial (acl_t acl) } return got_one; -# elif HAVE_ACL_TO_SHORT_TEXT /* IRIX */ - /* Don't use acl_get_entry: it is undocumented. */ - - int count = acl->acl_cnt; - int i; - - for (i = 0; i < count; i++) - { - acl_entry_t ace = &acl->acl_entry[i]; - acl_tag_t tag = ace->ae_tag; - - if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ - || tag == ACL_OTHER_OBJ)) - return 1; - } - return 0; - -# elif HAVE_ACL_FREE_TEXT /* Tru64 */ - /* Don't use acl_get_entry: it takes only one argument and does not work. */ - - int count = acl->acl_num; - acl_entry_t ace; - - for (ace = acl->acl_first; count > 0; ace = ace->next, count--) - { - acl_tag_t tag; - acl_perm_t perm; - - tag = ace->entry->acl_type; - if (!(tag == ACL_USER_OBJ || tag == ACL_GROUP_OBJ || tag == ACL_OTHER)) - return 1; - - perm = ace->entry->acl_perm; - /* On Tru64, perm can also contain non-standard bits such as - PERM_INSERT, PERM_DELETE, PERM_MODIFY, PERM_LOOKUP, ... */ - if ((perm & ~(ACL_READ | ACL_WRITE | ACL_EXECUTE)) != 0) - return 1; - } - return 0; - # else errno = ENOSYS; @@ -548,7 +508,7 @@ void free_permission_context (struct permission_context *ctx) { #if USE_ACL -# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ +# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */ if (ctx->acl) acl_free (ctx->acl); # if !HAVE_ACL_TYPE_EXTENDED diff --git a/lib/acl-internal.h b/lib/acl-internal.h index cb969e9797e..cf41e050ec4 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -68,7 +68,7 @@ _GL_INLINE_HEADER_BEGIN # if HAVE_ACL_GET_FILE /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */ -/* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ +/* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */ # ifndef MIN_ACL_ENTRIES # define MIN_ACL_ENTRIES 4 @@ -76,17 +76,7 @@ _GL_INLINE_HEADER_BEGIN /* POSIX 1003.1e (draft 17) */ # ifdef HAVE_ACL_GET_FD -/* Most platforms have a 1-argument acl_get_fd, only OSF/1 has a 2-argument - macro(!). */ -# if HAVE_ACL_FREE_TEXT /* OSF/1 */ -ACL_INTERNAL_INLINE acl_t -rpl_acl_get_fd (int fd) -{ - return acl_get_fd (fd, ACL_TYPE_ACCESS); -} -# undef acl_get_fd -# define acl_get_fd rpl_acl_get_fd -# endif +/* acl_get_fd takes one argument. */ # else # define HAVE_ACL_GET_FD false # undef acl_get_fd @@ -95,17 +85,7 @@ rpl_acl_get_fd (int fd) /* POSIX 1003.1e (draft 17) */ # ifdef HAVE_ACL_SET_FD -/* Most platforms have a 2-argument acl_set_fd, only OSF/1 has a 3-argument - macro(!). */ -# if HAVE_ACL_FREE_TEXT /* OSF/1 */ -ACL_INTERNAL_INLINE int -rpl_acl_set_fd (int fd, acl_t acl) -{ - return acl_set_fd (fd, ACL_TYPE_ACCESS, acl); -} -# undef acl_set_fd -# define acl_set_fd rpl_acl_set_fd -# endif +/* acl_set_fd takes two arguments. */ # else # define HAVE_ACL_SET_FD false # undef acl_set_fd @@ -136,7 +116,7 @@ rpl_acl_set_fd (int fd, acl_t acl) # endif /* Set to 0 if a file's mode is stored independently from the ACL. */ -# if (HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP) || defined __sgi /* Mac OS X, IRIX */ +# if HAVE_ACL_COPY_EXT_NATIVE && HAVE_ACL_CREATE_ENTRY_NP /* Mac OS X */ # define MODE_INSIDE_ACL 0 # endif @@ -260,7 +240,7 @@ extern int acl_nontrivial (int count, struct acl *entries); struct permission_context { mode_t mode; #if USE_ACL -# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ +# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */ acl_t acl; # if !HAVE_ACL_TYPE_EXTENDED acl_t default_acl; diff --git a/lib/acl_entries.c b/lib/acl_entries.c index 57b7b4998c0..7b44e694896 100644 --- a/lib/acl_entries.c +++ b/lib/acl_entries.c @@ -22,7 +22,10 @@ #include "acl-internal.h" /* This file assumes POSIX-draft like ACLs - (Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */ + (Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5). + + It is compiled only on systems that do not have the acl_entries() function + (in libc or libacl). */ /* Return the number of entries in ACL. Return -1 and set errno upon failure to determine it. */ @@ -58,16 +61,6 @@ acl_entries (acl_t acl) if (got_one < 0) return -1; # endif -#else /* IRIX, Tru64 */ -# if HAVE_ACL_TO_SHORT_TEXT /* IRIX */ - /* Don't use acl_get_entry: it is undocumented. */ - count = acl->acl_cnt; -# endif -# if HAVE_ACL_FREE_TEXT /* Tru64 */ - /* Don't use acl_get_entry: it takes only one argument and does not - work. */ - count = acl->acl_num; -# endif #endif } diff --git a/lib/boot-time.c b/lib/boot-time.c index 9104bae16ed..65d7aeaa4ac 100644 --- a/lib/boot-time.c +++ b/lib/boot-time.c @@ -88,7 +88,7 @@ get_boot_time_uncached (struct timespec *p_boot_time) /* Try to find the boot time in the /var/run/utmp file. */ -# if defined UTMP_NAME_FUNCTION /* glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, IRIX, Solaris, Cygwin, Android */ +# if defined UTMP_NAME_FUNCTION /* glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, Solaris, Cygwin, Android */ /* Ignore the return value for now. Solaris' utmpname returns 1 upon success -- which is contrary @@ -120,13 +120,13 @@ get_boot_time_uncached (struct timespec *p_boot_time) found_boot_time = ts; # if defined __linux__ && !defined __ANDROID__ - if (memcmp (UT_USER (ut), "runlevel", strlen ("runlevel") + 1) == 0 - && memcmp (ut->ut_line, "~", strlen ("~") + 1) == 0) + if (memeq (UT_USER (ut), "runlevel", strlen ("runlevel") + 1) + && memeq (ut->ut_line, "~", strlen ("~") + 1)) runlevel_ts = ts; # endif # if defined __minix if (UT_USER (ut)[0] == '\0' - && memcmp (ut->ut_line, "run-level ", strlen ("run-level ")) == 0) + && memeq (ut->ut_line, "run-level ", strlen ("run-level "))) runlevel_ts = ts; # endif } diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h index 1227f01d144..6b4fbabf283 100644 --- a/lib/byteswap.in.h +++ b/lib/byteswap.in.h @@ -23,13 +23,16 @@ #error "Please include config.h first." #endif -#include - -_GL_INLINE_HEADER_BEGIN +/* Define this now, rather than after including stdint.h, in case + stdint.h recursively includes us. This is for Gnulib endian.h. */ #ifndef _GL_BYTESWAP_INLINE # define _GL_BYTESWAP_INLINE _GL_INLINE #endif +#include + +_GL_INLINE_HEADER_BEGIN + #ifdef __cplusplus extern "C" { #endif diff --git a/lib/c++defs.h b/lib/c++defs.h index df98a5ae57c..b77979a3259 100644 --- a/lib/c++defs.h +++ b/lib/c++defs.h @@ -310,7 +310,7 @@ _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) # define _GL_CXXALIASWARN_1(func,namespace) \ _GL_CXXALIASWARN_2 (func, namespace) -/* To work around GCC bug , +/* To work around GCC bug , we enable the warning only when not optimizing. */ # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) # define _GL_CXXALIASWARN_2(func,namespace) \ @@ -338,7 +338,7 @@ GNULIB_NAMESPACE) # define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) -/* To work around GCC bug , +/* To work around GCC bug , we enable the warning only when not optimizing. */ # if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) # define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 9ec3ca33224..8f4a3c1a70f 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -45,7 +45,7 @@ enum { STACK_BUF_SIZE = 1024 }; If GCC_LINT is defined, do not inline this function with GCC 10.1 and later, to avoid creating a pointer to the stack that GCC -Wreturn-local-addr incorrectly complains about. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93644 + https://gcc.gnu.org/PR93644 Although the noinline attribute can hurt performance a bit, no better way to pacify GCC is known; even an explicit #pragma does not pacify GCC. When the GCC bug is fixed this workaround should be limited to the @@ -174,7 +174,7 @@ careadlinkat (int fd, char const *filename, shrinking realloc. */ #ifdef GCC_BOGUS_WRETURN_LOCAL_ADDR #warning "GCC might issue a bogus -Wreturn-local-addr warning here." - #warning "See ." + #warning "See ." #endif char stack_buf[STACK_BUF_SIZE]; return readlink_stk (fd, filename, buffer, buffer_size, alloc, diff --git a/lib/cdefs.h b/lib/cdefs.h index 2682c092f0e..dce5739d235 100644 --- a/lib/cdefs.h +++ b/lib/cdefs.h @@ -277,10 +277,10 @@ */ #endif -/* GCC and clang have various useful declarations that can be made with - the '__attribute__' syntax. All of the ways we use this do fine if - they are omitted for compilers that don't understand it. */ -#if !(defined __GNUC__ || defined __clang__) +/* GCC, clang, and compatible compilers have various useful declarations + that can be made with the '__attribute__' syntax. All of the ways we use + this do fine if they are omitted for compilers that don't understand it. */ +#if !(defined __GNUC__ || defined __clang__ || defined __TINYC__) # define __attribute__(xyz) /* Ignore */ #endif diff --git a/lib/copy-file-range.c b/lib/copy-file-range.c index 2465a558028..208750bca6e 100644 --- a/lib/copy-file-range.c +++ b/lib/copy-file-range.c @@ -76,9 +76,9 @@ copy_file_range (int infd, off_t *pinoff, if (ok) { -# if defined __GLIBC__ && ! (2 < __GLIBC__ + (43 <= __GLIBC_MINOR__)) +# if defined __GLIBC__ && ! (2 < __GLIBC__ + (43 <= __GLIBC_MINOR__)) /* Work around glibc bug 33245 - . + . This bug is present in glibc 2.42 (2025) and fixed in 2.43, so this workaround, and the configure-time check for glibc, can be removed once glibc 2.42 and earlier is no longer a diff --git a/lib/dirent.in.h b/lib/dirent.in.h index 9d3bffa97ff..e6c59e5a41d 100644 --- a/lib/dirent.in.h +++ b/lib/dirent.in.h @@ -101,40 +101,6 @@ static_assert (DT_UNKNOWN != DT_FIFO && DT_UNKNOWN != DT_CHR /* Other optional information about a directory entry. */ #define _GL_DT_NOTDIR 0x100 /* Not a directory */ -/* Conversion between S_IF* and DT_* file types. */ -#if ! (defined IFTODT && defined DTTOIF) -# include -# ifdef S_ISWHT -# define _GL_DIRENT_S_ISWHT(mode) S_ISWHT(mode) -# else -# define _GL_DIRENT_S_ISWHT(mode) 0 -# endif -# ifdef S_IFWHT -# define _GL_DIRENT_S_IFWHT S_IFWHT -# else -# define _GL_DIRENT_S_IFWHT (DT_WHT << 12) /* just a guess */ -# endif -#endif -/* Conversion from a 'stat' mode to a DT_* value. */ -#ifndef IFTODT -# define IFTODT(mode) \ - (S_ISREG (mode) ? DT_REG : S_ISDIR (mode) ? DT_DIR \ - : S_ISLNK (mode) ? DT_LNK : S_ISBLK (mode) ? DT_BLK \ - : S_ISCHR (mode) ? DT_CHR : S_ISFIFO (mode) ? DT_FIFO \ - : S_ISSOCK (mode) ? DT_SOCK \ - : _GL_DIRENT_S_ISWHT (mode) ? DT_WHT : DT_UNKNOWN) -#endif -/* Conversion from a DT_* value to a 'stat' mode. */ -#ifndef DTTOIF -# define DTTOIF(dirtype) \ - ((dirtype) == DT_REG ? S_IFREG : (dirtype) == DT_DIR ? S_IFDIR \ - : (dirtype) == DT_LNK ? S_IFLNK : (dirtype) == DT_BLK ? S_IFBLK \ - : (dirtype) == DT_CHR ? S_IFCHR : dirtype == DT_FIFO ? S_IFIFO \ - : (dirtype) == DT_SOCK ? S_IFSOCK \ - : (dirtype) == DT_WHT ? _GL_DIRENT_S_IFWHT \ - : (dirtype) << 12 /* just a guess */) -#endif - #if !@DIR_HAS_FD_MEMBER@ # if !GNULIB_defined_DIR /* struct gl_directory is a type with a field 'int fd_to_close'. @@ -426,5 +392,44 @@ _GL_WARN_ON_USE (alphasort, "alphasort is unportable - " #endif +/* Includes that provide only macros that don't need to be overridden. + (Includes that are needed for type definitions and function declarations + have their place above, before the function overrides.) */ + +/* Conversion between S_IF* and DT_* file types. */ +#if ! (defined IFTODT && defined DTTOIF) +# include +# ifdef S_ISWHT +# define _GL_DIRENT_S_ISWHT(mode) S_ISWHT(mode) +# else +# define _GL_DIRENT_S_ISWHT(mode) 0 +# endif +# ifdef S_IFWHT +# define _GL_DIRENT_S_IFWHT S_IFWHT +# else +# define _GL_DIRENT_S_IFWHT (DT_WHT << 12) /* just a guess */ +# endif +#endif +/* Conversion from a 'stat' mode to a DT_* value. */ +#ifndef IFTODT +# define IFTODT(mode) \ + (S_ISREG (mode) ? DT_REG : S_ISDIR (mode) ? DT_DIR \ + : S_ISLNK (mode) ? DT_LNK : S_ISBLK (mode) ? DT_BLK \ + : S_ISCHR (mode) ? DT_CHR : S_ISFIFO (mode) ? DT_FIFO \ + : S_ISSOCK (mode) ? DT_SOCK \ + : _GL_DIRENT_S_ISWHT (mode) ? DT_WHT : DT_UNKNOWN) +#endif +/* Conversion from a DT_* value to a 'stat' mode. */ +#ifndef DTTOIF +# define DTTOIF(dirtype) \ + ((dirtype) == DT_REG ? S_IFREG : (dirtype) == DT_DIR ? S_IFDIR \ + : (dirtype) == DT_LNK ? S_IFLNK : (dirtype) == DT_BLK ? S_IFBLK \ + : (dirtype) == DT_CHR ? S_IFCHR : dirtype == DT_FIFO ? S_IFIFO \ + : (dirtype) == DT_SOCK ? S_IFSOCK \ + : (dirtype) == DT_WHT ? _GL_DIRENT_S_IFWHT \ + : (dirtype) << 12 /* just a guess */) +#endif + + #endif /* _@GUARD_PREFIX@_DIRENT_H */ #endif /* _@GUARD_PREFIX@_DIRENT_H */ diff --git a/lib/endian.in.h b/lib/endian.in.h index e81aa7da8ce..03f541967fb 100644 --- a/lib/endian.in.h +++ b/lib/endian.in.h @@ -109,6 +109,15 @@ _GL_INLINE_HEADER_BEGIN extern "C" { #endif +/* These declarations are needed if Gnulib byteswap.h -> stdint.h -> + sys/types.h -> endian.h -> Gnulib byteswap.h, the last of which is blocked + by its include guard so the functions are not yet declared. */ +#ifdef _GL_BYTESWAP_INLINE +_GL_BYTESWAP_INLINE uint_least16_t bswap_16 (uint_least16_t); +_GL_BYTESWAP_INLINE uint_least32_t bswap_32 (uint_least32_t); +_GL_BYTESWAP_INLINE uint_least64_t bswap_64 (uint_least64_t); +#endif + /* Big endian to host. */ _GL_ENDIAN_INLINE uint16_t diff --git a/lib/errno.in.h b/lib/errno.in.h index ba5dd371005..3db2853cf10 100644 --- a/lib/errno.in.h +++ b/lib/errno.in.h @@ -148,27 +148,11 @@ # endif -/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros - EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ -# if @EMULTIHOP_HIDDEN@ -# define EMULTIHOP @EMULTIHOP_VALUE@ -# define GNULIB_defined_EMULTIHOP 1 -# endif -# if @ENOLINK_HIDDEN@ -# define ENOLINK @ENOLINK_VALUE@ -# define GNULIB_defined_ENOLINK 1 -# endif -# if @EOVERFLOW_HIDDEN@ -# define EOVERFLOW @EOVERFLOW_VALUE@ -# define GNULIB_defined_EOVERFLOW 1 -# endif - - /* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. Likewise, on NonStop Kernel, EDQUOT is not defined. Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, - HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. + HP-UX EWOULDBLOCK = 246. Note: When one of these systems defines some of these macros some day, binaries will have to be recompiled so that they recognizes the new diff --git a/lib/euidaccess.c b/lib/euidaccess.c index 05e1f2a6ddd..67b9a94544f 100644 --- a/lib/euidaccess.c +++ b/lib/euidaccess.c @@ -79,7 +79,7 @@ euidaccess (const char *file, int mode) { #if HAVE_FACCESSAT /* glibc, AIX 7, Solaris 11, Cygwin 1.7 */ return faccessat (AT_FDCWD, file, mode, AT_EACCESS); -#elif defined EFF_ONLY_OK /* IRIX, OSF/1, Interix */ +#elif defined EFF_ONLY_OK /* Interix */ return access (file, mode | EFF_ONLY_OK); #elif defined ACC_SELF /* AIX */ return accessx (file, mode, ACC_SELF); diff --git a/lib/faccessat.c b/lib/faccessat.c index abb912090a9..743f3728871 100644 --- a/lib/faccessat.c +++ b/lib/faccessat.c @@ -22,7 +22,7 @@ #define _GL_INCLUDING_UNISTD_H #include -/* Specification. */ +/* Get the original definition of faccessat. */ #include #include @@ -40,14 +40,8 @@ orig_faccessat (int fd, char const *name, int mode, int flag) } #endif -#ifdef __osf__ -/* Write "unistd.h" here, not , otherwise OSF/1 5.1 DTK cc - eliminates this include because of the preliminary #include - above. */ -# include "unistd.h" -#else -# include -#endif +/* Specification. */ +#include #ifndef HAVE_ACCESS /* Mingw lacks access, but it also lacks real vs. effective ids, so diff --git a/lib/fchmodat.c b/lib/fchmodat.c index 8853d7a3ae8..9151778b8e3 100644 --- a/lib/fchmodat.c +++ b/lib/fchmodat.c @@ -22,7 +22,7 @@ #define __need_system_sys_stat_h #include -/* Specification. */ +/* Get the original definition of fchmodat. */ #include #undef __need_system_sys_stat_h @@ -41,17 +41,13 @@ orig_fchmodat (int dir, char const *file, mode_t mode, int flags) #include #include -#ifdef __osf__ -/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc - eliminates this include because of the preliminary #include - above. */ -# include "sys/stat.h" -#else -# include -#endif +/* Specification. */ +#include #include +#include "issymlink.h" + /* Invoke chmod or lchmod on FILE, using mode MODE, in the directory open on descriptor FD. If possible, do it without changing the working directory. Otherwise, resort to using save_cwd/fchdir, @@ -84,29 +80,30 @@ fchmodat (int dir, char const *file, mode_t mode, int flags) if (flags == AT_SYMLINK_NOFOLLOW) { # if HAVE_READLINKAT - char readlink_buf[1]; - # ifdef O_PATH /* Open a file descriptor with O_NOFOLLOW, to make sure we don't follow symbolic links, if /proc is mounted. O_PATH is used to avoid a failure if the file is not readable. - Cf. */ + Cf. */ int fd = openat (dir, file, O_PATH | O_NOFOLLOW | O_CLOEXEC); if (fd < 0) return fd; int err; - if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf)) - err = EOPNOTSUPP; - else if (errno == EINVAL) - { - static char const fmt[] = "/proc/self/fd/%d"; - char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)]; - sprintf (buf, fmt, fd); - err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno; - } - else - err = errno == ENOENT ? -1 : errno; + { + int ret = issymlinkat (fd, ""); + if (ret > 0) + err = EOPNOTSUPP; + else if (ret == 0) + { + static char const fmt[] = "/proc/self/fd/%d"; + char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)]; + sprintf (buf, fmt, fd); + err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno; + } + else + err = errno == ENOENT ? -1 : errno; + } close (fd); @@ -117,7 +114,7 @@ fchmodat (int dir, char const *file, mode_t mode, int flags) /* O_PATH + /proc is not supported. */ - if (0 <= readlinkat (dir, file, readlink_buf, sizeof readlink_buf)) + if (issymlinkat (dir, file) > 0) { errno = EOPNOTSUPP; return -1; diff --git a/lib/fcntl.c b/lib/fcntl.c index 69cac9a5951..f47ebde105c 100644 --- a/lib/fcntl.c +++ b/lib/fcntl.c @@ -376,12 +376,6 @@ fcntl (int fd, int action, /* arg */...) #ifdef F_NOTIFY /* Linux */ case F_NOTIFY: #endif - #ifdef F_OPLKACK /* IRIX */ - case F_OPLKACK: - #endif - #ifdef F_OPLKREG /* IRIX */ - case F_OPLKREG: - #endif #ifdef F_RDAHEAD /* macOS */ case F_RDAHEAD: #endif diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index c5068ed48a0..3fbbf4b0e4a 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -249,6 +249,46 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # endif #endif +#if @GNULIB_OPENAT2@ +# if !defined RESOLVE_NO_XDEV && defined __has_include +# if __has_include () +# include +# endif +# endif +# ifndef RESOLVE_NO_XDEV +struct open_how +{ +# ifdef __UINT64_TYPE__ + __UINT64_TYPE__ flags, mode, resolve; +# else + unsigned long long int flags, mode, resolve; +# endif +}; +# define RESOLVE_NO_XDEV 0x01 +# define RESOLVE_NO_MAGICLINKS 0x02 +# define RESOLVE_NO_SYMLINKS 0x04 +# define RESOLVE_BENEATH 0x08 +# define RESOLVE_IN_ROOT 0x10 +# define RESOLVE_CACHED 0x20 +# endif + +# if !@HAVE_OPENAT2@ +_GL_FUNCDECL_SYS (openat2, int, + (int fd, char const *file, struct open_how const *how, + size_t size), + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (openat2, int, + (int fd, char const *file, struct open_how const *how, + size_t size)); +_GL_CXXALIASWARN (openat2); +#elif defined GNULIB_POSIXCHECK +# undef openat2 +# if HAVE_RAW_DECL_OPENAT2 +_GL_WARN_ON_USE (openat2, "openat2 is not portable - " + "use gnulib module openat2 for portability"); +# endif +#endif /* Fix up the FD_* macros, only known to be missing on mingw. */ @@ -293,11 +333,6 @@ _GL_WARN_ON_USE (openat, "openat is not portable - " # endif #endif -#if !defined O_DIRECT && defined O_DIRECTIO -/* Tru64 spells it 'O_DIRECTIO'. */ -# define O_DIRECT O_DIRECTIO -#endif - #if !defined O_CLOEXEC && defined O_NOINHERIT /* Mingw spells it 'O_NOINHERIT'. */ # define O_CLOEXEC O_NOINHERIT diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c index a9cfbf3a16e..d2fa69a2834 100644 --- a/lib/file-has-acl.c +++ b/lib/file-has-acl.c @@ -261,7 +261,7 @@ get_aclinfo (int fd, char const *name, struct aclinfo *ai, int flags) first case, and ENODATA in the latter. */ if (r == 0) scontext_err = ENOTSUP; - if (r == 10 && memcmp (ai->scontext, "unlabeled", 10) == 0) + if (r == 10 && memeq (ai->scontext, "unlabeled", 10)) { freecon (ai->scontext); scontext_err = ENODATA; @@ -364,9 +364,9 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes) /* For a trivial ACL, max 6 (typically 3) ACEs, 3 allow, 3 deny. Check that there is at most one ACE of each TYPE and WHO. */ int who2 - = (wholen == 6 && memcmp (xattr, "OWNER@", 6) == 0 ? 0 - : wholen == 6 && memcmp (xattr, "GROUP@", 6) == 0 ? 2 - : wholen == 9 && memcmp (xattr, "EVERYONE@", 9) == 0 ? 4 + = (wholen == 6 && memeq (xattr, "OWNER@", 6) ? 0 + : wholen == 6 && memeq (xattr, "GROUP@", 6) ? 2 + : wholen == 9 && memeq (xattr, "EVERYONE@", 9) ? 4 : -1); if (who2 < 0) return 1; @@ -384,9 +384,9 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes) #if (!USE_LINUX_XATTR && USE_ACL && HAVE_ACL_GET_FILE \ && !HAVE_ACL_EXTENDED_FILE && !HAVE_ACL_TYPE_EXTENDED) -/* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */ +/* FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */ -# if HAVE_ACL_GET_FD && !HAVE_ACL_GET_LINK_NP /* IRIX, Tru64, Cygwin >= 2.5 */ +# if HAVE_ACL_GET_FD && !HAVE_ACL_GET_LINK_NP /* Cygwin >= 2.5 */ # include # ifdef O_PATH # define acl_get_fd_np(fd, type) acl_get_fd (fd) @@ -522,7 +522,7 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd, { /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */ - /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ + /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */ int ret; # if HAVE_ACL_EXTENDED_FILE /* Linux */ @@ -553,7 +553,7 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd, } else ret = -1; -# else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */ +# else /* FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */ acl_t acl = acl_get_fdfile (fd, name, ACL_TYPE_ACCESS, flags); if (acl) @@ -562,12 +562,7 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd, int saved_errno = errno; acl_free (acl); errno = saved_errno; -# if HAVE_ACL_FREE_TEXT /* Tru64 */ - /* On OSF/1, acl_get_file (name, ACL_TYPE_DEFAULT) always - returns NULL with errno not set. There is no point in - making this call. */ -# else /* FreeBSD, NetBSD >= 10, IRIX, Cygwin >= 2.5 */ - /* On Linux, FreeBSD, NetBSD, IRIX, + /* On Linux, FreeBSD, NetBSD, acl_get_file (name, ACL_TYPE_ACCESS) and acl_get_file (name, ACL_TYPE_DEFAULT) on a directory either both succeed or both fail; it depends on the @@ -580,26 +575,25 @@ fdfile_has_aclinfo (MAYBE_UNUSED int fd, acl = acl_get_fdfile (fd, name, ACL_TYPE_DEFAULT, flags); if (acl) { -# ifdef __CYGWIN__ /* Cygwin >= 2.5 */ +# ifdef __CYGWIN__ /* Cygwin >= 2.5 */ ret = acl_access_nontrivial (acl); saved_errno = errno; acl_free (acl); errno = saved_errno; -# else +# else ret = (0 < acl_entries (acl)); acl_free (acl); -# endif +# endif } else { ret = -1; -# ifdef __CYGWIN__ /* Cygwin >= 2.5 */ +# ifdef __CYGWIN__ /* Cygwin >= 2.5 */ if (d_type == DT_UNKNOWN) ret = 0; -# endif +# endif } } -# endif } else ret = -1; diff --git a/lib/fpending.c b/lib/fpending.c index 529bc7f6517..5aaa33f58a4 100644 --- a/lib/fpending.c +++ b/lib/fpending.c @@ -25,8 +25,8 @@ #include "stdio-impl.h" /* This file is not used on systems that already have the __fpending function, - namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34, - Android API >= 23, musl libc, Haiku >= hrev58760. */ + namely glibc >= 2.2, OpenBSD >= 7.6, Solaris >= 7, UnixWare >= 7.1.4.MP4, + Cygwin >= 1.7.34, Android API >= 23, musl libc, Haiku >= hrev58760. */ /* Return the number of pending (aka buffered, unflushed) bytes on the stream, FP, that is open for writing. */ @@ -39,14 +39,14 @@ __fpending (FILE *fp) #if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */ return fp->_IO_write_ptr - fp->_IO_write_base; -#elif defined __sferror || defined __OpenBSD__ || defined __DragonFly__ || defined __ANDROID__ - /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ +#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin < 1.7.34, Minix 3, Android */ return fp_->_p - fp_->_bf._base; #elif defined __EMX__ /* emx+gcc */ return fp->_ptr - fp->_buffer; #elif defined __minix /* Minix */ return fp_->_ptr - fp_->_buf; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ +#elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ return (fp_->_ptr ? fp_->_ptr - fp_->_base : 0); #elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & __FLAG_WRITING ? fp->__bufpos - fp->__bufstart : 0); diff --git a/lib/free.c b/lib/free.c index 98ceafd7da2..394d8d13905 100644 --- a/lib/free.c +++ b/lib/free.c @@ -33,7 +33,7 @@ rpl_free (void *p) { # if defined __GNUC__ && !defined __clang__ /* An invalid GCC optimization - + would optimize away the assignments in the code below, when link-time optimization (LTO) is enabled. Make the code more complicated, so that GCC does not grok how to optimize it. */ diff --git a/lib/fseterr.c b/lib/fseterr.c new file mode 100644 index 00000000000..40aca95c8eb --- /dev/null +++ b/lib/fseterr.c @@ -0,0 +1,84 @@ +/* Set the error indicator of a stream. + Copyright (C) 2007-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "fseterr.h" + +#include + +#include "stdio-impl.h" + +/* This file is not used on systems that have the __fseterr function, + namely OpenBSD >= 7.6, musl libc, Haiku >= hrev58760. */ + +void +fseterr (FILE *fp) +{ + /* Most systems provide FILE as a struct and the necessary bitmask in + , because they need it for implementing getc() and putc() as + fast macros. */ +#if defined _IO_EOF_SEEN || defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 + /* GNU libc, BeOS, Haiku, Linux libc5 */ + fp->_flags |= _IO_ERR_SEEN; +#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__ + /* FreeBSD, NetBSD, OpenBSD < 7.6, DragonFly, Mac OS X, Cygwin, Minix 3, Android */ + fp_->_flags |= __SERR; +#elif defined __EMX__ /* emx+gcc */ + fp->_flags |= _IOERR; +#elif defined __minix /* Minix */ + fp->_flags |= _IOERR; +#elif defined _IOERR /* AIX, HP-UX, Solaris, OpenServer, UnixWare, mingw, MSVC, NonStop Kernel, OpenVMS */ + fp_->_flag |= _IOERR; +#elif defined __UCLIBC__ /* uClibc */ + fp->__modeflags |= __FLAG_ERROR; +#elif defined __QNX__ /* QNX */ + fp->_Mode |= 0x200 /* _MERR */; +#elif defined __MINT__ /* Atari FreeMiNT */ + fp->__error = 1; +#elif defined EPLAN9 /* Plan9 */ + if (fp->state != 0 /* CLOSED */) + fp->state = 5 /* ERR */; +#elif 0 /* unknown */ + /* Portable fallback, based on an idea by Rich Felker. + Wow! 6 system calls for something that is just a bit operation! + Not activated on any system, because there is no way to repair FP when + the sequence of system calls fails, and library code should not call + abort(). */ + int saved_errno; + int fd; + int fd2; + + saved_errno = errno; + fflush (fp); + fd = fileno (fp); + fd2 = dup (fd); + if (fd2 >= 0) + { + close (fd); + fputc ('\0', fp); /* This should set the error indicator. */ + fflush (fp); /* Or this. */ + if (dup2 (fd2, fd) < 0) + /* Whee... we botched the stream and now cannot restore it! */ + abort (); + close (fd2); + } + errno = saved_errno; +#else + #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib." +#endif +} diff --git a/lib/fseterr.h b/lib/fseterr.h new file mode 100644 index 00000000000..57c30ef3d75 --- /dev/null +++ b/lib/fseterr.h @@ -0,0 +1,55 @@ +/* Set the error indicator of a stream. + Copyright (C) 2007, 2009-2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _FSETERR_H +#define _FSETERR_H + +/* This file uses HAVE___FSETERR. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#include + +/* Set the error indicator of the stream FP. + The "error indicator" is set when an I/O operation on the stream fails, and + is cleared (together with the "end-of-file" indicator) by clearerr (FP). */ + +#if HAVE___FSETERR /* musl libc */ + +/* Haiku has __fseterr but does not declare it. */ +# if defined __HAIKU__ +extern void __fseterr (FILE *fp); +# endif + +# include +# define fseterr(fp) __fseterr (fp) + +#else + +# ifdef __cplusplus +extern "C" { +# endif + +extern void fseterr (FILE *fp); + +# ifdef __cplusplus +} +# endif + +#endif + +#endif /* _FSETERR_H */ diff --git a/lib/fstatat.c b/lib/fstatat.c index 36dd5e9a200..6029de78842 100644 --- a/lib/fstatat.c +++ b/lib/fstatat.c @@ -36,14 +36,8 @@ orig_fstatat (int fd, char const *filename, struct stat *buf, int flags) } #endif -#ifdef __osf__ -/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc - eliminates this include because of the preliminary #include - above. */ -# include "sys/stat.h" -#else -# include -#endif +/* Specification. */ +#include #include "stat-time.h" diff --git a/lib/fsusage.c b/lib/fsusage.c index e26bda88aa6..64a12c5d48e 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -148,15 +148,6 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) ? PROPAGATE_ALL_ONES (fsd.f_frsize) : PROPAGATE_ALL_ONES (fsd.f_bsize)); -#elif defined STAT_STATFS3_OSF1 /* OSF/1 */ - - struct statfs fsd; - - if (statfs (file, &fsd, sizeof (struct statfs)) != 0) - return -1; - - fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); - #elif defined STAT_STATFS2_FRSIZE /* 2.6 < glibc/Linux < 2.6.36 */ struct statfs fsd; @@ -201,7 +192,7 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize); -#elif defined STAT_STATFS4 /* SVR3, old Irix */ +#elif defined STAT_STATFS4 /* SVR3 */ struct statfs fsd; diff --git a/lib/get-permissions.c b/lib/get-permissions.c index f9e96afbe45..9b904e8ca22 100644 --- a/lib/get-permissions.c +++ b/lib/get-permissions.c @@ -38,9 +38,9 @@ get_permissions (const char *name, int desc, mode_t mode, #if USE_ACL && HAVE_ACL_GET_FILE /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */ - /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ + /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */ # if !HAVE_ACL_TYPE_EXTENDED - /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */ + /* Linux, FreeBSD, Cygwin >= 2.5 */ if (HAVE_ACL_GET_FD && desc != -1) ctx->acl = acl_get_fd (desc); diff --git a/lib/getdelim.c b/lib/getdelim.c index 2576d376f06..4cd5eca1895 100644 --- a/lib/getdelim.c +++ b/lib/getdelim.c @@ -65,7 +65,13 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp) ssize_t result; size_t cur_len = 0; - if (lineptr == NULL || n == NULL || fp == NULL) + if (lineptr == NULL || n == NULL + /* glibc already declares this function as __nonnull ((4)). + Avoid a gcc warning "‘nonnull’ argument ‘fp’ compared to NULL". */ +#if !(__GLIBC__ >= 2) + || fp == NULL +#endif + ) { errno = EINVAL; return -1; diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 752ec1f5ae7..1e3e215360b 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -140,21 +140,6 @@ # define SUNOS_5 # endif -# if defined (__osf__) && defined (__alpha) -# define OSF_ALPHA -# include -# include -# include -# include -/* Tru64 4.0D's table.h redefines sys */ -# undef sys -# endif - -# if defined (__osf__) && (defined (mips) || defined (__mips__)) -# define OSF_MIPS -# include -# endif - /* VAX C can't handle multi-line #ifs, or lines longer than 256 chars. */ # ifndef LOAD_AVE_TYPE @@ -167,31 +152,16 @@ # define LOAD_AVE_TYPE long # endif -# ifdef sgi -# define LOAD_AVE_TYPE long -# endif - # ifdef SVR4 # define LOAD_AVE_TYPE long # endif -# ifdef OSF_ALPHA -# define LOAD_AVE_TYPE long -# endif - # if defined _AIX && ! defined HAVE_LIBPERFSTAT # define LOAD_AVE_TYPE long # endif # endif /* No LOAD_AVE_TYPE. */ -# ifdef OSF_ALPHA -/* defines an incorrect value for FSCALE on Alpha OSF/1, - according to ghazi@noc.rutgers.edu. */ -# undef FSCALE -# define FSCALE 1024.0 -# endif - # ifndef FSCALE @@ -324,10 +294,6 @@ # endif # endif /* NeXT */ -# ifdef sgi -# include -# endif /* sgi */ - # ifdef UMAX # include # include @@ -389,7 +355,7 @@ static bool getloadavg_initialized; /* Offset in kmem to seek to read load average, or 0 means invalid. */ static long offset; -# if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined __ANDROID__) +# if ! defined __VMS && ! (defined __linux__ || defined __ANDROID__) static struct nlist name_list[2]; # endif @@ -781,18 +747,6 @@ getloadavg (double loadavg[], int nelem) } # endif /* __MSDOS__ || WINDOWS32 */ -# if !defined (LDAV_DONE) && defined (OSF_ALPHA) /* OSF/1 */ -# define LDAV_DONE - - struct tbl_loadavg load_ave; - table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave)); - for (elem = 0; elem < nelem; elem++) - loadavg[elem] - = (load_ave.tl_lscale == 0 - ? load_ave.tl_avenrun.d[elem] - : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale)); -# endif /* OSF_ALPHA */ - # if ! defined LDAV_DONE && defined __VMS /* VMS */ /* VMS specific code -- read from the Load Ave driver. */ @@ -837,7 +791,7 @@ getloadavg (double loadavg[], int nelem) # endif /* ! defined LDAV_DONE && defined __VMS */ # if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS - /* IRIX, other old systems */ + /* other old systems */ /* UNIX-specific code -- read the average from /dev/kmem. */ @@ -848,41 +802,35 @@ getloadavg (double loadavg[], int nelem) /* Get the address of LDAV_SYMBOL. */ if (offset == 0) { -# ifndef sgi -# if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER +# if ! defined NLIST_STRUCT || ! defined N_NAME_POINTER strcpy (name_list[0].n_name, LDAV_SYMBOL); strcpy (name_list[1].n_name, ""); -# else /* NLIST_STRUCT */ -# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME +# else /* NLIST_STRUCT */ +# ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME name_list[0].n_un.n_name = LDAV_SYMBOL; name_list[1].n_un.n_name = 0; -# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ +# else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ name_list[0].n_name = LDAV_SYMBOL; name_list[1].n_name = 0; -# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ -# endif /* NLIST_STRUCT */ +# endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ +# endif /* NLIST_STRUCT */ -# ifndef SUNOS_5 +# ifndef SUNOS_5 if ( -# if !defined (_AIX) +# if !defined (_AIX) nlist (KERNEL_FILE, name_list) -# else /* _AIX */ +# else /* _AIX */ knlist (name_list, 1, sizeof (name_list[0])) -# endif +# endif >= 0) /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */ { -# ifdef FIXUP_KERNEL_SYMBOL_ADDR +# ifdef FIXUP_KERNEL_SYMBOL_ADDR FIXUP_KERNEL_SYMBOL_ADDR (name_list); -# endif +# endif offset = name_list[0].n_value; } -# endif /* !SUNOS_5 */ -# else /* sgi */ - ptrdiff_t ldav_off = sysmp (MP_KERNADDR, MPKA_AVENRUN); - if (ldav_off != -1) - offset = (long int) ldav_off & 0x7fffffff; -# endif /* sgi */ +# endif /* !SUNOS_5 */ } /* Make sure we have /dev/kmem open. */ diff --git a/lib/getopt.c b/lib/getopt.c index 6b155e6c635..d61bf8619c0 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -42,7 +42,7 @@ # define funlockfile(fp) _IO_funlockfile (fp) #else # include "gettext.h" -# define _(msgid) dgettext ("gnulib", msgid) +# define _(msgid) dgettext (GNULIB_TEXT_DOMAIN, msgid) /* When used standalone, flockfile and funlockfile might not be available. */ # if (!defined _POSIX_THREAD_SAFE_FUNCTIONS \ diff --git a/lib/gettext.h b/lib/gettext.h index fd6c62b7eb7..0650abc9a3d 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -70,7 +70,12 @@ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wbuiltin-declaration-mismatch" # endif -__attribute__ ((__always_inline__, __gnu_inline__)) extern inline +# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 +__attribute__ ((__always_inline__, __gnu_inline__)) +# else +__attribute__ ((__always_inline__)) +# endif +extern inline # if !defined(__sun) const # endif @@ -79,7 +84,12 @@ gettext (const char *msgid) { return msgid; } -__attribute__ ((__always_inline__, __gnu_inline__)) extern inline +# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 +__attribute__ ((__always_inline__, __gnu_inline__)) +# else +__attribute__ ((__always_inline__)) +# endif +extern inline # if !defined(__sun) const # endif @@ -89,7 +99,12 @@ dgettext (const char *domain, const char *msgid) (void) domain; return msgid; } -__attribute__ ((__always_inline__, __gnu_inline__)) extern inline +# if __GNUC__ + (__GNUC_MINOR__ >= 2) > 4 +__attribute__ ((__always_inline__, __gnu_inline__)) +# else +__attribute__ ((__always_inline__)) +# endif +extern inline # if !defined(__sun) const # endif diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index fa800300a42..e655023878e 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -166,7 +166,9 @@ # stdckdint-h \ # stddef-h \ # stdio-h \ +# stdio-windows \ # stpcpy \ +# stringeq \ # strnlen \ # strtoimax \ # symlink \ @@ -269,14 +271,8 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EMACSRES = @EMACSRES@ EMACS_MANIFEST = @EMACS_MANIFEST@ -EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ -EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ ENDIAN_H = @ENDIAN_H@ ENDIAN_H_JUST_MISSING_STDINT = @ENDIAN_H_JUST_MISSING_STDINT@ -ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ -ENOLINK_VALUE = @ENOLINK_VALUE@ -EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ -EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ ERRNO_H = @ERRNO_H@ EUIDACCESS_LIBGEN = @EUIDACCESS_LIBGEN@ EXECINFO_H = @EXECINFO_H@ @@ -301,6 +297,7 @@ GIF_CFLAGS = @GIF_CFLAGS@ GL_CFLAG_ALLOW_WARNINGS = @GL_CFLAG_ALLOW_WARNINGS@ GL_CFLAG_GNULIB_WARNINGS = @GL_CFLAG_GNULIB_WARNINGS@ GL_COND_LIBTOOL_CONDITION = @GL_COND_LIBTOOL_CONDITION@ +GL_COND_OBJ_ACL_ENTRIES_CONDITION = @GL_COND_OBJ_ACL_ENTRIES_CONDITION@ GL_COND_OBJ_CANONICALIZE_LGPL_CONDITION = @GL_COND_OBJ_CANONICALIZE_LGPL_CONDITION@ GL_COND_OBJ_COPY_FILE_RANGE_CONDITION = @GL_COND_OBJ_COPY_FILE_RANGE_CONDITION@ GL_COND_OBJ_DIRFD_CONDITION = @GL_COND_OBJ_DIRFD_CONDITION@ @@ -313,6 +310,7 @@ GL_COND_OBJ_FCNTL_CONDITION = @GL_COND_OBJ_FCNTL_CONDITION@ GL_COND_OBJ_FDOPENDIR_CONDITION = @GL_COND_OBJ_FDOPENDIR_CONDITION@ GL_COND_OBJ_FPENDING_CONDITION = @GL_COND_OBJ_FPENDING_CONDITION@ GL_COND_OBJ_FREE_CONDITION = @GL_COND_OBJ_FREE_CONDITION@ +GL_COND_OBJ_FSETERR_CONDITION = @GL_COND_OBJ_FSETERR_CONDITION@ GL_COND_OBJ_FSTATAT_CONDITION = @GL_COND_OBJ_FSTATAT_CONDITION@ GL_COND_OBJ_FSUSAGE_CONDITION = @GL_COND_OBJ_FSUSAGE_CONDITION@ GL_COND_OBJ_FSYNC_CONDITION = @GL_COND_OBJ_FSYNC_CONDITION@ @@ -344,6 +342,7 @@ GL_COND_OBJ_REALLOC_POSIX_CONDITION = @GL_COND_OBJ_REALLOC_POSIX_CONDITION@ GL_COND_OBJ_REGEX_CONDITION = @GL_COND_OBJ_REGEX_CONDITION@ GL_COND_OBJ_SIG2STR_CONDITION = @GL_COND_OBJ_SIG2STR_CONDITION@ GL_COND_OBJ_SIGDESCR_NP_CONDITION = @GL_COND_OBJ_SIGDESCR_NP_CONDITION@ +GL_COND_OBJ_STDIO_CONSOLESAFE_CONDITION = @GL_COND_OBJ_STDIO_CONSOLESAFE_CONDITION@ GL_COND_OBJ_STDIO_READ_CONDITION = @GL_COND_OBJ_STDIO_READ_CONDITION@ GL_COND_OBJ_STDIO_WRITE_CONDITION = @GL_COND_OBJ_STDIO_WRITE_CONDITION@ GL_COND_OBJ_STPCPY_CONDITION = @GL_COND_OBJ_STPCPY_CONDITION@ @@ -352,7 +351,6 @@ GL_COND_OBJ_STRTOIMAX_CONDITION = @GL_COND_OBJ_STRTOIMAX_CONDITION@ GL_COND_OBJ_STRTOLL_CONDITION = @GL_COND_OBJ_STRTOLL_CONDITION@ GL_COND_OBJ_SYMLINK_CONDITION = @GL_COND_OBJ_SYMLINK_CONDITION@ GL_COND_OBJ_TIMEGM_CONDITION = @GL_COND_OBJ_TIMEGM_CONDITION@ -GL_COND_OBJ_TIME_RZ_CONDITION = @GL_COND_OBJ_TIME_RZ_CONDITION@ GL_COND_OBJ_TIME_R_CONDITION = @GL_COND_OBJ_TIME_R_CONDITION@ GL_COND_OBJ_UTIMENSAT_CONDITION = @GL_COND_OBJ_UTIMENSAT_CONDITION@ GL_GENERATE_ALLOCA_H_CONDITION = @GL_GENERATE_ALLOCA_H_CONDITION@ @@ -559,6 +557,7 @@ GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ GL_GNULIB_OBSTACK_ZPRINTF = @GL_GNULIB_OBSTACK_ZPRINTF@ GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ +GL_GNULIB_OPENAT2 = @GL_GNULIB_OPENAT2@ GL_GNULIB_OPENDIR = @GL_GNULIB_OPENDIR@ GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ @@ -629,6 +628,7 @@ GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ GL_GNULIB_STRERROR_L = @GL_GNULIB_STRERROR_L@ GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ +GL_GNULIB_STRINGEQ = @GL_GNULIB_STRINGEQ@ GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ @@ -769,6 +769,7 @@ HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ +HAVE_DECL_MEMEQ = @HAVE_DECL_MEMEQ@ HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ @@ -780,6 +781,7 @@ HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ HAVE_DECL_SETSTATE = @HAVE_DECL_SETSTATE@ HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STREQ = @HAVE_DECL_STREQ@ HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ @@ -862,6 +864,7 @@ HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ HAVE_NATIVE_COMP = @HAVE_NATIVE_COMP@ HAVE_OFF64_T = @HAVE_OFF64_T@ HAVE_OPENAT = @HAVE_OPENAT@ +HAVE_OPENAT2 = @HAVE_OPENAT2@ HAVE_OPENDIR = @HAVE_OPENDIR@ HAVE_OS_H = @HAVE_OS_H@ HAVE_PCLOSE = @HAVE_PCLOSE@ @@ -886,7 +889,6 @@ HAVE_PWRITE = @HAVE_PWRITE@ HAVE_QSORT_R = @HAVE_QSORT_R@ HAVE_RAISE = @HAVE_RAISE@ HAVE_RANDOM = @HAVE_RANDOM@ -HAVE_RANDOM_H = @HAVE_RANDOM_H@ HAVE_RANDOM_R = @HAVE_RANDOM_R@ HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ HAVE_READDIR = @HAVE_READDIR@ @@ -1500,6 +1502,8 @@ gl_GNULIB_ENABLED_fd38c7e463b54744b77b98aeafb4fa7c_CONDITION = @gl_GNULIB_ENABLE gl_GNULIB_ENABLED_getdelim_CONDITION = @gl_GNULIB_ENABLED_getdelim_CONDITION@ gl_GNULIB_ENABLED_getdtablesize_CONDITION = @gl_GNULIB_ENABLED_getdtablesize_CONDITION@ gl_GNULIB_ENABLED_getgroups_CONDITION = @gl_GNULIB_ENABLED_getgroups_CONDITION@ +gl_GNULIB_ENABLED_issymlink_CONDITION = @gl_GNULIB_ENABLED_issymlink_CONDITION@ +gl_GNULIB_ENABLED_issymlinkat_CONDITION = @gl_GNULIB_ENABLED_issymlinkat_CONDITION@ gl_GNULIB_ENABLED_lchmod_CONDITION = @gl_GNULIB_ENABLED_lchmod_CONDITION@ gl_GNULIB_ENABLED_open_CONDITION = @gl_GNULIB_ENABLED_open_CONDITION@ gl_GNULIB_ENABLED_rawmemchr_CONDITION = @gl_GNULIB_ENABLED_rawmemchr_CONDITION@ @@ -1587,10 +1591,11 @@ endif ifeq (,$(OMIT_GNULIB_MODULE_acl-permissions)) libgnu_a_SOURCES += acl-errno-valid.c acl-internal.c get-permissions.c set-permissions.c +ifneq (,$(GL_COND_OBJ_ACL_ENTRIES_CONDITION)) +libgnu_a_SOURCES += acl_entries.c +endif -EXTRA_DIST += acl-internal.h acl.h acl_entries.c - -EXTRA_libgnu_a_SOURCES += acl_entries.c +EXTRA_DIST += acl-internal.h acl.h endif ## end gnulib module acl-permissions @@ -2015,12 +2020,6 @@ errno.h: errno.in.h $(top_builddir)/config.status -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ - -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ - -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ - -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ - -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ - -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ - -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ $(srcdir)/errno.in.h > $@-t $(AM_V_at)mv $@-t $@ else @@ -2129,10 +2128,12 @@ fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ + -e 's/@''GNULIB_OPENAT2''@/$(GL_GNULIB_OPENAT2)/g' \ -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''HAVE_OPENAT2''@|$(HAVE_OPENAT2)|g' \ -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ @@ -2231,6 +2232,18 @@ endif endif ## end gnulib module free-posix +## begin gnulib module fseterr +ifeq (,$(OMIT_GNULIB_MODULE_fseterr)) + +ifneq (,$(GL_COND_OBJ_FSETERR_CONDITION)) +libgnu_a_SOURCES += fseterr.c +endif + +EXTRA_DIST += fseterr.h stdio-impl.h + +endif +## end gnulib module fseterr + ## begin gnulib module fstatat ifeq (,$(OMIT_GNULIB_MODULE_fstatat)) @@ -2617,6 +2630,30 @@ EXTRA_DIST += inttypes.in.h endif ## end gnulib module inttypes-h-incomplete +## begin gnulib module issymlink +ifeq (,$(OMIT_GNULIB_MODULE_issymlink)) + +ifneq (,$(gl_GNULIB_ENABLED_issymlink_CONDITION)) +libgnu_a_SOURCES += issymlink.c + +endif +EXTRA_DIST += issymlink.h + +endif +## end gnulib module issymlink + +## begin gnulib module issymlinkat +ifeq (,$(OMIT_GNULIB_MODULE_issymlinkat)) + +ifneq (,$(gl_GNULIB_ENABLED_issymlinkat_CONDITION)) +libgnu_a_SOURCES += issymlinkat.c + +endif +EXTRA_DIST += issymlink.h + +endif +## end gnulib module issymlinkat + ## begin gnulib module lchmod ifeq (,$(OMIT_GNULIB_MODULE_lchmod)) @@ -3481,6 +3518,16 @@ EXTRA_DIST += stdio.in.h endif ## end gnulib module stdio-h +## begin gnulib module stdio-windows +ifeq (,$(OMIT_GNULIB_MODULE_stdio-windows)) + +ifneq (,$(GL_COND_OBJ_STDIO_CONSOLESAFE_CONDITION)) +libgnu_a_SOURCES += stdio-consolesafe.c +endif + +endif +## end gnulib module stdio-windows + ## begin gnulib module stdlib-h ifeq (,$(OMIT_GNULIB_MODULE_stdlib-h)) @@ -3576,7 +3623,6 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \ -e 's|@''HAVE_QSORT_R''@|$(HAVE_QSORT_R)|g' \ -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \ - -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ -e 's|@''HAVE_REALLOCARRAY''@|$(HAVE_REALLOCARRAY)|g' \ -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ @@ -3708,6 +3754,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRINGEQ''@/$(GL_GNULIB_STRINGEQ)/g' \ -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ @@ -3735,6 +3782,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + -e 's|@''HAVE_DECL_MEMEQ''@|$(HAVE_DECL_MEMEQ)|g' \ -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ @@ -3744,6 +3792,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_DECL_STREQ''@|$(HAVE_DECL_STREQ)|g' \ -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ @@ -3793,6 +3842,14 @@ EXTRA_DIST += string.in.h endif ## end gnulib module string-h +## begin gnulib module stringeq +ifeq (,$(OMIT_GNULIB_MODULE_stringeq)) + +libgnu_a_SOURCES += string.c + +endif +## end gnulib module stringeq + ## begin gnulib module strnlen ifeq (,$(OMIT_GNULIB_MODULE_strnlen)) @@ -4136,9 +4193,7 @@ endif ## begin gnulib module time_rz ifeq (,$(OMIT_GNULIB_MODULE_time_rz)) -ifneq (,$(GL_COND_OBJ_TIME_RZ_CONDITION)) libgnu_a_SOURCES += time_rz.c -endif EXTRA_DIST += time-internal.h diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h index 62de3c889ec..2609803094b 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h @@ -29,10 +29,6 @@ Do not evaluate E. */ #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) -/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see - . */ -#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v)) - /* The extra casts in the following macros work around compiler bugs, e.g., in Cray C 5.0.3.0. */ @@ -41,7 +37,7 @@ /* Return 1 if the real expression E, after promotion, has a signed or floating type. Do not evaluate E. */ -#define _GL_EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) +#define _GL_EXPR_SIGNED(e) (_GL_INT_CONVERT (e, -1) < 0) /* Minimum and maximum values for integer types and expressions. */ @@ -60,7 +56,7 @@ #define _GL_INT_MAXIMUM(e) \ (_GL_EXPR_SIGNED (e) \ ? _GL_SIGNED_INT_MAXIMUM (e) \ - : _GL_INT_NEGATE_CONVERT (e, 1)) + : _GL_INT_CONVERT (e, -1)) #define _GL_SIGNED_INT_MAXIMUM(e) \ (((_GL_INT_CONVERT (e, 1) << (_GL_TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1) @@ -112,7 +108,7 @@ #elif defined __has_builtin # define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) /* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x, - see . */ + see . */ #elif 7 <= __GNUC__ # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 #else @@ -184,7 +180,7 @@ #endif /* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 + https://gcc.gnu.org/PR68193 https://llvm.org/bugs/show_bug.cgi?id=25390 For now, assume GCC < 14 and all Clang versions generate bogus warnings for _Generic. This matters only for compilers that diff --git a/lib/intprops.h b/lib/intprops.h index 2f9fa0a0222..72e866ff5bd 100644 --- a/lib/intprops.h +++ b/lib/intprops.h @@ -205,11 +205,11 @@ || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) #endif #define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \ : (a) < 0 ? (b) <= (a) + (b) - 1 \ : (b) < 0 && (a) + (b) <= (a)) #define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ - ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + ((min) < 0 ? (b) == _GL_INT_CONVERT (min, -1) && (a) < - (max) \ : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) diff --git a/lib/issymlink.c b/lib/issymlink.c new file mode 100644 index 00000000000..dbf56c037c4 --- /dev/null +++ b/lib/issymlink.c @@ -0,0 +1,20 @@ +/* Test whether a file is a symbolic link. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define _GL_ISSYMLINK_INLINE _GL_EXTERN_INLINE +#include "issymlink.h" diff --git a/lib/issymlink.h b/lib/issymlink.h new file mode 100644 index 00000000000..af6dc965645 --- /dev/null +++ b/lib/issymlink.h @@ -0,0 +1,103 @@ +/* Test whether a file is a symbolic link. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _ISSYMLINK_H +#define _ISSYMLINK_H + +/* This file uses _GL_ARG_NONNULL, _GL_INLINE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + +#include +#include /* for readlink, readlinkat */ + + +_GL_INLINE_HEADER_BEGIN + +#ifndef _GL_ISSYMLINK_INLINE +# define _GL_ISSYMLINK_INLINE _GL_INLINE +#endif +#ifndef _GL_ISSYMLINKAT_INLINE +# define _GL_ISSYMLINKAT_INLINE _GL_INLINE +#endif + +#if GNULIB_ISSYMLINK +/* Tests whether FILENAME represents a symbolic link. + This function is more reliable than lstat() / fstatat() followed by S_ISLNK, + because it avoids possible EOVERFLOW errors. + Returns + 1 if FILENAME is a symbolic link, + 0 if FILENAME exists and is not a symbolic link, + -1 with errno set if determination failed, in particular + -1 with errno = ENOENT or ENOTDIR if FILENAME does not exist. */ +# ifdef __cplusplus +extern "C" { +# endif +_GL_ISSYMLINK_INLINE int issymlink (const char *filename) + _GL_ARG_NONNULL ((1)); +_GL_ISSYMLINK_INLINE int +issymlink (const char *filename) +{ + char linkbuf[1]; + if (readlink (filename, linkbuf, sizeof (linkbuf)) >= 0) + return 1; + if (errno == EINVAL) + return 0; + else + return -1; +} +# ifdef __cplusplus +} +# endif +#endif + +#if GNULIB_ISSYMLINKAT +/* Tests whether FILENAME represents a symbolic link. + This function is more reliable than lstat() / fstatat() followed by S_ISLNK, + because it avoids possible EOVERFLOW errors. + If FILENAME is a relative file name, it is interpreted as relative to the + directory referred to by FD (where FD = AT_FDCWD denotes the current + directory). + Returns + 1 if FILENAME is a symbolic link, + 0 if FILENAME exists and is not a symbolic link, + -1 with errno set if determination failed, in particular + -1 with errno = ENOENT or ENOTDIR if FILENAME does not exist. */ +# ifdef __cplusplus +extern "C" { +# endif +_GL_ISSYMLINKAT_INLINE int issymlinkat (int fd, const char *filename) + _GL_ARG_NONNULL ((2)); +_GL_ISSYMLINKAT_INLINE int +issymlinkat (int fd, const char *filename) +{ + char linkbuf[1]; + if (readlinkat (fd, filename, linkbuf, sizeof (linkbuf)) >= 0) + return 1; + if (errno == EINVAL) + return 0; + else + return -1; +} +# ifdef __cplusplus +} +# endif +#endif + +_GL_INLINE_HEADER_END + +#endif /* _ISSYMLINK_H */ diff --git a/lib/issymlinkat.c b/lib/issymlinkat.c new file mode 100644 index 00000000000..8286356c8a2 --- /dev/null +++ b/lib/issymlinkat.c @@ -0,0 +1,20 @@ +/* Test whether a file is a symbolic link. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include + +#define _GL_ISSYMLINKAT_INLINE _GL_EXTERN_INLINE +#include "issymlink.h" diff --git a/lib/lchmod.c b/lib/lchmod.c index 4391a4aa940..deba4c50f5b 100644 --- a/lib/lchmod.c +++ b/lib/lchmod.c @@ -29,6 +29,7 @@ #include #include +#include "issymlink.h" /* Work like chmod, except when FILE is a symbolic link. In that case, on systems where permissions on symbolic links are unsupported @@ -37,29 +38,30 @@ int lchmod (char const *file, mode_t mode) { - char readlink_buf[1]; - #ifdef O_PATH /* Open a file descriptor with O_NOFOLLOW, to make sure we don't follow symbolic links, if /proc is mounted. O_PATH is used to avoid a failure if the file is not readable. - Cf. */ + Cf. */ int fd = open (file, O_PATH | O_NOFOLLOW | O_CLOEXEC); if (fd < 0) return fd; int err; - if (0 <= readlinkat (fd, "", readlink_buf, sizeof readlink_buf)) - err = EOPNOTSUPP; - else if (errno == EINVAL) - { - static char const fmt[] = "/proc/self/fd/%d"; - char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)]; - sprintf (buf, fmt, fd); - err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno; - } - else - err = errno == ENOENT ? -1 : errno; + { + int ret = issymlinkat (fd, ""); + if (ret > 0) + err = EOPNOTSUPP; + else if (ret == 0) + { + static char const fmt[] = "/proc/self/fd/%d"; + char buf[sizeof fmt - sizeof "%d" + INT_BUFSIZE_BOUND (int)]; + sprintf (buf, fmt, fd); + err = chmod (buf, mode) == 0 ? 0 : errno == ENOENT ? -1 : errno; + } + else + err = errno == ENOENT ? -1 : errno; + } close (fd); @@ -83,7 +85,7 @@ lchmod (char const *file, mode_t mode) /* O_PATH + /proc is not supported. */ - if (0 <= readlink (file, readlink_buf, sizeof readlink_buf)) + if (issymlink (file) > 0) { errno = EOPNOTSUPP; return -1; diff --git a/lib/limits.in.h b/lib/limits.in.h index c33c59e13bd..693df9984c2 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -47,7 +47,7 @@ #ifndef LLONG_MIN # if defined LONG_LONG_MIN /* HP-UX 11.31 */ # define LLONG_MIN LONG_LONG_MIN -# elif defined LONGLONG_MIN /* IRIX 6.5 */ +# elif defined LONGLONG_MIN /* AIX, BeOS */ # define LLONG_MIN LONGLONG_MIN # elif defined __GNUC__ # define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL) @@ -56,7 +56,7 @@ #ifndef LLONG_MAX # if defined LONG_LONG_MAX /* HP-UX 11.31 */ # define LLONG_MAX LONG_LONG_MAX -# elif defined LONGLONG_MAX /* IRIX 6.5 */ +# elif defined LONGLONG_MAX /* AIX, BeOS */ # define LLONG_MAX LONGLONG_MAX # elif defined __GNUC__ # define LLONG_MAX __LONG_LONG_MAX__ @@ -65,7 +65,7 @@ #ifndef ULLONG_MAX # if defined ULONG_LONG_MAX /* HP-UX 11.31 */ # define ULLONG_MAX ULONG_LONG_MAX -# elif defined ULONGLONG_MAX /* IRIX 6.5 */ +# elif defined ULONGLONG_MAX /* AIX, BeOS */ # define ULLONG_MAX ULONGLONG_MAX # elif defined __GNUC__ # define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL) diff --git a/lib/lstat.c b/lib/lstat.c index bb4a59f1749..f5fda4af771 100644 --- a/lib/lstat.c +++ b/lib/lstat.c @@ -42,14 +42,7 @@ orig_lstat (const char *filename, struct stat *buf) } /* Specification. */ -# ifdef __osf__ -/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc - eliminates this include because of the preliminary #include - above. */ -# include "sys/stat.h" -# else -# include -# endif +# include # include "stat-time.h" diff --git a/lib/md5-stream.c b/lib/md5-stream.c index fdbf97a682b..a5d6a3109a4 100644 --- a/lib/md5-stream.c +++ b/lib/md5-stream.c @@ -87,7 +87,7 @@ md5_stream (FILE *stream, void *resblock) or the fread() in afalg_stream may have gotten EOF. We need to avoid a subsequent fread() as EOF may not be sticky. For details of such systems, see: - https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ + https://sourceware.org/PR1190 */ if (feof (stream)) goto process_partial_block; diff --git a/lib/mini-gmp.c b/lib/mini-gmp.c index c97dc7e6cfa..9f3812b31bd 100644 --- a/lib/mini-gmp.c +++ b/lib/mini-gmp.c @@ -51,7 +51,11 @@ see https://www.gnu.org/licenses/. */ #include "mini-gmp.h" -#if !defined(MINI_GMP_DONT_USE_FLOAT_H) +#ifndef MINI_GMP_ENABLE_FLOAT +#define MINI_GMP_ENABLE_FLOAT 1 +#endif + +#if MINI_GMP_ENABLE_FLOAT #include #endif @@ -1705,6 +1709,7 @@ mpz_roinit_n (mpz_t x, mp_srcptr xp, mp_size_t xs) } +#if MINI_GMP_ENABLE_FLOAT /* Conversions and comparison to double. */ void mpz_set_d (mpz_t r, double x) @@ -1861,6 +1866,7 @@ mpz_cmp_d (const mpz_t x, double d) return mpz_cmpabs_d (x, d); } } +#endif /* MINI_GMP_ENABLE_FLOAT */ /* MPZ comparisons and the like. */ @@ -4515,6 +4521,11 @@ mpz_import (mpz_t r, size_t count, int order, size_t size, int endian, assert (order == 1 || order == -1); assert (endian >= -1 && endian <= 1); + if (count == 0) + { + r->_mp_size = 0; + return; + } if (endian == 0) endian = gmp_detect_endian (); diff --git a/lib/minmax.h b/lib/minmax.h index 355de4b1c3f..7cafcea3818 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -19,8 +19,8 @@ #define _MINMAX_H /* Note: MIN, MAX are also defined in on some systems - (glibc, IRIX, HP-UX, OSF/1). Therefore you might get warnings about - MIN, MAX macro redefinitions on some systems; the workaround is to + (glibc, HP-UX). Therefore you might get warnings about MIN, MAX + macro redefinitions on some systems; the workaround is to #include this file as the last one among the #include list. */ /* This file uses HAVE_MINMAX_IN_LIMITS_H, HAVE_MINMAX_IN_SYS_PARAM_H. */ diff --git a/lib/nproc.c b/lib/nproc.c index 83439aa0eb2..9404be1d384 100644 --- a/lib/nproc.c +++ b/lib/nproc.c @@ -22,7 +22,12 @@ #include #include +#if HAVE_SETMNTENT +# include +#endif #include +#include +#include #include #if HAVE_PTHREAD_GETAFFINITY_NP && 0 @@ -39,10 +44,6 @@ # include #endif -#if HAVE_SYS_SYSMP_H -# include -#endif - #if HAVE_SYS_PARAM_H # include #endif @@ -62,6 +63,8 @@ #define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) +#define NPROC_MINIMUM 1 + /* Return the number of processors available to the current process, based on a modern system call that returns the "affinity" between the current process and each CPU. Return 0 if unknown or if such a system call does @@ -244,7 +247,7 @@ num_processors_via_affinity_mask (void) /* Return the total number of processors. Here QUERY must be one of NPROC_ALL, NPROC_CURRENT. The result is guaranteed to be at least 1. */ static unsigned long int -num_processors_ignoring_omp (enum nproc_query query) +num_processors_available (enum nproc_query query) { /* On systems with a modern affinity mask system call, we have sysconf (_SC_NPROCESSORS_CONF) @@ -258,7 +261,7 @@ num_processors_ignoring_omp (enum nproc_query query) the /sys and /proc file systems (see glibc/sysdeps/unix/sysv/linux/getsysstats.c). In some situations these file systems are not mounted, and the sysconf call - returns 1 or 2 (), + returns 1 or 2 (), which does not reflect the reality. */ if (query == NPROC_CURRENT) @@ -272,8 +275,8 @@ num_processors_ignoring_omp (enum nproc_query query) } #if defined _SC_NPROCESSORS_ONLN - { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris, - Cygwin, Haiku. */ + { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, Solaris, Cygwin, + Haiku. */ long int nprocs = sysconf (_SC_NPROCESSORS_ONLN); if (nprocs > 0) return nprocs; @@ -283,8 +286,8 @@ num_processors_ignoring_omp (enum nproc_query query) else /* query == NPROC_ALL */ { #if defined _SC_NPROCESSORS_CONF - { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris, - Cygwin, Haiku. */ + { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, Solaris, Cygwin, + Haiku. */ long int nprocs = sysconf (_SC_NPROCESSORS_CONF); # if __GLIBC__ >= 2 && defined __linux__ @@ -330,20 +333,6 @@ num_processors_ignoring_omp (enum nproc_query query) } #endif -#if HAVE_SYSMP && defined MP_NAPROCS && defined MP_NPROCS - { /* This works on IRIX. */ - /* MP_NPROCS yields the number of installed processors. - MP_NAPROCS yields the number of processors available to unprivileged - processes. */ - int nprocs = - sysmp (query == NPROC_CURRENT && getuid () != 0 - ? MP_NAPROCS - : MP_NPROCS); - if (nprocs > 0) - return nprocs; - } -#endif - /* Finally, as fallback, use the APIs that don't distinguish between NPROC_CURRENT and NPROC_ALL. */ @@ -377,7 +366,159 @@ num_processors_ignoring_omp (enum nproc_query query) } #endif - return 1; + return NPROC_MINIMUM; +} + +#if defined __linux__ || defined __ANDROID__ +/* Identify the cgroup2 mount point, + initially at the usual location for efficiency, + resorting to searching mount points otherwise. + Return NULL if the mount point is not found. + The returned string can be freed. */ +static char * +cgroup2_mount (void) +{ + FILE *fp; + char *ret = NULL; + + /* Check the usual location first. */ + if (access ("/sys/fs/cgroup/cgroup.controllers", F_OK) == 0) + return strdup ("/sys/fs/cgroup"); + +#if HAVE_SETMNTENT + /* Otherwise look for the mount point. */ + struct mntent *mnt; + if (! (fp = setmntent ("/proc/mounts", "r"))) + return NULL; + while ((mnt = getmntent (fp)) != NULL) + { + if (streq (mnt->mnt_type, "cgroup2")) + { + ret = strdup (mnt->mnt_dir); + break; + } + } + endmntent (fp); +#endif + + return ret; +} + +/* Return the minimum configured cgroupv2 CPU quota for the current process. + Return ULONG_MAX if quota can't be read. + Returned value will be >= 1. */ +static unsigned long int +get_cgroup2_cpu_quota (void) +{ + unsigned long int cpu_quota = ULONG_MAX; + FILE *fp; + + fp = fopen ("/proc/self/cgroup", "r"); + if (! fp) + return cpu_quota; + + /* Get our cgroupv2 (unififed) hierarchy. */ + char *cgroup = NULL; + char *cgroup_str = NULL; + size_t cgroup_size = 0; + ssize_t read; + while ((read = getline (&cgroup_str, &cgroup_size, fp)) != -1) + { + if (strncmp (cgroup_str, "0::/", 4) == 0) + { + char *end = cgroup_str + read - 1; + if (*end == '\n') + *end = '\0'; + cgroup = cgroup_str + 3; + break; + } + } + fclose (fp); + + char *mount = NULL; + if (cgroup && ! (mount = cgroup2_mount ())) + cgroup = NULL; + + /* Find the lowest quota in the hierarchy. */ + char *quota_str = NULL; + size_t quota_size = 0; + while (cgroup && *cgroup) + { + /* Walk back up the nested cgroup hierarchy + to find the lowest cpu quota as defined in a cpu.max file. + Note this file may not be present if the cpu controller + is not enabled for that part of the hierarchy. */ + + char cpu_max_file[PATH_MAX]; + snprintf (cpu_max_file, sizeof (cpu_max_file), + "%s%s/cpu.max", mount, cgroup); + + if ((fp = fopen (cpu_max_file, "r")) + && getline ("a_str, "a_size, fp) != -1 + && strncmp (quota_str, "max", 3) != 0) + { + long quota, period; + if (sscanf (quota_str, "%ld %ld", "a, &period) == 2 && period) + { + double ncpus = (double)quota / period; + if (cpu_quota == ULONG_MAX || ncpus < cpu_quota) + { + cpu_quota = MAX (1, (long)(ncpus + 0.5)); + /* nproc will return 1 minimum, so no point going lower */ + if (cpu_quota == 1) + *cgroup = '\0'; + } + } + } + + if (fp) + fclose (fp); + + char *last_sep = strrchr (cgroup, '/'); + if (! last_sep) + break; + if (last_sep == cgroup && *(cgroup + 1)) + *(cgroup + 1) = '\0'; /* Iterate on "/" also. */ + else + *last_sep = '\0'; + } + + free (quota_str); + free (mount); + free (cgroup_str); + + return cpu_quota; +} +#endif + + +/* Return the cgroupv2 CPU quota if the current scheduler honors it. + Otherwise return ULONG_MAX. + Returned value will be >= 1. */ +static unsigned long int +cpu_quota (void) +{ + unsigned long int quota = ULONG_MAX; + +#if defined __linux__ || defined __ANDROID__ +# if HAVE_SCHED_GETAFFINITY_LIKE_GLIBC && defined SCHED_DEADLINE + /* We've a new enough sched.h */ + switch (sched_getscheduler (0)) + { + case -1: + case SCHED_FIFO: + case SCHED_RR: + case SCHED_DEADLINE: + quota = ULONG_MAX; + break; + default: + quota = get_cgroup2_cpu_quota (); + break; + } +# endif +#endif + + return quota; } /* Parse OMP environment variables without dependence on OMP. @@ -416,13 +557,13 @@ parse_omp_threads (char const* threads) unsigned long int num_processors (enum nproc_query query) { - unsigned long int omp_env_limit = ULONG_MAX; + unsigned long int nproc_limit = ULONG_MAX; + /* Honor the OpenMP environment variables, recognized also by all + programs that are based on OpenMP. */ if (query == NPROC_CURRENT_OVERRIDABLE) { - unsigned long int omp_env_threads; - /* Honor the OpenMP environment variables, recognized also by all - programs that are based on OpenMP. */ + unsigned long int omp_env_threads, omp_env_limit; omp_env_threads = parse_omp_threads (getenv ("OMP_NUM_THREADS")); omp_env_limit = parse_omp_threads (getenv ("OMP_THREAD_LIMIT")); if (! omp_env_limit) @@ -431,14 +572,22 @@ num_processors (enum nproc_query query) if (omp_env_threads) return MIN (omp_env_threads, omp_env_limit); + nproc_limit = omp_env_limit; query = NPROC_CURRENT; } - /* Here query is one of NPROC_ALL, NPROC_CURRENT. */ - if (omp_env_limit == 1) - /* No need to even call num_processors_ignoring_omp (query). */ - return 1; - { - unsigned long nprocs = num_processors_ignoring_omp (query); - return MIN (nprocs, omp_env_limit); - } + + /* Honor any CPU quotas. */ + if (query == NPROC_CURRENT && nproc_limit > NPROC_MINIMUM) + { + unsigned long int quota = cpu_quota (); + nproc_limit = MIN (quota, nproc_limit); + } + + if (nproc_limit > NPROC_MINIMUM) + { + unsigned long nprocs = num_processors_available (query); + nproc_limit = MIN (nprocs, nproc_limit); + } + + return nproc_limit; } diff --git a/lib/open.c b/lib/open.c index d76372fd603..fceacfcc00f 100644 --- a/lib/open.c +++ b/lib/open.c @@ -38,13 +38,7 @@ orig_open (const char *filename, int flags, mode_t mode) } /* Specification. */ -#ifdef __osf__ -/* Write "fcntl.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates - this include because of the preliminary #include above. */ -# include "fcntl.h" -#else -# include -#endif +#include #include "cloexec.h" @@ -100,7 +94,7 @@ open (const char *filename, int flags, ...) #endif #if defined _WIN32 && ! defined __CYGWIN__ - if (strcmp (filename, "/dev/null") == 0) + if (streq (filename, "/dev/null")) filename = "NUL"; #endif diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c index a4968f7df40..0d0a5c211da 100644 --- a/lib/pthread_sigmask.c +++ b/lib/pthread_sigmask.c @@ -26,10 +26,6 @@ # include #endif -#if PTHREAD_SIGMASK_UNBLOCK_BUG -# include -#endif - int pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) #undef pthread_sigmask @@ -58,7 +54,7 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) Don't cache the information: libpthread.so could be dynamically loaded after the program started and after pthread_sigmask was called for the first time. */ - if (memcmp (&omask_copy, &omask, sizeof omask) == 0 + if (memeq (&omask_copy, &omask, sizeof omask) && pthread_sigmask (1729, &omask_copy, NULL) == 0) { /* pthread_sigmask is currently ineffective. The program is not @@ -73,16 +69,6 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask) # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO if (ret == -1) return errno; -# endif -# if PTHREAD_SIGMASK_UNBLOCK_BUG - if (ret == 0 - && new_mask != NULL - && (how == SIG_UNBLOCK || how == SIG_SETMASK)) - { - /* Give the OS the opportunity to raise signals that were pending before - the pthread_sigmask call and have now been unblocked. */ - usleep (1); - } # endif return ret; #else diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c index 282f4b2d2a5..e86e15544f6 100644 --- a/lib/qcopy-acl.c +++ b/lib/qcopy-acl.c @@ -50,9 +50,9 @@ is_attr_permissions (const char *name, struct error_context *ctx) { /* We need to explicitly test for the known extended attribute names, because at least on CentOS 7, attr_copy_action does not do it. */ - return strcmp (name, XATTR_NAME_POSIX_ACL_ACCESS) == 0 - || strcmp (name, XATTR_NAME_POSIX_ACL_DEFAULT) == 0 - || strcmp (name, XATTR_NAME_NFSV4_ACL) == 0 + return streq (name, XATTR_NAME_POSIX_ACL_ACCESS) + || streq (name, XATTR_NAME_POSIX_ACL_DEFAULT) + || streq (name, XATTR_NAME_NFSV4_ACL) || attr_copy_action (name, ctx) == ATTR_ACTION_PERMISSIONS; } diff --git a/lib/readutmp.h b/lib/readutmp.h index 60d63df9598..f186d99d68d 100644 --- a/lib/readutmp.h +++ b/lib/readutmp.h @@ -115,19 +115,19 @@ enum { UT_HOST_SIZE = -1 }; Field Type Platforms ---------- ------ --------- - ⎡ ut_user char[] glibc, musl, macOS, FreeBSD, AIX, HP-UX, IRIX, Solaris, Cygwin, Android + ⎡ ut_user char[] glibc, musl, macOS, FreeBSD, AIX, HP-UX, Solaris, Cygwin, Android ⎣ ut_name char[] NetBSD, Minix - ut_id char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_line char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_pid pid_t glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_type short glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ⎡ ut_tv struct glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android + ut_id char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android + ut_line char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android + ut_pid pid_t glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android + ut_type short glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android + ⎡ ut_tv struct glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android ⎢ { tv_sec; tv_usec; } ⎣ ut_time time_t Cygwin - ut_host char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_exit struct glibc, musl, NetBSD, Minix, HP-UX, IRIX, Solaris, Android + ut_host char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android + ut_exit struct glibc, musl, NetBSD, Minix, HP-UX, Solaris, Android { e_termination; e_exit; } - ut_session [long] int glibc, musl, NetBSD, Minix, IRIX, Solaris, Android + ut_session [long] int glibc, musl, NetBSD, Minix, Solaris, Android ⎡ ut_addr [long] int HP-UX, Cygwin ⎢ ut_addr_v6 [u]int[4] glibc, musl, Android ⎣ ut_ss struct sockaddr_storage NetBSD, Minix @@ -174,7 +174,7 @@ struct utmpx32 # define SET_UTMP_ENT setutxent # define GET_UTMP_ENT getutxent # define END_UTMP_ENT endutxent -# ifdef HAVE_UTMPXNAME /* glibc, musl, macOS, NetBSD, Minix, IRIX, Solaris, Cygwin */ +# ifdef HAVE_UTMPXNAME /* glibc, musl, macOS, NetBSD, Minix, Solaris, Cygwin */ # define UTMP_NAME_FUNCTION utmpxname # elif defined UTXDB_ACTIVE /* FreeBSD */ # define UTMP_NAME_FUNCTION(x) setutxdb (UTXDB_ACTIVE, x) @@ -190,17 +190,17 @@ struct utmpx32 Field Type Platforms ---------- ------ --------- - ⎡ ut_user char[] glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android + ⎡ ut_user char[] glibc, musl, AIX, HP-UX, Solaris, Cygwin, Android ⎣ ut_name char[] macOS, old FreeBSD, NetBSD, OpenBSD, Minix - ut_id char[] glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_line char[] glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_pid pid_t glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android - ut_type short glibc, musl, AIX, HP-UX, IRIX, Solaris, Cygwin, Android + ut_id char[] glibc, musl, AIX, HP-UX, Solaris, Cygwin, Android + ut_line char[] glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android + ut_pid pid_t glibc, musl, AIX, HP-UX, Solaris, Cygwin, Android + ut_type short glibc, musl, AIX, HP-UX, Solaris, Cygwin, Android ⎡ ut_tv struct glibc, musl, Android ⎢ { tv_sec; tv_usec; } - ⎣ ut_time time_t macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin + ⎣ ut_time time_t macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, Solaris, Cygwin ut_host char[] glibc, musl, macOS, old FreeBSD, NetBSD, OpenBSD, Minix, AIX, HP-UX, Cygwin, Android - ut_exit struct glibc, musl, AIX, HP-UX, IRIX, Solaris, Android + ut_exit struct glibc, musl, AIX, HP-UX, Solaris, Android { e_termination; e_exit; } ut_session [long] int glibc, musl, Android ⎡ ut_addr [long] int HP-UX, Cygwin @@ -211,7 +211,7 @@ struct utmpx32 # define SET_UTMP_ENT setutent # define GET_UTMP_ENT getutent # define END_UTMP_ENT endutent -# ifdef HAVE_UTMPNAME /* glibc, musl, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android */ +# ifdef HAVE_UTMPNAME /* glibc, musl, NetBSD, Minix, AIX, HP-UX, Solaris, Cygwin, Android */ # define UTMP_NAME_FUNCTION utmpname # endif diff --git a/lib/realloc.c b/lib/realloc.c index 42375010975..62efd5a39ff 100644 --- a/lib/realloc.c +++ b/lib/realloc.c @@ -50,7 +50,7 @@ rpl_realloc (void *p, size_t n) undefined behavior even though C17 and earlier partially defined the behavior. Let the programmer know. When the undefined-behaviour sanitizers report this case, i.e. when - and + and have been closed and new releases of GCC and clang have been made, we can revisit this code. */ diff --git a/lib/regex.c b/lib/regex.c index f5f6552670d..1404dac7534 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -24,6 +24,7 @@ # if __GNUC_PREREQ (4, 6) # pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +# pragma GCC diagnostic ignored "-Wswitch-enum" # pragma GCC diagnostic ignored "-Wvla" # endif #endif diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 1f2972999ad..03893b8630b 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -98,24 +98,14 @@ #endif /* This is for other GNU distributions with internationalized messages. */ -#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC +#ifdef _LIBC # include # undef gettext -# ifdef _LIBC -# define gettext(msgid) \ +# define gettext(msgid) \ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) -# else -# define gettext(msgid) dgettext ("gnulib", msgid) -# endif -#else -# undef gettext -# define gettext(msgid) (msgid) -#endif - -#ifndef gettext_noop -/* This define is so xgettext can find the internationalizable - strings. */ # define gettext_noop(String) String +#else +# include "gettext.h" #endif /* Number of ASCII characters. */ diff --git a/lib/set-permissions.c b/lib/set-permissions.c index 2da2e98e426..af0b5de228d 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c @@ -25,17 +25,13 @@ #include "minmax.h" #if USE_ACL -# if ! defined HAVE_ACL_FROM_MODE && defined HAVE_ACL_FROM_TEXT /* FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */ +# if ! defined HAVE_ACL_FROM_MODE && defined HAVE_ACL_FROM_TEXT /* FreeBSD, Cygwin >= 2.5 */ # if HAVE_ACL_GET_FILE && !HAVE_ACL_TYPE_EXTENDED static acl_t acl_from_mode (mode_t mode) { -# if HAVE_ACL_FREE_TEXT /* Tru64 */ - char acl_text[] = "u::---,g::---,o::---,"; -# else /* FreeBSD, IRIX, Cygwin >= 2.5 */ char acl_text[] = "u::---,g::---,o::---"; -# endif if (mode & S_IRUSR) acl_text[ 3] = 'r'; if (mode & S_IWUSR) acl_text[ 4] = 'w'; @@ -490,9 +486,9 @@ set_acls (struct permission_context *ctx, const char *name, int desc, # if HAVE_ACL_GET_FILE /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */ - /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */ + /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */ # if !HAVE_ACL_TYPE_EXTENDED - /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */ + /* Linux, FreeBSD, Cygwin >= 2.5 */ # ifndef HAVE_ACL_FROM_TEXT # error Must have acl_from_text (see POSIX 1003.1e draft 17). diff --git a/lib/sig2str.c b/lib/sig2str.c index e8c830c6daf..bf4d009578d 100644 --- a/lib/sig2str.c +++ b/lib/sig2str.c @@ -288,7 +288,7 @@ str2signum (char const *signame) { unsigned int i; for (i = 0; i < NUMNAME_ENTRIES; i++) - if (strcmp (numname_table[i].name, signame) == 0) + if (streq (numname_table[i].name, signame)) return numname_table[i].num; { diff --git a/lib/sigdescr_np.c b/lib/sigdescr_np.c index 46c746ae072..6715269e05e 100644 --- a/lib/sigdescr_np.c +++ b/lib/sigdescr_np.c @@ -26,7 +26,7 @@ const char * sigdescr_np (int sig) { - /* Note: Some platforms (glibc, FreeBSD, NetBSD, OpenBSD, AIX, IRIX, Haiku, + /* Note: Some platforms (glibc, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Android) have an array 'sys_siglist'. (On AIX, you need to declare it yourself, and it has fewer than NSIG elements.) Its contents varies depending on the OS. @@ -160,12 +160,7 @@ sigdescr_np (int sig) case SIGBREAK: return "Ctrl-Break"; #endif - /* IRIX */ - #if defined SIGCKPT - case SIGCKPT: - return "Checkpoint"; /* See man 1 cpr, man 3C atcheckpoint */ - #endif - /* Linux, IRIX, Cygwin */ + /* Linux, Cygwin */ #if defined SIGCLD && SIGCLD != SIGCHLD case SIGCLD: return "Child stopped or exited"; @@ -182,7 +177,7 @@ sigdescr_np (int sig) /* AIX: "Paging space low". */ return "Swap space nearly exhausted"; #endif - /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin, mingw */ + /* Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, Cygwin, mingw */ #if defined SIGEMT case SIGEMT: /* glibc/Hurd, *BSD: "EMT trap". Solaris: "Emulation trap". */ @@ -193,12 +188,12 @@ sigdescr_np (int sig) case SIGINFO: return "Information request"; #endif - /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin */ + /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, Cygwin */ #if defined SIGIO && SIGIO != SIGPOLL case SIGIO: return "I/O possible"; #endif - /* Linux, IRIX, Cygwin, mingw */ + /* Linux, Cygwin, mingw */ #if defined SIGIOT && SIGIOT != SIGABRT case SIGIOT: return "IOT instruction"; /* a PDP-11 instruction */ @@ -267,17 +262,7 @@ sigdescr_np (int sig) case SIGPRE: return "Programmed exception"; #endif - /* IRIX */ - #if defined SIGPTINTR - case SIGPTINTR: - return "Pthread interrupt"; - #endif - /* IRIX */ - #if defined SIGPTRESCHED - case SIGPTRESCHED: - return "Pthread rescheduling"; - #endif - /* Linux, NetBSD, Minix, AIX, IRIX, Cygwin */ + /* Linux, NetBSD, Minix, AIX, Cygwin */ #if defined SIGPWR case SIGPWR: /* glibc: "Power failure". NetBSD: "Power fail/restart". */ @@ -293,11 +278,6 @@ sigdescr_np (int sig) case SIGRECOVERY: return "Kernel recovery"; #endif - /* IRIX */ - #if defined SIGRESTART - case SIGRESTART: - return "Checkpoint restart"; /* See man 1 cpr, man 3C atrestart */ - #endif /* AIX */ #if defined SIGRETRACT case SIGRETRACT: @@ -347,11 +327,6 @@ sigdescr_np (int sig) /* OpenBSD: "Thread AST". */ return "Thread library interrupt"; #endif - /* IRIX */ - #if defined SIGUME - case SIGUME: - return "Uncorrectable memory error"; - #endif /* AIX */ #if defined SIGVIRT case SIGVIRT: @@ -363,7 +338,7 @@ sigdescr_np (int sig) /* AIX: "No runnable lwp". */ return "Thread waiting"; #endif - /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, IRIX, Cygwin, Haiku */ + /* Linux, Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, AIX, Cygwin, Haiku */ #if defined SIGWINCH case SIGWINCH: /* glibc: "Window changed". *BSD: "Window size changed" or "Window size changes". */ diff --git a/lib/signal.in.h b/lib/signal.in.h index a2549e84235..66e0c310ef8 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -66,14 +66,14 @@ # include #endif -/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, OSF/1 4.0, Solaris 2.6, Android, +/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, Solaris 2.6, Android, OS/2 kLIBC declare pthread_sigmask in , not in . But avoid namespace pollution on glibc systems.*/ #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ && ((defined __APPLE__ && defined __MACH__) \ || (defined __FreeBSD__ && __FreeBSD__ < 8) \ || (defined __OpenBSD__ && OpenBSD < 201205) \ - || defined __osf__ || defined __sun || defined __ANDROID__ \ + || defined __sun || defined __ANDROID__ \ || defined __KLIBC__) \ && ! defined __GLIBC__ # include diff --git a/lib/stddef.in.h b/lib/stddef.in.h index e8c55ff1cdc..9ad768d785b 100644 --- a/lib/stddef.in.h +++ b/lib/stddef.in.h @@ -32,7 +32,7 @@ || defined __need_wint_t) \ /* Avoid warning triggered by "gcc -std=gnu23 -Wsystem-headers" \ in GCC 13.3 and 14.2 \ - . */ \ + . */ \ && !@STDDEF_NOT_IDEMPOTENT@ /* Special invocation convention inside gcc header files. In particular, in some ancient versions of GCC blindly @@ -91,7 +91,7 @@ typedef long max_align_t; # if !defined _GCC_NULLPTR_T && !@NULLPTR_T_NEEDS_STDDEF@ /* Suppress unwanted nullptr_t typedef. See - . */ + . */ # define _GCC_NULLPTR_T # endif diff --git a/lib/stdint.in.h b/lib/stdint.in.h index ca566b303ee..4df6433338f 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -51,13 +51,6 @@ in public interfaces due to compiler differences. */ #if @HAVE_STDINT_H@ -# if defined __sgi && ! defined __c99 - /* Bypass IRIX's if in C89 mode, since it merely annoys users - with "This header file is to be used only for c99 mode compilations" - diagnostics. */ -# define __STDINT_H__ -# endif - /* Some pre-C++11 implementations need this. */ # ifdef __cplusplus # ifndef __STDC_CONSTANT_MACROS @@ -94,8 +87,8 @@ #if ! @HAVE_C99_STDINT_H@ -/* defines some of the stdint.h types as well, on glibc, - IRIX 6.5, and OpenBSD 3.8 (via ). +/* defines some of the stdint.h types as well, on glibc and + OpenBSD 3.8 (via ). AIX 5.2 isn't needed and causes troubles. Mac OS X 10.4.6 includes (which is us), but relies on the system definitions, so include @@ -584,11 +577,7 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) # endif /* wchar_t limits */ -/* Get WCHAR_MIN, WCHAR_MAX. - This include is not on the top, above, because on OSF/1 4.0 we have a - sequence of nested includes - -> -> -> , and the latter includes - and assumes its types are already defined. */ +/* Get WCHAR_MIN, WCHAR_MAX. */ # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H # include diff --git a/lib/stdio-consolesafe.c b/lib/stdio-consolesafe.c new file mode 100644 index 00000000000..80561a6da4e --- /dev/null +++ b/lib/stdio-consolesafe.c @@ -0,0 +1,199 @@ +/* msvcrt workarounds. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include +#include +#include + +/* Outputs N bytes starting at S to FP. + These N bytes are known to be followed by a NUL. + Finally frees the string at S. + Returns the number of written bytes. */ +static size_t +workaround_fwrite0 (char *s, size_t n, FILE *fp) +{ + const char *ptr = s; + /* Use fputs instead of fwrite, which is buggy in msvcrt. */ + size_t written = 0; + while (n > 0) + { + size_t l = strlen (ptr); /* 0 <= l <= n */ + if (l > 0) + { + if (fputs (ptr, fp) == EOF) + break; + written += l; + n -= l; + } + if (n == 0) + break; + if (fputc ('\0', fp) == EOF) + break; + written++; + n--; + ptr += l + 1; + } + free (s); + return written; +} + +size_t +gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp) +{ + size_t nbytes; + if (ckd_mul (&nbytes, size, nmemb) || nbytes == 0) + /* Overflow, or nothing to do. */ + return 0; + char *tmp = malloc (nbytes + 1); + if (tmp == NULL) + return 0; + memcpy (tmp, ptr, nbytes); + tmp[nbytes] = '\0'; + size_t written = workaround_fwrite0 (tmp, nbytes, fp); + return written / size; +} + +#if defined __MINGW32__ && __USE_MINGW_ANSI_STDIO + +# include "fseterr.h" +# include + +# if !HAVE_VASPRINTF + +# include + +/* The old mingw (before mingw-w64) does not have the vasprintf function. + Define a suitable replacement here, that supports the same format + specifiers as the mingw *printf functions. */ + +static int +vasprintf (char **resultp, const char *format, va_list args) +{ + /* First try: Use a stack-allocated buffer. */ + char buf[2048]; + size_t bufsize = sizeof (buf); + int ret = __mingw_vsnprintf (buf, bufsize, format, args); + if (ret < 0) + return -1; + size_t nbytes = ret; + char *mem = (char *) malloc (nbytes + 1); + if (mem == NULL) + { + errno = ENOMEM; + return -1; + } + if (ret < bufsize) + { + /* The buffer was sufficiently large. */ + memcpy (mem, buf, nbytes + 1); + } + else + { + /* Second try: Use the heap-allocated memory. */ + ret = __mingw_vsnprintf (mem, nbytes + 1, format, args); + if (ret < 0) + { + int saved_errno = errno; + free (mem); + errno = saved_errno; + return -1; + } + if (ret != nbytes) + abort (); + } + *resultp = mem; + return nbytes; +} + +# endif + +/* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt, + but without losing the support for modern format specifiers added by + __mingw_*printf. */ + +int +gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...) +{ + va_list args; + char *tmpstring; + va_start (args, format); + int result = vasprintf (&tmpstring, format, args); + va_end (args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, fp) < result) + result = -1; + } + else + fseterr (fp); + return result; +} + +int +gl_consolesafe_printf (const char *restrict format, ...) +{ + va_list args; + char *tmpstring; + va_start (args, format); + int result = vasprintf (&tmpstring, format, args); + va_end (args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, stdout) < result) + result = -1; + } + else + fseterr (stdout); + return result; +} + +int +gl_consolesafe_vfprintf (FILE *restrict fp, + const char *restrict format, va_list args) +{ + char *tmpstring; + int result = vasprintf (&tmpstring, format, args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, fp) < result) + result = -1; + } + else + fseterr (fp); + return result; +} + +int +gl_consolesafe_vprintf (const char *restrict format, va_list args) +{ + char *tmpstring; + int result = vasprintf (&tmpstring, format, args); + if (result >= 0) + { + if (workaround_fwrite0 (tmpstring, result, stdout) < result) + result = -1; + } + else + fseterr (stdout); + return result; +} + +#endif diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h index 4abf9e68b23..e4a69a8d11b 100644 --- a/lib/stdio-impl.h +++ b/lib/stdio-impl.h @@ -108,15 +108,59 @@ # define _flags pub._flags # define _r pub._r # define _w pub._w -# elif defined __ANDROID__ || defined __OpenBSD__ /* Android, OpenBSD */ -# if defined __LP64__ && !defined __OpenBSD__ +# elif defined __OpenBSD__ /* OpenBSD */ +# if defined __sferror /* OpenBSD <= 7.7 */ +# define _gl_flags_file_t short +# else /* OpenBSD >= 7.8 */ +# define _gl_flags_file_t int +# endif + /* Up to this commit from 2025-07-16 + + the innards of FILE were public. After this commit, the innards of FILE + are hidden. In this commit + + they were reshuffled. */ +# if defined __sferror /* OpenBSD <= 7.7 */ +# define fp_ ((struct { unsigned char *_p; \ + int _r; \ + int _w; \ + _gl_flags_file_t _flags; \ + _gl_flags_file_t _file; \ + struct { unsigned char *_base; size_t _size; } _bf; \ + int _lbfsize; \ + void *_cookie; \ + void *_close; \ + void *_read; \ + void *_seek; \ + void *_write; \ + struct { unsigned char *_base; size_t _size; } _ext; \ + unsigned char *_up; \ + int _ur; \ + unsigned char _ubuf[3]; \ + unsigned char _nbuf[1]; \ + struct { unsigned char *_base; size_t _size; } _lb; \ + int _blksize; \ + fpos_t _offset; \ + /* More fields, not relevant here. */ \ + } *) fp) +# else /* OpenBSD >= 7.8 */ +# define fp_ ((struct { _gl_flags_file_t _flags; \ + _gl_flags_file_t _file; \ + unsigned char *_p; \ + int _r; \ + int _w; \ + struct { unsigned char *_base; size_t _size; } _bf; \ + int _lbfsize; \ + /* More fields, not relevant here. */ \ + } *) fp) +# endif +# elif defined __ANDROID__ /* Android */ +# if defined __LP64__ # define _gl_flags_file_t int # else # define _gl_flags_file_t short # endif -# if defined __OpenBSD__ -# define _gl_file_offset_t fpos_t -# elif defined __LP64__ +# if defined __LP64__ # define _gl_file_offset_t int64_t # else /* see https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */ @@ -127,9 +171,7 @@ the innards of FILE were public, see and . - After this commit, the innards of FILE are hidden. Likewise for OpenBSD - up to this commit from 2025-07-16 - . */ + After this commit, the innards of FILE are hidden. */ # define fp_ ((struct { unsigned char *_p; \ int _r; \ int _w; \ diff --git a/lib/stdio.in.h b/lib/stdio.in.h index e80862125df..cc6010119d0 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -22,12 +22,7 @@ #if defined __need_FILE || defined __need___FILE || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H || defined _GL_SKIP_GNULIB_STDIO_H /* Special invocation convention: - - Inside glibc header files. - - On OSF/1 5.1 we have a sequence of nested includes - -> -> -> -> - -> -> -> . - In this situation, the functions are not yet declared, therefore we cannot - provide the C++ aliases. */ + - Inside glibc header files. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ @@ -269,10 +264,6 @@ - with MSVC ucrt: "[-]nan" or "[-]nan(ind)" or "[-]nan(snan)", - with mingw: "[-]1.#IND" or "[-]1.#QNAN". */ # define _PRINTF_NAN_LEN_MAX 10 -# elif defined __sgi -/* On IRIX, the output typically is "[-]nan0xNNNNNNNN" with 8 hexadecimal - digits. */ -# define _PRINTF_NAN_LEN_MAX 14 # else /* We don't know, but 32 should be a safe maximum. */ # define _PRINTF_NAN_LEN_MAX 32 @@ -280,6 +271,33 @@ #endif +#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT +/* Workarounds against msvcrt bugs. */ +_GL_FUNCDECL_SYS (gl_consolesafe_fwrite, size_t, + (const void *ptr, size_t size, size_t nmemb, FILE *fp), + _GL_ARG_NONNULL ((1, 4))); +# if defined __MINGW32__ +_GL_FUNCDECL_SYS (gl_consolesafe_fprintf, int, + (FILE *restrict fp, const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_SYS (gl_consolesafe_printf, int, + (const char *restrict format, ...), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_FUNCDECL_SYS (gl_consolesafe_vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_FUNCDECL_SYS (gl_consolesafe_vprintf, int, + (const char *restrict format, va_list args), + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) + _GL_ARG_NONNULL ((1))); +# endif +#endif + + #if @GNULIB_DZPRINTF@ /* Prints formatted output to file descriptor FD. Returns the number of bytes written to the file descriptor. Upon @@ -616,6 +634,11 @@ _GL_CXXALIAS_SYS (fprintf, int, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fprintf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fprintf +# define fprintf gl_consolesafe_fprintf +# endif #endif #if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_fprintf @@ -945,7 +968,7 @@ _GL_CXXALIAS_SYS (fwrite, size_t, FILE *restrict stream)); /* Work around bug 11959 when fortifying glibc 2.4 through 2.15 - , + , which sometimes causes an unwanted diagnostic for fwrite calls. This affects only function declaration attributes under certain versions of gcc and clang, and is not needed for C++. */ @@ -970,6 +993,11 @@ _GL_EXTERN_C size_t __REDIRECT (rpl_fwrite_unlocked, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (fwrite); # endif +#elif (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fwrite +# define fwrite gl_consolesafe_fwrite +# endif #endif #if @GNULIB_GETC@ @@ -1016,6 +1044,17 @@ _GL_CXXALIASWARN (getchar); # undef getdelim # define getdelim rpl_getdelim # endif +# ifndef __has_feature +# define __has_feature(a) 0 +# endif +# if __GLIBC__ >= 2 && !(defined __SANITIZE_ADDRESS__ \ + || __has_feature (address_sanitizer)) +/* Arrange for the inline definition of getline() in + to call our getdelim() override. Do not use the __getdelim symbol + if address sanitizer is in use, otherwise it may be overridden by + __interceptor_trampoline___getdelim. */ +# define rpl_getdelim __getdelim +# endif _GL_FUNCDECL_RPL (getdelim, ssize_t, (char **restrict lineptr, size_t *restrict linesize, int delimiter, @@ -1057,14 +1096,27 @@ _GL_WARN_ON_USE (getdelim, "getdelim is unportable - " Return the number of bytes read and stored at *LINEPTR (not including the NUL terminator), or -1 on error or EOF. */ # if @REPLACE_GETLINE@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef getline -# define getline rpl_getline -# endif _GL_FUNCDECL_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream), _GL_ARG_NONNULL ((1, 2, 3)) _GL_ATTRIBUTE_NODISCARD); +# if defined __cplusplus +/* The C++ standard library defines std::basic_istream::getline in + or . */ +# if !(__GLIBC__ >= 2) +extern "C" { +inline ssize_t +getline (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) +{ + return rpl_getline (lineptr, linesize, stream); +} +} +# endif +# else +# undef getline +# define getline rpl_getline +# endif _GL_CXXALIAS_RPL (getline, ssize_t, (char **restrict lineptr, size_t *restrict linesize, FILE *restrict stream)); @@ -1333,6 +1385,11 @@ _GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); # if __GLIBC__ >= 2 _GL_CXXALIASWARN (printf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef printf +# define printf gl_consolesafe_printf +# endif #endif #if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_printf @@ -1885,6 +1942,11 @@ _GL_CXXALIAS_SYS_CAST (vfprintf, int, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vfprintf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vfprintf +# define vfprintf gl_consolesafe_vfprintf +# endif #endif #if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vfprintf @@ -1966,6 +2028,11 @@ _GL_CXXALIAS_SYS_CAST (vprintf, int, # if __GLIBC__ >= 2 _GL_CXXALIASWARN (vprintf); # endif +#elif defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vprintf +# define vprintf gl_consolesafe_vprintf +# endif #endif #if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK # if !GNULIB_overrides_vprintf diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index 1342db48772..bef0aaaf92e 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -62,12 +62,6 @@ /* NetBSD 5.0 mis-defines NULL. */ #include -/* MirBSD 10 defines WEXITSTATUS in , not in . - glibc 2.41 defines WCOREDUMP in , not in . */ -#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) -# include -#endif - /* Solaris declares getloadavg() in . */ #if (@GNULIB_GETLOADAVG@ || defined GNULIB_POSIXCHECK) && @HAVE_SYS_LOADAVG_H@ /* OpenIndiana has a bug: must be included before @@ -83,13 +77,6 @@ #if @GNULIB_RANDOM_R@ -/* OSF/1 5.1 declares 'struct random_data' in , which is included - from if _REENTRANT is defined. Include it whenever we need - 'struct random_data'. */ -# if @HAVE_RANDOM_H@ -# include -# endif - # include # if !@HAVE_STRUCT_RANDOM_DATA@ @@ -2027,6 +2014,18 @@ _GL_CXXALIASWARN (wctomb); _GL_INLINE_HEADER_END + +/* Includes that provide only macros that don't need to be overridden. + (Includes that are needed for type definitions and function declarations + have their place above, before the function overrides.) */ + +/* MirBSD 10 defines WEXITSTATUS in , not in . + glibc 2.41 defines WCOREDUMP in , not in . */ +#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP) +# include +#endif + + #endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif /* _@GUARD_PREFIX@_STDLIB_H */ #endif diff --git a/lib/strftime.c b/lib/strftime.c index 537172d8be6..6445d6e3d28 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -110,6 +110,7 @@ #include #include #include +#include #include #include @@ -198,17 +199,48 @@ enum pad_style # define mktime(tp) __mktime64 (tp) #endif +/* For functions that fill an in-memory string, the number of bytes fits in a + size_t. For functions that write to a stream, the number of bytes fits in + an off64_t (a type that is always at least 64 bits large). */ #if FPRINTFTIME # define STREAM_OR_CHAR_T FILE # define STRFTIME_ARG(x) /* empty */ +typedef off64_t byte_count_t; +typedef off64_t sbyte_count_t; #else # define STREAM_OR_CHAR_T CHAR_T # define STRFTIME_ARG(x) x, +typedef size_t byte_count_t; +typedef ptrdiff_t sbyte_count_t; +#endif + +/* The functions strftime[_l], wcsftime[_l] defined by glibc have a return type + 'size_t', for compatibility with POSIX, and return 0 upon failure. + The functions defined by Gnulib have a signed return type, and return -1 + upon failure. */ +#ifdef _LIBC +typedef size_t retval_t; +# define FAILURE 0 +#else +typedef sbyte_count_t retval_t; +# define FAILURE (-1) #endif #if FPRINTFTIME +# define FPUTC(Byte, P) \ + do \ + { \ + int _r = fputc (Byte, P); \ + if (_r < 0) \ + return FAILURE; \ + } \ + while (false) + # define memset_byte(P, Len, Byte) \ - do { size_t _i; for (_i = 0; _i < Len; _i++) fputc (Byte, P); } while (0) + do \ + for (byte_count_t _i = Len; 0 < _i; _i--) \ + FPUTC (Byte, P); \ + while (false) # define memset_space(P, Len) memset_byte (P, Len, ' ') # define memset_zero(P, Len) memset_byte (P, Len, '0') #elif defined COMPILE_WIDE @@ -226,22 +258,32 @@ enum pad_style #endif #define add(n, f) width_add (width, n, f) + +/* Add INCR, returning true if I would become too large. + INCR should not have side effects. */ +#if FPRINTFTIME +# define incr_overflow(incr) ckd_add (&i, i, incr) +#else +/* Use <= not <, to leave room for trailing NUL. */ +# define incr_overflow(incr) (maxsize - i <= (incr) || (i += (incr), false)) +#endif + #define width_add(width, n, f) \ do \ { \ - size_t _n = (n); \ - size_t _w = pad == NO_PAD || width < 0 ? 0 : width; \ - size_t _incr = _n < _w ? _w : _n; \ - if (_incr >= maxsize - i) \ + byte_count_t _n = n; \ + byte_count_t _w = pad == NO_PAD || width < 0 ? 0 : width; \ + byte_count_t _incr = _n < _w ? _w : _n; \ + if (incr_overflow (_incr)) \ { \ errno = ERANGE; \ - return 0; \ + return FAILURE; \ } \ if (p) \ { \ if (_n < _w) \ { \ - size_t _delta = _w - _n; \ + byte_count_t _delta = _w - _n; \ if (pad == ALWAYS_ZERO_PAD || pad == SIGN_PAD) \ memset_zero (p, _delta); \ else \ @@ -250,12 +292,11 @@ enum pad_style f; \ advance (p, _n); \ } \ - i += _incr; \ } while (0) #define add1(c) width_add1 (width, c) #if FPRINTFTIME -# define width_add1(width, c) width_add (width, 1, fputc (c, p)) +# define width_add1(width, c) width_add (width, 1, FPUTC (c, p)) #else # define width_add1(width, c) width_add (width, 1, *p = c) #endif @@ -266,19 +307,15 @@ enum pad_style width_add (width, n, \ do \ { \ + CHAR_T const *_s = s; \ if (to_lowcase) \ - fwrite_lowcase (p, (s), _n); \ + for (byte_count_t _i = 0; _i < _n; _i++) \ + FPUTC (TOLOWER ((UCHAR_T) _s[_i], loc), p); \ else if (to_uppcase) \ - fwrite_uppcase (p, (s), _n); \ - else \ - { \ - /* Ignore the value of fwrite. The caller can determine whether \ - an error occurred by inspecting ferror (P). All known fwrite \ - implementations set the stream's error indicator when they \ - fail due to ENOMEM etc., even though C11 and POSIX.1-2008 do \ - not require this. */ \ - fwrite (s, _n, 1, p); \ - } \ + for (byte_count_t _i = 0; _i < _n; _i++) \ + FPUTC (TOUPPER ((UCHAR_T) _s[_i], loc), p); \ + else if (fwrite (_s, _n, 1, p) == 0) \ + return FAILURE; \ } \ while (0) \ ) @@ -355,32 +392,12 @@ enum pad_style /* Avoid false GCC warning "'memset' specified size 18446744073709551615 exceeds maximum object size 9223372036854775807", caused by insufficient data flow analysis and value propagation of the 'width_add' expansion when GCC is not - optimizing. Cf. . */ + optimizing. Cf. . */ #if _GL_GNUC_PREREQ (7, 0) && !__OPTIMIZE__ # pragma GCC diagnostic ignored "-Wstringop-overflow" #endif -#if FPRINTFTIME -static void -fwrite_lowcase (FILE *fp, const CHAR_T *src, size_t len) -{ - while (len-- > 0) - { - fputc (TOLOWER ((UCHAR_T) *src, loc), fp); - ++src; - } -} - -static void -fwrite_uppcase (FILE *fp, const CHAR_T *src, size_t len) -{ - while (len-- > 0) - { - fputc (TOUPPER ((UCHAR_T) *src, loc), fp); - ++src; - } -} -#else +#if !FPRINTFTIME static CHAR_T *memcpy_lowcase (CHAR_T *dest, const CHAR_T *src, size_t len LOCALE_PARAM); @@ -894,12 +911,14 @@ static CHAR_T const c_month_names[][sizeof "September"] = # define ns 0 #endif -static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t) - const CHAR_T *, const struct tm *, - CAL_ARGS (const struct calendar *, - struct calendar_date *) - bool, enum pad_style, int, bool * - extra_args_spec LOCALE_PARAM); +static retval_t __strftime_internal (STREAM_OR_CHAR_T *, + STRFTIME_ARG (size_t) + const CHAR_T *, const struct tm *, + CAL_ARGS (const struct calendar *, + struct calendar_date *) + bool, enum pad_style, + sbyte_count_t, bool * + extra_args_spec LOCALE_PARAM); #if !defined _LIBC \ && (!(HAVE_ONLY_C_LOCALE || (USE_C_LOCALE && !HAVE_STRFTIME_L)) \ @@ -1102,12 +1121,16 @@ get_tm_zone (timezone_t tz, char *ubuf, int ubufsize, int modifier, } /* Write information from TP into S according to the format - string FORMAT, writing no more that MAXSIZE characters - (including the terminating '\0') and returning number of - characters written. If S is NULL, nothing will be written - anywhere, so to determine how many characters would be - written, use NULL for S and (size_t) -1 for MAXSIZE. */ -size_t + string FORMAT. Return the number of bytes written. + Upon failure: + - return 0 for the functions defined by glibc, + - return -1 for the functions defined by Gnulib. + + If !FPRINTFTIME, write no more than MAXSIZE bytes (including the + terminating '\0'), and if S is NULL do not write into S. + To determine how many characters would be written, use NULL for S + and (size_t) -1 for MAXSIZE. */ +retval_t my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) const CHAR_T *format, const struct tm *tp extra_args_spec LOCALE_PARAM) @@ -1150,24 +1173,26 @@ libc_hidden_def (my_strftime) UPCASE indicates that the result should be converted to upper case. YR_SPEC and WIDTH specify the padding and width for the year. *TZSET_CALLED indicates whether tzset has been called here. */ -static size_t +static retval_t __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) const CHAR_T *format, const struct tm *tp, CAL_ARGS (const struct calendar *cal, struct calendar_date *caldate) bool upcase, - enum pad_style yr_spec, int width, bool *tzset_called + enum pad_style yr_spec, sbyte_count_t width, + bool *tzset_called extra_args_spec LOCALE_PARAM) { #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL struct __locale_data *const current = loc->__locales[LC_TIME]; #endif -#if FPRINTFTIME - size_t maxsize = (size_t) -1; -#endif - +#if FAILURE == 0 int saved_errno = errno; +#elif !FPRINTFTIME + if (PTRDIFF_MAX < maxsize) + maxsize = PTRDIFF_MAX; +#endif #ifdef _NL_CURRENT /* We cannot make the following values variables since we must delay @@ -1221,7 +1246,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) # define ampm (L_("AMPM") + 2 * (tp->tm_hour > 11)) # define ap_len 2 #endif - size_t i = 0; + retval_t i = 0; STREAM_OR_CHAR_T *p = s; const CHAR_T *f; #if DO_MULTIBYTE && !defined COMPILE_WIDE @@ -1260,7 +1285,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) size_t colons; bool change_case = false; int format_char; - int subwidth; + sbyte_count_t subwidth; #if DO_MULTIBYTE && !defined COMPILE_WIDE switch (*f) @@ -1384,7 +1409,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) { if (ckd_mul (&width, width, 10) || ckd_add (&width, width, *f - L_('0'))) - width = INT_MAX; + return FAILURE; ++f; } while (ISDIGIT (*f)); @@ -1585,12 +1610,15 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) subwidth = -1; subformat_width: { - size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1) - subfmt, tp, - CAL_ARGS (cal, caldate) - to_uppcase, pad, subwidth, - tzset_called - extra_args LOCALE_ARG); + retval_t len = + __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1) + subfmt, tp, + CAL_ARGS (cal, caldate) + to_uppcase, pad, subwidth, + tzset_called + extra_args LOCALE_ARG); + if (FAILURE < 0 && len < 0) + return FAILURE; /* errno is set here */ add (len, __strftime_internal (p, STRFTIME_ARG (maxsize - i) subfmt, tp, @@ -1862,8 +1890,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) if (digits_base >= 0x100) number_digits = number_bytes / 2; #endif - int shortage = width - !!sign_char - number_digits; - int padding = pad == NO_PAD || shortage <= 0 ? 0 : shortage; + byte_count_t shortage = width - !!sign_char - number_digits; + byte_count_t padding = (pad == NO_PAD || shortage <= 0 + ? 0 : shortage); if (sign_char) { @@ -1871,7 +1900,11 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) { if (p) memset_space (p, padding); - i += padding; + if (ckd_add (&i, i, padding) && FPRINTFTIME) + { + errno = ERANGE; + return FAILURE; + } width -= padding; } width_add1 (0, sign_char); @@ -2033,7 +2066,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) if (ltm.tm_yday < 0) { errno = EOVERFLOW; - return 0; + return FAILURE; } /* Generate string value for T using time_t arithmetic; @@ -2252,12 +2285,12 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) mbstate_t st = {0}; size_t len = __mbsrtowcs_l (p, &z, maxsize - i, &st, loc); if (len == (size_t) -1) - return 0; + return FAILURE; size_t incr = len < w ? w : len; if (incr >= maxsize - i) { errno = ERANGE; - return 0; + return FAILURE; } if (p) { @@ -2375,6 +2408,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize) *p = L_('\0'); #endif +#if FAILURE == 0 errno = saved_errno; +#endif + return i; } diff --git a/lib/strftime.h b/lib/strftime.h index a76c98c9c82..bb2b63b075f 100644 --- a/lib/strftime.h +++ b/lib/strftime.h @@ -15,6 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#include #include #ifdef __cplusplus @@ -71,23 +72,32 @@ extern "C" { Store the result, as a string with a trailing NUL character, at the beginning of the array __S[0..__MAXSIZE-1] and return the length of - that string, not counting the trailing NUL, and without changing errno. - If unsuccessful, possibly change the array __S, set errno, and return 0; + that string, not counting the trailing NUL. + If unsuccessful, possibly change the array __S, set errno, and return -1; errno == ERANGE means the string didn't fit. + As a glibc extension if __S is null, do not store anything, and + return the value that would have been returned had __S been non-null. + + A __MAXSIZE greater than PTRDIFF_MAX is silently treated as if + it were PTRDIFF_MAX, so that the caller can safely add 1 to + any return value without overflow. + This function is like strftime, but with two more arguments: * __TZ instead of the local timezone information, - * __NS as the number of nanoseconds in the %N directive. + * __NS as the number of nanoseconds in the %N directive, + and on success it does not preserve errno, + and on failure it returns -1 not 0. */ -size_t nstrftime (char *restrict __s, size_t __maxsize, - char const *__format, - struct tm const *__tp, timezone_t __tz, int __ns); +ptrdiff_t nstrftime (char *restrict __s, size_t __maxsize, + char const *__format, + struct tm const *__tp, timezone_t __tz, int __ns); /* Like nstrftime, except that it uses the "C" locale instead of the current locale. */ -size_t c_nstrftime (char *restrict __s, size_t __maxsize, - char const *__format, - struct tm const *__tp, timezone_t __tz, int __ns); +ptrdiff_t c_nstrftime (char *restrict __s, size_t __maxsize, + char const *__format, + struct tm const *__tp, timezone_t __tz, int __ns); #ifdef __cplusplus } diff --git a/lib/string.c b/lib/string.c new file mode 100644 index 00000000000..cce2eac9c06 --- /dev/null +++ b/lib/string.c @@ -0,0 +1,20 @@ +/* streq and memeq functions. + Copyright (C) 2025 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +#define _GL_STRING_INLINE _GL_EXTERN_INLINE +#include diff --git a/lib/string.in.h b/lib/string.in.h index 9a039c7ba06..fdcdd21bed6 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -80,6 +80,12 @@ # include #endif +_GL_INLINE_HEADER_BEGIN + +#ifndef _GL_STRING_INLINE +# define _GL_STRING_INLINE _GL_INLINE +#endif + /* _GL_ATTRIBUTE_DEALLOC (F, I) declares that the function returns pointers that can be freed by passing them as the Ith argument to the function F. */ @@ -96,7 +102,7 @@ /* Applies to: functions. Cannot be used on inline functions. */ #ifndef _GL_ATTRIBUTE_DEALLOC_FREE # if defined __cplusplus && defined __GNUC__ && !defined __clang__ -/* Work around GCC bug */ +/* Work around GCC bug */ # define _GL_ATTRIBUTE_DEALLOC_FREE \ _GL_ATTRIBUTE_DEALLOC ((void (*) (void *)) free, 1) # else @@ -409,6 +415,21 @@ _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " "use gnulib module memchr for portability" ); #endif +/* Are S1 and S2, of size N, bytewise equal? */ +#if @GNULIB_STRINGEQ@ && !@HAVE_DECL_MEMEQ@ +# ifdef __cplusplus +extern "C" { +# endif +_GL_STRING_INLINE bool +memeq (void const *__s1, void const *__s2, size_t __n) +{ + return !memcmp (__s1, __s2, __n); +} +# ifdef __cplusplus +} +# endif +#endif + /* Return the first occurrence of NEEDLE in HAYSTACK. */ #if @GNULIB_MEMMEM@ # if @REPLACE_MEMMEM@ @@ -789,6 +810,21 @@ _GL_CXXALIASWARN (strdup); # endif #endif +/* Are strings S1 and S2 equal? */ +#if @GNULIB_STRINGEQ@ && !@HAVE_DECL_STREQ@ +# ifdef __cplusplus +extern "C" { +# endif +_GL_STRING_INLINE bool +streq (char const *__s1, char const *__s2) +{ + return !strcmp (__s1, __s2); +} +# ifdef __cplusplus +} +# endif +#endif + /* Append no more than N characters from SRC onto DEST. */ #if @GNULIB_STRNCAT@ # if @REPLACE_STRNCAT@ @@ -1208,7 +1244,7 @@ _GL_EXTERN_C bool str_endswith (const char *string, const char *prefix) # ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ # undef mbslen # endif -# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ +# if @HAVE_MBSLEN@ /* AIX, MirBSD define mbslen already in libc. */ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mbslen rpl_mbslen # endif @@ -1722,6 +1758,7 @@ _GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " # endif #endif +_GL_INLINE_HEADER_END #endif /* _@GUARD_PREFIX@_STRING_H */ #endif /* _@GUARD_PREFIX@_STRING_H */ diff --git a/lib/sys-limits.h b/lib/sys-limits.h index a556dfeb6d5..5f074fc7db6 100644 --- a/lib/sys-limits.h +++ b/lib/sys-limits.h @@ -30,10 +30,6 @@ Using this also works around a serious Linux bug before 2.6.16; see . - Using this also works around a Tru64 5.1 bug, where attempting - to read INT_MAX bytes fails with errno == EINVAL. See - . - Using this is likely to work around similar bugs in other operating systems. */ diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index a06725020d2..69c2fa9fc4e 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -26,17 +26,14 @@ #error "Please include config.h first." #endif -/* On OSF/1 and Solaris 2.6, and - both include . +/* On Solaris 2.6, and both include . On Cygwin and OpenBSD, includes . Simply delegate to the system's header in this case. */ #if (@HAVE_SYS_SELECT_H@ \ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H \ - && ((defined __osf__ && defined _SYS_TYPES_H_ \ - && defined _OSF_SOURCE) \ - || (defined __sun && defined _SYS_TYPES_H \ - && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \ - || defined __EXTENSIONS__)))) + && (defined __sun && defined _SYS_TYPES_H \ + && (! (defined _XOPEN_SOURCE || defined _POSIX_C_SOURCE) \ + || defined __EXTENSIONS__))) # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ @@ -44,9 +41,7 @@ #elif (@HAVE_SYS_SELECT_H@ \ && (defined _CYGWIN_SYS_TIME_H \ || (!defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H \ - && ((defined __osf__ && defined _SYS_TIME_H_ \ - && defined _OSF_SOURCE) \ - || (defined __OpenBSD__ && defined _SYS_TIME_H_) \ + && ((defined __OpenBSD__ && defined _SYS_TIME_H_) \ || (defined __sun && defined _SYS_TIME_H \ && (! (defined _XOPEN_SOURCE \ || defined _POSIX_C_SOURCE) \ @@ -55,16 +50,6 @@ # define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ -/* On IRIX 6.5, includes , which includes - , which includes . At this point we cannot - include , because that includes , which - gives a syntax error because has not been completely - processed. Simply delegate to the system's header in this case. */ -#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H) - -# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H -# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ - /* On OpenBSD 5.0, includes , which includes . At this point we cannot include , because that includes gnulib's pthread.h override, which gives a syntax error because @@ -90,10 +75,7 @@ #if @HAVE_SYS_SELECT_H@ -/* On OSF/1 4.0, provides only a forward declaration - of 'struct timeval', and no definition of this type. - Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select() - in . +/* Mac OS X, AIX, HP-UX, Solaris, Interix declare select() in . But avoid namespace pollution on glibc systems, a circular include -> -> on FreeBSD 13.1, and "unknown type name" problems on Cygwin. */ @@ -101,14 +83,6 @@ # include # endif -/* On AIX 7 and Solaris 10, provides an FD_ZERO implementation - that relies on memset(), but without including . - But in any case avoid namespace pollution on glibc systems. */ -# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \ - && ! defined __GLIBC__ -# include -# endif - /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@ @@ -352,5 +326,20 @@ _GL_WARN_ON_USE (select, "select is not always POSIX compliant - " #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */ + + +/* Includes that provide only macros that don't need to be overridden. + (Includes that are needed for type definitions and function declarations + have their place above, before the function overrides.) */ + +/* On AIX 7 and Solaris 10, provides an FD_ZERO implementation + that relies on memset(), but without including . + But in any case avoid namespace pollution on glibc systems. */ +# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __BEOS__) \ + && ! defined __GLIBC__ +# include +# endif + + #endif /* _@GUARD_PREFIX@_SYS_SELECT_H */ -#endif /* OSF/1 */ +#endif diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index c3c38fd653e..8f676cb390e 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -790,8 +790,7 @@ _GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); _GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev), _GL_ARG_NONNULL ((1))); # endif -/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ -_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); +_GL_CXXALIAS_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev)); # endif _GL_CXXALIASWARN (mknod); #elif defined GNULIB_POSIXCHECK diff --git a/lib/time.in.h b/lib/time.in.h index 3ff16e3b3e4..d28702d2f61 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -523,11 +523,18 @@ _GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); # endif /* tzfree (tz) - Frees a time zone object. + Free a time zone object, preserving errno. The argument must have been returned by tzalloc(). */ # if !@HAVE_TZALLOC@ _GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz), ); _GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tzfree +# define tzfree rpl_tzfree +# endif +_GL_FUNCDECL_RPL (tzfree, void, (timezone_t __tz), ); +_GL_CXXALIAS_RPL (tzfree, void, (timezone_t __tz)); # endif /* localtime_rz (tz, &t, &result) diff --git a/lib/time_rz.c b/lib/time_rz.c index 125f4e272d2..8a8eb44c357 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -27,7 +27,10 @@ /* Specification. */ #include -#if NEED_TIMEZONE_NULL_SUPPORT /* Android API level >= 35 */ +#include + +#if HAVE_TZALLOC +# if NEED_TIMEZONE_NULL_SUPPORT /* Android API level >= 35 */ struct tm * localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) @@ -48,10 +51,19 @@ mktime_z (timezone_t tz, struct tm *tm) else return mktime_z (tz, tm); } +# endif + +void +tzfree (timezone_t tz) +# undef tzfree +{ + int err = errno; + tzfree (tz); + errno = err; +} #else -# include # include # include # include @@ -116,7 +128,7 @@ save_abbr (timezone_t tz, struct tm *tm) { zone_copy = tz->abbrs; - while (strcmp (zone_copy, zone) != 0) + while (!streq (zone_copy, zone)) { if (! (*zone_copy || (zone_copy == tz->abbrs && tz->tz_is_set))) { @@ -202,7 +214,7 @@ set_tz (timezone_t tz) { char *env_tz = getenv_TZ (); if (env_tz - ? tz->tz_is_set && strcmp (tz->abbrs, env_tz) == 0 + ? tz->tz_is_set && streq (tz->abbrs, env_tz) : !tz->tz_is_set) return local_tz; else @@ -212,9 +224,7 @@ set_tz (timezone_t tz) return old_tz; if (! change_env (tz)) { - int saved_errno = errno; tzfree (old_tz); - errno = saved_errno; return NULL; } return old_tz; diff --git a/lib/u64.h b/lib/u64.h index 6ea08969c29..b47d65e5033 100644 --- a/lib/u64.h +++ b/lib/u64.h @@ -1,4 +1,4 @@ -/* uint64_t-like operations that work even on hosts lacking uint64_t +/* Unsigned integers with arithmetic modulo 2**64 Copyright (C) 2006, 2009-2025 Free Software Foundation, Inc. @@ -17,11 +17,15 @@ /* Written by Paul Eggert. */ +#ifndef U64_H +#define U64_H 1 + /* This file uses _GL_INLINE_HEADER_BEGIN, _GL_INLINE. */ #if !_GL_CONFIG_H_INCLUDED #error "Please include config.h first." #endif +#include #include #include @@ -37,7 +41,7 @@ extern "C" { #endif -#ifdef UINT64_MAX +#if defined UINT64_MAX && INT_MAX < UINT64_MAX /* Native implementations are trivial. See below for comments on what these operations do. */ @@ -45,7 +49,9 @@ typedef uint64_t u64; # define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo))) # define u64init(hi, lo) u64hilo (hi, lo) # define u64lo(x) ((u64) (x)) +# define u64getlo(x) ((uint32_t) ((x) & UINT32_MAX)) # define u64size(x) u64lo (x) +# define u64not(x) (~(x)) # define u64lt(x, y) ((x) < (y)) # define u64and(x, y) ((x) & (y)) # define u64or(x, y) ((x) | (y)) @@ -94,6 +100,13 @@ u64lo (unsigned int lo) return r; } +/* Return the low 32 bits of the u64 value X. */ +_GL_U64_INLINE unsigned int +u64getlo (u64 x) +{ + return x.lo & _GL_U64_MASK32; +} + /* Return a u64 value representing SIZE, where 0 <= SIZE < 2**64. */ _GL_U64_INLINE u64 u64size (size_t size) @@ -104,6 +117,16 @@ u64size (size_t size) return r; } +/* Return the bitwise NOT of X. */ +_GL_U64_INLINE u64 +u64not (u64 x) +{ + u64 r; + r.hi = ~x.hi; + r.lo = ~x.lo; + return r; +} + /* Return X < Y. */ _GL_U64_INLINE bool u64lt (u64 x, u64 y) @@ -209,3 +232,5 @@ u64rol (u64 x, int n) #endif _GL_INLINE_HEADER_END + +#endif diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 9f057d30cdf..5b5838240aa 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -104,15 +104,12 @@ # include #endif -/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41 - do not define O_CLOEXEC in . */ /* Cygwin 1.7.1 and Android 4.3 declare unlinkat in , not in . */ /* But avoid namespace pollution on glibc systems. */ -#if ! defined O_CLOEXEC \ - || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ - && (defined __CYGWIN__ || defined __ANDROID__) \ - && ! defined __GLIBC__) +#if ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ + && (defined __CYGWIN__ || defined __ANDROID__) \ + && ! defined __GLIBC__) # include #endif @@ -120,10 +117,8 @@ /* mingw, MSVC, BeOS, Haiku declare environ in , not in . */ /* Solaris declares getcwd not only in but also in . */ -/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system is - included here. */ /* But avoid namespace pollution on glibc systems. */ -#if !defined __GLIBC__ && !defined __osf__ +#if !defined __GLIBC__ # define __need_system_stdlib_h # include # undef __need_system_stdlib_h @@ -134,10 +129,10 @@ # include #endif -/* AIX and OSF/1 5.1 declare getdomainname in , not in . +/* AIX declares getdomainname in , not in . NonStop Kernel declares gethostname in , not in . */ /* But avoid namespace pollution on glibc systems. */ -#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ +#if ((@GNULIB_GETDOMAINNAME@ && defined _AIX) \ || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ && !defined __GLIBC__ # include @@ -1336,8 +1331,7 @@ _GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); _GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len), _GL_ARG_NONNULL ((1))); # endif -/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second - parameter is +/* Need to cast, because on Solaris 10 systems, the second parameter is int len. */ _GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); # endif @@ -2151,9 +2145,9 @@ _GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len), _GL_ARG_NONNULL ((1)) _GL_ATTRIBUTE_NODISCARD); # endif -/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 - and FreeBSD 6.4 the second parameter is int. On Solaris 11 - 2011-10, the first parameter is not const. */ +/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, and FreeBSD 6.4 + the second parameter is int. On Solaris 11 2011-10, the first parameter is + not const. */ _GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); # endif @@ -2493,6 +2487,18 @@ _GL_CXXALIASWARN (write); _GL_INLINE_HEADER_END + +/* Includes that provide only macros that don't need to be overridden. + (Includes that are needed for type definitions and function declarations + have their place above, before the function overrides.) */ + +/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41 + do not define O_CLOEXEC in . */ +#if ! defined O_CLOEXEC +# include +#endif + + #endif /* _@GUARD_PREFIX@_UNISTD_H */ #endif /* _GL_INCLUDING_UNISTD_H */ #endif /* _@GUARD_PREFIX@_UNISTD_H */ diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h index 69ea6641a3f..8a7719c4876 100644 --- a/lib/unlocked-io.h +++ b/lib/unlocked-io.h @@ -73,6 +73,13 @@ # define fgets_unlocked(x,y,z) fgets (x,y,z) # endif +# if HAVE_DECL_FILENO_UNLOCKED || defined fileno_unlocked +# undef fileno +# define fileno(x) fileno_unlocked (x) +# else +# define fileno_unlocked(x) fileno (x) +# endif + # if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked # undef fputc # define fputc(x,y) fputc_unlocked (x,y) diff --git a/lib/utimens.c b/lib/utimens.c index 28e4295f025..0387e9f10e9 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -21,6 +21,7 @@ #include +/* Specification. */ #define _GL_UTIMENS_INLINE _GL_EXTERN_INLINE #include "utimens.h" @@ -32,6 +33,7 @@ #include #include +#include "issymlink.h" #include "stat-time.h" #include "timespec.h" @@ -670,9 +672,17 @@ lutimens (char const *file, struct timespec const timespec[2]) # endif /* HAVE_LUTIMES && !HAVE_UTIMENSAT */ /* Out of luck for symlinks, but we still handle regular files. */ - if (!(adjustment_needed || REPLACE_FUNC_STAT_FILE) && lstat (file, &st)) - return -1; - if (!S_ISLNK (st.st_mode)) + bool not_symlink; + if (adjustment_needed || REPLACE_FUNC_STAT_FILE) + not_symlink = !S_ISLNK (st.st_mode); + else + { + int ret = issymlink (file); + if (ret < 0) + return -1; + not_symlink = !ret; + } + if (not_symlink) return fdutimens (-1, file, ts); errno = ENOSYS; return -1; diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index 28f3a0ae7f2..fb82f8b912b 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el @@ -38,6 +38,11 @@ :prefix "holidays-" :group 'local) +(defun holidays--set-calendar-holidays (sym val) + (custom-set-default sym val) + (when (get 'calendar-holidays 'standard-value) + (custom-reevaluate-setting 'calendar-holidays))) + ;; The various holiday variables are autoloaded because people ;; are used to using them to set calendar-holidays without having to ;; explicitly load this file. @@ -62,7 +67,11 @@ (holiday-fixed 11 11 "Veteran's Day") (holiday-float 11 4 4 "Thanksgiving")) "General holidays. Default value is for the United States. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-general-holidays 'risky-local-variable t) @@ -78,11 +87,14 @@ See the documentation for `calendar-holidays' for details." (holiday-chinese 7 7 "Double Seventh Festival") (holiday-chinese 8 15 "Mid-Autumn Festival") (holiday-chinese 9 9 "Double Ninth Festival") - (holiday-chinese-winter-solstice) - ))) + (holiday-chinese-winter-solstice)))) "Oriental holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." :version "23.1" ; added more holidays + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-oriental-holidays 'risky-local-variable t) @@ -90,7 +102,11 @@ See the documentation for `calendar-holidays' for details." ;;;###autoload (defcustom holiday-local-holidays nil "Local holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-local-holidays 'risky-local-variable t) @@ -98,7 +114,11 @@ See the documentation for `calendar-holidays' for details." ;;;###autoload (defcustom holiday-other-holidays nil "User defined holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-other-holidays 'risky-local-variable t) @@ -113,7 +133,11 @@ See the documentation for `calendar-holidays' for details." (holiday-hebrew-tisha-b-av) (holiday-hebrew-misc)))) "Jewish holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp :version "23.1") ; removed dependency on hebrew-holidays-N @@ -132,7 +156,11 @@ See the documentation for `calendar-holidays' for details." (holiday-fixed 8 15 "Assumption") (holiday-advent 0 "Advent")))) "Christian holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-christian-holidays 'risky-local-variable t) @@ -151,7 +179,11 @@ See the documentation for `calendar-holidays' for details." (holiday-islamic 10 1 "Id-al-Fitr") (holiday-islamic 12 10 "Id-al-Adha")))) "Islamic holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-islamic-holidays 'risky-local-variable t) @@ -171,6 +203,7 @@ See the documentation for `calendar-holidays' for details." (holiday-fixed 11 28 "Ascension of `Abdu’l-Bahá")))) "Bahá’í holidays. See the documentation for `calendar-holidays' for details." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-bahai-holidays 'risky-local-variable t) @@ -189,14 +222,17 @@ See the documentation for `calendar-holidays' for details." (/ calendar-daylight-savings-ends-time (float 60)) calendar-daylight-time-zone-name)))) "Sun-related holidays. -See the documentation for `calendar-holidays' for details." +See the documentation for `calendar-holidays' for details. + +Do not set this variable with `setq'; instead, use `setopt' +or `customize-option'." + :set #'holidays--set-calendar-holidays :type 'sexp) ;;;###autoload (put 'holiday-solar-holidays 'risky-local-variable t) ;; This one should not be autoloaded, else .emacs changes of ;; holiday-general-holidays etc have no effect. -;; FIXME should have some :set-after. (defcustom calendar-holidays (append holiday-general-holidays holiday-local-holidays holiday-other-holidays holiday-christian-holidays @@ -218,10 +254,7 @@ by the function `holiday-list' when it is called interactively. They also initialize the default value of `calendar-holidays', which is the default list of holidays used by the function -`holiday-list' in the non-interactive case. Note that these -variables have no effect on `calendar-holidays' after it has been -set (e.g. after the calendar is loaded). In that case, customize -`calendar-holidays' directly. +`holiday-list' in the non-interactive case. The intention is that (in the US) `holiday-local-holidays' be set in site-init.el and `holiday-other-holidays' be set by the user. diff --git a/lisp/comint.el b/lisp/comint.el index b7c609ed469..d94bc97ede3 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1123,6 +1123,7 @@ See also `comint-read-input-ring'." (let* ((history-buf (get-buffer-create " *Temp Input History*")) (ring comint-input-ring) (file comint-input-ring-file-name) + (separator comint-input-ring-separator) (index (ring-length ring))) ;; Write it all out into a buffer first. Much faster, but messier, ;; than writing it one line at a time. @@ -1130,7 +1131,7 @@ See also `comint-read-input-ring'." (erase-buffer) (while (> index 0) (setq index (1- index)) - (insert (ring-ref ring index) comint-input-ring-separator)) + (insert (ring-ref ring index) separator)) (write-region (buffer-string) nil file nil 'no-message) (kill-buffer nil)))))) @@ -2313,14 +2314,12 @@ Make backspaces delete the previous character." ;; `yank' removes the field text property from the text it inserts ;; due to `yank-excluded-properties', so arrange for this text ;; property to be reapplied in the `after-change-functions'. - (let (fun) - (setq - fun - (lambda (beg1 end1 _len1) - (remove-hook 'after-change-functions fun t) - (when (and (= beg beg1) - (= end end1)) - (comint--mark-as-output beg1 end1)))) + (letrec ((fun + (lambda (beg1 end1 _len1) + (remove-hook 'after-change-functions fun t) + (when (and (= beg beg1) + (= end end1)) + (comint--mark-as-output beg1 end1))))) (add-hook 'after-change-functions fun nil t))) (defun comint--unmark-string-as-output (string) diff --git a/lisp/cus-start.el b/lisp/cus-start.el index e49d1552c08..c4ab23bec61 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -347,6 +347,12 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of ;; :initialize custom-initialize-default :set custom-set-minor-mode) (frame-resize-pixelwise frames boolean "24.4") + (alter-fullscreen-frames frames + (choice + (const :tag "Forward request to window manager" nil) + (const :tag "Reset fullscreen status first" t) + (const :tag "Inhibit altering fullscreen frames" inhibit)) + "31.1") (frame-inhibit-implied-resize frames (choice (const :tag "Never" nil) diff --git a/lisp/custom.el b/lisp/custom.el index ceb598b6787..27fb877e652 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -140,6 +140,7 @@ For the standard setting, use `set-default-toplevel-value'." Once this list has been processed, this var is set to a non-list value.") (defun custom-initialize-delay (symbol value) + ;; FIXME: Rename to `custom-initialize-after-dump'? "Delay initialization of SYMBOL to the next Emacs start. This is used in files that are preloaded (or for autoloaded variables), so that the initialization is done in the run-time @@ -159,6 +160,27 @@ the :set function." ;; delay it, so initialize it "normally" (bug#47072). (custom-initialize-reset symbol value))) +(defun custom-initialize-after-file-load (symbol value) + "Delay initialization to after the current file is loaded. +This is handy when the initialization needs functions defined after the +variable, such as for global minor modes." + ;; Defvar it so as to mark it special, etc (bug#25770). + (internal--define-uninitialized-variable symbol) + + ;; Until the var is actually initialized, it is kept unbound. + ;; This seemed to be at least as good as setting it to an arbitrary + ;; value like nil (evaluating `value' is not an option because it + ;; may have undesirable side-effects). + (if (not load-file-name) + ;; There's no "after file" to speak of. + (custom-initialize-set symbol value) + (let ((thisfile load-file-name)) + (letrec ((f (lambda (file) + (when (equal file thisfile) + (remove-hook 'after-load-functions f) + (custom-initialize-set symbol value))))) + (add-hook 'after-load-functions f))))) + (defun custom-declare-variable (symbol default doc &rest args) "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments. DEFAULT should be an expression to evaluate to compute the default value, @@ -749,10 +771,16 @@ Normally, this sets the default value of VARIABLE to nil if VALUE is nil and to t otherwise, but if `custom-local-buffer' is non-nil, this sets the local binding in that buffer instead." - (if custom-local-buffer - (with-current-buffer custom-local-buffer - (funcall variable (if value 1 0))) - (funcall variable (if value 1 0)))) + (if (and (null value) + (autoloadp (symbol-function variable)) + (not (and (boundp variable) (symbol-value variable)))) + ;; We're disabling a minor mode that's not even loaded yet. + ;; Let's avoid autoloading it needlessly. + (custom-set-default variable value) + (if custom-local-buffer + (with-current-buffer custom-local-buffer + (funcall variable (if value 1 0))) + (funcall variable (if value 1 0))))) (defun custom-quote (sexp) "Quote SEXP if it is not self quoting." diff --git a/lisp/desktop.el b/lisp/desktop.el index b82a9dc9626..21a742c9aad 100644 --- a/lisp/desktop.el +++ b/lisp/desktop.el @@ -775,7 +775,7 @@ if different)." ;; Don't delete daemon's initial frame, or ;; we'll never be able to close the last ;; client's frame (Bug#26912). - (if (daemonp) (not (frame-parameter frame 'client))) + (and (daemonp) (eq frame terminal-frame)) (frame-parameter frame 'desktop-dont-clear)) (delete-frame frame)) (error @@ -1255,7 +1255,7 @@ This function also sets `desktop-dirname' to nil." (and desktop-restore-frames desktop-saved-frameset ;; Don't restore frames when the selected frame is the daemon's ;; initial frame. - (not (and (daemonp) (not (frame-parameter nil 'client)))) + (not (and (daemonp) (eq (selected-frame) terminal-frame))) t)) (defun desktop-restore-frameset () diff --git a/lisp/dired.el b/lisp/dired.el index 258e0550a7d..e400bccebd1 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -550,6 +550,16 @@ displayed instead." :group 'dired :version "30.1") +(defcustom dired-auto-toggle-b-switch nil + "Whether to automatically add or remove the `b' switch. +If non-nil, the function `dired--toggle-b-switch' (which see) is added +to `post-command-hook' in Dired mode." + :type 'boolean + :group 'dired + :initialize #'custom-initialize-default + :set #'dired--set-auto-toggle-b-switch + :version "31.1") + ;;; Internal variables @@ -1437,6 +1447,16 @@ The return value is the target column for the file names." (dired-initial-position dirname)) (when (consp dired-directory) (dired--align-all-files)) + ;; Pop up a warning if the Dired listing displays a literal newline. + ;; We do this here in order to get the warning not only when + ;; interactively invoking `dired' on a directory, but also e.g. when + ;; passing the directory name as a command line argument when + ;; starting Emacs from the shell. + (unless (or dired-auto-toggle-b-switch + (dired-switches-escape-p dired-listing-switches) + (dired-switches-escape-p dired-actual-switches)) + (when (dired--filename-with-newline-p) + (dired--display-filename-with-newline-warning buffer))) (set-buffer old-buf) buffer)) @@ -1699,7 +1719,7 @@ BEG..END is the line where the file info is located." (defun dired-switches-escape-p (switches) "Return non-nil if the string SWITCHES contains -b or --escape." ;; Do not match things like "--block-size" that happen to contain "b". - (dired-check-switches switches "b" "escape")) + (dired-check-switches switches "b" "\\(quoting-style=\\)?escape")) (defun dired-switches-recursive-p (switches) "Return non-nil if the string SWITCHES contains -R or --recursive." @@ -2855,6 +2875,8 @@ Keybindings: (add-hook 'file-name-at-point-functions #'dired-file-name-at-point nil t) (add-hook 'isearch-mode-hook #'dired-isearch-filenames-setup nil t) (add-hook 'context-menu-functions 'dired-context-menu 5 t) + (when dired-auto-toggle-b-switch + (add-hook 'post-command-hook #'dired--toggle-b-switch nil t)) (run-mode-hooks 'dired-mode-hook)) @@ -3439,7 +3461,14 @@ If EOL, it should be an position to use instead of ;; On failure, signals an error (with non-nil NO-ERROR just returns nil). ;; This is the UNIX version. (if (get-text-property (point) 'dired-filename) - (goto-char (next-single-property-change (point) 'dired-filename)) + (goto-char (or (next-single-property-change (point) 'dired-filename) + ;; No property change can happen on or before the + ;; last file name in the Dired listing when there + ;; is at least one prior file name containing a + ;; newline. To prevent an error in this case we + ;; take the position just before the final newline + ;; as the end of the last file name (bug#79528). + (1- (point-max)))) (let ((opoint (point)) (used-F (dired-check-switches dired-actual-switches "F" "classify")) (eol (line-end-position)) @@ -3973,6 +4002,98 @@ Considers buffers closer to the car of `buffer-list' to be more recent." (memq buffer1 (buffer-list)) (not (memq buffer1 (memq buffer2 (buffer-list)))))) +(defun dired--filename-with-newline-p () + "Check if a file name in this directory has a newline. +Return non-nil if at least one file name in this directory contains +either a literal newline or the string \"\\n\")." + (save-excursion + (goto-char (point-min)) + (catch 'found + (while (not (eobp)) + (when (dired-move-to-filename) + (let ((fn (buffer-substring-no-properties + (point) (dired-move-to-end-of-filename)))) + (when (or (memq 10 (seq-into fn 'list)) + (string-search "\\n" fn)) + (throw 'found t)))) + (forward-line))))) + +(defun dired--remove-b-switch () + "Remove all variants of the `b' switch from `dired-actual-switches'. +This removes not only all occurrences of the short form `-b' but also +the long forms `--escape' and `--quoting-style=escape'." + (let (switches) + (dolist (s (string-split dired-actual-switches)) + (when (string-match "\\`-[^-]" s) + (setq s (remove ?b s))) + (unless (or (string= s "-") + (string-match "escape" s)) + (cl-pushnew s switches :test 'equal))) + (mapconcat #'identity (nreverse switches) " "))) + +(defun dired--toggle-b-switch () + "Add or remove `b' switch and redisplay Dired buffer. +When the current Dired buffer has a file name containing a newline, add +the `b' switch to the actual switches if it isn't already among them; +otherwise remove the `b' switch unless it is in `dired-listing-switches'. +Then redisplay the Dired buffer. This function is called from +`post-command-hook' in Dired mode buffers." + (when (eq major-mode 'dired-mode) + (if (and (dired--filename-with-newline-p) dired-auto-toggle-b-switch) + (unless (dired-switches-escape-p dired-actual-switches) + (setq dired-actual-switches (concat dired-actual-switches " -b")) + (dired-revert)) + (unless (dired-switches-escape-p dired-listing-switches) + (when (dired-switches-escape-p dired-actual-switches) + (setq dired-actual-switches (dired--remove-b-switch)) + (dired-revert)))))) + +(defun dired--set-auto-toggle-b-switch (symbol value) + "The :set function for user option `dired-auto-toggle-b-switch'." + (custom-set-default symbol value) + (if value + (add-hook 'post-command-hook #'dired--toggle-b-switch nil t) + (remove-hook 'post-command-hook #'dired--toggle-b-switch t)) + (dolist (b (buffer-list)) + (with-current-buffer b + (dired--toggle-b-switch)))) + +(defun dired--display-filename-with-newline-warning (dir) + "Display a warning if buffer DIR has a file name with a newline." + (let ((msg "Literal newline in file name. +This Dired buffer displays a file name containing a literal newline character. +Executing Dired operations on files displayed this way may fail and signal an +error. To avoid this you can temporarily change the display for all Dired +buffers, so that newlines in file names appear as \"\\n\", by typing `M-:' and +entering `(setopt dired-auto-toggle-b-switch t)' in the minibuffer. To change +the display only for this Dired buffer click or press RETURN `%s'. +See `%s' for other alternatives and more information.")) + (display-warning + 'dired + (format-message + msg + (buttonize "here" + (lambda (_) + (pop-to-buffer dir) + (when (dired--filename-with-newline-p) + (unless (dired-switches-escape-p dired-actual-switches) + (setq dired-actual-switches + (concat dired-actual-switches " -b")) + (dired-revert)))) + nil "mouse-2: Change newline display") + (buttonize "(emacs) Dired Enter" + (lambda (_) + (info "(emacs) Dired Enter") + (declare-function Info-goto-node "info") + (with-current-buffer "*info*" + (Info-goto-node "File names with newline"))) + nil "mouse-2: Jump to Info node"))) + ;; Display *Warnings* buffer with point at start of message instead + ;; of at the end. + (with-current-buffer "*Warnings*" + (set-window-point (get-buffer-window) + (search-backward "Warning (dired)"))))) + ;;; Deleting files diff --git a/lisp/display-fill-column-indicator.el b/lisp/display-fill-column-indicator.el index dbd067f5f3d..4598b659341 100644 --- a/lisp/display-fill-column-indicator.el +++ b/lisp/display-fill-column-indicator.el @@ -102,7 +102,7 @@ See Info node `Displaying Boundaries' for details." (defun display-fill-column-indicator--turn-on () "Turn on `display-fill-column-indicator-mode'." (unless (or (minibufferp) - (and (daemonp) (null (frame-parameter nil 'client)))) + (and (daemonp) (eq (selected-frame) terminal-frame))) (display-fill-column-indicator-mode))) ;;;###autoload diff --git a/lisp/electric.el b/lisp/electric.el index a1131499be6..d235a384620 100644 --- a/lisp/electric.el +++ b/lisp/electric.el @@ -383,7 +383,7 @@ indent the line according to context and rules of the major mode. This is a global minor mode. To toggle the mode in a single buffer, use `electric-indent-local-mode'." :global t :group 'electricity - :initialize 'custom-initialize-delay + :initialize #'custom-initialize-after-file-load :init-value t (if (not electric-indent-mode) (unless (catch 'found @@ -767,7 +767,7 @@ ones listed here. Also see `electric-quote-replace-consecutive'. This is a global minor mode. To toggle the mode in a single buffer, use `electric-quote-local-mode'." :global t :group 'electricity - :initialize 'custom-initialize-delay + ;; :initialize #'custom-initialize-after-file-load :init-value nil (if (not electric-quote-mode) (unless (catch 'found diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 0560640952f..d936d7e341c 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1005,19 +1005,19 @@ There can be multiple entries for the same NAME if it has several aliases.") (let* ((op (car form)) (bindings nil) (rev-args nil)) - (if (memq nil (mapcar #'macroexp-copyable-p (cddr form))) - ;; At least one arg beyond the first is non-constant non-variable: - ;; create temporaries for all args to guard against side-effects. - ;; The optimizer will eliminate trivial bindings later. - (let ((i 1)) - (dolist (arg (cdr form)) - (let ((var (make-symbol (format "arg%d" i)))) - (push var rev-args) - (push (list var arg) bindings) - (setq i (1+ i))))) - ;; All args beyond the first are copyable: no temporary variables - ;; required. - (setq rev-args (reverse (cdr form)))) + (if (all #'macroexp-copyable-p (cddr form)) + ;; All args beyond the first are copyable: no temporary variables + ;; required. + (setq rev-args (reverse (cdr form))) + ;; At least one arg beyond the first is non-constant non-variable: + ;; create temporaries for all args to guard against side-effects. + ;; The optimizer will eliminate trivial bindings later. + (let ((i 1)) + (dolist (arg (cdr form)) + (let ((var (make-symbol (format "arg%d" i)))) + (push var rev-args) + (push (list var arg) bindings) + (setq i (1+ i)))))) (let ((prev (car rev-args)) (exprs nil)) (dolist (arg (cdr rev-args)) @@ -1030,14 +1030,11 @@ There can be multiple entries for the same NAME if it has several aliases.") (t form)))) (defun byte-optimize-constant-args (form) - (let ((rest (cdr form))) - (while (and rest (macroexp-const-p (car rest))) - (setq rest (cdr rest))) - (if rest - form + (if (all #'macroexp-const-p (cdr form)) (condition-case () (list 'quote (eval form t)) - (error form))))) + (error form)) + form)) (defun byte-optimize-identity (form) (if (and (cdr form) (null (cdr (cdr form)))) @@ -1099,11 +1096,9 @@ See Info node `(elisp) Integer Basics'." (and (macroexp-const-p arg2) (let ((listval (byteopt--eval-const arg2))) (and (listp listval) - (not (memq nil (mapcar - (lambda (o) - (or (symbolp o) - (byte-optimize--fixnump o))) - listval)))))))) + (all (lambda (o) + (or (symbolp o) (byte-optimize--fixnump o))) + listval)))))) (cons 'memq (cdr form))) (t form))) @@ -1429,12 +1424,6 @@ See Info node `(elisp) Integer Basics'." (put 'not 'byte-optimizer #'byte-optimize-not) (put 'null 'byte-optimizer #'byte-optimize-not) -;; byte-compile-negation-optimizer lives in bytecomp.el -(put '/= 'byte-optimizer #'byte-compile-negation-optimizer) -(put 'atom 'byte-optimizer #'byte-compile-negation-optimizer) -(put 'nlistp 'byte-optimizer #'byte-compile-negation-optimizer) - - (defun byte-optimize-funcall (form) ;; (funcall #'(lambda ...) ...) -> (let ...) ;; (funcall #'SYM ...) -> (SYM ...) @@ -1622,7 +1611,7 @@ See Info node `(elisp) Integer Basics'." ;; (list CONSTANTS...) -> '(CONSTANTS...) ((and (consp arg) (eq (car arg) 'list) - (not (memq nil (mapcar #'macroexp-const-p (cdr arg))))) + (all #'macroexp-const-p (cdr arg))) (loop (cons (list 'quote (eval arg)) (cdr args)) newargs)) (t (loop (cdr args) (cons arg newargs))))) @@ -2158,108 +2147,76 @@ See Info node `(elisp) Integer Basics'." ;;; peephole optimizer -(defconst byte-tagref-ops (cons 'TAG byte-goto-ops)) +(eval-when-compile + (defconst byte-opt--side-effect-and-error-free-ops + '( byte-stack-ref byte-constant byte-dup byte-symbolp byte-consp + byte-stringp byte-listp byte-integerp byte-numberp byte-eq byte-not + byte-car-safe byte-cdr-safe + byte-cons byte-list1 byte-list2 byte-list3 byte-list4 byte-listN + byte-point byte-point-max byte-point-min + byte-following-char byte-preceding-char + byte-current-column byte-eolp byte-eobp byte-bolp byte-bobp + byte-current-buffer)) -(defconst byte-conditional-ops - '(byte-goto-if-nil byte-goto-if-not-nil byte-goto-if-nil-else-pop - byte-goto-if-not-nil-else-pop)) - -(defconst byte-after-unbind-ops - '(byte-constant byte-dup byte-stack-ref byte-stack-set byte-discard - byte-discardN byte-discardN-preserve-tos - byte-symbolp byte-consp byte-stringp byte-listp byte-numberp byte-integerp - byte-not - byte-cons byte-list1 byte-list2 byte-list3 byte-list4 byte-listN - byte-interactive-p) - ;; How about other side-effect-free-ops? Is it safe to move an - ;; error invocation (such as from nth) out of an unwind-protect? - ;; No, it is not, because the unwind-protect forms can alter - ;; the inside of the object to which nth would apply. - ;; For the same reason, byte-equal was deleted from this list. - ;; - ;; In particular, `byte-eq' isn't here despite `eq' being nominally - ;; pure because it is currently affected by `symbols-with-pos-enabled' - ;; and so cannot be sunk past an unwind op that might end a binding of - ;; that variable. Yes, this is unsatisfactory. - "Byte-codes that can be moved past an unbind.") - -(defconst byte-compile-side-effect-and-error-free-ops - '(byte-constant byte-dup byte-symbolp byte-consp byte-stringp byte-listp - byte-integerp byte-numberp byte-eq byte-not byte-car-safe - byte-cdr-safe byte-cons byte-list1 byte-list2 byte-list3 byte-list4 - byte-listN byte-point byte-point-max - byte-point-min byte-following-char byte-preceding-char - byte-current-column byte-eolp byte-eobp byte-bolp byte-bobp - byte-current-buffer byte-stack-ref)) - -(defconst byte-compile-side-effect-free-ops - (append - '(byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref - byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1 - byte-eqlsign byte-equal byte-gtr byte-lss byte-leq byte-geq byte-diff - byte-negate byte-plus byte-max byte-min byte-mult byte-char-after - byte-char-syntax byte-buffer-substring byte-string= byte-string< - byte-nthcdr byte-elt byte-member byte-assq byte-quo byte-rem - byte-substring) - byte-compile-side-effect-and-error-free-ops)) - -;; This crock is because of the way DEFVAR_BOOL variables work. -;; Consider the code -;; -;; (defun foo (flag) -;; (let ((old-pop-ups pop-up-windows) -;; (pop-up-windows flag)) -;; (cond ((not (eq pop-up-windows old-pop-ups)) -;; (setq old-pop-ups pop-up-windows) -;; ...)))) -;; -;; Uncompiled, old-pop-ups will always be set to nil or t, even if FLAG is -;; something else. But if we optimize -;; -;; varref flag -;; varbind pop-up-windows -;; varref pop-up-windows -;; not -;; to -;; varref flag -;; dup -;; varbind pop-up-windows -;; not -;; -;; we break the program, because it will appear that pop-up-windows and -;; old-pop-ups are not EQ when really they are. So we have to know what -;; the BOOL variables are, and not perform this optimization on them. - -;; The variable `byte-boolean-vars' is now primitive and updated -;; automatically by DEFVAR_BOOL. + (defconst byte-opt--side-effect-free-ops + (append + '( byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref + byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1 + byte-eqlsign byte-equal byte-gtr byte-lss byte-leq byte-geq byte-diff + byte-negate byte-plus byte-max byte-min byte-mult byte-char-after + byte-char-syntax byte-buffer-substring byte-string= byte-string< + byte-nthcdr byte-elt byte-member byte-assq byte-quo byte-rem + byte-substring) + byte-opt--side-effect-and-error-free-ops)) + ) (defun byte-optimize-lapcode (lap &optional _for-effect) "Simple peephole optimizer. LAP is both modified and returned. If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." - (let ((side-effect-free (if byte-compile-delete-errors - byte-compile-side-effect-free-ops - byte-compile-side-effect-and-error-free-ops)) - ;; Ops taking and produce a single value on the stack. - (unary-ops '( byte-not byte-length byte-list1 byte-nreverse - byte-car byte-cdr byte-car-safe byte-cdr-safe - byte-symbolp byte-consp byte-stringp - byte-listp byte-integerp byte-numberp - byte-add1 byte-sub1 byte-negate - ;; There are more of these but the list is - ;; getting long and the gain is typically small. - )) - ;; Ops producing a single result without looking at the stack. - (producer-ops '( byte-constant byte-varref - byte-point byte-point-max byte-point-min - byte-following-char byte-preceding-char - byte-current-column - byte-eolp byte-eobp byte-bolp byte-bobp - byte-current-buffer byte-widen)) - (add-depth 0) - (keep-going 'first-time) - ;; Create a cons cell as head of the list so that removing the first - ;; element does not need special-casing: `setcdr' always works. - (lap-head (cons nil lap))) + (let* ((side-effect-free + (if byte-compile-delete-errors + (eval-when-compile byte-opt--side-effect-free-ops) + (eval-when-compile byte-opt--side-effect-and-error-free-ops))) + + (conditional-ops + '( byte-goto-if-nil byte-goto-if-not-nil byte-goto-if-nil-else-pop + byte-goto-if-not-nil-else-pop)) + (conditional-or-discard-ops (cons 'byte-discard conditional-ops)) + + ;; Ops that can be sunk past an unbind. + ;; This means they have to commute with anything else, which rules + ;; out ones like `byte-car-safe' and `byte-equal'. + ;; In particular, `byte-eq' and `byte-symbolp' aren't here despite + ;; being nominally pure because they are currently affected by + ;; `symbols-with-pos-enabled'. Yes, this is unsatisfactory. + (after-unbind-ops + '( byte-constant byte-dup byte-stack-ref byte-stack-set byte-discard + byte-discardN byte-discardN-preserve-tos + byte-consp byte-stringp byte-listp byte-numberp + byte-integerp byte-not + byte-cons byte-list1 byte-list2 byte-list3 byte-list4 byte-listN)) + + ;; Ops taking and produce a single value on the stack. + (unary-ops '( byte-not byte-length byte-list1 byte-nreverse + byte-car byte-cdr byte-car-safe byte-cdr-safe + byte-symbolp byte-consp byte-stringp + byte-listp byte-integerp byte-numberp + byte-add1 byte-sub1 byte-negate + ;; There are more of these but the list is + ;; getting long and the gain is typically small. + )) + ;; Ops producing a single result without looking at the stack. + (producer-ops '( byte-constant byte-varref + byte-point byte-point-max byte-point-min + byte-following-char byte-preceding-char + byte-current-column + byte-eolp byte-eobp byte-bolp byte-bobp + byte-current-buffer byte-widen)) + (add-depth 0) + (keep-going 'first-time) + ;; Create a cons cell as head of the list so that removing the first + ;; element does not need special-casing: `setcdr' always works. + (lap-head (cons nil lap))) (while keep-going (byte-compile-log-lap " ---- %s pass" (if (eq keep-going 'first-time) "first" "next")) @@ -2337,6 +2294,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." ((and (eq 'byte-varref (car lap2)) (eq (cdr lap1) (cdr lap2)) (memq (car lap1) '(byte-varset byte-varbind)) + ;; Can't optimise away varref for DEFVAR_BOOL vars + ;; because what we put in might not be what we get out. (let ((tmp (memq (car (cdr lap2)) byte-boolean-vars))) (and (not (and tmp (not (eq (car lap0) 'byte-constant)))) @@ -2435,7 +2394,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." ;; const goto-if-* --> whatever ;; ((and (eq 'byte-constant (car lap0)) - (memq (car lap1) byte-conditional-ops) + (memq (car lap1) conditional-ops) ;; Must be an actual constant, not a closure variable. (consp (cdr lap0))) (cond ((if (memq (car lap1) '(byte-goto-if-nil @@ -2564,7 +2523,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." ;; (this may enable other optimizations.) ;; ((and (eq 'byte-unbind (car lap1)) - (memq (car lap0) byte-after-unbind-ops)) + (memq (car lap0) after-unbind-ops)) (byte-compile-log-lap " %s %s\t-->\t%s %s" lap0 lap1 lap1 lap0) (setcar rest lap1) (setcar (cdr rest) lap0) @@ -2679,9 +2638,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." byte-goto-if-not-nil-else-pop)) (let ((tmp (cdr (memq (cdr lap0) (cdr lap-head))))) (and - (memq (caar tmp) - (eval-when-compile - (cons 'byte-discard byte-conditional-ops))) + (memq (caar tmp) conditional-or-discard-ops) (not (eq lap0 (car tmp))) (let ((tmp2 (car tmp)) (tmp3 (assq (car lap0) @@ -2714,9 +2671,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." (eq (car lap1) 'byte-goto) (let ((tmp (cdr (memq (cdr lap1) (cdr lap-head))))) (and - (memq (caar tmp) - (eval-when-compile - (cons 'byte-discard byte-conditional-ops))) + (memq (caar tmp) conditional-or-discard-ops) (not (eq lap1 (car tmp))) (let ((tmp2 (car tmp))) (cond ((and (consp (cdr lap0)) @@ -2766,6 +2721,8 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance." (and (eq (car (car tmp)) 'byte-varref) (eq (cdr (car tmp)) (cdr lap1)) + ;; Can't optimise away varref for DEFVAR_BOOL vars + ;; because what we put in might not be what we get out. (not (memq (car (cdr lap1)) byte-boolean-vars)) (let ((newtag (byte-compile-make-tag))) (byte-compile-log-lap diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 6cce65e2c9b..05ee0615fec 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -683,7 +683,8 @@ enabled." ;; When the byte-compiler expands code, this macro is not used, so we're ;; either about to run `body' (plain interpretation) or we're doing eager ;; macroexpansion. - (list 'quote (eval (cons 'progn body) lexical-binding))) + (list 'quote (eval (cons 'progn body) + (when lexical-binding (or macroexp--dynvars t))))) (defun with-no-warnings (&rest body) "Like `progn', but prevents compiler warnings in the body." diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index bc764881303..adb4deba6c2 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -372,9 +372,7 @@ for the Emacs build itself.") ;;;###autoload (put 'byte-compile-warnings 'safe-local-variable - (lambda (v) - (or (symbolp v) - (null (delq nil (mapcar (lambda (x) (not (symbolp x))) v)))))) + (lambda (v) (or (symbolp v) (all #'symbolp v)))) ;;;###autoload (defun byte-compile-warning-enabled-p (warning &optional symbol) @@ -589,7 +587,11 @@ Only conses are traversed and duplicated, not arrays or any other structure." macroexpand-all-environment))) (eval (byte-run-strip-symbol-positions (bytecomp--copy-tree expanded)) - lexical-binding) + (when lexical-binding + (or (append + macroexp--dynvars + byte-compile-bound-variables) + t))) expanded))))) (with-suppressed-warnings . ,(lambda (warnings &rest body) @@ -1145,17 +1147,6 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (unless (or (get f 'function-history) (assq f byte-compile-function-environment)) (push f byte-compile-noruntime-functions))))))))))))) - -(defun byte-compile-eval-before-compile (form) - "Evaluate FORM for `eval-and-compile'." - (let ((hist-nil-orig current-load-list)) - (prog1 (eval form lexical-binding) - ;; (eval-and-compile (require 'cl) turns off warnings for cl functions. - ;; FIXME Why does it do that - just as a hack? - ;; There are other ways to do this nowadays. - (let ((tem current-load-list)) - (while (not (eq tem hist-nil-orig)) - (setq tem (cdr tem))))))) ;;; byte compiler messages @@ -1580,8 +1571,7 @@ when printing the error message." (defun byte-compile--check-arity-bytecode (form bytecode) "Check that the call in FORM matches that allowed by BYTECODE." - (when (and (byte-code-function-p bytecode) - (byte-compile-warning-enabled-p 'callargs)) + (when (byte-code-function-p bytecode) (let* ((actual-args (length (cdr form))) (arity (func-arity bytecode)) (min-args (car arity)) @@ -1882,18 +1872,19 @@ It is too wide if it has any lines longer than the largest of ;; defined, issue a warning enumerating them. ;; `unresolved' in the list `byte-compile-warnings' disables this. (defun byte-compile-warn-about-unresolved-functions () - (when (byte-compile-warning-enabled-p 'unresolved) - (let ((byte-compile-current-form :end)) - ;; Separate the functions that will not be available at runtime - ;; from the truly unresolved ones. - (dolist (urf byte-compile-unresolved-functions) - (let ((f (car urf))) - (when (not (memq f byte-compile-new-defuns)) - (byte-compile-warn-x - f - (if (fboundp f) "the function `%s' might not be defined at runtime." "the function `%s' is not known to be defined.") - (car urf))))))) - nil) + (let ((byte-compile-current-form :end)) + ;; Separate the functions that will not be available at runtime + ;; from the truly unresolved ones. + (dolist (urf byte-compile-unresolved-functions) + (let ((f (car urf))) + (when (and (not (memq f byte-compile-new-defuns)) + (byte-compile-warning-enabled-p 'unresolved)) + (byte-compile-warn-x + f + (if (fboundp f) + "the function `%s' might not be defined at runtime." + "the function `%s' is not known to be defined.") + (car urf))))))) ;; Dynamically bound in byte-compile-from-buffer. @@ -3341,7 +3332,7 @@ lambda-expression." (cons (nth 1 (car body)) (cdr body)) (cons tmp body)))) (or (eq output-type 'file) - (not (delq nil (mapcar 'consp (cdr (car body)))))))) + (not (any #'consp (cdr (car body))))))) (setq rest (cdr rest))) rest)) (let ((byte-compile-vector (byte-compile-constants-vector))) @@ -3427,11 +3418,11 @@ lambda-expression." (let ((hook (car-safe (cdr form)))) (if (eq (car-safe hook) 'quote) (byte-compile-check-variable (cadr hook) nil)))) - (when (and (byte-compile-warning-enabled-p 'suspicious) - (macroexp--const-symbol-p fn)) + (when (and (macroexp--const-symbol-p fn) + (byte-compile-warning-enabled-p 'suspicious)) (byte-compile-warn-x fn "`%s' called as a function" fn)) - (when (and (byte-compile-warning-enabled-p 'interactive-only fn) - interactive-only) + (when (and interactive-only + (byte-compile-warning-enabled-p 'interactive-only fn)) (byte-compile-warn-x fn "`%s' is for interactive use only%s" fn (cond ((stringp interactive-only) @@ -3841,12 +3832,12 @@ VAR must not be lexically bound. ARG is a position argument, used by `byte-compile-warn-x'. If optional argument ASSIGNMENT is non-nil, this is treated as an assignment (i.e. `setq')." - (unless (or (not (byte-compile-warning-enabled-p 'free-vars var)) - (boundp var) + (unless (or (boundp var) (memq var byte-compile-bound-variables) (memq var (if assignment byte-compile-free-assignments - byte-compile-free-references))) + byte-compile-free-references)) + (not (byte-compile-warning-enabled-p 'free-vars var))) (let* ((varname (prin1-to-string var)) (desc (if assignment "assignment" "reference")) (suggestions (help-uni-confusable-suggestions varname))) @@ -3880,14 +3871,7 @@ assignment (i.e. `setq')." (byte-compile-dynamic-variable-op 'byte-varset var)))) (defmacro byte-compile-get-constant (const) - `(or (if (stringp ,const) - ;; In a string constant, treat properties as significant. - (let (result) - (dolist (elt byte-compile-constants) - (if (equal-including-properties (car elt) ,const) - (setq result elt))) - result) - (assoc ,const byte-compile-constants #'eql)) + `(or (assoc ,const byte-compile-constants #'equal-including-properties) (car (setq byte-compile-constants (cons (list ,const) byte-compile-constants))))) @@ -4079,18 +4063,22 @@ If it is nil, then the handler is \"byte-compile-SYMBOL.\"" (defun byte-compile-cmp (form) "Compile calls to numeric comparisons such as `<', `=' etc." - ;; Lisp-level transforms should already have reduced valid calls to 2 args. - (if (not (= (length form) 3)) - (byte-compile-subr-wrong-args form "1 or more") - (byte-compile-two-args - (if (macroexp-const-p (nth 1 form)) - ;; First argument is constant: flip it so that the constant - ;; is last, which may allow more lapcode optimizations. - (let* ((op (car form)) - (flipped-op (cdr (assq op '((< . >) (<= . >=) - (> . <) (>= . <=) (= . =)))))) - (list flipped-op (nth 2 form) (nth 1 form))) - form)))) + ;; Lisp-level transforms should already have reduced valid calls to 2 args, + ;; but optimisations may have been disabled. + (let ((l (length form))) + (cond + ((= l 3) + (byte-compile-two-args + (if (macroexp-const-p (nth 1 form)) + ;; First argument is constant: flip it so that the constant + ;; is last, which may allow more lapcode optimizations. + (let* ((op (car form)) + (flipped-op (cdr (assq op '((< . >) (<= . >=) + (> . <) (>= . <=) (= . =)))))) + (list flipped-op (nth 2 form) (nth 1 form))) + form))) + ((= l 2) (byte-compile-form `(progn ,(nth 1 form) t))) + (t (byte-compile-normal-call form))))) (defun byte-compile-three-args (form) (if (not (= (length form) 4)) @@ -4917,28 +4905,6 @@ binding slots have been popped." (> byte-compile-depth init-stack-depth)))))) - -(byte-defop-compiler-1 /= byte-compile-negated) -(byte-defop-compiler-1 atom byte-compile-negated) -(byte-defop-compiler-1 nlistp byte-compile-negated) - -(put '/= 'byte-compile-negated-op '=) -(put 'atom 'byte-compile-negated-op 'consp) -(put 'nlistp 'byte-compile-negated-op 'listp) - -(defun byte-compile-negated (form) - (byte-compile-form-do-effect (byte-compile-negation-optimizer form))) - -;; Even when optimization is off, /= is optimized to (not (= ...)). -(defun byte-compile-negation-optimizer (form) - ;; an optimizer for forms where is less efficient than (not ) - (list 'not - (cons (or (get (car form) 'byte-compile-negated-op) - (error - "Compiler error: `%s' has no `byte-compile-negated-op' property" - (car form))) - (cdr form)))) - ;;; other tricky macro-like special-forms (byte-defop-compiler-1 catch) @@ -5889,6 +5855,18 @@ and corresponding effects." (featurep (cadr feature)) form))) +(defmacro bytecomp--define-negated (fn arity negfn) + "Define FN with ARITY as the Boolean negation of NEGFN." + `(put ',fn 'compiler-macro + (lambda (form &rest args) + (if (= (length args) ,arity) + (list 'not (cons ',negfn args)) + form)))) + +(bytecomp--define-negated /= 2 = ) +(bytecomp--define-negated atom 1 consp) +(bytecomp--define-negated nlistp 1 listp) + ;; Report comma operator used outside of backquote. ;; Inside backquote, backquote will transform it before it gets here. diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 170c7828cdd..ad7fc1de5c2 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -311,11 +311,11 @@ ENV is a list where each entry takes the shape either: EXTEND is a list of variables which might need to be accessed even from places where they are shadowed, because some part of ENV causes them to be used at places where they originally did not directly appear." - (cl-assert (not (delq nil (mapcar (lambda (mapping) - (if (eq (cadr mapping) #'apply-partially) - (cconv--set-diff (cdr (cddr mapping)) - extend))) - env)))) + (cl-assert (not (any (lambda (mapping) + (and (eq (cadr mapping) #'apply-partially) + (cconv--set-diff (cdr (cddr mapping)) + extend))) + env))) ;; What's the difference between fvrs and envs? ;; Suppose that we have the code diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 4a9819a2039..0c80400d028 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -974,23 +974,11 @@ Outputs to the current buffer." ;; Extend `cl-deftype' to define data types which are also valid ;; argument types for dispatching generic function methods (see also ;; ). -;; -;; The main entry points are: -;; -;; - `cl-deftype', that defines new data types. -;; -;; - `cl-types-of', that returns the types an object belongs to. ;; Ensure each type satisfies `eql'. -(defvar cl--types-of-memo (make-hash-table :test 'equal) - "Memoization table used in `cl-types-of'.") +(defvar cl--derived-type-specializers-memo (make-hash-table :test 'equal) + "Memoization table used in `cl--derived-type-specializers'.") -;; FIXME: `cl-types-of' CPU cost is proportional to the number of types -;; defined with `cl-deftype', so the more popular it gets, the slower -;; it becomes. And of course, the cost of each type check is -;; unbounded, so a single "expensive" type can slow everything down -;; further. -;; ;; The usual dispatch is ;; ;; (lambda (arg &rest args) @@ -1026,49 +1014,34 @@ Outputs to the current buffer." ;; associated with the `t' "dummy parent". [ We could even go crazy ;; and try and guess PARENTS when not provided, by analyzing the ;; type's definition. ] -;; - in `cl-types-of' start by calling `cl-type-of', then use the map -;; to find which cl-types may need to be checked. +;; - in `cl--derived-type-specializers' start by calling `cl-type-of', +;; then use the map to find which cl-types may need to be checked. ;; -;;;###autoload -(defun cl-types-of (object &optional types) - "Return the atomic types OBJECT belongs to. -Return an unique list of types OBJECT belongs to, ordered from the -most specific type to the most general. -TYPES is an internal argument." - (let* ((found nil)) +(defun cl--derived-type-specializers (object types) + "Return the list of specializers for OBJECT, derived from TYPES. +Return an unique (eq) list of atomic types OBJECT belongs to, ordered +from the most specific type to the most general. +TYPES is a list of types that OBJECT can potentially belong to." + ;; This function is speed critical for the dispatch on CL's derived types. + ;; Currently TYPES is just the set of types we're interested in. + ;; TODO: We could speed this up by replacing TYPES with anything that can + ;; be precomputed from it. + (let* ((found (list (cl-type-of object)))) ;; Build a list of all types OBJECT belongs to. - (dolist (type (or types cl--derived-type-list)) - (let ((pred (get type 'cl-deftype-satisfies))) - (and - ;; If OBJECT is of type, add type to the matching list. - (if types - ;; For method dispatch, we don't need to filter out errors, - ;; since we can presume that method dispatch is used only on - ;; sanely-defined types. - (funcall pred object) - (condition-case-unless-debug e - (funcall pred object) - (error (setq cl--derived-type-list - (delq type cl--derived-type-list)) - (warn "cl-types-of %S: %s" - type (error-message-string e)) - nil))) - (push type found)))) - (push (cl-type-of object) found) - ;; Return the list of types OBJECT belongs to, which is also the list - ;; of specifiers for OBJECT. This memoization has two purposes: + (dolist (type types) + ;; If OBJECT is of type, add type to the matching list. + (if (funcall (get type 'cl-deftype-satisfies) object) + (push type found))) + ;; This memoization has two purposes: ;; - Speed up computation. ;; - Make sure we always return the same (eq) object, so that the ;; method dispatch's own caching works as it should. - (with-memoization (gethash found cl--types-of-memo) + (with-memoization (gethash found cl--derived-type-specializers-memo) ;; Compute an ordered list of types from the DAG. - (let (dag) - (dolist (type found) - (push (cl--class-allparents (cl--find-class type)) dag)) - (merge-ordered-lists dag))))) - -(defvar cl--derived-type-dispatch-list nil - "List of types that need to be checked during dispatch.") + (merge-ordered-lists + (mapcar (lambda (type) + (cl--class-allparents (cl--find-class type))) + found))))) (cl-generic-define-generalizer cl--derived-type-generalizer ;; FIXME: This priority can't be always right. :-( @@ -1080,31 +1053,23 @@ TYPES is an internal argument." ;; Fixing this 100% is impossible so this generalizer is condemned to ;; suffer from "undefined method ordering" problems, unless/until we ;; restrict it somehow to a subset that we can handle reliably. - 20 ;; "typeof" < "cl-types-of" < "head" priority - (lambda (obj &rest _) `(cl-types-of ,obj cl--derived-type-dispatch-list)) + 20 ;; "typeof" < "derived-types" < "head" priority + (lambda (obj &optional types &rest _) + (if (not types) + :need-specializers + `(nil ;; Extra bindings, if any. + . (cl--derived-type-specializers ,obj ,types)))) (lambda (tag &rest _) (if (consp tag) tag))) ;;;###autoload (defun cl--derived-type-generalizers (type) ;; Make sure this derived type can be used without arguments. - (let ((expander (or (get type 'cl-deftype-handler) - (error "Type %S lacks cl-deftype-handler" type)))) - ;; Check that the type can be used without arguments. - (funcall expander) - ;; Check that we have a precomputed predicate since that's what - ;; `cl-types-of' uses. - (unless (get type 'cl-deftype-satisfies) - (error "Type %S lacks cl-deftype-satisfies" type))) - ;; Add a new dispatch type to the dispatch list, then - ;; synchronize with `cl--derived-type-list' so that both lists follow - ;; the same type precedence order. - ;; The `merge-ordered-lists' is `cl-types-of' should we make this - ;; ordering unnecessary, but it's still handy for all those types - ;; that don't declare their parents. - (unless (memq type cl--derived-type-dispatch-list) - (setq cl--derived-type-dispatch-list - (seq-intersection cl--derived-type-list - (cons type cl--derived-type-dispatch-list)))) + (funcall (or (get type 'cl-deftype-handler) + (error "Type %S lacks cl-deftype-handler" type))) + ;; Check that we have a precomputed predicate since that's what + ;; `cl--derived-type-specializers' uses. + (or (get type 'cl-deftype-satisfies) + (error "Type %S lacks cl-deftype-satisfies" type)) (list cl--derived-type-generalizer)) ;;;; Trailer diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index e821b15378b..ad032e82e9e 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -122,12 +122,25 @@ NAME is the name of the variable that will hold it. PRIORITY defines which generalizer takes precedence. The catch-all generalizer has priority 0. Then `eql' generalizer has priority 100. -TAGCODE-FUNCTION takes as first argument a varname and should return - a chunk of code that computes the tag of the value held in that variable. +TAGCODE-FUNCTION takes as first argument VALVAR which is a symbol + and it should return a chunk of code that computes the tag of the value + held in VALVAR. Further arguments are reserved for future use. SPECIALIZERS-FUNCTION takes as first argument a tag value TAG and should return a list of specializers that match TAG. - Further arguments are reserved for future use." + Further arguments are reserved for future use. + +When called with a single argument, TAGCODE-FUNCTION can return +`:need-specializers', to means this generalizer needs to know the list of +its own specializers that are applicable to the current dispatch. +In that case, TAGCODE-FUNCTION receives as second argument SPECSVAR, +the name of a variable that will hold the list of those specializers and +it should return a pair (BINDINGS . TAGCODE) where BINDINGS is a list +of (VAR FORM) that will be placed (in reverse order) in a `let*' and can +refer to SPECSVAR to precompute any data TAGCODE may need. +TAGCODE can refer to any of those bindings in addition to VALVAR. +Furthermore, the value of the first VAR (or SPECSVAR, in its absence) is +also passed as second argument to SPECIALIZERS-FUNCTION." (declare (indent 1) (debug (symbolp body))) `(defconst ,name (cl-generic-make-generalizer @@ -683,6 +696,48 @@ The set of acceptable TYPEs (also called \"specializers\") is defined ;; see `cl--generic-prefill-dispatchers'. #'byte-compile)) +(defun cl--generic-collect-specializers (methods dispatch-arg) + "Return the list of specializers used by METHODS at position DISPATCH-ARG. +Every element of the list is of the form (SPECIALIZER . GENERALIZERS)." + (let ((specializers ())) + (dolist (method methods) + (let ((specializer (cl--generic-arg-specializer method dispatch-arg))) + (unless (assoc specializer specializers) + (push (cons specializer (cl-generic-generalizers specializer)) + specializers)))) + specializers)) + +(defun cl--generic-filter-specializers (specializers generalizer) + "Return those SPECIALIZERS which use GENERALIZER. +SPECIALIZERS is as returned by `cl--generic-collect-specializers'." + (let ((res ())) + (dolist (spec+gens specializers) + (when (memq generalizer (cdr spec+gens)) + (push (car spec+gens) res))) + res)) + +(defun cl--generic--tagcode-with-specializers + (generalizer dispatch-arg outer-bindings) + (unless outer-bindings + (push `(specializers + (cl--generic-collect-specializers + methods ',dispatch-arg)) + outer-bindings)) + (let* ((our-specializers + (gensym "our-specializers")) + (binding+code + (funcall + (cl--generic-generalizer-tagcode-function + generalizer) + 'arg our-specializers))) + (cons (append (car binding+code) + (cons + `(,our-specializers + (cl--generic-filter-specializers + specializers ',generalizer)) + outer-bindings)) + (cdr binding+code)))) + (defun cl--generic-get-dispatcher (dispatch) (with-memoization ;; We need `copy-sequence` here because this `dispatch' object might be @@ -708,26 +763,39 @@ You might need to add: %S" (let* ((dispatch-arg (car dispatch)) (generalizers (cdr dispatch)) (lexical-binding t) + (outer-bindings nil) (tagcodes (mapcar (lambda (generalizer) - (funcall (cl--generic-generalizer-tagcode-function - generalizer) - 'arg)) + (let ((code (funcall + (cl--generic-generalizer-tagcode-function + generalizer) + 'arg)) + (extra-args nil)) + (when (eq code :need-specializers) + (let* ((binding+code + (cl--generic--tagcode-with-specializers + generalizer dispatch-arg outer-bindings))) + (setq outer-bindings (car binding+code)) + (setq code (cdr binding+code)) + ;; Pass the most recent binding (which defaults to + ;; the list of specializers of interest) to the + ;; function that recovers the types from the tag, + ;; in case it helps. + (setq extra-args (list (caar outer-bindings))))) + `(,generalizer ,code ,@extra-args))) generalizers)) (typescodes (mapcar - (lambda (generalizer) + (lambda (gen+code+args) `(funcall ',(cl--generic-generalizer-specializers-function - generalizer) - ,(funcall (cl--generic-generalizer-tagcode-function - generalizer) - 'arg))) - generalizers)) + (car gen+code+args)) + ,@(cdr gen+code+args))) + tagcodes)) + (tagcodes (mapcar #'cadr tagcodes)) (tag-exp - ;; Minor optimization: since this tag-exp is - ;; only used to lookup the method-cache, it - ;; doesn't matter if the default value is some - ;; constant or nil. + ;; Minor optimization: since this tag-exp is used only to + ;; lookup the method-cache, it doesn't matter if the default + ;; value is some constant or nil. `(or ,@(if (macroexp-const-p (car (last tagcodes))) (butlast tagcodes) tagcodes))) @@ -746,7 +814,8 @@ You might need to add: %S" (funcall cl--generic-compiler `(lambda (generic dispatches-left methods) - (let ((method-cache (make-hash-table :test #'eql))) + (let* ((method-cache (make-hash-table :test #'eql)) + ,@(nreverse outer-bindings)) (lambda (,@fixedargs &rest args) (let ,bindings (apply (with-memoization @@ -978,7 +1047,7 @@ those methods.") ('cl--generic-eql-generalizer '(eql 'x)) ('cl--generic-struct-generalizer 'cl--generic) ('cl--generic-typeof-generalizer 'integer) - ('cl--generic-derived-generalizer '(derived-mode c-mode)) + ('cl--generic-derived-mode-generalizer '(derived-mode c-mode)) ('cl--generic-oclosure-generalizer 'oclosure) (_ x)))) @@ -1397,19 +1466,19 @@ This currently works for built-in types and types built on top of records." ;; "&context (major-mode c-mode)" rather than ;; "&context (major-mode (derived-mode c-mode))". -(defun cl--generic-derived-specializers (mode &rest _) +(defun cl--generic-derived-mode-specializers (mode &rest _) ;; FIXME: Handle (derived-mode ... ) (mapcar (lambda (mode) `(derived-mode ,mode)) (derived-mode-all-parents mode))) -(cl-generic-define-generalizer cl--generic-derived-generalizer - 90 (lambda (name) `(and (symbolp ,name) (functionp ,name) ,name)) - #'cl--generic-derived-specializers) +(cl-generic-define-generalizer cl--generic-derived-mode-generalizer + 90 (lambda (name &rest _) `(and (symbolp ,name) (functionp ,name) ,name)) + #'cl--generic-derived-mode-specializers) (cl-defmethod cl-generic-generalizers ((_specializer (head derived-mode))) "Support for (derived-mode MODE) specializers. Used internally for the (major-mode MODE) context specializers." - (list cl--generic-derived-generalizer)) + (list cl--generic-derived-mode-generalizer)) (cl-generic-define-context-rewriter major-mode (mode &rest modes) `(major-mode ,(if (consp mode) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 63d85623fbe..73b3b243643 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -676,7 +676,7 @@ its argument list allows full Common Lisp conventions." ((eq keys t) nil) ;No &keys at all ((null keys) ;A &key but no actual keys specified. (push `(when ,restarg - (error ,(format "Keyword argument %%s not one of %s" + (error ,(format "Keyword argument %%S not one of %S" keys) (car ,restarg))) cl--bind-forms)) @@ -693,7 +693,7 @@ its argument list allows full Common Lisp conventions." (setq ,var nil)) (t (error - ,(format "Keyword argument %%s not one of %s" + ,(format "Keyword argument %%S not one of %S" keys) (car ,var))))))) (push `(let ((,var ,restarg)) ,check) cl--bind-forms))))) @@ -1888,9 +1888,7 @@ An implicit nil block is established around the loop. \(fn (VAR LIST [RESULT]) BODY...)" (declare (debug ((symbolp form &optional form) cl-declarations body)) (indent 1)) - (let ((loop `(dolist ,spec ,@body))) - (if (advice-member-p 'cl--wrap-in-nil-block 'dolist) - loop `(cl-block nil ,loop)))) + `(cl-block nil (dolist ,spec ,@body))) ;;;###autoload (defmacro cl-dotimes (spec &rest body) @@ -1901,9 +1899,7 @@ nil. \(fn (VAR COUNT [RESULT]) BODY...)" (declare (debug cl-dolist) (indent 1)) - (let ((loop `(dotimes ,spec ,@body))) - (if (advice-member-p 'cl--wrap-in-nil-block 'dotimes) - loop `(cl-block nil ,loop)))) + `(cl-block nil (dotimes ,spec ,@body))) (defvar cl--tagbody-alist nil) @@ -3127,8 +3123,7 @@ To see the documentation for a defined struct type, use (include-name nil) (type nil) ;nil here means not specified explicitly. (named nil) - (cldefsym (if cl--struct-inline 'cl-defsubst 'cl-defun)) - (defsym (if cl--struct-inline 'cl-defsubst 'defun)) + (noinline (not cl--struct-inline)) (forms nil) (docstring (if (stringp (car descs)) (pop descs))) (dynbound-slotnames '()) @@ -3175,8 +3170,7 @@ To see the documentation for a defined struct type, use (error "Invalid :type specifier: %s" type))) ((eq opt :named) (setq named t)) - ((eq opt :noinline) - (setq defsym 'defun) (setq cldefsym 'cl-defun)) + ((eq opt :noinline) (setq noinline t)) ((eq opt :initial-offset) (setq descs (nconc (make-list (car args) '(cl-skip-slot)) descs))) @@ -3228,30 +3222,40 @@ To see the documentation for a defined struct type, use descs))))) (cond ((null type) ;Record type. - `(memq (type-of cl-x) ,tag-symbol)) + (lambda (var) `(memq (type-of ,var) ,tag-symbol))) ((eq type 'vector) - `(and (vectorp cl-x) - (>= (length cl-x) ,(length descs)) - (memq (aref cl-x ,pos) ,tag-symbol))) - ((= pos 0) `(memq (car-safe cl-x) ,tag-symbol)) - (t `(and (consp cl-x) - (memq (nth ,pos cl-x) ,tag-symbol)))))) + (lambda (var) + `(and (vectorp ,var) + (>= (length ,var) ,(length descs)) + (memq (aref ,var ,pos) ,tag-symbol)))) + ((= pos 0) + (lambda (var) `(memq (car-safe ,var) ,tag-symbol))) + (t (lambda (var) `(and (consp ,var) + (memq (nth ,pos ,var) + ,tag-symbol))))))) pred-check (and pred-form (> safety 0) - (if (and (eq (caadr pred-form) 'vectorp) - (= safety 1)) - (cons 'and (cdddr pred-form)) - `(,predicate cl-x)))) + (lambda (var) + (let ((pf (funcall pred-form var))) + (cond + ((eq (caadr pf) 'vectorp) (nth 3 pf)) + ((eq (caadr pf) 'consp) (nth 2 pf)) + (t `(,predicate ,var))))))) (when pred-form (push `(eval-and-compile ;; Define the predicate to be effective at compile time ;; as native comp relies on `cl-typep' that relies on ;; predicates to be defined as they are registered in ;; cl-deftype-satisfies. - (,defsym ,predicate (cl-x) - (declare (side-effect-free error-free) (pure t)) - ,(if (eq (car pred-form) 'and) - (append pred-form '(t)) - `(and ,pred-form t))) + (define-inline ,predicate (x) + (declare (side-effect-free error-free) (pure t) + (noinline ,noinline)) + ,(let* ((varexp ',x) + (pf (funcall pred-form varexp)) + (body (if (eq (car pf) 'and) + (append pf '(t)) + `(and ,pf t)))) + `(inline-letevals (x) + (inline-quote ,body)))) (define-symbol-prop ',name 'cl-deftype-satisfies ',predicate)) forms)) (let ((pos 0) (descp descs)) @@ -3264,26 +3268,29 @@ To see the documentation for a defined struct type, use (progn (push nil slots) (push (and (eq slot 'cl-tag-slot) `',tag) - defaults)) + defaults)) (if (assq slot descp) (error "Duplicate slots named %s in %s" slot name)) (let ((accessor (intern (format "%s%s" conc-name slot))) (default-value (pop desc)) (doc (plist-get desc :documentation)) (access-body - `(progn - ,@(and pred-check - (list `(or ,pred-check - (signal 'wrong-type-argument - (list ',name cl-x))))) - ,(if (memq type '(nil vector)) `(aref cl-x ,pos) - (if (= pos 0) '(car cl-x) - `(nth ,pos cl-x)))))) + (lambda (var) + `(progn + ,@(if pred-check + (let ((pc (funcall pred-check var))) + `((or ,pc + (signal 'wrong-type-argument + (list ',name ,var)))))) + ,(if (memq type '(nil vector)) + `(aref ,var ,pos) + (if (= pos 0) `(car ,var) + `(nth ,pos ,var))))))) (push slot slots) (push default-value defaults) - ;; The arg "cl-x" is referenced by name in e.g. pred-form - ;; and pred-check, so changing it is not straightforward. - (push `(,defsym ,accessor (cl-x) + ;; FIXME: If this is an inherited slot, use an alias of + ;; the parent's accessor? + (push `(define-inline ,accessor (x) ,(let ((long-docstring (format "Access slot \"%s\" of `%s' struct X." slot name))) @@ -3311,8 +3318,10 @@ To see the documentation for a defined struct type, use (if doc (concat "\n" doc) "") "\n" (format "\n\n(fn %s X)" accessor))) - (declare (side-effect-free t)) - ,access-body) + (declare (side-effect-free t) (noinline ,noinline)) + (inline-letevals (x) + (inline-quote + ,(funcall access-body ',x)))) forms) ;; FIXME: This hack is to document this as a generalized ;; variable, despite it not having the `gv-expander' @@ -3340,14 +3349,14 @@ To see the documentation for a defined struct type, use (push kw desc) (setcar defaults nil)))) (cond - ((eq defsym 'defun) + (noinline (unless (plist-get desc ':read-only) - (push `(defun ,(gv-setter accessor) (val cl-x) - (setf ,access-body val)) + (push `(defun ,(gv-setter accessor) (val x) + (setf ,(funcall access-body 'x) val)) forms))) ((plist-get desc ':read-only) (push `(gv-define-expander ,accessor - (lambda (_cl-do _cl-x) + (lambda (_do _x) (error "%s is a read-only slot" ',accessor))) forms)) (t @@ -3388,7 +3397,7 @@ To see the documentation for a defined struct type, use (make (cl-mapcar (lambda (s d) (if (memq s anames) s d)) slots defaults)) (con-fun (or type #'record))) - (push `(,cldefsym ,cname + (push `(,(if noinline 'cl-defun 'cl-defsubst) ,cname (&cl-defs (nil ,@descs) ,@args) ,(if (stringp doc) doc ;; NB. This will produce incorrect results in @@ -3423,6 +3432,9 @@ To see the documentation for a defined struct type, use (nreverse forms) `((with-suppressed-warnings ((lexical . ,dynbound-slotnames)) ,@(nreverse forms)))) + ;; Don't include cl-struct-define in the autoloads file, since ordering + ;; there is not guaranteed, so we can't be sure that the parent struct + ;; is already defined :-( :autoload-end ;; Call cl-struct-define during compilation as well, so that ;; a subsequent cl-defstruct in the same file can correctly include this @@ -3804,12 +3816,39 @@ If PARENTS is non-nil, ARGLIST must be nil." (cl-callf (lambda (x) (delq parent-decl x)) (cdr declares)) (when (equal declares '(declare)) (cl-callf (lambda (x) (delq declares x)) decls))) - (and parents arglist - (error "Parents specified, but arglist not empty")) (let* ((expander - `(cl-function (lambda (&cl-defs ('*) ,@arglist) ,@decls ,@forms))) - ;; FIXME: Pass a better lexical context. - (specifier (ignore-errors (funcall (eval expander t)))) + `(cl-function + (lambda (&cl-defs ('*) ,@arglist) ,@decls ,@forms))) + (specifier + (condition-case nil + ;; FIXME: Pass a better lexical context. + (funcall (eval expander t)) + ;; We previously signaled an error when the type specified + ;; both non-nil parents and arglist, like `unsigned-byte' + ;; in below example: + ;; + ;; (cl-deftype my-integer () + ;; 'integer) + ;; + ;; (cl-deftype unsigned-byte (&optional bits) + ;; "Unsigned integer." + ;; (declare (parents my-integer)) + ;; `(integer 0 ,(if (memq bits '(nil *)) + ;; bits + ;; (1- (ash 1 bits))))) + ;; + ;; In order to accept the above (correct) definition of + ;; `unsigned-byte', call the expander without arguments to + ;; check if the arglist is mandatory by catching a + ;; `wrong-number-of-arguments' error. If so, and the type + ;; specified both parents and arglist, there is a good + ;; chance that the type is not atomic, so signal it; + ;; otherwise, return nil as previously. Report any other + ;; error on type definition. + (wrong-number-of-arguments + (and parents arglist ;; type is not atomic + (error "Type %S with parents may be not atomic: %S" + name arglist))))) (predicate (pcase specifier (`(satisfies ,f) `#',f) @@ -3847,13 +3886,13 @@ If PARENTS is non-nil, ARGLIST must be nil." `(cl-deftype ,type (&optional min max) (list 'and ',base (if (memq min '(* nil)) t - (if (consp min) - `(satisfies . ,(lambda (val) (> val (car min)))) - `(satisfies . ,(lambda (val) (>= val min))))) + `(satisfies . ,(if (consp min) + (lambda (val) (> val (car min))) + (lambda (val) (>= val min))))) (if (memq max '(* nil)) t - (if (consp max) - `(satisfies . ,(lambda (val) (< val (car max)))) - `(satisfies . ,(lambda (val) (<= val max))))))))) + `(satisfies . ,(if (consp max) + (lambda (val) (< val (car max))) + (lambda (val) (<= val max))))))))) ;;(cl--defnumtype integer ??) ;;(cl--defnumtype float ??) ;;(cl--defnumtype number ??) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 71b4a863b30..36437b346d2 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -473,9 +473,6 @@ The fields are used as follows: ;;;; Support for `cl-deftype'. -(defvar cl--derived-type-list nil - "Precedence list of the defined cl-types.") - ;; FIXME: The `cl-deftype-handler' property should arguably be turned ;; into a field of this struct (but it has performance and ;; compatibility implications, so let's not make that change for now). @@ -521,19 +518,7 @@ PARENTS is a list of types NAME is a subtype of, or nil." parents)) (define-symbol-prop name 'cl-deftype-handler expander) (when predicate - (define-symbol-prop name 'cl-deftype-satisfies predicate) - ;; If the type can be used without arguments, record it for - ;; use by `cl-types-of'. - ;; The order in `cl--derived-type-list' is important, but the - ;; constructor of the class `cl-type-class' already ensures that - ;; parent types must be defined before their "child" types - ;; (i.e. already added to the `cl--derived-type-list' for types - ;; defined with `cl-deftype'). So it is enough to simply push - ;; a new type at the beginning of the list. - ;; Redefinition is a can of worms anyway, so we don't try to be clever - ;; in that case. - (or (memq name cl--derived-type-list) - (push name cl--derived-type-list))))) + (define-symbol-prop name 'cl-deftype-satisfies predicate)))) ;; Make sure functions defined with cl-defsubst can be inlined even in ;; packages which do not require CL. We don't put an autoload cookie diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index f1b7e1c7f12..7a30f37d486 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2478,8 +2478,9 @@ PRE-LAMBDA and POST-LAMBDA are called in pre or post-order if non-nil." (setf (comp-vec-aref frame slot-n) mvar (cadr insn) mvar)))) (pcase insn - (`(setimm ,(pred targetp) ,_imm) - (new-lvalue)) + (`(setimm ,lval ,_imm) + (when (targetp lval) + (new-lvalue))) (`(,(pred comp--assign-op-p) ,(pred targetp) . ,_) (let ((mvar (comp-vec-aref frame slot-n))) (setf (cddr insn) (cl-nsubst-if mvar #'targetp (cddr insn)))) diff --git a/lisp/emacs-lisp/cond-star.el b/lisp/emacs-lisp/cond-star.el index 7c4c1043948..7d042116578 100644 --- a/lisp/emacs-lisp/cond-star.el +++ b/lisp/emacs-lisp/cond-star.el @@ -57,7 +57,7 @@ A `cond*' construct is a series of clauses, and a clause normally has the form (CONDITION BODY...). CONDITION can be a Lisp expression, as in `cond'. -Or it can be one of`(bind* BINDINGS...)', `(match* PATTERN DATUM)', +Or it can be one of `(bind* BINDINGS...)', `(match* PATTERN DATUM)', or `(pcase* PATTERN DATUM)', `(bind* BINDINGS...)' means to bind BINDINGS (as if they were in `let*') @@ -69,6 +69,10 @@ and runs the body of the clause if the first binding's value is non-nil. For its patterns, see `match*'. The condition counts as true if PATTERN matches DATUM. +`(bind-and* BINDINGS...)' means to bind BINDINGS (as if they were in +`if-let*') for only the the body of the clause. If any expression +evaluates to nil, the condition counts as false. + `(pcase* PATTERN DATUM)' means to match DATUM against the pattern PATTERN, using the same pattern syntax as `pcase'. The condition counts as true if PATTERN matches DATUM. @@ -111,7 +115,7 @@ ATOM (meaning any other kind of non-list not described above) to (match-string 0 DATUM), (match-string 1 DATUM), and so on. You can use as many SYMs as regexp matching supports. -`OBJECT matches any value `equal' to OBJECT. +\\=`OBJECT matches any value `equal' to OBJECT. \(cons CARPAT CDRPAT) matches a cons cell if CARPAT matches its car and CDRPAT matches its cdr. \(list ELTPATS...) @@ -154,6 +158,13 @@ ATOM (meaning any other kind of non-list not described above) ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. (byte-compile-warn-x pattern "`match*' used other than as a `cond*' condition")) +(defmacro bind-and* (&rest bindings) + "This macro evaluates BINDINGS like `if-let*'. +It is not really a Lisp function, and it is meaningful +only in the CONDITION of a `cond*' clause." + ;; FIXME: `byte-compile-warn-x' is not necessarily defined here. + (byte-compile-warn-x bindings "`bind-and*' used other than as a `cond*' condition")) + (defun cond*-non-exit-clause-p (clause) "If CLAUSE, a cond* clause, is a non-exit clause, return t." (or (null (cdr-safe clause)) ;; clause has only one element. @@ -167,7 +178,9 @@ ATOM (meaning any other kind of non-list not described above) (defun cond*-non-exit-clause-substance (clause) "For a non-exit cond* clause CLAUSE, return its substance. This removes a final keyword if that's what makes CLAUSE non-exit." - (cond ((null (cdr-safe clause)) ;; clause has only one element. + (cond ((or (null (cdr-safe clause)) ;; either clause has only one element + (and (consp (car clause)) ;; or it starts with `bind*' + (eq (caar clause) 'bind*))) clause) ;; Starts with t or a keyword. ;; Include t as the first element of the substance @@ -279,6 +292,30 @@ This is used for conditional exit clauses." (let* ,mod-bindings (when ,init-gensym . ,true-exps))))))) + ((eq pat-type 'bind-and*) + (let ((checks '()) (last t)) + (dolist (bind (cdr condition)) + (push (list (car bind) (list 'and last (cadr bind))) + checks) + (setq last (car bind))) + (cond + ;; For explanations on these cases, see "Ordinary + ;; Lisp expression is the condition." below. + (rest + (let ((quit (gensym "quit"))) + `(catch ',quit + (let* (,@(nreverse checks)) + (if ,last (throw ',quit ,(macroexp-progn true-exps)))) + ,iffalse))) + (uncondit-clauses + `(progn + (let* (,@(nreverse checks)) + (if ,last ,(macroexp-progn true-exps))) + ,(cond*-convert uncondit-clauses))) + (true-exps + `(let* (,@(nreverse checks)) + (if ,last ,(macroexp-progn true-exps)))) + (t last)))) ((eq pat-type 'pcase*) (if true-exps (progn diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index e87b9269188..8e51825854a 100644 --- a/lisp/emacs-lisp/easy-mmode.el +++ b/lisp/emacs-lisp/easy-mmode.el @@ -501,7 +501,6 @@ on if the hook has explicitly disabled it. (MODE-set-explicitly (intern (concat mode-name "--set-explicitly"))) (MODE-suppress-set-explicitly (intern (concat mode-name "--suppress-set-explicitly"))) - (MODE-major-mode (intern (concat global-mode-name "--major-mode"))) (MODE-predicate (intern (concat (replace-regexp-in-string "-mode\\'" "" global-mode-name) "-modes"))) @@ -523,12 +522,17 @@ on if the hook has explicitly disabled it. (when (easy-mmode--globalized-predicate-p ,MODE-predicate) (funcall ,turn-on-function))))) (_ (push keyw extra-keywords) (push (pop body) extra-keywords)))) + (setq extra-keywords (nreverse extra-keywords)) + + (when (and (plist-get extra-keywords :init-value) + (null (plist-get extra-keywords :initialize))) + (setq extra-keywords `(:initialize #'custom-initialize-after-file-load + . ,extra-keywords))) `(progn (progn (put ',global-mode 'globalized-minor-mode t) :autoload-end - (defvar-local ,MODE-major-mode nil) ,@(when predicate `((defvar ,MODE-predicate)))) ;; The actual global minor-mode (define-minor-mode ,global-mode @@ -555,7 +559,7 @@ Disable the mode if ARG is a negative number.\n\n" "`%s' is used to control which modes this minor mode is used in." MODE-predicate)) "")) - :global t ,@group ,@(nreverse extra-keywords) + :global t ,@group ,@extra-keywords ;; Setup hook to handle future mode changes and new buffers. (if ,global-mode @@ -620,8 +624,7 @@ list." ;; The function that calls TURN-ON in the current buffer. (defun ,MODE-enable-in-buffer () - (unless (or ,MODE-set-explicitly - (eq ,MODE-major-mode major-mode)) + (unless ,MODE-set-explicitly (let (;; We are not part of the major mode hook so we don't ;; want to set MODE-set-explicitly to t. ;; In particular this is necessary when there are @@ -629,12 +632,7 @@ list." ;; If one of them declines to turn the minor mode on, ;; that should not mean the others can't. (,MODE-suppress-set-explicitly t)) - (if (bound-and-true-p ,MODE-variable) - (progn - (,mode -1) - (funcall ,turn-on-function)) - (funcall ,turn-on-function)))) - (setq ,MODE-major-mode major-mode)) + (funcall ,turn-on-function)))) (put ',MODE-enable-in-buffer 'definition-name ',global-mode)))) (defun easy-mmode--globalized-predicate-p (predicate) diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index eb5f112f4a9..b82ee981eb7 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -238,7 +238,6 @@ expression point is on." :lighter eldoc-minor-mode-string ;;;###autoload (define-globalized-minor-mode global-eldoc-mode eldoc-mode turn-on-eldoc-mode - :initialize 'custom-initialize-delay :init-value t ;; For `read--expression', the usual global mode mechanism of ;; `change-major-mode-hook' runs in the minibuffer before diff --git a/lisp/emacs-lisp/elisp-scope.el b/lisp/emacs-lisp/elisp-scope.el index f717a5f4070..81d19af983c 100644 --- a/lisp/emacs-lisp/elisp-scope.el +++ b/lisp/emacs-lisp/elisp-scope.el @@ -133,6 +133,8 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defun elisp-scope--define-symbol-role (name parents props) (put name 'elisp-scope-parent-roles parents) (put name 'elisp-scope-role-properties props)) @@ -259,14 +261,11 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role free-variable (variable) :doc "Variable names." :face 'elisp-free-variable - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (let ((val (if (boundp sym) (truncate-string-to-width (prin1-to-string (symbol-value sym)) 60 nil nil t) "#"))) - (if-let* ((doc (documentation-property sym 'variable-documentation t))) - (format "Special variable `%S'.\n\nValue: %s\n\n%s" sym val doc) - (format "Special variable `%S'.\n\nValue: %s" sym val)))) - "Special variable"))) + :help (lambda (sym &rest _) + (let ((val (if (boundp sym) (truncate-string-to-width (prin1-to-string (symbol-value sym)) 60 nil nil t) "#"))) + (if-let* ((doc (documentation-property sym 'variable-documentation t))) + (format "Special variable `%S'.\n\nValue: %s\n\n%s" sym val doc) + (format "Special variable `%S'.\n\nValue: %s" sym val))))) (elisp-scope-define-symbol-role bound-variable (variable) :doc "Local variable names." @@ -291,8 +290,7 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role face () :doc "Face names." :face 'elisp-face - :help (lambda (beg end _def) - (elisp--help-echo beg end 'face-documentation "Face"))) + :help (apply-partially #'elisp--help-echo 'face-documentation "Face")) (elisp-scope-define-symbol-role callable () :doc "Abstract symbol role of function-like symbols.") @@ -300,12 +298,7 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role function (callable) :doc "Function names." :face 'elisp-function - :help (lambda (beg end def) - (cond ((equal beg def) "Local function definition") - (def "Local function call") - (t (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) - (apply-partially #'elisp--function-help-echo sym) - "Function call"))))) + :help #'elisp--function-help-echo) (elisp-scope-define-symbol-role command (function) :doc "Command names.") @@ -317,27 +310,17 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role non-local-exit (function) :doc "Functions that do not return." - :face 'elisp-non-local-exit - :help (lambda (beg end _def) - (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) - (apply-partially #'elisp--function-help-echo sym) - "Non-local exit"))) + :face 'elisp-non-local-exit) (elisp-scope-define-symbol-role macro (callable) :doc "Macro names." :face 'elisp-macro - :help (lambda (beg end _def) - (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) - (apply-partially #'elisp--function-help-echo sym) - "Macro call"))) + :help #'elisp--function-help-echo) (elisp-scope-define-symbol-role special-form (callable) :doc "Special form names." :face 'elisp-special-form - :help (lambda (beg end _def) - (if-let* ((sym (intern-soft (buffer-substring-no-properties beg end)))) - (apply-partially #'elisp--function-help-echo sym) - "Special form"))) + :help #'elisp--function-help-echo) (elisp-scope-define-symbol-role throw-tag () :doc "Symbols used as `throw'/`catch' tags." @@ -422,15 +405,12 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role condition () :doc "`condition-case' conditions." :face 'elisp-condition - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (let ((msg (get sym 'error-message))) - (apply #'concat - "`condition-case' condition" - (when (and msg (not (string-empty-p msg))) - `(": " ,msg))))) - "`condition-case' condition"))) + :help (lambda (sym &rest _) + (let ((msg (get sym 'error-message))) + (apply #'concat + "`condition-case' condition" + (when (and msg (not (string-empty-p msg))) + `(": " ,msg)))))) (elisp-scope-define-symbol-role defcondition (condition) :doc "`condition-case' condition definitions." @@ -478,12 +458,9 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role major-mode () :doc "Major mode names." :face 'elisp-major-mode-name - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (if-let* ((doc (documentation sym))) - (format "Major mode `%S'.\n\n%s" sym doc) - "Major mode")) + :help (lambda (sym &rest _) + (if-let* ((doc (documentation sym))) + (format "Major mode `%S'.\n\n%s" sym doc) "Major mode"))) (elisp-scope-define-symbol-role major-mode-definition (major-mode) @@ -492,8 +469,7 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role block () :doc "`cl-block' block names." - :help (lambda (beg _end def) - (if (equal beg def) "Block definition" "Block"))) + :help "Block") (elisp-scope-define-symbol-role icon () :doc "Icon names." @@ -508,12 +484,9 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role oclosure () :doc "OClosure type names." :face 'elisp-oclosure - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (if-let* ((doc (oclosure--class-docstring (get sym 'cl--class)))) - (format "OClosure type `%S'.\n\n%s" sym doc) - "OClosure type")) + :help (lambda (sym &rest _) + (if-let* ((doc (oclosure--class-docstring (get sym 'cl--class)))) + (format "OClosure type `%S'.\n\n%s" sym doc) "OClosure type"))) (elisp-scope-define-symbol-role defoclosure () @@ -524,12 +497,9 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role coding () :doc "Coding-system names." :face 'elisp-coding - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (if-let* ((doc (coding-system-doc-string sym))) - (format "Coding-system `%S'.\n\n%s" sym doc) - "Coding-system")) + :help (lambda (sym &rest _) + (if-let* ((doc (coding-system-doc-string sym))) + (format "Coding-system `%S'.\n\n%s" sym doc) "Coding-system"))) (elisp-scope-define-symbol-role defcoding () @@ -540,12 +510,9 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role charset () :doc "Character set names." :face 'elisp-charset - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (if-let* ((doc (charset-description sym))) - (format "Character set `%S'.\n\n%s" sym doc) - "Character set")) + :help (lambda (sym &rest _) + (if-let* ((doc (charset-description sym))) + (format "Character set `%S'.\n\n%s" sym doc) "Character set"))) (elisp-scope-define-symbol-role defcharset () @@ -556,12 +523,9 @@ Interactively, prompt for ROLE." (elisp-scope-define-symbol-role completion-category () :doc "Completion categories." :face 'elisp-completion-category - :help (lambda (beg end _def) - (if-let* ((sym (intern (buffer-substring-no-properties beg end)))) - (lambda (&rest _) - (if-let* ((doc (get sym 'completion-category-documentation))) - (format "Completion category `%S'.\n\n%s" sym doc) - "Completion category")) + :help (lambda (sym &rest _) + (if-let* ((doc (get sym 'completion-category-documentation))) + (format "Completion category `%S'.\n\n%s" sym doc) "Completion category"))) (elisp-scope-define-symbol-role completion-category-definition () @@ -587,8 +551,6 @@ See `elisp-scope-1' for possible values.") (defvar elisp-scope--callback #'ignore "Function to call to report information about each analyzed symbol.") -(defvar elisp-scope--current-let-alist-form nil) - (defsubst elisp-scope--local-new (sym pos &optional local) "Return new local context with SYM bound at POS. @@ -605,8 +567,8 @@ Optional argument LOCAL is a local context to extend." (defvar elisp-scope--quoted nil) -(defsubst elisp-scope--report (role beg len &optional id def) - (funcall elisp-scope--callback role beg len id (or def (and (numberp id) id)))) +(defsubst elisp-scope--report (role beg sym &optional id def) + (funcall elisp-scope--callback role beg sym id (or def (and (numberp id) id)))) (defvar elisp-scope-special-variables nil "List of symbols that are special variables in the current analysis context.") @@ -615,42 +577,32 @@ Optional argument LOCAL is a local context to extend." "Check whether SYM is a special variable in the current analysis context." (or (memq sym elisp-scope-special-variables) (special-variable-p sym))) -(defun elisp-scope--variable (sym beg len id) +(defun elisp-scope--variable (sym beg id) (elisp-scope--report (if id (if (elisp-scope--special-variable-p sym) 'shadowed-variable 'bound-variable) 'free-variable) - beg len id)) + beg sym id)) -(defun elisp-scope--binding (sym beg len) +(defun elisp-scope--binding (sym beg) (elisp-scope--report (if (elisp-scope--special-variable-p sym) 'shadowing-variable 'binding-variable) - beg len beg)) + beg sym beg)) (defun elisp-scope--symbol (sym) - (let* ((beg (elisp-scope--sym-pos sym)) - (bare (elisp-scope--sym-bare sym)) - (name (symbol-name bare)) - (len (length name))) - (when (and beg (not (booleanp bare))) - (cond - ((keywordp bare) (elisp-scope--report 'constant beg len)) - ((and elisp-scope--current-let-alist-form (= (aref name 0) ?.)) - (if (and (length> name 1) (= (aref name 1) ?.)) - ;; Double dot escapes `let-alist'. - (let* ((unescaped (intern (substring name 1)))) - (elisp-scope--variable unescaped beg len (alist-get unescaped elisp-scope-local-bindings))) - (elisp-scope--report 'bound-variable beg len - (list 'let-alist (car elisp-scope--current-let-alist-form) bare) - (cdr elisp-scope--current-let-alist-form)))) - (t (elisp-scope--variable bare beg len (alist-get bare elisp-scope-local-bindings))))))) + "Analyze and report symbol SYM as a variable reference." + (when-let* ((beg (elisp-scope--sym-pos sym)) + (bare (bare-symbol sym))) + (if (keywordp bare) (elisp-scope--report 'constant beg bare) + (unless (eq bare t) ; Do not report t as a variable. + (elisp-scope--variable + bare beg (alist-get bare elisp-scope-local-bindings)))))) (defun elisp-scope--let-1 (local bindings body) (if bindings (let* ((binding (ensure-list (car bindings))) (sym (car binding)) (bare (elisp-scope--sym-bare sym)) - (len (length (symbol-name bare))) (beg (elisp-scope--sym-pos sym))) - (when beg (elisp-scope--binding bare beg len)) + (when beg (elisp-scope--binding bare beg)) (elisp-scope-1 (cadr binding)) (elisp-scope--let-1 (if bare (elisp-scope--local-new bare beg local) local) (cdr bindings) body)) @@ -667,9 +619,8 @@ Optional argument LOCAL is a local context to extend." (let* ((binding (ensure-list (car bindings))) (sym (car binding)) (bare (bare-symbol sym)) - (len (length (symbol-name bare))) (beg (elisp-scope--sym-pos sym))) - (when beg (elisp-scope--binding bare beg len)) + (when beg (elisp-scope--binding bare beg)) (elisp-scope-1 (cadr binding)) (let ((elisp-scope-local-bindings (elisp-scope--local-new bare beg elisp-scope-local-bindings))) (elisp-scope-let* (cdr bindings) body))) @@ -677,9 +628,7 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-interactive (intr spec modes) (when (symbol-with-pos-p intr) - (elisp-scope--report 'special-form - (symbol-with-pos-pos intr) - (length (symbol-name (elisp-scope--sym-bare intr))))) + (elisp-scope--report 'special-form (symbol-with-pos-pos intr) (bare-symbol intr))) (elisp-scope-1 spec) (mapc #'elisp-scope-major-mode-name modes)) @@ -706,18 +655,15 @@ Optional argument LOCAL is a local context to extend." (decl (car-safe form)) ((or (symbol-with-pos-p decl) (symbolp decl))) - ((eq (bare-symbol decl) 'declare))) + (bare (bare-symbol decl)) + ((eq bare 'declare))) (when (symbol-with-pos-p decl) - (elisp-scope--report 'macro - (symbol-with-pos-pos decl) - (length (symbol-name (bare-symbol decl))))) + (elisp-scope--report 'macro (symbol-with-pos-pos decl) bare)) (dolist (spec (cdr form)) (when-let* ((head (car-safe spec)) (bare (elisp-scope--sym-bare head))) (when (symbol-with-pos-p head) - (elisp-scope--report 'function-property-declaration - (symbol-with-pos-pos head) - (length (symbol-name bare)))) + (elisp-scope--report 'function-property-declaration (symbol-with-pos-pos head) bare)) (cl-case bare (completion (elisp-scope-sharpquote (cadr spec))) (interactive-only @@ -752,12 +698,11 @@ Optional argument LOCAL is a local context to extend." (dolist (arg args) (and (symbol-with-pos-p arg) (let* ((beg (symbol-with-pos-pos arg)) - (bare (bare-symbol arg)) - (len (length (symbol-name bare)))) + (bare (bare-symbol arg))) (when (and beg (not (eq bare '_))) (if (memq bare '(&optional &rest)) - (elisp-scope--report 'ampersand beg len) - (elisp-scope--report 'binding-variable beg len beg))))))) + (elisp-scope--report 'ampersand beg bare) + (elisp-scope--report 'binding-variable beg bare beg))))))) ;; Handle BODY. (let ((elisp-scope-local-bindings l)) (elisp-scope-n body outspec)))) @@ -771,7 +716,7 @@ Optional argument LOCAL is a local context to extend." (if (eq 'interactive (elisp-scope--sym-bare (car-safe (car-safe tmp)))) 'defcmd 'defun)) - beg (length (symbol-name bare)))) + beg bare)) (elisp-scope-lambda args body)) (defun elisp-scope-setq (args) (elisp-scope-n args elisp-scope-output-spec)) @@ -792,11 +737,10 @@ Optional argument LOCAL is a local context to extend." (func (car def)) (exps (cdr def)) (beg (elisp-scope--sym-pos func)) - (bare (bare-symbol func)) - (len (length (symbol-name bare)))) + (bare (bare-symbol func))) (when beg ;; TODO: Use a bespoke 'local-function-definition' role. - (elisp-scope--report 'function beg len beg)) + (elisp-scope--report 'function beg bare beg)) (if (cdr exps) ;; def is (FUNC ARGLIST BODY...) (elisp-scope-cl-lambda (car exps) (cdr exps)) @@ -811,10 +755,7 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope--local-function-analyzer (pos) (lambda (f &rest args) (when (symbol-with-pos-p f) - (elisp-scope--report 'function - (symbol-with-pos-pos f) - (length (symbol-name (bare-symbol f))) - pos)) + (elisp-scope--report 'function (symbol-with-pos-pos f) (bare-symbol f) pos)) (elisp-scope-n args))) (defun elisp-scope-labels (defs forms outspec) @@ -824,10 +765,9 @@ Optional argument LOCAL is a local context to extend." (args (cadr def)) (body (cddr def)) (beg (elisp-scope--sym-pos func)) - (bare (bare-symbol func)) - (len (length (symbol-name bare)))) + (bare (bare-symbol func))) (when beg - (elisp-scope--report 'function beg len beg)) + (elisp-scope--report 'function beg bare beg)) (let ((pos (or beg (cons 'gen (incf elisp-scope--counter))))) (elisp-scope-with-local-definition bare (elisp-scope--local-function-analyzer pos) @@ -842,7 +782,7 @@ Optional argument LOCAL is a local context to extend." (let* ((beg (elisp-scope--sym-pos name)) (bare (bare-symbol name))) (when beg - (elisp-scope--report 'block beg (length (symbol-name bare)) beg)) + (elisp-scope--report 'block beg bare beg)) (let ((elisp-scope-block-alist (elisp-scope--local-new bare beg elisp-scope-block-alist))) (elisp-scope-n body))) (elisp-scope-n body))) @@ -850,8 +790,7 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-return-from (name result) (when-let* ((bare (and (symbol-with-pos-p name) (bare-symbol name))) (pos (alist-get bare elisp-scope-block-alist))) - (elisp-scope--report 'block - (symbol-with-pos-pos name) (length (symbol-name bare)) pos)) + (elisp-scope--report 'block (symbol-with-pos-pos name) bare pos)) (elisp-scope-1 result)) (defvar elisp-scope-assume-func nil) @@ -914,7 +853,7 @@ Optional argument LOCAL is a local context to extend." (let* ((var (cadr form)) (bare (elisp-scope--sym-bare var)) (beg (elisp-scope--sym-pos var))) - (when beg (elisp-scope--binding bare beg (length (symbol-name bare)))) + (when beg (elisp-scope--binding bare beg)) (let ((elisp-scope-local-bindings (elisp-scope--local-new bare beg elisp-scope-local-bindings))) (elisp-scope-loop-for-and rest)))) @@ -958,7 +897,7 @@ Optional argument LOCAL is a local context to extend." (let* ((var (car (ensure-list vars))) (bare (bare-symbol var)) (beg (elisp-scope--sym-pos var))) - (when beg (elisp-scope--binding bare beg (length (symbol-name bare)))) + (when beg (elisp-scope--binding bare beg)) (elisp-scope-loop-for (elisp-scope--local-new bare beg local) (cdr-safe vars) rest)) (when-let* ((bare (elisp-scope--sym-bare (car rest))) (more (cdr rest))) @@ -994,7 +933,7 @@ Optional argument LOCAL is a local context to extend." (progn (elisp-scope--symbol var) (elisp-scope-loop (cdr more))) - (when beg (elisp-scope--binding bare beg (length (symbol-name bare)))) + (when beg (elisp-scope--binding bare beg)) (let ((elisp-scope-loop-into-vars (cons bare elisp-scope-loop-into-vars)) (elisp-scope-local-bindings (elisp-scope--local-new bare beg elisp-scope-local-bindings))) (elisp-scope-loop (cdr more))))) @@ -1010,7 +949,7 @@ Optional argument LOCAL is a local context to extend." (beg (symbol-with-pos-pos var)) (l (elisp-scope--local-new bare beg elisp-scope-local-bindings)) (eql (car rest))) - (when beg (elisp-scope--binding bare beg (length (symbol-name bare)))) + (when beg (elisp-scope--binding bare beg)) (if (eq (elisp-scope--sym-bare eql) '=) (let* ((val (cadr rest)) (more (cddr rest))) (elisp-scope-1 val) @@ -1029,7 +968,7 @@ Optional argument LOCAL is a local context to extend." (let* ((beg (elisp-scope--sym-pos name)) (bare (elisp-scope--sym-bare name))) (when beg - (elisp-scope--report 'block beg (length (symbol-name bare)) beg)) + (elisp-scope--report 'block beg bare beg)) (let ((elisp-scope-block-alist (elisp-scope--local-new bare beg elisp-scope-block-alist))) (elisp-scope-loop rest)))) @@ -1097,12 +1036,12 @@ Optional argument LOCAL is a local context to extend." (let ((bare (elisp-scope--sym-bare name)) (beg (elisp-scope--sym-pos name))) (when beg - (elisp-scope--report 'function beg (length (symbol-name bare)) beg)) + (elisp-scope--report 'function beg bare beg)) (dolist (binding bindings) (let* ((sym (car (ensure-list binding))) (beg (symbol-with-pos-pos sym)) (bare (bare-symbol sym))) - (when beg (elisp-scope--binding bare beg (length (symbol-name bare)))) + (when beg (elisp-scope--binding bare beg)) (elisp-scope-1 (cadr binding)))) (let ((l elisp-scope-local-bindings)) (dolist (binding bindings) @@ -1124,9 +1063,7 @@ Optional argument LOCAL is a local context to extend." (let* ((head (car regexp)) (bare (elisp-scope--sym-bare head))) (when (and bare (symbol-with-pos-p head)) - (elisp-scope--report 'rx-construct - (symbol-with-pos-pos head) (length (symbol-name bare)) - (alist-get bare elisp-scope-rx-alist))) + (elisp-scope--report 'rx-construct (symbol-with-pos-pos head) bare (alist-get bare elisp-scope-rx-alist))) (cond ((memq bare '(literal regex regexp eval)) (elisp-scope-1 (cadr regexp))) @@ -1142,14 +1079,11 @@ Optional argument LOCAL is a local context to extend." (elisp-scope-rx (cdr regexp))))) (when-let* (((symbol-with-pos-p regexp)) (bare (elisp-scope--sym-bare regexp))) - (elisp-scope--report 'rx-construct - (symbol-with-pos-pos regexp) (length (symbol-name bare)) - (alist-get bare elisp-scope-rx-alist))))) + (elisp-scope--report 'rx-construct (symbol-with-pos-pos regexp) bare (alist-get bare elisp-scope-rx-alist))))) (defun elisp-scope-rx-define (name rest) (when-let* ((bare (elisp-scope--sym-bare name))) - (elisp-scope--report 'rx-construct - (symbol-with-pos-pos name) (length (symbol-name bare)) nil)) + (elisp-scope--report 'rx-construct (symbol-with-pos-pos name) bare)) (if (not (cdr rest)) (elisp-scope-rx-1 (car rest)) (let ((l elisp-scope-rx-alist) @@ -1157,13 +1091,11 @@ Optional argument LOCAL is a local context to extend." (rx (cadr rest))) (dolist (arg args) (and (symbol-with-pos-p arg) - (let* ((beg (symbol-with-pos-pos arg)) - (bare (bare-symbol arg)) - (len (length (symbol-name bare)))) - (when beg - (if (memq (bare-symbol arg) '(&optional &rest _)) - (elisp-scope--report 'ampersand beg len) - (elisp-scope--report 'rx-construct beg len beg)))))) + (when-let* ((beg (symbol-with-pos-pos arg)) + (bare (bare-symbol arg))) + (if (memq bare '(&optional &rest _)) + (elisp-scope--report 'ampersand beg bare) + (elisp-scope--report 'rx-construct beg bare beg))))) (dolist (arg args) (when-let* ((bare (bare-symbol arg)) (beg (elisp-scope--sym-pos arg))) @@ -1177,21 +1109,18 @@ Optional argument LOCAL is a local context to extend." (let ((name (car binding)) (rest (cdr binding))) (when-let* ((bare (elisp-scope--sym-bare name)) (beg (symbol-with-pos-pos name))) - (elisp-scope--report 'rx-construct - beg (length (symbol-name bare)) beg)) + (elisp-scope--report 'rx-construct beg bare beg)) (if (cdr rest) (let ((l elisp-scope-rx-alist) (args (car rest)) (rx (cadr rest))) (dolist (arg args) (and (symbol-with-pos-p arg) - (let* ((beg (symbol-with-pos-pos arg)) - (bare (bare-symbol arg)) - (len (length (symbol-name bare)))) - (when beg - (if (memq (bare-symbol arg) '(&optional &rest _)) - (elisp-scope--report 'ampersand beg len) - (elisp-scope--report 'rx-construct beg len beg)))))) + (when-let* ((beg (symbol-with-pos-pos arg)) + (bare (bare-symbol arg))) + (if (memq bare '(&optional &rest _)) + (elisp-scope--report 'ampersand beg bare) + (elisp-scope--report 'rx-construct beg bare beg))))) (dolist (arg args) (when-let* ((bare (bare-symbol arg)) (beg (elisp-scope--sym-pos arg))) @@ -1212,45 +1141,19 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-gv-define-expander (name handler) (when-let* ((beg (elisp-scope--sym-pos name)) (bare (elisp-scope--sym-bare name))) - (elisp-scope--report 'defun beg (length (symbol-name bare)))) + (elisp-scope--report 'defun beg bare)) (elisp-scope-1 handler)) (defun elisp-scope-gv-define-simple-setter (name setter rest) (when-let* ((beg (elisp-scope--sym-pos name)) (bare (elisp-scope--sym-bare name))) - (elisp-scope--report 'defun beg (length (symbol-name bare)))) + (elisp-scope--report 'defun beg bare)) (when-let* ((beg (elisp-scope--sym-pos setter)) (bare (elisp-scope--sym-bare setter))) - (elisp-scope--report 'function beg (length (symbol-name bare)))) + (elisp-scope--report 'function beg bare)) (elisp-scope-n rest)) -(defun elisp-scope-face (face) - (if (or (elisp-scope--sym-bare face) - (keywordp (elisp-scope--sym-bare (car-safe face)))) - (elisp-scope-face-1 face) - (mapc #'elisp-scope-face-1 face))) - -(defun elisp-scope-face-1 (face) - (cond - ((symbol-with-pos-p face) - (when-let* ((beg (elisp-scope--sym-pos face)) (bare (elisp-scope--sym-bare face))) - (elisp-scope--report 'face beg (length (symbol-name bare))))) - ((keywordp (elisp-scope--sym-bare (car-safe face))) - (let ((l face)) - (while l - (let ((kw (car l)) - (vl (cadr l))) - (setq l (cddr l)) - (when-let* ((bare (elisp-scope--sym-bare kw)) - ((keywordp bare))) - (when-let* ((beg (elisp-scope--sym-pos kw)) - (len (length (symbol-name bare)))) - (elisp-scope--report 'constant beg len)) - (when (eq bare :inherit) - (when-let* ((beg (elisp-scope--sym-pos vl)) (fbare (elisp-scope--sym-bare vl))) - (elisp-scope--report 'face beg (length (symbol-name fbare)))))))))))) - (defun elisp-scope-deftype (name args body) (when-let* ((beg (elisp-scope--sym-pos name)) (bare (elisp-scope--sym-bare name))) - (elisp-scope--report 'deftype beg (length (symbol-name bare)))) + (elisp-scope--report 'deftype beg bare)) (elisp-scope-lambda args body)) (defun elisp-scope-defmethod-1 (local args body) @@ -1262,9 +1165,8 @@ Optional argument LOCAL is a local context to extend." (spec (cadr arg))) (cond ((setq bare (elisp-scope--sym-bare var)) - (when-let* ((beg (elisp-scope--sym-pos var)) - (len (length (symbol-name bare)))) - (elisp-scope--binding bare beg len)) + (when-let* ((beg (elisp-scope--sym-pos var))) + (elisp-scope--binding bare beg)) (cond ((consp spec) (let ((head (car spec)) (form (cadr spec))) @@ -1273,16 +1175,15 @@ Optional argument LOCAL is a local context to extend." (elisp-scope-1 form)))) ((symbol-with-pos-p spec) (when-let* ((beg (symbol-with-pos-pos spec)) - (bare (bare-symbol spec)) - (len (length (symbol-name bare)))) - (elisp-scope--report 'type beg len)))) + (bare (bare-symbol spec))) + (elisp-scope--report 'type beg bare)))) (elisp-scope-defmethod-1 (elisp-scope--local-new bare (elisp-scope--sym-pos var) local) (cdr args) body))))) ((setq bare (elisp-scope--sym-bare arg)) (cond ((memq bare '(&optional &rest &body _)) (when-let* ((beg (elisp-scope--sym-pos arg))) - (elisp-scope--report 'ampersand beg (length (symbol-name bare)))) + (elisp-scope--report 'ampersand beg bare)) (elisp-scope-defmethod-1 local (cdr args) body)) ((eq bare '&context) (let* ((expr-type (cadr args)) @@ -1290,7 +1191,7 @@ Optional argument LOCAL is a local context to extend." (spec (cadr expr-type)) (more (cddr args))) (when-let* ((beg (elisp-scope--sym-pos arg))) - (elisp-scope--report 'ampersand beg (length (symbol-name bare)))) + (elisp-scope--report 'ampersand beg bare)) (elisp-scope-1 expr) (cond ((consp spec) @@ -1300,14 +1201,12 @@ Optional argument LOCAL is a local context to extend." (elisp-scope-1 form)))) ((symbol-with-pos-p spec) (when-let* ((beg (symbol-with-pos-pos spec)) - (bare (bare-symbol spec)) - (len (length (symbol-name bare)))) - (elisp-scope--report 'type beg len beg)))) + (bare (bare-symbol spec))) + (elisp-scope--report 'type beg bare beg)))) (elisp-scope-defmethod-1 local more body))) (t - (when-let* ((beg (elisp-scope--sym-pos arg)) - (len (length (symbol-name bare)))) - (elisp-scope--binding bare beg len)) + (when-let* ((beg (elisp-scope--sym-pos arg))) + (elisp-scope--binding bare beg)) (elisp-scope-defmethod-1 (elisp-scope--local-new bare (elisp-scope--sym-pos arg) local) (cdr args) body)))))) (let ((elisp-scope-local-bindings local)) @@ -1325,7 +1224,7 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-defmethod (name rest) (when-let* ((beg (elisp-scope--sym-pos name)) (bare (elisp-scope--sym-bare name))) - (elisp-scope--report 'defun beg (length (symbol-name bare)))) + (elisp-scope--report 'defun beg bare)) ;; [EXTRA] (when (eq (elisp-scope--sym-bare (car rest)) :extra) (elisp-scope--symbol (car rest)) @@ -1340,7 +1239,7 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-cl-defun (name arglist body) (let ((beg (elisp-scope--sym-pos name)) (bare (elisp-scope--sym-bare name))) - (when beg (elisp-scope--report 'defun beg (length (symbol-name bare)))) + (when beg (elisp-scope--report 'defun beg bare)) (let ((elisp-scope-block-alist (elisp-scope--local-new bare beg elisp-scope-block-alist))) (elisp-scope-cl-lambda arglist body)))) @@ -1358,7 +1257,7 @@ Optional argument LOCAL is a local context to extend." (if (memq bare '(&optional &rest &body &key &aux &whole &cl-defs &cl-quote)) (progn (when-let* ((beg (elisp-scope--sym-pos head))) - (elisp-scope--report 'ampersand beg (length (symbol-name bare)))) + (elisp-scope--report 'ampersand beg bare)) (cl-case bare (&optional (elisp-scope-cl-lambda-optional (cadr arglist) (cddr arglist) more body)) (&cl-defs (elisp-scope-cl-lambda-defs (cadr arglist) (cddr arglist) more body)) @@ -1367,7 +1266,7 @@ Optional argument LOCAL is a local context to extend." (&aux (elisp-scope-cl-lambda-aux (cadr arglist) (cddr arglist) more body)) (&whole (elisp-scope-cl-lambda-1 (cdr arglist) more body)))) (when-let* ((beg (elisp-scope--sym-pos head))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (let ((elisp-scope-local-bindings (elisp-scope--local-new bare (elisp-scope--sym-pos head) elisp-scope-local-bindings))) @@ -1399,11 +1298,11 @@ Optional argument LOCAL is a local context to extend." body)) (when-let* ((bare (elisp-scope--sym-bare svar))) (when-let* ((beg (elisp-scope--sym-pos svar))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos svar) l))) (when-let* ((bare (elisp-scope--sym-bare var))) (when-let* ((beg (elisp-scope--sym-pos var))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos var) l))) (cond (arglist @@ -1412,7 +1311,7 @@ Optional argument LOCAL is a local context to extend." ((memq bare '(&rest &body &key &aux)))) (progn (when-let* ((beg (elisp-scope--sym-pos head))) - (elisp-scope--report 'ampersand beg (length (symbol-name bare)))) + (elisp-scope--report 'ampersand beg bare)) (cl-case bare ((&rest &body) (let ((elisp-scope-local-bindings l)) @@ -1434,16 +1333,16 @@ Optional argument LOCAL is a local context to extend." (elisp-scope-cl-lambda-1 var (cons arglist more) body) (when-let* ((bare (elisp-scope--sym-bare var))) (when-let* ((beg (elisp-scope--sym-pos var))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos var) l))) (cond (arglist - (let ((head (car arglist))) - (if-let* ((bare (elisp-scope--sym-bare head)) - ((memq bare '(&key &aux)))) + (let* ((head (car arglist)) + (bare (elisp-scope--sym-bare head))) + (if (memq bare '(&key &aux)) (progn (when-let* ((beg (elisp-scope--sym-pos head))) - (elisp-scope--report 'ampersand beg (length (symbol-name bare)))) + (elisp-scope--report 'ampersand beg bare)) (cl-case bare (&key (let ((elisp-scope-local-bindings l)) @@ -1474,7 +1373,7 @@ Optional argument LOCAL is a local context to extend." (when-let* ((bare (elisp-scope--sym-bare kw)) ((keywordp bare))) (when-let* ((beg (elisp-scope--sym-pos kw))) - (elisp-scope--report 'constant beg (length (symbol-name bare)))) + (elisp-scope--report 'constant beg bare)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos svar) l))) (if (consp var) (let ((elisp-scope-local-bindings l)) @@ -1484,20 +1383,20 @@ Optional argument LOCAL is a local context to extend." body)) (when-let* ((bare (elisp-scope--sym-bare svar))) (when-let* ((beg (elisp-scope--sym-pos svar))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos svar) l))) (when-let* ((bare (elisp-scope--sym-bare var))) (when-let* ((beg (elisp-scope--sym-pos var))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos var) l))) (cond (arglist - (let ((head (car arglist))) - (if-let* ((bare (elisp-scope--sym-bare head)) - ((memq bare '(&aux &allow-other-keys)))) + (let* ((head (car arglist)) + (bare (elisp-scope--sym-bare head))) + (if (memq bare '(&aux &allow-other-keys)) (progn (when-let* ((beg (elisp-scope--sym-pos head))) - (elisp-scope--report 'ampersand beg (length (symbol-name bare)))) + (elisp-scope--report 'ampersand beg bare)) (cl-case bare (&aux (let ((elisp-scope-local-bindings l)) @@ -1523,7 +1422,7 @@ Optional argument LOCAL is a local context to extend." (elisp-scope-cl-lambda-1 var (cons arglist more) body)) (when-let* ((bare (elisp-scope--sym-bare var))) (when-let* ((beg (elisp-scope--sym-pos var))) - (elisp-scope--binding bare beg (length (symbol-name bare)))) + (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare (elisp-scope--sym-pos var) l))) (let ((elisp-scope-local-bindings l)) (cond @@ -1537,16 +1436,15 @@ Optional argument LOCAL is a local context to extend." (arglist (cadr b)) (mbody (cddr b))) (elisp-scope-cl-lambda arglist mbody) - (when-let* ((bare (elisp-scope--sym-bare name)) - (len (length (symbol-name bare)))) + (when-let* ((bare (elisp-scope--sym-bare name))) (let ((beg (elisp-scope--sym-pos name))) ;; TODO: Use a bespoke 'local-macro-definition' role. - (when beg (elisp-scope--report 'macro beg len beg)) + (when beg (elisp-scope--report 'macro beg bare beg)) (let ((pos (or beg (cons 'gen (incf elisp-scope--counter))))) (elisp-scope-with-local-definition bare (lambda (f &rest _) (when (symbol-with-pos-p f) - (elisp-scope--report 'macro (symbol-with-pos-pos f) len pos))) + (elisp-scope--report 'macro (symbol-with-pos-pos f) bare pos))) (elisp-scope-cl-macrolet (cdr bindings) body outspec)))))) (elisp-scope-n body outspec))) @@ -1556,7 +1454,7 @@ Optional argument LOCAL is a local context to extend." (bkw (elisp-scope--sym-bare kw)) ((keywordp bkw))) (when-let* ((beg (elisp-scope--sym-pos kw))) - (elisp-scope--report 'constant beg (length (symbol-name bkw)))) + (elisp-scope--report 'constant beg bkw)) (cl-case bkw ((:init-value :keymap :after-hook :initialize) (elisp-scope-1 (cadr body))) @@ -1586,9 +1484,9 @@ Optional argument LOCAL is a local context to extend." (setq body (cddr body))) (when-let* ((bare (elisp-scope--sym-bare mode)) (beg (elisp-scope--sym-pos mode)) (typ (if command 'defcmd 'defun))) - (elisp-scope--report typ beg (length (symbol-name bare))) + (elisp-scope--report typ beg bare) (unless explicit-var - (elisp-scope--report 'defvar beg (length (symbol-name bare))))) + (elisp-scope--report 'defvar beg bare))) (elisp-scope-n body))) (defun elisp-scope-global-minor-mode-predicate (pred) @@ -1601,9 +1499,8 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-major-mode-name (mode) (when-let* ((beg (elisp-scope--sym-pos mode)) (bare (bare-symbol mode)) - ((not (booleanp bare))) - (len (length (symbol-name bare)))) - (elisp-scope--report 'major-mode beg len))) + ((not (booleanp bare)))) + (elisp-scope--report 'major-mode beg bare))) (defun elisp-scope-mode-line-construct (format) (elisp-scope-mode-line-construct-1 format)) @@ -1611,9 +1508,7 @@ Optional argument LOCAL is a local context to extend." (defun elisp-scope-mode-line-construct-1 (format) (cond ((symbol-with-pos-p format) - (elisp-scope--report 'free-variable - (symbol-with-pos-pos format) - (length (symbol-name (bare-symbol format))))) + (elisp-scope--report 'free-variable (symbol-with-pos-pos format) (bare-symbol format))) ((consp format) (let ((head (car format))) (cond @@ -1626,10 +1521,10 @@ Optional argument LOCAL is a local context to extend." (elisp-scope-1 (cadr format))) (:propertize (elisp-scope-mode-line-construct-1 (cadr format)) - (when-let* ((props (cdr format)) + (when-let* ((props (cddr format)) (symbols-with-pos-enabled t) (val-form (plist-get props 'face))) - (elisp-scope-face-1 val-form))) + (elisp-scope-quote val-form 'face))) (otherwise (elisp-scope-mode-line-construct-1 (cadr format)) (elisp-scope-mode-line-construct-1 (caddr format)))))))))) @@ -1915,10 +1810,7 @@ ARGS bound to the analyzed arguments." (elisp-scope-define-function-analyzer custom-declare-face (face spec doc &rest args) (elisp-scope-1 face '(symbol . defface)) - ;; TODO: Use `elisp-scope-1' with an appropriate outspec. - (if-let* ((q (elisp-scope--unquote spec))) - (when (consp q) (dolist (s q) (elisp-scope-face (cdr s)))) - (elisp-scope-1 spec)) + (elisp-scope-1 spec '(repeat . (cons t . (plist (:inherit . (symbol . face)))))) (elisp-scope-1 doc) (while-let ((kw (car-safe args)) (bkw (elisp-scope--sym-bare kw)) @@ -1962,17 +1854,16 @@ ARGS bound to the analyzed arguments." (elisp-scope-define-function-analyzer overlay-put (&optional ov prop val) (elisp-scope-1 ov) (elisp-scope-1 prop) ;TODO: Recognize overlay props. - (if-let* ((q (elisp-scope--unquote prop)) - ((eq (elisp-scope--sym-bare q) 'face)) - (face (elisp-scope--unquote val))) - ;; TODO: Use `elisp-scope-1' with an appropriate outspec. - (elisp-scope-face face) - (elisp-scope-1 val))) + (elisp-scope-1 + val + (let* ((q (elisp-scope--unquote prop))) + (when (memq (elisp-scope--sym-bare q) '(face mouse-face)) + 'face)))) (elisp-scope-define-function-analyzer add-face-text-property (&optional start end face &rest rest) (elisp-scope-1 start) (elisp-scope-1 end) - (elisp-scope-1 face '(symbol . face)) + (elisp-scope-1 face 'face) (elisp-scope-n rest)) (elisp-scope-define-function-analyzer facep (&optional face &rest rest) @@ -2029,12 +1920,11 @@ ARGS bound to the analyzed arguments." (elisp-scope-1 beg) (elisp-scope-1 end) (elisp-scope-1 prop) - (if-let* (((memq (elisp-scope--sym-bare (elisp-scope--unquote prop)) - '(mouse-face face))) - (q (elisp-scope--unquote val))) - ;; TODO: Use `elisp-scope-1' with an appropriate outspec. - (elisp-scope-face q) - (elisp-scope-1 val)) + (elisp-scope-1 + val + (let* ((q (elisp-scope--unquote prop))) + (when (memq (elisp-scope--sym-bare q) '(face mouse-face)) + 'face))) (elisp-scope-1 obj)) (put 'remove-overlays 'elisp-scope-analyzer #'elisp-scope--analyze-put-text-property) @@ -2043,13 +1933,11 @@ ARGS bound to the analyzed arguments." (elisp-scope-1 string) (while props (elisp-scope-1 (car props)) - (cl-case (elisp-scope--sym-bare (elisp-scope--unquote (car props))) - ((face mouse-face) - (if-let* ((q (elisp-scope--unquote (cadr props)))) - ;; TODO: Use `elisp-scope-1' with an appropriate outspec. - (elisp-scope-face q) - (elisp-scope-1 (cadr props)))) - (otherwise (elisp-scope-1 (cadr props)))) + (elisp-scope-1 + (cadr props) + (let* ((q (elisp-scope--unquote (car props)))) + (when (memq (elisp-scope--sym-bare q) '(face mouse-face)) + 'face))) (setq props (cddr props))) (when props (elisp-scope-n props))) @@ -2273,9 +2161,8 @@ ARGS bound to the analyzed arguments." (form (when (consp binding) (if (cdr binding) (cadr binding) (car binding)))) (bare (elisp-scope--sym-bare sym)) - (len (length (symbol-name bare))) (beg (elisp-scope--sym-pos sym))) - (when beg (elisp-scope--binding bare beg len)) + (when beg (elisp-scope--binding bare beg)) (when form (elisp-scope-1 form)) (let ((elisp-scope-local-bindings (elisp-scope--local-new bare beg elisp-scope-local-bindings))) @@ -2311,9 +2198,8 @@ ARGS bound to the analyzed arguments." (let* ((binding (ensure-list (car bindings))) (sym (car binding)) (bare (elisp-scope--sym-bare sym)) - (len (length (symbol-name bare))) (beg (elisp-scope--sym-pos sym))) - (when beg (elisp-scope--binding bare beg len)) + (when beg (elisp-scope--binding bare beg)) (elisp-scope-1 (cadr binding)) (elisp-scope-oclosure-lambda-1 (if bare (elisp-scope--local-new bare beg local) local) @@ -2382,7 +2268,7 @@ ARGS bound to the analyzed arguments." (let* ((label (car labels)) (bare (elisp-scope--sym-bare label))) (when-let* ((beg (elisp-scope--sym-pos label))) - (elisp-scope--report 'label beg (length (symbol-name bare)) beg)) + (elisp-scope--report 'label beg bare beg)) (let ((elisp-scope-label-alist (if bare (elisp-scope--local-new bare (elisp-scope--sym-pos label) elisp-scope-label-alist) @@ -2395,7 +2281,7 @@ ARGS bound to the analyzed arguments." (when-let* ((bare (elisp-scope--sym-bare label)) (pos (alist-get bare elisp-scope-label-alist)) (beg (elisp-scope--sym-pos label))) - (elisp-scope--report 'label beg (length (symbol-name bare)) pos))) + (elisp-scope--report 'label beg bare pos))) (elisp-scope-define-macro-analyzer rx-define (name &rest rest) (elisp-scope-rx-define name rest)) @@ -2421,10 +2307,8 @@ ARGS bound to the analyzed arguments." (elisp-scope-define-macro-analyzer nnoo-define-basics (&optional backend) ;; Unsafe macro! - (let* ((bare (bare-symbol backend)) - (len (length (symbol-name bare))) - (beg (elisp-scope--sym-pos backend))) - (when beg (elisp-scope--report 'nnoo-backend beg len)))) + (when-let* ((beg (elisp-scope--sym-pos backend))) + (elisp-scope--report 'nnoo-backend beg (bare-symbol backend)))) (elisp-scope-define-macro-analyzer gv-define-expander (name handler) (elisp-scope-gv-define-expander name handler)) @@ -2464,11 +2348,7 @@ ARGS bound to the analyzed arguments." (bkw (elisp-scope--sym-bare kw)) ((keywordp bkw))) (elisp-scope-report-s kw 'constant) - (cl-case bkw - (:face - (if-let* ((q (elisp-scope--unquote (cadr props)))) (elisp-scope-face-1 q) - (elisp-scope-1 (cadr props)))) - (otherwise (elisp-scope-1 (cadr props)))) + (elisp-scope-1 (cadr props) (when (eq bkw :face) 'face)) (setq props (cddr props)))) (elisp-scope-define-macro-analyzer cl-letf (bindings &rest body) @@ -2477,9 +2357,8 @@ ARGS bound to the analyzed arguments." (let ((place (car binding))) (if (or (symbol-with-pos-p place) (symbolp place)) (let* ((bare (bare-symbol place)) - (len (length (symbol-name bare))) (beg (elisp-scope--sym-pos place))) - (when beg (elisp-scope--binding bare beg len)) + (when beg (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare beg l))) (elisp-scope-1 place)) (elisp-scope-1 (cadr binding)))) @@ -2530,22 +2409,13 @@ ARGS bound to the analyzed arguments." (let ((l elisp-scope-local-bindings)) (dolist (arg args) (let* ((bare (elisp-scope--sym-bare arg)) - (len (length (symbol-name bare))) (beg (elisp-scope--sym-pos arg))) (if (eq bare '&rest) - (elisp-scope--report 'ampersand beg len) - (when beg (elisp-scope--binding bare beg len)) + (elisp-scope--report 'ampersand beg bare) + (when beg (elisp-scope--binding bare beg)) (setq l (elisp-scope--local-new bare beg l))))) (let ((elisp-scope-local-bindings l)) (elisp-scope-n body)))) -(elisp-scope-define-analyzer let-alist (f alist &rest body) - (elisp-scope-report-s f 'macro) - (elisp-scope-1 alist) - (let ((elisp-scope--current-let-alist-form - (cons (or (elisp-scope--sym-pos f) (cons 'gen (incf elisp-scope--counter))) - (elisp-scope--sym-pos f)))) - (elisp-scope-n body))) - (elisp-scope-define-macro-analyzer define-obsolete-face-alias (&optional obs cur when) (when-let* ((q (elisp-scope--unquote obs))) (elisp-scope-report-s q 'defface)) (when-let* ((q (elisp-scope--unquote cur))) (elisp-scope-report-s q 'face)) @@ -2602,7 +2472,7 @@ ARGS bound to the analyzed arguments." (let* ((bare (bare-symbol var)) (beg (when (symbol-with-pos-p var) (symbol-with-pos-pos var))) (l (elisp-scope--local-new bare beg elisp-scope-local-bindings))) - (when beg (elisp-scope--binding bare beg (length (symbol-name bare)))) + (when beg (elisp-scope--binding bare beg)) (elisp-scope-1 bodyform elisp-scope-output-spec) (dolist (handler handlers) (dolist (cond-name (ensure-list (car-safe handler))) @@ -2611,8 +2481,8 @@ ARGS bound to the analyzed arguments." (clen (length (symbol-name cbare)))) (cond ((booleanp cbare)) - ((keywordp cbare) (elisp-scope--report 'constant cbeg clen)) - (t (elisp-scope--report 'condition cbeg clen))))) + ((keywordp cbare) (elisp-scope--report 'constant cbeg cbare)) + (t (elisp-scope--report 'condition cbeg cbare))))) (let ((elisp-scope-local-bindings l)) (elisp-scope-n (cdr handler) elisp-scope-output-spec))))) @@ -2650,7 +2520,6 @@ ARGS bound to the analyzed arguments." (cl-defmethod elisp-scope--handle-quoted ((_spec (eql 'code)) arg) (let ((elisp-scope-local-bindings nil) - (elisp-scope--current-let-alist-form nil) (elisp-scope-local-definitions nil) (elisp-scope-block-alist nil) (elisp-scope-label-alist nil) @@ -2690,6 +2559,18 @@ ARGS bound to the analyzed arguments." (cons (member plist-and-then) . (repeat . (cons (symbol . constant) . spec)))) arg)) +(cl-defmethod elisp-scope--match-spec-to-arg ((_spec (eql 'face)) arg) + (elisp-scope--match-spec-to-arg + (if (consp arg) + (if (keywordp (elisp-scope--sym-bare (car arg))) + ;; One face, given as a plist of face attributes. + '(plist (:inherit . (symbol . face))) + ;; Multiple faces. + '(repeat . (or (symbol . face) + (plist (:inherit . (symbol . face)))))) + '(symbol . face)) + arg)) + (cl-defmethod elisp-scope--match-spec-to-arg ((_spec (eql 'cl-type)) arg) (elisp-scope--match-spec-to-arg ;; Unfold `cl-type'. @@ -2763,8 +2644,7 @@ ARGS bound to the analyzed arguments." (let ((symbols-with-pos-enabled t)) (and (member arg (cdr spec)) t))) (cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist)) arg) - (cond - ((consp arg) + (when (listp arg) (let ((res nil) (go t)) (while (and arg go) (let* ((key (car arg)) @@ -2773,17 +2653,14 @@ ARGS bound to the analyzed arguments." (push (if (keywordp bkw) '(symbol . constant) t) res) (push (setq go (elisp-scope--match-spec-to-arg (alist-get bkw (cdr spec) t) val)) res)) (setq arg (cddr arg))) - (when go (cons 'list (nreverse res))))) - ((null arg) t))) + (when go (cons 'list (nreverse res)))))) (cl-defmethod elisp-scope--match-spec-to-arg ((spec (head list)) arg) - (cond - ((consp arg) + (when (listp arg) (let ((specs (cdr spec)) (go t) res) (while (and specs (setq go (elisp-scope--match-spec-to-arg (pop specs) (pop arg)))) (push go res)) - (when go (cons 'list (nreverse res))))) - ((null arg) t))) + (when go (cons 'list (nreverse res)))))) (cl-defmethod elisp-scope--match-spec-to-arg ((spec (head plist-and-then)) arg) (cond @@ -2831,7 +2708,7 @@ ARGS bound to the analyzed arguments." If SYM is not a symbol with position information, do nothing." (when-let* ((beg (elisp-scope--sym-pos sym)) (bare (bare-symbol sym))) - (elisp-scope--report role beg (length (symbol-name bare))))) + (elisp-scope--report role beg bare))) (defvar-local elisp-scope-buffer-file-name nil) @@ -2896,15 +2773,16 @@ are analyzed." ((macrop bare) (elisp-scope-report-s f 'macro) (cond ((elisp-scope-safe-macro-p bare) - (let* ((warning-minimum-log-level :emergency) + (elisp-scope-1 + (let* ((warning-minimum-log-level :emergency) (macroexp-inhibit-compiler-macros t) (symbols-with-pos-enabled t) (message-log-max nil) (inhibit-message t) (macroexpand-all-environment - (append (mapcar #'list elisp-scope-unsafe-macros) macroexpand-all-environment)) - (expanded (ignore-errors (macroexpand-1 form macroexpand-all-environment)))) - (elisp-scope-1 expanded outspec))) + (append (mapcar #'list elisp-scope-unsafe-macros) macroexpand-all-environment))) + (ignore-errors (macroexpand-1 form macroexpand-all-environment))) + outspec)) ((eq (get bare 'edebug-form-spec) t) (elisp-scope-n forms)))) ((functionp bare) (elisp-scope-report-s f 'function) (elisp-scope-n forms)) @@ -2926,16 +2804,15 @@ It is passed to `elisp-scope-1', which see." "Read and analyze code from STREAM, reporting findings via CALLBACK. Call CALLBACK for each analyzed symbol SYM with arguments ROLE, POS, -LEN, ID and DEF, where ROLE is a symbol that specifies the semantics of -SYM; POS is the position of SYM in STREAM; LEN is SYM's length; ID is an -object that uniquely identifies (co-)occurrences of SYM in the current -defun; and DEF is the position in which SYM is locally defined, or nil. -If SYM is itself a binding occurrence, then POS and BINDER are equal. -If SYM is not lexically bound, then BINDER is nil. This function -ignores `read-symbol-shorthands', so SYM and LEN always correspond to -the symbol as it appears in STREAM. +SYM, ID and DEF, where ROLE is a symbol that specifies the semantics of +SYM; POS is the position of SYM in STREAM; ID is an object that uniquely +identifies (co-)occurrences of SYM in the current defun; and DEF is the +position in which SYM is locally defined, or nil. If SYM is itself a +binding occurrence, then POS and DEF are equal. If SYM is not lexically +bound, then DEF is nil. -If STREAM is nil, it defaults to the current buffer. +If STREAM is nil, it defaults to the current buffer. When reading from +the current buffer, this function leaves point at the end of the form. This function recursively analyzes Lisp forms (HEAD . TAIL), usually starting with a top-level form, by inspecting HEAD at each level: @@ -2965,11 +2842,15 @@ for the `identity' function: (lambda (fsym arg) (elisp-scope-report-s fsym \\='function) (elisp-scope-1 arg elisp-scope-output-spec))" - (let ((elisp-scope--counter 0) - (elisp-scope--callback callback) - (read-symbol-shorthands nil) - (max-lisp-eval-depth 32768)) - (elisp-scope-1 (read-positioning-symbols (or stream (current-buffer)))))) + (let* ((stream (or stream (current-buffer))) + (form (read-positioning-symbols stream)) + (elisp-scope--counter 0) + (elisp-scope--callback callback) + (max-lisp-eval-depth 32768)) + (if (eq stream (current-buffer)) + ;; `save-excursion' so CALLBACK can change point freely. + (save-excursion (elisp-scope-1 form)) + (elisp-scope-1 form)))) (provide 'elisp-scope) ;;; elisp-scope.el ends here diff --git a/lisp/emacs-lisp/icons.el b/lisp/emacs-lisp/icons.el index 83bbfc10cb4..b01cc76275e 100644 --- a/lisp/emacs-lisp/icons.el +++ b/lisp/emacs-lisp/icons.el @@ -194,7 +194,6 @@ present if the icon is represented by an image." (file-exists (and (stringp file) (file-readable-p file)))) (and file-exists (display-images-p) - (fboundp 'image-supported-file-p) (image-supported-file-p file) (propertize " " 'display diff --git a/lisp/emacs-lisp/inline.el b/lisp/emacs-lisp/inline.el index 027c24c465b..20d621d87a8 100644 --- a/lisp/emacs-lisp/inline.el +++ b/lisp/emacs-lisp/inline.el @@ -131,16 +131,25 @@ After VARS is handled, BODY is evaluated in the new environment." ;;;###autoload (defmacro define-inline (name args &rest body) "Define an inline function NAME with arguments ARGS and body in BODY. +This is halfway between `defmacro' and `defun'. BODY is used as a blueprint +both for the body of the function and for the body of the compiler-macro +used to generate the code inlined at each call site. +See Info node `(elisp)Inline Functions for more details. -This is like `defmacro', but has several advantages. -See Info node `(elisp)Defining Functions' for more details." +A (noinline t) in the `declare' form prevents the definition of the +compiler macro. This is for the rare case in which you want to use this +macro to define a function that should not be inlined." ;; FIXME: How can this work with CL arglists? (declare (indent defun) (debug defun) (doc-string 3) - (autoload-macro expand)) ; expand to the defun on autoload gen - (let ((doc (if (stringp (car-safe body)) (list (pop body)))) - (declares (if (eq (car-safe (car-safe body)) 'declare) (pop body))) - (cm-name (intern (format "%s--inliner" name))) - (bodyexp (macroexp-progn body))) + (autoload-macro expand)) ; expand to the defun on autoload gen + (let* ((doc (if (stringp (car-safe body)) (list (pop body)))) + (declares (if (eq (car-safe (car-safe body)) 'declare) (pop body))) + (cm-name (intern (format "%s--inliner" name))) + (noinline-decl (assq 'noinline declares)) + (inline (not (cadr noinline-decl))) + (bodyexp (macroexp-progn body))) + (when noinline-decl + (setq declares (delq noinline-decl declares))) ;; If the function is autoloaded then when we load the .el file, the ;; `compiler-macro' property is already set (from loaddefs.el) and might ;; hence be called during the macroexpand-all calls below (if the function @@ -150,7 +159,8 @@ See Info node `(elisp)Defining Functions' for more details." `(progn (defun ,name ,args ,@doc - (declare (compiler-macro ,cm-name) ,@(cdr declares)) + (declare ,@(when inline `((compiler-macro ,cm-name))) + ,@(cdr declares)) ,(macroexpand-all bodyexp `((inline-quote . inline--dont-quote) ;; (inline-\` . inline--dont-quote) @@ -160,22 +170,23 @@ See Info node `(elisp)Defining Functions' for more details." (inline-const-val . inline--alwaysconst-val) (inline-error . inline--error) ,@macroexpand-all-environment))) - :autoload-end - (eval-and-compile - (defun ,cm-name ,(cons 'inline--form args) - (ignore inline--form) ;In case it's not used! - (catch 'inline--just-use - ,(macroexpand-all - bodyexp - `((inline-quote . inline--do-quote) - ;; (inline-\` . inline--do-quote) - (inline--leteval . inline--do-leteval) - (inline--letlisteval - . inline--do-letlisteval) - (inline-const-p . inline--testconst-p) - (inline-const-val . inline--getconst-val) - (inline-error . inline--warning) - ,@macroexpand-all-environment)))))))) + ,@(when inline + `(:autoload-end + (eval-and-compile + (defun ,cm-name ,(cons 'inline--form args) + (ignore inline--form) ;In case it's not used! + (catch 'inline--just-use + ,(macroexpand-all + bodyexp + `((inline-quote . inline--do-quote) + ;; (inline-\` . inline--do-quote) + (inline--leteval . inline--do-leteval) + (inline--letlisteval + . inline--do-letlisteval) + (inline-const-p . inline--testconst-p) + (inline-const-val . inline--getconst-val) + (inline-error . inline--warning) + ,@macroexpand-all-environment)))))))))) (defun inline--do-quote (exp) (pcase exp diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index e4dfc7c2f78..0756c0f908f 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -729,7 +729,9 @@ font-lock keywords will not be case sensitive." :group 'lisp (lisp-mode-variables nil t nil) (setq-local electric-quote-string t) - (setq imenu-case-fold-search nil)) + (setq imenu-case-fold-search nil) + (setq-local hs-block-start-regexp "\\s(\\|\"") + (setq-local hs-block-end-regexp "\\s)\\|\"")) (defun lisp-outline-level () "Lisp mode `outline-level' function." diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index c8e05921fc1..fcec04115e4 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -593,18 +593,18 @@ If COMPILE, don't include a \"don't compile\" cookie." (buffer-string)))) ;;;###autoload -(defun loaddefs-generate (dir output-file &optional excluded-files - extra-data include-package-version - generate-full) - "Generate loaddefs files for Lisp files in one or more directories given by DIR. -DIR can be either a single directory or a list of directories. +(defun loaddefs-generate (dirs output-file &optional excluded-files + extra-data include-package-version + generate-full) + "Generate loaddefs files for Lisp files in directories given by DIRS. +DIRS can be either a single directory or a list of directories. The autoloads will be written to OUTPUT-FILE. If any Lisp file binds `generated-autoload-file' as a file-local variable, write its autoloads into the specified file instead. -The function does NOT recursively descend into subdirectories of the -directories specified by DIR. +This function does NOT recursively descend into subdirectories of the +directories specified by DIRS. Optional argument EXCLUDED-FILES, if non-nil, should be a list of files, such as preloaded files, whose autoloads should not be written @@ -632,13 +632,18 @@ instead of just updating them with the new/changed autoloads." (mapcar (lambda (d) (directory-files (expand-file-name d) t files-re)) - (if (consp dir) dir (list dir))))) + (ensure-list dirs)))) (updating (and (file-exists-p output-file) (not generate-full))) (defs nil)) ;; Allow the excluded files to be relative. - (setq excluded-files - (mapcar (lambda (file) (expand-file-name file dir)) - excluded-files)) + ;; We used to do (expand-file-name file dirs), which strangely enough + ;; doesn't signal an error when DIRS is a list but does something weird + ;; instead, so let's preserve the old behavior when DIRS is a string, + ;; even tho it's different from what we do when it's a list. + (let ((basedir (if (stringp dirs) dirs))) + (setq excluded-files + (mapcar (lambda (file) (expand-file-name file basedir)) + excluded-files))) ;; Collect all the autoload data. (let ((progress (make-progress-reporter @@ -657,7 +662,15 @@ instead of just updating them with the new/changed autoloads." (file-attributes file)))) ;; If we're scanning for package versions, we want to look ;; at the file even if it's excluded. - (let* ((excluded (member (expand-file-name file dir) excluded-files)) + (let* ((excluded + ;; FIXME: In out-of-tree builds (bug#79694) `excluded-files' + ;; (derived via `lisp-directory' from `invocation-directory') + ;; may end up using names which don't quite match those of + ;; `file' (derived from the command line arguments), w.r.t. + ;; "c:/" vs "C:/" on MS-Windows, so use a test more lax + ;; than `member'. + (let ((x (member-ignore-case file excluded-files))) + (and x (file-equal-p file (car x))))) (package-data (and include-package-version (if excluded 'only t)))) (when (or package-data (not excluded)) @@ -724,7 +737,7 @@ instead of just updating them with the new/changed autoloads." (unless (equal (buffer-hash) hash) (write-region (point-min) (point-max) loaddefs-file nil 'silent) (byte-compile-info - (file-relative-name loaddefs-file (car (ensure-list dir))) + (file-relative-name loaddefs-file (car (ensure-list dirs))) t "GEN"))))) ;; If processing files without any autoloads, the above loop will @@ -776,19 +789,21 @@ instead of just updating them with the new/changed autoloads." ;; Exclude those files that are preloaded on ALL platforms. ;; These are the ones in loadup.el where "(load" is at the start ;; of the line (crude, but it works). - (let ((default-directory (file-name-directory lisp-directory)) - (excludes nil) - file) + (unless (equal default-directory (file-name-as-directory lisp-directory)) + (error "PWD is not set as expected: %S" default-directory)) + (let ((excludes nil)) (with-temp-buffer (insert-file-contents "loadup.el") + (when (= (point-min) (point-max)) (error "Can't find loadup.el")) (while (re-search-forward "^(load \"\\([^\"]+\\)\"" nil t) - (setq file (match-string 1)) - (or (string-match "\\.el\\'" file) - (setq file (format "%s.el" file))) - (or (string-match "\\`site-" file) - (push (expand-file-name file) excludes)))) + (let ((file (match-string 1))) + (unless (string-match "\\`site-" file) + (push (if (string-match "\\.el\\'" file) + file + (format "%s.el" file)) + excludes))))) ;; Don't scan ldefs-boot.el, either. - (cons (expand-file-name "ldefs-boot.el") excludes))) + (cons "ldefs-boot.el" excludes))) ;;;###autoload (defun loaddefs-generate-batch () @@ -806,8 +821,12 @@ use." "Generate the loaddefs for the Emacs build. This is like `loaddefs-generate-batch', but has some specific rules for built-in packages and excluded files." - (let ((args command-line-args-left) - (output-file (expand-file-name "loaddefs.el" lisp-directory))) + (let* ((args command-line-args-left) + ;; We're run from $BUILDDIR/lisp but all the .el(c) files reside + ;; (and are generated) in `lisp-directory' which is in $SRCDIR, + ;; so go there and don't look back. + (default-directory lisp-directory) + (output-file (expand-file-name "loaddefs.el"))) (setq command-line-args-left nil) (loaddefs-generate args output-file @@ -817,12 +836,12 @@ rules for built-in packages and excluded files." ;; updated. (file-newer-than-file-p (expand-file-name "emacs-lisp/loaddefs-gen.el" lisp-directory) - output-file))) - (let ((lisp-mode-autoload-regexp - "^;;;###\\(\\(noexist\\)-\\)?\\(theme-autoload\\)")) + output-file)) + (let ((lisp-mode-autoload-regexp + "^;;;###\\(\\(noexist\\)-\\)?\\(theme-autoload\\)")) (loaddefs-generate - (expand-file-name "../etc/themes/" lisp-directory) - (expand-file-name "theme-loaddefs.el" lisp-directory)))) + (expand-file-name "../etc/themes/") + (expand-file-name "theme-loaddefs.el"))))) ;;;###autoload (load "theme-loaddefs.el" t) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 2bf9e0eb451..e89ad4e17e4 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -399,7 +399,6 @@ change this." (defun macroexp--dynamic-variable-p (var) "Whether the variable VAR is dynamically scoped. Only valid during macro-expansion." - (defvar byte-compile-bound-variables) (or (not lexical-binding) (special-variable-p var) (memq var macroexp--dynvars) diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index 9c08f8dc2eb..385bb6f752c 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -36,6 +36,7 @@ (declare-function x-popup-dialog "menu.c" (position contents &optional header)) (declare-function set-text-conversion-style "textconv.c") +(autoload 'cl--map-keymap-recursively "cl-extra") (defvar overriding-text-conversion-style) @@ -96,6 +97,11 @@ This function uses `query-replace-map' to define the standard responses, but only some of the responses which `query-replace' understands are meaningful here, as described above. +By default, this function uses the minibuffer to read the key +non-modally (see `read-from-minibuffer'). However, if +`y-or-n-p-use-read-key' is non-nil, the modal `read-key' +function is used instead. + The function's value is the number of actions taken." (let* ((actions 0) (msg (current-message)) @@ -161,11 +167,13 @@ The function's value is the number of actions taken." (cond ((stringp prompt) ;; Prompt the user about this object. (setq quit-flag nil) - (if use-menus - (setq def (or (x-popup-dialog (or mouse-event use-menus) - (cons prompt map)) - 'quit)) - ;; Prompt in the echo area. + (cond + (use-menus + (setq def (or (x-popup-dialog (or mouse-event use-menus) + (cons prompt map)) + 'quit))) + (y-or-n-p-use-read-key + ;; Prompt in the echo area using `read-key'. (let ((cursor-in-echo-area (not no-cursor-in-echo-area))) (message "%s" (substitute-command-keys (format @@ -203,7 +211,48 @@ The function's value is the number of actions taken." "[end-of-keyboard-macro]" (single-key-description char)))))) (setq def (lookup-key map (vector char)))) - (cond ((eq def 'exit) + (t + ;; Read from the minibuffer. + (let* ((full-prompt + (substitute-command-keys + (format + (apply #'propertize + "%s(\\`y', \\`n', \\`!', \\`.', \\`q', %sor \\`%s') " + minibuffer-prompt-properties) + prompt user-keys (help-key)))) + (remap (make-sparse-keymap)) + (cmd-char + (lambda () + (interactive) + (setq char last-command-event) + (exit-minibuffer))) + (cmd-help + (lambda () + (interactive) + (message "%s" (substitute-command-keys + (format + "Type \\`%s' for help" + (help-key)))))) + (this-command this-command) + (real-this-command real-this-command) + (enable-recursive-minibuffers t) + (overriding-text-conversion-style nil)) + (set-keymap-parent remap minibuffer-local-map) + (define-key remap [remap self-insert-command] cmd-help) + (cl--map-keymap-recursively + (lambda (key _cmd) + (define-key remap key cmd-char)) + map) + (if minibuffer-auto-raise + (raise-frame (window-frame (minibuffer-window)))) + (when (fboundp 'set-text-conversion-style) + (set-text-conversion-style text-conversion-style)) + (read-from-minibuffer + full-prompt nil remap nil + (or y-or-n-p-history-variable t)) + (message "%s%s" full-prompt (single-key-description char))) + (setq def (lookup-key map (vector char))))) + (cond ((eq def 'exit) (setq next (lambda () nil))) ((eq def 'act) ;; Act on the object. @@ -274,6 +323,8 @@ Type \\`SPC' or \\`y' to %s the current %s; ;; switch-frame event. Put it off until we're done. (setq delayed-switch-frame char) (funcall try-again)) + ((eq def nil) ;; Special case for bug#67836 + (error "Can't use in a kmacro in batch mode")) (t ;; Random char. (message "%s" (substitute-command-keys diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el index 1e88630959d..fb43f53d5b1 100644 --- a/lisp/emacs-lisp/map.el +++ b/lisp/emacs-lisp/map.el @@ -405,7 +405,11 @@ If MAP is a plist, TESTFN defaults to `eq'." (cl-defmethod map-contains-key ((map hash-table) key &optional _testfn) "Return non-nil if MAP contains KEY, ignoring TESTFN." - (hash-table-contains-p key map)) + ;; FIXME: use `hash-table-contains-p' from Compat when available. + (if (fboundp 'hash-table-contains-p) + (hash-table-contains-p key map) + (let ((v '(nil))) + (not (eq v (gethash key map v)))))) (cl-defgeneric map-some (pred map) "Return the first non-nil value from applying PRED to elements of MAP. diff --git a/lisp/emacs-lisp/package-vc.el b/lisp/emacs-lisp/package-vc.el index 7433fce2d89..6642522d11e 100644 --- a/lisp/emacs-lisp/package-vc.el +++ b/lisp/emacs-lisp/package-vc.el @@ -371,7 +371,7 @@ otherwise it's assumed to be an Info file." (let* ((pkg-name (package-desc-name pkg-desc)) (default-directory (package-desc-dir pkg-desc)) (docs-directory (file-name-directory (expand-file-name file))) - (output (expand-file-name (format "%s.info" pkg-name))) + (output (expand-file-name (format "%s.info" (file-name-base file)))) (log-buffer (get-buffer-create (format " *package-vc doc: %s*" pkg-name))) clean-up) (with-current-buffer log-buffer @@ -393,15 +393,16 @@ otherwise it's assumed to be an Info file." "--no-split" file "-o" output)) (message "Failed to build manual %s, see buffer %S" - file (buffer-name))) + file (buffer-name log-buffer))) ((/= 0 (call-process "install-info" nil log-buffer nil output (expand-file-name "dir"))) (message "Failed to install manual %s, see buffer %S" - output (buffer-name))) + output (buffer-name log-buffer))) ((kill-buffer log-buffer)))) (error (with-current-buffer log-buffer (insert (error-message-string err))) - (message "Failed to export org manual for %s, see buffer %S" pkg-name log-buffer))) + (message "Failed to export org manual for %s, see buffer %S" + pkg-name (buffer-name log-buffer)))) (when clean-up (delete-file file)))) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index c39c8bf24cc..63124706e28 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2341,7 +2341,7 @@ from ELPA by either using `\\[package-upgrade]' or `\\\\[package-menu-mark-install]' after `\\[list-packages]'." (interactive (list (not noninteractive))) (package-refresh-contents) - (let ((upgradeable (package--upgradeable-packages))) + (let ((upgradeable (package--upgradeable-packages package-install-upgrade-built-in))) (if (not upgradeable) (message "No packages to upgrade") (when (and query diff --git a/lisp/emacs-lisp/range.el b/lisp/emacs-lisp/range.el index 770bf572289..300329124ad 100644 --- a/lisp/emacs-lisp/range.el +++ b/lisp/emacs-lisp/range.el @@ -198,6 +198,7 @@ these ranges." Note: LIST has to be sorted over `<'." (if (not ranges) (range-compress-list list) + (setq ranges (copy-tree ranges)) (setq list (copy-sequence list)) (unless (listp (cdr ranges)) (setq ranges (list ranges))) diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el index 158c1e857cc..f01ef7a5c43 100644 --- a/lisp/emacs-lisp/rmc.el +++ b/lisp/emacs-lisp/rmc.el @@ -63,7 +63,15 @@ (let* ((buf-name (if (stringp show-help) show-help "*Multiple Choice Help*")) - (buf (get-buffer-create buf-name))) + (buf (get-buffer-create buf-name)) + ;; Show non-selected resized Help window at bottom. + (help-window-select nil) + (display-buffer-base-action + `(display-buffer--maybe-at-bottom + . ((window-height . ,#'fit-window-to-buffer)))) + ;; Inhibit useless message "Type q in help window to delete it". + (set-message-functions (cons 'inhibit-message set-message-functions)) + (inhibit-message-regexps (cons "^Type " inhibit-message-regexps))) (if (stringp help-string) (with-help-window buf (with-current-buffer buf @@ -71,7 +79,6 @@ (with-help-window buf (with-current-buffer buf (erase-buffer) - (pop-to-buffer buf) (insert prompt "\n\n") (let* ((columns (/ (window-width) 25)) (fill-column 21) @@ -145,11 +152,16 @@ If optional argument SHOW-HELP is non-nil, show the help screen immediately, before any user input. If SHOW-HELP is a string, use it as the name of the help buffer. -This function translates user input into responses by consulting -the bindings in `query-replace-map'; see the documentation of -that variable for more information. The relevant bindings for the -purposes of this function are `recenter', `scroll-up', `scroll-down', -and `edit'. +By default, this function uses the minibuffer to read the key +non-modally (see `read-from-minibuffer'). However, if +`read-char-choice-use-read-key' is non-nil, the modal `read-key' +function is used instead. + +In case of using the modal `read-key', this function translates user +input into responses by consulting the bindings in `query-replace-map'; +see the documentation of that variable for more information. The +relevant bindings for the purposes of this function are `recenter', +`scroll-up', `scroll-down', and `edit'. If the user types the `recenter', `scroll-up', or `scroll-down' responses, the function performs the requested window recentering or scrolling, and then asks the question again. If the user enters `edit', @@ -174,10 +186,14 @@ Usage example: \\='((?a \"always\") (?s \"session only\") (?n \"no\")))" - (if long-form - (read-multiple-choice--long-answers prompt choices) - (read-multiple-choice--short-answers - prompt choices help-string show-help))) + (cond (long-form + (read-multiple-choice--long-answers prompt choices)) + ((or read-char-choice-use-read-key (use-dialog-box-p)) + (read-multiple-choice--short-answers + prompt choices help-string show-help)) + (t + (read-multiple-choice--from-minibuffer + prompt choices help-string show-help)))) (declare-function touch-screen-scroll "touch-screen.el") (declare-function touch-screen-pinch "touch-screen.el") @@ -313,6 +329,66 @@ Usage example: (equal (cadr elem) answer)) choices))) +(defvar overriding-text-conversion-style) + +(defun read-multiple-choice--from-minibuffer (prompt choices help-string show-help) + ;; Read short answers from the minibuffer. + (let* ((prompt-choices + (if show-help choices (append choices '((?? "?"))))) + (altered-names (mapcar #'rmc--add-key-description prompt-choices)) + (full-prompt + (format + "%s (%s): " + prompt + (mapconcat #'cdr altered-names ", "))) + tchar buf + (map (make-sparse-keymap)) + (cmd-char + (lambda () + (interactive) + (setq tchar last-command-event) + (exit-minibuffer))) + (cmd-help + (lambda () + (interactive) + (setq buf (rmc--show-help prompt help-string show-help + choices altered-names)))) + (cmd-wrong + (lambda () + (interactive) + (ding) + (setq buf (rmc--show-help prompt help-string show-help + choices altered-names)) + (minibuffer-message "Invalid choice") + (sit-for 2))) + (this-command this-command) + (real-this-command real-this-command) + (enable-recursive-minibuffers t) + (overriding-text-conversion-style nil)) + + (unwind-protect + (progn + (when show-help + (setq buf (rmc--show-help prompt help-string show-help + choices altered-names))) + + (set-keymap-parent map minibuffer-local-map) + (dolist (char choices) + (define-key map `[,(car char)] cmd-char)) + (define-key map [help-char] cmd-help) + (unless show-help (define-key map [??] cmd-help)) + (define-key map [remap self-insert-command] cmd-wrong) + + (when (fboundp 'set-text-conversion-style) + (set-text-conversion-style text-conversion-style)) + (read-from-minibuffer full-prompt nil map)) + + (when (buffer-live-p buf) + (let ((kill-buffer-quit-windows t)) + (kill-buffer buf)))) + + (assq tchar choices))) + (provide 'rmc) ;;; rmc.el ends here diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 617a0fb1d40..77237b8e5a7 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -267,13 +267,6 @@ Return (REGEXP . PRECEDENCE)." "Regexp that never matches anything." (cons (list regexp-unmatchable) 'seq)) -;; `cl-every' replacement to avoid bootstrapping problems. -(defun rx--every (pred list) - "Whether PRED is true for every element of LIST." - (while (and list (funcall pred (car list))) - (setq list (cdr list))) - (null list)) - (defun rx--foldl (f x l) "(F (F (F X L0) L1) L2) ... Left-fold the list L, starting with X, by the binary function F." @@ -454,10 +447,10 @@ Each element of ARGS should have been normalised using (defun rx--all-string-branches-p (forms) "Whether FORMS are all strings or `or' forms with the same property." - (rx--every (lambda (x) (or (stringp x) - (and (eq (car-safe x) 'or) - (rx--all-string-branches-p (cdr x))))) - forms)) + (all (lambda (x) (or (stringp x) + (and (eq (car-safe x) 'or) + (rx--all-string-branches-p (cdr x))))) + forms)) (defun rx--collect-or-strings (forms) "All strings from FORMS, which are strings or `or' forms." @@ -598,10 +591,10 @@ classes." ;; regexp engine. Ranges from ASCII to raw bytes will exclude the ;; all non-ASCII non-raw bytes, and ranges from non-ASCII Unicode ;; to raw bytes are ignored. - (unless (or classes - ;; Any interval set covering #x3fff7f should be negated. - (rx--every (lambda (iv) (not (<= (car iv) #x3fff7f (cdr iv)))) - intervals)) + (when (and (not classes) + ;; Any interval set covering #x3fff7f should be negated. + (any (lambda (iv) (<= (car iv) #x3fff7f (cdr iv))) + intervals)) (setq negated (not negated)) (setq intervals (rx--interval-set-complement intervals))) (cond @@ -1132,7 +1125,7 @@ DEF is the definition tuple. Return (REGEXP . PRECEDENCE)." (when (and max-args (> nargs max-args)) (error "The `%s' form takes at most %d argument(s)" (car form) max-args)) - (when (and predicate (not (rx--every predicate (cdr form)))) + (when (and predicate (not (all predicate (cdr form)))) (error "The `%s' form requires arguments satisfying `%s'" (car form) predicate)) (let ((regexp (funcall fn form))) @@ -1535,7 +1528,7 @@ TAIL is on the form ([ARGLIST] DEFINITION)." (`(,def) (list def)) (`(,args ,def) - (unless (and (listp args) (rx--every #'symbolp args)) + (unless (and (listp args) (all #'symbolp args)) (error "Bad argument list for `rx' definition %s: %S" name args)) (list args def)) (_ (error "Bad `rx' definition of %s: %S" name tail)))) @@ -1685,10 +1678,6 @@ following constructs: REF can be a number, as usual, or a name introduced by a previous (let REF ...) construct." - ;; FIXME: We can't rely on the surrounding lexical context because - ;; `pcase-defmacro' wraps this function inside an `eval-and-compile', - ;; so we have to repeat the (defvar rx--pcase-vars). - (defvar rx--pcase-vars) (let* ((rx--pcase-vars nil) (regexp (rx--to-expr (rx--pcase-transform (cons 'seq regexps))))) `(and (pred stringp) diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 754b2016d9e..7b8ecd1b260 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -761,6 +761,15 @@ A FUNC form can have any number of `:no-eval' (or `:no-value'), :eval (take 3 '(one two three four))) (ntake :eval (ntake 3 (list 'one 'two 'three 'four))) + (take-while + :eval (take-while #'numberp '(1 2 three 4 five))) + (drop-while + :eval (drop-while #'numberp '(1 2 three 4 five))) + (any + :eval (any #'symbolp '(1 2 three 4 five))) + (all + :eval (all #'symbolp '(one 2 three)) + :eval (all #'symbolp '(one two three))) (elt :eval (elt '(one two three) 1)) (car-safe diff --git a/lisp/epa-hook.el b/lisp/epa-hook.el index 0f83528bae5..61dba3f244d 100644 --- a/lisp/epa-hook.el +++ b/lisp/epa-hook.el @@ -99,11 +99,10 @@ interface, update `file-name-handler-alist'." (define-minor-mode auto-encryption-mode "Toggle automatic file encryption/decryption (Auto Encryption mode)." :global t :init-value t :group 'epa-file :version "23.1" - ;; We'd like to use custom-initialize-set here so the setup is done - ;; before dumping, but at the point where the defcustom is evaluated, + ;; At the point where the defcustom is evaluated, ;; the corresponding function isn't defined yet, so - ;; custom-initialize-set signals an error. - :initialize 'custom-initialize-delay + ;; custom-initialize-set would signal an error. + :initialize #'custom-initialize-after-file-load (setq file-name-handler-alist (delq epa-file-handler file-name-handler-alist)) (remove-hook 'find-file-hook 'epa-file-find-file-hook) diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el index d293e6ba878..e383e92c7ff 100644 --- a/lisp/erc/erc-common.el +++ b/lisp/erc/erc-common.el @@ -100,7 +100,7 @@ ERC only refolds `string', never `substxt'.")) :named) "Object containing channel-specific data for a single user." ;; voice halfop op admin owner - (status 0 :type integer) + (status 0 :type natnum) ;; Last message time (in the form of the return value of ;; (current-time) ;; diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 6ebb137311b..271c5d5fcf8 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -12,7 +12,7 @@ ;; David Edmondson (dme@dme.org) ;; Michael Olson (mwolson@gnu.org) ;; Kelvin White (kwhite@gnu.org) -;; Version: 5.6.1-git +;; Version: 5.6.2-git ;; Package-Requires: ((emacs "27.1") (compat "29.1.4.5")) ;; Keywords: IRC, chat, client, Internet ;; URL: https://www.gnu.org/software/emacs/erc.html @@ -70,7 +70,7 @@ (require 'auth-source) (eval-when-compile (require 'subr-x)) -(defconst erc-version "5.6.1-git" +(defconst erc-version "5.6.2-git" "This version of ERC.") (defvar erc-official-location @@ -88,7 +88,8 @@ ("5.4.1" . "29.1") ("5.5" . "29.1") ("5.6" . "30.1") - ("5.6.1" . "31.1"))) + ("5.6.1" . "31.1") + ("5.6.2" . "31.1"))) (defgroup erc nil "Emacs Internet Relay Chat client." @@ -683,6 +684,11 @@ Also remove members from the server table if this was their only buffer." (funcall original-function nick user)))))) (erc-remove-channel-users))) +(defvar erc-channel-user-signal-if-status-unknown nil + "If non-nil ERC signals before setting an unadvertized status prefix. +But only in ERC buffers. Otherwise, if nil, accessors like +`erc-channel-user-halfop' ignore such attempts and return nil.") + (defmacro erc--define-channel-user-status-compat-getter (name c d) "Define accessor with gv getter for historical `erc-channel-user' slot NAME. Expect NAME to be a string, C to be its traditionally associated letter, @@ -690,19 +696,30 @@ and D to be its fallback power-of-2 integer for non-ERC buffers. Unlike pre-ERC-5.6 accessors, do not bother generating a compiler macro for inlining calls to these adapters." `(defun ,(intern (concat "erc-channel-user-" name)) (u) - ,(format "Get equivalent of pre-5.6 `%s' slot for `erc-channel-user'." - name) - (declare (gv-setter (lambda (v) - (macroexp-let2 nil v v - (,'\`(let ((val (erc-channel-user-status ,',u)) - (n (or (erc--get-prefix-flag ,c) ,d))) - (setf (erc-channel-user-status ,',u) - (if ,',v - (logior val n) - (logand val (lognot n)))) - ,',v)))))) - (let ((n (or (erc--get-prefix-flag ,c) ,d))) - (= n (logand n (erc-channel-user-status u)))))) + ,(concat + "Get equivalent of pre-5.6 `" name "' slot for `erc-channel-user'." + "\nUse a fallback value in non-ERC buffers. Treat an unadvertised" + "\nstatus according to `erc-channel-user-signal-if-status-unknown'.") + (declare (gv-setter + (lambda (v) + (macroexp-let2 nil v v + (,'\`(let* ((val (erc-channel-user-status ,',u)) + (p (erc--parsed-prefix)) + (n (if p (or (erc--get-prefix-flag ,c p) 0) ,d)) + (nop (and p ,',v (zerop n))) ; unsupportedp + (rv (and (not nop) ,',v))) + (when (and nop + erc-channel-user-signal-if-status-unknown) + (error "Unsupported status prefix: %c" ,c)) + (unless nop + (setf (erc-channel-user-status ,',u) + (if ,',v + (logior val n) + (logand val (lognot n))))) + rv)))))) + (let* ((p (erc--parsed-prefix)) + (n (if p (erc--get-prefix-flag ,c p) ,d))) + (and n (= n (logand n (erc-channel-user-status u))))))) (erc--define-channel-user-status-compat-getter "voice" ?v 1) (erc--define-channel-user-status-compat-getter "halfop" ?h 2) @@ -7089,7 +7106,7 @@ Used when a channel names list is about to be received. Should be called with the current buffer set to the channel buffer. See also `erc-channel-end-receiving-names'." - (setq erc-channel-new-member-names (make-hash-table :test 'equal))) + (setq erc-channel-new-member-names (make-hash-table :test #'equal))) (defun erc-channel-end-receiving-names () "Internal function. @@ -7141,7 +7158,7 @@ stand-in from the fallback value \"(qaohv)~&@%+\"." :alist (nreverse alist))))) (defun erc--get-prefix-flag (char &optional parsed-prefix from-prefix-p) - "Return numeric rank for CHAR or nil if unknown. + "Return numeric rank for CHAR or nil if unknown or unsupported. For example, given letters \"qaohv\" return 1 for ?v, 2 for ?h, and 4 for ?o, etc. If given, expect PARSED-PREFIX to be a `erc--parsed-prefix' object. With FROM-PREFIX-P, expect CHAR to diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el index 15dfd90dd8a..b41f7aa9055 100644 --- a/lisp/eshell/esh-mode.el +++ b/lisp/eshell/esh-mode.el @@ -128,7 +128,10 @@ buffer. If `this', scroll only the selected window. See `eshell-preinput-scroll-to-bottom'." :type '(radio (const :tag "Do not scroll Eshell windows" nil) - (const :tag "Scroll all windows showing the buffer" all) + (choice :tag "Scroll all windows showing the buffer" + :value all + (const t) + (const all)) (const :tag "Scroll only the selected window" this))) (defcustom eshell-scroll-to-bottom-on-output nil @@ -140,7 +143,10 @@ scroll only those that are not the selected window. See variable `eshell-scroll-show-maximum-output' and function `eshell-postoutput-scroll-to-bottom'." :type '(radio (const :tag "Do not scroll Eshell windows" nil) - (const :tag "Scroll all windows showing the buffer" all) + (choice :tag "Scroll all windows showing the buffer" + :value all + (const t) + (const all)) (const :tag "Scroll only the selected window" this) (const :tag "Scroll all windows other than selected" others))) diff --git a/lisp/font-core.el b/lisp/font-core.el index 7c8230f54e7..41bdb94085c 100644 --- a/lisp/font-core.el +++ b/lisp/font-core.el @@ -270,9 +270,7 @@ means that Font Lock mode is turned on for buffers in C and C++ modes only." (define-globalized-minor-mode global-font-lock-mode font-lock-mode turn-on-font-lock-if-desired - ;; What was this :extra-args thingy for? --Stef - ;; :extra-args (dummy) - :initialize 'custom-initialize-delay + :initialize #'custom-initialize-delay :init-value (not (or noninteractive emacs-basic-display)) :group 'font-lock :version "22.1") diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 0d1bd18ee23..0f3c303316b 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -560,8 +560,12 @@ This is normally set via `font-lock-add-keywords' and `font-lock-remove-keywords'.") (defvar font-lock-keywords-only nil - "Non-nil means Font Lock should not fontify comments or strings. -This is normally set via `font-lock-defaults'.") + "Non-nil means Font Lock should not use syntactic fontifications. +This is normally set via `font-lock-defaults'. Setting it to a +non-nil value will usually cause comments and strings not to be +fontified, unless `font-lock-keywords' are set so as to fontify them, +or some other font-lock mechanism has the same effect even when this +variable is non-nil.") (defvar-local font-lock-keywords-case-fold-search nil "Non-nil means the patterns in `font-lock-keywords' are case-insensitive. diff --git a/lisp/frame.el b/lisp/frame.el index b6641ca716a..c48b2c4af1e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -493,7 +493,7 @@ there (in decreasing order of priority)." (setq parms (append initial-frame-alist window-system-frame-alist default-frame-alist parms nil)) ;; Don't enable tab-bar in daemon's initial frame. - (when (and (daemonp) (not (frame-parameter nil 'client))) + (when (and (daemonp) (eq (selected-frame) terminal-frame)) (setq parms (delq (assq 'tab-bar-lines parms) parms))) parms)) (if (null initial-window-system) ;; MS-DOS does this differently in pc-win.el @@ -2889,7 +2889,10 @@ deleting them." (if iconify (iconify-frame this) (delete-frame this)))) ;; In a second round consider all remaining frames. (dolist (this frames) - (unless (or (eq this frame) + ;; We did not recalculate FRAMES so make sure THIS is still a live + ;; frame since otherwise 'frame-terminal' will throw an error. + (unless (or (not (frame-live-p this)) + (eq this frame) (eq this minibuffer-frame) (not (eq (frame-terminal this) terminal)) ;; When FRAME is a child frame, delete its siblings diff --git a/lisp/help.el b/lisp/help.el index 4ba99868c4a..8cf91faf174 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -517,6 +517,67 @@ If that doesn't give a function, return nil." (setq sym (intern-soft (match-string 1 str))) (and (fboundp sym) sym)))))))) + +;;; Lossage + +(defcustom view-lossage-auto-refresh nil + "Whether to auto-refresh the lossage buffer. +If non-nil, the lossage buffer will be refreshed automatically for each +new input keystroke and command performed." + :type 'boolean + :group 'help + :version "31.1") + +(defvar-local help--lossage-update nil + "Variable used to determine if lossage buffer should be refreshed.") + +(defun help--lossage-make-recent-keys (&optional most-recent) + "Return a string containing all the recent keys and its commands. +If MOST-RECENT is non-nil, only return the most recent key and its +command." + (let ((keys + (if most-recent + `[,@(this-single-command-raw-keys) (nil . ,this-command)] + (recent-keys 'include-cmds)))) + (mapconcat + (lambda (key) + (cond + ((and (consp key) (null (car key))) + (concat + ";; " + (if (symbolp (cdr key)) + (buttonize + (symbol-name (cdr key)) + (lambda (&rest _) + (interactive) + (describe-function (cdr key))) + "mouse-1: go to the documentation for this command.") + (propertize "anonymous-command" 'face 'shadow)) + "\n")) + ((or (integerp key) (symbolp key) (listp key)) + (propertize (single-key-description key) + 'face 'help-key-binding + 'rear-nonsticky t)) + (t + (propertize (prin1-to-string key nil) + 'face 'help-key-binding + 'rear-nonsticky t)))) + keys + " "))) + +(defun help--refresh-lossage-buffer () + (if-let* ((buf (get-buffer "*Help*")) + (_ (buffer-local-value 'help--lossage-update buf))) + (with-current-buffer buf + (let ((inhibit-read-only t)) + (save-excursion + (goto-char (point-max)) + (insert-before-markers + (concat " " (help--lossage-make-recent-keys :most-recent))) + (forward-line -1) + (comment-indent)))) + (remove-hook 'post-command-hook #'help--refresh-lossage-buffer))) + ;;; `User' help functions @@ -692,43 +753,50 @@ the variable `message-log-max'." (interactive) (info "(efaq)Packages that do not come with Emacs")) -(defun view-lossage () +(defun view-lossage (&optional auto-refresh) "Display last few input keystrokes and the commands run. For convenience this uses the same format as `edit-last-kbd-macro'. See `lossage-size' to update the number of recorded keystrokes. +With argument, auto-refresh the lossage buffer for each new input +keystroke, see also `view-lossage-auto-refresh'. + To record all your input, use `open-dribble-file'." - (interactive) - (let ((help-buffer-under-preparation t)) - (help-setup-xref (list #'view-lossage) - (called-interactively-p 'interactive)) + (interactive "P") + (let ((help-buffer-under-preparation t) + (view-lossage-auto-refresh + (if auto-refresh t view-lossage-auto-refresh))) + (unless view-lossage-auto-refresh + ;; `view-lossage-auto-refresh' conflicts with xref buttons, add + ;; them if `view-lossage-auto-refresh' is nil. + (help-setup-xref (list #'view-lossage) + (called-interactively-p 'interactive))) (with-help-window (help-buffer) (princ " ") - (princ (mapconcat (lambda (key) - (cond - ((and (consp key) (null (car key))) - (format ";; %s\n" (if (symbolp (cdr key)) (cdr key) - "anonymous-command"))) - ((or (integerp key) (symbolp key) (listp key)) - (single-key-description key)) - (t - (prin1-to-string key nil)))) - (recent-keys 'include-cmds) - " ")) + (insert (help--lossage-make-recent-keys)) (with-current-buffer standard-output (goto-char (point-min)) - (let ((comment-start ";; ") - ;; Prevent 'comment-indent' from handling a single - ;; semicolon as the beginning of a comment. - (comment-start-skip ";; ") - (comment-use-syntax nil) - (comment-column 24)) - (while (not (eobp)) - (comment-indent) - (forward-line 1))) + (setq-local comment-start ";; " + ;; Prevent 'comment-indent' from handling a single + ;; semicolon as the beginning of a comment. + comment-start-skip ";; " + comment-use-syntax nil + comment-column 24) + (while (not (eobp)) + (comment-indent) + (forward-line 1)) ;; Show point near the end of "lossage", as we did in Emacs 24. - (set-marker help-window-point-marker (point)))))) + (set-marker help-window-point-marker (point)) + + (when view-lossage-auto-refresh + (setq-local help--lossage-update t) + (add-hook 'post-command-hook #'help--refresh-lossage-buffer)))) + + ;; `help-make-xrefs' adds a newline at the end of the buffer, which + ;; makes impossible to reposition point in `with-help-window'. + (when view-lossage-auto-refresh + (set-window-point (get-buffer-window (help-buffer)) (point-max))))) ;; Key bindings diff --git a/lisp/image.el b/lisp/image.el index 51a7a687961..06cd1543c08 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -417,7 +417,7 @@ be determined." ;; If nothing seems to be supported, return first type that matched. (or first (setq first type)))))))) - ;;;###autoload +;;;###autoload (defun image-supported-file-p (file) "Return non-nil if Emacs can display the specified image FILE. The returned value is a symbol specifying the image type of FILE, diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index 1ad0a78b1d1..808c1fdd147 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -4,7 +4,7 @@ ;; Author: João Távora ;; Keywords: processes, languages, extensions -;; Version: 1.0.25 +;; Version: 1.0.26 ;; Package-Requires: ((emacs "25.2")) ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -360,8 +360,8 @@ object, using the keywords `:code', `:message' and `:data'." _timeout-fn _timeout _deferred) "Make a request to CONNECTION, expecting a reply, return immediately. -The JSONRPC request is formed by METHOD, a symbol, and PARAMS a -JSON object. +The JSONRPC request is formed by METHOD, a symbol; and PARAMS, a JSON +object value as described in `json-serialize' (which see). The caller can expect SUCCESS-FN or ERROR-FN to be called with a JSONRPC `:result' or `:error' object, respectively. If this @@ -378,6 +378,9 @@ never be sent at all, in case it is overridden in the meantime by a new request with identical DEFERRED and for the same buffer. However, in that situation, the original timeout is kept. +PARAMS can also be the keyword `:jsonrpc-omit', in which case the +JSONRPC request object is formed witout a `params' entry. + Returns a list whose first element is an integer identifying the request as specified in the JSONRPC 2.0 spec." (apply #'jsonrpc--async-request-1 connection method params args)) @@ -387,9 +390,8 @@ as specified in the JSONRPC 2.0 spec." deferred timeout cancel-on-input cancel-on-input-retval) - "Make a request to CONNECTION, wait for a reply. -Like `jsonrpc-async-request' for CONNECTION, METHOD and PARAMS, -but synchronous. + "Make a request to CONNECTION, synchronously wait for a reply. +CONNECTION, METHOD and PARAMS as in `jsonrpc-async-request' (which see). Except in the case of a non-nil CANCEL-ON-INPUT (explained below), this function doesn't exit until anything interesting @@ -401,11 +403,13 @@ error of type `jsonrpc-error'. DEFERRED and TIMEOUT as in `jsonrpc-async-request', which see. If CANCEL-ON-INPUT is non-nil and the user inputs something while the -function is waiting, then any future replies to the request by the -remote endpoint (normal or error) are ignored and the function exits -returning CANCEL-ON-INPUT-RETVAL. If CANCEL-ON-INPUT is a function, it -is invoked with one argument, an integer identifying the canceled -request as specified in the JSONRPC 2.0 spec." +function is waiting, the function locally exits immediately returning +CANCEL-ON-INPUT-RETVAL. Any future replies to the request coming from +the remote endpoint (normal or error) are ignored. If CANCEL-ON-INPUT +is a function, it is invoked with one argument, an integer identifying +the canceled request as specified in the JSONRPC 2.0 spec. Callers may +use this function to issue a cancel notification to the endpoint, thus +preventing it from continuing to work on the now-cancelled request." (let* ((tag (funcall (if (fboundp 'gensym) 'gensym 'cl-gensym) "jsonrpc-request-catch-tag")) id-and-timer @@ -465,10 +469,11 @@ request as specified in the JSONRPC 2.0 spec." (cadr retval))) (cl-defun jsonrpc-notify (connection method params) - "Notify CONNECTION of something, don't expect a reply." - (jsonrpc-connection-send connection - :method method - :params params)) + "Notify CONNECTION of something, don't expect a reply. +CONNECTION, METHOD and PARAMS as in `jsonrpc-async-request' (which see)." + (apply #'jsonrpc-connection-send connection + :method method + (unless (eq params :jsonrpc-omit) `(:params ,params)))) (define-obsolete-variable-alias 'jrpc-default-request-timeout 'jsonrpc-default-request-timeout "28.1") @@ -933,10 +938,10 @@ TIMEOUT is nil)." (cl-return-from jsonrpc--async-request-1 (list id timer)))) ;; Really send it thru the wire ;; - (jsonrpc-connection-send connection - :id id - :method method - :params params) + (apply #'jsonrpc-connection-send connection + :id id + :method method + (unless (eq params :jsonrpc-omit) `(:params ,params))) ;; Setup some control structures ;; (when sync-request diff --git a/lisp/keymap.el b/lisp/keymap.el index b418d157619..95e1ebc48fb 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -39,7 +39,7 @@ (dolist (key keys) (when (or (vectorp key) (and (stringp key) (not (key-valid-p key)))) - (byte-compile-warn "Invalid `kbd' syntax: %S" key)))) + (byte-compile-warn "Invalid `key-valid-p' syntax: %S" key)))) (defun keymap-set (keymap key definition) "Set KEY to DEFINITION in KEYMAP. @@ -585,7 +585,7 @@ If MESSAGE (and interactively), message the result." (let* ((wargs args) (key (pop args))) (when (and (stringp key) (not (key-valid-p key))) - (byte-compile-warn-x wargs "Invalid `kbd' syntax: %S" key))) + (byte-compile-warn-x wargs "Invalid `key-valid-p' syntax: %S" key))) (when (null args) (byte-compile-warn-x form "Uneven number of key bindings in %S" form)) (setq args (cdr args))) diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 173f95fd325..a1fb715ab5e 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -842,9 +842,8 @@ directly." ((string-match "text/" content-type) (setq type 'text)) ((string-match "image/\\(.*\\)" content-type) - (setq type (and (fboundp 'image-supported-file-p) - (image-supported-file-p - (concat "." (match-string 1 content-type))))) + (setq type (image-supported-file-p + (concat "." (match-string 1 content-type)))) (when (and type rmail-mime-show-images (not (eq rmail-mime-show-images 'button)) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 29628fcb831..e79e96bd7c7 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2349,7 +2349,7 @@ Runs of equal candidate strings are eliminated. GROUP-FUN is a (goto-char (point-max)) (recenter -1))))) (remove-hook 'window-scroll-functions - 'completion--lazy-insert-strings-on-scroll t)) + #'completion--lazy-insert-strings-on-scroll t)) (defun completion--lazy-insert-strings (&optional button) (setq button (or button completions--lazy-insert-button)) @@ -4291,36 +4291,59 @@ or a symbol, see `completion-pcm--merge-completions'." (_ (push (pop p) n)))) (nreverse n))) -(defun completion-pcm--pattern->regex (pattern &optional group) - (let ((re - (concat "\\`" - (mapconcat - (lambda (x) - (cond - ((stringp x) (regexp-quote x)) - (t - (let ((re (if (eq x 'any-delim) - (concat completion-pcm--delim-wild-regex "*?") - "[^z-a]*?"))) - (if (if (consp group) (memq x group) group) - (concat "\\(" re "\\)") - re))))) - pattern - "")))) - ;; Avoid pathological backtracking. - (while (string-match "\\.\\*\\?\\(?:\\\\[()]\\)*\\(\\.\\*\\?\\)" re) - (setq re (replace-match "" t t re 1))) - re)) +(defun completion-pcm--pattern->segments (pattern) + "Segment PATTERN into more structured sublists. -(defun completion-pcm--pattern-point-idx (pattern) - "Return index of subgroup corresponding to `point' element of PATTERN. -Return nil if there's no such element." +Returns a list of lists which when concatenated is semantically the same +as PATTERN. + +The first element in each sublist is a (possibly empty) string. The +remaining elements in the sublist are all wildcard symbols. If PATTERN +ends with a wildcard, then each sublist is guaranteed to have at least +one wildcard." + (let (ret) + (while pattern + (let ((fixed "") + wildcards) + ;; Pop strings from PATTERN and concatenate them. + (while (stringp (car-safe pattern)) + (setq fixed (concat fixed (pop pattern)))) + ;; Pop wildcards from PATTERN. + (while (and pattern (symbolp (car-safe pattern))) + (push (pop pattern) wildcards)) + ;; The sublist is a fixed string followed by all the wildcards. + (push (cons fixed (nreverse wildcards)) ret))) + (nreverse ret))) + +(defun completion-pcm--segments->regex (segments &optional group) + (concat "\\`" + (mapconcat + (lambda (segment) + (concat + (regexp-quote (car segment)) + (when (cdr segment) + (concat + (when group "\\(") + (if (all (lambda (x) (eq x 'any-delim)) (cdr segment)) + (concat completion-pcm--delim-wild-regex "*?") + "[^z-a]*?") + (when group "\\)"))))) + segments + ""))) + +(defun completion-pcm--pattern->regex (pattern &optional group) + (completion-pcm--segments->regex (completion-pcm--pattern->segments pattern) group)) + +(defun completion-pcm--segments-point-idx (segments) + "Return index of subgroup corresponding to `point' element of SEGMENTS. +Return nil if there's no such element. +This is used in combination with `completion-pcm--segments->regex'." (let ((idx nil) (i 0)) - (dolist (x pattern) - (unless (stringp x) - (incf i) - (if (eq x 'point) (setq idx i)))) + (dolist (x segments) + (incf i) + (when (memq 'point (cdr x)) + (setq idx i))) idx)) (defun completion-pcm--all-completions (prefix pattern table pred) @@ -4551,8 +4574,9 @@ see) for later lazy highlighting." completion-lazy-hilit-fn nil) (cond ((and completions (cl-loop for e in pattern thereis (stringp e))) - (let* ((re (completion-pcm--pattern->regex pattern 'group)) - (point-idx (completion-pcm--pattern-point-idx pattern))) + (let* ((segments (completion-pcm--pattern->segments pattern)) + (re (completion-pcm--segments->regex segments 'group)) + (point-idx (completion-pcm--segments-point-idx segments))) (setq completion-pcm--regexp re) (cond (completion-lazy-hilit (setq completion-lazy-hilit-fn @@ -4696,12 +4720,13 @@ the same set of elements." (cond ((null (cdr strs)) (list (car strs))) (t - (let ((re (completion-pcm--pattern->regex pattern 'group)) + (let ((segmented (completion-pcm--pattern->segments (append pattern '(any)))) (ccs ())) ;Chopped completions. ;; First chop each string into the parts corresponding to each ;; non-constant element of `pattern', using regexp-matching. - (let ((case-fold-search completion-ignore-case)) + (let ((re (concat (completion-pcm--segments->regex segmented t) "\\'")) + (case-fold-search completion-ignore-case)) (dolist (str strs) (unless (string-match re str) (error "Internal error: %s doesn't match %s" str re)) @@ -4713,24 +4738,15 @@ the same set of elements." (push (substring str last next) chopped) (setq last next) (setq i (1+ i))) - ;; Add the text corresponding to the implicit trailing `any'. - (push (substring str last) chopped) (push (nreverse chopped) ccs)))) ;; Then for each of those non-constant elements, extract the ;; commonality between them. - (let ((res ()) - (fixed "") - ;; Accumulate each stretch of wildcards, and process them as a unit. - (wildcards ())) - ;; Make the implicit trailing `any' explicit. - (dolist (elem (append pattern '(any))) - (if (stringp elem) - (progn - (setq fixed (concat fixed elem)) - (setq wildcards nil)) + (let ((res ())) + (dolist (elem segmented) + (let ((fixed (car elem)) + (wildcards (cdr elem))) (let ((comps ())) - (push elem wildcards) (dolist (cc (prog1 ccs (setq ccs nil))) (push (car cc) comps) (push (cdr cc) ccs)) @@ -4768,7 +4784,8 @@ the same set of elements." (push prefix res) ;; Push all the wildcards in this stretch, to preserve `point' and ;; `star' wildcards before ELEM. - (setq res (append wildcards res)) + (dolist (wildcard wildcards) + (push wildcard res)) ;; Extract common suffix additionally to common prefix. ;; Don't do it for `any' since it could lead to a merged ;; completion that doesn't itself match the candidates. @@ -4786,10 +4803,7 @@ the same set of elements." comps)))))) (cl-assert (stringp suffix)) (unless (equal suffix "") - (push suffix res)))) - ;; We pushed these wildcards on RES, so we're done with them. - (setq wildcards nil)) - (setq fixed ""))))) + (push suffix res))))))))) ;; We return it in reverse order. res))))) @@ -5617,7 +5631,7 @@ and make sexp navigation more intuitive. The list of prompts activating this mode in specific minibuffer interactions is customizable via `minibuffer-regexp-prompts'." :global t - :initialize #'custom-initialize-delay + :initialize #'custom-initialize-after-file-load :init-value t (if minibuffer-regexp-mode (progn @@ -5711,7 +5725,7 @@ Use the face `minibuffer-nonselected' to highlight the contents of the minibuffer window when the minibuffer remains active but its window is no longer selected." :global t - :initialize #'custom-initialize-delay + :initialize #'custom-initialize-after-file-load :init-value t :version "31.1" (if minibuffer-nonselected-mode diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 666a5025c2c..7d7373b275e 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -148,7 +148,9 @@ If nil, buffers will require manual reload, and will contain the text specified in `eww-restore-reload-prompt' instead of the actual Web page contents." :version "25.1" - :type '(choice (const :tag "Restore all automatically" t) + :type '(choice (choice :tag "Restore all automatically" :value t + (const t) + (const auto)) (const :tag "Require manual reload" nil))) (defcustom eww-restore-reload-prompt diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el index 45883fe306f..e8c50636dcb 100644 --- a/lisp/net/newst-backend.el +++ b/lisp/net/newst-backend.el @@ -1107,6 +1107,15 @@ same as in `newsticker--parse-atom-1.0'." (xml-node-children node)))) (or new-item new-feed))) +(defun newsticker--parse-text-container (node) + "Handle content according to ``type'' attribute." + (let ((content (car (xml-node-children node)))) + (if (string= "html" (xml-get-attribute node 'type)) + ;; element contains entity escaped html + content + ;; plain text or xhtml + (newsticker--unxml content)))) + (defun newsticker--unxml (node) "Reverse parsing of an xml string. Restore an xml-string from a an xml NODE that was returned by xml-parse..." @@ -1159,23 +1168,14 @@ URL `http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html'" name time (xml-get-children topnode 'entry) ;; title-fn (lambda (node) - (car (xml-node-children - (car (xml-get-children node 'title))))) + (newsticker--parse-text-container + (car (xml-get-children node 'title)))) ;; desc-fn (lambda (node) - ;; unxml the content or the summary node. Atom - ;; allows for integrating (x)html into the atom - ;; structure but we need the raw html string. - ;; e.g. https://www.heise.de/open/news/news-atom.xml - ;; https://feeds.feedburner.com/ru_nix_blogs - (or (newsticker--unxml - (car (xml-node-children - (car (xml-get-children node 'content))))) - (newsticker--unxml - (car (xml-node-children - (car (xml-get-children node 'summary))))) - (car (xml-node-children - (car (xml-get-children node 'summary)))))) + (or (newsticker--parse-text-container + (car (xml-get-children node 'content))) + (newsticker--parse-text-container + (car (xml-get-children node 'summary))))) ;; link-fn (lambda (node) (xml-get-attribute diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 93e9255cce8..5c9e28153f7 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -3103,7 +3103,11 @@ indicated by RESPONSE)." (#x1f 'underline) (#x1e '(:strike-through t)) (#x11 'rcirc-monospace-text))) - (goto-char (1+ (match-beginning 0))))) + (goto-char (match-beginning 0)) + (forward-char) + (unless (eq (char-before (match-end 2)) ?\C-o) + (delete-region (match-beginning 2) (match-end 2))) + (delete-region (match-beginning 1) (match-end 1)))) (defconst rcirc-color-codes ;; Taken from https://modern.ircdocs.horse/formatting.html diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index c8223d859c7..941c502fa83 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -253,19 +253,19 @@ Return VALUE." (defun tramp-flush-file-upper-properties (key file) "Remove some properties of FILE's upper directory." - (when (file-name-absolute-p file) - ;; `file-name-directory' can return nil, for example for "~". - (when-let* ((file (file-name-directory file)) - (file (directory-file-name file))) - (setq key (tramp-file-name-unify key file)) - (unless (eq key tramp-cache-undefined) - (dolist (property (hash-table-keys (tramp-get-hash-table key))) - (when (string-match-p - (rx - bos (| "directory-" "file-name-all-completions" - "file-entries")) - property) - (tramp-flush-file-property key file property))))))) + (when-let* (((file-name-absolute-p file)) + ;; `file-name-directory' can return nil, for example for "~". + (file (file-name-directory file)) + (file (directory-file-name file))) + (setq key (tramp-file-name-unify key file)) + (unless (eq key tramp-cache-undefined) + (dolist (property (hash-table-keys (tramp-get-hash-table key))) + (when (string-match-p + (rx + bos (| "directory-" "file-name-all-completions" + "file-entries")) + property) + (tramp-flush-file-property key file property)))))) ;;;###tramp-autoload (defun tramp-flush-file-properties (key file) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index a4f74383325..db3737500e6 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -632,13 +632,28 @@ For details, see `tramp-rename-files'." "Which method to be used in `tramp-file-name-with-sudo'." :group 'tramp :version "31.1" + ;; It should be a choice of constant strings. See + ;; `with-tramp-file-name-with-method'. :type '(choice (const "su") (const "surs") (const "sudo") (const "sudors") (const "doas") (const "run0") (const "ksu")) + :initialize #'custom-initialize-default + :set #'tramp-set-file-name-with-method :link '(tramp-info-link :tag "Tramp manual" tramp-file-name-with-method)) +(defun tramp-set-file-name-with-method (symbol value) + "Set SYMBOL to value VALUE. +Used in user option `tramp-file-name-with-method'. If VALUE is an +optional method, enable it." + (unless (string-equal (symbol-value symbol) value) + ;; Enable optional method. + (tramp-enable-method value) + ;; Set the value. + (when (assoc value tramp-methods) + (set-default symbol value)))) + (defun tramp-get-file-name-with-method () "Return connection-local value of `tramp-file-name-with-method'." (tramp-compat-connection-local-value tramp-file-name-with-method)) @@ -651,8 +666,11 @@ Run BODY." (if current-prefix-arg (completing-read "Tramp method: " - (mapcar - #'cadr (cdr (get 'tramp-file-name-with-method 'custom-type))) + ;; Filter out enabled methods. + (seq-intersection + (mapcar #'car tramp-methods) + (mapcar + #'cadr (cdr (get 'tramp-file-name-with-method 'custom-type)))) nil t (tramp-get-file-name-with-method)) (tramp-get-file-name-with-method)))) ,@body)) diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 5d463bc0062..93190fec3a7 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -259,5 +259,8 @@ value is the default binding of the variable." ;; instead of `condition-case' when the origin of an error shall be ;; kept, for example when the HANDLER propagates the error with ;; `(signal (car err) (cdr err)'. +;; +;; * Starting with Emacs 30.1, use '(_ VALUEFORM)' instead of +;; '(VALUEFORM)' in 'if-let*/when-let*/and-let*'. ;;; tramp-compat.el ends here diff --git a/lisp/net/tramp-container.el b/lisp/net/tramp-container.el index 6e82bc67be1..5ac2e46819a 100644 --- a/lisp/net/tramp-container.el +++ b/lisp/net/tramp-container.el @@ -701,8 +701,8 @@ see its function help for a description of the format." (tramp-login-program ,tramp-distrobox-program) (tramp-login-args (("enter") ("-n" "%h") - ("--" "%l"))) - ;(tramp-direct-async (,tramp-default-remote-shell "-c")) + ("--") ("%l"))) + (tramp-direct-async (,tramp-default-remote-shell "-c")) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-c")) @@ -761,7 +761,14 @@ see its function help for a description of the format." ("--env" ,(format "TERM=%s" tramp-terminal-type)) ("instance://%h") - ("%h"))) ; Needed for multi-hop check. + ;; Needed for multi-hop check, + ;; ignored by the "shell" command. + ("%h"))) + ;; `tramp-direct-async' must be used *instead* of `tramp-login-args'. + ;; (tramp-direct-async (("exec") + ;; ("--env" + ;; ,(format "TERM=%s" tramp-terminal-type)) + ;; ("instance://%h")) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-c")) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index c283c119b87..687cc7e1bc6 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -123,7 +123,10 @@ (and (featurep 'dbusbind) (tramp-compat-funcall 'dbus-get-unique-name :session) (or (tramp-process-running-p "gvfs-fuse-daemon") - (tramp-process-running-p "gvfsd-fuse")))) + (tramp-process-running-p "gvfsd-fuse") + ;; Gvfs may be built without fuse + ;; (cf. https://lists.gnu.org/archive/html/tramp-devel/2025-10/msg00009.html). + (tramp-process-running-p "gvfsd")))) "Non-nil when GVFS is available.") ;;;###tramp-autoload diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index d349179d0e6..aafceaf3335 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el @@ -172,6 +172,7 @@ They are completed by `M-x TAB' only in Tramp debug buffers." (use-local-map special-mode-map) (set-buffer-modified-p nil) ;; For debugging purposes. + ;(add-hook 'kill-buffer-hook #'debug nil 'local) (local-set-key "\M-n" 'clone-buffer) (add-hook 'clone-buffer-hook #'tramp-setup-debug-buffer nil 'local)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 98e3cae5a79..e55af1f9659 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -303,6 +303,7 @@ The string is used in `tramp-methods'.") `("sg" (tramp-login-program "sg") (tramp-login-args (("-") ("%u"))) + (tramp-direct-async ("-c")) (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-args ("-c")) (tramp-connection-timeout 10))) @@ -687,8 +688,8 @@ This list is used for copying/renaming with out-of-band methods. See `tramp-actions-before-shell' for more info.") -(defconst tramp-uudecode - "(echo begin 600 %t; tail -n +2) | uudecode +(defconst tramp-uudecode "\ +(echo begin 600 %t; tail -n +2) | uudecode cat %t rm -f %t" "Shell function to implement `uudecode' to standard output. @@ -698,16 +699,16 @@ we have this shell function. Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-readlink-file-truename - "if %m -h \"$1\"; then echo t; else echo nil; fi +(defconst tramp-readlink-file-truename "\ +if %m -h \"$1\"; then echo t; else echo nil; fi %r \"$1\"" "Shell script to produce output suitable for use with `file-truename' on the remote file system. Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-perl-file-truename - "%p -e ' +(defconst tramp-perl-file-truename "\ +%p -e ' use File::Spec; use Cwd \"realpath\"; @@ -755,8 +756,8 @@ on the remote file system. Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-perl-file-name-all-completions - "%p -e ' +(defconst tramp-perl-file-name-all-completions "\ +%p -e ' $dir = $ARGV[0]; if ($dir ne \"/\") { $dir =~ s#/+$##; @@ -778,20 +779,28 @@ print \")\\n\"; ' \"$1\" %n" "Perl script to produce output suitable for use with `file-name-all-completions' on the remote file system. It returns the -same format as `tramp-bundle-read-file-names'. Format specifiers are -replaced by `tramp-expand-script', percent characters need to be -doubled.") +same format as `tramp-bundle-read-file-names'. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") -(defconst tramp-shell-file-name-all-completions - "cd \"$1\" 2>&1; %l -a %n | while IFS= read file; do - quoted=`echo \"$1/$file\" | sed -e \"s#//#/#g\"` - printf \"%%s\\n\" \"$quoted\" - done | tramp_bundle_read_file_names" +(defconst tramp-shell-print-quoted-string "\ +quoted=`echo \"$1\" | sed -e \"s/\\\"/\\\\\\\\\\\\\\\\\\\"/g\"` +printf \"\\\"%%s\\\"\" \"$quoted\"" + "Shell script to print a lispy string. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") + +(defconst tramp-shell-file-name-all-completions "\ +cd \"$1\" 2>&1; %l -a %n | while IFS= read file; do + quoted=`echo \"$1/$file\" | sed -e \"s#//#/#g\"` + printf \"%%s\\n\" \"$quoted\" +done | %b" "Shell script to produce output suitable for use with `file-name-all-completions' on the remote file system. It returns the -same format as `tramp-bundle-read-file-names'. Format specifiers are -replaced by `tramp-expand-script', percent characters need to be -doubled.") +same format as `tramp-bundle-read-file-names', which must be declared on +the remote host as well. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") ;; Perl script to implement `file-attributes' in a Lisp `read'able ;; output. If you are hacking on this, note that you get *no* output @@ -799,8 +808,8 @@ doubled.") ;; end. ;; The device number is returned as "-1", because there will be a virtual ;; device number set in `tramp-sh-handle-file-attributes'. -(defconst tramp-perl-file-attributes - "%p -e ' +(defconst tramp-perl-file-attributes "\ +%p -e ' @stat = lstat($ARGV[0]); if (!@stat) { print \"nil\\n\"; @@ -882,12 +891,11 @@ characters need to be doubled.") (defconst tramp-ls-file-attributes "%s -ild %s \"$1\" || return\n%s -lnd%s %s \"$1\"" "Shell function to produce output suitable for use with `file-attributes' -on the remote file system. -Format specifiers are replaced by `tramp-expand-script', percent -characters need to be doubled.") +on the remote file system. The \"%s\" format specifiers are replaced +when called in `tramp-do-file-attributes-with-ls'.") -(defconst tramp-perl-directory-files-and-attributes - "%p -e ' +(defconst tramp-perl-directory-files-and-attributes "\ +%p -e ' chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), exit(); opendir(DIR,\".\") or printf(\"\\\"Cannot open directory $ARGV[0]: $''!''\\\"\\n\"), exit(); @list = readdir(DIR); @@ -991,8 +999,8 @@ characters need to be doubled.") Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-perl-id - "%p -e ' +(defconst tramp-perl-id "\ +%p -e ' use strict; use warnings; use POSIX qw(getgroups); @@ -1007,8 +1015,8 @@ printf \"uid=%%d(%%s) gid=%%d(%%s) groups=%%s\\n\", Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-python-id - "%y -c ' +(defconst tramp-python-id "\ +%y -c ' import os, pwd, grp; def idform(id): @@ -1043,9 +1051,9 @@ on the remote host. Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-perl-encode - "%p -e ' -# This script contributed by Juanma Barranquero . +;; This script contributed by Juanma Barranquero . +(defconst tramp-perl-encode "\ +%p -e ' use strict; my %%trans = do { @@ -1081,9 +1089,9 @@ while (read STDIN, $data, 54) { Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-perl-decode - "%p -e ' -# This script contributed by Juanma Barranquero . +;; This script contributed by Juanma Barranquero . +(defconst tramp-perl-decode "\ +%p -e ' use strict; my %%trans = do { @@ -1141,8 +1149,8 @@ characters need to be doubled.") Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-awk-encode - "%a '\\ +(defconst tramp-awk-encode "\ +%a '\\ BEGIN { b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" b16 = \"0123456789abcdef\" @@ -1192,8 +1200,8 @@ characters need to be doubled.") Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-awk-decode - "%a '\\ +(defconst tramp-awk-decode "\ +%a '\\ BEGIN { b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\" } @@ -1219,24 +1227,23 @@ BEGIN { Format specifiers are replaced by `tramp-expand-script', percent characters need to be doubled.") -(defconst tramp-bundle-read-file-names - "echo \"(\" +(defconst tramp-bundle-read-file-names "\ +printf \"(\\n\" while IFS= read file; do - quoted=`echo \"$file\" | sed -e \"s/\\\"/\\\\\\\\\\\\\\\\\\\"/g\"` - printf \"(%%s\" \"\\\"$quoted\\\"\" + printf \"(\"; %k \"$file\" if %q \"$file\"; then printf \" %%s\" t; else printf \" %%s\" nil; fi if %m -r \"$file\"; then printf \" %%s\" t; else printf \" %%s\" nil; fi if %m -d \"$file\"; then printf \" %%s\" t; else printf \" %%s\" nil; fi if %m -x \"$file\"; then printf \" %%s)\\n\" t; else printf \" %%s)\\n\" nil; fi done -echo \")\"" +printf \")\\n\"" "Shell script to check file attributes of a bundle of files. For every file, it returns a list with the absolute file name, and the tests for file existence, file readability, file directory, and file executable. Input shall be read via here-document, otherwise the -command could exceed maximum length of command line. Format specifiers -\"%s\" are replaced before the script is used, percent characters need -to be doubled.") +command could exceed maximum length of command line. +Format specifiers are replaced by `tramp-expand-script', percent +characters need to be doubled.") ;; New handlers should be added here. ;;;###tramp-autoload @@ -2001,9 +2008,6 @@ ID-FORMAT valid values are `string' and `integer'." (tramp-maybe-send-script v tramp-perl-file-name-all-completions "tramp_perl_file_name_all_completions") - ;; Used in `tramp-shell-file-name-all-completions'. - (tramp-maybe-send-script - v tramp-bundle-read-file-names "tramp_bundle_read_file_names") (tramp-maybe-send-script v tramp-shell-file-name-all-completions "tramp_shell_file_name_all_completions")) @@ -2934,15 +2938,15 @@ The method used must be an out-of-band method." ;; Try to insert the amount of free space. (goto-char (point-min)) ;; First find the line to put it on. - (when (and (search-forward-regexp - (rx bol (group (* blank) "total")) nil t) - ;; Emacs 29.1 or later. - (not (fboundp 'dired--insert-disk-space))) - (when-let* ((available (get-free-disk-space "."))) - ;; Replace "total" with "total used", to avoid confusion. - (replace-match "\\1 used in directory") - (end-of-line) - (insert " available " available)))) + (when-let* (((search-forward-regexp + (rx bol (group (* blank) "total")) nil t)) + ;; Emacs 29.1 or later. + ((not (fboundp 'dired--insert-disk-space))) + (available (get-free-disk-space "."))) + ;; Replace "total" with "total used", to avoid confusion. + (replace-match "\\1 used in directory") + (end-of-line) + (insert " available " available))) (prog1 (goto-char end-marker) (set-marker beg-marker nil) @@ -4052,81 +4056,94 @@ Fall back to normal file name handler if no Tramp handler exists." \"%a\", \"%h\", \"%l\", \"%m\", \"%o\", \"%p\", \"%q\", \"%r\", \"%s\" and \"%y\" format specifiers are replaced by the respective `awk', `hexdump', `ls', `test', od', `perl', `test -e', `readlink', `stat' and -`python' commands. \"%n\" is replaced by \"2>/dev/null\", and \"%t\" is -replaced by a temporary file name. If VEC is nil, the respective local -commands are used. If there is a format specifier which cannot be -expanded, this function returns nil." - (if (not (string-match-p - (rx (| bol (not "%")) "%" (any "ahlmnopqrsty")) script)) - script - (catch 'wont-work - (let ((awk (when (string-match-p (rx (| bol (not "%")) "%a") script) - (or - (if vec (tramp-get-remote-awk vec) (executable-find "awk")) - (throw 'wont-work nil)))) - (hdmp (when (string-match-p (rx (| bol (not "%")) "%h") script) - (or - (if vec (tramp-get-remote-hexdump vec) - (executable-find "hexdump")) - (throw 'wont-work nil)))) - (dev (when (string-match-p (rx (| bol (not "%")) "%n") script) - (or - (if vec (concat "2>" (tramp-get-remote-null-device vec)) - (if (eq system-type 'windows-nt) "" - (concat "2>" null-device))) - (throw 'wont-work nil)))) - (ls (when (string-match-p (rx (| bol (not "%")) "%l") script) - (format "%s %s" - (or (tramp-get-ls-command vec) - (throw 'wont-work nil)) - (tramp-sh--quoting-style-options vec)))) - (test (when (string-match-p (rx (| bol (not "%")) "%m") script) - (or (tramp-get-test-command vec) - (throw 'wont-work nil)))) - (test-e (when (string-match-p (rx (| bol (not "%")) "%q") script) - (or (tramp-get-file-exists-command vec) - (throw 'wont-work nil)))) - (od (when (string-match-p (rx (| bol (not "%")) "%o") script) - (or (if vec (tramp-get-remote-od vec) (executable-find "od")) +`python' commands. +\"%b\" is replaced by a call of \"tramp_bundle_read_file-names\", \"%k\" +is replaced by a call of \"tramp_shell_print_quoted_string\", \"%n\" is +replaced by \"2>/dev/null\", and \"%t\" is replaced by a temporary file +name. +\"%%\" is replaced by \"%\". If one of the format specifiers cannot be +expanded, this function returns nil. If there are only other format +specifiers, SCRIPT is returned unchanged. + +If VEC is nil, the respective local commands are used." + (catch 'wont-work + (let ((awk (when (string-match-p (rx (| bol (not "%")) "%a") script) + (or + (if vec (tramp-get-remote-awk vec) (executable-find "awk")) + (throw 'wont-work nil)))) + (bundle (when (string-match-p (rx (| bol (not "%")) "%b") script) + (tramp-maybe-send-script + vec tramp-bundle-read-file-names + "tramp_bundle_read_file_names") + "tramp_bundle_read_file_names")) + (hdmp (when (string-match-p (rx (| bol (not "%")) "%h") script) + (or + (if vec (tramp-get-remote-hexdump vec) + (executable-find "hexdump")) + (throw 'wont-work nil)))) + (dev (when (string-match-p (rx (| bol (not "%")) "%n") script) + (or + (if vec (concat "2>" (tramp-get-remote-null-device vec)) + (if (eq system-type 'windows-nt) "" + (concat "2>" null-device))) + (throw 'wont-work nil)))) + (lispy (when (string-match-p (rx (| bol (not "%")) "%k") script) + (tramp-maybe-send-script + vec tramp-shell-print-quoted-string + "tramp_shell_print_quoted_string") + "tramp_shell_print_quoted_string")) + (ls (when (string-match-p (rx (| bol (not "%")) "%l") script) + (format "%s %s" + (or (tramp-get-ls-command vec) + (throw 'wont-work nil)) + (tramp-sh--quoting-style-options vec)))) + (test (when (string-match-p (rx (| bol (not "%")) "%m") script) + (or (tramp-get-test-command vec) (throw 'wont-work nil)))) - (perl (when (string-match-p (rx (| bol (not "%")) "%p") script) + (test-e (when (string-match-p (rx (| bol (not "%")) "%q") script) + (or (tramp-get-file-exists-command vec) + (throw 'wont-work nil)))) + (od (when (string-match-p (rx (| bol (not "%")) "%o") script) + (or (if vec (tramp-get-remote-od vec) (executable-find "od")) + (throw 'wont-work nil)))) + (perl (when (string-match-p (rx (| bol (not "%")) "%p") script) + (or + (if vec + (tramp-get-remote-perl vec) (executable-find "perl")) + (throw 'wont-work nil)))) + (python (when (string-match-p (rx (| bol (not "%")) "%y") script) (or (if vec - (tramp-get-remote-perl vec) (executable-find "perl")) + (tramp-get-remote-python vec) + (executable-find "python")) (throw 'wont-work nil)))) - (python (when (string-match-p (rx (| bol (not "%")) "%y") script) - (or - (if vec - (tramp-get-remote-python vec) - (executable-find "python")) - (throw 'wont-work nil)))) - (readlink (when (string-match-p (rx (| bol (not "%")) "%r") script) - (format "%s %s" - (or - (if vec - (tramp-get-remote-readlink vec) - (executable-find "readlink")) - (throw 'wont-work nil)) - "--canonicalize-missing"))) - (stat (when (string-match-p (rx (| bol (not "%")) "%s") script) - (or - (if vec - (tramp-get-remote-stat vec) (executable-find "stat")) - (throw 'wont-work nil)))) - (tmp (when (string-match-p (rx (| bol (not "%")) "%t") script) - (or - (if vec - (tramp-file-local-name (tramp-make-tramp-temp-name vec)) - (tramp-compat-make-temp-name)) - (throw 'wont-work nil))))) - (format-spec - script - (format-spec-make - ?a awk ?h hdmp ?l ls ?m test ?n dev ?o od ?p perl - ?q test-e ?r readlink ?s stat ?t tmp ?y python)))))) + (readlink (when (string-match-p (rx (| bol (not "%")) "%r") script) + (format "%s %s" + (or + (if vec + (tramp-get-remote-readlink vec) + (executable-find "readlink")) + (throw 'wont-work nil)) + "--canonicalize-missing"))) + (stat (when (string-match-p (rx (| bol (not "%")) "%s") script) + (or + (if vec + (tramp-get-remote-stat vec) (executable-find "stat")) + (throw 'wont-work nil)))) + (tmp (when (string-match-p (rx (| bol (not "%")) "%t") script) + (or + (if vec + (tramp-file-local-name (tramp-make-tramp-temp-name vec)) + (tramp-compat-make-temp-name)) + (throw 'wont-work nil))))) + (format-spec + script + (format-spec-make + ?a awk ?b bundle ?h hdmp ?k lispy ?l ls ?m test ?n dev ?o od + ?p perl ?q test-e ?r readlink ?s stat ?t tmp ?y python))))) (defun tramp-maybe-send-script (vec script name) - "Define in remote shell function NAME implemented as SCRIPT. + "Define a remote shell function NAME implemented as SCRIPT. Only send the definition if it has not already been done." ;; We cannot let-bind (tramp-get-connection-process vec) because it ;; might be nil. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ec57aca0568..be13afebeba 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -927,6 +927,7 @@ Customize. See also `tramp-change-syntax'." (const :tag "Ange-FTP" simplified) (const :tag "XEmacs" separate)) :require 'tramp + ;; Starting with Emacs 31.1, we can use `custom-initialize-after-file' instead. :initialize #'custom-initialize-default :set #'tramp-set-syntax :link '(info-link :tag "Tramp manual" "(tramp) Change file name syntax")) @@ -941,7 +942,7 @@ to be set, depending on VALUE." ;; Cleanup existing buffers. (unless (eq (symbol-value symbol) value) (tramp-cleanup-all-buffers)) - ;; Set the value: + ;; Set the value. (set-default symbol value) ;; Reset the depending variables. (setq tramp-prefix-format (tramp-build-prefix-format) @@ -970,6 +971,7 @@ to be set, depending on VALUE." ;; Initialize the Tramp syntax variables. We want to override initial ;; value of `tramp-file-name-regexp'. We do not call ;; `custom-set-variable', this would load Tramp via custom.el. +;; Starting with Emacs 31.1, we can use `custom-initialize-after-file' instead. (tramp--with-startup (tramp-set-syntax 'tramp-syntax tramp-syntax)) @@ -2556,7 +2558,9 @@ packages like `tramp-sh' (except `tramp-ftp')." `(lambda (orig-fun &rest args) (if-let* ((handler (find-file-name-handler - (or (car args) default-directory) #',operation))) + (if (and (car args) (file-name-absolute-p (car args))) + (car args) default-directory) + #',operation))) (apply handler #',operation args) (apply orig-fun args))) `((name . ,(concat "tramp-advice-" (symbol-name operation)))))))) @@ -4088,17 +4092,17 @@ BODY is the backend specific code." (let (last-coding-system-used (need-chown t)) ;; Set file modification time. - (when (or (eq ,visit t) (stringp ,visit)) - (when-let* ((file-attr (file-attributes filename 'integer))) - (set-visited-file-modtime - ;; We must pass modtime explicitly, because FILENAME - ;; can be different from (buffer-file-name), f.e. if - ;; `file-precious-flag' is set. - (or (file-attribute-modification-time file-attr) - (current-time))) - (when (and (= (file-attribute-user-id file-attr) uid) - (= (file-attribute-group-id file-attr) gid)) - (setq need-chown nil)))) + (when-let* (((or (eq ,visit t) (stringp ,visit))) + (file-attr (file-attributes filename 'integer))) + (set-visited-file-modtime + ;; We must pass modtime explicitly, because FILENAME + ;; can be different from (buffer-file-name), f.e. if + ;; `file-precious-flag' is set. + (or (file-attribute-modification-time file-attr) + (current-time))) + (when (and (= (file-attribute-user-id file-attr) uid) + (= (file-attribute-group-id file-attr) gid)) + (setq need-chown nil))) ;; Set the ownership. (when need-chown @@ -7221,6 +7225,7 @@ Consults the auth-source package." (tramp-compat-auth-info-password auth-info)))) ;; Try the password cache. + ;; Starting with Emacs 31.1, this isn't needed anymore. (with-tramp-suspended-timers (setq auth-passwd (password-read diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index ae27824fdc9..9b780a91721 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -532,6 +532,10 @@ Many aspects this mode can be customized using (setq-local comment-line-break-function #'nxml-newline-and-indent) (setq-local comment-quote-nested-function #'nxml-comment-quote-nested) (setq-local comment-continue "") ; avoid double-hyphens as a padding + (setq-local hs-block-start-regexp "<[^/>]*?") + (setq-local hs-block-end-regexp "]*[^/]>") + (setq-local hs-c-start-regexp "