From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Including AI into Emacs Date: Fri, 06 Dec 2024 20:22:23 +0300 Message-ID: <0e802e6ebb6a3e4dd12237ca4ec2e5c1.support1@rcdrun.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10432"; mail-complaints-to="usenet@ciao.gmane.io" To: Emacs Tangents Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 06 18:29:41 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tJc97-0002TU-8s for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 06 Dec 2024 18:29:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJc2E-0005Yp-JT; Fri, 06 Dec 2024 12:22:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJc2A-0005SA-HA for help-gnu-emacs@gnu.org; Fri, 06 Dec 2024 12:22:30 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJc29-00016k-1g for help-gnu-emacs@gnu.org; Fri, 06 Dec 2024 12:22:30 -0500 Original-Received: from localhost ([::ffff:41.75.182.215]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000081F0A.00000000675332D2.003B3678; Fri, 06 Dec 2024 10:22:26 -0700 Received-SPF: pass client-ip=217.170.207.13; envelope-from=support1@rcdrun.com; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148628 Archived-At: 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