unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Emacs Tangents <help-gnu-emacs@gnu.org>
Subject: Including AI into Emacs
Date: Fri, 06 Dec 2024 20:22:23 +0300	[thread overview]
Message-ID: <0e802e6ebb6a3e4dd12237ca4ec2e5c1.support1@rcdrun.com> (raw)

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



             reply	other threads:[~2024-12-06 17:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06 17:22 Jean Louis [this message]
2024-12-06 18:25 ` Including AI into Emacs Eli Zaretskii
2024-12-06 18:32   ` John Yates
2024-12-06 19:06   ` Jean Louis
  -- strict thread matches above, loose matches on Subject: below --
2024-12-06 17:19 Jean Louis
2024-12-06 18:16 ` Bruno Barbier
2024-12-06 22:18   ` Jean Louis
2024-12-07  9:32     ` Bruno Barbier
2024-12-07 10:30       ` Jean Louis
2024-12-07 11:29         ` Bruno Barbier
2024-12-09 21:06           ` Jean Louis
2024-12-09 22:56             ` Bruno Barbier
2024-12-10  8:03               ` Jean Louis
2024-12-10 10:37                 ` Bruno Barbier
2024-12-10 14:27                   ` Jean Louis
2024-12-06 18:22 ` Eli Zaretskii
2024-12-06 19:11 ` Basile Starynkevitch
2024-12-06 21:14   ` Jean Louis
2024-12-06 22:26   ` Jean Louis
2024-12-06 22:59 ` Christopher Howard
2024-12-06 23:21   ` Jean Louis
2024-12-10 10:45   ` Basile Starynkevitch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e802e6ebb6a3e4dd12237ca4ec2e5c1.support1@rcdrun.com \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).