;(mapc #'package-install '(ledger-mode jabber transpose-frame dictionary go-translate paredit multiple-cursors expand-region 0x0 po-mode pinentry rainbow-delimiters clhs emms ebdb plisp-mode markdown-mode magit)) (setq gnus-summary-expunge-below -10) (setq epa-file-select-keys t) ; Common Lisp (setq inferior-lisp-program "/usr/local/bin/sbcl") ;(load (expand-file-name "~/quicklisp/slime-helper.el")) ;(require 'slime) ;(slime-setup) (setq clhs-root "file:///usr/share/doc/clhs/HyperSpec/") ; Scheme (setq scheme-program-name "/usr/bin/mit-scheme") ;(setq scheme-program-name "gsi -:t") ; gambit ; EWW (setq browse-url-browser-function 'eww-browse-url) ;(setq eww-search-prefix "https://lite.qwant.com/?q=") ;(setq eww-search-prefix "https://www.mojeek.com/search?q=") (setq eww-search-prefix "http://www.google.com/search?q=") (setq url-cookie-untrusted-urls '(".")) (setq url-cookie-trusted-urls '("lists.gnupg.org")) (setq url-user-agent (shell-command-to-string "yt-dlp --dump-user-agent 2>/dev/null")) (setq eww-download-directory (expand-file-name "~/Downloads")) (setq shr-discard-aria-hidden t) (setq shr-max-width 179) (defun eww-half () (interactive) (setq shr-max-width 88) (eww-reload)) (defun eww-full () (interactive) (setq shr-max-width 179)) (require 'package) (with-eval-after-load 'package (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (add-to-list 'package-archives '("nongnu" . "https://elpa.nongnu.org/nongnu/"))) ;; unicode ;(set-selection-coding-system 'utf-8) ;(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) (set-language-environment "UTF-8") ; prefer utf-8 for language settings (prefer-coding-system 'utf-8) (set-default-coding-systems 'utf-8) (setq sendmail-coding-system 'utf-8) (with-eval-after-load "ispell" (setenv "LANG" "pt_PT.UTF-8") (setq ispell-program-name "/usr/bin/hunspell") (setq ispell-dictionary "en_GB,pt_PT") (ispell-set-spellchecker-params) (ispell-hunspell-add-multi-dic "en_GB,pt_PT") (setq ispell-personal-dictionary (expand-file-name "~/.hunspell_personal"))) (keymap-global-set "C-c s" 'ispell) (setq make-backup-files nil) (setq gc-cons-treshold 20000000) (setq sentence-end-double-space nil) (setq fill-column 72) ;; deleting trailing whitespace (add-hook 'before-save-hook #'delete-trailing-whitespace) ;; lisp show parenthesis (show-paren-mode) ;; lisp pair up parenthesis (electric-pair-mode) ;; lisp color parenthesis automatic (package rainbow-delimiters) (add-hook 'lisp-mode-hook #'rainbow-delimiters-mode) (add-hook 'eldoc-mode-hook #'rainbow-delimiters-mode) ;; time european (setq calendar-time-display-form '(24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))) (setq display-time-24hr-format t) ;; display time (display-time-mode) ;; switch command mode (require 'ido) (ido-mode t) ;; winner-mode (setq winner-dont-bind-my-keys t) (winner-mode 1) (keymap-global-set "C-x w " 'winner-undo) (keymap-global-set "C-x w " 'winner-redo) ;; windmove (keymap-global-set "C-c " 'windmove-up) (keymap-global-set "C-c " 'windmove-left) (keymap-global-set "C-c " 'windmove-down) (keymap-global-set "C-c " 'windmove-right) ;; identation for C (setq-default indent-tabs-mode nil) ; spaces instead of tabs ;(setq c-default-style "gnu") ;(setq c-basic-offset 4) ;; info (setq Info-hide-note-references 'hide) ;; org mode (setq org-export-with-toc nil) ;; make (defun make-make () (interactive) (shell-command "make > /dev/null 2>&1") (message "Make done.")) (keymap-global-set "C-c RET m" 'make-make) ;; keybindings (keymap-global-set "C-w" 'backward-kill-word) (keymap-global-set "M-DEL" 'kill-region) (keymap-global-set "C-x %" 'shrink-window) ; lisp with paredit (keymap-global-set "C-c M-q" 'slime-close-all-parens-in-sexp) (keymap-global-set "C-c M-<" 'paredit-forward-barf-sexp) (keymap-global-set "C-c M->" 'paredit-forward-slurp-sexp) ;(keymap-global-set "" 'paredit-splice-sexp-killing-backward) ;(keymap-global-set "ESC DEL" 'paredit-kill-region) (add-hook 'lisp-mode-hook #'enable-paredit-mode) (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) (defun my-split-window-below () (interactive) (split-window-below) (set-window-buffer (next-window) (other-buffer)) (other-window 1)) (keymap-global-set "C-x 2" #'my-split-window-below) (defun my-split-window-right () (interactive) (split-window-right) (set-window-buffer (next-window) (other-buffer)) (other-window 1)) (keymap-global-set "C-x 3" #'my-split-window-right) ; gdb gud ;(gdb-many-windows) ; ledger (setq ledger-default-commodity 'EUR) ;; gnus (setq user-full-name "Daniel Cerqueira") (setq user-mail-address "danny@brilhante.top") (setq message-kill-buffer-on-exit t) ;; C-c C-c killing the buffer (setq mml-secure-openpgp-signers '("0x2D3C49A28079BBBD") ;; We want to be able to read the emails we wrote. mml-secure-openpgp-encrypt-to-self t ;; always verify signatures mm-verify-option 'always ;; show result of pgp verification gnus-buttonized-mime-types '("multipart/signed" "multipart/encrypted") ) ;; Attempt to sign all the mails we'll be sending. (add-hook 'gnus-message-setup-hook #'mml-secure-message-sign) ;;; open gnus in topics mode (add-hook 'gnus-group-mode-hook 'gnus-topic-mode) ;;; lines with time (setq gnus-summary-line-format "%U%R%z%I %4L %(%[%-25,25D %-23,23f%]%) %s ") ;;; order threads by most recent date (setq gnus-thread-sort-functions '(gnus-thread-sort-by-most-recent-date)) ;;; show headers of emails ;(setq gnus-show-all-headers 't) (setq gnus-select-method '(nnmaildir "email" (directory (expand-file-name "~/.mail/")))) (setq gnus-secondary-select-methods '( (nntp "news.eternal-september.org") (nntp "news.gmane.io") (nntp "news.gwene.org") ;; (nntp "news.solani.org") (nntp "paganini.bofh.team") (nntp "news.tilde.club" (nntp-address "news.tilde.club") (nntp-via-user-name "danisanti") (nntp-via-address "tilde.institute") (nntp-via-rlogin-command "ssh") (nntp-via-rlogin-command-switches ("-C")) (nntp-netcat-switches ("-w" "15")) (nntp-open-connection-function nntp-open-via-rlogin-and-netcat)) ; (nntp "news.netfront.net") (nnmaildir "email" (directory (expand-file-name "~/.mail/"))) )) (setq gnus-message-archive-group "nnmaildir+email:sent") (setq nndraft-directory (expand-file-name "~/.mail/drafts/")) ;(setq nndraft-current-group "drafts") ;(setcdr (assoc 'nndraft-directory (nnoo-variables 'nndraft)) nndraft-directory) (setq message-directory (expand-file-name "~/.mail/")) (setq gnus-directory (expand-file-name "~/.emacs.d/news/")) (setq nnfolder-directory (expand-file-name "~/.mail/archive")) ;; auto-expire newsgroups ;(setq gnus-auto-expirable-newsgroups "gwene.*\\|gmane.*") ;;; mailcap (eval-after-load 'mailcap (mailcap-parse-mailcaps)) ;;; gnus ssh tilde smtp (require 'smtpmail) (defun tilde-ssh-smtpmail () (let* ((smtpmail-smtp-server "localhost") (smtpmail-smtp-service 2525) (smtpmail-stream-type nil) (smtp-local-domain "tilde.institute") (smtp-sendto-domain "tilde.institute") (sendmail (start-process "ssh-smtp" nil "/usr/bin/ssh" "-L" "2525:localhost:25" "institute" "cat")) (ready-p nil) (sendmail-filter (lambda (p s) (if (string-match "tunnel is ready" s) (setq ready-p t) (message "Received from SSH connection: %s" s))))) (unwind-protect (progn (set-process-filter sendmail sendmail-filter) (process-send-string sendmail "tunnel is ready\n") (while (not ready-p) (accept-process-output sendmail)) (message "") (smtpmail-send-it)) (process-send-eof sendmail) ; ask it nicely first (kill-process sendmail)))); if that does nothing, inhume it forcefully (defun smtp-tilde () (interactive) (setq send-mail-function 'tilde-ssh-smtpmail) (setq message-send-mail-function 'tilde-ssh-smtpmail)) (defun smtp-yandex-native () (interactive) (setq send-mail-function 'smtpmail-send-it message-send-mail-function 'smtpmail-send-it smtpmail-smtp-server "smtp.yandex.com" smtpmail-smtp-service 465 smtpmail-stream-type 'ssl)) (defun smtp-msmtp () (interactive) (setq message-sendmail-f-is-evil 't) (setq message-sendmail-extra-arguments '("--read-envelope-from")) (setq message-send-mail-function 'message-send-mail-with-sendmail) (setq sendmail-program "/usr/bin/msmtp") ; (setq message-sendmail-extra-arguments '("-a" "anderson")) ) ;;; gnus multiple email; variables (setq my-other-email-addresses (list (list "danisanti@tilde.institute" "danisanti" "tilde") (list "dan.list@brilhante.top" user-full-name "list" ) (list "dan.git@brilhante.top" user-full-name "git" ) (list "dan.work@brilhante.top" user-full-name "job-hunting" ) (list "dan.penpal@brilhante.top" user-full-name "penpal" ) )) (setq message-alternative-emails (regexp-opt (mapcar 'car my-other-email-addresses))) ;; gnus multiple email; functions (defun my-email-set-field (search-tag insert-line) "Set email SEARCH-TAG header line as this INSERT-LINE" (save-excursion (goto-char (point-min)) (re-search-forward (concat "^" search-tag ":.*$") nil) (replace-match insert-line))) (defun my-email-set-fields (email name gcc) "Set From and Gcc header's fields" (my-email-set-field "From" (concat "From: " (if name name user-full-name) " <" email ">")) (my-email-set-field "Gcc" (concat "Gcc: " gcc))) (defun my-email-get-from-address () "Get current From email address from the email compose buffer" (interactive) (save-excursion (goto-char (point-min)) (re-search-forward "^From:.*<\\(.*\\)>$" nil) (substring-no-properties (match-string 1)))) (defun gnus-email-set-loop (&optional my-tmp-email-list current-address) "Email loop and set through all of the my-other-email-addresses variable items" (interactive) (or my-tmp-email-list (setq my-tmp-email-list (cons (list user-mail-address user-full-name gnus-message-archive-group) my-other-email-addresses))) (or current-address (setq current-address (my-email-get-from-address))) (cond ((null (cdr my-tmp-email-list)) (my-email-set-fields user-mail-address user-full-name gnus-message-archive-group)) ((equal current-address (caar my-tmp-email-list)) (my-email-set-fields (caadr my-tmp-email-list) (cadadr my-tmp-email-list) (car (cddadr my-tmp-email-list)))) (t (gnus-email-set-loop (cdr my-tmp-email-list))))) (keymap-global-set "C-c f" 'gnus-email-set-loop) (defun sending-email () (interactive) (ebdb-message-auto-update) ; this value already was in message-send-hook (let ((from-address (my-email-get-from-address))) (cond ((equal from-address "danisanti@tilde.institute") (smtp-tilde)) (t (smtp-msmtp))))) (add-hook 'message-send-hook #'sending-email) ;; gnus news article reply automation (defun my-email-set-as-news () "Set email as news" (interactive) (mml-unsecure-message) (my-email-set-fields "dan.list@brilhante.top" user-full-name "list")) (add-hook 'gnus-news-article-reply-hook #'my-email-set-as-news) ;; gnus pgp (setq gnus-message-replysign t) (setq gnus-message-replysignencrypted t) ;; gnus pgp hooks (defun gnus-set-gcc-as-cryptosent () (interactive) (my-email-set-field "Gcc" "Gcc: crypto-sent")) (defun gnus-set-default-gcc () (interactive) (my-email-set-field "Gcc" "Gcc: sent")) (add-hook 'mml-unsecure-message-hook #'gnus-set-default-gcc) (add-hook 'mml-secure-message-sign-hook #'gnus-set-default-gcc) (add-hook 'mml-secure-message-sign-encrypt-hook #'gnus-set-gcc-as-cryptosent) ;; gnus activate yubikey on sending (defun yubikey-pin () (interactive) (async-shell-command "~/bin/pass name >/dev/null") ; (display-buffer-no-window "*Async Shell Command*" '((allow-no-window t))) ; (kill-buffer "*Async Shell Command*") (switch-to-buffer-other-window "*Async Shell Command*")) ;; gnus rss (setq nnrss-directory (expand-file-name "~/.emacs.d/gnus/rss/")) ;; gnus in M-x mail (setq mail-user-agent 'gnus-user-agent) ;; read mail in Gnus (setq read-mail-command 'gnus) ;; gnus atom feeds (require 'mm-url) (defadvice mm-url-insert (after DE-convert-atom-to-rss () ) "Converts atom to RSS by calling xsltproc." (when (re-search-forward "xmlns=\"http://www.w3.org/.*/Atom\"" nil t) (goto-char (point-min)) (message "Converting Atom to RSS... ") (call-process-region (point-min) (point-max) "xsltproc" t t nil (expand-file-name "~/.emacs.d/gnus/atom2rss.xsl") "-") (goto-char (point-min)) (message "Converting Atom to RSS... done"))) (ad-activate 'mm-url-insert) ;;; gnus shortcut (keymap-global-set "C-x g g" (lambda () (interactive) (tab-bar-new-tab-to 1) (tab-rename "gnus") (gnus))) ;; gpg pinentry (unless (bound-and-true-p pinentry--server-process) (pinentry-start)) ;;; trying to setup the more secure loopback with pinentry on Emacs. Unsuccessful. ;; (setq epg-pinentry-mode 'loopback) (defun pinentry-restart () (interactive) (pinentry-stop) (pinentry-start) (shell-command "~/bin/gpg-reload")) ;; get mail function (defun fetch-mail-alt () (interactive) (save-excursion (if (not (get-buffer "*shell*")) (shell)) (set-buffer "*shell*") (goto-char (point-max)) (insert "fdm fetch") (comint-send-input))) (defun fetch-mail () (interactive) (eval-expression ;the below line is a fix of (shell-command-to-string command) (with-output-to-string (with-current-buffer standard-output ; (shell-command "fdm fetch" t) ; ver e editar o codigo desta funcao ; (start-process-shell-command "fdm" nil "fdm fetch &") (async-shell-command "fdm fetch") ))) (switch-to-buffer-other-window "*Async Shell Command*")) (keymap-global-set "C-x g f" 'fetch-mail) ;; ebdb (require 'ebdb-gnus) (require 'ebdb-message) (setq ebdb-record-self "36b79c52-1bbf-432a-9c80-c84e056fbcd1") ;; irc (setq erc-nick "danisanti") (setq erc-user-full-name user-full-name) (setq erc-session-client-certificate t) (setq erc-track-enable-keybindings nil) (setq erc-hide-list '("PART" "QUIT")) ; hide irc part and quit messages (join is allowed) (defun libera-irc () "Auto-login into Libera.Chat IRC" (interactive) (erc-tls :server "irc.libera.chat" :port 6697 :client-certificate `(,(expand-file-name "~/.certs/libera.key") ,(expand-file-name "~/.certs/libera.crt")) :id "Libera.Chat") (tab-bar-new-tab-to 2) (tab-rename "libera irc") (switch-to-buffer "Libera.Chat")) (defun tilde-irc () "Login into tilde IRC" (interactive) (tilde) (tab-bar-new-tab-to 2) (tab-rename "tilde irc") (switch-to-buffer "Tilde.Chat")) (defun tilde () "Login into tilde IRC" (interactive) (erc-tls :server "irc.tilde.chat" :port 6697 :nick "danisanti" :client-certificate `(,(expand-file-name "~/.certs/libera.key") ,(expand-file-name "~/.certs/libera.crt")) :id "Tilde.Chat")) (defun newnet-irc () "Login into Newnet IRC" (interactive) (newnet) (tab-bar-new-tab-to 2) (tab-rename "newnet irc") (switch-to-buffer "Newnet")) (defun newnet () "Login into newnet IRC" (interactive) (erc-tls :server "irc.newnet.net" :port 6697 :nick "danisanti" :client-certificate `(,(expand-file-name "~/.certs/libera.key") ,(expand-file-name "~/.certs/libera.crt")) :id "Newnet")) (defalias 'irc 'libera) (defalias 'irc-other 'erc-tls) ;; emms (emms-all) (setq emms-player-list '(emms-player-mpv emms-player-vlc) emms-info-functions '(emms-info-native) emms-source-file-default-directory (expand-file-name "~/me/files/audio/music/")) (setq emms-volume-pulse-sink 0) ; set the default pulseaudio sound interface (customize-set-variable 'emms-player-mpv-update-metadata t) ; mpv show stream track info ;;; metadata (require 'emms-info-exiftool) (setq emms-info-functions '(emms-info-exiftool)) ; pacman -S perl-image-exiftool ;;; music filters ;;;; (emms-browser-show-chill) (emms-browser-make-filter "chill" (emms-browser-filter-only-dir "~/me/files/audio/music/chillhop-essentials/")) ;;;; (emms-browser-show-main) (emms-browser-make-filter "main" nil) (defun chill () "Play my ChillHop music" (interactive) ;; (setq emms-random-playlist t) ;; (emms-play-directory-tree (expand-file-name "~/me/files/audio/music/chillhop-essentials/")) ;; (emms-random) (shell-command "sort -R ~/me/files/audio/playlist/chillhop.m3u | sort -R | sort -R > ~/me/files/audio/playlist/chillhop-shuffle.m3u") (emms-play-playlist-file (expand-file-name "~/me/files/audio/playlist/chillhop-shuffle.m3u")) (message "Sit back and Chill...")) ;;; volume mode timeout (setq emms-volume-mode-timeout 9) (keymap-global-set "C-x p +" 'emms-volume-mode-plus) (keymap-global-set "C-x p -" 'emms-volume-mode-minus) (keymap-global-set "C-x p " 'chill) (keymap-global-set "C-x p " 'emms-stop) (keymap-global-set "C-x p " 'emms-next) (keymap-global-set "C-x p " 'emms-previous) (keymap-global-set "C-x p ." 'emms-show) ;; set audio output (defun set-speakers-jack () "Set audio speakers as jack headphones" (interactive) (shell-command "pactl set-default-sink 1") (setq emms-volume-pulse-sink 1)) (defun set-speakers-usb () "Set audio speakers as usb speaker" (interactive) (shell-command "pactl set-default-sink 0") (setq emms-volume-pulse-sink 0)) ;; calendar (setq calendar-latitude 41.15) (setq calendar-longitude -8.61024) (setq calendar-location-name "Porto") (setq calendar-week-start-day 1) ; start on Monday ;;; holidays ;;;; disable following holidays (setq holiday-hebrew-holidays nil holiday-islamic-holidays nil holiday-bahai-holidays nil holiday-oriental-holidays nil) ;;;; disable some (setq holiday-general-holidays '((holiday-fixed 1 1 "New Year's Day") (holiday-fixed 2 14 "Valentine's Day") (holiday-fixed 3 17 "St. Patrick's Day") (holiday-fixed 4 1 "April Fools' Day"))) ;;;; portugal holidays (national and religious) (setq holiday-portugal-holidays '((holiday-easter-etc -47 "Carnaval") (holiday-fixed 3 19 "Dia do Pai") (holiday-easter-etc -2 "Sexta-feira Santa") (holiday-fixed 4 25 "Dia da Liberdade") (holiday-fixed 5 1 "Dia do Trabalhador") (holiday-float 5 0 1 "Dia da Mãe") (holiday-easter-etc 60 "Corpo de Deus") (holiday-fixed 6 10 "Dia de Portugal") (holiday-fixed 8 15 "Assunção de Nossa Senhora") (holiday-fixed 10 5 "Implantação da República") (holiday-fixed 11 1 "Todos os Santos") (holiday-fixed 12 1 "Restauração da Independência") (holiday-fixed 12 8 "Imaculada Conceição"))) ;;;; fun days (setq holiday-fun-days '((holiday-fixed 2 7 "Dia de Enviar um Postal a um/a Amigo/a") (holiday-float 2 1 2 "Dia de Limpar o teu Computador") (holiday-fixed 2 22 "Dia de Single Tasking") (holiday-fixed 3 1 "Dia Mundial do Elogio") (holiday-fixed 3 3 "Dia de Eu Quero que Sejas Feliz") (holiday-fixed 3 14 "Dia do PI") (holiday-fixed 3 19 "Dia de Vamos Rir") (holiday-fixed 3 25 "Dia do Waffle") (holiday-fixed 4 23 "Dia do/a Amante") (holiday-fixed 5 6 "Dia da Bebida") (holiday-fixed 5 9 "Dia da Europa") (holiday-fixed 5 28 "Dia da Hamburga") (holiday-fixed 6 4 "Dia de Abraçar o Teu Gato/a") (holiday-fixed 6 17 "Dia de Comer os Teus Vegetais") (holiday-fixed 7 12 "Dia da Simplicidade") (holiday-float 7 0 3 "Dia do Gelado") (holiday-fixed 7 24 "Dia do/a Primo/a") (holiday-fixed 7 26 "Dia do/a Tia/o") (holiday-fixed 7 29 "Dia da Lasanha") (holiday-float 8 5 1 "Dia Internacional da Cerveja") (holiday-float 8 0 1 "Dia da Irmã") (holiday-fixed 8 9 "Dia do/a Amante de Livros") (holiday-fixed 8 11 "Dia do/a Filho/a") (holiday-fixed 8 15 "Dia do Relaxamento") (holiday-fixed 9 5 "Dia da Pizza de Queijo") (holiday-fixed 9 6 "Dia de Ler um Livro") (holiday-float 10 1 3 "Dia Nacional de Limpar o Desktop Virtual") (holiday-fixed 10 27 "Dia da Cerveja Americana") (holiday-fixed 10 29 "Dia da Internet") (holiday-fixed 11 1 "Dia do/a Autor(a)") (holiday-float 11 4 1 "Dia de Homens Fazem o Jantar") (holiday-fixed 11 21 "Dia Mundial do Olá") (holiday-fixed 11 29 "Dia do Cartão Eletrónico") (holiday-fixed 12 9 "Dia do Cartão de Natal") (holiday-fixed 12 20 "Dia da Sangria"))) ;;;; United Nations days (setq holiday-un-days '((holiday-fixed 1 24 "International Day of Education") (holiday-fixed 3 5 "International Day for Disarmament and Non-Proliferation Awareness") (holiday-fixed 3 20 "International Day of Happiness") (holiday-fixed 3 30 "International Day of Zero Waste") (holiday-fixed 4 5 "International Day of Conscience") (holiday-fixed 4 23 "World Book and Copyright Day") (holiday-fixed 5 5 "World Portuguese Language Day") (holiday-fixed 5 16 "International Day of Living Together in Peace") (holiday-fixed 5 21 "International Tea Day") (holiday-fixed 5 31 "World No-Tobacco Day") (holiday-fixed 6 21 "International Day of Yoga") (holiday-fixed 7 30 "International Day of Friendship") (holiday-fixed 9 15 "International Day of Democracy") (holiday-fixed 9 21 "International Day of Peace") (holiday-fixed 9 28 "International Day for Universal Access to Information") (holiday-fixed 10 2 "International Day of Non-Violence") (holiday-fixed 10 10 "World Mental Health Day") (holiday-fixed 10 16 "World Food Day") (holiday-fixed 12 10 "Human Rights Day") (holiday-fixed 12 12 "International Day of Neutrality"))) (setq holiday-other-holidays (append holiday-portugal-holidays holiday-un-days holiday-fun-days )) ;;;; local holidays ;;;;; Porto's holidays (setq holiday-porto-holidays '((holiday-fixed 6 24 "Festa de São João"))) (setq holiday-local-holidays (append holiday-porto-holidays )) (setq calendar-mark-holidays-flag t) ; enable holidays in calendar (setq calendar-date-style 'european) ;;; diary (setq calendar-mark-diary-entries-flag t) ; enable diary in calendar (setq diary-comment-start ";") ; set comments for diary files ;;;; enable include facility in diary files (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files) (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files) ;;; cal function (defun cal () (interactive) (calendar) (kill-buffer "diary")) ;; translate (require 'go-translate) ;;; my own render translator (defclass gts-insert-render (gts-render) ()) (cl-defmethod gts-out ((_ gts-insert-render) task) (delete-region (point) (mark)) (with-slots (err parsed) task (insert (if (listp parsed) (string-join parsed "\n\n") parsed)) (deactivate-mark))) ;;; translation config (setq gts-translate-list '(("en" "pt"))) (setq gts-default-translator (gts-translator :picker (gts-noprompt-picker) ; (gts-prompt-picker) :engines (list (gts-google-engine) (gts-bing-engine) ) :render (gts-buffer-render) )) (defun gts-do-translate-yank () "Translate by yank" (interactive) (gts-translate (gts-translator :picker (gts-noprompt-picker) :engines (list ; (gts-google-engine) (gts-bing-engine) ) :render (gts-kill-ring-render) ))) (defun gts-do-translate-insert () "Translate by substitution" (interactive) (gts-translate (gts-translator :picker (gts-noprompt-picker) :engines (list ; (gts-google-engine) (gts-bing-engine) ) :render (gts-insert-render) ))) (keymap-global-set "C-c t" 'gts-do-translate) (keymap-global-set "C-c T" 'gts-do-translate-insert) ;;; po substitution (defun po-subst-word (target replacement) (beginning-of-buffer) (replace-string target replacement)) (defun po-subst-gnupg () (interactive) (po-subst-word "senha" "frase-secreta") (po-subst-word "frase secreta" "frase-secreta") (po-subst-word "frases secretas" "frases-secretas") (po-subst-word "SSH" "ssh") (po-subst-word "o cache" "a cache") (po-subst-word "um cache" "uma cache") (po-subst-word "não alfa" "não alfabéticos") (po-subst-word "mouse" "rato") (po-subst-word "soquete" "socket") (po-subst-word "agente GPG" "gpg-agent") (po-subst-word "agente gpg" "gpg-agent") (po-subst-word "escutando" "ouvindo") (po-subst-word "o diretório" "a pasta") (po-subst-word "diretório" "pasta") (po-subst-word "manipulador" "handler") (po-subst-word "arquivo" "ficheiro") (po-subst-word "do usuário" "de utilizador") (po-subst-word "usuário" "utilizador") (po-subst-word "placas" "cartões") (po-subst-word "placa" "cartão") (po-subst-word "não." "nº") (po-subst-word "cadeia de caracteres" "string") (po-subst-word "criptografia" "cifragem") (po-subst-word "encripta" "cifra") (po-subst-word "desencripta" "decifra") (po-subst-word "administrador" "Admin") (po-subst-word "modo de lote" "modo batch") (po-subst-word "excluí" "apaga") (po-subst-word "exclui" "apaga") (po-subst-word "somente" "só") (po-subst-word "(s/n)" "(s/N)") (po-subst-word "e-mail" "email") (po-subst-word "e armadura" "a blindagem") (po-subst-word "armadura" "blindagem") (po-subst-word "compactaç" "compress") (po-subst-word "propriedade" "ownership") (po-subst-word "listagens de assinatura" "listagens de assinaturas") (po-subst-word "autoassina" "auto-assina") (po-subst-word "tecla" "chave") (po-subst-word "conjunto de chaves" "porta-chaves") (po-subst-word "chaveiro" "porta-chaves") (po-subst-word "agente" "agent") (po-subst-word "mescla" "fundi") (po-subst-word "detect" "detet") (po-subst-word "insir" "introduz") (po-subst-word "digite" "introduza") (po-subst-word "cartão inteligente" "smartcard") (po-subst-word "Você realmente quer" "De certeza que você deseja") (po-subst-word "Você realmente" "De certeza que você") (po-subst-word "você realmente quer" "de certeza que você deseja") (po-subst-word "você realmente" "de certeza que você") (po-subst-word "um banco de dados" "uma base de dados") (po-subst-word "o banco de dados" "a base de dados") (po-subst-word "Realmente" "De certeza que deseja") (po-subst-word "primária" "principal") (po-subst-word "primário" "principal") (po-subst-word "o ID" "a ID") (po-subst-word "um ID" "uma ID") (po-subst-word "portanto" "por isso") (po-subst-word "resumo" "digest") (po-subst-word "descriptograf" "decifr") (po-subst-word "preterid" "depreciad") (po-subst-word "um documento de identificação com foto" "uma ID fotográfica") (po-subst-word "o documento de identificação com foto" "a ID fotográfica") (po-subst-word "diretoria" "pasta") (po-subst-word "acessar" "aceder") (po-subst-word "essa" "esta") (po-subst-word "esse" "este") (po-subst-word "Observação:" "Nota:") (po-subst-word "cadeia" "corrente") (po-subst-word "assunto" "entidade") (po-subst-word "gravar" "escrever") (po-subst-word "registro" "registo") (po-subst-word "carimbo de data/hora" "timestamp") (po-subst-word "expressão S" "S-expression") (po-subst-word "detect" "detet") (end-of-buffer)) ;;; temp po functions (defun dan-gnupg () (interactive) (po-next-entry) (po-edit-msgstr) (mark-whole-buffer) (gts-do-translate-insert) (keyboard-quit) (po-subst-gnupg) ) (keymap-global-set "C-c v" 'dan-gnupg) (keymap-global-set "C-c b" 'po-subst-gnupg) ;; emerge (setq emerge-combine-versions-template "%a%b") ;; mastodon (keymap-global-set "C-x RET m" (lambda () (interactive) (eww "https://brutaldon.org") (rename-buffer "*mastodon*"))) ;; expand-region (keymap-global-set "C-c C-SPC" 'er/expand-region) (keymap-global-set "C-c DEL" 'er/contract-region) ;; multiple-cursors (keymap-global-set "C-c C-n" 'mc/mark-next-like-this) (keymap-global-set "C-c C-p" 'mc/mark-previous-like-this) (keymap-global-set "C-c C-a" 'mc/mark-all-like-this) (keymap-global-set "C-c SPC" 'mc/edit-lines) ;; dictd (setq dictionary-server "localhost") (keymap-global-set "C-c d" 'dictionary-search) ;; password prompt (keymap-global-set "C-c p" (lambda () (interactive) (comint-send-invisible) (clear-this-command-keys))) (message "GNU Emacs configuration loaded.") ;; end of emacs configuration (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(canlock-password "1d1f960e6ec71b4e77292dfa6c9c1b68fea57aaf") '(package-selected-packages '(magit go-translate pinentry markdown-mode ebdb plisp-mode emms clhs transpose-frame rainbow-delimiters po-mode paredit multiple-cursors ledger-mode jabber expand-region dictionary 0x0))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. )