Skip to content

Instantly share code, notes, and snippets.

@enisozgen
Last active December 26, 2023 09:56
Show Gist options
  • Save enisozgen/fc4ed9ad300e954629c93a0ccb32a395 to your computer and use it in GitHub Desktop.
Save enisozgen/fc4ed9ad300e954629c93a0ccb32a395 to your computer and use it in GitHub Desktop.
ingilizce klavye ile yazılmış türkçe kelimeleri doğru yazmaya yarayan script
#!/bin/bash
# 1. Run `bash global-emacs-turkish-correct-buffer.sh` from rofi or set some keybinding for this command
# More info
# https://github.com/emres/turkish-mode
# http://denizyuret.blogspot.com/2006/11/emacs-turkish-mode.html
function global-emacs-turkish-correct-buffer
{
TEMPFILE="$(mktemp emacs-turkish-$(date +"%Y-%m-%dT%H-%M-%S").XXXXXXX --tmpdir)"
xsel --clipboard > "$TEMPFILE"
emacsclient -c -n --no-wait --eval "(find-file \"$TEMPFILE\")" \
--eval '(turkish-correct-buffer)' \
--eval '(save-buffer)' \
--eval '(set-visited-file-name nil)' \
--eval '(spacemacs/frame-killer)'
}
# Copy file
xdotool key --clearmodifiers ctrl+c
global-emacs-turkish-correct-buffer
cat $TEMPFILE | xclip -sel clip
# Paste output
xdotool key --clearmodifiers ctrl+v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment