:END:
#+begin_src emacs-lisp
- (setq modus-themes-mode-line '(borderless accented))
- (setq modus-themes-region '(bg-only))
- (setq modus-themes-italic-constructs t)
- (setq modus-themes-prompts '(background))
- (setq modus-themes-hl-line '(accented))
- (setq modus-themes-subtle-line-numbers t)
- (setq modus-themes-paren-match '(intense))
- (setq modus-themes-org-blocks '(tinted-background))
+ (setq modus-themes-mode-line '(borderless accented)
+ modus-themes-region '(bg-only)
+ modus-themes-italic-constructs t
+ modus-themes-prompts '(bold)
+ modus-themes-hl-line '(accented)
+ modus-themes-subtle-line-numbers t
+ modus-themes-paren-match '(intense)
+ modus-themes-org-blocks '(tinted-background))
(load-theme 'modus-vivendi)
#+end_src
+* Dutch to English translation with =define-word= and [[https://www.vertalen.nu/][vertalen.nu]]
+
+#+begin_src emacs-lisp
+ (define-derived-mode vertalen-mode tabulated-list-mode "Vertalen"
+ "Major mode for listing Dutch to English translations."
+ (setq tabulated-list-format [("Source Language" 64 t)
+ ("Target Language" 32 t)])
+ (tabulated-list-init-header)
+ (tabulated-list-print))
+
+ (defun vertalen-define-word-at-point ()
+ (interactive)
+ (define-word-at-point nil 'vertalen))
+
+ (define-key vertalen-mode-map (kbd "C-m") #'vertalen-define-word-at-point)
+ ; (define-key vertalen-mode-map (kbd "l") #'vertalen-previous-word)
+ ; (define-key vertalen-mode-map (kbd "r") #'vertalen-next-word)
+
+ (defun vertalen-handle-response ()
+ "Populate `tabulated-list-entries' and display the results."
+ (let* ((dom (libxml-parse-html-region (point-min) (point-max)))
+ (res (dom-by-class dom ".*result-item-translations.*"))
+ (act (with-selected-window (selected-window)
+ (unless (eq major-mode 'vertalen-mode)
+ `(nil . ((inhibit-same-window . t)))))))
+ (with-current-buffer-window "*vertalen*" act #'fit-window-to-buffer
+ (setq tabulated-list-entries nil)
+ (dolist (elem res)
+ (setq tabulated-list-entries
+ `((nil ,(vector
+ (apply #'concat
+ (dom-strings
+ (car (dom-by-class
+ elem
+ ".*result-item-source.*"))))
+ (mapconcat #'identity
+ (dom-strings
+ (car (dom-by-class
+ elem
+ ".*result-item-target.*")))
+ ", ")))
+ . ,tabulated-list-entries)))
+ (setq tabulated-list-entries (reverse tabulated-list-entries))
+ (vertalen-mode)
+ (+ 2 (length tabulated-list-entries))))
+ (with-current-buffer "*vertalen*"
+ (mapconcat #'identity (cadar tabulated-list-entries) ": ")))
+
+ (with-eval-after-load 'define-word
+ (add-to-list 'define-word-services
+ '(vertalen
+ "https://www.vertalen.nu/vertaal?van=nl&naar=en&vertaal=%s"
+ vertalen-handle-response)))
+#+end_src
* Package archives
:PROPERTIES:
:CUSTOM_ID: package-archives
(keymap-set ctl-x-map "c" #'org-capture)
(keymap-set ctl-x-map "o" #'ace-window)
(keymap-set ctl-x-map "w" #'esy/eww)
+ (keymap-set ctl-x-map "V" #'vertalen-define-word-at-point)
(keymap-set ctl-x-map "G" #'gnus)
(keymap-set ctl-x-map "E" #'elfeed)
(keymap-set ctl-x-map "j" #'org-agenda)
(global-corfu-mode)
(marginalia-mode)
(add-to-list 'completion-at-point-functions #'cape-file)
- (add-to-list 'completion-at-point-functions #'cape-dabbrev)
+; (add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
(add-to-list 'display-buffer-alist
'("*Completions*"