From: Martin Pohlack <mp26@os.inf.tu-dresden.de>
To: org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] add modification hook for inline images
Date: Wed, 02 Jun 2010 01:10:35 +0200 [thread overview]
Message-ID: <4C05936B.5030403@os.inf.tu-dresden.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 185 bytes --]
Hi,
this patch adds a modification hook to remove inline-image overlays if
the underlying text is modified. This prevents blind editing of text
behind images.
Cheers,
Martin Pohlack
[-- Attachment #2: inline-display-modification-hook.diff --]
[-- Type: text/plain, Size: 816 bytes --]
diff --git a/lisp/org.el b/lisp/org.el
index 62131be..5a00236 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15565,8 +15565,17 @@ BEG and END default to the buffer boundaries."
(overlay-put ov 'display img)
(overlay-put ov 'face 'default)
(overlay-put ov 'org-image-overlay t)
+ (overlay-put ov 'modification-hooks
+ (list 'org-display-inline-modification-hook))
(push ov org-inline-image-overlays)))))))))
+(defun org-display-inline-modification-hook (ov after beg end &optional len)
+ "Remove inline-display overlay if a corresponding region is modified."
+ (let ((inhibit-modification-hooks t))
+ (when (and ov after)
+ (delete ov org-inline-image-overlays)
+ (delete-overlay ov))))
+
(defun org-remove-inline-images ()
"Remove inline display of images."
(interactive)
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
reply other threads:[~2010-06-01 23:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C05936B.5030403@os.inf.tu-dresden.de \
--to=mp26@os.inf.tu-dresden.de \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.