From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Pohlack Subject: [PATCH] add modification hook for inline images Date: Wed, 02 Jun 2010 01:10:35 +0200 Message-ID: <4C05936B.5030403@os.inf.tu-dresden.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090000020207000907050908" Return-path: Received: from [140.186.70.92] (port=46067 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJabY-0004Jo-Sk for emacs-orgmode@gnu.org; Tue, 01 Jun 2010 19:10:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJabX-00029Z-Tu for emacs-orgmode@gnu.org; Tue, 01 Jun 2010 19:10:40 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:57040) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJabX-00029C-N6 for emacs-orgmode@gnu.org; Tue, 01 Jun 2010 19:10:39 -0400 Received: from [84.179.186.83] (helo=[192.168.2.108]) by os.inf.tu-dresden.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.71) id 1OJabU-0006DX-Ty for emacs-orgmode@gnu.org; Wed, 02 Jun 2010 01:10:37 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode This is a multi-part message in MIME format. --------------090000020207000907050908 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 --------------090000020207000907050908 Content-Type: text/plain; name="inline-display-modification-hook.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="inline-display-modification-hook.diff" 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) --------------090000020207000907050908 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --------------090000020207000907050908--