Skip to content

Commit 899a79e

Browse files
committed
Start trying out better support for composing email
1 parent 94c5d6e commit 899a79e

File tree

5 files changed

+112
-8
lines changed

5 files changed

+112
-8
lines changed

ChangeLog

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2022-12-17 Mats Lidell <[email protected]>
2+
3+
* Makefile (EL_COMPILE, ELC_COMPILE): Add hgnus-mail.
4+
5+
* hmail.el (hmail:init-function): Add Gnus-mail-init as an init option.
6+
(hmail:compose-mail-other-window): Add email interface function.
7+
8+
* hibtypes.el (mail-address): Use hmail:compose-mail-other-window.
9+
10+
* hgnus-mail.el: Mail definitions for Gnus as a mail reader.
11+
112
2022-12-03 Bob Weiner <[email protected]>
213

314
* hpath.el (hpath:expand-with-variable): Fix to expand from local dir first

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Author: Bob Weiner
44
#
55
# Orig-Date: 15-Jun-94 at 03:42:38
6-
# Last-Mod: 11-Oct-22 at 22:22:16 by Mats Lidell
6+
# Last-Mod: 17-Dec-22 at 23:25:35 by Mats Lidell
77
#
88
# Copyright (C) 1994-2022 Free Software Foundation, Inc.
99
# See the file HY-COPY for license information.
@@ -177,7 +177,7 @@ EMACS_BATCH=$(EMACS) $(BATCHFLAGS) $(PRELOADS)
177177
VPATH = kotl man
178178

179179
EL_COMPILE = hact.el hactypes.el hargs.el hbdata.el hbmap.el hbut.el \
180-
hgnus.el hhist.el hib-debbugs.el hib-doc-id.el hib-kbd.el \
180+
hgnus.el hgnus-mail.el hhist.el hib-debbugs.el hib-doc-id.el hib-kbd.el \
181181
hib-social.el hibtypes.el \
182182
hinit.el hload-path.el hmail.el hmh.el hmoccur.el hmouse-info.el \
183183
hmouse-drv.el hmouse-key.el hmouse-mod.el hmouse-sh.el hmouse-tag.el \
@@ -193,7 +193,7 @@ EL_KOTL = kotl/kexport.el kotl/kfile.el kotl/kfill.el kotl/kimport.el kotl/klabe
193193

194194
ELC_COMPILE = hactypes.elc hibtypes.elc hib-debbugs.elc hib-doc-id.elc hib-kbd.elc \
195195
hib-social.elc hact.elc \
196-
hargs.elc hbdata.elc hbmap.elc hbut.elc hgnus.elc hhist.elc \
196+
hargs.elc hbdata.elc hbmap.elc hbut.elc hgnus.elc hgnus-mail.elc hhist.elc \
197197
hinit.elc hload-path.elc hmail.elc hmh.elc hmoccur.elc hmouse-info.elc \
198198
hmouse-drv.elc hmouse-key.elc hmouse-mod.elc hmouse-sh.elc hmouse-tag.elc \
199199
hpath.elc hrmail.elc hsettings.elc hsmail.elc hsys-org.elc hsys-www.elc hsys-youtube.elc htz.elc \

