From a5ac84bb255c09ac340a307f6446c6d944545df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Kryger?= Date: Fri, 8 Nov 2024 15:55:22 +0000 Subject: [PATCH] Cleanup init-prefs --- modules/init-prefs.el | 284 ++++++++++++++++++++++-------------------- 1 file changed, 149 insertions(+), 135 deletions(-) diff --git a/modules/init-prefs.el b/modules/init-prefs.el index 9ae2cb1a..06f86a56 100644 --- a/modules/init-prefs.el +++ b/modules/init-prefs.el @@ -1,13 +1,16 @@ -;;;; Definition of the variables that prefs.el can override. -;;; -;;; These variables control other init-XXX files, such as init-look-and-feel.el. -;;; You can override them by creating your own file ~/.emacs.d/prefs.el -;;; with content like: -;;; -;;; (setq exordium-preferred-frame-width 110 -;;; exordium-preferred-frame-height 75) -;;; -;;; You can also use M-x `customize' and browse group Local -> Init. +;;; init-prefs.el --- Definition of the variables that prefs.el can override. -*- lexical-binding: t -*- + +;;; Commentary: +;; +;; These variables control other init-XXX files, such as init-look-and-feel.el. +;; You can override them by creating your own file ~/.emacs.d/prefs.el +;; with content like: +;; +;; (setq exordium-preferred-frame-width 110 +;; exordium-preferred-frame-height 75) +;; +;; You can also use M-x `customize' and browse group Local -> Init. +;;; Code: (defgroup exordium nil "Customize your Emacs configuration." @@ -21,11 +24,12 @@ ("Monaco" . 120) ("Monospace" . 120) ("Mono" . 120)) - "List of preferred fonts/sizes to use, in decreasing order of -preference. We will use the first one that is available on the -local machine. It is a list of pairs (font-name . font-size). If -nil, we don't set any font. Note that you can get the list of -available font names by evaluating (font-family-list)." + "List of preferred fonts/sizes to use. +The list is in decreasing order of preference. We will use the +first one that is available on the local machine. It is an alist +of pairs (FONT-NAME . FONT-SIZE). If nil, we don't set any font. +Note that you can get the list of available font names by +evaluating `font-family-list'." :group 'exordium :type 'sexp) @@ -46,12 +50,12 @@ available font names by evaluating (font-family-list)." :type 'boolean) (defcustom exordium-font-lock t - "Whether font-lock is turned on globally or not." + "Whether the `font-lock-mode' is turned on globally or not." :group 'exordium :type 'boolean) (defcustom exordium-scroll-bar t - "Whether a scroll bar is displayed globally or not" + "Whether a scroll bar is displayed globally or not." :group 'exordium :type 'boolean) @@ -68,69 +72,70 @@ available font names by evaluating (font-family-list)." :type 'boolean) (defcustom exordium-enable-y-or-n t - "Use y or n answers instead of full words yes or no" + "Whether to use \"y\" or \"n\" answers. +If nil use full words \"yes\" or \"no\"." :group 'exordium :type 'boolean) (defcustom exordium-enable-newline-and-indent t - "If t, binds the return key to newline-and-indent, and -shift-return for just newline. If nil, do the opposite." + "Whether to bind RET to `newline-and-indent' and S-RET for just `newline'. +If nil, do the opposite." :group 'exordium :type 'boolean) (defcustom exordium-delete-trailing-whitespace t - "If t, deletes all trailing whitespaces on all lines before -saving a buffer. This is the default because it is generally a -good practice. Set this variable to to nil if you work on legacy -projects that have a lot of trailing whitespaces" + "Whether to delete all trailing whitespaces on all lines before saving a buffer. +This is the default because it is generally a good practice. Set +this variable to to nil if you work on legacy projects that have +a lot of trailing whitespaces." :group 'exordium :type 'boolean) (defcustom exordium-enable-electric-pair-mode t - "Enables electric-pair-mode." + "Whether to enable `electric-pair-mode'." :group 'exordium :type 'boolean) (defcustom exordium-enable-cua-mode nil - "If set to t, enables CUA mode. -If set to :region, enables CUA rectagular regions. -IF nil, disables CUA completely." + "Whether to enable CUA (`cua-mode'). +If set to :region, enables CUA rectangular regions. If nil, +disables CUA completely." :group 'exordium :type 'symbol) (defcustom exordium-enable-evil-mode nil - "If set to t, enables EVIL mode." + "Whether to enable EVIL mode (`evil-mode')." :group 'exordium :type 'boolean) (defcustom exordium-enable-insert-gui-primary-selection nil - "If set to t, binds Meta-Insert to insert-gui-primary-selection. + "Whether to bind Meta-Insert to `insert-gui-primary-selection'. This makes it easier to paste text from the Windows clipboard." :group 'exordium :type 'boolean) ;;; Backup files (e.g. file~) (defcustom exordium-backup-files nil - "Enables or disables backup files. -Disabled by default, I can't stand these annoying files~" + "Whether to enable backup files. +Disabled by default, I can't stand these annoying files~." :group 'exordium :type 'boolean) (defcustom exordium-use-magit-fullscreen t - "If t, magit status and log will fill the whole frame. + "Whether `magit-status' and `magit-log' should fill the whole frame. The original window configuration will be restored when you quit out of magit." :group 'exordium :type 'boolean) (defcustom exordium-smerge-show-dispatch t - "It t, automatically show `exordium-smerge-dispatch' for unmerged files. -This is when hitting RET on a file with a merge conflict in a + "Whether to automatically show `exordium-smerge-dispatch' for unmerged files. +This is when hitting Return on a file with a merge conflict in a Magit status buffer." :group 'exordium :type 'boolean) (defcustom exordium-help-extensions t - "If t, use help extensions like `which-key' and `helpful-mode'." + "Whether use help extensions like `which-key' and `helpful-mode'." :group 'exordium :type 'boolean) @@ -164,7 +169,7 @@ When buffer matches either of the `exordium-inhibit-line-numbers-modes', treemacs-mode) "List of modes for which line numbers should not be displayed." :group 'exordium - :type 'list) + :type '(repeat symbol)) (defcustom exordium-inhibit-line-numbers-buffer-size nil "The maximum buffer size that line numbers should be displayed. @@ -176,7 +181,7 @@ Set to nil to enable line numbers even in large buffers." :type 'integer) (defcustom exordium-inhibit-line-numbers-star-buffers nil - "Controls whether line numbers shold be displayed in buffers that name starts with `*'. + "Whether to display line numbers in buffers that name starts with `*'. Set to t to don't display line numbers in buffers that name starts with `*'. Set to nil to display line numbers in buffers that name starts with `*'." :group 'exordium @@ -186,10 +191,10 @@ Set to nil to display line numbers in buffers that name starts with `*'." ;;; Miscellaneous utilities -- see init-util.el (defcustom exordium-fci-mode :ondemand - "Controls fill-column-indicator e.g. the 80-character ruler. -:ondemand off by default (you need to hit C-| to toggle it), -:always means it is always on, :prog means on for programming modes -nil means it is disabled." + "Control fill-column-indicator e.g. the 80-character ruler. +If :ondemand it is off by default (you need to hit C-| to toggle +it). When :always it is always on. When :prog it is on for +programming modes. When nil it is disabled." :group 'exordium :type 'symbol) @@ -212,25 +217,18 @@ if displayable in current configuration. If the value of `exordium-fci-use-dashes' cannot be mapped or the mapped value cannot be displayed by the current font default will be used." :group 'exordium - :type 'alist) - -(defcustom exordium-fci-fix-autocomplete-bug t - "Whether fill-column-indicator is temporarily disabled when an - auto-complete popup is displayed, in order to work around a bug - that causes the popup to be incorrectly displayed" - :group 'exordium - :type 'boolean) + :type '(alist :key-type (symbol :tag "Symbol") + :value-type (repeat (character :tag "Dashes character")))) (defcustom exordium-highlight-symbol nil - "Whether occurrences of the symbol under point gets highlighted - in the buffer after a few seconds." + "Whether occurrences of symbol under point gets highlighted after a few seconds." :group 'exordium :type 'boolean) (defcustom exordium-skip-taps-update nil "Whether to skip taps update when updating configuration. If set to nil, each tap need to be updated manually, -i.e., with git pull." +i.e., with \"git pull\"." :group 'exordium :type 'boolean) @@ -246,7 +244,7 @@ i.e., with git pull." ;;; Autocomplete -- see init-autocomplete.el (defcustom exordium-complete-mode :auto-complete - "Slect the completion engine for exordium. + "Select the completion engine for exordium. Possible values are `:auto-complete',`:company', and nil. Default is `:auto-complete'. See also `exordium-rtags-auto-complete'." :group 'exordium @@ -256,76 +254,75 @@ Default is `:auto-complete'. See also `exordium-rtags-auto-complete'." ;;; Themes -- see themes directory (defcustom exordium-theme 'tomorrow-night - "Theme to load on startup. Use nil to not load any theme, -otherwise use one of the following: + "Theme to load on startup. Use nil to not load any theme. +Otherwise use one of the following: - tomorrow-day, tomorrow-night, tomorrow-night-bright, - tomorrow-night-blue, tomorrow-night-eighties -- monokai -- solarized-light, solarized-dark -- zenburn -- material -- atom-one" + tomorrow-night-blue, tomorrow-night-eighties, +- monokai, +- solarized-light, solarized-dark, +- zenburn, +- material, +- atom-one." :group 'exordium :type 'symbol) (defcustom exordium-theme-use-loud-rtags-faces nil - "Whether RTags error/warning/fixit faces are loud or not with -the current theme. It depends on the theme but generally setting -this to t will use reverse video, while setting it to nil will -use underline waves." + "Whether RTags error/warning/fixit faces are loud or not. +It depends on the theme but generally setting this to t will use +reverse video, while setting it to nil will use underline waves." :group 'exordium :type 'boolean) (defcustom exordium-theme-use-big-font t - "Whether the theme uses big fonts for titles and top-level - items. This applies to modes like org or markdown. Set it to - nil if you do not want to have variable-sized font." + "Whether the theme uses big fonts for titles and top-level items. +This applies to modes like `org-mode' or `markdown-mode'. Set it to +nil if you do not want to have variable-sized font." :group 'exordium :type 'boolean) (defcustom exordium-enable-powerline t - "Enables Powerline" + "Whether to enable Powerline." :group 'exordium :type 'boolean) (defcustom exordium-display-powerline-after-idle-time 0 - "Fix a race/crash at startup related to Powerline that may - happen on some environments, by displaying Powerline only after - a specified number of seconds of idle time. Normally 1 second - is enough." + "Fix a race/crash at startup related to Powerline. +The race may happen on some environments, by displaying Powerline +only after a specified number of seconds of idle time. Normally 1 +second is enough." :group 'exordium :type 'integer) (defcustom exordium-fix-powerline-osx-bug t - "Fix the graphical bug with Emacs24.4 on OS-X (the angles in -powerline are not rendered correctly). It makes the colors a bit -washed up, especially with the zenburn theme. See these links: + "Fix the graphical bug with Emacs24.4 on OS-X. +The bug causes the angles in Powerline to be not rendered +correctly. It makes the colors a bit washed up, especially with +the `zenburn-theme' See these links: https://github.com/milkypostman/powerline/issues/54 http://emacsredux.com/blog/2013/08/21/color-themes-redux" :group 'exordium :type 'boolean) (defcustom exordium-powerline-theme :angle - "Drives the shape of Powerline separators, and other things. + "Control the shape of Powerline separators, and other things. Possible values are :angle, :wave" :group 'exordium :type 'symbol) (defcustom exordium-powerline-shows-rtags-diagnostics t - "Whether Powerline shows RTags Diagnostics results. If there -are errors, the buffer name is displayed in red instead of the -default color." + "Whether Powerline shows RTags Diagnostics results. +If there are errors, the buffer name is displayed in red instead +of the default color." :group 'exordium :type 'boolean) (defcustom exordium-powerline-enable-icons nil - "Whether Powerline displays icons for git branches and other - things." + "Whether Powerline displays icons for git branches and other things." :group 'exordium :type 'boolean) (defcustom exordium-use-variable-pitch nil - "Allow variable pitch fonts" + "Allow variable pitch fonts." :group 'exordium :type 'boolean) @@ -365,8 +362,9 @@ default color." ;;; See init-prog.el (defcustom exordium-spell-check :prog - "Enables flyspell for prog modes if set to :prog. -Disables flyspell if set to nil." + "Whether to enable `flyspell'. +If set to :prog enable flyspell in `prog-mode' buffers. +If set to nil do not enable `flyspell'." :group 'exordium :type 'symbol) @@ -378,7 +376,7 @@ Disables flyspell if set to nil." (defcustom exordium-yasnippet-author (format "%s (%s)" user-full-name user-login-name) - "Author string for yasnippet expansion" + "Author string for yasnippet expansion." :group 'exordium :type 'string) @@ -394,9 +392,9 @@ Disables flyspell if set to nil." ;;; exordium-git-gutter-non-fringe displays the diff icon on the left side of the ;;; line numbers. The latter takes precedence. (defcustom exordium-git-gutter-non-fringe nil - "Whether a git status icon is displayed at the very left. Takes - precedence over exordium-gut-gutter. Note that this option - disables highlighting the current line number" + "Whether a git status icon is displayed at the very left. +Takes precedence over `exordium-gut-gutter'. Note that this +option disables highlighting the current line number" :group 'exordium :type 'boolean) @@ -420,8 +418,9 @@ opened in TRAMP mode." ;;; See init-cpp.el (defcustom exordium-enable-c++11-keywords :simple - "Enables syntax highlighting for the new keywords introduced in C++11 if set -to :simple. Enables modern-cpp-font-lock when set to :modern." + "Control syntax highlighting for the new keywords introduced in C++11. +If set to :simple add extra keywords to `font-lock'. +If set to :modern use `modern-cpp-font-lock'." :group 'exordium :type 'symbol) @@ -436,64 +435,65 @@ to :simple. Enables modern-cpp-font-lock when set to :modern." ;;; See init-rtags.el (defcustom exordium-rtags-rdm-args nil - "Command-line arguments passed to rdm, if needed. This should -be a list of strings." + "Command-line arguments passed to \"rdm\". +This should be a list of strings." :group 'exordium :type 'sexp) (defcustom exordium-rtags-auto-complete nil "Whether RTags is used as the source for auto-complete in C++ mode. -This is considered only when `exordium-complete-mode' is `:auto-complete'." +This is considered only when `exordium-complete-mode' is :auto-complete." :group 'exordium :type 'boolean) (defcustom exordium-rtags-syntax-checker :flymake - "The syntax checker to be used with rtags. If set to :flycheck the -`flycheck-rtags' will be used. Otherwise, the built-in flymake will be used." + "The syntax checker to be used with rtags. +If set to :flycheck the `flycheck-rtags' will be used. +Otherwise, the built-in flymake will be used." :group 'exordium :type 'symbol) ;;; See init-rtags-helm.el (defcustom exordium-rtags-helm-everywhere t - "Whether RTags uses Helm to display list of results, rather - than its own UI" + "Whether RTags uses Helm to display list of results. +If nil use its own UI." :group 'exordium :type 'boolean) ;;; see init-rtags-cmake.el (defcustom exordium-rtags-cmake nil - "Whether RTags is used automatically for CMake-enabled projects" + "Whether RTags is used automatically for CMake-enabled projects." :group 'exordium :type 'boolean) (defcustom exordium-rtags-cmake-build-dir "cmake.bld/" - "Relative path of the build directory inside a CMake-enabled - repo. '' is replaced by the local machine's architecture." + "Relative path of the build directory inside a CMake-enabled repo. +The special token \\='\\=' is replaced by the local +machine's architecture." :group 'exordium :type 'string) ;;; See init-rtags-cdb.el (defcustom exordium-rtags-source-file-extensions '("*.cpp" "*.c") - "List of source file extension patterns for creating a - compilation database using command - `rtags-create-compilation-database'. Not needed for CMake projects." + "List of source file extension patterns for creating a compilation database. +The compilation database is created using command +`rtags-create-compilation-database'. Not needed for CMake projects." :group 'exordium :type 'sexp) (defcustom exordium-iwyu-filter-args '("-fno-default-inline") - "List of flags that should be removed from the 'include-what-you-use'. - When `include-what-you-use' is called, all parameters after the first space - in JSON value of `command' property are passed. Use this list to remove - unsupported flags and arguments as well as compiler wrappers that are in - project's compilation database." + "List of flags that should be removed from the \"include-what-you-use\". +When \"include-what-you-use\" is called, all parameters after the +first space in JSON value of `command' property are passed. Use +this list to remove unsupported flags and arguments as well as +compiler wrappers that are in project's compilation database." :group 'exordium :type 'sexp) (defcustom exordium-iwyu-extra-args '() - "List of extra arguments that should be passed when calling - `include-what-you-use'. They are passed 'as is' to `include-what-you-use' - executable." + "List of extra arguments to call \"include-what-you-use\". +They are passed \\='as is\\=' to \"include-what-you-use\" executable." :group 'exordium :type 'sexp) @@ -512,7 +512,7 @@ This is considered only when `exordium-complete-mode' is `:auto-complete'." ;;; Desktop state (defcustom exordium-desktop nil - "Whether the desktop state is saved" + "Whether the desktop state is saved." :group 'exordium :type 'boolean) @@ -529,35 +529,37 @@ configuration load slower." ;;; Org mode (defcustom exordium-enable-org-export t - "Configure org mode for code export and babel. Setting this to - nil makes emacs starts a little bit faster, if you don't need - to use this feature." + "Configure org mode for code export and babel. +Setting this to nil make Emacs starts a little bit faster, if +you don't need to use this feature." :group 'exordium :type 'boolean) (defcustom exordium-no-org-babel-confirm nil - "Disable confirmation requests when evaluating code blocks when - using org-babel. Setting to non-nil could conceivably result in - accidentally executing code." + "Disable confirmation requests when evaluating `org-babel' code blocks. +Setting to non-nil could conceivably result in accidentally executing code." :group 'exordium :type 'boolean) (defcustom exordium-org-export-css nil - "Export from org mode using a css style sheet, rather than - inline styles. This allows more control over the appearance, at - the cost of having to maintain a stylesheet." + "Wether to export from `org-mode' using a css style sheet. +When nil use inline styles. This allows more control over the +appearance, at the cost of having to maintain a stylesheet." :group 'exordium :type 'boolean) (defcustom exordium-org-export-css-stylesheet "" - "The stylesheet to use in html based org export. This will be - loaded into `org-html-head' and exported. For example, + "The stylesheet to use in html based org export. +This will be loaded into `org-html-head' and exported. +For example, - + - To generate a basic css file that matches your theme, use - `org-html-htmlize-generate-css' which will create a buffer with - css definitions for all currently defined faces." +To generate a basic css file that matches your theme, use +`org-html-htmlize-generate-css' which will create a buffer with +css definitions for all currently defined faces." :group 'exordium :type 'string) @@ -566,8 +568,8 @@ configuration load slower." ;;; LSP (defun exordium--string-vector-p (candidate) - "Returns true if CANDIDATE is a vector data structure and -every element of it is of type string, else nil." + "Return non-nil if CANDIDATE is a vector and every element of it a string. +Otherwise return nil." (and (vectorp candidate) (seq-every-p #'stringp candidate))) @@ -581,14 +583,23 @@ serialize as a JSON array of strings." :type '(restricted-sexp :match-alternatives (exordium--string-vector-p))) -(defcustom exordium-lsp-clangd-executable ["clangd-18" "clangd-17" "clangd-16" "clangd-15" "clangd-14" "clangd-13" "clangd"] +(defcustom exordium-lsp-clangd-executable ["clangd-18" + "clangd-17" + "clangd-16" + "clangd-15" + "clangd-14" + "clangd-13" + "clangd"] "List of executable names to search for to run clangd. Default is to choose the first that is found via `executable-find'." :group 'exordium :risky t :type 'exordium-string-vector) -(defcustom exordium-lsp-clangd-args '("-j=4" "--background-index" "--log=error" "--clang-tidy") +(defcustom exordium-lsp-clangd-args '("-j=4" + "--background-index" + "--log=error" + "--clang-tidy") "Extra arguments for the clangd executable." :group 'exordium :risky t @@ -641,11 +652,14 @@ Default is to choose the first that is found via `executable-find'." "Enable lsp-mode." :group 'exordium :type 'boolean) - + (defcustom exordium-treesit-modes-enable nil "Enable treesiter. -For emacs 29 and above enable new -ts-modes and attach forwarding hook." +For Emacs 29 and above enable new -ts-modes and attach forwarding hook." :group 'exordium :type 'boolean) + (provide 'init-prefs) + +;;; init-prefs.el ends here