Skip to content

Commit

Permalink
nit: minor code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 18, 2023
1 parent f552bd6 commit 34c10e2
Show file tree
Hide file tree
Showing 18 changed files with 119 additions and 239 deletions.
5 changes: 1 addition & 4 deletions core/me-bootstrap.el
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@
(mapc (+apply-partially-right #'+delete-file-or-directory 'trash 'recursive)
(seq-filter
(lambda (name)
(not (member name (list straight-build-dir
(concat straight-build-dir "-cache.el")
"versions"
"repos"))))
(not (member name (list straight-build-dir (concat straight-build-dir "-cache.el") "versions" "repos"))))
(directory-files default-directory nil "[^.][^.]?$")))))


Expand Down
8 changes: 3 additions & 5 deletions core/me-builtin.el
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,9 @@ or file path may exist now."
"ee" #'eglot
"eA" #'+eglot-auto-enable)
(defcustom +eglot-auto-enable-modes
'(c++-mode c++-ts-mode c-mode c-ts-mode
python-mode python-ts-mode
rust-mode rust-ts-mode cmake-mode
js-mode js-ts-mode typescript-mode typescript-ts-mode
json-mode json-ts-mode js-json-mode)
'(c++-mode c++-ts-mode c-mode c-ts-mode python-mode python-ts-mode rust-mode
rust-ts-mode cmake-mode js-mode js-ts-mode typescript-mode
typescript-ts-mode json-mode json-ts-mode js-json-mode)
"Modes for which Eglot can be automatically enabled by `+eglot-auto-enable'."
:group 'minemacs-prog
:type '(repeat symbol))
Expand Down
8 changes: 4 additions & 4 deletions core/me-fonts.el
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ scaling factor for the font in Emacs' `face-font-rescale-alist'. See the

(defconst +face-attributes
'(:family :foundry :width :height :weight :slant :foreground
:distant-foreground :background :underline :overline :strike-through
:box :inverse-video :stipple :font :inherit :extend)
:distant-foreground :background :underline :overline :strike-through :box
:inverse-video :stipple :font :inherit :extend)
"Arguments accepted by the `set-face-attribute' function.")

(defconst +font-spec-keywords
'(:family :foundry :width :weight :slant :adstyle :registry :dpi :size :spacing
:avgwidth :name :script :lang :otf)
'(:family :foundry :width :weight :slant :adstyle :registry :dpi :size
:spacing :avgwidth :name :script :lang :otf)
"Arguments accepted by the `font-spec' function.")

