[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Including AI into Emacs
From: |
Jean Louis |
Subject: |
Including AI into Emacs |
Date: |
Fri, 06 Dec 2024 20:22:23 +0300 |
My previous e-mail about AI was written only to test the following
function:
(defun rcd-monitor-directory-for-mail-files (directory)
"Monitor DIRECTORY for creation of *.mail files, and call
`msmtp-count-remaining` when one is created.
DIRECTORY should be the path to the directory you want to monitor.
This function sets up a file notification watch on DIRECTORY.
When a new file with the `.mail` extension is created within DIRECTORY,
the `msmtp-count-remaining` function is called."
(file-notify-add-watch
directory
'(change)
(lambda (event)
;; Structure of EVENT:
;; (ACTION EVENT-TYPE FILE)
(let* ((event-type (cadr event))
(file-path (caddr event))
(file-name (file-name-nondirectory file-path)))
(when (and (eq event-type 'created)
(string-suffix-p ".mail" file-name))
(msmtp-count-remaining))))))
As I was invoking the function always manually with: M-x msmtp-count-remaining
(defun msmtp-count-remaining ()
"Count and send any remaining MSMTP messages in the queue"
(interactive)
(let ((default-directory (rcd-my-home))
(msmtp-runqueue (executable-find "msmtp-runqueue.sh")))
(rcd-general-log "Function `msmtp-count-remaining' invoked" nil 1 nil nil
nil 6)
(let ((count (length (directory-files "~/.msmtpqueue" nil "\\.mail"))))
(if (> count 0)
(progn
(start-process msmtp-runqueue "RCD MSMTP" msmtp-runqueue)
(rcd-message "MSMTP: There is %s e-mails in queue." count))
(rcd-message "MSMTP: No emails.")))))
Now I can just put:
(rcd-monitor-directory-for-mail-files "~/.msmtpqueue")
in the Emacs configuration and as soon as e-mail is sent, it is also
dispatched with msmtp:
msmtp is an SMTP client that can be used to send mails from Mutt and
probably other MUAs (mail user agents). It forwards mails to an SMTP
server (for example at a free mail provider), which takes care of the
final delivery. Using profiles, it can be easily configured to use
different SMTP servers with different configurations, which makes it
ideal for mobile clients.
Jean Louis
- Re: Including AI into Emacs, (continued)
Re: Including AI into Emacs, Eli Zaretskii, 2024/12/06
Re: Including AI into Emacs, Basile Starynkevitch, 2024/12/06
Re: Including AI into Emacs, Christopher Howard, 2024/12/06
Including AI into Emacs,
Jean Louis <=