emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: [PATCH] Adjustment of point in Org-src buffer


From: Dan Davison
Subject: [Orgmode] Re: [PATCH] Adjustment of point in Org-src buffer
Date: Thu, 30 Sep 2010 11:48:16 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Dan Davison <address@hidden> writes:

> Currently, if point is in the #+end_src line, then in the org-src edit
> buffer it goes to the beginning of the last line. There are two patches
> below. Patch 1 changes this so that point goes to the end of the last
> line of code. This gives nicer behaviour when creating an active region
> in the edit buffer. Patch 2 places a save-excursion round this, and gets
> rid of an org-goto-line, so that point in the Org buffer is not affected
> by generating the edit buffer.

These patches have been applied.

>
>
> Patch 1: Adjustment of location of point when generating org-src edit buffer
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> diff --git a/lisp/org-src.el b/lisp/org-src.el
> index 6c4c464..05580d9 100644
> --- a/lisp/org-src.el
> +++ b/lisp/org-src.el
> @@ -211,9 +211,7 @@ buffer."
>    (interactive)
>    (unless (eq context 'save)
>      (setq org-edit-src-saved-temp-window-config 
> (current-window-configuration)))
> -  (let ((line (org-current-line))
> -     (col (current-column))
> -     (mark (and (use-region-p) (mark)))
> +  (let ((mark (and (use-region-p) (mark)))
>       (case-fold-search t)
>       (info (org-edit-src-find-region-and-lang))
>       (babel-info (org-babel-get-src-block-info))
> @@ -223,7 +221,7 @@ buffer."
>       (preserve-indentation org-src-preserve-indentation)
>       (allow-write-back-p (null code))
>       block-nindent total-nindent ovl lang lang-f single lfmt buffer msg
> -     begline markline markcol)
> +     begline markline markcol line col)
>      (if (not info)
>       nil
>        (setq beg (move-marker beg (nth 0 info))
> @@ -254,6 +252,9 @@ buffer."
>                        (org-set-local 'org-edit-src-content-indentation 0))))
>        (unless (functionp lang-f)
>       (error "No such language mode: %s" lang-f))
> +      (if (> (point) end) (goto-char end))
> +      (setq line (org-current-line)
> +         col (current-column))
>        (org-goto-line line)
>        (if (and (setq buffer (org-edit-src-find-buffer beg end))
>              (if org-src-ask-before-returning-to-edit-buffer
>
>
>
> Patch 2: Don't move point when generating org-src edit buffer
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> diff --git a/lisp/org-src.el b/lisp/org-src.el
> index 05580d9..c1d579c 100644
> --- a/lisp/org-src.el
> +++ b/lisp/org-src.el
> @@ -252,10 +252,10 @@ buffer."
>                        (org-set-local 'org-edit-src-content-indentation 0))))
>        (unless (functionp lang-f)
>       (error "No such language mode: %s" lang-f))
> -      (if (> (point) end) (goto-char end))
> -      (setq line (org-current-line)
> -         col (current-column))
> -      (org-goto-line line)
> +      (save-excursion
> +     (if (> (point) end) (goto-char end))
> +     (setq line (org-current-line)
> +           col (current-column)))
>        (if (and (setq buffer (org-edit-src-find-buffer beg end))
>              (if org-src-ask-before-returning-to-edit-buffer
>                  (y-or-n-p "Return to existing edit buffer? [n] will revert 
> changes: ") t))
>
> Dan
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]