From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Miele Subject: Re: [PATCH] Respect buffer-local value of `org-edit-src-content-indentation' Date: Thu, 17 Oct 2019 00:34:56 +0000 Message-ID: <87v9so8b0v.fsf@gmail.com> References: <87eezelxbq.fsf@gmail.com> <87eezdv7h2.fsf@alphapapa.net> Reply-To: sebastian.miele@gmail.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:49056) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKtkr-0004AO-CB for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 20:35:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKtkq-0008KH-8Y for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 20:35:01 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:44001) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKtkq-0008Js-10 for emacs-orgmode@gnu.org; Wed, 16 Oct 2019 20:35:00 -0400 Received: by mail-wr1-x442.google.com with SMTP id j18so255723wrq.10 for ; Wed, 16 Oct 2019 17:34:59 -0700 (PDT) Received: from tisch ([2a02:908:175c:4260:5ffc:7882:6024:ca5b]) by smtp.gmail.com with ESMTPSA id z13sm412263wrq.51.2019.10.16.17.34.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 17:34:56 -0700 (PDT) In-reply-to: <87eezdv7h2.fsf@alphapapa.net> 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 --=-=-= Content-Type: text/plain Hello Adam, Adam Porter writes: > 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. Thank you. Such information is always very welcome. An updated patch is attached to this mail. I also added an ORG-NEWS entry. Best wishes Sebastian --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Respect-buffer-local-value-of-org-edit-src-content-i.patch >From 34eb8882e09701aa12da40510a24c688f4a5ac20 Mon Sep 17 00:00:00 2001 From: Sebastian Miele Date: Wed, 9 Oct 2019 01:00:50 +0000 Subject: [PATCH] Respect buffer-local value of `org-edit-src-content-indentation' * 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. --- etc/ORG-NEWS | 4 ++++ lisp/org-src.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 0e07326cb..b562a0935 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -428,6 +428,10 @@ leave unfolded subtrees unfolded. I.e. treat the whole file as if it was a subtree. *** Respect narrowing when agenda command is restricted to buffer +*** Respect buffer-local value of ~org-edit-src-content-indentation~ + +Use the potentially buffer-local value of `org-edit-src-content-indentation' +from the source buffer instead of that from the editing buffer. * Version 9.2 ** Incompatible changes diff --git a/lisp/org-src.el b/lisp/org-src.el index 9134d5b5d..99841c211 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 + (buffer-local-value 'org-edit-src-content-indentation + (marker-buffer org-src--beg-marker)) 0)))) (use-tabs? (and (> org-src--tab-width 0) t)) (source-tab-width org-src--tab-width) -- 2.23.0 --=-=-=--