home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / lisp / vm / vm-mark.el < prev    next >
Encoding:
Text File  |  1992-06-29  |  4.0 KB  |  118 lines

  1. ;;; Commands for handling messages marks
  2. ;;; Copyright (C) 1990 Kyle E. Jones
  3. ;;;
  4. ;;; This program is free software; you can redistribute it and/or modify
  5. ;;; it under the terms of the GNU General Public License as published by
  6. ;;; the Free Software Foundation; either version 1, or (at your option)
  7. ;;; any later version.
  8. ;;;
  9. ;;; This program is distributed in the hope that it will be useful,
  10. ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12. ;;; GNU General Public License for more details.
  13. ;;;
  14. ;;; You should have received a copy of the GNU General Public License
  15. ;;; along with this program; if not, write to the Free Software
  16. ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. (defun vm-clear-all-marks ()
  19.   "Removes all message marks in the current folder."
  20.   (interactive)
  21.   (vm-select-folder-buffer)
  22.   (vm-check-for-killed-summary)
  23.   (vm-error-if-folder-empty)
  24.   (let ((mp vm-message-list))
  25.     (while mp
  26.       (vm-set-mark-of (car mp) nil)
  27.       (vm-mark-for-display-update (car mp))
  28.       (setq mp (cdr mp))))
  29.   (vm-update-summary-and-mode-line))
  30.  
  31. (defun vm-mark-all-messages ()
  32.   "Mark all messages in the current folder."
  33.   (interactive)
  34.   (vm-select-folder-buffer)
  35.   (vm-check-for-killed-summary)
  36.   (vm-error-if-folder-empty)
  37.   (let ((mp vm-message-list))
  38.     (while mp
  39.       (vm-set-mark-of (car mp) t)
  40.       (vm-mark-for-display-update (car mp))
  41.       (setq mp (cdr mp))))
  42.   (vm-update-summary-and-mode-line))
  43.  
  44. (defun vm-mark-message (count)
  45.   "Mark the current message.
  46. Numeric prefix argument N means mark the current message and the next
  47. N-1 messages.  A negative N means mark the current message and the
  48. previous N-1 messages."
  49.   (interactive "p")
  50.   (if (interactive-p)
  51.       (vm-follow-summary-cursor))
  52.   (vm-select-folder-buffer)
  53.   (vm-check-for-killed-summary)
  54.   (vm-error-if-folder-empty)
  55.   (if (not (eq vm-circular-folders t))
  56.       (vm-check-count count))
  57.   (let ((direction (if (< count 0) 'backward 'forward))
  58.     (count (vm-abs count))
  59.     (oldmp vm-message-pointer)
  60.     (vm-message-pointer vm-message-pointer))
  61.     (while (not (zerop count))
  62.       (if (not (vm-mark-of (car vm-message-pointer)))
  63.       (progn
  64.         (vm-set-mark-of (car vm-message-pointer) t)
  65.         (vm-mark-for-display-update (car vm-message-pointer))))
  66.       (vm-decrement count)
  67.       (if (not (zerop count))
  68.       (vm-move-message-pointer direction))))
  69.   (vm-update-summary-and-mode-line))
  70.  
  71. (defun vm-unmark-message (count)
  72.   "Remove the mark from the current message.
  73. Numeric prefix argument N means unmark the current message and the next
  74. N-1 messages.  A negative N means unmark the current message and the
  75. previous N-1 messages."
  76.   (interactive "p")
  77.   (if (interactive-p)
  78.       (vm-follow-summary-cursor))
  79.   (vm-select-folder-buffer)
  80.   (vm-check-for-killed-summary)
  81.   (vm-error-if-folder-empty)
  82.   (if (not (eq vm-circular-folders t))
  83.       (vm-check-count count))
  84.   (let ((direction (if (< count 0) 'backward 'forward))
  85.     (count (vm-abs count))
  86.     (oldmp vm-message-pointer)
  87.     (vm-message-pointer vm-message-pointer))
  88.     (while (not (zerop count))
  89.       (if (vm-mark-of (car vm-message-pointer))
  90.       (progn
  91.         (vm-set-mark-of (car vm-message-pointer) nil)
  92.         (vm-mark-for-display-update (car vm-message-pointer))))
  93.       (vm-decrement count)
  94.       (if (not (zerop count))
  95.       (vm-move-message-pointer direction))))
  96.   (vm-update-summary-and-mode-line))
  97.  
  98. (defun vm-next-command-uses-marks ()
  99.   "Does nothing except insure that the next VM command will operate only
  100. on the marked messages in the current folder."
  101.   (interactive)
  102.   (message "Next command uses marks...")
  103.   (if (fboundp 'next-command-event)
  104.       (setq unread-command-event (next-command-event (allocate-event)))
  105.     (setq unread-command-char (read-char))))
  106.  
  107. (defun vm-marked-messages ()
  108.   (let (list (mp vm-message-list))
  109.     (while mp
  110.       (if (vm-mark-of (car mp))
  111.       (setq list (cons (car mp) list)))
  112.       (setq mp (cdr mp)))
  113.     (nreverse list)))
  114.  
  115. (defun vm-mark-help ()
  116.   (interactive)
  117.   (message "MM = mark, MU = unmark, Mm = mark all, Mu = unmark all, MN - use marks"))
  118.