emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-src: Reset buffer-modified-p after fontifying
@ 2021-10-28 15:24 Clément Pit-Claudel
  2021-11-21  6:58 ` Timothy
  0 siblings, 1 reply; 2+ messages in thread
From: Clément Pit-Claudel @ 2021-10-28 15:24 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]

Hi all,

* lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
modification flag of the temporary fontification buffer after
fontifying.

Without this some modes cause Emacs to prompt about unsaved buffers
when exiting: `Save buffer *org-src-fontification:...-mode*?'

(I'm seeing this with Proof General's coq-mode, specifically.)

Clément.

[-- Attachment #2: 0001-org-src-Reset-buffer-modified-p-after-fontifying.patch --]
[-- Type: text/x-patch, Size: 1129 bytes --]

From 085cc7ae79ff3649dbe9a53bb6a9ca26f30d58f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Pit-Claudel?= <clement.pitclaudel@live.com>
Date: Thu, 28 Oct 2021 11:09:55 -0400
Subject: [PATCH] org-src: Reset buffer-modified-p after fontifying

* lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
modification flag of the temporary fontification buffer after
fontifying.

Without this some modes cause Emacs to prompt about unsaved buffers
when exiting: `Save buffer *org-src-fontification:...-mode*?'
---
 lisp/org-src.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index f1948bfa9..51dde602d 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -642,7 +642,8 @@ org-src-font-lock-fontify-block
 		  (put-text-property
 		   (+ start (1- pos)) (1- (+ start next)) prop new-prop
 		   org-buffer)))
-	      (setq pos next))))
+	      (setq pos next)))
+          (set-buffer-modified-p nil))
 	;; Add Org faces.
 	(let ((src-face (nth 1 (assoc-string lang org-src-block-faces t))))
           (when (or (facep src-face) (listp src-face))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] org-src: Reset buffer-modified-p after fontifying
  2021-10-28 15:24 [PATCH] org-src: Reset buffer-modified-p after fontifying Clément Pit-Claudel
@ 2021-11-21  6:58 ` Timothy
  0 siblings, 0 replies; 2+ messages in thread
From: Timothy @ 2021-11-21  6:58 UTC (permalink / raw)
  To: Clément Pit-Claudel; +Cc: emacs-orgmode


Hi Clément,

I've just had a look at your patch, and it seems very reasonable to me.
Hence, I've just pushed it as ebd06c1 :)

> Hi all,
>
> * lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
> modification flag of the temporary fontification buffer after
> fontifying.
>
> Without this some modes cause Emacs to prompt about unsaved buffers
> when exiting: `Save buffer *org-src-fontification:...-mode*?'
>
> (I'm seeing this with Proof General's coq-mode, specifically.)
>
> Clément.
>
> [2. text/x-patch; 0001-org-src-Reset-buffer-modified-p-after-fontifying.patch]...

--
Timothy


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-21  7:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-28 15:24 [PATCH] org-src: Reset buffer-modified-p after fontifying Clément Pit-Claudel
2021-11-21  6:58 ` Timothy

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).