hgnus-mail.el

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
;;; hgnus-mail.el --- Gnus mailer support -*- lexical-binding: t; -*-
2+
;;
3+
;; Author: Mats Lidell
4+
;;
5+
;; Orig-Date: 17-Dec-22 at 22:04:19
6+
;; Last-Mod: 17-Dec-22 at 23:45:46 by Mats Lidell
7+
;;
8+
;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
9+
;; See the "HY-COPY" file for license information.
10+
;;
11+
;; This file is part of GNU Hyperbole.
12+
13+
;;; Commentary:
14+
;;
15+
16+
;;; Code:
17+
18+
;;; ************************************************************************
19+
;;; Requirements
20+
;;; ************************************************************************
21+
22+
;;; ************************************************************************
23+
;;; Public variables
24+
;;; ************************************************************************
25+
26+
;;; ************************************************************************
27+
;;; Private variables
28+
;;; ************************************************************************
29+
30+
;;; ************************************************************************
31+
;;; Public functions
32+
;;; ************************************************************************
33+
34+
;; FIXME - Start to use common prefix such as hypb for file name and
35+
;; functions?
36+
;;
37+
;; Would be:
38+
;; File: hypb-gnus-email.el
39+
;; Function: hypb-gnus-email-init
40+
41+
;;;###autoload
42+
(defun Gnus-mail-init ()
43+
"Initialize Hyperbole support for Gnus mail reading."
44+
(interactive)
45+
(setq hmail:compose-mail-other-window 'hgnus-mail--message-mail-other-window
46+
hmail:composer 'message-mode
47+
hmail:lister 'gnus-summary-mode
48+
hmail:modifier 'message-mode
49+
hmail:reader 'gnus-article-mode)
50+
;;
51+
;; Setup public abstract interface to Hyperbole defined mail
52+
;; reader-specific functions used in "hmail.el".
53+
;;
54+
(rmail:init)
55+
;;
56+
;; Setup private abstract interface to mail reader-specific functions
57+
;; used in "hmail.el".
58+
;;
59+
(defalias 'rmail:get-new 'gnus-group-get-new-news)
60+
(defalias 'rmail:msg-forward 'gnus-summary-mail-forward)
61+
(defalias 'rmail:summ-msg-to nil) ;FIXME - What is this for?
62+
(defalias 'rmail:summ-new nil) ;FIXME - What is this for?
63+
(if (called-interactively-p 'interactive)
64+
(message "Hyperbole Gnus mail reader support initialized.")))
65+
66+
;;; ************************************************************************
67+
;;; Private functions
68+
;;; ************************************************************************
69+
70+
;; FIXME - noerase arg is nil in the other invocation so really not
71+
;; needed. We can use a local defun in the other case as well and so
72+
;; the noerase can go away.
73+
(defun hgnus-mail--message-mail-other-window (_noerase to)
74+
"Open mail composer in other window with field TO set."
75+
(gnus-msg-mail to nil nil nil #'switch-to-buffer-other-window))
76+
77+
(provide 'hgnus-mail.el)
78+
;;; hgnus-mail.el ends here

hibtypes.el

+14-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 19-Sep-91 at 20:45:31
6-
;; Last-Mod: 3-Dec-22 at 01:08:43 by Bob Weiner
6+
;; Last-Mod: 17-Dec-22 at 23:35:46 by Mats Lidell
77
;;
88
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
99
;; See the "HY-COPY" file for license information.
@@ -291,8 +291,20 @@ in all buffers."
291291
(mapcar 'get-file-buffer hyrolo-file-list)))))
292292
(let ((address (mail-address-at-p)))
293293
(when address
294+
295+
;; FIXME - Shall we not initialize the user preferred mail
296+
;; reader at startup instead? Code below copied from
297+
;; "hactypes.el:576". The only other place the
298+
;; hmail:init-function is used.
299+
300+
;; Initialize user-specified mail reader if need be.
301+
(if (and (symbolp hmail:init-function)
302+
(fboundp hmail:init-function)
303+
(listp (symbol-function hmail:init-function))
304+
(eq 'autoload (car (symbol-function hmail:init-function))))
305+
(funcall hmail:init-function))
294306
(ibut:label-set address (match-beginning 1) (match-end 1))
295-
(hact 'mail-other-window nil address)))))
307+
(hact hmail:compose-mail-other-window nil address)))))
296308

297309
;;; ========================================================================
298310
;;; Follows Org links that are in non-Org mode buffers

hmail.el

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Bob Weiner
44
;;
55
;; Orig-Date: 9-Oct-91 at 18:38:05
6-
;; Last-Mod: 25-Jul-22 at 17:59:37 by Mats Lidell
6+
;; Last-Mod: 17-Dec-22 at 23:36:33 by Mats Lidell
77
;;
88
;; Copyright (C) 1991-2022 Free Software Foundation, Inc.
99
;; See the HY-COPY (Hyperbole) or BR-COPY (OO-Browser) file for license
@@ -42,13 +42,16 @@
4242

4343
(defcustom hmail:init-function nil
4444
"*Function (a symbol) to initialize Hyperbole support for a mail reader/composer.
45-
Valid values are: nil, Mh-init, Rmail-init or Vm-init."
45+
Valid values are: nil, Mh-init, Rmail-init, Vm-init or Gnus-mail-init."
4646
:type '(choice (const nil)
4747
(const Mh-init)
4848
(const Rmail-init)
49-
(const Vm-init))
49+
(const Vm-init)
50+
(const Gnus-mail-init))
5051
:group 'hyperbole-commands)
5152

53+
(defvar hmail:compose-mail-other-window 'mail-other-window
54+
"Function for starting to compose a mail in the other window.")
5255
(defvar hmail:composer 'message-mode
5356
"Major mode for composing mail to be sent with Hyperbole buttons.")
5457
(defvar hmail:lister nil

0 commit comments

Comments
 (0)