(defun +font--get-valid-args (script-or-face font)
Expand Down
3 changes: 1 addition & 2 deletions core/me-gc.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
(gcmh-idle-delay 20)
;; The default `gcmh's 1GB is probably too high. We set it to 256MB on 64bit
;; systems, or 16MB on 32bit ones.
(gcmh-high-cons-threshold
(* 1024 1024 (if (string-suffix-p "64" (symbol-name sys/arch)) 256 16))))
(gcmh-high-cons-threshold (* 1024 1024 (if (string-suffix-p "64" (symbol-name sys/arch)) 256 16))))


(provide 'me-gc)
Expand Down
7 changes: 3 additions & 4 deletions core/me-use-package-extra.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
(defun use-package-normalize/:pin-ref (_name-symbol keyword args)
(use-package-only-one (symbol-name keyword) args
(lambda (_label arg)
(cond
((stringp arg) arg)
((symbolp arg) (symbol-name arg))
(t (use-package-error ":pin-ref wants a commit hash or a ref."))))))
(cond ((stringp arg) arg)
((symbolp arg) (symbol-name arg))
(t (use-package-error ":pin-ref wants a commit hash or a ref."))))))

(defun use-package-handler/:pin-ref (name-symbol _keyword ref rest state)
(let ((body (use-package-process-keywords name-symbol rest state)))
Expand Down
3 changes: 1 addition & 2 deletions core/me-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ MinEmacs hooks will be run in this order:
;; Socket envvars, like I3SOCK, GREETD_SOCK, SEATD_SOCK, SWAYSOCK, etc.
"SOCK$"
;; SSH and GPG variables that could quickly become stale if persisted.
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$"
"^GPG_AGENT_INFO$"
"^SSH_\\(AUTH_SOCK\\|AGENT_PID\\)$" "^\\(SSH\\|GPG\\)_TTY$" "^GPG_AGENT_INFO$"
;; MinEmacs envvars
"^MINEMACS\\(_?DIR\\|_\\(ALPHA\\|DEBUG\\|VERBOSE\\|NOT_LAZY\\|MSG_LEVEL\\|IGNORE_.*\\)\\)$")
"Environment variables to omit.
Expand Down
7 changes: 3 additions & 4 deletions modules/me-data.el
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@
(+map-local! :keymaps 'plantuml-mode-map
"p" #'plantuml-preview-buffer
"P" #'plantuml-preview
"d" `(,(+cmdfy!
(if plantuml-mode-debug-enabled
(plantuml-disable-debug)
(plantuml-enable-debug)))
"d" `(,(+cmdfy! (if plantuml-mode-debug-enabled
(plantuml-disable-debug)
(plantuml-enable-debug)))
:wk "Toggle debug")))

(use-package mermaid-mode
Expand Down
31 changes: 12 additions & 19 deletions modules/me-editor.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,16 @@
;; Enable all "Cascadia Code" ligatures in programming modes
(ligature-set-ligatures
'prog-mode
'("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
"##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
"\\\\" "://")))
'("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>" ":::" "::="
"=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!==" "!!." ">=>" ">>=" ">>>"
">>-" ">->" "->>" "-->" "---" "-<<" "<~~" "<~>" "<*>" "<||" "<|>" "<$>"
"<==" "<=>" "<=<" "<->" "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###"
"#_(" "..<" "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|" "[|" "]#" "::"
":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:" ">=" ">>" ">-" "-~" "-|" "->"
"--" "-<" "<~" "<*" "<|" "<:" "<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#["
"#:" "#=" "#!" "##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" "\\\\" "://")))

(use-package rainbow-delimiters
:straight t
Expand All @@ -67,10 +64,7 @@
:straight t
:hook ((prog-mode conf-mode) . highlight-numbers-mode)
:config
(setq highlight-numbers-generic-regexp
(rx (and symbol-start (one-or-more digit))
(optional "." (* digit))
symbol-end)))
(setq highlight-numbers-generic-regexp (rx (and symbol-start (one-or-more digit)) (optional "." (* digit)) symbol-end)))

(use-package smartparens
:straight t
Expand All @@ -86,8 +80,7 @@
;; Make evil-mc cooperate with smartparens better
(let ((vars (cdr (assq :default evil-mc-cursor-variables))))
(unless (memq (car sp--mc/cursor-specific-vars) vars)
(setcdr (assq :default evil-mc-cursor-variables)
(append vars sp--mc/cursor-specific-vars))))))
(setcdr (assq :default evil-mc-cursor-variables) (append vars sp--mc/cursor-specific-vars))))))

;; Default `smartparens' configuration (for example, do not complete a single
;; quote)
Expand Down
8 changes: 3 additions & 5 deletions modules/me-emacs-lisp.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
(parinfer-rust-mode 1)))

(defun +parinter-rust--disable-a (&rest _)
(if (and (bound-and-true-p parinfer-rust-mode)
(bound-and-true-p parinfer-rust-enabled))
(progn
(setq +parinter-rust--was-enabled-p t)
(parinfer-rust-mode -1))
(if (and (bound-and-true-p parinfer-rust-mode) (bound-and-true-p parinfer-rust-enabled))
(progn (setq +parinter-rust--was-enabled-p t)
(parinfer-rust-mode -1))
(setq +parinter-rust--was-enabled-p nil)))

;; The `evil-shif-right' (and `evil-shift-left' which uses it under the hood)
Expand Down
34 changes: 9 additions & 25 deletions modules/me-email.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
:group 'minemacs)

(defconst +mu4e-available-p
(and (executable-find "mu")
(executable-find "msmtp")
(executable-find "mbsync")
(file-directory-p +mu4e-load-path)))
(and (executable-find "mu") (executable-find "msmtp") (executable-find "mbsync") (file-directory-p +mu4e-load-path)))

(use-package mu4e
:when +mu4e-available-p
Expand Down Expand Up @@ -121,8 +118,7 @@
:after mu4e
:demand t
:config
;; Setup Gmail specific hacks (adapted from Doom Emacs, with a lot of
;; improvements)
;; Setup Gmail specific hacks (adapted from Doom Emacs, with a lot of improvements)
(+mu4e-gmail-setup))

(use-package me-mu4e-extras
Expand Down Expand Up @@ -174,8 +170,7 @@
"p" #'org-msg-preview)
(org-msg-mode 1)

;; HACK: When adding multiple attachements, we likely need it to remember the
;; directory of the last added attachement.
;; HACK: When adding multiple attachements, I likely need it to remember the directory of the last added attachement.
(advice-add
'org-msg-attach-attach :after
(defun +org-msg-attach-attach--save-default-directory-a (file &rest _)
Expand All @@ -189,11 +184,7 @@
:demand t
:config
;; Do not export table of contents nor author name
(setq org-mime-export-options
'(:with-latex dvipng
:section-numbers t
:with-author nil
:with-toc nil)))
(setq org-mime-export-options '(:with-latex dvipng :section-numbers t :with-author nil :with-toc nil)))

(use-package mu4e-alert
:straight t
Expand All @@ -219,8 +210,7 @@
(setq doom-modeline-mu4e t)

;; Ignore spams!
(setq mu4e-alert-interesting-mail-query
(+mu4e-extras-ignore-spams-query mu4e-alert-interesting-mail-query))
(setq mu4e-alert-interesting-mail-query (+mu4e-extras-ignore-spams-query mu4e-alert-interesting-mail-query))

(mu4e-alert-enable-mode-line-display)
(mu4e-alert-enable-notifications)
Expand All @@ -229,31 +219,25 @@
(defun +mu4e-name-or-email (msg)
(let* ((from (car (plist-get msg :from)))
(name (plist-get from :name)))
(if (or (null name) (eq name ""))
(plist-get from :email)
name)))
(if (or (null name) (eq name "")) (plist-get from :email) name)))

(defun +mu4e-alert-grouped-mail-notif-formatter (mail-group _all-mails)
"This function can be used for `mu4e-alert-grouped-mail-notification-formatter'."
(when +mu4e-alert-bell-command
(start-process "mu4e-alert-bell" nil (car +mu4e-alert-bell-command) (cdr +mu4e-alert-bell-command)))
(let ((mail-count (length mail-group)))
(list
:title (format "You have %d unread email%s"
mail-count (if (> mail-count 1) "s" ""))
:title (format "You have %d unread email%s" mail-count (if (> mail-count 1) "s" ""))
:body (concat
""
(string-join
(mapcar
(lambda (msg)
(format "<b>%s</b>: %s"
(+mu4e-name-or-email msg)
(plist-get msg :subject)))
(format "<b>%s</b>: %s" (+mu4e-name-or-email msg) (plist-get msg :subject)))
mail-group)
"\n")))))

