From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: [PATCH] Respect buffer-local value of `org-edit-src-content-indentation' Date: Tue, 15 Oct 2019 19:50:49 -0500 Message-ID: <87eezdv7h2.fsf@alphapapa.net> References: <87eezelxbq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:54076) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKXfa-0000Qu-Pu for emacs-orgmode@gnu.org; Tue, 15 Oct 2019 21:00:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKXfZ-0002qt-R0 for emacs-orgmode@gnu.org; Tue, 15 Oct 2019 21:00:06 -0400 Received: from 195-159-176-226.customer.powertech.no ([195.159.176.226]:46148 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iKXfY-0002nT-Vw for emacs-orgmode@gnu.org; Tue, 15 Oct 2019 21:00:05 -0400 Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1iKXfW-000yR4-1n for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 03:00:02 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hi Sebastian, Sebastian Miele writes: > * lisp/org-src.el (org-src--contents-for-write-back): Use the > potentially buffer-local value of `org-edit-src-content-indentation' > from the source buffer instead of that from the editing buffer. > --- > 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 9134d5b5d..b7fe4c0fa 100644 > --- a/lisp/org-src.el > +++ b/lisp/org-src.el > @@ -422,7 +422,8 @@ Assume point is in the corresponding edit buffer." > (if org-src--preserve-indentation 0 > (+ (or org-src--block-indentation 0) > (if (memq org-src--source-type '(example-block src-block)) > - org-edit-src-content-indentation > + (with-current-buffer (marker-buffer org-src--beg-marker) > + org-edit-src-content-indentation) > 0)))) > (use-tabs? (and (> org-src--tab-width 0) t)) > (source-tab-width org-src--tab-width) You might consider using the function buffer-local-value instead of the macro with-current-buffer. Not that it matters so much here, but benchmarking shows that it is much faster when simply accessing the buffer-local value of a variable.