From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/12953 Path: main.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.gnus.general Subject: patch: gnus-art,sum -- No save, if Edit didn't modify buffer Date: 25 Nov 1997 12:32:32 +0200 Message-ID: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: multipart/mixed; boundary="Multipart_Tue_Nov_25_12:32:32_1997-1" Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1035152401 6584 80.91.224.250 (20 Oct 2002 22:20:01 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 22:20:01 +0000 (UTC) Return-Path: Original-Received: from xemacs.org (xemacs.cs.uiuc.edu [128.174.252.16]) by altair.xemacs.org (8.8.8/8.8.8) with ESMTP id EAA05093 for ; Tue, 25 Nov 1997 04:19:59 -0800 Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by xemacs.org (8.8.5/8.8.5) with ESMTP id GAA19740 for ; Tue, 25 Nov 1997 06:19:48 -0600 (CST) Original-Received: from claymore.vcinet.com (claymore.vcinet.com [208.205.12.23]) by ifi.uio.no (8.8.8/8.8.7/ifi0.2) with SMTP id LAA00475 for ; Tue, 25 Nov 1997 11:38:29 +0100 (MET) Original-Received: (qmail 8846 invoked by uid 504); 25 Nov 1997 10:37:42 -0000 Original-Received: (qmail 8843 invoked from network); 25 Nov 1997 10:37:42 -0000 Original-Received: from ns11.nokia.com (131.228.6.230) by claymore.vcinet.com with SMTP; 25 Nov 1997 10:37:41 -0000 Original-Received: from axl01it.ntc.nokia.com (axl01it.ntc.nokia.com [131.228.118.232]) by ns11.nokia.com (8.8.5/8.6.9) with ESMTP id MAA17357 for ; Tue, 25 Nov 1997 12:37:39 +0200 (EET) Original-Received: from zeus.tele.nokia.fi (zeus.tele.nokia.fi [131.228.134.50]) by axl01it.ntc.nokia.com (8.8.5/8.6.9) with SMTP id MAA16792 for ; Tue, 25 Nov 1997 12:32:05 +0200 (EET) Original-Received: from pegasus.tele.nokia.fi (pegasus.ntc.nokia.com [131.228.169.148]) by zeus.tele.nokia.fi (8.6.4/8.6.4) with ESMTP id MAA24924 for ; Tue, 25 Nov 1997 12:33:38 +0200 Original-Received: (from jaalto@localhost) by pegasus.tele.nokia.fi (8.7.5/8.7.1) id MAA09850; Tue, 25 Nov 1997 12:32:32 +0200 (EET) X-My-Info: http://www.netforward.com/poboxes/?jari.aalto http://www.geocities.com/SiliconValley/Bay/2349 Send me subject "send help" to get my mailserver info. Original-To: Ding mailing list Original-Lines: 203 X-Mailer: Quassia Gnus v0.13/Emacs 19.34 Xref: main.gmane.org gmane.emacs.gnus.general:12953 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:12953 --Multipart_Tue_Nov_25_12:32:32_1997-1 Content-Type: text/plain; charset=US-ASCII Hi, - Whwn I edit buffer and I decide that was a mistake, I press C-c C-c to end the edit. - Gnus however writes the buffer back whether the buffer was modified or not. The following patch writes the buffer only if buffer was modified. gnus-sum patch's + marks are mostly due to changed indentation, the changes are in the the `when' statement. jari --Multipart_Tue_Nov_25_12:32:32_1997-1 Content-Type: text/plain; charset=US-ASCII Content-Disposition: attachment; filename="log" Content-Transfer-Encoding: 7bit Tue Nov 25 11:50:16 1997 Jari Aalto * gnus-art.el (gnus-article-edit-article): When going edit mode, clear the buffer modified flag. (gnus-article-edit-exit): Added modified-flag which keeps the modified state of the edit buffer * gnus-sum.el (gnus-summary-edit-article-done): Added `buffer-modified-p' test. Article is not written back to disk if buffer is unmodified. Now uses `when' instead of `if' --Multipart_Tue_Nov_25_12:32:32_1997-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="gnus-art.diff" Content-Transfer-Encoding: 7bit Prereq: 1.1 =================================================================== RCS file: RCS/gnus-art.el,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- 1.1 1997/11/25 09:48:19 +++ 1.2 1997/11/25 10:25:34 @@ -2531,6 +2531,7 @@ (gnus-configure-windows 'edit-article) (setq gnus-article-edit-done-function exit-func) (setq gnus-prev-winconf winconf) + (set-buffer-modified-p nil) (gnus-message 6 "C-c C-c to end edits"))) (defun gnus-article-edit-done (&optional arg) @@ -2552,12 +2553,19 @@ "Exit the article editing without updating." (interactive) ;; We remove all text props from the article buffer. - (let ((buf (format "%s" (buffer-string))) + (let ((modified-flag (buffer-modified-p)) + (buf (format "%s" (buffer-string))) (curbuf (current-buffer)) (p (point)) (window-start (window-start))) (erase-buffer) (insert buf) + + ;; Was the buffer modified before we cleared the properties? + ;; --> preserve previous state. + (when (null modified-flag) + (set-buffer-modified-p nil)) + (let ((winconf gnus-prev-winconf)) (gnus-article-mode) ;; The cache and backlog have to be flushed somewhat. --Multipart_Tue_Nov_25_12:32:32_1997-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="gnus-sum.diff" Content-Transfer-Encoding: 7bit Prereq: 1.1 =================================================================== RCS file: RCS/gnus-sum.el,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- 1.1 1997/11/25 10:21:19 +++ 1.2 1997/11/25 10:25:09 @@ -7241,55 +7241,56 @@ "Make edits to the current article permanent." (interactive) ;; Replace the article. - (if (and (not read-only) - (not (gnus-request-replace-article - (cdr gnus-article-current) (car gnus-article-current) - (current-buffer)))) - (error "Couldn't replace article") - ;; Update the summary buffer. - (if (and references - (equal (message-tokenize-header references " ") - (message-tokenize-header - (or (message-fetch-field "references") "") " "))) - ;; We only have to update this line. - (save-excursion - (save-restriction - (message-narrow-to-head) - (let ((head (buffer-string)) - header) - (nnheader-temp-write nil - (insert (format "211 %d Article retrieved.\n" - (cdr gnus-article-current))) - (insert head) - (insert ".\n") - (let ((nntp-server-buffer (current-buffer))) - (setq header (car (gnus-get-newsgroup-headers - (save-excursion - (set-buffer gnus-summary-buffer) - gnus-newsgroup-dependencies) - t)))) - (save-excursion - (set-buffer gnus-summary-buffer) - (gnus-data-set-header - (gnus-data-find (cdr gnus-article-current)) - header) - (gnus-summary-update-article-line - (cdr gnus-article-current) header)))))) - ;; Update threads. - (set-buffer (or buffer gnus-summary-buffer)) - (gnus-summary-update-article (cdr gnus-article-current))) - ;; Prettify the article buffer again. - (unless no-highlight + (when (buffer-modified-p) ;Changed ? + (if (and (not read-only) + (not (gnus-request-replace-article + (cdr gnus-article-current) (car gnus-article-current) + (current-buffer)))) + (error "Couldn't replace article"))) + ;; Update the summary buffer. + (if (and references + (equal (message-tokenize-header references " ") + (message-tokenize-header + (or (message-fetch-field "references") "") " "))) + ;; We only have to update this line. (save-excursion - (set-buffer gnus-article-buffer) - (run-hooks 'gnus-article-display-hook) - (set-buffer gnus-original-article-buffer) - (gnus-request-article - (cdr gnus-article-current) - (car gnus-article-current) (current-buffer)))) - ;; Prettify the summary buffer line. - (when (gnus-visual-p 'summary-highlight 'highlight) - (run-hooks 'gnus-visual-mark-article-hook)))) + (save-restriction + (message-narrow-to-head) + (let ((head (buffer-string)) + header) + (nnheader-temp-write nil + (insert (format "211 %d Article retrieved.\n" + (cdr gnus-article-current))) + (insert head) + (insert ".\n") + (let ((nntp-server-buffer (current-buffer))) + (setq header (car (gnus-get-newsgroup-headers + (save-excursion + (set-buffer gnus-summary-buffer) + gnus-newsgroup-dependencies) + t)))) + (save-excursion + (set-buffer gnus-summary-buffer) + (gnus-data-set-header + (gnus-data-find (cdr gnus-article-current)) + header) + (gnus-summary-update-article-line + (cdr gnus-article-current) header)))))) + ;; Update threads. + (set-buffer (or buffer gnus-summary-buffer)) + (gnus-summary-update-article (cdr gnus-article-current))) + ;; Prettify the article buffer again. + (unless no-highlight + (save-excursion + (set-buffer gnus-article-buffer) + (run-hooks 'gnus-article-display-hook) + (set-buffer gnus-original-article-buffer) + (gnus-request-article + (cdr gnus-article-current) + (car gnus-article-current) (current-buffer)))) + ;; Prettify the summary buffer line. + (when (gnus-visual-p 'summary-highlight 'highlight) + (run-hooks 'gnus-visual-mark-article-hook))) (defun gnus-summary-edit-wash (key) "Perform editing command in the article buffer." --Multipart_Tue_Nov_25_12:32:32_1997-1--