From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Display inline images patch Date: Mon, 31 May 2010 14:30:32 -0500 Message-ID: <20100531193031.GH2731@thinkpad.adamsinfoserv.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=38046 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJAhH-0004bb-Mx for emacs-orgmode@gnu.org; Mon, 31 May 2010 15:30:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJAhG-0002gV-0B for emacs-orgmode@gnu.org; Mon, 31 May 2010 15:30:51 -0400 Received: from squirtle.drak.net ([72.52.144.201]:53398) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJAhF-0002fs-Rp for emacs-orgmode@gnu.org; Mon, 31 May 2010 15:30:49 -0400 Received: from 206.180.155.43.adsl.hal-pc.org ([206.180.155.43] helo=localhost) by squirtle.drak.net with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1OJAgw-0003zD-97 for emacs-orgmode@gnu.org; Mon, 31 May 2010 14:30:30 -0500 Content-Disposition: inline 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: emacs-orgmode I got irritated by my point jumping to the end of the buffer every time I toggled inline image display, so lets save excursion. ;] $ diff -Narub org.el~ org.el --- org.el~ 2010-05-20 10:12:45.000000000 -0500 +++ org.el 2010-05-31 14:28:21.000000000 -0500 @@ -15489,6 +15489,7 @@ is how it will work for export. When INCLUDE-LINKED is set, also links with a description part will be inlined." (interactive "P") + (save-excursion (org-remove-inline-images) (goto-char (point-min)) (let ((re (concat "\\[\\[\\(file:\\|\\./\\)\\(~?" "[-+./_0-9a-zA-Z]+" @@ -15501,7 +15502,7 @@ (setq ov (make-overlay (match-beginning 0) (match-end 0))) (overlay-put ov 'display (create-image file)) (overlay-put ov 'face 'default) - (push ov org-inline-image-overlays))))) + (push ov org-inline-image-overlays)))))) (defun org-remove-inline-images () "Remove inline display of images." ------------------------------------------------------------------ Russell Adams RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3