+2005-03-07 Yoichi NAKAYAMA <yoichi@geiin.org>
+
+ * elmo.el (message-number-changed): Define new signal.
+ * elmo-dop.el (elmo-folder-append-buffer-dop-delayed): Emit
+ message-number-changed signal.
+ * elmo-localdir.el (elmo-folder-pack-numbers): Ditto.
+ * elmo-map.el (elmo-folder-pack-numbers): Ditto.
+ Respect `elmo-pack-number-check-strict'.
+
2005-03-06 Yoichi NAKAYAMA <yoichi@geiin.org>
* elmo-signal.el (elmo-connect-signal): Document.
(t
(list flag)))))
(when (or (condition-case nil
- (elmo-folder-append-buffer folder flags set-number)
+ (let ((new-num (elmo-folder-next-message-number folder)))
+ (prog1
+ (elmo-folder-append-buffer folder flags set-number)
+ (elmo-emit-signal 'message-number-changed
+ folder (- number) new-num)))
(error))
;; Append failed...
(elmo-folder-append-buffer
(elmo-message-entity-set-number entity new-number))
(elmo-msgdb-append-entity new-msgdb entity
(elmo-msgdb-flags msgdb old-number))
+ (elmo-emit-signal 'message-number-changed folder old-number new-number)
(setq new-number (1+ new-number))))
(message "Packing...done")
(elmo-folder-set-msgdb-internal folder new-msgdb)))
(luna-define-method elmo-folder-pack-numbers ((folder elmo-map-folder))
(let* ((msgdb (elmo-folder-msgdb folder))
- (numbers (sort (elmo-folder-list-messages folder nil 'in-msgdb) '<))
+ (numbers
+ (sort (elmo-folder-list-messages folder nil
+ (not elmo-pack-number-check-strict))
+ '<))
(new-msgdb (elmo-make-msgdb (elmo-folder-msgdb-path folder)))
(number 1)
total location entity)
(cons (cons number
(elmo-map-message-location folder old-number))
location))
+ (elmo-emit-signal 'message-number-changed folder old-number number)
(setq number (1+ number))))
(message "Packing...done")
(elmo-map-folder-location-setup folder (nreverse location))
(elmo-define-signal update-overview (number)
"Notify update overview of the message with NUMBER.")
+(elmo-define-signal message-number-changed (old-number new-number)
+ "Notify change of message number within the folder.")
+
;; autoloads
(eval-and-compile
(autoload 'md5 "md5")
+2005-03-07 Yoichi NAKAYAMA <yoichi@geiin.org>
+
+ * wl-draft.el (wl-draft-config-info-filename): Extracted from
+ `wl-draft-config-info-operation'.
+ (wl-draft-buffer-change-number): New function.
+ (wl-draft-rename-saved-config): Ditto.
+ * wl.el (wl-init): Connect slot for message-number-changed.
+ (toplevel): Add autoload for wl-draft-rename-saved-config.
+
2005-03-05 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* wl-summary.el (wl-summary-buffer-attach): Connect to signal
(goto-char (point-max))
(insert (concat field ": " content "\n"))))))))
+(defsubst wl-draft-config-info-filename (number msgdb-dir)
+ (expand-file-name
+ (format "%s-%d" wl-draft-config-save-filename number)
+ msgdb-dir))
+
(defun wl-draft-config-info-operation (msg operation)
(let* ((msgdb-dir (elmo-folder-msgdb-path (wl-draft-get-folder)))
- (filename
- (expand-file-name
- (format "%s-%d" wl-draft-config-save-filename msg)
- msgdb-dir))
+ (filename (wl-draft-config-info-filename msg msgdb-dir))
element alist variable)
(cond
((eq operation 'save)
(setq wl-draft-parent-flag flag)
(wl-draft-config-info-operation wl-draft-buffer-message-number 'save)))
+(defun wl-draft-buffer-change-number (old-number new-number)
+ (when (eq wl-draft-buffer-message-number old-number)
+ (setq wl-draft-buffer-message-number new-number)
+ (rename-buffer (format "%s/%d" wl-draft-folder new-number))
+ (setq buffer-file-name (buffer-name))
+ (set-buffer-modified-p nil)))
+
+(defun wl-draft-rename-saved-config (old-number new-number)
+ (let* ((msgdb-dir (elmo-folder-msgdb-path (wl-draft-get-folder)))
+ (old-name (wl-draft-config-info-filename old-number msgdb-dir))
+ (new-name (wl-draft-config-info-filename new-number msgdb-dir)))
+ (when (file-exists-p old-name)
+ (rename-file old-name new-name 'ok-if-already-exists))))
+
(require 'product)
(product-provide (provide 'wl-draft) (require 'wl-version))
(nth 1 spec)))
(setq elmo-no-from wl-summary-no-from-message)
(setq elmo-no-subject wl-summary-no-subject-message)
+ (elmo-connect-signal
+ nil
+ 'message-number-changed
+ 'wl-draft
+ (elmo-define-signal-handler (listener folder old-number new-number)
+ (dolist (buffer (wl-collect-draft))
+ (with-current-buffer buffer
+ (wl-draft-buffer-change-number old-number new-number)))
+ (wl-draft-rename-saved-config old-number new-number))
+ (elmo-define-signal-filter (listener folder old-number new-number)
+ (and folder
+ (string= (elmo-folder-name-internal folder) wl-draft-folder))))
(wl-news-check)
(setq wl-init t)
;; This hook may contain the functions `wl-plugged-init-icons' and
wl-score-change-score-file wl-score-edit-current-scores
wl-score-edit-file wl-score-flush-cache wl-summary-rescore
wl-score-set-mark-below wl-score-set-expunge-below
- wl-summary-increase-score wl-summary-lower-score ))))
+ wl-summary-increase-score wl-summary-lower-score )
+ ("wl-draft" wl-draft-rename-saved-config))))
;; for backward compatibility
(defalias 'wl-summary-from-func-petname 'wl-summary-default-from)