2017-01-04 00:40:45 -05:00
|
|
|
|
;;; undigest.el --- digest-cracking support for the RMAIL mail reader -*- lexical-binding:t -*-
|
1992-05-30 20:24:49 +00:00
|
|
|
|
|
2025-01-01 07:39:17 +00:00
|
|
|
|
;; Copyright (C) 1985-1986, 1994, 1996, 2001-2025 Free Software
|
2013-01-01 09:11:05 +00:00
|
|
|
|
;; Foundation, Inc.
|
1992-07-22 02:58:48 +00:00
|
|
|
|
|
2019-05-25 13:43:06 -07:00
|
|
|
|
;; Maintainer: emacs-devel@gnu.org
|
1992-07-17 20:24:00 +00:00
|
|
|
|
;; Keywords: mail
|
1992-07-16 21:47:34 +00:00
|
|
|
|
|
1989-10-31 15:59:53 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
1989-10-31 15:59:53 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 07:25:26 +00:00
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
1989-10-31 15:59:53 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 15:52:52 -07:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
1989-10-31 15:59:53 +00:00
|
|
|
|
|
1992-07-16 21:47:34 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2009-02-06 03:58:20 +00:00
|
|
|
|
;; See Internet RFC 934 and RFC 1153.
|
|
|
|
|
;; Also limited support for MIME digest encapsulation.
|
1992-07-16 21:47:34 +00:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
1989-10-31 15:59:53 +00:00
|
|
|
|
|
2017-01-04 00:40:45 -05:00
|
|
|
|
(eval-when-compile (require 'cl-lib))
|
1994-04-23 02:31:52 +00:00
|
|
|
|
(require 'rmail)
|
|
|
|
|
|
2003-01-31 14:01:20 +00:00
|
|
|
|
(defcustom rmail-forward-separator-regex
|
|
|
|
|
"^----.*\\([Ff]orwarded\\|[Oo]riginal\\).*[Mm]essage"
|
2012-04-09 21:05:48 +08:00
|
|
|
|
"Regexp to match the string that introduces forwarded messages.
|
2003-01-31 14:01:20 +00:00
|
|
|
|
This is not a header, but a string contained in the body of the message.
|
2005-06-10 00:44:05 +00:00
|
|
|
|
You may need to customize it for local needs."
|
2003-01-31 14:01:20 +00:00
|
|
|
|
:type 'regexp
|
|
|
|
|
:group 'rmail-headers)
|
|
|
|
|
|
2002-12-20 12:46:44 +00:00
|
|
|
|
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(defconst rmail-digest-methods
|
2022-03-23 20:42:55 +01:00
|
|
|
|
'(rmail-digest-parse-mixed-mime
|
|
|
|
|
rmail-digest-parse-mime
|
2002-12-16 16:22:41 +00:00
|
|
|
|
rmail-digest-parse-rfc1153strict
|
|
|
|
|
rmail-digest-parse-rfc1153sloppy
|
|
|
|
|
rmail-digest-parse-rfc934)
|
2002-12-20 12:46:44 +00:00
|
|
|
|
"List of digest parsing functions, first tried first.
|
2002-12-16 16:22:41 +00:00
|
|
|
|
|
2002-12-20 12:46:44 +00:00
|
|
|
|
These functions operate on the current narrowing, and take no argument.
|
|
|
|
|
A function returns nil if it cannot parse the digest. If it can, it
|
2002-12-16 16:22:41 +00:00
|
|
|
|
returns a list of cons pairs containing the start and end positions of
|
|
|
|
|
each undigestified message as markers.")
|
|
|
|
|
|
2022-03-23 20:42:55 +01:00
|
|
|
|
(defun rmail-content-type-boundary (type)
|
|
|
|
|
"If Content-type is of type TYPE, return its boundary; otherwise, return nil."
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(let ((head-end (save-excursion (search-forward "\n\n" nil t) (point))))
|
|
|
|
|
(when (re-search-forward
|
|
|
|
|
(concat "^Content-type: " type ";"
|
|
|
|
|
"\\s-* boundary=\"?\\([^\";\n]+\\)[\";\n]")
|
|
|
|
|
head-end t)
|
|
|
|
|
(match-string 1))))
|
|
|
|
|
|
|
|
|
|
(defun rmail-digest-parse-mixed-mime ()
|
|
|
|
|
"Like `rmail-digest-parse-mime', but for multipart/mixed messages."
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
|
|
|
|
(when-let* ((boundary (rmail-content-type-boundary "multipart/mixed")))
|
2022-03-23 20:42:55 +01:00
|
|
|
|
(let ((global-sep (concat "\n--" boundary))
|
|
|
|
|
(digest (concat "^Content-type: multipart/digest;"
|
|
|
|
|
"\\s-* boundary=\"?\\([^\";\n]+\\)[\";\n]"))
|
|
|
|
|
result)
|
|
|
|
|
(search-forward global-sep nil t)
|
|
|
|
|
(while (not (or result (eobp)))
|
|
|
|
|
;; For each part, see if it is a multipart/digest.
|
|
|
|
|
(let* ((limit (save-excursion (search-forward global-sep nil 'move)
|
|
|
|
|
(point)))
|
|
|
|
|
(beg (and (re-search-forward digest limit t)
|
|
|
|
|
(match-beginning 0)))
|
|
|
|
|
digest-sep)
|
|
|
|
|
(when (and beg
|
|
|
|
|
(setq digest-sep (concat "\n--" (match-string 1)))
|
|
|
|
|
;; Search for 1st sep.
|
|
|
|
|
(search-forward digest-sep nil t))
|
|
|
|
|
;; Skip body part headers.
|
|
|
|
|
(search-forward "\n\n" nil t)
|
|
|
|
|
;; Push the 1st message.
|
|
|
|
|
(push (cons (copy-marker beg) (copy-marker (point-marker) t))
|
|
|
|
|
result)
|
|
|
|
|
;; Push the rest of the messages.
|
|
|
|
|
(let ((start (make-marker))
|
|
|
|
|
done)
|
|
|
|
|
(while (and (search-forward digest-sep limit 'move) (not done))
|
|
|
|
|
(move-marker start (match-beginning 0))
|
|
|
|
|
(and (looking-at "--$") (setq done t))
|
|
|
|
|
(search-forward "\n\n")
|
|
|
|
|
(push (cons (copy-marker start)
|
|
|
|
|
(copy-marker (point-marker) t))
|
|
|
|
|
result))))
|
|
|
|
|
(goto-char limit)))
|
|
|
|
|
(nreverse result))))
|
|
|
|
|
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(defun rmail-digest-parse-mime ()
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (let ((head-end (progn (search-forward "\n\n" nil t) (point))))
|
|
|
|
|
(goto-char (point-min))
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(and head-end ; FIXME always true
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(re-search-forward
|
|
|
|
|
(concat
|
|
|
|
|
"^Content-type: multipart/digest;"
|
2017-01-04 00:40:45 -05:00
|
|
|
|
"\\s-* boundary=\"?\\([^\";\n]+\\)[\";\n]")
|
|
|
|
|
head-end t)
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(search-forward (match-string 1) nil t)))
|
|
|
|
|
;; Ok, prolog separator found
|
|
|
|
|
(let ((start (make-marker))
|
|
|
|
|
(end (make-marker))
|
|
|
|
|
(separator (concat "\n--" (match-string 0) "\n\n"))
|
|
|
|
|
result)
|
|
|
|
|
(while (search-forward separator nil t)
|
|
|
|
|
(move-marker start (match-beginning 0))
|
|
|
|
|
(move-marker end (match-end 0))
|
2017-01-04 00:40:45 -05:00
|
|
|
|
(cl-pushnew (cons (copy-marker start) (copy-marker end t))
|
|
|
|
|
result :test #'equal))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
;; Return the list of marker pairs
|
|
|
|
|
(nreverse result))))
|
|
|
|
|
|
|
|
|
|
(defun rmail-digest-parse-rfc1153strict ()
|
|
|
|
|
"Parse following strictly the method defined in RFC 1153.
|
|
|
|
|
See rmail-digest-methods."
|
|
|
|
|
(rmail-digest-rfc1153
|
|
|
|
|
"^-\\{70\\}\n\n"
|
|
|
|
|
"^\n-\\{30\\}\n\n"
|
2015-09-17 12:28:45 -07:00
|
|
|
|
"^\n-\\{30\\}\n\nEnd of .* Digest.*\n\\*\\{15,\\}\n+\\'"))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
|
|
|
|
|
(defun rmail-digest-parse-rfc1153sloppy ()
|
|
|
|
|
"Parse using the method defined in RFC 1153, allowing for some sloppiness.
|
|
|
|
|
See rmail-digest-methods."
|
|
|
|
|
(rmail-digest-rfc1153
|
|
|
|
|
"^-\\{55,\\}\n\n"
|
|
|
|
|
"^\n-\\{27,\\}\n\n"
|
2007-08-15 03:09:28 +00:00
|
|
|
|
;; GNU Mailman knowingly (see comment at line 353 of ToDigest.py in
|
|
|
|
|
;; Mailman source) produces non-conformant rfc 1153 digests, in that
|
|
|
|
|
;; the trailer contains a "digest footer" like this:
|
|
|
|
|
;; _______________________________________________
|
|
|
|
|
;; <one or more lines of list blurb>
|
|
|
|
|
;;
|
|
|
|
|
;; End of Foo Digest...
|
|
|
|
|
;; **************************************
|
|
|
|
|
"^\nEnd of"))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
|
|
|
|
|
(defun rmail-digest-rfc1153 (prolog-sep message-sep trailer-sep)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (re-search-forward prolog-sep nil t)
|
|
|
|
|
;; Ok, prolog separator found
|
|
|
|
|
(let ((start (make-marker))
|
|
|
|
|
(end (make-marker))
|
|
|
|
|
separator result)
|
|
|
|
|
(move-marker start (match-beginning 0))
|
|
|
|
|
(move-marker end (match-end 0))
|
2007-08-15 03:09:28 +00:00
|
|
|
|
(setq result (list (cons (copy-marker start) (copy-marker end t))))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(when (re-search-forward message-sep nil t)
|
|
|
|
|
;; Ok, at least one message separator found
|
|
|
|
|
(setq separator (match-string 0))
|
|
|
|
|
(when (re-search-forward trailer-sep nil t)
|
|
|
|
|
;; Wonderful, we found a trailer, too. Now, go on splitting
|
|
|
|
|
;; the digest into separate rmail messages
|
|
|
|
|
(goto-char (cdar result))
|
|
|
|
|
(while (search-forward separator nil t)
|
|
|
|
|
(move-marker start (match-beginning 0))
|
|
|
|
|
(move-marker end (match-end 0))
|
2017-01-04 00:40:45 -05:00
|
|
|
|
(cl-pushnew (cons (copy-marker start) (copy-marker end t))
|
|
|
|
|
result :test #'equal))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
;; Undo masking of separators inside digestified messages
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (search-forward
|
Use string-replace instead of replace-regexp-in-string
`string-replace` is easier to understand, less error-prone, much
faster, and results in shorter Lisp and byte code. Use it where
applicable and obviously safe (erring on the conservative side).
* admin/authors.el (authors-scan-change-log):
* lisp/autoinsert.el (auto-insert-alist):
* lisp/calc/calc-prog.el (calc-edit-macro-combine-alg-ent)
(calc-edit-macro-combine-ext-command)
(calc-edit-macro-combine-var-name):
* lisp/calc/calc-units.el (math-make-unit-string):
* lisp/calendar/cal-html.el (cal-html-comment):
* lisp/calendar/cal-tex.el (cal-tex-comment):
* lisp/calendar/icalendar.el (icalendar--convert-string-for-export)
(icalendar--convert-string-for-import):
* lisp/calendar/iso8601.el (iso8601--concat-regexps)
(iso8601--full-time-match, iso8601--combined-match):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/todo-mode.el (todo-filter-items-filename):
* lisp/cedet/cedet-files.el (cedet-directory-name-to-file-name)
(cedet-file-name-to-directory-name):
* lisp/comint.el (comint-watch-for-password-prompt):
* lisp/dired-aux.el (dired-do-chmod):
* lisp/dired-x.el (dired-man):
* lisp/dired.el (dired-insert-directory, dired-goto-file-1):
* lisp/emacs-lisp/comp.el (comp-c-func-name):
* lisp/emacs-lisp/re-builder.el (reb-copy):
* lisp/erc/erc-dcc.el (erc-dcc-unquote-filename):
* lisp/erc/erc.el (erc-quit-reason-zippy, erc-part-reason-zippy)
(erc-update-mode-line-buffer, erc-message-english-PART):
* lisp/files.el (make-backup-file-name-1, files--transform-file-name)
(read-file-modes):
* lisp/fringe.el (fringe-mode):
* lisp/gnus/gnus-art.el (gnus-button-handle-info-url):
* lisp/gnus/gnus-group.el (gnus-group-completing-read):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-ical):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-search.el (gnus-search-query-parse-date)
(gnus-search-transform-expression, gnus-search-run-search):
* lisp/gnus/gnus-start.el (gnus-dribble-enter):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-mode-string-quote):
* lisp/gnus/message.el (message-put-addresses-in-ecomplete)
(message-parse-mailto-url, message-mailto-1):
* lisp/gnus/mml-sec.el (mml-secure-epg-sign):
* lisp/gnus/mml-smime.el (mml-smime-epg-verify):
* lisp/gnus/mml2015.el (mml2015-epg-verify):
* lisp/gnus/nnmaildir.el (nnmaildir--system-name)
(nnmaildir-request-list, nnmaildir-retrieve-groups)
(nnmaildir-request-group, nnmaildir-retrieve-headers):
* lisp/gnus/nnrss.el (nnrss-node-text):
* lisp/gnus/spam-report.el (spam-report-gmane-internal)
(spam-report-user-mail-address):
* lisp/ibuffer.el (name):
* lisp/image-dired.el (image-dired-pngnq-thumb)
(image-dired-pngcrush-thumb, image-dired-optipng-thumb)
(image-dired-create-thumb-1):
* lisp/info.el (Info-set-mode-line):
* lisp/international/mule-cmds.el (describe-language-environment):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rfc2368.el (rfc2368-parse-mailto-url):
* lisp/mail/rmail.el (rmail-insert-inbox-text)
(rmail-simplified-subject-regexp):
* lisp/mail/rmailout.el (rmail-output-body-to-file):
* lisp/mail/undigest.el (rmail-digest-rfc1153):
* lisp/man.el (Man-default-man-entry):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc--debug):
* lisp/net/browse-url.el (browse-url-mail):
* lisp/net/eww.el (eww-update-header-line-format):
* lisp/net/newst-backend.el (newsticker-save-item):
* lisp/net/rcirc.el (rcirc-sentinel):
* lisp/net/soap-client.el (soap-decode-date-time):
* lisp/nxml/rng-cmpct.el (rng-c-literal-2-re):
* lisp/nxml/xmltok.el (let*):
* lisp/obsolete/nnir.el (nnir-run-swish-e, nnir-run-hyrex)
(nnir-run-find-grep):
* lisp/play/dunnet.el (dun-doassign):
* lisp/play/handwrite.el (handwrite):
* lisp/proced.el (proced-format-args):
* lisp/profiler.el (profiler-report-header-line-format):
* lisp/progmodes/gdb-mi.el (gdb-mi-quote):
* lisp/progmodes/make-mode.el (makefile-bsdmake-rule-action-regex)
(makefile-make-font-lock-keywords):
* lisp/progmodes/prolog.el (prolog-guess-fill-prefix):
* lisp/progmodes/ruby-mode.el (ruby-toggle-string-quotes):
* lisp/progmodes/sql.el (sql-remove-tabs-filter, sql-str-literal):
* lisp/progmodes/which-func.el (which-func-current):
* lisp/replace.el (query-replace-read-from)
(occur-engine, replace-quote):
* lisp/select.el (xselect--encode-string):
* lisp/ses.el (ses-export-tab):
* lisp/subr.el (shell-quote-argument):
* lisp/term/pc-win.el (msdos-show-help):
* lisp/term/w32-win.el (w32--set-selection):
* lisp/term/xterm.el (gui-backend-set-selection):
* lisp/textmodes/picture.el (picture-tab-search):
* lisp/thumbs.el (thumbs-call-setroot-command):
* lisp/tooltip.el (tooltip-show-help-non-mode):
* lisp/transient.el (transient-format-key):
* lisp/url/url-mailto.el (url-mailto):
* lisp/vc/log-edit.el (log-edit-changelog-ours-p):
* lisp/vc/vc-bzr.el (vc-bzr-status):
* lisp/vc/vc-hg.el (vc-hg--glob-to-pcre):
* lisp/vc/vc-svn.el (vc-svn-after-dir-status):
* lisp/xdg.el (xdg-desktop-strings):
* test/lisp/electric-tests.el (defun):
* test/lisp/term-tests.el (term-simple-lines):
* test/lisp/time-stamp-tests.el (formatz-mod-del-colons):
* test/lisp/wdired-tests.el (wdired-test-bug32173-01)
(wdired-test-unfinished-edit-01):
* test/src/json-tests.el (json-parse-with-custom-null-and-false-objects):
Use `string-replace` instead of `replace-regexp-in-string`.
2021-08-08 18:58:46 +02:00
|
|
|
|
(string-replace "\n-" "\n " separator) nil t)
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(replace-match separator))
|
|
|
|
|
;; Return the list of marker pairs
|
|
|
|
|
(nreverse result))))))
|
|
|
|
|
|
|
|
|
|
(defun rmail-digest-parse-rfc934 ()
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(when (re-search-forward "^\n?-[^ ].*\n\n?" nil t)
|
|
|
|
|
;; Message separator found
|
|
|
|
|
(let ((start (make-marker))
|
|
|
|
|
(end (make-marker))
|
|
|
|
|
(separator (match-string 0))
|
|
|
|
|
result)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (search-forward separator nil t)
|
|
|
|
|
(move-marker start (match-beginning 0))
|
|
|
|
|
(move-marker end (match-end 0))
|
2017-01-04 00:40:45 -05:00
|
|
|
|
(cl-pushnew (cons (copy-marker start) (copy-marker end t))
|
|
|
|
|
result :test #'equal))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
;; Undo masking of separators inside digestified messages
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (search-forward "\n- -" nil t)
|
|
|
|
|
(replace-match "\n-"))
|
|
|
|
|
;; Return the list of marker pairs
|
|
|
|
|
(nreverse result))))
|
|
|
|
|
|
2007-11-25 16:48:31 +00:00
|
|
|
|
(declare-function rmail-update-summary "rmailsum" (&rest ignore))
|
|
|
|
|
|
1996-09-27 00:33:39 +00:00
|
|
|
|
;;;###autoload
|
1989-10-31 15:59:53 +00:00
|
|
|
|
(defun undigestify-rmail-message ()
|
|
|
|
|
"Break up a digest message into its constituent messages.
|
|
|
|
|
Leaves original message, deleted, before the undigestified messages."
|
|
|
|
|
(interactive)
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(set-buffer rmail-buffer)
|
|
|
|
|
(let ((buff (current-buffer))
|
|
|
|
|
(current rmail-current-message)
|
|
|
|
|
(msgbeg (rmail-msgbeg rmail-current-message))
|
|
|
|
|
(msgend (rmail-msgend rmail-current-message)))
|
|
|
|
|
(if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer))
|
1997-12-26 10:48:47 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(let ((error t)
|
|
|
|
|
(buffer-read-only nil))
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(goto-char msgend)
|
|
|
|
|
(let ((msg-copy (buffer-substring-no-properties msgbeg msgend)))
|
2002-12-16 16:22:41 +00:00
|
|
|
|
(narrow-to-region (point) (point))
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(insert "\n" msg-copy))
|
|
|
|
|
(goto-char (point-min))
|
1997-12-26 10:48:47 +00:00
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(let ((fill-prefix "")
|
|
|
|
|
(case-fold-search t)
|
|
|
|
|
digest-name fun-list sep-list start end)
|
|
|
|
|
(setq digest-name (mail-strip-quoted-names
|
|
|
|
|
(save-restriction
|
|
|
|
|
(search-forward "\n\n" nil 'move)
|
|
|
|
|
(narrow-to-region (point-min) (point))
|
|
|
|
|
(or (mail-fetch-field "Reply-To")
|
|
|
|
|
(mail-fetch-field "To")
|
|
|
|
|
(mail-fetch-field "Apparently-To")
|
|
|
|
|
(mail-fetch-field "From")))))
|
|
|
|
|
(unless digest-name
|
|
|
|
|
(error "Message is not a digest--bad header"))
|
|
|
|
|
(setq fun-list rmail-digest-methods)
|
|
|
|
|
(while (and fun-list
|
|
|
|
|
(null (setq sep-list (funcall (car fun-list)))))
|
|
|
|
|
(setq fun-list (cdr fun-list)))
|
|
|
|
|
(unless sep-list
|
|
|
|
|
(error "Message is not a digest--no messages found"))
|
|
|
|
|
;; Split the digest into separate rmail messages.
|
|
|
|
|
(while sep-list
|
|
|
|
|
(setq start (caar sep-list)
|
|
|
|
|
end (cdar sep-list))
|
|
|
|
|
(delete-region start end)
|
|
|
|
|
(goto-char start)
|
|
|
|
|
(search-forward "\n\n" (caar (cdr sep-list)) 'move)
|
|
|
|
|
(save-restriction
|
|
|
|
|
(narrow-to-region end (point))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(insert "\nFrom rmail@localhost " (current-time-string) "\n")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(rmail-add-mbox-headers))
|
|
|
|
|
(unless (mail-fetch-field "To")
|
|
|
|
|
(insert "To: " digest-name "\n")))
|
|
|
|
|
(set-marker start nil)
|
|
|
|
|
(set-marker end nil)
|
|
|
|
|
(setq sep-list (cdr sep-list))))
|
1997-12-26 10:48:47 +00:00
|
|
|
|
(setq error nil)
|
|
|
|
|
(message "Message successfully undigestified")
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(set-buffer buff)
|
|
|
|
|
(rmail-swap-buffers-maybe)
|
|
|
|
|
(goto-char (point-max))
|
2009-09-10 06:18:23 +00:00
|
|
|
|
;; FIXME use rmail-count-new-messages.
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(rmail-set-message-counters)
|
|
|
|
|
(set-buffer-modified-p t)
|
|
|
|
|
(rmail-show-message current)
|
|
|
|
|
(rmail-delete-forward)
|
|
|
|
|
(if (rmail-summary-exists)
|
|
|
|
|
(rmail-select-summary (rmail-update-summary))))
|
|
|
|
|
(when error
|
|
|
|
|
(delete-region (point-min) (point-max))
|
|
|
|
|
(set-buffer buff)
|
|
|
|
|
(rmail-show-message current))))))
|
2002-12-20 12:46:44 +00:00
|
|
|
|
|
1996-09-27 00:33:39 +00:00
|
|
|
|
;;;###autoload
|
1996-02-21 21:28:05 +00:00
|
|
|
|
(defun unforward-rmail-message ()
|
|
|
|
|
"Extract a forwarded message from the containing message.
|
2012-02-18 13:57:00 -08:00
|
|
|
|
This puts the forwarded message into a separate rmail message following
|
|
|
|
|
the containing message. This command is only useful when messages are
|
|
|
|
|
forwarded with `rmail-enable-mime-composing' set to nil."
|
1996-02-21 21:28:05 +00:00
|
|
|
|
(interactive)
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(set-buffer rmail-buffer)
|
|
|
|
|
(let ((buff (current-buffer))
|
|
|
|
|
(current rmail-current-message)
|
|
|
|
|
(beg (rmail-msgbeg rmail-current-message))
|
|
|
|
|
(msgend (rmail-msgend rmail-current-message))
|
|
|
|
|
(error t))
|
|
|
|
|
(unwind-protect
|
|
|
|
|
(progn
|
|
|
|
|
(if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer))
|
2002-12-20 12:46:44 +00:00
|
|
|
|
(widen)
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(goto-char beg)
|
|
|
|
|
(search-forward "\n\n" msgend)
|
|
|
|
|
(narrow-to-region beg (point))
|
|
|
|
|
(let ((old-fwd-from (mail-fetch-field "Forwarded-From" nil nil t))
|
|
|
|
|
(old-fwd-date (mail-fetch-field "Forwarded-Date" nil nil t))
|
|
|
|
|
(fwd-from (mail-fetch-field "From"))
|
|
|
|
|
(fwd-date (mail-fetch-field "Date"))
|
|
|
|
|
(buffer-read-only nil)
|
|
|
|
|
prefix forward-msg end)
|
|
|
|
|
(widen)
|
|
|
|
|
(narrow-to-region beg msgend)
|
|
|
|
|
(cond ((re-search-forward rmail-forward-separator-regex nil t)
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(skip-chars-forward "\n")
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
(setq end (if (re-search-forward "^----.*[^- \t\n]" nil t)
|
|
|
|
|
(match-beginning 0) (point-max)))
|
|
|
|
|
(setq forward-msg
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
"^- -" "-" (buffer-substring beg end))))
|
|
|
|
|
((and (re-search-forward "^\\(> ?\\)[a-zA-Z-]+: .*\n" nil t)
|
|
|
|
|
(setq beg (match-beginning 0))
|
|
|
|
|
(setq prefix (match-string-no-properties 1))
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(looking-at (concat "\\(" prefix ".+\n\\)*"
|
|
|
|
|
prefix "Date: ."))
|
|
|
|
|
(looking-at (concat "\\(" prefix ".+\n\\)*"
|
|
|
|
|
prefix "From: .+\n"
|
|
|
|
|
"\\(" prefix ".+\n\\)*"
|
|
|
|
|
"\\(> ?\\)?\n" prefix)))
|
|
|
|
|
(re-search-forward "^[^>\n]" nil 'move)
|
|
|
|
|
(backward-char)
|
|
|
|
|
(skip-chars-backward " \t\n")
|
|
|
|
|
(forward-line 1)
|
|
|
|
|
(setq end (point))
|
|
|
|
|
(setq forward-msg
|
|
|
|
|
(replace-regexp-in-string
|
|
|
|
|
(if (string= prefix ">") "^>" "> ?")
|
|
|
|
|
"" (buffer-substring beg end))))
|
|
|
|
|
(t
|
|
|
|
|
(error "No forwarded message found")))
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char msgend)
|
|
|
|
|
;; Insert a fake From line.
|
|
|
|
|
;; FIXME we could construct one using the From and Date headers
|
|
|
|
|
;; of the forwarded message - is it worth it?
|
|
|
|
|
(insert "\n\nFrom rmail@localhost " (current-time-string) "\n")
|
|
|
|
|
(setq beg (point)) ; start of header
|
|
|
|
|
(while old-fwd-from
|
|
|
|
|
(insert "Forwarded-From: " (car old-fwd-from) "\n")
|
|
|
|
|
(insert "Forwarded-Date: " (car old-fwd-date) "\n")
|
|
|
|
|
(setq old-fwd-from (cdr old-fwd-from))
|
|
|
|
|
(setq old-fwd-date (cdr old-fwd-date)))
|
|
|
|
|
(insert "Forwarded-From: " fwd-from "\n")
|
|
|
|
|
(insert "Forwarded-Date: " fwd-date "\n")
|
|
|
|
|
(insert forward-msg "\n")
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(re-search-forward "\n$" nil 'move) ; end of header
|
|
|
|
|
(narrow-to-region beg (point))
|
2002-12-20 12:46:44 +00:00
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(while (not (eobp))
|
|
|
|
|
(unless (looking-at "^[a-zA-Z-]+: ")
|
|
|
|
|
(insert "\t"))
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(forward-line))
|
|
|
|
|
(widen)
|
|
|
|
|
(goto-char beg)
|
|
|
|
|
(forward-line -1)
|
|
|
|
|
(rmail-add-mbox-headers)) ; marks as unseen
|
|
|
|
|
(setq error nil)
|
|
|
|
|
(set-buffer buff)
|
|
|
|
|
(rmail-swap-buffers-maybe)
|
|
|
|
|
(goto-char (point-max))
|
2009-09-10 06:18:23 +00:00
|
|
|
|
;; FIXME use rmail-count-new-messages.
|
2009-02-06 03:58:20 +00:00
|
|
|
|
(rmail-set-message-counters)
|
|
|
|
|
(set-buffer-modified-p t)
|
|
|
|
|
(rmail-show-message current)
|
|
|
|
|
(if (rmail-summary-exists)
|
|
|
|
|
(rmail-select-summary (rmail-update-summary))))
|
|
|
|
|
(when error
|
|
|
|
|
(set-buffer buff)
|
|
|
|
|
(rmail-show-message current)))))
|
1996-02-21 21:28:05 +00:00
|
|
|
|
|
1997-06-22 18:57:55 +00:00
|
|
|
|
(provide 'undigest)
|
|
|
|
|
|
1992-05-30 20:24:49 +00:00
|
|
|
|
;;; undigest.el ends here
|