(setq mu4e-alert-grouped-mail-notification-formatter
#'+mu4e-alert-grouped-mail-notif-formatter))
(setq mu4e-alert-grouped-mail-notification-formatter #'+mu4e-alert-grouped-mail-notif-formatter))


(provide 'me-email)
Expand Down
8 changes: 3 additions & 5 deletions modules/me-lsp.el
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@
"ll" #'lsp
"lA" #'+lsp-auto-enable)
(defcustom +lsp-auto-enable-modes
'(c++-mode c++-ts-mode c-mode c-ts-mode
python-mode python-ts-mode
rust-mode rust-ts-mode cmake-mode
js-mode js-ts-mode typescript-mode typescript-ts-mode
json-mode json-ts-mode js-json-mode)
'(c++-mode c++-ts-mode c-mode c-ts-mode python-mode python-ts-mode rust-mode
rust-ts-mode cmake-mode js-mode js-ts-mode typescript-mode
typescript-ts-mode json-mode json-ts-mode js-json-mode)
"Modes for which LSP-mode can be automatically enabled by `+lsp-auto-enable'."
:group 'minemacs-prog
:type '(repeat symbol))
Expand Down
36 changes: 15 additions & 21 deletions modules/me-multi-cursors.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
:straight t
:hook (minemacs-first-file . global-evil-mc-mode)
:config
;; Use "gz" instead of "gr", this last is mapped to `xref-find-references' in
;; some programming modes.
;; Use "gz" instead of "gr", this last is mapped to `xref-find-references' in some programming modes.
(evil-define-key* '(normal visual) evil-mc-key-map (kbd "gr") nil)
(evil-define-key* '(normal visual) evil-mc-key-map (kbd "gz") evil-mc-cursors-map)

Expand All @@ -38,27 +37,22 @@
evil-mc-skip-and-goto-prev-cursor evil-mc-skip-and-goto-next-cursor
evil-mc-make-and-goto-prev-match evil-mc-make-and-goto-next-match
evil-mc-skip-and-goto-prev-match evil-mc-skip-and-goto-next-match))
(advice-add
cmd :around
(lambda (fn)
(dotimes (i (if (integerp current-prefix-arg) current-prefix-arg 1))
(funcall fn)))))
(advice-add cmd :around (lambda (fn) (dotimes (i (if (integerp current-prefix-arg) current-prefix-arg 1)) (funcall fn)))))

;; Custom commands to execute with `evil-mc'
(setq
evil-mc-custom-known-commands
'((backward-kill-word (:default . evil-mc-execute-default-call-with-count))
(evil-delete-back-to-indentation (:default . evil-mc-execute-default-call))
(undo-fu-only-redo (:default . evil-mc-execute-default-redo))
(undo-fu-only-undo (:default . evil-mc-execute-default-undo))
(corfu-complete (:default . evil-mc-execute-default-complete))
(evil-numbers/dec-at-pt-incremental (:default . evil-mc-execute-default-call-with-count))
(evil-numbers/inc-at-pt-incremental (:default . evil-mc-execute-default-call-with-count))
(evil-org-delete (:default . evil-mc-execute-default-evil-delete))
(ess-smart-comma (:default . evil-mc-execute-call))
(evil-digit-argument-or-evil-beginning-of-visual-line
(:default . evil-mc-execute-default-call)
(visual . evil-mc-execute-visual-call)))))
(setq evil-mc-custom-known-commands
'((backward-kill-word (:default . evil-mc-execute-default-call-with-count))
(evil-delete-back-to-indentation (:default . evil-mc-execute-default-call))
(undo-fu-only-redo (:default . evil-mc-execute-default-redo))
(undo-fu-only-undo (:default . evil-mc-execute-default-undo))
(corfu-complete (:default . evil-mc-execute-default-complete))
(evil-numbers/dec-at-pt-incremental (:default . evil-mc-execute-default-call-with-count))
(evil-numbers/inc-at-pt-incremental (:default . evil-mc-execute-default-call-with-count))
(evil-org-delete (:default . evil-mc-execute-default-evil-delete))
(ess-smart-comma (:default . evil-mc-execute-call))
(evil-digit-argument-or-evil-beginning-of-visual-line
(:default . evil-mc-execute-default-call)
(visual . evil-mc-execute-visual-call)))))

(use-package evil-multiedit
:straight t
Expand Down

0 comments on commit 34c10e2

Please sign in to comment.