Skip to content

Commit

Permalink
emacs: umlauts
Browse files Browse the repository at this point in the history
  • Loading branch information
SqrtMinusOne committed Aug 24, 2024
1 parent d5c7b30 commit afb6dc1
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 4 deletions.
29 changes: 27 additions & 2 deletions .emacs.d/init.el
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,29 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
;; (lambda () (setq visual-fill-column-center-text t)))
)

(defvar my/default-accents
'((a . ä)
(o . ö)
(u . ü)
(s . ß)
(A . Ä)
(O . Ö)
(U . Ü)
(S . ẞ)))

(defun my/accent (arg)
(interactive "P")
(message "%s" arg)
(let* ((after? (eq accent-position 'after))
(char (if after? (char-after) (char-before)))
(curr (intern (string char)))
(default-diac (cdr (assoc curr my/default-accents))))
(if (and default-diac (not arg))
(progn
(delete-char (if after? 1 -1))
(insert (format "%c" default-diac)))
(call-interactively #'accent-company))))

(use-package accent
:straight (:host github :repo "eliascotto/accent")
:init
Expand All @@ -580,7 +603,7 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
"gs" #'accent-company)
(general-define-key
:states '(normal insert)
"M-n" #'accent-company)
"M-n" #'my/accent)
:commands (accent-menu)
:config
(general-define-key
Expand Down Expand Up @@ -3277,7 +3300,7 @@ With ARG, repeats or can move backward if negative."
(interactive)
(let* ((files
(thread-last
'("projects" "misc")
'("projects" "misc" "learning")
(mapcar (lambda (f)
(directory-files (concat org-directory "/" f) t (rx ".org" eos))))
(apply #'append)
Expand Down Expand Up @@ -8971,6 +8994,8 @@ to `dired' if used interactively."
(cond
((string-match-p (rx bos (? "CAPTURE-") (= 14 num) "-" (* not-newline) ".org" eos) name)
"<ORG-ROAM>")
((string-match-p (rx "german" (* not-newline) ".org" eos) name)
"<LEARNING>")
((string-match-p (rx bos (+ num) "-" (+ num) "-" (+ num) ".org" eos) name)
"<ORG-JOURNAL>")
((string-match-p (rx bos "EXWM") name)
Expand Down
29 changes: 27 additions & 2 deletions Emacs.org
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,29 @@ References:
Input accented characters.

#+begin_src emacs-lisp
(defvar my/default-accents
'((a . ä)
(o . ö)
(u . ü)
(s . ß)
(A . Ä)
(O . Ö)
(U . Ü)
(S . ẞ)))

(defun my/accent (arg)
(interactive "P")
(message "%s" arg)
(let* ((after? (eq accent-position 'after))
(char (if after? (char-after) (char-before)))
(curr (intern (string char)))
(default-diac (cdr (assoc curr my/default-accents))))
(if (and default-diac (not arg))
(progn
(delete-char (if after? 1 -1))
(insert (format "%c" default-diac)))
(call-interactively #'accent-company))))

(use-package accent
:straight (:host github :repo "eliascotto/accent")
:init
Expand All @@ -1047,7 +1070,7 @@ Input accented characters.
"gs" #'accent-company)
(general-define-key
:states '(normal insert)
"M-n" #'accent-company)
"M-n" #'my/accent)
:commands (accent-menu)
:config
(general-define-key
Expand Down Expand Up @@ -4538,7 +4561,7 @@ A function to open a file from =org-directory=, excluding a few directories like
(interactive)
(let* ((files
(thread-last
'("projects" "misc")
'("projects" "misc" "learning")
(mapcar (lambda (f)
(directory-files (concat org-directory "/" f) t (rx ".org" eos))))
(apply #'append)
Expand Down Expand Up @@ -12425,6 +12448,8 @@ Some functions to override the displayed message:
(cond
((string-match-p (rx bos (? "CAPTURE-") (= 14 num) "-" (* not-newline) ".org" eos) name)
"<ORG-ROAM>")
((string-match-p (rx "german" (* not-newline) ".org" eos) name)
"<LEARNING>")
((string-match-p (rx bos (+ num) "-" (+ num) "-" (+ num) ".org" eos) name)
"<ORG-JOURNAL>")
((string-match-p (rx bos "EXWM") name)
Expand Down

0 comments on commit afb6dc1

Please sign in to comment.