* 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 ()
+ (defun vertalen--parse-vertalen ()
"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.*"))
(add-to-list 'define-word-services
'(vertalen
"https://www.vertalen.nu/vertaal?van=nl&naar=en&vertaal=%s"
- vertalen-handle-response)))
+ vertalen--parse-vertalen)))
+
+ (defun vertalen (word)
+ "Translate WORD."
+ (interactive "M")
+ (define-word word 'vertalen))
+
+ (defun vertalen-at-point ()
+ "Translate word at point."
+ (interactive)
+ (vertalen (thing-at-point 'word t)))
+
+ (defvar-keymap vertalen-mode-map
+ :doc "Keymap for `vertalen-mode' buffers."
+ "RET" #'vertalen-at-point)
+
+ (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))
#+end_src
* Package archives
:PROPERTIES:
(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 "V" #'vertalen-at-point)
(keymap-set ctl-x-map "G" #'gnus)
(keymap-set ctl-x-map "E" #'elfeed)
(keymap-set ctl-x-map "j" #'org-agenda)
"Prompt for a URL or keywords to search the web for."
(interactive)
(require 'eww)
- (eww (completing-read "Browse or search: "
- eww-prompt-history
- nil nil nil
- 'eww-prompt-history
- (car (eww-suggested-uris)))))
+ (eww (mapconcat #'identity
+ (completing-read-multiple "Browse or search: "
+ eww-prompt-history
+ nil nil nil
+ 'eww-prompt-history
+ (car (eww-suggested-uris)))
+ " ")))
#+end_src
*** Use =eww= as the default web browser
(global-corfu-mode)
(marginalia-mode)
(add-to-list 'completion-at-point-functions #'cape-file)
-; (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*"