emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Recenter around #+begin_src when moving to previous/next code block
@ 2013-09-13 10:02 Sebastien Vauban
  2013-09-15  4:46 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2013-09-13 10:02 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-16  4:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-13 10:02 [PATCH] Recenter around #+begin_src when moving to previous/next code block Sebastien Vauban
2013-09-15  4:46 ` 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

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).