1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-14 18:10:32 -08:00
emacs/lisp/obsolete/mailpost.el
Stefan Monnier 79d585c2be * lisp/obsolete: Use lexical-binding
Use lexical-binding in all the lisp/obsolete/*.el files.
While at it, removed redundant :group arguments and used #' to quote
functions.  Commented out the key bindings which the #' revealed
to lead to non-existing commands, and replaced those revealed to be obsolete.

* lisp/obsolete/cl-compat.el: Use cl-lib.

* lisp/obsolete/cust-print.el: Assume `defalias` exists.
(with-custom-print): Use `declare`.

* lisp/obsolete/iswitchb.el (iswitchb-init-XEmacs-trick)
(iswitchb-xemacs-backspacekey): Remove functions.

* lisp/obsolete/landmark.el (landmark, landmark-nslify-wts):
Prefer `apply` to `eval`.

* lisp/obsolete/longlines.el (longlines-mode): Don't use `add-to-list`
on a hook.

* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region): Use `clear-string`.

* lisp/obsolete/pgg-pgp.el (pgg-pgp-encrypt-region): Remove oddly
unused var `passphrase`.
(pgg-pgp-verify-region): Declare var `jam-zcat-filename-list`.

* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-encrypt-region): Remove oddly
unused var `passphrase`.
(pgg-pgp5-verify-region): Declare var `jam-zcat-filename-list`.

* lisp/obsolete/pgg.el: Remove some XEmacs compatibility code.
(pgg-run-at-time, pgg-cancel-timer, pgg-clear-string): Remove functions.
Use their core equivalent instead.

* lisp/obsolete/rcompile.el (remote-compile): Remove unused vars `l`,
`l-host`, `l-user`, and `localname`.

* lisp/obsolete/starttls.el (starttls-any-program-available):
Use `define-obsolete-function-alias`.

* lisp/obsolete/tls.el (tls-format-message): Delete function, use
`format-message` instead.

* lisp/obsolete/url-ns.el (url-ns-prefs): Use `with-current-buffer`
and `dlet`.

* lisp/obsolete/vip.el (vip-escape-to-emacs): Remove unused var `key`.
(vip-command-argument, vip-read-string, ex-delete, ex-line): Remove
unused var `conditions`.
(ex-map): Use a closure instead of `eval`.
(ex-set): Make it an alias of `set-variable`.
(ex-substitute): Remove unused var `cont`.

* lisp/obsolete/abbrevlist.el:
* lisp/obsolete/bruce.el:
* lisp/obsolete/cc-compat.el:
* lisp/obsolete/cl-compat.el:
* lisp/obsolete/cl.el:
* lisp/obsolete/complete.el:
* lisp/obsolete/crisp.el:
* lisp/obsolete/cust-print.el:
* lisp/obsolete/erc-compat.el:
* lisp/obsolete/erc-hecomplete.el:
* lisp/obsolete/eudcb-ph.el:
* lisp/obsolete/fast-lock.el:
* lisp/obsolete/gs.el:
* lisp/obsolete/gulp.el:
* lisp/obsolete/html2text.el:
* lisp/obsolete/info-edit.el:
* lisp/obsolete/iswitchb.el:
* lisp/obsolete/landmark.el:
* lisp/obsolete/lazy-lock.el:
* lisp/obsolete/longlines.el:
* lisp/obsolete/mailpost.el:
* lisp/obsolete/mantemp.el:
* lisp/obsolete/meese.el:
* lisp/obsolete/messcompat.el:
* lisp/obsolete/metamail.el:
* lisp/obsolete/mouse-sel.el:
* lisp/obsolete/nnir.el:
* lisp/obsolete/old-emacs-lock.el:
* lisp/obsolete/otodo-mode.el:
* lisp/obsolete/patcomp.el:
* lisp/obsolete/pc-mode.el:
* lisp/obsolete/pc-select.el:
* lisp/obsolete/pgg-def.el:
* lisp/obsolete/pgg-gpg.el:
* lisp/obsolete/pgg-parse.el:
* lisp/obsolete/pgg-pgp.el:
* lisp/obsolete/pgg-pgp5.el:
* lisp/obsolete/pgg.el:
* lisp/obsolete/rcompile.el:
* lisp/obsolete/s-region.el:
* lisp/obsolete/sb-image.el:
* lisp/obsolete/sregex.el:
* lisp/obsolete/starttls.el:
* lisp/obsolete/sup-mouse.el:
* lisp/obsolete/terminal.el:
* lisp/obsolete/tls.el:
* lisp/obsolete/tpu-edt.el:
* lisp/obsolete/tpu-extras.el:
* lisp/obsolete/tpu-mapper.el:
* lisp/obsolete/url-ns.el:
* lisp/obsolete/vc-arch.el:
* lisp/obsolete/vi.el:
* lisp/obsolete/vip.el:
* lisp/obsolete/ws-mode.el:
* lisp/obsolete/yow.el: Use lexical-binding.
2021-02-22 16:54:59 -05:00

101 lines
3 KiB
EmacsLisp

;;; mailpost.el --- RMAIL coupler to /usr/uci/post mailer -*- lexical-binding: t; -*-
;; This is in the public domain
;; since Delp distributed it in 1986 without a copyright notice.
;; This file is part of GNU Emacs.
;; Author: Gary Delp <delp@huey.Udel.Edu>
;; Maintainer: emacs-devel@gnu.org
;; Created: 13 Jan 1986
;; Keywords: mail
;; Obsolete-since: 24.3
;;; Commentary:
;; Yet another mail interface. this for the rmail system to provide
;; the missing sendmail interface on systems without /usr/lib/sendmail,
;; but with /usr/uci/post.
;;; Code:
(require 'mailalias)
(require 'sendmail)
;; (setq send-mail-function 'post-mail-send-it)
(defun post-mail-send-it ()
"The MH -post interface for `rmail-mail' to call.
To use it, include \"(setq send-mail-function \\='post-mail-send-it)\" in
site-init."
(let ((errbuf (if mail-interactive
(generate-new-buffer " post-mail errors")
0))
temfile
(tembuf (generate-new-buffer " post-mail temp"))
(case-fold-search nil)
delimline
(mailbuf (current-buffer)))
(unwind-protect
(with-current-buffer tembuf
(erase-buffer)
(insert-buffer-substring mailbuf)
(goto-char (point-max))
;; require one newline at the end.
(or (= (preceding-char) ?\n)
(insert ?\n))
;; Change header-delimiter to be what post-mail expects.
(mail-sendmail-undelimit-header)
(setq delimline (point-marker))
(if mail-aliases
(expand-mail-aliases (point-min) delimline))
(goto-char (point-min))
;; ignore any blank lines in the header
(while (and (re-search-forward "\n\n\n*" delimline t)
(< (point) delimline))
(replace-match "\n"))
;; Find and handle any Fcc fields.
(let ((case-fold-search t))
(goto-char (point-min))
(if (re-search-forward "^Fcc:" delimline t)
(mail-do-fcc delimline))
;; If there is a From and no Sender, put it a Sender.
(goto-char (point-min))
(and (re-search-forward "^From:" delimline t)
(not (save-excursion
(goto-char (point-min))
(re-search-forward "^Sender:" delimline t)))
(progn
(forward-line 1)
(insert "Sender: " (user-login-name) "\n")))
;; don't send out a blank subject line
(goto-char (point-min))
(if (re-search-forward "^Subject:[ \t]*\n" delimline t)
(replace-match ""))
(if mail-interactive
(with-current-buffer errbuf
(erase-buffer))))
(with-file-modes 384 (setq temfile (make-temp-file ",rpost")))
(apply #'call-process
(append (list (if (boundp 'post-mail-program)
post-mail-program
"/usr/uci/lib/mh/post")
nil errbuf nil
"-nofilter" "-msgid")
(if mail-interactive '("-watch") '("-nowatch"))
(list temfile)))
(if mail-interactive
(with-current-buffer errbuf
(goto-char (point-min))
(while (re-search-forward "\n\n* *" nil t)
(replace-match "; "))
(if (not (zerop (buffer-size)))
(error "Sending...failed to %s"
(buffer-substring (point-min) (point-max)))))))
(kill-buffer tembuf)
(if (bufferp errbuf)
(switch-to-buffer errbuf)))))
(provide 'mailpost)
;;; mailpost.el ends here