* [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
* Re: [PATCH] Recenter around #+begin_src when moving to previous/next code block
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>
0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2013-09-15 4:46 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
Hi Sebastien,
I don't think this patch is the right thing - is feels different from standard Emacs behavior.
- Carsten
On 13.9.2013, at 12:02, Sebastien Vauban <sva-news@mygooglest.com> wrote:
> 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@mygooglest.com>
> 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
>
>
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Recenter around #+begin_src when moving to previous/next code block
[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
0 siblings, 1 reply; 4+ messages in thread
From: Sebastien Vauban @ 2013-09-15 19:06 UTC (permalink / raw)
To: Carsten Dominik; +Cc: emacs-orgmode-mXXj517/zsQ
Hi Carsten,
Carsten Dominik wrote:
>> 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.
>
> I don't think this patch is the right thing - is feels different from
> standard Emacs behavior.
I'm not sure to understand which Emacs behavior we would deviate from? This
is a jump, and it'd be better located at a readable place. Without it, you're
forced to follow 90% of your jumps by a `C-l'...
And isn't it very similar to the patch I sent earlier this week regarding the
recenter after the jump with `C-c C-x C-j'? I'd more easily understand that
both are either accepted or rejected, but not a mixed case.
Anyway, I'm not bothered if it's not in Org, I can simply defadvice the
functions (the `after' case). So I respect your decision, even if it puzzles
me: it's just that having to manually recenter after almost all jumps do not
feel like a right behavior of Org to me, for the beginners who can't make such
defadvice on their own.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Recenter around #+begin_src when moving to previous/next code block
2013-09-15 19:06 ` Sebastien Vauban
@ 2013-09-16 4:06 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2013-09-16 4:06 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
On 15.9.2013, at 21:06, Sebastien Vauban <sva-news@mygooglest.com> wrote:
> Hi Carsten,
>
> Carsten Dominik wrote:
>>> 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.
>>
>> I don't think this patch is the right thing - is feels different from
>> standard Emacs behavior.
>
> I'm not sure to understand which Emacs behavior we would deviate from? This
> is a jump, and it'd be better located at a readable place. Without it, you're
> forced to follow 90% of your jumps by a `C-l'...
>
> And isn't it very similar to the patch I sent earlier this week regarding the
> recenter after the jump with `C-c C-x C-j'? I'd more easily understand that
> both are either accepted or rejected, but not a mixed case.
I think the difference is the following:
org-clock-goto is a jump to a specific location and can be
expected to be far away, so it is OK to recenter the screen.
org-babel-next-src-block is more like forward paragraph, or
like a forward search. It is possible that there are several
src blocks on a page. Only moving the window content when
necessary gives a better sense of space and location. This is
why such commands in Emacs only scroll when the target position
is off screen.
Regards
- Carsten
>
> Anyway, I'm not bothered if it's not in Org, I can simply defadvice the
> functions (the `after' case). So I respect your decision, even if it puzzles
> me: it's just that having to manually recenter after almost all jumps do not
> feel like a right behavior of Org to me, for the beginners who can't make such
> defadvice on their own.
>
> Best regards,
> Seb
>
> --
> Sebastien Vauban
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.