emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH] org-src: Reset buffer-modified-p after fontifying
Date: Thu, 28 Oct 2021 11:24:37 -0400	[thread overview]
Message-ID: <2cbf6d37-4622-65ba-5d04-65b47ec1327a@gmail.com> (raw)

[-- 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


             reply	other threads:[~2021-10-28 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-28 15:24 Clément Pit-Claudel [this message]
2021-11-21  6:58 ` [PATCH] org-src: Reset buffer-modified-p after fontifying Timothy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2cbf6d37-4622-65ba-5d04-65b47ec1327a@gmail.com \
    --to=cpitclaudel@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).