Commit 0143335b authored by Chong Yidong's avatar Chong Yidong
Browse files

Sync with rmailedit.el.

(pmail-edit-current-message): Remove deleted function
parent faa2c8ba
......@@ -38,13 +38,14 @@
(defvar pmail-old-text)
(defvar pmail-edit-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map text-mode-map)
(define-key map "\C-c\C-c" 'pmail-cease-edit)
(define-key map "\C-c\C-]" 'pmail-abort-edit)
"Keymap for `pmail-edit-mode'.")
(defvar pmail-edit-map nil)
(if pmail-edit-map
;; Make a keymap that inherits text-mode-map.
(setq pmail-edit-map (make-sparse-keymap))
(set-keymap-parent pmail-edit-map text-mode-map)
(define-key pmail-edit-map "\C-c\C-c" 'pmail-cease-edit)
(define-key pmail-edit-map "\C-c\C-]" 'pmail-abort-edit))
;; Pmail Edit mode is suitable only for specially formatted data.
(put 'pmail-edit-mode 'mode-class 'special)
......@@ -87,7 +88,7 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
(if (= pmail-total-messages 0)
(error "No messages in this file"))
(make-local-variable 'pmail-old-pruned)
(setq pmail-old-pruned (pmail-msg-is-pruned))
(setq pmail-old-pruned (eq pmail-header-style 'normal))
(make-local-variable 'pmail-edit-saved-coding-system)
(setq pmail-edit-saved-coding-system save-buffer-coding-system)
......@@ -109,18 +110,18 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
(defun pmail-cease-edit ()
"Finish editing message; switch back to Pmail proper."
(when (pmail-summary-exists)
(with-current-buffer pmail-summary-buffer
(if (pmail-summary-exists)
(set-buffer pmail-summary-buffer)
;; Make sure buffer ends with a newline.
(goto-char (point-max))
(when (/= (preceding-char) ?\n)
(insert "\n"))
;; Adjust the marker that points to the end of this message, unless
;; we're at the last message.
(when (< pmail-current-message (length pmail-desc-vector))
(pmail-desc-set-start (1+ pmail-current-message) (point))))
(if (/= (preceding-char) ?\n)
(insert "\n"))
;; Adjust the marker that points to the end of this message.
(set-marker (aref pmail-message-vector (1+ pmail-current-message))
(let ((old pmail-old-text))
......@@ -131,16 +132,26 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
;; As the local value of save-buffer-coding-system is changed by
;; pmail-variables, we restore the original value.
(setq save-buffer-coding-system pmail-edit-saved-coding-system)
(unless (and (= (length old) (- (point-max) (point-min)))
(string= old (buffer-substring (point-min) (point-max))))
(if (and (= (length old) (- (point-max) (point-min)))
(string= old (buffer-substring (point-min) (point-max))))
(setq old nil)
(pmail-set-attribute "edited" t))
(pmail-set-attribute "edited" t)
(if (boundp 'pmail-summary-vector)
(aset pmail-summary-vector (1- pmail-current-message) nil)
(function (lambda ()
(forward-line 2)
(if (looking-at "Summary-line: ")
(let ((buffer-read-only nil))
(delete-region (point)
(progn (forward-line 1)
;; `pmail-show-message' always hides the headers, so we show them
;; here if they were visible before starting the edit.
(when pmail-old-pruned
(pmail-toggle-header (if pmail-old-pruned 1 0))))
(run-hooks 'pmail-mode-hook)
(setq buffer-read-only t))
......@@ -149,7 +160,8 @@ This functions runs the normal hook `pmail-edit-mode-hook'.
(delete-region (point-min) (point-max))
(insert pmail-old-text)
(provide 'pmailedit)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment