Article View: gnu.emacs.vm.bug
Article #9292Re: deleting and refiling lossage
From: Jerry
Date: Sat, 28 Dec 1991 03:09
Date: Sat, 28 Dec 1991 03:09
121 lines
5635 bytes
5635 bytes
Jamie Zawinski writes:
*> Well I don't know what's going on, because it honest-to-god is for me.
*> I marked a message for deletion, and executed vm-save-message, copying
*> it to a folder that did not yet exist. I visited that file as a normal
*> file, and the VM-data had a `t' in the third slot. When I killed the
*> buffer and visited it as a folder, the message was marked for deletion.
*> I evaluated the definition of vm-save-message from the vm source before
*> doing this, just to make sure it wasn't getting redefined from somewhere
*> else.
*> -- Jamie
Beats me. Here's the (standard ?) version of vm-save-message I'm using:
------------------------ 8< Cut here 8< --------------------------------
(defun vm-save-message (folder &optional count)
"Save the current message to a mail folder.
If the folder already exists, the message will be appended to it.
Prefix arg COUNT means save the next COUNT messages. A negative COUNT means
save the previous COUNT messages.
When invoked on marked messages (via vm-next-command-uses-marks),
all marked message in the current folder are saved; other messages are
ignored.
The saved messages are flagged as `filed'."
(interactive
(list
;; protect value of last-command
(let ((last-command last-command))
(vm-follow-summary-cursor)
(let ((default (save-excursion
(vm-select-folder-buffer)
(vm-check-for-killed-summary)
(or (vm-auto-select-folder vm-message-pointer
vm-auto-folder-alist)
vm-last-save-folder)))
(dir (or vm-folder-directory default-directory)))
(if default
(read-file-name (format "Save in folder: (default %s) "
default)
dir default nil )
(read-file-name "Save in folder: " dir nil nil))))
(prefix-numeric-value current-prefix-arg)))
(let (unexpanded-folder)
(setq unexpanded-folder folder)
(vm-select-folder-buffer)
(vm-check-for-killed-summary)
(vm-error-if-folder-empty)
(or count (setq count 1))
;; Expand the filename, forcing relative paths to resolve
;; into the folder directory.
(let ((default-directory
(expand-file-name (or vm-folder-directory default-directory))))
(setq folder (expand-file-name folder)))
;; Confirm new folders, if the user requested this.
(if (and vm-confirm-new-folders (interactive-p)
(not (file-exists-p folder))
(or (not vm-visit-when-saving) (not (get-file-buffer folder)))
(not (y-or-n-p (format "%s does not exist, save there anyway? "
folder))))
(error "Save aborted"))
;; Check and see if we are currently visiting the folder
;; that the user wants to save to.
(if (and (not vm-visit-when-saving) (get-file-buffer folder))
(error "Folder %s is being visited, cannot save." folder))
(let ((mlist (vm-select-marked-or-prefixed-messages count))
folder-buffer)
(cond ((eq vm-visit-when-saving t)
(setq folder-buffer (or (get-file-buffer folder)
(find-file-noselect folder))))
(vm-visit-when-saving
(setq folder-buffer (get-file-buffer folder))))
(save-excursion
(while mlist
(set-buffer (marker-buffer (vm-start-of (car mlist))))
(vm-save-restriction
(widen)
(if (vm-modflag-of (car mlist))
(vm-stuff-attributes (car mlist) t))
(if (null folder-buffer)
(write-region (vm-start-of (car mlist))
(vm-end-of (car mlist))
folder t 'quiet)
(let ((start (vm-start-of (car mlist)))
(end (vm-end-of (car mlist))))
(save-excursion
(set-buffer folder-buffer)
(let (buffer-read-only)
(vm-save-restriction
(widen)
(save-excursion
(goto-char (point-max))
(insert-buffer-substring
(marker-buffer (vm-start-of (car mlist)))
start end))
;; vars should exist and be local
;; but they may have strange values
(cond ((eq major-mode 'vm-mode)
(vm-increment vm-messages-not-on-disk)
(vm-set-buffer-modified-p (buffer-modified-p))
(vm-clear-modification-flag-undos))))))))
(if (null (vm-filed-flag (car mlist)))
(vm-set-filed-flag (car mlist) t))
(setq mlist (cdr mlist)))))
(if folder-buffer
(progn
(save-excursion
(set-buffer folder-buffer)
(if (eq major-mode 'vm-mode)
(let (buffer-read-only)
(vm-check-for-killed-summary)
(vm-assimilate-new-messages)
(vm-update-summary-and-mode-line))))
(message "Message%s saved to buffer %s" (if (/= 1 count) "s" "")
(buffer-name folder-buffer)))
(message "Message%s saved to %s" (if (/= 1 count) "s" "") folder)))
(setq vm-last-save-folder unexpanded-folder)
(if vm-delete-after-saving
(vm-delete-message count))
(vm-update-summary-and-mode-line)))
Technical Details
Message-ID:
<9112280309.AA04266@banach.math.ep.utexas.edu>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!wendy-fate.uu.net!bug-vmReferences:
<9112250012.AA04973@thalidomide.lucid> <9112271804.AA23514@wendy-fate.UU.NET> <9112272142.AA08538@thalidomide.lucid> <9112272152.AA25102@wendy-fate.UU.NET> <9112280233.AA04182@banach.math.ep.utexas.edu> <9112280245.AA09412@thalidomide.lucid>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f6829,4288f8034bad826d X-Google-Attributes: gidf6829,public X-Google-ArrivalTime: 1991-12-27 21:22:04 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!wendy-fate.uu.net!bug-vm From: jerry@math.ep.utexas.edu (Jerry) Newsgroups: gnu.emacs.vm.bug Subject: Re: deleting and refiling lossage Message-ID: <9112280309.AA04266@banach.math.ep.utexas.edu> Date: 28 Dec 91 03:09:05 GMT References: <9112250012.AA04973@thalidomide.lucid> <9112271804.AA23514@wendy-fate.UU.NET> <9112272142.AA08538@thalidomide.lucid> <9112272152.AA25102@wendy-fate.UU.NET> <9112280233.AA04182@banach.math.ep.utexas.edu> <9112280245.AA09412@thalidomide.lucid> Sender: bug-vm-request@uunet.uu.net Lines: 121