dev: merge from master

This commit is contained in:
Matt Nish-Lapidus 2024-08-25 17:59:12 -04:00
commit 1f75958e90
11 changed files with 91 additions and 53 deletions

View file

@ -74,31 +74,23 @@ orderless."
(completion-styles +vertico-company-completion-styles)) (completion-styles +vertico-company-completion-styles))
(apply fn args))) (apply fn args)))
(setq orderless-affix-dispatch-alist
`((?! . ,#'orderless-without-literal)
(?& . ,#'orderless-annotation)
(?% . ,#'char-fold-to-regexp)
(?` . ,#'orderless-initialism)
(?= . ,#'orderless-literal)
(?^ . ,#'orderless-literal-prefix)
(?~ . ,#'orderless-flex)))
(defun +vertico-orderless-dispatch (pattern _index _total) (defun +vertico-orderless-dispatch (pattern _index _total)
(cond (cond
;; Ensure $ works with Consult commands, which add disambiguation suffixes ;; Ensure $ works with Consult commands, which add disambiguation suffixes
((string-suffix-p "$" pattern) ((string-suffix-p "$" pattern)
`(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x200000-\x300000]*$"))) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x200000-\x300000]*$")))))
;; Ignore single !
((string= "!" pattern) `(orderless-literal . "")) (add-to-list 'orderless-style-dispatchers '+vertico-orderless-dispatch)
;; Without literal
((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1)))
;; Annotation
((string-prefix-p "&" pattern) `(orderless-annotation . ,(substring pattern 1)))
((string-suffix-p "&" pattern) `(orderless-annotation . ,(substring pattern 0 -1)))
;; Character folding
((string-prefix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 1)))
((string-suffix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 0 -1)))
;; Initialism matching
((string-prefix-p "`" pattern) `(orderless-initialism . ,(substring pattern 1)))
((string-suffix-p "`" pattern) `(orderless-initialism . ,(substring pattern 0 -1)))
;; Literal matching
((string-prefix-p "=" pattern) `(orderless-literal . ,(substring pattern 1)))
((string-suffix-p "=" pattern) `(orderless-literal . ,(substring pattern 0 -1)))
;; Flex matching
((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1)))
((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1)))))
;; TODO: Find a way to deduplicate this code from the corfu module.
(add-to-list (add-to-list
'completion-styles-alist 'completion-styles-alist
'(+vertico-basic-remote '(+vertico-basic-remote
@ -110,7 +102,6 @@ orderless."
;; note that despite override in the name orderless can still be used in ;; note that despite override in the name orderless can still be used in
;; find-file etc. ;; find-file etc.
completion-category-overrides '((file (styles +vertico-basic-remote orderless partial-completion))) completion-category-overrides '((file (styles +vertico-basic-remote orderless partial-completion)))
orderless-style-dispatchers '(+vertico-orderless-dispatch)
orderless-component-separator #'orderless-escapable-split-on-space) orderless-component-separator #'orderless-escapable-split-on-space)
;; ...otherwise find-file gets different highlighting than other commands ;; ...otherwise find-file gets different highlighting than other commands
(set-face-attribute 'completions-first-difference nil :inherit nil)) (set-face-attribute 'completions-first-difference nil :inherit nil))

View file

@ -39,6 +39,18 @@ It also provides easy font configuration for Hebrew and Arabic-derived scripts
See [[Fonts]] for more information. If you use an RTL language that isn't covered by See [[Fonts]] for more information. If you use an RTL language that isn't covered by
these characters, open an issue requesting support for it. these characters, open an issue requesting support for it.
To resize fonts, don't include a ~:size~ parameter in ~+bidi-hebrew-font~ or
~+bidi-arabic-font~, set ~+bidi-hebrew-font-scale~ or ~+bidi-arabic-font-scale~
instead, or add an entry to ~face-font-rescale-alist~ for your font. E.g.
#+begin_src emacs-lisp
;;; Add to $DOOMDIR/config.el
(setq +bidi-arabic-font-scale 1.5)
;; or
(setq +bidi-hebrew-font-scale 2.5)
;; or
(add-to-list 'face-font-rescale-alist '("DejaVu Sans" . 1.2))
#+end_src
* Configuration * Configuration
** Using ~+bidi-mode~ ** Using ~+bidi-mode~
~+bidi-mode~ is a local minor mode, meaning it has to be turned on a per-buffer ~+bidi-mode~ is a local minor mode, meaning it has to be turned on a per-buffer

View file

@ -1,14 +1,16 @@
;;; input/bidi/config.el -*- lexical-binding: t; -*- ;;; input/bidi/config.el -*- lexical-binding: t; -*-
(defvar +bidi-mode-map (make-sparse-keymap)
"Keymap for `+bidi-mode'.")
(defvar +bidi-hebrew-font (font-spec :family "DejaVu Sans") (defvar +bidi-hebrew-font (font-spec :family "DejaVu Sans")
"Overriding font for hebrew script. "Overriding font for hebrew script.
Must be a `font-spec', see `doom-font' for examples. Must be a `font-spec', see `doom-font' for examples.
WARNING: if you specify a size for this font it will hard-lock any usage of this WARNING: if you specify a size for this font it will hard-lock any usage of this
font to that size. It's rarely a good idea to do so!") font to that size. It's rarely a good idea to do so! Set
`+bidi-hebrew-font-scale' to scale the font up or down.")
(defcustom +bidi-hebrew-font-scale 1.0
"What scale to display `+bidi-hebrew-font' at."
:type 'float)
(defface +bidi-hebrew-face `((t :font ,+bidi-hebrew-font)) "") (defface +bidi-hebrew-face `((t :font ,+bidi-hebrew-font)) "")
@ -17,7 +19,12 @@ font to that size. It's rarely a good idea to do so!")
Must be a `font-spec', see `doom-font' for examples. Must be a `font-spec', see `doom-font' for examples.
WARNING: if you specify a size for this font it will hard-lock any usage of this WARNING: if you specify a size for this font it will hard-lock any usage of this
font to that size. It's rarely a good idea to do so!") font to that size. It's rarely a good idea to do so! Set
`+bidi-arabic-font-scale' to scale the font up or down.")
(defcustom +bidi-arabic-font-scale 1.0
"What scale to display `+bidi-arabic-font' at."
:type 'float)
(defface +bidi-arabic-face `((t :font ,+bidi-arabic-font)) "") (defface +bidi-arabic-face `((t :font ,+bidi-arabic-font)) "")
@ -51,7 +58,10 @@ Warning: do not change this if you are using `+bidi-global-mode'.'"
(const :tag "Right to Left" right-to-left) (const :tag "Right to Left" right-to-left)
(const :tag "Dynamic, according to paragraph text" nil))) (const :tag "Dynamic, according to paragraph text" nil)))
;;;###autoload
(defvar +bidi-mode-map (make-sparse-keymap)
"Keymap for `+bidi-mode'.")
(define-minor-mode +bidi-mode (define-minor-mode +bidi-mode
"Minor mode for using bidirectional text in a buffer. "Minor mode for using bidirectional text in a buffer.
@ -85,9 +95,24 @@ easier."
(define-globalized-minor-mode +bidi-global-mode +bidi-mode +bidi-mode) (define-globalized-minor-mode +bidi-global-mode +bidi-mode +bidi-mode)
(defun +bidi--set-font (name)
(when-let* ((font-name (format "+bidi-%s-font" name))
(font-var (or (intern-soft font-name) (error "Invalid font: %s" name)))
(font (symbol-value font-var)))
(condition-case e
(let ((scale (symbol-value (intern (format "+bidi-%s-font-scale" name)))))
(set-fontset-font t 'hebrew font)
(set-face-font (intern (format "+bidi-%s-face" name)) font)
(when (/= scale 1.0)
(setf (alist-get (font-get font :family) face-font-rescale-alist nil nil #'equal)
scale)))
('error
(if (string-prefix-p "Font not available" (error-message-string e))
(warn "Missing font for `%s': %s" font-name (font-get font :family))
(signal (car e) (cdr e)))))))
(add-hook! 'after-setting-font-hook (add-hook! 'after-setting-font-hook
(defun +bidi-set-fonts-h () (defun +bidi-init-fonts-h ()
(set-fontset-font t 'hebrew +bidi-hebrew-font) (+bidi--set-font 'hebrew)
(set-fontset-font t 'arabic +bidi-arabic-font) (+bidi--set-font 'arabic)))
(set-face-font '+bidi-arabic-face +bidi-arabic-font)
(set-face-font '+bidi-hebrew-face +bidi-hebrew-font)))

View file

@ -1207,19 +1207,23 @@ between the two."
(map! :map evil-org-mode-map (map! :map evil-org-mode-map
:ni [C-return] #'+org/insert-item-below :ni [C-return] #'+org/insert-item-below
:ni [C-S-return] #'+org/insert-item-above :ni [C-S-return] #'+org/insert-item-above
;; navigate table cells (from insert-mode) (:unless evil-disable-insert-state-bindings
:i Cright (cmds! (org-at-table-p) #'org-table-next-field :i Cright (cmds! (org-at-table-p) #'org-table-next-field
#'org-end-of-line) #'org-end-of-line)
:i Cleft (cmds! (org-at-table-p) #'org-table-previous-field :i Cleft (cmds! (org-at-table-p) #'org-table-previous-field
#'org-beginning-of-line) #'org-beginning-of-line)
:i Cup (cmds! (org-at-table-p) #'+org/table-previous-row :i Cup (cmds! (org-at-table-p) #'+org/table-previous-row
#'org-up-element) #'org-up-element)
:i Cdown (cmds! (org-at-table-p) #'org-table-next-row :i Cdown (cmds! (org-at-table-p) #'org-table-next-row
#'org-down-element) #'org-down-element)
:ni CSright #'org-shiftright :i CSright #'org-shiftright
:ni CSleft #'org-shiftleft :i CSleft #'org-shiftleft
:ni CSup #'org-shiftup :i CSup #'org-shiftup
:ni CSdown #'org-shiftdown :i CSdown #'org-shiftdown)
:n CSright #'org-shiftright
:n CSleft #'org-shiftleft
:n CSup #'org-shiftup
:n CSdown #'org-shiftdown
;; more intuitive RET keybinds ;; more intuitive RET keybinds
:n [return] #'+org/dwim-at-point :n [return] #'+org/dwim-at-point
:n "RET" #'+org/dwim-at-point :n "RET" #'+org/dwim-at-point

View file

@ -34,7 +34,4 @@
(unless (bound-and-true-p jupyter-org-interaction-mode) (unless (bound-and-true-p jupyter-org-interaction-mode)
(jupyter-org-interaction-mode))) (jupyter-org-interaction-mode)))
;; Remove text/html since it's not human readable
(delq! :text/html jupyter-org-mime-types)
(require 'tramp)) (require 'tramp))

View file

@ -34,7 +34,7 @@ This function is called by `org-babel-execute-src-block'."
(concat (shell-quote-argument (executable-find plantuml-executable-path)) (concat (shell-quote-argument (executable-find plantuml-executable-path))
" --headless")) " --headless"))
((not (file-exists-p plantuml-jar-path)) ((not (file-exists-p plantuml-jar-path))
(error "Could not find plantuml.jar at %s" org-plantuml-jar-path)) (error "Could not find plantuml.jar at %s" plantuml-jar-path))
((concat "java " (cdr (assoc :java params)) " -jar " ((concat "java " (cdr (assoc :java params)) " -jar "
(shell-quote-argument (shell-quote-argument
(expand-file-name plantuml-jar-path))))) (expand-file-name plantuml-jar-path)))))

View file

@ -11,6 +11,7 @@ This module configures Emacs for use in the terminal, by providing:
- Cursor-shape changing across evil states (requires a terminal that supports - Cursor-shape changing across evil states (requires a terminal that supports
it). it).
- Mouse support in the terminal. - Mouse support in the terminal.
- Support for the [[https://sw.kovidgoyal.net/kitty/keyboard-protocol/][Kitty keyboard protocol]] in supported terminals.
** Maintainers ** Maintainers
/This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]] /This module has no dedicated maintainers./ [[doom-contrib-maintainer:][Become a maintainer?]]
@ -25,6 +26,7 @@ This module configures Emacs for use in the terminal, by providing:
** Packages ** Packages
- [[doom-package:clipetty]] if [[doom-module:+osc]] - [[doom-package:clipetty]] if [[doom-module:+osc]]
- [[doom-package:evil-terminal-cursor-changer]] if [[doom-module::editor evil]] - [[doom-package:evil-terminal-cursor-changer]] if [[doom-module::editor evil]]
- [[doom-package:kkp]]
- [[doom-package:xclip]] unless [[doom-module:+osc]] - [[doom-package:xclip]] unless [[doom-module:+osc]]
** Hacks ** Hacks

View file

@ -41,4 +41,9 @@
;; http://www.culater.net/software/SIMBL/SIMBL.php and ;; http://www.culater.net/software/SIMBL/SIMBL.php and
;; https://github.com/saitoha/mouseterm-plus/releases. That makes to support ;; https://github.com/saitoha/mouseterm-plus/releases. That makes to support
;; VT's DECSCUSR sequence. ;; VT's DECSCUSR sequence.
(add-hook 'tty-setup-hook #'evil-terminal-cursor-changer-activate) (use-package! evil-terminal-cursor-changer
:hook (tty-setup . evil-terminal-cursor-changer-activate))
;; Add support for the Kitty keyboard protocol.
(use-package! kkp
:hook (after-init . global-kkp-mode))

View file

@ -11,3 +11,5 @@
;; NOTE Despite the evil-* prefix, evil-terminal-cursor-changer does not depend ;; NOTE Despite the evil-* prefix, evil-terminal-cursor-changer does not depend
;; on evil (anymore). ;; on evil (anymore).
(package! evil-terminal-cursor-changer :pin "2358f3e27d89128361cf80fcfa092fdfe5b52fd8") (package! evil-terminal-cursor-changer :pin "2358f3e27d89128361cf80fcfa092fdfe5b52fd8")
(package! kkp :pin "ed9214329f11b095fc7bad06feb329b9f232258d")

View file

@ -11,4 +11,4 @@
:recipe (:host github :recipe (:host github
:repo "doomelpa/code-review" :repo "doomelpa/code-review"
:files ("graphql" "code-review*.el")) :files ("graphql" "code-review*.el"))
:pin "e4c34fa284da25d8e0bafbae4300f1db5bdcda44")) :pin "eeffdd9e20ad133e5981f216965445bfae20292a"))

View file

@ -7,4 +7,4 @@
(when (modulep! :editor evil +everywhere) (when (modulep! :editor evil +everywhere)
(package! evil-textobj-tree-sitter (package! evil-textobj-tree-sitter
:pin "a19ab9d89a00f4a04420f9b5d61b66f04fea5261")) :pin "041fcb9fbb00deac92a4e58b5fca03f7dc0a32e8"))