Advertisement
froleyks

*Org Src spacemacs.org[ emacs-lisp ]*

Mar 17th, 2020
817
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.79 KB | None | 0 0
  1. (setq diary-file "~/Dropbox/org/diary.org")
  2.  
  3. (add-hook 'after-save-hook
  4.           '(lambda ()
  5.              (if (string-match-p (regexp-quote "~/Dropbox/org/brain") (buffer-file-name))
  6.                  (org-agenda-to-appt))))
  7.  
  8. (defun talky-popup (title msg &optional icon sound)
  9.   "Show a popup if we're on X, or echo it otherwise; TITLE is the title
  10. of the message, MSG is the context. Optionally, you can provide an ICON and
  11. a sound to be played"
  12.  
  13.   (interactive)
  14.   ;;verbal warning
  15.  
  16.   (shell-command
  17.    ;;  (concat "espeak -v mb-en1 -k5 -s125 " "'" title " " msg "'" " --stdout | paplay") ;; use local espeak
  18.    (concat "echo " "'" title "'" " " "'" msg "'" " |text-to-speech en-gb")  ;; use remote Google voices
  19.     ;; text-to-speech is from https://github.com/taylorchu/speech-to-text-text-to-speech
  20.    )
  21.   (if (eq window-system 'x)
  22.     (shell-command (concat "notify-send -u critical -t 1800000  "
  23.  
  24.                      (if icon (concat "-i " icon) "")
  25.                      " '" title "' '" msg "'"))
  26.     ;; text only version
  27.  
  28.     (message (concat title ": " msg))))
  29.  
  30. ;; the appointment notification facility
  31. (setq
  32.   appt-message-warning-time 15 ;; warn 15 min in advance
  33.  
  34.   appt-display-mode-line t     ;; show in the modeline
  35.   appt-display-format 'window) ;; use our func
  36. (appt-activate 1)              ;; active appt (appointment notification)
  37. (display-time)                 ;; time display is required for this...
  38.  
  39. ;; our little façade-function for talky-popup
  40.  (defun talky-appt-display (min-to-app new-time msg)
  41.     (talky-popup (format "In %s minutes:" min-to-app) msg
  42.   ;;    "/usr/share/icons/gnome/32x32/status/appointment-soon.png"   ;; optional icon
  43.  
  44.   ;;    "/usr/share/sounds/ubuntu/stereo/phone-incoming-call.ogg"    ;; optional sound
  45.  
  46.         ))
  47.   (setq appt-disp-window-function (function talky-appt-display))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement