Article View: gnu.emacs.vm.bug
Article #8699Gack! Insufficient hooks in 5.35
From: Jonathan Stigelman
Date: Wed, 25 Aug 1993 11:31
Date: Wed, 25 Aug 1993 11:31
297 lines
13341 bytes
13341 bytes
Kyle,
Edit message does work. Hey, I don't mean to be a complainer, but "all the
hooks I'd been using in vm are gone." That's because they'd come from the
Lucid version and you haven't propagated any of the Lucid changes. :-(
Please add the following hooks as hilit19 presently *requires* them:
vm-summary-mode-hooks
vm-preview-message-hook
vm-show-message-hook
I would also like, but do not need, something more efficient than an
after-change-function to keep the summary buffer up-to-date:
(vm-summary-change-function summary-position)
For reference, I use these hooks in gnus...
gnus-article-prepare-hook
gnus-summary-prepare-hook
gnus-group-prepare-hook
For reference, below are diffs against the Lucid version of VM. There seem
to be other fixes in that version that should be beneficial to merge. But,
I don't think you'll want to apply these patches
Also, please consider including vm-sort and vm-frame in your distribution.
I've CCed the author of vm-frame as he expressed his desire for more hooks
in his code...
Thanks,
Stig
--STIG/stigma-- /usr2/hw/misc2/lucid/lemacs-19.6/lisp/vm >> grep run-hooks *el
vm-folder.el: (run-hooks 'vm-mode-hooks))
vm-page.el: (run-hooks 'vm-preview-message-hook) ; jwz
vm-page.el: (cond (newp (run-hooks 'vm-show-new-message-hook))
vm-page.el: (unreadp (run-hooks 'vm-show-unread-message-hook)))
vm-page.el: (run-hooks 'vm-show-message-hook)
vm-reply.el: (run-hooks 'mail-yank-hooks)
vm-reply.el: (run-hooks 'mail-setup-hook))
vm-summary.el: (run-hooks 'vm-summary-mode-hooks))
--STIG/stigma-- /usr2/hw/misc2/lucid/lemacs-19.6/lisp/vm >> cd site/vm5.35
/usr2/macro/stig/links/site/vm5.35
--STIG/stigma-- ~/e19/lib/emacs/site-lisp/vm5.35 >> grep run-hooks *el
vm-folder.el: (run-hooks 'vm-mode-hooks))
vm-reply.el: (mail-citation-hook (run-hooks 'mail-citation-hook))
vm-reply.el: (mail-yank-hooks (run-hooks 'mail-yank-hooks))
vm-reply.el: (run-hooks 'mail-setup-hook))
--STIG/stigma-- ~/e19/lib/emacs/site-lisp/vm5.35 >>
Here are some of the patches.....
--- vm-page.el Sun Apr 11 20:04:50 1993
+++ /usr2/hw/misc2/lucid/lemacs-19.6/lisp/vm/vm-page.el Wed Jan 27 00:04:48 1993
@@ -154,6 +154,8 @@
(eq major-mode 'vm-virtual-mode)
(not (one-window-p t)))
(vm-display-current-message-buffer t))
+ (if (null vm-message-pointer) ; don't lose on empty folder -- jwz
+ nil
(let ((vmp vm-message-pointer))
(vm-within-current-message-buffer
(let ((vm-message-pointer vmp))
@@ -185,11 +187,15 @@
(not (vm-new-flag (car vm-message-pointer)))
(not (vm-unread-flag (car vm-message-pointer)))))
(vm-show-current-message)
- (vm-update-summary-and-mode-line)))
+ (vm-update-summary-and-mode-line)
+ (run-hooks 'vm-preview-message-hook) ; jwz
+ )))
(defun vm-show-current-message ()
(setq vm-system-state 'showing)
- (let ((vmp vm-message-pointer))
+ (let ((vmp vm-message-pointer)
+ (newp nil)
+ (unreadp nil))
(vm-within-current-message-buffer
(let ((vm-message-pointer vmp))
(save-excursion
@@ -200,12 +206,18 @@
(progn
(if (looking-at page-delimiter)
(forward-page 1))
- (vm-narrow-to-page))))))
+ (vm-narrow-to-page)))))
(cond ((vm-new-flag (car vm-message-pointer))
+ (setq newp t) ; jwz: for vm-show-new-message-hook.
(vm-set-new-flag (car vm-message-pointer) nil))
((vm-unread-flag (car vm-message-pointer))
+ (setq unreadp t) ; jwz: for vm-show-unread-message-hook.
(vm-set-unread-flag (car vm-message-pointer) nil)))
- (vm-update-summary-and-mode-line))
+ (vm-update-summary-and-mode-line)
+ (cond (newp (run-hooks 'vm-show-new-message-hook))
+ (unreadp (run-hooks 'vm-show-unread-message-hook)))
+ (run-hooks 'vm-show-message-hook)
+ ))
(defun vm-expose-hidden-headers ()
"Toggle exposing and hiding message headers that are normally not visible."
--- vm-summary.el Sun Aug 1 20:28:10 1993
+++ /usr2/hw/misc2/lucid/lemacs-19.6/lisp/vm/vm-summary.el Sun Aug 2 15:33:40 1992
@@ -25,7 +25,8 @@
buffer-read-only t
vm-summary-pointer nil
truncate-lines t)
- (use-local-map vm-mode-map))
+ (use-local-map vm-mode-map)
+ (run-hooks 'vm-summary-mode-hooks))
(put 'vm-summary-mode 'mode-class 'special)
@@ -220,7 +221,7 @@
(defun vm-follow-summary-cursor ()
(and vm-follow-summary-cursor (eq major-mode 'vm-summary-mode)
(let ((point (point))
- message-pointer message-list mp)
+ message-pointer message-list)
(save-excursion
(set-buffer vm-mail-buffer)
(setq message-pointer vm-message-pointer
@@ -260,7 +261,7 @@
sexp sexp-fmt conv-spec last-match-end case-fold-search)
(store-match-data nil)
(while (string-match
-"%\\(-\\)?\\([0-9]+\\)?\\(\\.\\([0-9]+\\)\\)?\\([aAcdfFhilmMnstTwyz*%]\\)"
+"%\\(-\\)?\\([0-9]\\)*\\(\\.\\([0-9]+\\)\\)?\\([aAcdfFhilmMnstTwyz*%]\\)"
format (match-end 0))
(setq conv-spec (aref format (match-beginning 5)))
(if (memq conv-spec '(?a ?A ?c ?d ?f ?F ?h ?i ?l ?M
@@ -642,7 +643,6 @@
names)))
(t (setq names (cons (car list) names))))
(setq list (cdr list)))
- (setq names (nreverse names)) ; added by jwz for fixed vm-parse-addresses
(if vm-gargle-uucp
(while list
(if (string-match
--- vm-vars.el Tue Aug 24 21:31:34 1993
+++ /usr2/hw/misc2/lucid/lemacs-19.6/lisp/vm/vm-vars.el Sun Aug 2 15:33:47 1992
@@ -131,7 +131,7 @@
"*Non-nil value causes VM to remove empty (zero length) folder files
after saving them.")
-(defvar vm-flush-interval t
+(defvar vm-flush-interval 90
"*Non-nil value specifies how often VM flushes its cached internal
data. A numeric value gives the number of seconds between
flushes. A value of t means flush every time there is a change.
@@ -141,7 +141,7 @@
of the change in its internal memory and doesn't insert the
changed data into the folder buffer until a particular message or
the whole folder is saved to disk. This makes normal Emacs
-auto-saving useless for VM folder buffers because the information
+auto-saving useless of VM folder buffers because the information
you'd want to auto-save, i.e. the attribute changes, isn't in
the buffer when it is auto-saved.
@@ -253,7 +253,7 @@
underlying real message.
The value of vm-virtual-mirror is considered only at the time a
-virtual folder is visited. Changing the value of vm-virtual-mirror
+virtaul folder is visited. Changing the value of vm-virtual-mirror
does not affect the behavior of existing virtual folders.")
(defvar vm-folder-read-only nil
@@ -503,6 +503,12 @@
and local variables. Mucking about in the folder buffer is certainly
possible but it is not encouraged.")
+(defvar vm-summary-mode-hooks nil
+ "*List of hook functions to run when a buffer enters vm-summary-mode.
+These hook functions should generally be used to set key bindings
+and local variables. Mucking about in the folder buffer is certainly
+possible but it is not encouraged.")
+
(defvar vm-berkeley-mail-compatibility
(memq system-type '(berkeley-unix))
"*Non-nil means to read and write BSD Mail(1) style Status: headers.
@@ -532,29 +538,44 @@
etc. when started in the usual way.")
(defvar mail-yank-hooks nil
- "Obsolete hook for modifying a citation just inserted in the mail buffer.
-Each hook function can find the citation between (point) and (mark t).
-And each hook function should leave point and mark around the citation
-text as modified.
-
-This is a normal hook, misnamed for historical reasons.
-It is semi-obsolete and mail agents should no longer use it.
-
-If this hook is entirely empty (nil), a default action is taken
-instead of no action.")
-
-(defvar mail-citation-hook nil
- "*Hook for modifying a citation just inserted in the mail buffer.
-Each hook function can find the citation between (point) and (mark t).
-And each hook function should leave point and mark around the citation
-text as modified.
+ "*List of hook functions called after yanking a message into a *mail*
+buffer. See the documentation for the function vm-yank-message for details.")
+
+(defvar vm-show-message-hook nil
+ "*List of hook functions called when a VM message is selected.
+See also vm-preview-message-hook.")
+
+(defvar vm-preview-message-hook nil
+ "*List of hook functions called when a VM message is previewed,
+if and only if vm-preview-lines is non-nil. See also vm-show-message-hook.")
+
+(defvar vm-show-new-message-hook nil
+ "*List of hook functions called when VM selects a new message,
+that is, just after the ``message new'' flag has been set to false.
+
+This is subtly different from the vm-show-unread-message-hook: a `new'
+message is one that has been added to this folder in this session, before
+vm-quit has been executed. An `unread' message is one that has simply
+never been selected before; most likely this is because the message was
+added to the folder by something other than VM.
+
+The vm-show-message-hook will be run immediately after this hook.")
+
+(defvar vm-show-unread-message-hook nil
+ "*List of hook functions called when VM selects a message for the first time,
+that is, just after the ``message new'' flag has been set to false. The
+
+This is subtly different from the vm-show-unread-message-hook: a `new'
+message is one that has been added to this folder in this session, before
+vm-quit has been executed. An `unread' message is one that has simply
+never been selected before; most likely this is because the message was
+added to the folder by something other than VM.
-If this hook is entirely empty (nil), a default action is taken
-instead of no action.")
+vm-show-message-hook will be run immediately after this hook.")
(defvar vm-movemail-program "movemail"
"*Name of program to use to move mail from the system spool
-to another location. Normally this should be the movemail program
+to another location. Normally this shoul be the movemail program
distributed with Emacs.")
(defvar vm-mode-map
@@ -734,22 +755,22 @@
(or (and (boundp 'rmail-spool-directory) rmail-spool-directory)
"/usr/spool/mail/"))
(defconst vm-attributes-header-regexp
- "^X-VM-\\(Attributes\\|v5-Data\\):\\(.*\n\\([ \t].*\n\\)*\\)")
+ "^X-VM-\\(Attributes\\|v5-Data\\):\\(.*\n\\([ \t]+.*\n\\)*\\)")
(defconst vm-attributes-header "X-VM-v5-Data:")
(defconst vm-message-order-header-regexp
- "X-VM-Message-Order:\\(.*\n\\([ \t].*\n\\)*\\)")
+ "X-VM-Message-Order:\\(.*\n\\([ \t]+.*\n\\)*\\)")
(defconst vm-message-order-header "X-VM-Message-Order:")
(defconst vm-bookmark-header-regexp
- "X-VM-Bookmark:\\(.*\n\\([ \t].*\n\\)*\\)")
+ "X-VM-Bookmark:\\(.*\n\\([ \t]+.*\n\\)*\\)")
(defconst vm-bookmark-header "X-VM-Bookmark:")
(defconst vm-vheader-header-regexp
- "X-VM-VHeader:\\(.*\n\\([ \t].*\n\\)*\\)")
+ "X-VM-VHeader:\\(.*\n\\([ \t]+.*\n\\)*\\)")
(defconst vm-vheader-header "X-VM-VHeader:")
(defconst vm-berkeley-mail-status-header "Status: ")
(defconst vm-berkeley-mail-status-header-regexp "^Status: \\(..?\\)\n")
(defconst vm-generic-header-regexp
- "^\\([^: \t\n]+\\)[\t ]*:\\(.*\n\\([ \t].*\n\\)*\\)")
-(defconst vm-header-regexp-format "^%s:[ \t]*\\(.*\\(\n[ \t].*\\)*\\)")
+ "^\\([^: \t\n]+\\)[\t ]*:\\(.*\n\\([ \t]+.*\n\\)*\\)")
+(defconst vm-header-regexp-format "^%s:[ \t]*\\(.*\\(\n[ \t]+.*\\)*\\)")
(defconst vm-supported-groupings-alist
'(("physical-order") ("subject") ("author") ("date-sent") ("recipient")))
(defconst vm-supported-window-configurations
@@ -761,12 +782,11 @@
(defconst vm-attributes-vector-length 9)
(defconst vm-cache-vector-length 16)
(defconst vm-softdata-vector-length 4)
-(defconst vm-location-data-vector-length 4)
-(defconst vm-mirror-data-vector-length 2)
+(defconst vm-virtual-data-vector-length 9)
(defconst vm-startup-message-lines
'("Mail bug reports to bug-vm@uunet.uu.net or post them to gnu.emacs.vm.bug"
"This is prerelease software. Giving out copies of it means DEATH!"
- "See Revelation 6:8 for full details"
+ "See Revelations 6:8 for full details"
"VM comes with ABSOLUTELY NO WARRANTY; type \\[vm-show-no-warranty] for full details"
"In Stereo (where available)"))
; '("Mail bug reports to bug-vm@uunet.uu.net or post them to gnu.emacs.vm.bug"
Technical Details
Message-ID:
<9308251131.AA18833@stigma.key.amdahl.com>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!wendy-fate.uu.net!bug-vmShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6829,1d2cbee2fc146a2d,start X-Google-Attributes: gidf6829,public X-Google-ArrivalTime: 1993-08-25 04:38:59 PST x-gateway: relay2.UU.NET from bug-vm to gnu.emacs.vm.bug; Wed, 25 Aug 1993 07:32:51 EDT Date: Wed, 25 Aug 1993 04:31:53 PDT From: stig@key.amdahl.com (Jonathan Stigelman) Message-ID: <9308251131.AA18833@stigma.key.amdahl.com> Reply-To: Stig@netcom.com (Jonathan Stigelman) Subject: Gack! Insufficient hooks in 5.35 Newsgroups: gnu.emacs.vm.bug Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!wendy-fate.uu.net!bug-vm Sender: bug-vm-request@uunet.uu.net Lines: 297