From: Sebastian Miele <sebastian.miele@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Respect buffer-local value of `org-edit-src-content-indentation'
Date: Thu, 17 Oct 2019 00:34:56 +0000 [thread overview]
Message-ID: <87v9so8b0v.fsf@gmail.com> (raw)
In-Reply-To: <87eezdv7h2.fsf@alphapapa.net>
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
Hello Adam,
Adam Porter <adam@alphapapa.net> 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
[-- Attachment #2: 0001-Respect-buffer-local-value-of-org-edit-src-content-i.patch --]
[-- Type: text/plain, Size: 1684 bytes --]
From 34eb8882e09701aa12da40510a24c688f4a5ac20 Mon Sep 17 00:00:00 2001
From: Sebastian Miele <sebastian.miele@gmail.com>
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
next prev parent reply other threads:[~2019-10-17 0:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 23:30 [PATCH] Respect buffer-local value of `org-edit-src-content-indentation' Sebastian Miele
2019-10-16 0:50 ` Adam Porter
2019-10-17 0:34 ` Sebastian Miele [this message]
2019-11-03 21:24 ` Nicolas Goaziou
2019-11-03 22:25 ` Sebastian Miele
2019-11-19 10:39 ` Nicolas Goaziou
2019-11-20 6:12 ` Sebastian Miele
2019-11-20 21:30 ` Nicolas Goaziou
2020-02-12 17:51 ` Bastien
2020-02-12 18:35 ` Sebastian Miele
2020-02-12 19:10 ` Bastien
2020-02-12 19:28 ` Sebastian Miele
2020-02-13 19:31 ` Sebastian Miele
2020-02-14 10:02 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87v9so8b0v.fsf@gmail.com \
--to=sebastian.miele@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).