emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: [PATCH] Recenter around #+begin_src when moving to previous/next code block
Date: Fri, 13 Sep 2013 12:02:29 +0200	[thread overview]
Message-ID: <86wqml3uq2.fsf@somewhere.org> (raw)

Hello,

When moving with C-c C-v C-n (or p) from one code block to the next (or
previous), it's much better if the code block gets centered (vs hidden,
forcing the user to scroll down, as it currently is).

This is the purpose of this easy patch.

Best regards,
  Seb

From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
Date: Fri, 13 Sep 2013 11:56:56 +0200
Subject: [PATCH] Recenter around #+begin_src when moving to previous/next code block

* ob-core.el (org-babel-next-src-block): Recenter after jumping to next code block.
  (org-babel-previous-src-block): Recenter after jumping to previous code block.

---
 lisp/ob-core.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index d57806b..fd4b1bd 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -1748,14 +1748,16 @@ buffer or nil if no such result exists."
   "Jump to the next source block.
 With optional prefix argument ARG, jump forward ARG many source blocks."
   (interactive "p")
-  (org-next-block arg nil org-babel-src-block-regexp))
+  (org-next-block arg nil org-babel-src-block-regexp)
+  (recenter))
 
 ;;;###autoload
 (defun org-babel-previous-src-block (&optional arg)
   "Jump to the previous source block.
 With optional prefix argument ARG, jump backward ARG many source blocks."
   (interactive "p")
-  (org-previous-block arg org-babel-src-block-regexp))
+  (org-previous-block arg org-babel-src-block-regexp)
+  (recenter))
 
 (defvar org-babel-load-languages)
 
-- 
1.7.9

             reply	other threads:[~2013-09-13 10:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 10:02 Sebastien Vauban [this message]
2013-09-15  4:46 ` [PATCH] Recenter around #+begin_src when moving to previous/next code block Carsten Dominik
     [not found]   ` <A29F0253-B563-4C55-9E01-140C253E1760-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-09-15 19:06     ` Sebastien Vauban
2013-09-16  4:06       ` Carsten Dominik

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=86wqml3uq2.fsf@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.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).