From: yamaoka Date: Tue, 27 Feb 2001 05:44:10 +0000 (+0000) Subject: * gnus-art.el (gnus-article-mime-edit-exit): Bind X-Git-Tag: t-gnus-6_15_0-09-quimby~10 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a28f95776dd7485a98b0fbe776931f7a41de91f;p=elisp%2Fgnus.git- * gnus-art.el (gnus-article-mime-edit-exit): Bind `mime-edit-insert-user-agent-field' to nil while `mime-edit-exit' is being done; turn off font-lock first; query if the buffer is modified. (gnus-article-mime-edit-done): New function. (gnus-article-mime-edit-article-setup): Make the window fill its frame; clear the buffere modified flag; substitute key definition `gnus-article-edit-done' with `gnus-article-mime-edit-done'; don't turn off font-lock here; bind `mime-edit-insert-user-agent-field' to nil while `mime-edit-exit' is being done. (gnus-article-mime-edit-article-unwind): Turn off font-lock first. --- diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index e3b3d84..315d5e6 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -2421,7 +2421,7 @@ should replace the \"Date:\" one, or should be added below it." (condition-case () (let ((time (date-to-time date))) (cond - ;; Convert to the local timezone. + ;; Convert to the local timezone. ((eq type 'local) (let ((tz (car (current-time-zone time)))) (format "Date: %s %s%02d%02d" (current-time-string time) @@ -3189,9 +3189,9 @@ If variable `gnus-use-long-file-name' is non-nil, it is ["Decode HZ" gnus-article-decode-HZ t])) ;; Note "Commands" menu is defined in gnus-sum.el for consistency - + (when (boundp 'gnus-summary-post-menu) - (cond + (cond ((not (keymapp gnus-summary-post-menu)) (setq gnus-article-post-menu gnus-summary-post-menu)) ((not gnus-article-post-menu) @@ -4981,7 +4981,7 @@ groups." (setq gnus-prev-winconf winconf) (when gnus-article-edit-article-setup-function (funcall gnus-article-edit-article-setup-function)) - (gnus-message 6 "C-c C-c to end edits"))) + (gnus-message 6 "C-c C-c to end edits; C-c C-k to exit"))) (defun gnus-article-edit-done (&optional arg) "Update the article edits and exit." @@ -5066,12 +5066,12 @@ groups." (defun gnus-article-mime-edit-article-unwind () "Unwind `gnus-article-buffer' if article editing was given up." (remove-hook 'gnus-article-mode-hook 'gnus-article-mime-edit-article-unwind) - (when mime-edit-mode-flag - (mime-edit-exit 'nomime 'no-error) - (message "")) (when (featurep 'font-lock) (setq font-lock-defaults nil) - (font-lock-mode -1))) + (font-lock-mode -1)) + (when mime-edit-mode-flag + (mime-edit-exit 'nomime 'no-error) + (message ""))) (defun gnus-article-mime-edit-article-setup () "Convert current buffer to MIME-Edit buffer and turn on MIME-Edit mode @@ -5080,7 +5080,8 @@ after replacing with the original article." (setq gnus-article-edit-done-function `(lambda (&rest args) (when mime-edit-mode-flag - (mime-edit-exit) + (let (mime-edit-insert-user-agent-field) + (mime-edit-exit)) (message "")) (goto-char (point-min)) (let (case-fold-search) @@ -5088,18 +5089,18 @@ after replacing with the original article." (format "^%s$" (regexp-quote mail-header-separator)) nil t) (replace-match ""))) - (when (featurep 'font-lock) - (setq font-lock-defaults nil) - (font-lock-mode -1)) (apply ,gnus-article-edit-done-function args) - (set-buffer gnus-original-article-buffer) + (set-buffer (get-buffer-create gnus-original-article-buffer)) (erase-buffer) (insert-buffer gnus-article-buffer) (setq gnus-current-headers (gnus-article-make-full-mail-header)) (gnus-article-prepare-display))) - (substitute-key-definition - 'gnus-article-edit-exit 'gnus-article-mime-edit-exit - gnus-article-edit-mode-map) + (substitute-key-definition 'gnus-article-edit-done + 'gnus-article-mime-edit-done + gnus-article-edit-mode-map) + (substitute-key-definition 'gnus-article-edit-exit + 'gnus-article-mime-edit-exit + gnus-article-edit-mode-map) (erase-buffer) (insert-buffer gnus-original-article-buffer) (mime-edit-again) @@ -5108,33 +5109,44 @@ after replacing with the original article." '(message-font-lock-keywords t)) (font-lock-set-defaults) (turn-on-font-lock)) + (set-buffer-modified-p nil) + (delete-other-windows) (add-hook 'gnus-article-mode-hook 'gnus-article-mime-edit-article-unwind) (gnus-run-hooks 'gnus-article-mime-edit-article-setup-hook)) +(defun gnus-article-mime-edit-done (&optional arg) + "Update the article MIME edits and exit." + (interactive "P") + (when (featurep 'font-lock) + (setq font-lock-defaults nil) + (font-lock-mode -1)) + (gnus-article-edit-done arg)) + (defun gnus-article-mime-edit-exit () "Exit the article MIME editing without updating." (interactive) - (let ((winconf gnus-prev-winconf) - buf) + (when (or (not (buffer-modified-p)) + (yes-or-no-p "Article modified; kill anyway? ")) + (when (featurep 'font-lock) + (setq font-lock-defaults nil) + (font-lock-mode -1)) (when mime-edit-mode-flag - (mime-edit-exit) + (let (mime-edit-insert-user-agent-field) + (mime-edit-exit)) (message "")) (goto-char (point-min)) (let (case-fold-search) (when (re-search-forward (format "^%s$" (regexp-quote mail-header-separator)) nil t) (replace-match ""))) - (when (featurep 'font-lock) - (setq font-lock-defaults nil) - (font-lock-mode -1)) - ;; We remove all text props from the article buffer. - (setq buf (buffer-substring-no-properties (point-min) (point-max))) - (set-buffer (get-buffer-create gnus-original-article-buffer)) - (erase-buffer) - (insert buf) - (setq gnus-current-headers (gnus-article-make-full-mail-header)) - (gnus-article-prepare-display) - (set-window-configuration winconf))) + (let ((winconf gnus-prev-winconf)) + (insert (prog1 + (buffer-substring-no-properties (point-min) (point-max)) + (set-buffer (get-buffer-create gnus-original-article-buffer)) + (erase-buffer))) + (setq gnus-current-headers (gnus-article-make-full-mail-header)) + (gnus-article-prepare-display) + (set-window-configuration winconf)))) ;;; ;;; Article highlights