1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
emacs/lisp/mail/rmailsum.el

2114 lines
78 KiB
EmacsLisp
Raw Normal View History

;;; rmailsum.el --- make summary buffers for the mail reader -*- lexical-binding:t -*-
2009-01-22 17:09:23 +00:00
2024-01-02 01:47:10 +00:00
;; Copyright (C) 1985, 1993-1996, 2000-2024 Free Software Foundation,
;; Inc.
2009-01-22 17:09:23 +00:00
;; Maintainer: emacs-devel@gnu.org
2009-01-22 17:09:23 +00:00
;; Keywords: mail
;; Package: rmail
2009-01-22 17:09:23 +00:00
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; 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
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
2009-01-22 17:09:23 +00:00
;;; Commentary:
;; Extended by Bob Weiner of Motorola
;; Provided all commands from rmail-mode in rmail-summary-mode and made key
;; bindings in both modes wholly compatible.
;;; Code:
;; For rmail-select-summary.
2009-01-22 17:09:23 +00:00
(require 'rmail)
2010-11-26 04:06:59 +00:00
(require 'rfc2047)
2009-01-22 17:09:23 +00:00
(defcustom rmail-summary-scroll-between-messages t
"Non-nil means Rmail summary scroll commands move between messages.
That is, after `rmail-summary-scroll-msg-up' reaches the end of a
message, it moves to the next message; and similarly for
`rmail-summary-scroll-msg-down'."
2009-01-22 17:09:23 +00:00
:type 'boolean
:group 'rmail-summary)
;; FIXME could do with a :set function that regenerates the summary
;; and updates rmail-summary-vector.
2009-01-22 17:09:23 +00:00
(defcustom rmail-summary-line-count-flag t
"Non-nil means Rmail summary should show the number of lines in each message.
Setting this option to nil might speed up the generation of summaries."
2009-01-22 17:09:23 +00:00
:type 'boolean
:group 'rmail-summary)
(defcustom rmail-summary-progressively-narrow nil
"Non-nil means progressively narrow the set of messages produced by summary.
Correct many instances of ``allows to'' Refer to: lists.gnu.org/archive/html/emacs-devel/2016-01/msg01598.html * doc/emacs/frames.texi (Tab Bars): * doc/emacs/maintaining.texi (Tag Syntax): * doc/lispref/compile.texi (Native Compilation): * doc/lispref/control.texi (Destructuring with pcase Patterns): * doc/lispref/display.texi (Overlay Properties, Glyphless Chars): * doc/lispref/frames.texi (Size Parameters, Layout Parameters) (Child Frames): * doc/lispref/minibuf.texi (Minibuffer Windows): * doc/lispref/processes.texi (Asynchronous Processes): * doc/lispref/windows.texi (Precedence of Action Functions) (Mouse Window Auto-selection): * doc/misc/autotype.texi (Autoinserting): * doc/misc/efaq.texi (New in Emacs 28): * doc/misc/idlwave.texi (Examining Variables): * doc/misc/ses.texi (Quick Tutorial, Standard formula functions): * doc/misc/tramp.texi (External methods, FUSE-based methods): * lisp/comint.el (comint-insert-previous-argument-from-end): * lisp/emacs-lisp/rmc.el (read-multiple-choice): * lisp/gnus/gnus-util.el: * lisp/mail/rmailsum.el (rmail-summary-progressively-narrow): * lisp/mouse.el (mouse-drag-track): * lisp/net/tramp-sudoedit.el: * lisp/obsolete/landmark.el: * lisp/org/org.el (org-startup-truncated, org-file-apps): * lisp/pixel-scroll.el (pixel-scroll-precision-mode): * lisp/progmodes/cperl-mode.el (cperl-praise): * lisp/simple.el (yank-from-kill-ring, kill-visual-line): * lisp/window.el (delete-window-choose-selected): * src/ChangeLog.11: * src/xdisp.c (syms_of_xdisp): * src/xterm.c (handle_one_xevent): The construct ``allows to <infinitive>'' is not English inasmuch as no direct object to ``allows'' is provided. Correct and rephrase each instance of such a construct within our documentation and commentary.
2023-09-10 01:33:50 +00:00
This enables you to apply the summary criteria on top one another,
thus progressively narrowing the selection of the messages produced
by each summary criteria.
For example, applying `rmail-summary-by-senders' on top
of `rmail-summary-by-topic' produces a summary of messages
with the specified Subjects that were sent from specified
sending addresses.
This way, the user can apply one summary on top of another,
and keep narrowing the resulting list of messages."
:type 'boolean
:version "29.1"
:group 'rmail-summary)
(defvar rmail-summary-currently-displayed-msgs nil
"Boolean vector that tells which messages are displayed in the summary.
First element is ignored. Used when applying rmail-summary-by-*
commands consecutively. Filled by
`rmail-summary-populate-displayed-messages'.")
(put 'rmail-summary-currently-displayed-msgs 'permanent-local t)
(defvar rmail-summary-message-ids-hash-table nil
"Hash table linking Message IDs of messages with their indices.")
(defvar rmail-summary-subjects-hash-table nil
"Hash table linking subjects with index of the first message with that subject.")
(defvar rmail-summary-message-parents-vector nil
"Vector that holds a list of indices of parents for each message.
Message A is parent of message B if the id of A appears in the
\"References\" or \"In-reply-to\" fields of B, or if A is the first
message with the same \"Subject\" as B. First element is ignored.")
(defcustom rmail-summary-starting-message 1
"Message number to start summarizing at."
:type 'integer
:group 'rmail-summary)
(defvar rmail-summary-message-descendants-vector nil
"Vector that holds the direct descendants of each message.
This is the antipode of `rmail-summary-message-parents-vector'.
First element is ignored.")
2009-01-22 17:09:23 +00:00
(defvar rmail-summary-font-lock-keywords
'(("^ *[0-9]+D.*" . font-lock-string-face) ; Deleted.
("^ *[0-9]+-.*" . font-lock-type-face) ; Unread.
2009-01-22 17:09:23 +00:00
;; Neither of the below will be highlighted if either of the above are:
("^ *[0-9]+[^D-] \\(......\\)" 1 font-lock-keyword-face) ; Date.
2009-01-22 17:09:23 +00:00
("{ \\([^\n}]+\\) }" 1 font-lock-comment-face)) ; Labels.
"Additional expressions to highlight in Rmail Summary mode.")
(defvar rmail-summary-redo nil
2009-01-22 17:09:23 +00:00
"(FUNCTION . ARGS) to regenerate this Rmail summary buffer.")
(defvar rmail-summary-overlay nil
"Overlay used to highlight the current message in the Rmail summary.")
2009-01-22 17:09:23 +00:00
(put 'rmail-summary-overlay 'permanent-local t)
Move keymap initialization into declaration. * lisp/textmodes/enriched.el (enriched-mode-map): * lisp/textmodes/bib-mode.el (bib-mode-map): * lisp/term/lk201.el (lk201-function-map): * lisp/tar-mode.el (tar-mode-map): * lisp/replace.el (occur-mode-map): * lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map): * lisp/progmodes/idlw-help.el (idlwave-help-mode-map): * lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu): * lisp/play/solitaire.el (solitaire-mode-map): * lisp/play/snake.el (snake-mode-map, snake-null-map): * lisp/play/pong.el (pong-mode-map): * lisp/play/handwrite.el (menu-bar-handwrite-map): * lisp/play/gametree.el (gametree-mode-map): * lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map (rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map): * lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map) (newsticker--url-keymap): * lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map): * lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu) (menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu) (menu-bar-edit-menu, menu-bar-custom-menu) (menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu) (menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu) (menu-bar-line-wrapping-menu, menu-bar-options-menu) (menu-bar-games-menu, menu-bar-encryption-decryption-menu) (menu-bar-tools-menu, menu-bar-describe-menu) (menu-bar-search-documentation-menu, menu-bar-manuals-menu) (menu-bar-help-menu): * lisp/mail/rmailsum.el (rmail-summary-mode-map): * lisp/kmacro.el (kmacro-step-edit-map): * lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map) (ibuffer-mode-operate-map): * lisp/hi-lock.el (hi-lock-menu, hi-lock-map): * lisp/emulation/vip.el (vip-mode-map): * lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map): * lisp/bookmark.el (bookmark-bmenu-mode-map): * lisp/help-mode.el (help-mode-map): * lisp/erc/erc-list.el (erc-list-menu-mode-map): * lisp/org/org-remember.el (org-remember-mode-map): * lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.
2011-02-10 16:56:00 +00:00
(defvar rmail-summary-mode-map
(let ((map (make-keymap)))
(suppress-keymap map)
(define-key map [mouse-2] 'rmail-summary-mouse-goto-message)
(define-key map "a" 'rmail-summary-add-label)
(define-key map "b" 'rmail-summary-bury)
(define-key map "c" 'rmail-summary-continue)
(define-key map "d" 'rmail-summary-delete-forward)
(define-key map "\C-d" 'rmail-summary-delete-backward)
(define-key map "e" 'rmail-summary-edit-current-message)
(define-key map "f" 'rmail-summary-forward)
(define-key map "g" 'rmail-summary-get-new-mail)
(define-key map "h" 'rmail-summary)
(define-key map "i" 'rmail-summary-input)
(define-key map "j" 'rmail-summary-goto-msg)
(define-key map "\C-m" 'rmail-summary-goto-msg)
(define-key map "k" 'rmail-summary-kill-label)
(define-key map "l" 'rmail-summary-by-labels)
(define-key map "\e\C-h" 'rmail-summary)
(define-key map "\e\C-l" 'rmail-summary-by-labels)
(define-key map "\e\C-r" 'rmail-summary-by-recipients)
(define-key map "\e\C-s" 'rmail-summary-by-regexp)
;; `f' for "from".
(define-key map "\e\C-f" 'rmail-summary-by-senders)
(define-key map "\e\C-t" 'rmail-summary-by-topic)
(define-key map "m" 'rmail-summary-mail)
(define-key map "\M-m" 'rmail-summary-retry-failure)
(define-key map "n" 'rmail-summary-next-msg)
(define-key map "\en" 'rmail-summary-next-all)
(define-key map "\e\C-n" 'rmail-summary-next-labeled-message)
(define-key map "o" 'rmail-summary-output)
(define-key map "\C-o" 'rmail-summary-output-as-seen)
(define-key map "p" 'rmail-summary-previous-msg)
(define-key map "\ep" 'rmail-summary-previous-all)
(define-key map "\e\C-p" 'rmail-summary-previous-labeled-message)
(define-key map "q" 'rmail-summary-quit)
(define-key map "Q" 'rmail-summary-wipe)
(define-key map "r" 'rmail-summary-reply)
(define-key map "s" 'rmail-summary-expunge-and-save)
;; See rms's comment in rmail.el
;; (define-key map "\er" 'rmail-summary-search-backward)
(define-key map "\es" 'rmail-summary-search)
(define-key map "t" 'rmail-summary-toggle-header)
(define-key map "u" 'rmail-summary-undelete)
(define-key map "\M-u" 'rmail-summary-undelete-many)
(define-key map "x" 'rmail-summary-expunge)
(define-key map "w" 'rmail-summary-output-body)
(define-key map "v" 'rmail-mime)
(define-key map "." 'rmail-summary-beginning-of-message)
(define-key map "/" 'rmail-summary-end-of-message)
(define-key map "<" 'rmail-summary-first-message)
(define-key map ">" 'rmail-summary-last-message)
(define-key map " " 'rmail-summary-scroll-msg-up)
(define-key map [?\S-\ ] 'rmail-summary-scroll-msg-down)
Move keymap initialization into declaration. * lisp/textmodes/enriched.el (enriched-mode-map): * lisp/textmodes/bib-mode.el (bib-mode-map): * lisp/term/lk201.el (lk201-function-map): * lisp/tar-mode.el (tar-mode-map): * lisp/replace.el (occur-mode-map): * lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map): * lisp/progmodes/idlw-help.el (idlwave-help-mode-map): * lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu): * lisp/play/solitaire.el (solitaire-mode-map): * lisp/play/snake.el (snake-mode-map, snake-null-map): * lisp/play/pong.el (pong-mode-map): * lisp/play/handwrite.el (menu-bar-handwrite-map): * lisp/play/gametree.el (gametree-mode-map): * lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map (rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map): * lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map) (newsticker--url-keymap): * lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map): * lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu) (menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu) (menu-bar-edit-menu, menu-bar-custom-menu) (menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu) (menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu) (menu-bar-line-wrapping-menu, menu-bar-options-menu) (menu-bar-games-menu, menu-bar-encryption-decryption-menu) (menu-bar-tools-menu, menu-bar-describe-menu) (menu-bar-search-documentation-menu, menu-bar-manuals-menu) (menu-bar-help-menu): * lisp/mail/rmailsum.el (rmail-summary-mode-map): * lisp/kmacro.el (kmacro-step-edit-map): * lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map) (ibuffer-mode-operate-map): * lisp/hi-lock.el (hi-lock-menu, hi-lock-map): * lisp/emulation/vip.el (vip-mode-map): * lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map): * lisp/bookmark.el (bookmark-bmenu-mode-map): * lisp/help-mode.el (help-mode-map): * lisp/erc/erc-list.el (erc-list-menu-mode-map): * lisp/org/org-remember.el (org-remember-mode-map): * lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.
2011-02-10 16:56:00 +00:00
(define-key map "\177" 'rmail-summary-scroll-msg-down)
(define-key map "?" 'describe-mode)
(define-key map "\C-c\C-d" 'rmail-summary-epa-decrypt)
Move keymap initialization into declaration. * lisp/textmodes/enriched.el (enriched-mode-map): * lisp/textmodes/bib-mode.el (bib-mode-map): * lisp/term/lk201.el (lk201-function-map): * lisp/tar-mode.el (tar-mode-map): * lisp/replace.el (occur-mode-map): * lisp/progmodes/idlwave.el (idlwave-rinfo-mouse-map, idlwave-rinfo-map): * lisp/progmodes/idlw-help.el (idlwave-help-mode-map): * lisp/progmodes/gdb-mi.el (gdb-memory-format-menu, gdb-memory-unit-menu): * lisp/play/solitaire.el (solitaire-mode-map): * lisp/play/snake.el (snake-mode-map, snake-null-map): * lisp/play/pong.el (pong-mode-map): * lisp/play/handwrite.el (menu-bar-handwrite-map): * lisp/play/gametree.el (gametree-mode-map): * lisp/net/rcirc.el (rcirc-mode-map, rcirc-browse-url-map (rcirc-multiline-minor-mode-map, rcirc-track-minor-mode-map): * lisp/net/newst-plainview.el (newsticker-menu, newsticker-mode-map) (newsticker--url-keymap): * lisp/net/net-utils.el (nslookup-mode-map, ftp-mode-map): * lisp/menu-bar.el (menu-bar-file-menu, menu-bar-i-search-menu) (menu-bar-search-menu, menu-bar-replace-menu, menu-bar-goto-menu) (menu-bar-edit-menu, menu-bar-custom-menu) (menu-bar-showhide-fringe-ind-menu, menu-bar-showhide-fringe-menu) (menu-bar-showhide-scroll-bar-menu, menu-bar-showhide-menu) (menu-bar-line-wrapping-menu, menu-bar-options-menu) (menu-bar-games-menu, menu-bar-encryption-decryption-menu) (menu-bar-tools-menu, menu-bar-describe-menu) (menu-bar-search-documentation-menu, menu-bar-manuals-menu) (menu-bar-help-menu): * lisp/mail/rmailsum.el (rmail-summary-mode-map): * lisp/kmacro.el (kmacro-step-edit-map): * lisp/ibuffer.el (ibuffer-mode-groups-popup, ibuffer-mode-map) (ibuffer-mode-operate-map): * lisp/hi-lock.el (hi-lock-menu, hi-lock-map): * lisp/emulation/vip.el (vip-mode-map): * lisp/emacs-lisp/re-builder.el (reb-lisp-mode-map): * lisp/bookmark.el (bookmark-bmenu-mode-map): * lisp/help-mode.el (help-mode-map): * lisp/erc/erc-list.el (erc-list-menu-mode-map): * lisp/org/org-remember.el (org-remember-mode-map): * lisp/org/org-src.el (org-src-mode-map): Move initialization into declaration.
2011-02-10 16:56:00 +00:00
(define-key map "\C-c\C-n" 'rmail-summary-next-same-subject)
(define-key map "\C-c\C-p" 'rmail-summary-previous-same-subject)
(define-key map "\C-c\C-s\C-d" 'rmail-summary-sort-by-date)
(define-key map "\C-c\C-s\C-s" 'rmail-summary-sort-by-subject)
(define-key map "\C-c\C-s\C-a" 'rmail-summary-sort-by-author)
(define-key map "\C-c\C-s\C-r" 'rmail-summary-sort-by-recipient)
(define-key map "\C-c\C-s\C-c" 'rmail-summary-sort-by-correspondent)
(define-key map "\C-c\C-s\C-l" 'rmail-summary-sort-by-lines)
(define-key map "\C-c\C-s\C-k" 'rmail-summary-sort-by-labels)
(define-key map "\C-x\C-s" 'rmail-summary-save-buffer)
;; Menu bar bindings.
(define-key map [menu-bar] (make-sparse-keymap))
(define-key map [menu-bar classify]
(cons "Classify" (make-sparse-keymap "Classify")))
(define-key map [menu-bar classify output-menu]
'("Output (Rmail Menu)..." . rmail-summary-output-menu))
(define-key map [menu-bar classify input-menu]
'("Input Rmail File (menu)..." . rmail-input-menu))
(define-key map [menu-bar classify input-menu]
'(nil))
(define-key map [menu-bar classify output-menu]
'(nil))
(define-key map [menu-bar classify output-body]
'("Output body..." . rmail-summary-output-body))
(define-key map [menu-bar classify output-inbox]
'("Output..." . rmail-summary-output))
(define-key map [menu-bar classify output]
'("Output as seen..." . rmail-summary-output-as-seen))
(define-key map [menu-bar classify kill-label]
'("Kill Label..." . rmail-summary-kill-label))
(define-key map [menu-bar classify add-label]
'("Add Label..." . rmail-summary-add-label))
(define-key map [menu-bar summary]
(cons "Summary" (make-sparse-keymap "Summary")))
(define-key map [menu-bar summary senders]
'("By Senders..." . rmail-summary-by-senders))
(define-key map [menu-bar summary labels]
'("By Labels..." . rmail-summary-by-labels))
(define-key map [menu-bar summary recipients]
'("By Recipients..." . rmail-summary-by-recipients))
(define-key map [menu-bar summary topic]
'("By Topic..." . rmail-summary-by-topic))
(define-key map [menu-bar summary regexp]
'("By Regexp..." . rmail-summary-by-regexp))
(define-key map [menu-bar summary all]
'("All" . rmail-summary))
(define-key map [menu-bar mail]
(cons "Mail" (make-sparse-keymap "Mail")))
(define-key map [menu-bar mail rmail-summary-get-new-mail]
'("Get New Mail" . rmail-summary-get-new-mail))
(define-key map [menu-bar mail lambda]
'("----"))
(define-key map [menu-bar mail continue]
'("Continue" . rmail-summary-continue))
(define-key map [menu-bar mail resend]
'("Re-send..." . rmail-summary-resend))
(define-key map [menu-bar mail forward]
'("Forward" . rmail-summary-forward))
(define-key map [menu-bar mail retry]
'("Retry" . rmail-summary-retry-failure))
(define-key map [menu-bar mail reply]
'("Reply" . rmail-summary-reply))
(define-key map [menu-bar mail mail]
'("Mail" . rmail-summary-mail))
(define-key map [menu-bar delete]
(cons "Delete" (make-sparse-keymap "Delete")))
(define-key map [menu-bar delete expunge/save]
'("Expunge/Save" . rmail-summary-expunge-and-save))
(define-key map [menu-bar delete expunge]
'("Expunge" . rmail-summary-expunge))
(define-key map [menu-bar delete undelete]
'("Undelete" . rmail-summary-undelete))
(define-key map [menu-bar delete delete]
'("Delete" . rmail-summary-delete-forward))
(define-key map [menu-bar move]
(cons "Move" (make-sparse-keymap "Move")))
(define-key map [menu-bar move search-back]
'("Search Back..." . rmail-summary-search-backward))
(define-key map [menu-bar move search]
'("Search..." . rmail-summary-search))
(define-key map [menu-bar move previous]
'("Previous Nondeleted" . rmail-summary-previous-msg))
(define-key map [menu-bar move next]
'("Next Nondeleted" . rmail-summary-next-msg))
(define-key map [menu-bar move last]
'("Last" . rmail-summary-last-message))
(define-key map [menu-bar move first]
'("First" . rmail-summary-first-message))
(define-key map [menu-bar move previous]
'("Previous" . rmail-summary-previous-all))
(define-key map [menu-bar move next]
'("Next" . rmail-summary-next-all))
map)
"Keymap used in Rmail summary mode.")
2009-01-22 17:09:23 +00:00
;; Entry points for making a summary buffer.
;; Regenerate the contents of the summary
;; using the same selection criterion as last time.
;; M-x revert-buffer in a summary buffer calls this function.
(defun rmail-update-summary (&rest _)
2009-01-22 17:09:23 +00:00
(apply (car rmail-summary-redo) (cdr rmail-summary-redo)))
(defun rmail-summary-populate-displayed-messages ()
"Populate the `rmail-summary-currently-displayed-msgs' vector."
(with-current-buffer rmail-buffer
(let ((totmsgs rmail-total-messages))
(with-current-buffer rmail-summary-buffer
(setq rmail-summary-currently-displayed-msgs
(make-bool-vector (1+ totmsgs) nil))
(goto-char (point-min))
(while (not (eobp))
(aset rmail-summary-currently-displayed-msgs
(string-to-number (thing-at-point 'line))
t)
(forward-line 1))))))
(defun rmail-summary-fill-message-ids-hash-table ()
"Fill `rmail-summary-message-ids-hash-table'."
(with-current-buffer rmail-buffer
(setq rmail-summary-message-ids-hash-table
(make-hash-table :test 'equal :size 1024))
(let ((msgnum 1))
(while (<= msgnum rmail-total-messages)
(let ((id (rmail-get-header "Message-ID" msgnum)))
(puthash id (cons (cons id msgnum)
(gethash id rmail-summary-message-ids-hash-table))
rmail-summary-message-ids-hash-table))
(setq msgnum (1+ msgnum))))))
(defun rmail-summary--split-header-field (name &optional msgnum)
(let ((header (rmail-get-header name msgnum)))
(if header
(split-string header "[ \f\t\n\r\v,;]+"))))
(defun rmail-summary-fill-message-parents-and-descs-vectors ()
"Fill parents and descendants vectors for messages.
This populates `rmail-summary-message-parents-vector'
and `rmail-summary-message-descendants-vector'."
(with-current-buffer rmail-buffer
(rmail-summary-fill-message-ids-hash-table)
(setq rmail-summary-subjects-hash-table
(make-hash-table :test 'equal :size 1024))
(setq rmail-summary-message-parents-vector
(make-vector (1+ rmail-total-messages) nil))
(setq rmail-summary-message-descendants-vector
(make-vector (1+ rmail-total-messages) nil))
(let ((msgnum 1))
(while (<= msgnum rmail-total-messages)
(let* ((parents nil)
(subject (rmail-simplified-subject msgnum))
(subj-cell (gethash subject rmail-summary-subjects-hash-table))
(subj-par (assoc subject subj-cell))
(refs (rmail-summary--split-header-field "References" msgnum))
(reply-tos (rmail-summary--split-header-field "In-reply-to"
msgnum)))
(if subj-par
(progn
(setq parents (cons (cdr subj-par) nil))
(aset rmail-summary-message-descendants-vector (cdr subj-par)
(cons msgnum
(aref rmail-summary-message-descendants-vector
(cdr subj-par)))))
(puthash subject (cons (cons subject msgnum) subj-cell)
rmail-summary-subjects-hash-table))
(dolist (id (append refs reply-tos))
(let ((ent
(assoc id
(gethash id rmail-summary-message-ids-hash-table))))
(when ent
(setq parents (cons (cdr ent) parents))
(aset rmail-summary-message-descendants-vector (cdr ent)
(cons msgnum
(aref rmail-summary-message-descendants-vector
(cdr ent)))))))
(aset rmail-summary-message-parents-vector msgnum parents)
(setq msgnum (1+ msgnum)))))))
(defun rmail-summary-invert ()
"Invert the criteria of the current summary.
That is, show the messages that are not displayed, and hide
the messages that are displayed."
(interactive)
(rmail-summary-populate-displayed-messages)
(rmail-new-summary "Invert"
'(rmail-summary-by-regexp ".*")
(lambda (msg)
(if
(not (aref rmail-summary-currently-displayed-msgs msg))
(aset rmail-summary-currently-displayed-msgs msg t)
(aset rmail-summary-currently-displayed-msgs msg nil)))))
(defun rmail-summary--exists-1 ()
"Like `rmail-summary-exists', but works in both main and summary buffers."
(with-current-buffer rmail-buffer
(and rmail-summary-buffer (buffer-name rmail-summary-buffer)
rmail-summary-buffer)))
2009-01-22 17:09:23 +00:00
;;;###autoload
(defun rmail-summary ()
"Display a summary of all messages, one line per message."
(interactive)
(rmail-new-summary "All" '(rmail-summary) nil))
2009-01-22 17:09:23 +00:00
(defun rmail-summary--walk-thread-message-recursively (msgnum encountered-msgs)
"Add parents and descendants of message MSGNUM to ENCOUNTERED-MSGS, recursively."
(unless (aref encountered-msgs msgnum)
(aset encountered-msgs msgnum t)
(let ((walk-thread-msg
(lambda (msg)
(rmail-summary--walk-thread-message-recursively
msg encountered-msgs))))
(mapc walk-thread-msg
(aref rmail-summary-message-parents-vector msgnum))
(mapc walk-thread-msg
(aref rmail-summary-message-descendants-vector msgnum)))))
;;;###autoload
(defun rmail-summary-by-thread (&optional msgnum)
"Display a summary of messages in the same discussion thread as MSGNUM.
Interactively, prompt for MSGNUM, defaulting to the current message.
Threads are based on the \"Subject\", \"References\" and \"In-reply-to\"
headers of the messages."
(interactive
(let* ((msg rmail-current-message)
(prompt (concat "Show thread containing message number")))
(list (read-number prompt msg))))
(with-current-buffer rmail-buffer
(unless msgnum
(setq msgnum rmail-current-message))
(unless (and rmail-summary-message-parents-vector
(= (length rmail-summary-message-parents-vector)
(1+ rmail-total-messages)))
(rmail-summary-fill-message-parents-and-descs-vectors)))
(let ((enc-msgs
(with-current-buffer rmail-buffer
(make-bool-vector (1+ rmail-total-messages) nil))))
(rmail-summary--walk-thread-message-recursively msgnum enc-msgs)
(rmail-new-summary (format "thread containing message %d" msgnum)
(list 'rmail-summary-by-thread msgnum)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(lambda (msg _msgnum)
(and (aref rmail-summary-currently-displayed-msgs msg)
(aref enc-msgs msg)))
(lambda (msg _msgnum)
(aref enc-msgs msg)))
msgnum)))
2009-01-22 17:09:23 +00:00
;;;###autoload
(defun rmail-summary-by-labels (labels)
2009-01-22 17:09:23 +00:00
"Display a summary of all messages with one or more LABELS.
LABELS should be a string containing the desired labels, separated by commas."
(interactive "sLabels to summarize by: ")
2009-01-22 17:09:23 +00:00
(if (string= labels "")
(setq labels (or rmail-last-multi-labels
(error "No label specified"))))
(setq rmail-last-multi-labels labels)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(rmail-summary-populate-displayed-messages))
2009-01-22 17:09:23 +00:00
(rmail-new-summary (concat "labels " labels)
(list 'rmail-summary-by-labels labels)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(lambda (msg l)
(and (aref rmail-summary-currently-displayed-msgs msg)
(rmail-message-labels-p msg l)))
'rmail-message-labels-p)
(concat " \\("
(mail-comma-list-regexp labels)
"\\)\\(,\\|\\'\\)")))
2009-01-22 17:09:23 +00:00
;;;###autoload
(defun rmail-summary-by-recipients (recipients &optional primary-only)
2009-01-22 17:09:23 +00:00
"Display a summary of all messages with the given RECIPIENTS.
Normally checks the To, From and Cc fields of headers;
but if PRIMARY-ONLY is non-nil (prefix arg given),
only look in the To and From fields.
RECIPIENTS is a regular expression."
2009-01-22 17:09:23 +00:00
(interactive "sRecipients to summarize by: \nP")
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(rmail-summary-populate-displayed-messages))
2009-01-22 17:09:23 +00:00
(rmail-new-summary
(concat "recipients " recipients)
(list 'rmail-summary-by-recipients recipients primary-only)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(lambda (msg r &optional po)
(and (aref rmail-summary-currently-displayed-msgs msg)
(rmail-message-recipients-p msg r po)))
'rmail-message-recipients-p)
recipients primary-only))
2009-01-22 17:09:23 +00:00
(defun rmail-message-recipients-p (msg recipients &optional primary-only)
(rmail-apply-in-message msg 'rmail-message-recipients-p-1
recipients primary-only))
(defun rmail-message-recipients-p-1 (recipients &optional primary-only)
;; mail-fetch-field does not care where it starts from.
(narrow-to-region (point) (progn (search-forward "\n\n") (point)))
2009-01-22 17:09:23 +00:00
(or (string-match recipients (or (mail-fetch-field "To") ""))
(string-match recipients (or (mail-fetch-field "From") ""))
(if (not primary-only)
(string-match recipients (or (mail-fetch-field "Cc") "")))))
;; FIXME I find this a non-obvious name for what this function does.
;; Also, the optional WHOLE-MESSAGE argument of r-s-by-topic would
;; seem more natural here.
2009-01-22 17:09:23 +00:00
;;;###autoload
(defun rmail-summary-by-regexp (regexp)
2009-01-22 17:09:23 +00:00
"Display a summary of all messages according to regexp REGEXP.
If the regular expression is found in the header of the message
\(including in the date and other lines, as well as the subject line),
Emacs will list the message in the summary."
(interactive "sRegexp to summarize by: ")
2009-01-22 17:09:23 +00:00
(if (string= regexp "")
(setq regexp (or rmail-last-regexp
(error "No regexp specified"))))
(setq rmail-last-regexp regexp)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(rmail-summary-populate-displayed-messages))
2009-01-22 17:09:23 +00:00
(rmail-new-summary (concat "regexp " regexp)
(list 'rmail-summary-by-regexp regexp)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(lambda (msg r)
(and (aref rmail-summary-currently-displayed-msgs msg)
(rmail-message-regexp-p msg r)))
'rmail-message-regexp-p)
2009-01-22 17:09:23 +00:00
regexp))
(defun rmail-message-regexp-p (msg regexp)
"Return t, if for message number MSG, regexp REGEXP matches in the header."
(rmail-apply-in-message msg 'rmail-message-regexp-p-1 msg regexp))
(defun rmail--decode-and-apply (function &rest args)
"Make an RFC2047-decoded copy of current buffer, apply FUNCTION with ARGS."
(let ((buff (current-buffer)))
(with-temp-buffer
(insert-buffer-substring buff)
(goto-char (point-min))
;; FIXME? In rmail-show-message-1, decoding depends on
;; rmail-enable-mime being non-nil (?).
(rfc2047-decode-region (point-min)
(save-excursion
(progn
(search-forward "\n\n" nil 'move)
(point))))
(apply function args))))
2009-01-22 17:09:23 +00:00
(defun rmail-message-regexp-p-1 (msg regexp)
;; Search functions can expect to start from the beginning.
(narrow-to-region (point) (save-excursion (search-forward "\n\n") (point)))
(if (and rmail-enable-mime
rmail-search-mime-header-function)
(funcall rmail-search-mime-header-function msg regexp (point))
;; We need to search the full headers, but probably want to decode
;; them so they match the ones people see displayed. (Bug#19088)
(rmail--decode-and-apply 're-search-forward regexp nil t)))
2009-01-22 17:09:23 +00:00
;;;###autoload
(defun rmail-summary-by-topic (subject &optional whole-message)
2009-01-22 17:09:23 +00:00
"Display a summary of all messages with the given SUBJECT.
Normally checks just the Subject field of headers; but when prefix
argument WHOLE-MESSAGE is non-nil, looks in the whole message.
SUBJECT is a regular expression."
2009-01-22 17:09:23 +00:00
(interactive
;; We quote the default subject, because if it contains regexp
;; special characters (eg "?"), it can fail to match itself. (Bug#2333)
(let* ((subject (regexp-quote (rmail-simplified-subject)))
2009-01-22 17:09:23 +00:00
(prompt (concat "Topics to summarize by (regexp"
(if subject ", default current subject" "")
"): ")))
(list (read-string prompt nil nil subject) current-prefix-arg)))
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(rmail-summary-populate-displayed-messages))
2009-01-22 17:09:23 +00:00
(rmail-new-summary
(concat "about " subject)
(list 'rmail-summary-by-topic subject whole-message)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(lambda (msg s &optional wm)
(and (aref rmail-summary-currently-displayed-msgs msg)
(rmail-message-subject-p msg s wm)))
'rmail-message-subject-p)
subject whole-message))
2009-01-22 17:09:23 +00:00
(defun rmail-message-subject-p (msg subject &optional whole-message)
(if whole-message
;; SUBJECT and rmail-simplified-subject are 2047 decoded.
(rmail-apply-in-message msg 'rmail--decode-and-apply
're-search-forward subject nil t)
2009-01-22 17:09:23 +00:00
(string-match subject (rmail-simplified-subject msg))))
;;;###autoload
(defun rmail-summary-by-senders (senders)
"Display a summary of all messages whose \"From\" field matches SENDERS.
SENDERS is a regular expression. The default for SENDERS matches the
sender of the current message."
(interactive
(let* ((def (rmail-get-header "From"))
;; We quote the default argument, because if it contains regexp
;; special characters (eg "?"), it can fail to match itself.
(sender (regexp-quote def))
(prompt (concat "Senders to summarize by (regexp"
(if sender ", default this message's sender" "")
"): ")))
(list (read-string prompt nil nil sender))))
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(rmail-summary-populate-displayed-messages))
2009-01-22 17:09:23 +00:00
(rmail-new-summary
(concat "senders " senders)
(list 'rmail-summary-by-senders senders)
(if (and rmail-summary-progressively-narrow
(rmail-summary--exists-1))
(lambda (msg s)
(and (aref rmail-summary-currently-displayed-msgs msg)
(rmail-message-senders-p msg s)))
'rmail-message-senders-p)
senders))
2009-01-22 17:09:23 +00:00
(defun rmail-message-senders-p (msg senders)
(string-match senders (or (rmail-get-header "From" msg) "")))
;; General making of a summary buffer.
(defvar rmail-summary-symbol-number 0)
(defvar rmail-new-summary-line-count)
(defun rmail-new-summary (desc redo function &rest args)
2009-01-22 17:09:23 +00:00
"Create a summary of selected messages.
DESC makes part of the mode line of the summary buffer.
REDO is what to put in `rmail-summary-redo'; usually
its car is the function that called `rmail-new-summary'
and its cdr is the arguments passed to that function.
For each message, applies FUNCTION to the message number and ARGS...,
and if the result is non-nil, it includes that message in the summary.
If FUNCTION is nil, includes all messages."
2009-01-22 17:09:23 +00:00
(message "Computing summary lines...")
(unless rmail-buffer
(error "No RMAIL buffer found"))
(let (mesg was-in-summary sumbuf)
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(if (derived-mode-p 'rmail-summary-mode)
2009-01-22 17:09:23 +00:00
(setq was-in-summary t))
(with-current-buffer rmail-buffer
(setq rmail-summary-buffer (rmail-new-summary-1 desc redo function args)
;; r-s-b is buffer-local.
sumbuf rmail-summary-buffer
mesg rmail-current-message))
2009-01-22 17:09:23 +00:00
;; Now display the summary buffer and go to the right place in it.
(unless was-in-summary
(if (and (one-window-p)
pop-up-windows
(not pop-up-frames))
;; If there is just one window, put the summary on the top.
(progn
(split-window (selected-window) rmail-summary-window-size)
(select-window (next-window (frame-first-window)))
(rmail-pop-to-buffer sumbuf)
2009-01-22 17:09:23 +00:00
;; If pop-to-buffer did not use that window, delete that
;; window. (This can happen if it uses another frame.)
(if (not (eq sumbuf (window-buffer (frame-first-window))))
2009-01-22 17:09:23 +00:00
(delete-other-windows)))
(rmail-pop-to-buffer sumbuf))
2009-01-22 17:09:23 +00:00
(set-buffer rmail-buffer)
;; This is how rmail makes the summary buffer reappear.
;; We do this here to make the window the proper size.
(rmail-select-summary nil)
(set-buffer sumbuf))
2009-01-22 17:09:23 +00:00
(rmail-summary-goto-msg mesg t t)
(rmail-summary-construct-io-menu)
(message "Computing summary lines...done")))
(defun rmail-new-summary-1 (description redo function args)
2009-01-22 17:09:23 +00:00
"Filter messages to obtain summary lines.
DESCRIPTION is added to the mode line.
Return the summary buffer by invoking FUNCTION on each message
passing the message number and ARGS.
2009-01-22 17:09:23 +00:00
REDO is what to put in `rmail-summary-redo'.
2009-01-22 17:09:23 +00:00
The current buffer must be a Rmail buffer either containing a
collection of mbox formatted messages or displaying a single
message."
(let ((summary-msgs ())
(rmail-new-summary-line-count 0)
(sumbuf (rmail-get-create-summary-buffer)))
;; Scan the messages, getting their summary strings
;; and putting the list of them in SUMMARY-MSGS.
(let ((msgnum rmail-summary-starting-message)
2009-01-22 17:09:23 +00:00
(main-buffer (current-buffer))
(total rmail-total-messages)
(inhibit-read-only t))
(save-excursion
;; Go where the mbox text is.
(if (rmail-buffers-swapped-p)
(set-buffer rmail-view-buffer))
(let ((old-min (point-min-marker))
(old-max (point-max-marker)))
(unwind-protect
;; Can't use save-restriction here; that doesn't work if we
;; plan to modify text outside the original restriction.
(save-excursion
(widen)
(goto-char (point-min))
(while (>= total msgnum)
;; Go back to the Rmail buffer so FUNCTION and
;; rmail-get-summary can see its local vars.
2009-01-22 17:09:23 +00:00
(with-current-buffer main-buffer
;; First test whether to include this message.
(if (or (null function)
(apply function msgnum args))
(setq summary-msgs
(cons (cons msgnum (rmail-get-summary msgnum))
summary-msgs))))
(setq msgnum (1+ msgnum))
;; Provide a periodic User progress message.
(if (and (not (zerop rmail-new-summary-line-count))
(zerop (% rmail-new-summary-line-count 10)))
2009-01-22 17:09:23 +00:00
(message "Computing summary lines...%d"
rmail-new-summary-line-count)))
(setq summary-msgs (nreverse summary-msgs)))
(narrow-to-region old-min old-max)))))
;; Temporarily, while summary buffer is unfinished,
;; we "don't have" a summary.
(setq rmail-summary-buffer nil)
2009-01-22 17:09:23 +00:00
;; I have not a clue what this clause is doing. If you read this
;; chunk of code and have a clue, then please write it here.
2009-01-22 17:09:23 +00:00
(if rmail-enable-mime
(with-current-buffer rmail-buffer
(setq rmail-summary-buffer nil)))
(save-excursion
(let ((rbuf (current-buffer))
(total 0))
2009-01-22 17:09:23 +00:00
(set-buffer sumbuf)
;; Set up the summary buffer's contents.
(let ((buffer-read-only nil))
(erase-buffer)
(while summary-msgs
(princ (cdr (car summary-msgs)) sumbuf)
(setq total (1+ total))
2009-01-22 17:09:23 +00:00
(setq summary-msgs (cdr summary-msgs)))
(goto-char (point-min)))
;; Set up the rest of its state and local variables.
(setq buffer-read-only t)
(rmail-summary-mode)
(setq-local minor-mode-alist (list (list t (concat ": " description))))
2009-01-22 17:09:23 +00:00
(setq rmail-buffer rbuf
rmail-summary-redo redo
2009-01-22 17:09:23 +00:00
rmail-total-messages total)))
sumbuf))
(defun rmail-get-create-summary-buffer ()
"Return the Rmail summary buffer.
If necessary, it is created and undo is disabled."
2009-01-22 17:09:23 +00:00
(if (and rmail-summary-buffer (buffer-name rmail-summary-buffer))
rmail-summary-buffer
(let ((buff (generate-new-buffer (concat (buffer-name) "-summary"))))
(with-current-buffer buff
(setq buffer-undo-list t))
buff)))
2009-01-22 17:09:23 +00:00
;; Low levels of generating a summary.
(defun rmail-get-summary (msgnum)
"Return the summary line for message MSGNUM.
The mbox buffer must be current when you call this function
even if its text is swapped.
If the message has a summary line already, it will be stored in
the message as a header and simply returned, otherwise the
summary line is created, saved in the message header, cached and
returned.
The current buffer contains the unrestricted message collection."
(let ((line (aref rmail-summary-vector (1- msgnum))))
(unless line
;; Register a summary line for MSGNUM.
(setq rmail-new-summary-line-count (1+ rmail-new-summary-line-count)
line (rmail-create-summary-line msgnum))
;; Cache the summary line for use during this Rmail session.
(aset rmail-summary-vector (1- msgnum) line))
line))
2010-11-26 04:06:59 +00:00
(defcustom rmail-summary-line-decoder (function rfc2047-decode-string)
"Function to decode a Rmail summary line.
2009-01-22 17:09:23 +00:00
It receives the summary line for one message as a string
and should return the decoded string.
2010-11-26 04:06:59 +00:00
By default, it is `rfc2047-decode-string', which decodes MIME-encoded
subject."
2009-01-22 17:09:23 +00:00
:type 'function
2010-11-26 04:06:59 +00:00
:version "23.3"
2009-01-22 17:09:23 +00:00
:group 'rmail-summary)
(defun rmail-create-summary-line (msgnum)
"Return the summary line for message MSGNUM.
Obtain the message summary from the header if it is available
otherwise create it and store it in the message header.
The mbox buffer must be current when you call this function
even if its text is swapped."
(let ((beg (rmail-msgbeg msgnum))
(end (rmail-msgend msgnum))
(deleted (rmail-message-deleted-p msgnum))
;; Does not work (swapped?)
;;; (unseen (rmail-message-unseen-p msgnum))
unseen lines)
2009-01-22 17:09:23 +00:00
(save-excursion
;; Switch to the buffer that has the whole mbox text.
(if (rmail-buffers-swapped-p)
(set-buffer rmail-view-buffer))
;; Now we can compute the line count.
(if rmail-summary-line-count-flag
(setq lines (count-lines beg end)))
;; Narrow to the message header.
(save-excursion
(save-restriction
(widen)
(goto-char beg)
(if (search-forward "\n\n" end t)
(progn
(narrow-to-region beg (point))
;; Replace rmail-message-unseen-p from above.
(goto-char beg)
(setq unseen (and (search-forward
(concat rmail-attribute-header ": ") nil t)
(looking-at "......U")))
;; Generate a status line from the message.
(rmail-create-summary msgnum deleted unseen lines))
(rmail-error-bad-format msgnum)))))))
2009-01-22 17:09:23 +00:00
;; FIXME this is now unused.
;; The intention was to display in the summary something like {E}
;; for an edited messaged, similarly for answered, etc.
;; But that conflicts with the previous rmail usage, where
;; any user-defined { labels } occupied this space.
;; So whilst it would be nice to have this information in the summary,
;; it would need to go somewhere else.
(defun rmail-get-summary-status ()
"Return a coded string wrapped in curly braces denoting the status.
2009-01-22 17:09:23 +00:00
The current buffer must already be narrowed to the message headers for
the message being processed."
(let ((status (mail-fetch-field rmail-attribute-header))
(index 0)
(result "")
char)
;; Strip off the read/unread and the deleted attribute which are
;; handled separately.
(setq status
(if status
(concat (substring status 0 1) (substring status 2 6))
""))
(while (< index (length status))
(unless (string= "-" (setq char (substring status index (1+ index))))
(setq result (concat result char)))
(setq index (1+ index)))
(when (> (length result) 0)
(setq result (concat "{" result "}")))
result))
(autoload 'rmail-make-label "rmailkwd")
(defun rmail-get-summary-labels ()
"Return a string wrapped in curly braces with the current message labels.
Returns nil if there are no labels. The current buffer must
already be narrowed to the message headers for the message being
processed."
(let ((labels (mail-fetch-field rmail-keyword-header)))
(and labels
(not (string-equal labels ""))
(progn
;; Intern so that rmail-read-label can offer completion.
(mapc 'rmail-make-label (split-string labels ", "))
(format "{ %s } " labels)))))
2009-01-22 17:09:23 +00:00
(defun rmail-create-summary (msgnum deleted unseen lines)
"Return the summary line for message MSGNUM.
The current buffer should already be narrowed to the header for that message.
It could be either buffer, so don't access Rmail local variables.
DELETED is t if this message is marked deleted.
UNSEEN is t if it is marked unseen.
LINES is the number of lines in the message (if we should display that)
or else nil."
(goto-char (point-min))
(let ((line (rmail-header-summary))
(labels (rmail-get-summary-labels))
status prefix basic-start basic-end linecount-string)
2009-01-22 17:09:23 +00:00
(setq linecount-string
(cond
((not lines) " ")
((<= lines 9) (format " [%d]" lines))
((<= lines 99) (format " [%d]" lines))
((<= lines 999) (format " [%d]" lines))
((<= lines 9999) (format " [%dk]" (/ lines 1000)))
((<= lines 99999) (format " [%dk]" (/ lines 1000)))
(t (format "[%dk]" (/ lines 1000)))))
(setq status (cond
(deleted ?D)
(unseen ?-)
(t ? ))
prefix (format "%5d%c " msgnum status)
2009-01-22 17:09:23 +00:00
basic-start (car line)
basic-end (cadr line))
(funcall rmail-summary-line-decoder
(concat prefix basic-start linecount-string " "
labels basic-end))))
(defun rmail-header-summary ()
"Return a message summary based on the message headers.
The value is a list of two strings, the first and second parts of the summary.
The current buffer must already be narrowed to the message headers for
the message being processed."
(goto-char (point-min))
(list
(concat (save-excursion
(if (not (re-search-forward "^Date:" nil t))
" "
;; Match month names case-insensitively
(cond ((let ((case-fold-search t))
(re-search-forward "\\([^0-9:]\\)\\([0-3]?[0-9]\\)\\([- \t_]+\\)\\([adfjmnos][aceopu][bcglnprtvy]\\)"
(line-end-position) t))
2009-01-22 17:09:23 +00:00
(format "%2d-%3s"
(string-to-number (buffer-substring
(match-beginning 2)
(match-end 2)))
(buffer-substring
(match-beginning 4) (match-end 4))))
((let ((case-fold-search t))
(re-search-forward "\\([^a-z]\\)\\([adfjmnos][acepou][bcglnprtvy]\\)\\([-a-z \t_]*\\)\\([0-9][0-9]?\\)"
(line-end-position) t))
2009-01-22 17:09:23 +00:00
(format "%2d-%3s"
(string-to-number (buffer-substring
(match-beginning 4)
(match-end 4)))
(buffer-substring
(match-beginning 2) (match-end 2))))
((re-search-forward "\\(19\\|20\\)\\([0-9][0-9]\\)-\\([01][0-9]\\)-\\([0-3][0-9]\\)"
(line-end-position) t)
2009-01-22 17:09:23 +00:00
(format "%2s%2s%2s"
(buffer-substring
(match-beginning 2) (match-end 2))
(buffer-substring
(match-beginning 3) (match-end 3))
(buffer-substring
(match-beginning 4) (match-end 4))))
(t "??????"))))
" "
(save-excursion
(let* ((from (and (re-search-forward "^From:[ \t]*" nil t)
(mail-strip-quoted-names
(buffer-substring
(1- (point))
;; Get all the lines of the From field
;; so that we get a whole comment if there is one,
;; so that mail-strip-quoted-names can discard it.
(progn
2009-01-22 17:09:23 +00:00
(while (progn (forward-line 1)
(looking-at "[ \t]")))
;; Back up over newline, then trailing spaces or tabs
(forward-char -1)
(skip-chars-backward " \t")
(point))))))
len mch lo newline)
;; If there are multiple lines in FROM,
;; discard up to the last newline in it.
(while (and (stringp from)
Use string-search instead of string-match[-p] `string-search` is easier to understand, less error-prone, much faster, does not pollute the regexp cache, and does not mutate global state. Use it where applicable and obviously safe (erring on the conservative side). * admin/authors.el (authors-canonical-file-name) (authors-scan-change-log): * lisp/apropos.el (apropos-command) (apropos-documentation-property, apropos-symbols-internal): * lisp/arc-mode.el (archive-arc-summarize) (archive-zoo-summarize): * lisp/calc/calc-aent.el (math-read-factor): * lisp/calc/calc-ext.el (math-read-big-expr) (math-format-nice-expr, math-format-number-fancy): * lisp/calc/calc-forms.el (math-read-angle-brackets): * lisp/calc/calc-graph.el (calc-graph-set-range): * lisp/calc/calc-keypd.el (calc-keypad-press): * lisp/calc/calc-lang.el (tex, latex, math-read-big-rec): * lisp/calc/calc-prog.el (calc-fix-token-name) (calc-user-define-permanent, math-define-exp): * lisp/calc/calc.el (calc-record, calcDigit-key) (calc-count-lines): * lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots) (math-do-integral): * lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum) (calc-get-fit-variables): * lisp/cedet/ede/speedbar.el (ede-tag-expand): * lisp/cedet/semantic/java.el (semantic-java-expand-tag): * lisp/cedet/semantic/sb.el (semantic-sb-show-extra) (semantic-sb-expand-group): * lisp/cedet/semantic/wisent/python.el (semantic-python-instance-variable-p): * lisp/cus-edit.el (get): * lisp/descr-text.el (describe-text-sexp): * lisp/dired-aux.el (dired-compress-file): * lisp/dired-x.el (dired-make-relative-symlink): * lisp/dired.el (dired-glob-regexp): * lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename): * lisp/edmacro.el (edmacro-format-keys): * lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand): * lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand): * lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list): * lisp/emacs-lisp/warnings.el (display-warning): * lisp/emulation/viper-ex.el (viper-ex-read-file-name) (ex-print-display-lines): * lisp/env.el (read-envvar-name, setenv): * lisp/epa-mail.el (epa-mail-encrypt): * lisp/epg.el (epg--start): * lisp/erc/erc-backend.el (erc-parse-server-response): * lisp/erc/erc-dcc.el (erc-dcc-member): * lisp/erc/erc-speedbar.el (erc-speedbar-expand-server) (erc-speedbar-expand-channel, erc-speedbar-expand-user): * lisp/erc/erc.el (erc-send-input): * lisp/eshell/em-glob.el (eshell-glob-entries): * lisp/eshell/esh-proc.el (eshell-needs-pipe-p): * lisp/eshell/esh-util.el (eshell-convert): * lisp/eshell/esh-var.el (eshell-envvar-names): * lisp/faces.el (x-resolve-font-name): * lisp/ffap.el (ffap-file-at-point): * lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern): * lisp/forms.el (forms--update): * lisp/frameset.el (frameset-filter-unshelve-param): * lisp/gnus/gnus-art.el (article-decode-charset): * lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file): * lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy): * lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc) (gnus-inews-insert-gcc): * lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body): * lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output) (gnus-search--complete-key-data): * lisp/gnus/gnus-spec.el (gnus-parse-simple-format): * lisp/gnus/gnus-sum.el (gnus-summary-refer-article): * lisp/gnus/gnus-util.el (gnus-extract-address-components) (gnus-newsgroup-directory-form): * lisp/gnus/gnus-uu.el (gnus-uu-grab-view): * lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name): * lisp/gnus/message.el (message-check-news-header-syntax) (message-make-message-id, message-user-mail-address) (message-make-fqdn, message-get-reply-headers, message-followup): * lisp/gnus/mm-decode.el (mm-dissect-buffer): * lisp/gnus/nnheader.el (nnheader-insert): * lisp/gnus/nnimap.el (nnimap-process-quirk) (nnimap-imap-ranges-to-gnus-ranges): * lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix): * lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path): * lisp/gnus/nnrss.el (nnrss-match-macro): * lisp/gnus/nntp.el (nntp-find-group-and-number): * lisp/help-fns.el (help--symbol-completion-table-affixation): * lisp/help.el (help-function-arglist): * lisp/hippie-exp.el (he-concat-directory-file-name): * lisp/htmlfontify.el (hfy-relstub): * lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word) (ido-exhibit): * lisp/image/image-converter.el (image-convert-p): * lisp/info-xref.el (info-xref-docstrings): * lisp/info.el (Info-toc-build, Info-follow-reference) (Info-backward-node, Info-finder-find-node) (Info-speedbar-expand-node): * lisp/international/mule-diag.el (print-fontset-element): * lisp/language/korea-util.el (default-korean-keyboard): * lisp/linum.el (linum-after-change): * lisp/mail/ietf-drums.el (ietf-drums-parse-address): * lisp/mail/mail-utils.el (mail-dont-reply-to): * lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string): * lisp/mail/rfc2231.el (rfc2231-parse-string): * lisp/mail/rmailkwd.el (rmail-set-label): * lisp/mail/rmailsum.el (rmail-header-summary): * lisp/mail/smtpmail.el (smtpmail-maybe-append-domain) (smtpmail-user-mail-address): * lisp/mail/uce.el (uce-reply-to-uce): * lisp/man.el (Man-default-man-entry): * lisp/mh-e/mh-alias.el (mh-alias-gecos-name) (mh-alias-minibuffer-confirm-address): * lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject): * lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output): * lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter) (mh-folder-completion-function): * lisp/minibuffer.el (completion--make-envvar-table) (completion-file-name-table, completion-flex-try-completion) (completion-flex-all-completions): * lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p) (mpc-constraints-tag-lookup): * lisp/net/ange-ftp.el (ange-ftp-send-cmd) (ange-ftp-allow-child-lookup): * lisp/net/mailcap.el (mailcap-mime-types): * lisp/net/mairix.el (mairix-search-thread-this-article): * lisp/net/pop3.el (pop3-open-server): * lisp/net/soap-client.el (soap-decode-xs-complex-type): * lisp/net/socks.el (socks-filter): * lisp/nxml/nxml-outln.el (nxml-highlighted-qname): * lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype): * lisp/nxml/rng-uri.el (rng-uri-file-name-1): * lisp/obsolete/complete.el (partial-completion-mode) (PC-do-completion): * lisp/obsolete/longlines.el (longlines-encode-string): * lisp/obsolete/nnir.el (nnir-compose-result): * lisp/obsolete/terminal.el (te-quote-arg-for-sh): * lisp/obsolete/tpu-edt.el (tpu-check-search-case): * lisp/obsolete/url-ns.el (isPlainHostName): * lisp/pcmpl-unix.el (pcomplete/scp): * lisp/play/dunnet.el (dun-listify-string2, dun-get-path) (dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface): * lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment): * lisp/progmodes/gdb-mi.el (gdb-var-delete) (gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result): * lisp/progmodes/gud.el (gud-find-expr): * lisp/progmodes/idlw-help.el (idlwave-do-context-help1): * lisp/progmodes/idlw-shell.el (idlwave-shell-mode) (idlwave-shell-filter-hidden-output, idlwave-shell-filter): * lisp/progmodes/idlwave.el (idlwave-skip-label-or-case) (idlwave-routine-info): * lisp/progmodes/octave.el (inferior-octave-completion-at-point): * lisp/progmodes/sh-script.el (sh-add-completer): * lisp/progmodes/sql.el (defun): * lisp/progmodes/xscheme.el (xscheme-process-filter): * lisp/replace.el (query-replace-compile-replacement) (map-query-replace-regexp): * lisp/shell.el (shell--command-completion-data) (shell-environment-variable-completion): * lisp/simple.el (display-message-or-buffer): * lisp/speedbar.el (speedbar-dired, speedbar-tag-file) (speedbar-tag-expand): * lisp/subr.el (split-string-and-unquote): * lisp/tar-mode.el (tar-extract): * lisp/term.el (term-command-hook, serial-read-name): * lisp/textmodes/bibtex.el (bibtex-print-help-message): * lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter) (ispell-parse-output, ispell-buffer-local-parsing): * lisp/textmodes/reftex-cite.el (reftex-do-citation): * lisp/textmodes/reftex-parse.el (reftex-notice-new): * lisp/textmodes/reftex-ref.el (reftex-show-entry): * lisp/textmodes/reftex.el (reftex-compile-variables): * lisp/textmodes/tex-mode.el (tex-send-command) (tex-start-tex, tex-append): * lisp/thingatpt.el (thing-at-point-url-at-point): * lisp/tmm.el (tmm-add-one-shortcut): * lisp/transient.el (transient-format-key): * lisp/url/url-auth.el (url-basic-auth) (url-digest-auth-directory-id-assoc): * lisp/url/url-news.el (url-news): * lisp/url/url-util.el (url-parse-query-string): * lisp/vc/vc-cvs.el (vc-cvs-parse-entry): * lisp/wid-browse.el (widget-browse-sexp): * lisp/woman.el (woman-parse-colon-path, woman-mini-help) (WoMan-getpage-in-background, woman-negative-vertical-space): * lisp/xml.el: * test/lisp/emacs-lisp/check-declare-tests.el (check-declare-tests-warn): * test/lisp/files-tests.el (files-tests-file-name-non-special-dired-compress-handler): * test/lisp/net/network-stream-tests.el (server-process-filter): * test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode): Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 09:20:00 +00:00
(setq newline (string-search "\n" from)))
(setq from (substring from (1+ newline))))
2009-01-22 17:09:23 +00:00
(if (or (null from)
(string-match
(or rmail-user-mail-address-regexp
(concat "^\\("
(regexp-quote (user-login-name))
"\\($\\|@\\)\\|"
(regexp-quote user-mail-address)
2009-01-22 17:09:23 +00:00
"\\>\\)"))
from))
;; No From field, or it's this user.
(save-excursion
(goto-char (point-min))
(if (not (re-search-forward "^To:[ \t]*" nil t))
nil
(setq from
(concat "to: "
(mail-strip-quoted-names
(buffer-substring
(point)
(progn (end-of-line)
(skip-chars-backward " \t")
(point)))))))))
(if (null from)
" "
;; We are going to return only 25 characters of the
;; address, so make sure it is RFC2047 decoded before
;; taking its substring. This is important when the address is not on the same line as the name, e.g.:
;; To: =?UTF-8?Q?=C5=A0t=C4=9Bp=C3=A1n_?= =?UTF-8?Q?N=C4=9Bmec?=
;; <stepnem@gmail.com>
(setq from (rfc2047-decode-string from))
;; We cannot tolerate any leftover newlines in From,
;; as that disrupts the rmail-summary display.
;; Newlines can be left in From if it was malformed,
;; e.g. had unbalanced quotes.
(setq from (replace-regexp-in-string "\n+" " " from))
2009-01-22 17:09:23 +00:00
(setq len (length from))
(setq mch (string-match "[@%]" from))
(format "%25s"
(if (or (not mch) (<= len 25))
(substring from (max 0 (- len 25)))
(substring from
(setq lo (cond ((< (- mch 14) 0) 0)
((< len (+ mch 11))
(- len 25))
(t (- mch 14))))
(min len (+ lo 25)))))))))
(concat (if (re-search-forward "^Subject:" nil t)
2010-11-26 04:06:59 +00:00
(let (pos str)
(skip-chars-forward " \t")
(setq pos (point))
(forward-line 1)
(setq str (buffer-substring pos (1- (point))))
(while (looking-at "[ \t]")
(setq str (concat str " "
2010-11-26 04:06:59 +00:00
(buffer-substring (match-end 0)
(line-end-position))))
(forward-line 1))
str)
2009-01-22 17:09:23 +00:00
(re-search-forward "[\n][\n]+" nil t)
(buffer-substring (point) (progn (end-of-line) (point))))
"\n")))
;; Simple motion in a summary buffer.
(defun rmail-summary-next-all (&optional number)
(interactive "p")
(or number (setq number 1))
(forward-line number)
2009-01-22 17:09:23 +00:00
;; It doesn't look nice to move forward past the last message line.
(and (eobp) (> number 0)
(forward-line -1))
(display-buffer rmail-buffer))
(defun rmail-summary-previous-all (&optional number)
(interactive "p")
(rmail-summary-next-all (- (or number 1))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-next-msg (&optional number)
"Display next non-deleted msg from rmail file.
With optional prefix argument NUMBER, moves forward this number of non-deleted
messages, or backward if NUMBER is negative."
(interactive "p")
(or number (setq number 1))
2009-01-22 17:09:23 +00:00
(forward-line 0)
(and (> number 0) (end-of-line))
(let ((count (if (< number 0) (- number) number))
(search (if (> number 0) 're-search-forward 're-search-backward))
(non-del-msg-found nil))
(while (and (> count 0) (setq non-del-msg-found
(or (funcall search "^.....[^D]" nil t)
non-del-msg-found)))
(setq count (1- count))))
(beginning-of-line)
(display-buffer rmail-buffer))
(defun rmail-summary-previous-msg (&optional number)
"Display previous non-deleted msg from rmail file.
With optional prefix argument NUMBER, moves backward this number of
non-deleted messages."
(interactive "p")
(rmail-summary-next-msg (- (or number 1))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-next-labeled-message (n labels)
"Show next message with LABELS. Defaults to last labels used.
With prefix argument N moves forward N messages with these labels."
(interactive "p\nsMove to next msg with labels: ")
(let (msg)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-next-labeled-message n labels)
(setq msg rmail-current-message))
(rmail-summary-goto-msg msg)))
(defun rmail-summary-previous-labeled-message (n labels)
"Show previous message with LABELS. Defaults to last labels used.
With prefix argument N moves backward N messages with these labels."
(interactive "p\nsMove to previous msg with labels: ")
(let (msg)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-previous-labeled-message n labels)
(setq msg rmail-current-message))
(rmail-summary-goto-msg msg)))
(defun rmail-summary-next-same-subject (n)
"Go to the next message in the summary having the same subject.
With prefix argument N, do this N times.
If N is negative, go backwards."
(interactive "p")
(let ((forward (> n 0))
subject i found)
(with-current-buffer rmail-buffer
(setq subject (rmail-simplified-subject)
i rmail-current-message))
(save-excursion
(while (and (/= n 0)
(if forward
(not (eobp))
(not (bobp))))
(let (done)
(while (and (not done)
(if forward
(not (eobp))
(not (bobp))))
;; Advance thru summary.
(forward-line (if forward 1 -1))
;; Get msg number of this line.
(setq i (string-to-number
(buffer-substring (point)
(min (point-max) (+ 6 (point))))))
(setq done (string-equal subject (rmail-simplified-subject i))))
(if done (setq found i)))
(setq n (if forward (1- n) (1+ n)))))
(if found
(rmail-summary-goto-msg found)
(error "No %s message with same subject"
(if forward "following" "previous")))))
(defun rmail-summary-previous-same-subject (n)
"Go to the previous message in the summary having the same subject.
With prefix argument N, do this N times.
If N is negative, go forwards instead."
(interactive "p")
(rmail-summary-next-same-subject (- n)))
;; Delete and undelete summary commands.
(defun rmail-summary-delete-forward (&optional count)
"Delete this message and move to next nondeleted one.
Deleted messages stay in the file until the \\[rmail-expunge] command is given.
A prefix argument serves as a repeat count;
a negative argument means to delete and move backward."
(interactive "p")
(unless (numberp count) (setq count 1))
(let (del-msg
(backward (< count 0)))
(while (/= count 0)
;; Don't waste time counting down without doing anything if we
;; are at the beginning and trying to go backward.
(if (and backward (bobp))
(setq count -1))
2009-01-22 17:09:23 +00:00
(rmail-summary-goto-msg)
(with-current-buffer rmail-buffer
(setq del-msg rmail-current-message)
(rmail-delete-message))
2009-01-22 17:09:23 +00:00
(rmail-summary-mark-deleted del-msg)
(while (and (not (if backward (bobp) (eobp)))
(save-excursion (beginning-of-line)
(looking-at " *[0-9]+D")))
(forward-line (if backward -1 1)))
(setq count
(if (> count 0) (1- count) (1+ count)))
2009-01-22 17:09:23 +00:00
;; It looks ugly to move to the empty line at end of buffer.
;; And don't waste time after hitting the end.
2009-01-22 17:09:23 +00:00
(and (eobp) (not backward)
(progn (setq count 0)
(forward-line -1))))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-delete-backward (&optional count)
"Delete this message and move to previous nondeleted one.
Deleted messages stay in the file until the \\[rmail-expunge] command is given.
A prefix argument serves as a repeat count;
a negative argument means to delete and move forward."
(interactive "p")
(rmail-summary-delete-forward (- count)))
(defun rmail-summary-mark-deleted (&optional n undel)
(and n (not (eq n (rmail-summary-msg-number)))
;; Since third arg is t, this only alters summary, not the Rmail buf.
(rmail-summary-goto-msg n t t))
2009-01-22 17:09:23 +00:00
(or (eobp)
(not (overlay-get rmail-summary-overlay 'face))
(let ((buffer-read-only nil))
(skip-chars-forward " ")
(skip-chars-forward "0-9")
2009-01-22 17:09:23 +00:00
(if undel
(if (looking-at "D")
(progn (delete-char 1) (insert " ")))
(delete-char 1)
(insert "D"))
;; Discard cached new summary line.
(when n
(with-current-buffer rmail-buffer
(aset rmail-summary-vector (1- n) nil)))))
2009-01-22 17:09:23 +00:00
(beginning-of-line))
(defun rmail-summary-update-line (n)
"Update the summary line for message N."
(when (rmail-summary-goto-msg n t t)
(let* ((buffer-read-only nil)
(start (line-beginning-position))
(end (line-beginning-position 2))
(overlays (overlays-in start end))
high ov)
(while (and (setq ov (car overlays))
(not (setq high (overlay-get ov 'rmail-summary))))
(setq overlays (cdr overlays)))
(delete-region start end)
(princ
(with-current-buffer rmail-buffer
(aset rmail-summary-vector (1- n) (rmail-create-summary-line n)))
(current-buffer))
(when high
(forward-line -1)
(rmail-summary-update-highlight nil)))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-mark-undeleted (n)
(rmail-summary-mark-deleted n t))
(defun rmail-summary-deleted-p (&optional n)
(save-excursion
(and n (rmail-summary-goto-msg n nil t))
(skip-chars-forward " ")
(skip-chars-forward "0-9")
2009-01-22 17:09:23 +00:00
(looking-at "D")))
(defun rmail-summary-undelete (&optional arg)
"Undelete current message.
Optional prefix ARG means undelete ARG previous messages."
(interactive "p")
(if (/= arg 1)
(rmail-summary-undelete-many arg)
(let ((buffer-read-only nil)
(opoint (point)))
(end-of-line)
(cond ((re-search-backward "\\(^ *[0-9]*\\)\\(D\\)" nil t)
(replace-match "\\1 ")
(rmail-summary-goto-msg)
(if rmail-enable-mime
(set-buffer rmail-buffer)
(rmail-pop-to-buffer rmail-buffer))
2009-01-22 17:09:23 +00:00
(and (rmail-message-deleted-p rmail-current-message)
(rmail-undelete-previous-message 1))
2009-01-22 17:09:23 +00:00
(if rmail-enable-mime
(rmail-pop-to-buffer rmail-buffer))
(rmail-pop-to-buffer rmail-summary-buffer))
2009-01-22 17:09:23 +00:00
(t (goto-char opoint))))))
(defun rmail-summary-undelete-many (&optional n)
"Undelete all deleted msgs, optional prefix arg N means undelete N prev msgs."
(interactive "P")
(if n
(while (and (> n 0) (not (eobp)))
(rmail-summary-goto-msg)
(let (del-msg)
(when (rmail-summary-deleted-p)
(with-current-buffer rmail-buffer
(rmail-undelete-previous-message 1)
(setq del-msg rmail-current-message))
(rmail-summary-mark-undeleted del-msg)))
(while (and (not (eobp))
(save-excursion (beginning-of-line)
(looking-at " *[0-9]+ ")))
(forward-line 1))
(setq n (1- n)))
(rmail-summary-goto-msg 1)
(dotimes (_ rmail-total-messages)
(rmail-summary-goto-msg)
(let (del-msg)
(when (rmail-summary-deleted-p)
(with-current-buffer rmail-buffer
(rmail-undelete-previous-message 1)
(setq del-msg rmail-current-message))
(rmail-summary-mark-undeleted del-msg)))
(if (not (eobp))
(forward-line 1))))
;; It looks ugly to move to the empty line at end of buffer.
(and (eobp)
(forward-line -1)))
2009-01-22 17:09:23 +00:00
;; Rmail Summary mode is suitable only for specially formatted data.
(put 'rmail-summary-mode 'mode-class 'special)
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(define-derived-mode rmail-summary-mode special-mode "RMAIL Summary"
2009-01-22 17:09:23 +00:00
"Rmail Summary Mode is invoked from Rmail Mode by using \\<rmail-mode-map>\\[rmail-summary].
As commands are issued in the summary buffer, they are applied to the
corresponding mail messages in the rmail buffer.
All normal editing commands are turned off.
Instead, nearly all the Rmail mode commands are available,
though many of them move only among the messages in the summary.
These additional commands exist:
\\[rmail-summary-undelete-many] Undelete all or prefix arg deleted messages.
\\[rmail-summary-wipe] Delete the summary and go to the Rmail buffer.
Commands for sorting the summary:
\\[rmail-summary-sort-by-date] Sort by date.
\\[rmail-summary-sort-by-subject] Sort by subject.
\\[rmail-summary-sort-by-author] Sort by author.
\\[rmail-summary-sort-by-recipient] Sort by recipient.
\\[rmail-summary-sort-by-correspondent] Sort by correspondent.
\\[rmail-summary-sort-by-lines] Sort by lines.
\\[rmail-summary-sort-by-labels] Sort by labels."
(setq truncate-lines t)
(setq buffer-read-only t)
(set-syntax-table text-mode-syntax-table)
(make-local-variable 'rmail-buffer)
(make-local-variable 'rmail-total-messages)
(setq-local rmail-current-message nil)
(setq-local rmail-summary-redo nil)
2009-01-22 17:09:23 +00:00
(make-local-variable 'revert-buffer-function)
(setq-local font-lock-defaults '(rmail-summary-font-lock-keywords t))
Use define-derived-mode (and derived-mode-p). * lisp/play/snake.el (snake-mode): * lisp/play/mpuz.el (mpuz-mode): * lisp/play/landmark.el (lm-mode): * lisp/play/blackbox.el (blackbox-mode): * lisp/play/5x5.el (5x5-mode): * lisp/obsolete/options.el (Edit-options-mode): * lisp/net/quickurl.el (quickurl-list-mode): * lisp/net/newst-treeview.el (newsticker-treeview-mode): * lisp/mail/rmailsum.el (rmail-summary-mode): * lisp/mail/mspools.el (mspools-mode): * lisp/locate.el (locate-mode): * lisp/ibuffer.el (ibuffer-mode): * lisp/emulation/ws-mode.el (wordstar-mode): * lisp/emacs-lisp/debug.el (debugger-mode): * lisp/array.el (array-mode): * lisp/net/eudc.el (eudc-mode): Use define-derived-mode. * lisp/net/mairix.el (mairix-searches-mode-font-lock-keywords): Move initialization into declaration. (mairix-searches-mode): Use define-derived-mode. * lisp/net/eudc-hotlist.el (eudc-hotlist-mode): Use define-derived-mode. (eudc-edit-hotlist): Use dolist. * lisp/man.el (Man-mode-syntax-table): Rename from man-mode-syntax-table. (Man-mode): Use define-derived-mode. * lisp/info.el (Info-edit-mode-map): Rename from Info-edit-map. (Info-edit-mode): Use define-derived-mode. (Info-cease-edit): Use Info-mode. * lisp/eshell/esh-mode.el (eshell-mode-syntax-table): Move initialization into declaration. (eshell-mode): Use define-derived-mode. * lisp/chistory.el (command-history-mode-map): Rename from command-history-map. (command-history-mode): Use define-derived-mode. * lisp/calc/calc.el (calc-trail-mode-map): New var. (calc-trail-mode): Use define-derived-mode. (calc-trail-buffer): Set calc-main-buffer manually. * lisp/bookmark.el (bookmark-insert-annotation): New function. (bookmark-edit-annotation): Use it. (bookmark-edit-annotation-mode): Make it a proper major mode. (bookmark-send-edited-annotation): Use derived-mode-p. * lisp/arc-mode.el (archive-mode): Move kill-all-local-variables a tiny bit closer to its ideal place. Use \' to match EOS. * lisp/cedet/semantic/grammar.el (semantic-grammar-mode): Use define-derived-mode. (semantic-grammar-mode-syntax-table): Rename from semantic-grammar-syntax-table. (semantic-grammar-mode-map): Rename from semantic-grammar-map. * lisp/cedet/data-debug.el (data-debug-mode-map): Rename from data-debug-map. (data-debug-mode): Use define-derived-mode. * lisp/gnus/score-mode.el (gnus-score-mode-map): Move initialization into declaration. (gnus-score-mode): Use define-derived-mode. * lisp/gnus/gnus-srvr.el (gnus-browse-mode): Use define-derived-mode. * lisp/gnus/gnus-kill.el (gnus-kill-file-mode-map): Move initialization into declaration. (gnus-kill-file-mode): Use define-derived-mode. (gnus-kill-file-edit-file, gnus-kill-file-enter-kill, gnus-kill): Use derived-mode-p. * lisp/gnus/gnus-group.el (gnus-group-mode): Use define-derived-mode. (gnus-group-setup-buffer, gnus-group-name-at-point) (gnus-group-make-web-group, gnus-group-enter-directory) (gnus-group-suspend): Use derived-mode-p. * lisp/gnus/gnus-cus.el (gnus-custom-mode): Use define-derived-mode. * lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode): Use define-derived-mode. * lisp/gnus/gnus-art.el (gnus-article-mode): Use define-derived-mode. (gnus-article-setup-buffer, gnus-article-prepare) (gnus-article-prepare-display, gnus-sticky-article) (gnus-kill-sticky-article-buffer, gnus-kill-sticky-article-buffers) (gnus-bind-safe-url-regexp, gnus-article-check-buffer) (gnus-article-read-summary-keys): Use derived-mode-p.
2013-09-11 03:31:56 +00:00
(rmail-summary-enable))
2009-01-22 17:09:23 +00:00
;; Summary features need to be disabled during edit mode.
(defun rmail-summary-disable ()
(use-local-map text-mode-map)
(remove-hook 'post-command-hook 'rmail-summary-rmail-update t)
(setq revert-buffer-function nil))
(defun rmail-summary-enable ()
(use-local-map rmail-summary-mode-map)
(add-hook 'post-command-hook 'rmail-summary-rmail-update nil t)
(setq revert-buffer-function 'rmail-update-summary))
(defun rmail-summary-mark-seen (n &optional nomove unseen)
"Remove the unseen mark from the current message, update the summary vector.
N is the number of the current message. Optional argument NOMOVE
non-nil means we are already at the right column. Optional argument
UNSEEN non-nil means mark the message as unseen."
(save-excursion
(unless nomove
(beginning-of-line)
(skip-chars-forward " ")
(skip-chars-forward "0-9"))
(when (char-equal (following-char) (if unseen ?\s ?-))
(let ((buffer-read-only nil))
(delete-char 1)
(insert (if unseen "-" " ")))
(let ((line (buffer-substring-no-properties (line-beginning-position)
(line-beginning-position 2))))
(with-current-buffer rmail-buffer
(aset rmail-summary-vector (1- n) line))))))
2009-01-22 17:09:23 +00:00
(defvar rmail-summary-put-back-unseen nil
"Used for communicating between calls to `rmail-summary-rmail-update'.
If it moves to a message within an Incremental Search, and removes
the `unseen' attribute from that message, it sets this flag
so that if the next motion between messages is in the same Incremental
Search, the `unseen' attribute is restored.")
;; Show in Rmail the message described by the summary line that point is on,
;; but only if the Rmail buffer is already visible.
;; This is a post-command-hook in summary buffers.
(defun rmail-summary-rmail-update ()
(let (buffer-read-only)
(save-excursion
;; If at end of buffer, pretend we are on the last text line.
(if (eobp)
(forward-line -1))
(beginning-of-line)
(skip-chars-forward " ")
;; If the summary is empty, don't do anything.
(unless (eobp)
(let ((msg-num (string-to-number (buffer-substring
(point)
(progn (skip-chars-forward "0-9")
(point))))))
;; Always leave `unseen' removed
;; if we get out of isearch mode.
;; Don't let a subsequent isearch restore that `unseen'.
(if (not isearch-mode)
(setq rmail-summary-put-back-unseen nil))
(or (eq rmail-current-message msg-num)
(let ((window (get-buffer-window rmail-buffer t))
(owin (selected-window)))
(if isearch-mode
(progn
;; If we first saw the previous message in this search,
;; and we have gone to a different message while searching,
;; put back `unseen' on the former one.
(when rmail-summary-put-back-unseen
(rmail-set-attribute rmail-unseen-attr-index t
rmail-current-message)
(save-excursion
(goto-char rmail-summary-put-back-unseen)
(rmail-summary-mark-seen rmail-current-message t t)))
;; Arrange to do that later, for the new current message,
;; if it still has `unseen'.
(setq rmail-summary-put-back-unseen
(if (rmail-message-unseen-p msg-num)
(point))))
(setq rmail-summary-put-back-unseen nil))
;; Go to the desired message.
(setq rmail-current-message msg-num)
;; Update the summary to show the message has been seen.
(rmail-summary-mark-seen msg-num t)
(if window
;; Using save-window-excursion would cause the new value
;; of point to get lost.
(unwind-protect
(progn
(select-window window)
(rmail-show-message msg-num t))
(select-window owin))
(if (buffer-name rmail-buffer)
(with-current-buffer rmail-buffer
(rmail-show-message msg-num t))))
;; In linum mode, the message buffer must be specially
;; updated (Bug#4878).
(and (fboundp 'linum-update)
(buffer-name rmail-buffer)
(linum-update rmail-buffer))))
(rmail-summary-update-highlight nil))))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-save-buffer ()
"Save the buffer associated with this RMAIL summary."
(interactive)
(save-window-excursion
(save-excursion
(switch-to-buffer rmail-buffer)
(save-buffer))))
(defun rmail-summary-mouse-goto-message (event)
"Select the message whose summary line you click on."
(interactive "@e")
(goto-char (posn-point (event-end event)))
(rmail-summary-goto-msg))
(defun rmail-summary-msg-number ()
(save-excursion
(beginning-of-line)
(string-to-number
(buffer-substring (point)
(min (point-max) (+ 6 (point)))))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-goto-msg (&optional n nowarn skip-rmail)
"Go to message N in the summary buffer and the Rmail buffer.
If N is nil, use the message corresponding to point in the summary
and move to that message in the Rmail buffer.
If NOWARN, don't say anything if N is out of range.
If SKIP-RMAIL, don't do anything to the Rmail buffer.
Returns non-nil if message N was found."
2009-01-22 17:09:23 +00:00
(interactive "P")
(if (consp n) (setq n (prefix-numeric-value n)))
(if (eobp) (forward-line -1))
(beginning-of-line)
(let* ((obuf (current-buffer))
(buf rmail-buffer)
(cur (point))
message-not-found
(curmsg (string-to-number
(buffer-substring (point)
(min (point-max) (+ 6 (point))))))
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(total (with-current-buffer buf rmail-total-messages)))
;; CURMSG should be nil when there's no current summary message
;; (for instance, if the summary is empty).
(if (= curmsg 0)
(setq curmsg nil))
2009-01-22 17:09:23 +00:00
;; If message number N was specified, find that message's line
;; or set message-not-found.
;; If N wasn't specified or that message can't be found.
;; set N by default.
(if (not n)
(setq n curmsg)
(if (< n 1)
(progn (message "No preceding message")
(setq n 1)))
(if (and (> n total)
(> total 0))
(progn (message "No following message")
(goto-char (point-max))
(rmail-summary-goto-msg nil nowarn skip-rmail)))
(goto-char (point-min))
(if (not (re-search-forward (format "^%5d[^0-9]" n) nil t))
(progn (or nowarn (message "Message %d not found" n))
(setq n curmsg)
(setq message-not-found t)
(goto-char cur))))
;; N can be nil now, along with CURMSG,
;; if the summary is empty.
(when n
(rmail-summary-mark-seen n)
(rmail-summary-update-highlight message-not-found)
(beginning-of-line)
(unless skip-rmail
(let ((selwin (selected-window)))
(unwind-protect
(progn (rmail-pop-to-buffer buf)
(rmail-show-message n))
(select-window selwin)
;; The actions above can alter the current buffer. Preserve it.
(set-buffer obuf)))))
(not message-not-found)))
2009-01-22 17:09:23 +00:00
;; Update the highlighted line in an rmail summary buffer.
;; That should be current. We highlight the line point is on.
;; If NOT-FOUND is non-nil, we turn off highlighting.
(defun rmail-summary-update-highlight (not-found)
;; Make sure we have an overlay to use.
(or rmail-summary-overlay
(progn
(setq-local rmail-summary-overlay (make-overlay (point) (point)))
(overlay-put rmail-summary-overlay 'rmail-summary t)))
2009-01-22 17:09:23 +00:00
;; If this message is in the summary, use the overlay to highlight it.
;; Otherwise, don't highlight anything.
(if not-found
(overlay-put rmail-summary-overlay 'face nil)
(move-overlay rmail-summary-overlay
(save-excursion (beginning-of-line)
(skip-chars-forward " ")
(point))
(line-end-position))
2009-01-22 17:09:23 +00:00
(overlay-put rmail-summary-overlay 'face 'highlight)))
(defun rmail-summary-scroll-msg-up (&optional dist)
"Scroll the Rmail window forward.
If the Rmail window is displaying the end of a message,
advance to the next message."
(interactive "P")
(if (eq dist '-)
(rmail-summary-scroll-msg-down nil)
(let ((rmail-buffer-window (get-buffer-window rmail-buffer)))
(if rmail-buffer-window
(if (let ((rmail-summary-window (selected-window)))
(select-window rmail-buffer-window)
(prog1
;; Is EOB visible in the buffer?
(pos-visible-in-window-p (point-max))
2009-01-22 17:09:23 +00:00
(select-window rmail-summary-window)))
(if (not rmail-summary-scroll-between-messages)
(error "End of buffer")
(rmail-summary-next-msg (or dist 1)))
(let ((other-window-scroll-buffer rmail-buffer))
(scroll-other-window dist)))
;; If it isn't visible at all, show the beginning.
(rmail-summary-beginning-of-message)))))
(defun rmail-summary-scroll-msg-down (&optional dist)
"Scroll the Rmail window backward.
If the Rmail window is now displaying the beginning of a message,
move to the previous message."
(interactive "P")
(if (eq dist '-)
(rmail-summary-scroll-msg-up nil)
(let ((rmail-buffer-window (get-buffer-window rmail-buffer)))
(if rmail-buffer-window
(if (let ((rmail-summary-window (selected-window)))
(select-window rmail-buffer-window)
(prog1
;; Is BOB visible in the buffer?
(pos-visible-in-window-p (point-min))
2009-01-22 17:09:23 +00:00
(select-window rmail-summary-window)))
(if (not rmail-summary-scroll-between-messages)
(error "Beginning of buffer")
(rmail-summary-previous-msg (or dist 1)))
(let ((other-window-scroll-buffer rmail-buffer))
(scroll-other-window-down dist)))
;; If it isn't visible at all, show the beginning.
(rmail-summary-beginning-of-message)))))
(defun rmail-summary-beginning-of-message ()
"Show current message from the beginning."
(interactive)
(rmail-summary-show-message 'BEG))
(defun rmail-summary-end-of-message ()
"Show bottom of current message."
(interactive)
(rmail-summary-show-message 'END))
(defun rmail-summary-show-message (where)
"Show current mail message.
lisp/*.el: Fix typos and other trivial doc fixes * lisp/allout-widgets.el (allout-widgets-auto-activation) (allout-current-decorated-p): * lisp/auth-source.el (auth-source-protocols): * lisp/autorevert.el (auto-revert-set-timer): * lisp/battery.el (battery-mode-line-limit): * lisp/calc/calcalg3.el (math-map-binop): * lisp/calendar/cal-dst.el (calendar-dst-find-startend): * lisp/calendar/cal-mayan.el (calendar-mayan-long-count-to-absolute): * lisp/calendar/calendar.el (calendar-date-echo-text) (calendar-generate-month, calendar-string-spread) (calendar-cursor-to-date, calendar-read, calendar-read-date) (calendar-mark-visible-date, calendar-dayname-on-or-before): * lisp/calendar/diary-lib.el (diary-ordinal-suffix): * lisp/cedet/ede/autoconf-edit.el (autoconf-new-program) (autoconf-find-last-macro, autoconf-parameter-strip): * lisp/cedet/ede/config.el (ede-target-with-config-build): * lisp/cedet/ede/linux.el (ede-linux--detect-architecture) (ede-linux--get-architecture): * lisp/cedet/semantic/complete.el (semantic-collector-calculate-cache) (semantic-displayer-abstract, semantic-displayer-point-position): * lisp/cedet/semantic/format.el (semantic-format-face-alist) (semantic-format-tag-short-doc): * lisp/cedet/semantic/fw.el (semantic-find-file-noselect): * lisp/cedet/semantic/idle.el (semantic-idle-scheduler-work-idle-time) (semantic-idle-breadcrumbs-display-function) (semantic-idle-breadcrumbs-format-tag-list-function): * lisp/cedet/semantic/lex.el (semantic-lex-map-types) (define-lex, define-lex-block-type-analyzer): * lisp/cedet/semantic/senator.el (senator-search-default-tag-filter): * lisp/cedet/semantic/symref.el (semantic-symref-result) (semantic-symref-hit-to-tag-via-db): * lisp/cedet/semantic/symref.el (semantic-symref-tool-baseclass): * lisp/cedet/semantic/tag.el (semantic-tag-new-variable) (semantic-tag-new-include, semantic-tag-new-package) (semantic-tag-set-faux, semantic-create-tag-proxy) (semantic-tag-function-parent) (semantic-tag-components-with-overlays): * lisp/cedet/srecode/cpp.el (srecode-cpp-namespaces) (srecode-semantic-handle-:c, srecode-semantic-apply-tag-to-dict): * lisp/cedet/srecode/dictionary.el (srecode-create-dictionary) (srecode-dictionary-add-entries, srecode-dictionary-lookup-name) (srecode-create-dictionaries-from-tags): * lisp/cmuscheme.el (scheme-compile-region): * lisp/color.el (color-lab-to-lch): * lisp/doc-view.el (doc-view-image-width) (doc-view-set-up-single-converter): * lisp/dynamic-setting.el (font-setting-change-default-font) (dynamic-setting-handle-config-changed-event): * lisp/elec-pair.el (electric-pair-text-pairs) (electric-pair-skip-whitespace-function) (electric-pair-string-bound-function): * lisp/emacs-lisp/avl-tree.el (avl-tree--del-balance) (avl-tree-member, avl-tree-mapcar, avl-tree-iter): * lisp/emacs-lisp/bytecomp.el (byte-compile-generate-call-tree): * lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-flag) (checkdoc-spellcheck-documentation-flag, checkdoc-ispell) (checkdoc-ispell-current-buffer, checkdoc-ispell-interactive) (checkdoc-ispell-message-interactive) (checkdoc-ispell-message-text, checkdoc-ispell-start) (checkdoc-ispell-continue, checkdoc-ispell-comments) (checkdoc-ispell-defun): * lisp/emacs-lisp/cl-generic.el (cl--generic-search-method): * lisp/emacs-lisp/eieio-custom.el (eieio-read-customization-group): * lisp/emacs-lisp/lisp.el (forward-sexp, up-list): * lisp/emacs-lisp/package-x.el (package--archive-contents-from-file): * lisp/emacs-lisp/package.el (package-desc) (package--make-autoloads-and-stuff, package-hidden-regexps): * lisp/emacs-lisp/tcover-ses.el (ses-exercise-startup): * lisp/emacs-lisp/testcover.el (testcover-nohits) (testcover-1value): * lisp/epg.el (epg-receive-keys, epg-start-edit-key): * lisp/erc/erc-backend.el (erc-server-processing-p) (erc-split-line-length, erc-server-coding-system) (erc-server-send, erc-message): * lisp/erc/erc-button.el (erc-button-face, erc-button-alist) (erc-browse-emacswiki): * lisp/erc/erc-ezbounce.el (erc-ezbounce, erc-ezb-get-login): * lisp/erc/erc-fill.el (erc-fill-variable-maximum-indentation): * lisp/erc/erc-log.el (erc-current-logfile): * lisp/erc/erc-match.el (erc-log-match-format) (erc-text-matched-hook): * lisp/erc/erc-netsplit.el (erc-netsplit, erc-netsplit-debug): * lisp/erc/erc-networks.el (erc-server-alist) (erc-networks-alist, erc-current-network): * lisp/erc/erc-ring.el (erc-input-ring-index): * lisp/erc/erc-speedbar.el (erc-speedbar) (erc-speedbar-update-channel): * lisp/erc/erc-stamp.el (erc-timestamp-only-if-changed-flag): * lisp/erc/erc-track.el (erc-track-position-in-mode-line) (erc-track-remove-from-mode-line, erc-modified-channels-update) (erc-track-last-non-erc-buffer, erc-track-sort-by-importance) (erc-track-get-active-buffer): * lisp/erc/erc.el (erc-get-channel-user-list) (erc-echo-notice-hook, erc-echo-notice-always-hook) (erc-wash-quit-reason, erc-format-@nick): * lisp/ffap.el (ffap-latex-mode): * lisp/files.el (abort-if-file-too-large) (dir-locals--get-sort-score, buffer-stale--default-function): * lisp/filesets.el (filesets-tree-max-level, filesets-data) (filesets-update-pre010505): * lisp/gnus/gnus-agent.el (gnus-agent-flush-cache): * lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol) (gnus-button-prefer-mid-or-mail): * lisp/gnus/gnus-cus.el (gnus-group-parameters): * lisp/gnus/gnus-demon.el (gnus-demon-handlers) (gnus-demon-run-callback): * lisp/gnus/gnus-dired.el (gnus-dired-print): * lisp/gnus/gnus-icalendar.el (gnus-icalendar-event-from-buffer): * lisp/gnus/gnus-range.el (gnus-range-normalize): * lisp/gnus/gnus-spec.el (gnus-pad-form): * lisp/gnus/gnus-srvr.el (gnus-server-agent, gnus-server-cloud) (gnus-server-opened, gnus-server-closed, gnus-server-denied) (gnus-server-offline): * lisp/gnus/gnus-sum.el (gnus-refer-thread-use-nnir) (gnus-refer-thread-limit-to-thread) (gnus-summary-limit-include-thread, gnus-summary-refer-thread) (gnus-summary-find-matching): * lisp/gnus/gnus-util.el (gnus-rescale-image): * lisp/gnus/gnus.el (gnus-summary-line-format, gnus-no-server): * lisp/gnus/mail-source.el (mail-source-incoming-file-prefix): * lisp/gnus/message.el (message-cite-reply-position) (message-cite-style-outlook, message-cite-style-thunderbird) (message-cite-style-gmail, message--send-mail-maybe-partially): * lisp/gnus/mm-extern.el (mm-inline-external-body): * lisp/gnus/mm-partial.el (mm-inline-partial): * lisp/gnus/mml-sec.el (mml-secure-message-sign) (mml-secure-message-sign-encrypt, mml-secure-message-encrypt): * lisp/gnus/mml2015.el (mml2015-epg-key-image) (mml2015-epg-key-image-to-string): * lisp/gnus/nndiary.el (nndiary-reminders, nndiary-get-new-mail): * lisp/gnus/nnheader.el (nnheader-directory-files-is-safe): * lisp/gnus/nnir.el (nnir-search-history) (nnir-imap-search-other, nnir-artlist-length) (nnir-artlist-article, nnir-artitem-group, nnir-artitem-number) (nnir-artitem-rsv, nnir-article-group, nnir-article-number) (nnir-article-rsv, nnir-article-ids, nnir-categorize) (nnir-retrieve-headers-override-function) (nnir-imap-default-search-key, nnir-hyrex-additional-switches) (gnus-group-make-nnir-group, nnir-run-namazu, nnir-read-parms) (nnir-read-parm, nnir-read-server-parm, nnir-search-thread): * lisp/gnus/nnmairix.el (nnmairix-default-group) (nnmairix-propagate-marks): * lisp/gnus/smime.el (smime-keys, smime-crl-check) (smime-verify-buffer, smime-noverify-buffer): * lisp/gnus/spam-report.el (spam-report-url-ping-mm-url): * lisp/gnus/spam.el (spam-spamassassin-positive-spam-flag-header) (spam-spamassassin-spam-status-header, spam-sa-learn-rebuild) (spam-classifications, spam-check-stat, spam-spamassassin-score): * lisp/help.el (describe-minor-mode-from-symbol): * lisp/hippie-exp.el (hippie-expand-ignore-buffers): * lisp/htmlfontify.el (hfy-optimizations, hfy-face-resolve-face) (hfy-begin-span): * lisp/ibuf-ext.el (ibuffer-update-saved-filters-format) (ibuffer-saved-filters, ibuffer-old-saved-filters-warning) (ibuffer-filtering-qualifiers, ibuffer-repair-saved-filters) (eval, ibuffer-unary-operand, file-extension, directory): * lisp/image-dired.el (image-dired-cmd-pngcrush-options): * lisp/image-mode.el (image-toggle-display): * lisp/international/ccl.el (ccl-compile-read-multibyte-character) (ccl-compile-write-multibyte-character): * lisp/international/kkc.el (kkc-save-init-file): * lisp/international/latin1-disp.el (latin1-display): * lisp/international/ogonek.el (ogonek-name-encoding-alist) (ogonek-information, ogonek-lookup-encoding) (ogonek-deprefixify-region): * lisp/isearch.el (isearch-filter-predicate) (isearch--momentary-message): * lisp/jsonrpc.el (jsonrpc-connection-send) (jsonrpc-process-connection, jsonrpc-shutdown) (jsonrpc--async-request-1): * lisp/language/tibet-util.el (tibetan-char-p): * lisp/mail/feedmail.el (feedmail-queue-use-send-time-for-date) (feedmail-last-chance-hook, feedmail-before-fcc-hook) (feedmail-send-it-immediately-wrapper, feedmail-find-eoh): * lisp/mail/hashcash.el (hashcash-generate-payment) (hashcash-generate-payment-async, hashcash-insert-payment) (hashcash-verify-payment): * lisp/mail/rmail.el (rmail-movemail-variant-in-use) (rmail-get-attr-value): * lisp/mail/rmailmm.el (rmail-mime-prefer-html, rmail-mime): * lisp/mail/rmailsum.el (rmail-summary-show-message): * lisp/mail/supercite.el (sc-raw-mode-toggle): * lisp/man.el (Man-start-calling): * lisp/mh-e/mh-acros.el (mh-do-at-event-location) (mh-iterate-on-messages-in-region, mh-iterate-on-range): * lisp/mh-e/mh-alias.el (mh-alias-system-aliases) (mh-alias-reload, mh-alias-ali) (mh-alias-canonicalize-suggestion, mh-alias-add-alias-to-file) (mh-alias-add-alias): * lisp/mouse.el (mouse-save-then-kill): * lisp/net/browse-url.el (browse-url-default-macosx-browser): * lisp/net/eudc.el (eudc-set, eudc-variable-protocol-value) (eudc-variable-server-value, eudc-update-variable) (eudc-expand-inline): * lisp/net/eudcb-bbdb.el (eudc-bbdb-format-record-as-result): * lisp/net/eudcb-ldap.el (eudc-ldap-get-field-list): * lisp/net/pop3.el (pop3-list): * lisp/net/soap-client.el (soap-namespace-put) (soap-xs-parse-sequence, soap-parse-envelope): * lisp/net/soap-inspect.el (soap-inspect-xs-complex-type): * lisp/nxml/rng-xsd.el (rng-xsd-date-to-days): * lisp/org/ob-C.el (org-babel-prep-session:C) (org-babel-load-session:C): * lisp/org/ob-J.el (org-babel-execute:J): * lisp/org/ob-asymptote.el (org-babel-prep-session:asymptote): * lisp/org/ob-awk.el (org-babel-execute:awk): * lisp/org/ob-core.el (org-babel-process-file-name): * lisp/org/ob-ebnf.el (org-babel-execute:ebnf): * lisp/org/ob-forth.el (org-babel-execute:forth): * lisp/org/ob-fortran.el (org-babel-execute:fortran) (org-babel-prep-session:fortran, org-babel-load-session:fortran): * lisp/org/ob-groovy.el (org-babel-execute:groovy): * lisp/org/ob-io.el (org-babel-execute:io): * lisp/org/ob-js.el (org-babel-execute:js): * lisp/org/ob-lilypond.el (org-babel-default-header-args:lilypond) (org-babel-lilypond-compile-post-tangle) (org-babel-lilypond-display-pdf-post-tangle) (org-babel-lilypond-tangle) (org-babel-lilypond-execute-tangled-ly) (org-babel-lilypond-compile-lilyfile) (org-babel-lilypond-check-for-compile-error) (org-babel-lilypond-process-compile-error) (org-babel-lilypond-mark-error-line) (org-babel-lilypond-parse-error-line) (org-babel-lilypond-attempt-to-open-pdf) (org-babel-lilypond-attempt-to-play-midi) (org-babel-lilypond-switch-extension) (org-babel-lilypond-set-header-args): * lisp/org/ob-lua.el (org-babel-prep-session:lua): * lisp/org/ob-picolisp.el (org-babel-execute:picolisp): * lisp/org/ob-processing.el (org-babel-prep-session:processing): * lisp/org/ob-python.el (org-babel-prep-session:python): * lisp/org/ob-scheme.el (org-babel-scheme-capture-current-message) (org-babel-scheme-execute-with-geiser, org-babel-execute:scheme): * lisp/org/ob-shen.el (org-babel-execute:shen): * lisp/org/org-agenda.el (org-agenda-entry-types) (org-agenda-move-date-from-past-immediately-to-today) (org-agenda-time-grid, org-agenda-sorting-strategy) (org-agenda-filter-by-category, org-agenda-forward-block): * lisp/org/org-colview.el (org-columns--overlay-text): * lisp/org/org-faces.el (org-verbatim, org-cycle-level-faces): * lisp/org/org-indent.el (org-indent-set-line-properties): * lisp/org/org-macs.el (org-get-limited-outline-regexp): * lisp/org/org-mobile.el (org-mobile-files): * lisp/org/org.el (org-use-fast-todo-selection) (org-extend-today-until, org-use-property-inheritance) (org-refresh-effort-properties, org-open-at-point-global) (org-track-ordered-property-with-tag, org-shiftright): * lisp/org/ox-html.el (org-html-checkbox-type): * lisp/org/ox-man.el (org-man-source-highlight) (org-man-verse-block): * lisp/org/ox-publish.el (org-publish-sitemap-default): * lisp/outline.el (outline-head-from-level): * lisp/progmodes/dcl-mode.el (dcl-back-to-indentation-1) (dcl-calc-command-indent, dcl-indent-to): * lisp/progmodes/flymake.el (flymake-make-diagnostic) (flymake--overlays, flymake-diagnostic-functions) (flymake-diagnostic-types-alist, flymake--backend-state) (flymake-is-running, flymake--collect, flymake-mode): * lisp/progmodes/gdb-mi.el (gdb-threads-list, gdb, gdb-non-stop) (gdb-buffers, gdb-gud-context-call, gdb-jsonify-buffer): * lisp/progmodes/grep.el (grep-error-screen-columns): * lisp/progmodes/gud.el (gud-prev-expr): * lisp/progmodes/ps-mode.el (ps-mode, ps-mode-target-column) (ps-run-goto-error): * lisp/progmodes/python.el (python-eldoc-get-doc) (python-eldoc-function-timeout-permanent, python-eldoc-function): * lisp/shadowfile.el (shadow-make-group): * lisp/speedbar.el (speedbar-obj-do-check): * lisp/textmodes/flyspell.el (flyspell-auto-correct-previous-hook): * lisp/textmodes/reftex-cite.el (reftex-bib-or-thebib): * lisp/textmodes/reftex-index.el (reftex-index-goto-entry) (reftex-index-kill, reftex-index-undo): * lisp/textmodes/reftex-parse.el (reftex-context-substring): * lisp/textmodes/reftex.el (reftex-TeX-master-file): * lisp/textmodes/rst.el (rst-next-hdr, rst-toc) (rst-uncomment-region, rst-font-lock-extend-region-internal): * lisp/thumbs.el (thumbs-mode): * lisp/vc/ediff-util.el (ediff-restore-diff): * lisp/vc/pcvs-defs.el (cvs-cvsroot, cvs-force-dir-tag): * lisp/vc/vc-hg.el (vc-hg--ignore-patterns-valid-p): * lisp/wid-edit.el (widget-field-value-set, string): * lisp/x-dnd.el (x-dnd-version-from-flags) (x-dnd-more-than-3-from-flags): Assorted docfixes.
2019-09-20 22:27:53 +00:00
Position it according to WHERE which can be BEG or END."
2009-01-22 17:09:23 +00:00
(if (and (one-window-p) (not pop-up-frames))
;; If there is just one window, put the summary on the top.
(let ((buffer rmail-buffer))
(split-window (selected-window) rmail-summary-window-size)
(select-window (frame-first-window))
(rmail-pop-to-buffer rmail-buffer)
2009-01-22 17:09:23 +00:00
;; If pop-to-buffer did not use that window, delete that
;; window. (This can happen if it uses another frame.)
(or (eq buffer (window-buffer (next-window (frame-first-window))))
(delete-other-windows)))
(rmail-pop-to-buffer rmail-buffer))
2009-01-22 17:09:23 +00:00
(cond
((eq where 'BEG)
(goto-char (point-min))
(search-forward "\n\n"))
((eq where 'END)
(goto-char (point-max))
(recenter (1- (window-height))))
)
(rmail-pop-to-buffer rmail-summary-buffer))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-bury ()
"Bury the Rmail buffer and the Rmail summary buffer."
(interactive)
(let ((buffer-to-bury (current-buffer)))
(let (window)
(while (setq window (get-buffer-window rmail-buffer))
(set-window-buffer window (other-buffer rmail-buffer)))
(bury-buffer rmail-buffer))
(switch-to-buffer (other-buffer buffer-to-bury))
(bury-buffer buffer-to-bury)))
(defun rmail-summary-quit ()
"Quit out of Rmail and Rmail summary."
(interactive)
(rmail-summary-wipe)
(rmail-quit))
(defun rmail-summary-wipe ()
"Kill and wipe away Rmail summary, remaining within Rmail."
(interactive)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer (setq rmail-summary-buffer nil))
2009-01-22 17:09:23 +00:00
(let ((local-rmail-buffer rmail-buffer))
(kill-buffer (current-buffer))
;; Delete window if not only one.
(if (not (eq (selected-window) (next-window nil 'no-minibuf)))
(delete-window))
;; Switch windows to the rmail buffer, or switch to it in this window.
(rmail-pop-to-buffer local-rmail-buffer)))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-expunge ()
"Actually erase all deleted messages and recompute summary headers."
(interactive)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(when (rmail-expunge-confirmed)
(rmail-only-expunge)))
(rmail-update-summary))
(defun rmail-summary-expunge-and-save ()
"Expunge and save RMAIL file."
(interactive)
(save-excursion
(rmail-expunge-and-save))
(rmail-update-summary)
(set-buffer-modified-p nil))
(defun rmail-summary-get-new-mail (&optional file-name)
"Get new mail and recompute summary headers.
Optionally you can specify the file to get new mail from. In this case,
the file of new mail is not changed or deleted. Noninteractively, you can
pass the inbox file name as an argument. Interactively, a prefix
argument says to read a file name and use that file as the inbox."
(interactive
(list (if current-prefix-arg
(read-file-name "Get new mail from file: "))))
(let (msg)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-get-new-mail file-name)
;; Get the proper new message number.
(setq msg rmail-current-message))
;; Make sure that message is displayed.
(or (zerop msg)
(rmail-summary-goto-msg msg))))
(defun rmail-summary-input (filename)
"Run Rmail on file FILENAME."
(interactive "FRun rmail on RMAIL file: ")
;; We switch windows here, then display the other Rmail file there.
(rmail-pop-to-buffer rmail-buffer)
2009-01-22 17:09:23 +00:00
(rmail filename))
(defun rmail-summary-first-message ()
"Show first message in Rmail file from summary buffer."
(interactive)
(with-no-warnings
(beginning-of-buffer)))
(defun rmail-summary-last-message ()
"Show last message in Rmail file from summary buffer."
(interactive)
(with-no-warnings
(end-of-buffer))
(forward-line -1))
(declare-function rmail-abort-edit "rmailedit" ())
; Fix mistakes in 'declare function' forms * lisp/progmodes/gdb-mi.el (tooltip-show): * lisp/vc/vc-git.el (grep-expand-template): * lisp/cedet/semantic/imenu.el (pulse-momentary-highlight-one-line): * lisp/mail/feedmail.el (smtpmail-via-smtp): * lisp/mail/rmail.el (rmail-mime-entity-truncated): * lisp/mail/rmailsum.el (rmail-cease-edit): * lisp/progmodes/gud.el (speedbar-toggle-line-expansion) (speedbar-edit-line): * lisp/autoinsert.el (sgml-tag): * lisp/comint.el (url-host, url-type, url-filename): * lisp/progmodes/elisp-mode.el (xref-make, xref-item-location): * lisp/vc/vc-hooks.el (vc-responsible-backend): * lisp/cedet/semantic/complete.el (tooltip-show): * lisp/doc-view.el (tooltip-show): * lisp/follow.el (mwheel-scroll): * lisp/term/pgtk-win.el (pgtk-set-resource): * lisp/progmodes/cperl-mode.el (Info-find-node): * lisp/lpr.el (print-region-function): * lisp/w32-fns.el (w32-version, w32-read-registry): * lisp/emacs-lisp/checkdoc.el (ispell-correct-p, checkdoc-dired): * lisp/progmodes/xref.el (apropos-parse-pattern): * lisp/cus-edit.el (apropos-parse-pattern): * lisp/obsolete/gs.el (x-change-window-property): * lisp/x-dnd.el (x-change-window-property): * lisp/xwidget.el (make-xwidget): * lisp/transient.el (info, Man-find-section, Man-next-section) (Man-getpage-in-background): * lisp/frame.el (x-device-class, pgtk-device-class): * lisp/textmodes/texinfo.el (flymake--log-1): * lisp/term/x-win.el (x-internal-focus-input-context): Fix 'declare function' errors uncovered by 'check-declare'.
2022-05-14 13:19:12 +00:00
(declare-function rmail-cease-edit "rmailedit" (&optional abort))
2009-01-22 17:09:23 +00:00
(declare-function rmail-set-label "rmailkwd" (l state &optional n))
(declare-function rmail-output-read-file-name "rmailout" ())
(declare-function mail-send-and-exit "sendmail" (&optional arg))
(defvar-keymap rmail-summary-edit-map
:parent text-mode-map
"C-c C-c" #'rmail-cease-edit
"C-c C-]" #'rmail-abort-edit)
2009-01-22 17:09:23 +00:00
(defun rmail-summary-edit-current-message ()
"Edit the contents of this message."
(interactive)
(rmail-pop-to-buffer rmail-buffer)
2009-01-22 17:09:23 +00:00
(rmail-edit-current-message)
(use-local-map rmail-summary-edit-map))
(defun rmail-summary-epa-decrypt ()
"Decrypt this message."
(interactive)
(rmail-pop-to-buffer rmail-buffer)
(rmail-epa-decrypt))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-cease-edit ()
"Finish editing message, then go back to Rmail summary buffer."
(interactive)
(rmail-cease-edit)
(rmail-pop-to-buffer rmail-summary-buffer))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-abort-edit ()
"Abort edit of current message; restore original contents.
Go back to summary buffer."
(interactive)
(rmail-abort-edit)
(rmail-pop-to-buffer rmail-summary-buffer))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-search-backward (regexp &optional n)
"Show message containing next match for REGEXP.
Prefix argument gives repeat count; negative argument means search
backwards (through earlier messages).
Interactively, empty argument means use same regexp used last time."
(interactive
(let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0))
(prompt
(concat (if reversep "Reverse " "") "Rmail search (regexp"))
regexp)
(setq prompt
(concat prompt
(if rmail-search-last-regexp
(concat ", default "
rmail-search-last-regexp "): ")
"): ")))
(setq regexp (read-string prompt))
(cond ((not (equal regexp ""))
(setq rmail-search-last-regexp regexp))
((not rmail-search-last-regexp)
(error "No previous Rmail search string")))
(list rmail-search-last-regexp
(prefix-numeric-value current-prefix-arg))))
;; Don't use save-excursion because that prevents point from moving
;; properly in the summary buffer.
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
(rmail-search regexp (- n))))
2009-01-22 17:09:23 +00:00
(defun rmail-summary-search (regexp &optional n)
"Show message containing next match for REGEXP.
Prefix argument gives repeat count; negative argument means search
backwards (through earlier messages).
Interactively, empty argument means use same regexp used last time."
(interactive
(let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0))
(prompt
(concat (if reversep "Reverse " "") "Rmail search (regexp"))
regexp)
(setq prompt
(concat prompt
(if rmail-search-last-regexp
(concat ", default "
rmail-search-last-regexp "): ")
"): ")))
(setq regexp (read-string prompt))
(cond ((not (equal regexp ""))
(setq rmail-search-last-regexp regexp))
((not rmail-search-last-regexp)
(error "No previous Rmail search string")))
(list rmail-search-last-regexp
(prefix-numeric-value current-prefix-arg))))
;; Don't use save-excursion because that prevents point from moving
;; properly in the summary buffer.
(let ((buffer (current-buffer))
(selwin (selected-window)))
2009-01-22 17:09:23 +00:00
(unwind-protect
(progn
(rmail-pop-to-buffer rmail-buffer)
2009-01-22 17:09:23 +00:00
(rmail-search regexp n))
(select-window selwin)
2009-01-22 17:09:23 +00:00
(set-buffer buffer))))
(defun rmail-summary-toggle-header ()
"Show original message header if pruned header currently shown, or vice versa."
(interactive)
(save-window-excursion
(set-buffer rmail-buffer)
(rmail-toggle-header))
;; Inside save-excursion, some changes to point in the RMAIL buffer are lost.
;; Set point to point-min in the RMAIL buffer, if it is visible.
(let ((window (get-buffer-window rmail-buffer)))
(if window
;; Using save-window-excursion would lose the new value of point.
(let ((owin (selected-window)))
(unwind-protect
(progn
(select-window window)
(goto-char (point-min)))
(select-window owin))))))
(defun rmail-summary-add-label (label)
"Add LABEL to labels associated with current Rmail message.
Completion is performed over known labels when reading."
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(interactive (list (with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-read-label "Add label"))))
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-add-label label)))
(defun rmail-summary-kill-label (label)
"Remove LABEL from labels associated with current Rmail message.
Completion is performed over known labels when reading."
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(interactive (list (with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-read-label "Kill label"))))
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(rmail-set-label label nil)))
;;;; *** Rmail Summary Mailing Commands ***
(defun rmail-summary-override-mail-send-and-exit ()
"Replace bindings to `mail-send-and-exit' with `rmail-summary-send-and-exit'."
(use-local-map (copy-keymap (current-local-map)))
(dolist (key (where-is-internal 'mail-send-and-exit))
(define-key (current-local-map) key 'rmail-summary-send-and-exit)))
(defun rmail-summary-mail ()
"Send mail in another window.
While composing the message, use \\[mail-yank-original] to yank the
original message into it."
(interactive)
(let ((window (get-buffer-window rmail-buffer)))
(if window
(select-window window)
(set-buffer rmail-buffer)))
(rmail-start-mail nil nil nil nil nil (current-buffer))
(rmail-summary-override-mail-send-and-exit))
(defun rmail-summary-continue ()
"Continue composing outgoing message previously being composed."
(interactive)
(let ((window (get-buffer-window rmail-buffer)))
(if window
(select-window window)
(set-buffer rmail-buffer)))
(rmail-start-mail t))
(defun rmail-summary-reply (just-sender)
"Reply to the current message.
Normally include Cc: to all other recipients of original message;
2009-01-22 17:09:23 +00:00
prefix argument means ignore them. While composing the reply,
use \\[mail-yank-original] to yank the original message into it."
(interactive "P")
(let ((window (get-buffer-window rmail-buffer)))
(if window
(select-window window)
(set-buffer rmail-buffer)))
(rmail-reply just-sender)
(rmail-summary-override-mail-send-and-exit))
(defun rmail-summary-retry-failure ()
"Edit a mail message which is based on the contents of the current message.
For a message rejected by the mail system, extract the interesting headers and
the body of the original message; otherwise copy the current message."
(interactive)
(let ((window (get-buffer-window rmail-buffer)))
(if window
(select-window window)
(set-buffer rmail-buffer)))
(rmail-retry-failure)
(rmail-summary-override-mail-send-and-exit))
(defun rmail-summary-send-and-exit ()
"Send mail reply and return to summary buffer."
(interactive)
(mail-send-and-exit t))
(defun rmail-summary-forward (resend)
"Forward the current message to another user.
With prefix argument, \"resend\" the message instead of forwarding it;
see the documentation of `rmail-resend'."
(interactive "P")
(save-excursion
(let ((window (get-buffer-window rmail-buffer)))
(if window
(select-window window)
(set-buffer rmail-buffer)))
(rmail-forward resend)
(rmail-summary-override-mail-send-and-exit)))
(defun rmail-summary-resend ()
"Resend current message using `rmail-resend'."
(interactive)
(save-excursion
(let ((window (get-buffer-window rmail-buffer)))
(if window
(select-window window)
(set-buffer rmail-buffer)))
(call-interactively 'rmail-resend)))
;; Summary output commands.
(defun rmail-summary-output (&optional file-name n)
"Append this message to mail file FILE-NAME.
This works with both mbox format and Babyl format files,
outputting in the appropriate format for each.
The default file name comes from `rmail-default-file',
which is updated to the name you use in this command.
A prefix argument N says to output that many consecutive messages
from those in the summary, starting with the current one.
Deleted messages are skipped and don't count.
When called from Lisp code, N may be omitted and defaults to 1.
This command always outputs the complete message header,
even if the header display is currently pruned."
2009-01-22 17:09:23 +00:00
(interactive
(progn (require 'rmailout)
(list (rmail-output-read-file-name)
(prefix-numeric-value current-prefix-arg))))
(let ((i 0) prev-msg curmsg)
2009-01-22 17:09:23 +00:00
(while
(and (< i n)
(progn (rmail-summary-goto-msg)
(not (eq prev-msg
(setq prev-msg
(with-current-buffer rmail-buffer
rmail-current-message))))))
(setq i (1+ i))
(with-current-buffer rmail-buffer
(let ((rmail-delete-after-output nil))
(setq curmsg rmail-current-message)
2009-01-22 17:09:23 +00:00
(rmail-output file-name 1)))
;; rmail-output sometimes moves to the next message; undo that.
(or (= curmsg (rmail-summary-msg-number))
(rmail-summary-goto-msg curmsg))
2009-01-22 17:09:23 +00:00
(if rmail-delete-after-output
(rmail-summary-delete-forward nil)
(if (< i n)
(rmail-summary-next-msg 1))))))
(declare-function rmail-output-as-seen "rmailout"
(file-name &optional count noattribute from-gnus))
(defun rmail-summary-output-as-seen (&optional file-name n)
"Append this message to mbox file named FILE-NAME.
2009-01-22 17:09:23 +00:00
A prefix argument N says to output that many consecutive messages,
from the summary, starting with the current one.
Deleted messages are skipped and don't count.
When called from Lisp code, N may be omitted and defaults to 1.
This outputs the message header as you see it (or would see it)
displayed in Rmail.
The default file name comes from `rmail-default-file',
which is updated to the name you use in this command."
(interactive
(progn (require 'rmailout)
(list (rmail-output-read-file-name)
(prefix-numeric-value current-prefix-arg))))
(require 'rmailout) ; for rmail-output-as-seen in non-interactive case
(let ((i 0) prev-msg)
(while
(and (< i n)
(progn (rmail-summary-goto-msg)
(not (eq prev-msg
(setq prev-msg
(with-current-buffer rmail-buffer
rmail-current-message))))))
(setq i (1+ i))
(with-current-buffer rmail-buffer
(let ((rmail-delete-after-output nil))
(rmail-output-as-seen file-name 1)))
(if rmail-delete-after-output
(rmail-summary-delete-forward nil)
(if (< i n)
(rmail-summary-next-msg 1))))))
(defun rmail-summary-output-menu ()
"Output current message to another Rmail file, chosen with a menu.
Also set the default for subsequent \\[rmail-output-to-babyl-file] commands.
The variables `rmail-secondary-file-directory' and
`rmail-secondary-file-regexp' control which files are offered in the menu."
(interactive)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(let ((rmail-delete-after-output nil))
(call-interactively 'rmail-output-menu)))
(if rmail-delete-after-output
(rmail-summary-delete-forward nil)))
(defun rmail-summary-construct-io-menu ()
(let ((files (rmail-find-all-files rmail-secondary-file-directory)))
(if files
(progn
(define-key rmail-summary-mode-map [menu-bar classify input-menu]
(cons "Input Rmail File"
(rmail-list-to-menu "Input Rmail File"
files
'rmail-summary-input)))
(define-key rmail-summary-mode-map [menu-bar classify output-menu]
(cons "Output Rmail File"
(rmail-list-to-menu "Output Rmail File"
files
'rmail-summary-output))))
(define-key rmail-summary-mode-map [menu-bar classify input-menu]
'("Input Rmail File" . rmail-disable-menu))
(define-key rmail-summary-mode-map [menu-bar classify output-menu]
'("Output Rmail File" . rmail-disable-menu)))))
(defun rmail-summary-output-body (&optional file-name)
"Write this message body to the file FILE-NAME.
FILE-NAME defaults, interactively, from the Subject field of the message."
(interactive)
* url-util.el (url-insert-entities-in-string): * url-nfs.el (url-nfs-unescape): * url-ldap.el (url-ldap): * url-imap.el (url-imap): * url-cid.el (url-cid-gnus, url-cid): Use with-current-buffer. * erc.el (erc-display-line-1, erc-process-away): * erc-truncate.el (erc-truncate-buffer-to-size): Use with-current-buffer. * term/ns-win.el (ns-scroll-bar-move, ns-face-at-pos): * play/mpuz.el (mpuz-create-buffer): * play/landmark.el (lm-prompt-for-move, lm-print-wts, lm-print-smell) (lm-print-y,s,noise, lm-print-w0, lm-init): * play/gomoku.el (gomoku-prompt-for-move): * play/fortune.el (fortune-in-buffer): * play/dissociate.el (dissociated-press): * play/decipher.el (decipher-adjacency-list, decipher-display-regexp) (decipher-analyze-buffer, decipher-stats-buffer,decipher-stats-buffer): * mail/supercite.el (sc-eref-show): * mail/smtpmail.el (smtpmail-send-it): * mail/rmailsum.el (rmail-summary-next-labeled-message) (rmail-summary-previous-labeled-message, rmail-summary-wipe) (rmail-summary-undelete-many, rmail-summary-rmail-update) (rmail-summary-goto-msg, rmail-summary-expunge) (rmail-summary-get-new-mail, rmail-summary-search-backward) (rmail-summary-add-label, rmail-summary-output-menu) (rmail-summary-output-body): * mail/rfc822.el (rfc822-addresses): * mail/reporter.el (reporter-dump-variable, reporter-dump-state): * mail/mailpost.el (post-mail-send-it): * mail/hashcash.el (hashcash-generate-payment): * mail/feedmail.el (feedmail-run-the-queue) (feedmail-queue-send-edit-prompt-help-first) (feedmail-send-it-immediately, feedmail-give-it-to-buffer-eater) (feedmail-deduce-address-list): * eshell/esh-ext.el (eshell-remote-command): * eshell/em-unix.el (eshell-occur-mode-mouse-goto): * emulation/viper-util.el (viper-glob-unix-files, viper-save-setting) (viper-wildcard-to-regexp, viper-glob-mswindows-files) (viper-save-string-in-file, viper-valid-marker): * emulation/viper-keym.el (viper-toggle-key): * emulation/viper-ex.el (ex-expand-filsyms, viper-get-ex-file) (ex-edit, ex-global, ex-mark, ex-next-related-buffer, ex-quit) (ex-get-inline-cmd-args, ex-tag, ex-command, ex-compile): * emulation/viper-cmd.el (viper-exec-form-in-vi) (viper-exec-form-in-emacs, viper-brac-function): * emulation/viper.el (viper-delocalize-var): * emulation/vip.el (vip-mode, vip-get-ex-token, vip-ex, vip-get-ex-pat) (vip-get-ex-command, vip-get-ex-opt-gc, vip-get-ex-buffer) (vip-get-ex-count, vip-get-ex-file, ex-edit, ex-global, ex-mark) (ex-map, ex-unmap, ex-quit, ex-read, ex-tag, ex-command): * emulation/vi.el (vi-switch-mode, vi-ex-cmd): * emulation/edt.el (edt-electric-helpify): * emulation/cua-rect.el (cua--rectangle-aux-replace): * emulation/cua-gmrk.el (cua--insert-at-global-mark) (cua--delete-at-global-mark, cua--copy-rectangle-to-global-mark) (cua-indent-to-global-mark-column): * calendar/diary-lib.el (calendar-mark-1): * calendar/cal-hebrew.el (calendar-hebrew-mark-date-pattern): Use with-current-buffer. * emulation/viper.el (viper-delocalize-var): Use dolist.
2009-11-03 02:04:29 +00:00
(with-current-buffer rmail-buffer
2009-01-22 17:09:23 +00:00
(let ((rmail-delete-after-output nil))
(if file-name
(rmail-output-body-to-file file-name)
(call-interactively 'rmail-output-body-to-file))))
(if rmail-delete-after-output
(rmail-summary-delete-forward nil)))
;; Sorting messages in Rmail Summary buffer.
(defun rmail-summary-sort-by-date (reverse)
"Sort messages of current Rmail summary by \"Date\" header.
If prefix argument REVERSE is non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P")
(rmail-sort-from-summary (function rmail-sort-by-date) reverse))
(defun rmail-summary-sort-by-subject (reverse)
"Sort messages of current Rmail summary by \"Subject\" header.
Ignores any \"Re: \" prefix. If prefix argument REVERSE is
non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P")
(rmail-sort-from-summary (function rmail-sort-by-subject) reverse))
(defun rmail-summary-sort-by-author (reverse)
"Sort messages of current Rmail summary by author.
This uses either the \"From\" or \"Sender\" header, downcased.
If prefix argument REVERSE is non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P")
(rmail-sort-from-summary (function rmail-sort-by-author) reverse))
(defun rmail-summary-sort-by-recipient (reverse)
"Sort messages of current Rmail summary by recipient.
This uses either the \"To\" or \"Apparently-To\" header, downcased.
If prefix argument REVERSE is non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P")
(rmail-sort-from-summary (function rmail-sort-by-recipient) reverse))
(defun rmail-summary-sort-by-correspondent (reverse)
"Sort messages of current Rmail summary by other correspondent.
This uses either the \"From\", \"Sender\", \"To\", or
\"Apparently-To\" header, downcased. Uses the first header not
excluded by `mail-dont-reply-to-names'. If prefix argument
REVERSE is non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P")
(rmail-sort-from-summary (function rmail-sort-by-correspondent) reverse))
(defun rmail-summary-sort-by-lines (reverse)
"Sort messages of current Rmail summary by the number of lines.
If prefix argument REVERSE is non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P")
(rmail-sort-from-summary (function rmail-sort-by-lines) reverse))
(defun rmail-summary-sort-by-labels (reverse labels)
"Sort messages of current Rmail summary by labels.
LABELS is a comma-separated list of labels.
If prefix argument REVERSE is non-nil, sorts in reverse order."
2009-01-22 17:09:23 +00:00
(interactive "P\nsSort by labels: ")
(rmail-sort-from-summary
(lambda (reverse) (rmail-sort-by-labels reverse labels))
2009-01-22 17:09:23 +00:00
reverse))
(defun rmail-sort-from-summary (sortfun reverse)
"Sort the Rmail buffer using sorting function SORTFUN.
Passes REVERSE to SORTFUN as its sole argument. Then regenerates
the summary. Note that the whole Rmail buffer is sorted, even if
the summary is only showing a subset of messages."
2009-01-22 17:09:23 +00:00
(require 'rmailsort)
(let ((selwin (selected-window)))
(unwind-protect
(progn (rmail-pop-to-buffer rmail-buffer)
2009-01-22 17:09:23 +00:00
(funcall sortfun reverse))
(select-window selwin))))
(define-obsolete-function-alias 'rmail-summary-output-to-rmail-file
#'rmail-summary-output "29.1")
2009-01-22 17:09:23 +00:00
(provide 'rmailsum)
;;; rmailsum.el ends here