Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start trying out better support for composing email #290

Closed
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2024-04-05 Mats Lidell <matsl@gnu.org>

* Makefile (EL_COMPILE, MANIFEST): Add hgnus-mail.

* hmail.el (hmail:init-function): Add Gnus-mail-init as an init option.
(hmail:compose-mail-function): Add email interface function.

* hibtypes.el (mail-address): Use hmail:compose-mail-func.

* hgnus-mail.el: Mail definitions for Gnus as a mail reader.

* hui-mini.el (hui:menu-choose): Use hui:menu-exit-hyperbole

2024-04-01 Mats Lidell <matsl@gnu.org>

* test/hpath-tests.el (hpath:prepend-shell-directory-test):
Expand Down
1 change: 1 addition & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ set.el - General mathematical operators for unordered sets
hmh.el - GNU Hyperbole buttons in mail reader: Mh
hrmail.el - GNU Hyperbole buttons in mail reader: Rmail
hsmail.el - GNU Hyperbole buttons in mail composer: mail
hgnus-mail.el - GNU Hyperbole buttons in mail reader/composer: GNUS

* --- HYPERBOLE KOUTLINER ---
kotl/MANIFEST - Summary of Koutliner files
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ EMACS_PLAIN_BATCH=$(EMACS) $(BATCHFLAGS)
VPATH = kotl man

EL_COMPILE = hact.el hactypes.el hargs.el hbdata.el hbmap.el hbut.el \
hgnus.el hhist.el hib-debbugs.el hib-doc-id.el hib-kbd.el \
hgnus.el hgnus-mail.el hhist.el hib-debbugs.el hib-doc-id.el hib-kbd.el \
hib-social.el hibtypes.el \
hinit.el hload-path.el hmail.el hmh.el hmoccur.el hmouse-info.el \
hmouse-drv.el hmouse-key.el hmouse-mod.el hmouse-sh.el hmouse-tag.el \
Expand Down
82 changes: 82 additions & 0 deletions hgnus-mail.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
;;; hgnus-mail.el --- Gnus mailer support -*- lexical-binding: t; -*-
;;
;; Author: Mats Lidell
;;
;; Orig-Date: 17-Dec-22 at 22:04:19
;; Last-Mod: 31-Oct-23 at 15:00:34 by Mats Lidell
;;
;; Copyright (C) 2023 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.

;;; Commentary:
;;

;;; Code:

;;; ************************************************************************
;;; Other required Elisp libraries
;;; ************************************************************************

(require 'gnus-sum)
(require 'gnus-art)
(require 'hmail)

;;; ************************************************************************
;;; Public functions
;;; ************************************************************************

;;;###autoload
(defun Gnus-mail-init ()
"Initialize Hyperbole support for Gnus mail reading."
(interactive)
(setq hmail:compose-mail-function 'hgnus-mail--message-mail-other-window
hmail:composer 'message-mode
hmail:lister 'gnus-summary-mode
hmail:modifier 'message-mode
hmail:reader 'gnus-article-mode)
;;
;; Setup public abstract interface to Hyperbole defined mail
;; reader-specific functions used in "hmail.el".
;;
(rmail:init)
;;
;; Setup private abstract interface to mail reader-specific functions
;; used in "hmail.el".
;;
(defalias 'rmail:get-new #'gnus-group-get-new-news)
(defalias 'rmail:msg-forward #'gnus-summary-mail-forward)
(defalias 'rmail:summ-msg-to #'gnus-summary-show-article)
(defalias 'rmail:summ-new #'gnus-summary-rescan-group)
(when (called-interactively-p 'interactive)
(message "Hyperbole Gnus mail reader support initialized.")))

;;; ************************************************************************
;;; Private functions
;;; ************************************************************************

(defun hgnus-mail--message-mail-other-window (_noerase to)
rswgnu marked this conversation as resolved.
Show resolved Hide resolved
"Open mail composer in other window with field TO set.
_NOERASE is for compatibility with `mail-other-window' type of
mail functions."
(gnus-msg-mail to nil nil nil #'switch-to-buffer-other-window))

(defalias 'Gnus-Summ-goto #'gnus-summary-show-article)
(defalias 'Gnus-msg-next #'gnus-article-goto-next-page)

(defun Gnus-Summ-delete ()
"Mark article for process so it can be expunged later."
(gnus-summary-mark-as-processable 1))

(defun Gnus-Summ-expunge ()
"Delete all articles with a process mark."
(let ((gnus-novice-user t))
(gnus-summary-delete-article)))

(defun Gnus-Summ-undelete-all ()
"Undelete all messages."
(error "Sorry. Deleted messages can't be undeleted"))

(provide 'hgnus-mail)
;;; hgnus-mail.el ends here
10 changes: 8 additions & 2 deletions hibtypes.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Bob Weiner
;;
;; Orig-Date: 19-Sep-91 at 20:45:31
;; Last-Mod: 31-Mar-24 at 15:17:46 by Bob Weiner
;; Last-Mod: 6-Apr-24 at 00:06:20 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -219,8 +219,14 @@ in all buffers."
(mapcar #'get-file-buffer (hyrolo-get-file-list))))))
(let ((address (mail-address-at-p)))
(when address
;; Initialize user-specified mail reader if need be.
(if (and (symbolp hmail:init-function)
(fboundp hmail:init-function)
(listp (symbol-function hmail:init-function))
(eq 'autoload (car (symbol-function hmail:init-function))))
(funcall hmail:init-function))
(ibut:label-set address (match-beginning 1) (match-end 1))
(hact 'mail-other-window nil address)))))
(hact hmail:compose-mail-function nil address)))))

;;; ========================================================================
;;; Displays files and directories when a valid pathname is activated.
Expand Down
9 changes: 6 additions & 3 deletions hmail.el
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@

(defcustom hmail:init-function nil
"*Function (a symbol) to initialize Hyperbole support for a mail reader/composer.
Valid values are: nil, Mh-init or Rmail-init."
Valid values are: nil, Mh-init, Rmail-init or Gnus-mail-init."
:type '(choice (const nil)
(const Mh-init)
(const Rmail-init))
(function-item :tag "MH" :value Mh-init)
(function-item :tag "Rmail" :value Rmail-init)
(function-item :tag "Gnus" :value Gnus-mail-init))
:group 'hyperbole-commands)

(defvar hmail:compose-mail-function 'mail-other-window
"Function for starting to compose a mail.")
(defvar hmail:composer 'message-mode
"Major mode for composing mail to be sent with Hyperbole buttons.")
(defvar hmail:lister nil
Expand Down