🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.vm.bug
Article #9637

Re: vm-do-reply squashes my key definitions (a patch)

#9637
From: Mike Williams
Date: Wed, 10 Apr 1991 13:31
139 lines
6682 bytes
>>> On 9 Apr 91 14:30:24 GMT,
>>> "David" == davide%cadillac.cad.mcc.com@mcc.com (David Eckelkamp) writes:

David> In VM-5.31(beta) I think there is a problem with vm-do-reply.  I
David> believe there needs to be another hook akin to mail-setup-hook because
David> VM sets some keys in the local map *after* vm-mail-internal runs the
David> mail-setup-hook.  This keeps me from being able to rebind \C-c\C-c and
David> such.  This new hook should probably be run after the 
David> "(if include-text ...)" form, IMHO.

    I _also_ wanted to change some of the key-bindings in mail-mode (in
  particular, binding C-c C-s to mail-signature), and found that VM was
  messing them up.  The problem is in vm-reply.el, where the key-rebinding
  code is duplicated in five places (not just in vm-do-reply, but also in
  vm-forward-message, vm-mail, vm-resend-bounced-message and
  vm-send-digest).  Each time it's done *after* mail-setup-hook is run
  (mail-setup-hook is called in vm-mail-internal). 

    My solution was pull the duplicated key-binding code into
  vm-mail-internal, before the call to mail-setup-hook.  Thus,
  mail-setup-hook can contain your own key redefinitions (which isn't
  strictly the right place for them, but it works). 

  [ Kyle, is there any chance of including this patch in the next release?
    I'm pretty sure it doesn't break anything. ]

  Patch (to VM 5.31b) follows ...

--- CUT HERE --------------------------------------------------------------
*** vm-reply.el-dist	Wed Apr  3 08:29:13 1991
--- vm-reply.el	Wed Apr  3 08:36:19 1991
***************
*** 103,114 ****
         (format "reply to %s%s" (vm-su-full-name (car mlist))
  	       (if (cdr mlist) ", ..." ""))
         to subject in-reply-to cc references newsgroups)
-       (use-local-map (copy-keymap (current-local-map)))
-       (local-set-key "\C-c\C-y" 'vm-yank-message)
-       (local-set-key "\C-cy" 'vm-yank-message-other-folder)
-       (local-set-key "\C-c\C-s" 'vm-mail-send)
-       (local-set-key "\C-c\C-c" 'vm-mail-send-and-exit)
-       (local-set-key "\C-c\C-v" vm-mode-map)
        (make-local-variable 'vm-reply-list)
        (setq vm-mail-buffer mail-buffer
  	    vm-system-state 'replying
--- 103,108 ----
***************
*** 413,424 ****
  	 (and vm-forwarding-subject-format
  	      (vm-sprintf 'vm-forwarding-subject-format
  			  (car mp))))
- 	(use-local-map (copy-keymap (current-local-map)))
- 	(local-set-key "\C-c\C-y" 'vm-yank-message)
- 	(local-set-key "\C-cy" 'vm-yank-message-other-folder)
- 	(local-set-key "\C-c\C-s" 'vm-mail-send)
- 	(local-set-key "\C-c\C-c" 'vm-mail-send-and-exit)
- 	(local-set-key "\C-c\C-v" vm-mode-map)
  	(make-local-variable 'vm-forward-list)
  	(setq vm-mail-buffer b
  	      vm-system-state 'forwarding
--- 407,412 ----
***************
*** 451,465 ****
    (let ((mail-buffer (if (memq major-mode '(vm-mode vm-virtual-mode))
  			 (current-buffer))))
      (vm-mail-internal)
!     (if (null mail-buffer)
! 	()
!       (use-local-map (copy-keymap (current-local-map)))
!       (local-set-key "\C-c\C-y" 'vm-yank-message)
!       (local-set-key "\C-c\C-v" vm-mode-map)
!       (setq vm-mail-buffer mail-buffer))
!     (local-set-key "\C-c\C-s" 'vm-mail-send)
!     (local-set-key "\C-c\C-c" 'vm-mail-send-and-exit)
!     (local-set-key "\C-cy" 'vm-yank-message-other-folder)))
  
  (defun vm-mail-internal
       (&optional buffer-name to subject in-reply-to cc references newsgroups)
--- 439,445 ----
    (let ((mail-buffer (if (memq major-mode '(vm-mode vm-virtual-mode))
  			 (current-buffer))))
      (vm-mail-internal)
!     (if mail-buffer (setq vm-mail-buffer mail-buffer))))
  
  (defun vm-mail-internal
       (&optional buffer-name to subject in-reply-to cc references newsgroups)
***************
*** 489,494 ****
--- 469,481 ----
        (goto-char (point-max))
      (goto-char (point-min))
      (end-of-line))
+   (if (and (boundp 'mail-buffer) (null mail-buffer)) nil
+     (use-local-map (copy-keymap (current-local-map)))
+     (local-set-key "\C-c\C-y" 'vm-yank-message)
+     (local-set-key "\C-cy" 'vm-yank-message-other-folder))
+   (local-set-key "\C-c\C-s" 'vm-mail-send)
+   (local-set-key "\C-c\C-c" 'vm-mail-send-and-exit)
+   (local-set-key "\C-c\C-v" vm-mode-map)
    (run-hooks 'mail-setup-hook))
  
  (defun vm-resend-bounced-message ()
***************
*** 530,541 ****
  	(vm-mail-internal
  	 (format "retry of %s:%s" (buffer-name)
  		 (vm-number-of (car vm-message-pointer))))
- 	(use-local-map (copy-keymap (current-local-map)))
- 	(local-set-key "\C-c\C-y" 'vm-yank-message)
- 	(local-set-key "\C-cy" 'vm-yank-message-other-folder)
- 	(local-set-key "\C-c\C-s" 'vm-mail-send)
- 	(local-set-key "\C-c\C-c" 'vm-mail-send-and-exit)
- 	(local-set-key "\C-c\C-v" vm-mode-map)
  	(goto-char (point-min))
  	(insert-buffer-substring b start lim)
  	(delete-region (point) (point-max))
--- 517,522 ----
***************
*** 658,669 ****
      (save-restriction
        (widen)
        (vm-mail-internal (format "digest from %s" (buffer-name)))
-       (use-local-map (copy-keymap (current-local-map)))
-       (local-set-key "\C-c\C-y" 'vm-yank-message)
-       (local-set-key "\C-cy" 'vm-yank-message-other-folder)
-       (local-set-key "\C-c\C-s" 'vm-mail-send)
-       (local-set-key "\C-c\C-c" 'vm-mail-send-and-exit)
-       (local-set-key "\C-c\C-v" vm-mode-map)
        (make-local-variable 'vm-forward-list)
        (setq vm-mail-buffer b
  	    vm-message-pointer mp
--- 639,644 ----
--
    /-------------------- mike-w@cs.aukuni.ac.nz ---------------------\
    | Mike Williams, Computer Science, Auckland University, Aotearoa. |
    \-------------- What's another word for Thesaurus? ---------------/
-- 
New administrater uofa.
Technical Details
Message-ID: <MIKE-W.91Apr10093141@cs17.cs.aukuni.ac.nz>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!mike-w
References: <9104091430.AA11416@maverick.cad.mcc.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6829,1a14710b4018c105
X-Google-Attributes: gidf6829,public
X-Google-ArrivalTime: 1991-04-09 17:54:00 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!comp.vuw.ac.nz!waikato.ac.nz!aukuni.ac.nz!mike-w
From: mike-w@cs.aukuni.ac.nz (Mike Williams)
Newsgroups: gnu.emacs.vm.bug
Subject: Re: vm-do-reply squashes my key definitions (a patch)
Message-ID: <MIKE-W.91Apr10093141@cs17.cs.aukuni.ac.nz>
Date: 10 Apr 91 13:31:41 GMT
References: <9104091430.AA11416@maverick.cad.mcc.com>
Sender: news@ccu1.aukuni.ac.nz (News Owner)
Organization: Dept. of Computer Science, Auckland Uni., New Zealand
Lines: 139
In-Reply-To: davide%cadillac.cad.mcc.com@mcc.com's message of 9 Apr 91 14:30:24 GMT
Nntp-Posting-Host: aucs17.cs.aukuni.ac.nz
X-News-Software: GNUS 3.13