From: "Valentin Wüstholz" <wuestholz@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: [PATCH] org.el: Preserve indentation of manually indented lines in example blocks.
Date: Mon, 8 Aug 2011 21:48:36 +0200 [thread overview]
Message-ID: <CAPVO5rySYhiirv=0KriY2VJCfnJLr7MMyL60i3kCcRB+XLb1+w@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 319 bytes --]
Hi,
lines in example blocks are currently indented like the surrounding
begin and end delimiters. ¨This works fine unless, you want to indent
some lines manually; in this case, auto-indenting the buffer reverts
the manual indentation. This patch should prevent this from happening.
Best regards,
Valentin
[-- Attachment #2: org.el.patch.txt --]
[-- Type: text/plain, Size: 1047 bytes --]
diff --git a/lisp/org.el b/lisp/org.el
index 11eaf78..428804d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19460,10 +19460,14 @@ If point is in an inline task, mark that task instead."
(save-excursion
(re-search-backward "^[ \t]*#\\+begin_\\([a-z]+\\)" nil t))
(setq column
- (if (equal (downcase (match-string 1)) "src")
- ;; src blocks: let `org-edit-src-exit' handle them
- (org-get-indentation)
- (org-get-indentation (match-string 0)))))
+ (cond ((equal (downcase (match-string 1)) "src")
+ ;; src blocks: let `org-edit-src-exit' handle them
+ (org-get-indentation))
+ ((equal (downcase (match-string 1)) "example")
+ (max (org-get-indentation) (org-get-indentation (match-string 0))))
+ (t
+ (org-get-indentation (match-string 0)))
+ )))
;; This line has nothing special, look at the previous relevant
;; line to compute indentation
(t
next reply other threads:[~2011-08-08 19:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-08 19:48 Valentin Wüstholz [this message]
2011-08-08 20:40 ` [PATCH] org.el: Preserve indentation of manually indented lines in example blocks Nicolas Goaziou
2011-08-08 21:04 ` Valentin Wüstholz
2011-08-08 22:33 ` Nicolas Goaziou
2011-08-09 5:42 ` Valentin Wüstholz
2011-08-09 9:18 ` Nicolas Goaziou
2011-08-09 12:10 ` Valentin Wüstholz
2011-08-09 13:21 ` Nicolas Goaziou
2011-08-09 19:37 ` Valentin Wüstholz
2011-08-10 9:00 ` Nicolas Goaziou
2011-08-16 17:21 ` Bastien
2011-08-16 19:18 ` Bastien
2011-08-16 21:33 ` Valentin Wüstholz
2011-08-17 9:40 ` Bastien
2011-08-17 18:32 ` Valentin Wüstholz
2011-08-18 16:44 ` Bastien
2011-08-26 6:45 ` Valentin Wüstholz
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='CAPVO5rySYhiirv=0KriY2VJCfnJLr7MMyL60i3kCcRB+XLb1+w@mail.gmail.com' \
--to=wuestholz@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).