emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Dan Davison <davison@stats.ox.ac.uk>
Cc: emacs org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Avoid leaving point inside hidden block
Date: Tue, 23 Mar 2010 16:01:26 +0100	[thread overview]
Message-ID: <E7F9CD77-648A-4205-BE82-120C792403DF@gmail.com> (raw)
In-Reply-To: <87eijb6sgn.fsf@stats.ox.ac.uk>

Hi Dan,

please go ahead and apply it to the master branch.

Thanks

- Carsten

On Mar 23, 2010, at 3:08 PM, Dan Davison wrote:

> If you
>
> 1. fold a code block
> 2. place point at the beginning of the #begin_src line
> 3. switch to the edit buffer using C-c '
> 4. exit the edit buffer with C-c '
>
> point will not return to where it started but instead be by the ...,
> reflecting the fact that it returned to a buffer position that is not
> visible. This patch returns point to the beginning of the begin_src  
> line
> when the block is folded. (overlay-querying code borrowed from
> org-hide-block-toggle)
>
> Dan
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/org-src.el b/lisp/org-src.el
> index 0cebcd1..bc71a92 100644
> --- a/lisp/org-src.el
> +++ b/lisp/org-src.el
> @@ -592,8 +592,15 @@ the language, a switch telling if the content  
> should be in a single line."
>     (insert code)
>     (goto-char beg)
>     (if single (just-one-space))
> -    (org-goto-line (1- (+ (org-current-line) line)))
> -    (org-move-to-column (if preserve-indentation col (+ col total- 
> nindent delta)))
> +    (if (memq t (mapcar (lambda (overlay)
> +                         (eq (org-overlay-get overlay 'invisible)
> +                             'org-hide-block))
> +                       (org-overlays-at (point))))
> +       ;; Block is hidden; put point at start of block
> +       (beginning-of-line 0)
> +      ;; Block is visible, put point where it was in the code buffer
> +      (org-goto-line (1- (+ (org-current-line) line)))
> +      (org-move-to-column (if preserve-indentation col (+ col total- 
> nindent delta))))
>     (move-marker beg nil)
>     (move-marker end nil))
>   (unless (eq context 'save)
> --8<---------------cut here---------------end--------------->8---
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

      reply	other threads:[~2010-03-23 15:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-23 14:08 [PATCH] Avoid leaving point inside hidden block Dan Davison
2010-03-23 15:01 ` Carsten Dominik [this message]

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=E7F9CD77-648A-4205-BE82-120C792403DF@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=davison@stats.ox.ac.uk \
    --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).