annotate lisp/mail/pmailkwd.el @ 100267:c851df8e004e

2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-id.el (org-id-locations-file): Wrap file name with `convert-standard-filename'. (org-id-files): New variable. (org-id-use-hash): New option. (org-id-update-id-locations): Also search in all files current listed in `org-id-files'. Convert the resulting alist to a hash if the user customation says so. (org-id-locations-save): Handle he case if `org-id-locations' is a hash. (org-id-locations-load): Convert the alist to a hash. (org-id-add-location): Handle the hast case. (kill-emacs-hook): Make sure id locations are saved when Emacs is exited. (org-id-hash-to-alist, org-id-alist-to-hash) (org-id-paste-tracker): New functions. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-agenda.el (org-agenda-goto-calendar): Remove duplicate let bindings of calendar variables. * org-table.el (org-table-find-row-type): Renamed from `org-find-row-type'. (org-table-rewrite-old-row-references): Renamed from `org-rewrite-old-row-references'. (org-table-shift-refpart): Renamed from `org-shift-refpart'. (org-table-cleanup-narrow-column-properties): Renamed from `org-cleanup-narrow-column-properties'. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (org-find-row-type): New arguments DESC and CLINE, for better error messages. (org-table-get-descriptor-line): Supply the new arguments to `org-find-row-type'. (org-table-error-on-row-ref-crossing-hline): New option. * org.el (org-target-link-regexp): Make buffer-local. (org-move-subtree-down): Fix bug with trees at beginning of buffer. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-faces.el (org-set-tag-faces): New function. (org-tags-special-faces-re): New variable. * org.el (org-font-lock-add-tag-faces, org-get-tag-face): New functions. * org-faces.el (org-tag-faces): New option. (org-tag): Mention `org-tag-faces' in the docstring. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-html-style-default): Implement new quoting. * org-jsinfo.el (org-infojs-template): Implement new quoting. * org-w3m.el (w3m-minor-mode-hook): Also add the special copy command to the `w3m-minor-mode-map'. * org-archive.el (org-archive-to-archive-sibling): Protect `this-command' to avoid appending kills during archiving. * org-exp.el (org-export-with-priority): New variable. (org-export-add-options-to-plist): Use `org-export-plist-vars' instead of internal list of strings and properties. (org-print-icalendar-entries): Retrieve the location property with inheritance. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-with-todo-keywords): New option. (org-export-plist-vars): Include also the keys for the #+OPTIONS line. (org-default-export-plist, org-export-add-options-to-plist) (org-export-as-ascii, org-export-as-html): Use the new structure of `org-export-plist-vars'. * org.el (org-map-entries): Return all values. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-matcher-time): Recognize more special values. * org-gnus.el (fboundp): Fix defvaralias for XEmacs. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-tags-exclude-from-inheritance): New option. (org-tag-inherit-p, org-remove-uniherited-tags): Respect `org-tags-exclude-from-inheritance'. * org-agenda.el (org-agenda-show-inherited-tags): New option. (org-format-agenda-item): Add inherited tags to the agenda line string, and make sure that properties are kept when downcasing the tags list. (org-agenda-add-inherited-tags): New function. (org-downcase-keep-props): New function. * org.el (org-scan-tags): Mark inherited tags with a text property. (org-get-tags-at): Mark inherited tags with a text property. (org-add-prop-inherited): New function. * org-agenda.el (org-agenda-add-inherited-tags): New function. (org-agenda-show-inherited-tags): New option. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-modules): Add org-w3m to the default modules. * org-table.el (orgtbl-self-insert-command): Make S-SPC work in orgtbl-mode. (orgtabl-create-or-convert-from-region): New command. * org-exp.el (org-export-as-ascii): Remove the handling of targets. (org-export-ascii-preprocess): Handle targets already in this function. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-timer.el (org-timer-start-time): Define this variable. (org-timer-item): Make argument optional. * org-list.el (org-insert-item): Automatically insert a timer item if the current list is a timer list. * org-timer.el: New file. * org-publish.el (org-publish-org-index): Only exclude the index file in the main directory from being added to the site-map. (org-publish-get-project-from-filename): If the current project is a component, start publishing from the parent project. 2008-12-07 Carsten Dominik <carsten.dominik@gmail.com> * org-table.el (orgtbl-ret): Fix RET at beginning-of-buffer. * org-publish.el (org-publish-org-index): Improve removal of temporary buffers.
author Carsten Dominik <dominik@science.uva.nl>
date Sun, 07 Dec 2008 18:36:02 +0000
parents f525c6b7ac64
children a9dc0e7c3f2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1 ;;; pmailkwd.el --- part of the "PMAIL" mail reader for Emacs
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
3 ;; Copyright (C) 1985, 1988, 1994, 2001, 2002, 2003, 2004,
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
5
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
6 ;; Maintainer: FSF
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
7 ;; Keywords: mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
8
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
10
98012
f4a921de2099 Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents: 97808
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
98012
f4a921de2099 Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents: 97808
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
f4a921de2099 Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents: 97808
diff changeset
14 ;; (at your option) any later version.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
15
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
20
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
98012
f4a921de2099 Fix copyright years and license notices.
Glenn Morris <rgm@gnu.org>
parents: 97808
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
23
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
24 ;;; Commentary:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
25
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
26 ;;; Code:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
27
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
28 (defvar pmail-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
29 (defvar pmail-current-message)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
30 (defvar pmail-last-label)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
31 (defvar pmail-last-multi-labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
32 (defvar pmail-summary-vector)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
33 (defvar pmail-total-messages)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
34
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
35 ;; Global to all PMAIL buffers. It exists primarily for the sake of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
36 ;; completion. It is better to use strings with the label functions
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
37 ;; and let them worry about making the label.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
38
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
39 (defvar pmail-label-obarray (make-vector 47 0))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
40
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
41 ;; Named list of symbols representing valid message attributes in PMAIL.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
42
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
43 (defconst pmail-attributes
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
44 (cons 'pmail-keywords
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
45 (mapcar (function (lambda (s) (intern s pmail-label-obarray)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
46 '("deleted" "answered" "filed" "forwarded" "unseen" "edited"
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
47 "resent"))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
48
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
49 (defconst pmail-deleted-label (intern "deleted" pmail-label-obarray))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
50
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
51 ;; Named list of symbols representing valid message keywords in PMAIL.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
52
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
53 (defvar pmail-keywords)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
54
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
55 ;;;###autoload
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
56 (defun pmail-add-label (string)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
57 "Add LABEL to labels associated with current PMAIL message.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
58 Completion is performed over known labels when reading."
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
59 (interactive (list (pmail-read-label "Add label")))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
60 (pmail-set-label string t))
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
61
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
62 ;;;###autoload
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
63 (defun pmail-kill-label (string)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
64 "Remove LABEL from labels associated with current PMAIL message.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
65 Completion is performed over known labels when reading."
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
66 (interactive (list (pmail-read-label "Remove label")))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
67 (pmail-set-label string nil))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
68
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
69 ;;;###autoload
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
70 (defun pmail-read-label (prompt)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
71 (with-current-buffer pmail-buffer
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
72 (if (not pmail-keywords) (pmail-parse-file-keywords))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
73 (let ((result
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
74 (completing-read (concat prompt
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
75 (if pmail-last-label
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
76 (concat " (default "
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
77 (symbol-name pmail-last-label)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
78 "): ")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
79 ": "))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
80 pmail-label-obarray
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
81 nil
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
82 nil)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
83 (if (string= result "")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
84 pmail-last-label
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
85 (setq pmail-last-label (pmail-make-label result t))))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
86
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
87 (declare-function pmail-maybe-set-message-counters "pmail" ())
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
88 (declare-function pmail-display-labels "pmail" ())
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
89 (declare-function pmail-msgbeg "pmail" (n))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
90 (declare-function pmail-set-message-deleted-p "pmail" (n state))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
91 (declare-function pmail-message-labels-p "pmail" (msg labels))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
92 (declare-function pmail-show-message "pmail" (&optional n no-summary))
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
93 (declare-function mail-comma-list-regexp "mail-utils" (labels))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
94 (declare-function mail-parse-comma-list "mail-utils.el" ())
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
95
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
96 (defun pmail-set-label (l state &optional n)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
97 (with-current-buffer pmail-buffer
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
98 (pmail-maybe-set-message-counters)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
99 (if (not n) (setq n pmail-current-message))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
100 (aset pmail-summary-vector (1- n) nil)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
101 (let* ((attribute (pmail-attribute-p l))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
102 (keyword (and (not attribute)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
103 (or (pmail-keyword-p l)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
104 (pmail-install-keyword l))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
105 (label (or attribute keyword)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
106 (if label
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
107 (let ((omax (- (buffer-size) (point-max)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
108 (omin (- (buffer-size) (point-min)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
109 (buffer-read-only nil)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
110 (case-fold-search t))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
111 (unwind-protect
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
112 (save-excursion
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
113 (widen)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
114 (goto-char (pmail-msgbeg n))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
115 (forward-line 1)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
116 (if (not (looking-at "[01],"))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
117 nil
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
118 (let ((start (1+ (point)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
119 (bound))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
120 (narrow-to-region (point) (progn (end-of-line) (point)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
121 (setq bound (point-max))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
122 (search-backward ",," nil t)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
123 (if attribute
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
124 (setq bound (1+ (point)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
125 (setq start (1+ (point))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
126 (goto-char start)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
127 ; (while (re-search-forward "[ \t]*,[ \t]*" nil t)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
128 ; (replace-match ","))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
129 ; (goto-char start)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
130 (if (re-search-forward
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
131 (concat ", " (pmail-quote-label-name label) ",")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
132 bound
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
133 'move)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
134 (if (not state) (replace-match ","))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
135 (if state (insert " " (symbol-name label) ",")))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
136 (if (eq label pmail-deleted-label)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
137 (pmail-set-message-deleted-p n state)))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
138 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
139 (if (= n pmail-current-message) (pmail-display-labels))))))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
140
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
141 ;; Commented functions aren't used by PMAIL but might be nice for user
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
142 ;; packages that do stuff with PMAIL. Note that pmail-message-labels-p
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
143 ;; is in pmail.el now.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
144
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
145 ;(defun pmail-message-label-p (label &optional n)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
146 ; "Returns symbol if LABEL (attribute or keyword) on NTH or current message."
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
147 ; (pmail-message-labels-p (or n pmail-current-message) (regexp-quote label)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
148
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
149 ;(defun pmail-parse-message-labels (&optional n)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
150 ; "Returns labels associated with NTH or current PMAIL message.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
151 ;The result is a list of two lists of strings. The first is the
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
152 ;message attributes and the second is the message keywords."
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
153 ; (let (atts keys)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
154 ; (save-restriction
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
155 ; (widen)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
156 ; (goto-char (pmail-msgbeg (or n pmail-current-message)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
157 ; (forward-line 1)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
158 ; (or (looking-at "[01],") (error "Malformed label line"))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
159 ; (forward-char 2)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
160 ; (while (looking-at "[ \t]*\\([^ \t\n,]+\\),")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
161 ; (setq atts (cons (buffer-substring (match-beginning 1) (match-end 1))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
162 ; atts))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
163 ; (goto-char (match-end 0)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
164 ; (or (looking-at ",") (error "Malformed label line"))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
165 ; (forward-char 1)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
166 ; (while (looking-at "[ \t]*\\([^ \t\n,]+\\),")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
167 ; (setq keys (cons (buffer-substring (match-beginning 1) (match-end 1))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
168 ; keys))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
169 ; (goto-char (match-end 0)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
170 ; (or (looking-at "[ \t]*$") (error "Malformed label line"))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
171 ; (list (nreverse atts) (nreverse keys)))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
172
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
173 (defun pmail-attribute-p (s)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
174 (let ((symbol (pmail-make-label s)))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
175 (if (memq symbol (cdr pmail-attributes)) symbol)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
176
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
177 (defun pmail-keyword-p (s)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
178 (let ((symbol (pmail-make-label s)))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
179 (if (memq symbol (cdr (pmail-keywords))) symbol)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
180
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
181 (defun pmail-make-label (s &optional forcep)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
182 (cond ((symbolp s) s)
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
183 (forcep (intern (downcase s) pmail-label-obarray))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
184 (t (intern-soft (downcase s) pmail-label-obarray))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
185
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
186 (defun pmail-force-make-label (s)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
187 (intern (downcase s) pmail-label-obarray))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
188
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
189 (defun pmail-quote-label-name (label)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
190 (regexp-quote (symbol-name (pmail-make-label label t))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
191
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
192 ;; Motion on messages with keywords.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
193
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
194 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
195 (defun pmail-previous-labeled-message (n labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
196 "Show previous message with one of the labels LABELS.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
197 LABELS should be a comma-separated list of label names.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
198 If LABELS is empty, the last set of labels specified is used.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
199 With prefix argument N moves backward N messages with these labels."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
200 (interactive "p\nsMove to previous msg with labels: ")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
201 (pmail-next-labeled-message (- n) labels))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
202
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
203 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
204 (defun pmail-next-labeled-message (n labels)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
205 "Show next message with one of the labels LABELS.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
206 LABELS should be a comma-separated list of label names.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
207 If LABELS is empty, the last set of labels specified is used.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
208 With prefix argument N moves forward N messages with these labels."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
209 (interactive "p\nsMove to next msg with labels: ")
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
210 (if (string= labels "")
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
211 (setq labels pmail-last-multi-labels))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
212 (or labels
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
213 (error "No labels to find have been specified previously"))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
214 (set-buffer pmail-buffer)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
215 (setq pmail-last-multi-labels labels)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
216 (pmail-maybe-set-message-counters)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
217 (let ((lastwin pmail-current-message)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
218 (current pmail-current-message)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
219 (regexp (concat ", ?\\("
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
220 (mail-comma-list-regexp labels)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
221 "\\),")))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
222 (save-restriction
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
223 (widen)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
224 (while (and (> n 0) (< current pmail-total-messages))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
225 (setq current (1+ current))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
226 (if (pmail-message-labels-p current regexp)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
227 (setq lastwin current n (1- n))))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
228 (while (and (< n 0) (> current 1))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
229 (setq current (1- current))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
230 (if (pmail-message-labels-p current regexp)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
231 (setq lastwin current n (1+ n)))))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
232 (pmail-show-message lastwin)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
233 (if (< n 0)
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
234 (message "No previous message with labels %s" labels))
100222
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
235 (if (> n 0)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
236 (message "No following message with labels %s" labels))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
237
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
238 ;;; Manipulate the file's Labels option.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
239
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
240 ;; Return a list of symbols for all
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
241 ;; the keywords (labels) recorded in this file's Labels option.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
242 (defun pmail-keywords ()
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
243 (or pmail-keywords (pmail-parse-file-keywords)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
244
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
245 ;; Set pmail-keywords to a list of symbols for all
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
246 ;; the keywords (labels) recorded in this file's Labels option.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
247 (defun pmail-parse-file-keywords ()
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
248 (save-restriction
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
249 (save-excursion
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
250 (widen)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
251 (goto-char 1)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
252 (setq pmail-keywords
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
253 (if (search-forward "\nLabels:" (pmail-msgbeg 1) t)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
254 (progn
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
255 (narrow-to-region (point) (progn (end-of-line) (point)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
256 (goto-char (point-min))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
257 (cons 'pmail-keywords
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
258 (mapcar 'pmail-force-make-label
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
259 (mail-parse-comma-list)))))))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
260
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
261 ;; Add WORD to the list in the file's Labels option.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
262 ;; Any keyword used for the first time needs this done.
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
263 (defun pmail-install-keyword (word)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
264 (let ((keyword (pmail-make-label word t))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
265 (keywords (pmail-keywords)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
266 (if (not (or (pmail-attribute-p keyword)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
267 (pmail-keyword-p keyword)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
268 (let ((omin (- (buffer-size) (point-min)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
269 (omax (- (buffer-size) (point-max))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
270 (unwind-protect
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
271 (save-excursion
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
272 (widen)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
273 (goto-char 1)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
274 (let ((case-fold-search t)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
275 (buffer-read-only nil))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
276 (or (search-forward "\nLabels:" nil t)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
277 (progn
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
278 (end-of-line)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
279 (insert "\nLabels:")))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
280 (delete-region (point) (progn (end-of-line) (point)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
281 (setcdr keywords (cons keyword (cdr keywords)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
282 (while (setq keywords (cdr keywords))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
283 (insert (symbol-name (car keywords)) ","))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
284 (delete-char -1)))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
285 (narrow-to-region (- (buffer-size) omin)
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
286 (- (buffer-size) omax)))))
f525c6b7ac64 Sync with rmailkwd.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
287 keyword))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
288
97808
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
289 (provide 'pmailkwd)
1aab9bdd9355 Resolve all byte compiler warnings and enable IMAP/movemail support.
Paul Reilly <pmr@pajato.com>
parents: 97533
diff changeset
290
98019
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
291 ;; Local Variables:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
292 ;; change-log-default-name: "ChangeLog.pmail"
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
293 ;; End:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 98014
diff changeset
294
97533
ec1125c7ac26 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 97532
diff changeset
295 ;; arch-tag: 1149979c-8e47-4333-9629-cf3dc887a6a7
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
296 ;;; pmailkwd.el ends here