From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Saving the *Org Edit Src Example* buffer Date: Tue, 02 Jun 2009 11:02:52 -0400 Message-ID: <873aain0f7.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MBVW3-0003T8-6P for emacs-orgmode@gnu.org; Tue, 02 Jun 2009 11:03:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MBVVx-0003Lj-NZ for emacs-orgmode@gnu.org; Tue, 02 Jun 2009 11:03:02 -0400 Received: from [199.232.76.173] (port=60919 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MBVVx-0003LV-Km for emacs-orgmode@gnu.org; Tue, 02 Jun 2009 11:02:57 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:44167) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MBVVw-000380-Q5 for emacs-orgmode@gnu.org; Tue, 02 Jun 2009 11:02:57 -0400 Received: from blackcap.stats.ox.ac.uk (blackcap.stats [163.1.210.5]) by markov.stats.ox.ac.uk (8.13.6/8.13.6) with ESMTP id n52F2snu020429 for ; Tue, 2 Jun 2009 16:02:54 +0100 (BST) 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 org-mode mailing list Following on from the recent improvements to the *Org Edit Src Example* buffer, I have one more proposal: I have remapped C-x C-s so that it saves the code in the org buffer, rather than offering to save the Edit buffer itself (as it used to be with the indirect edit buffer). I find this essential, although I recognise that remapping C-x C-s is a rather radical thing to do to an emacs buffer. I am using the simple-minded approach below; it seems to work fine (I don't even notice a flicker -- should I be surprised at that?), but if someone can suggest an improved implementation I'd be happy to learn how it should be done (perhaps there are buffer variables other than point and mark that I should restore? Is there a general mechanism I should use for this?). Dan (defun org-edit-src-save () "Update the parent org buffer with the edited source code, save the parent org-buffer, and return to the source code edit buffer." (interactive) (let ((p (point)) (m (mark))) (org-edit-src-exit) (save-buffer) (org-edit-src-code) (set-mark m) (goto-char p))) (define-key org-exit-edit-mode-map "\C-x\C-s" 'org-edit-src-save)