emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [patch] org-agenda-goto should push mark before moving point
@ 2010-04-22 20:57 Andreas Seltenreich
  2010-04-23  6:35 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Seltenreich @ 2010-04-22 20:57 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

many commands in Emacs that move the point long distances push the mark
so you can go back using C-u C-<SPC>.  org-agenda-goto doesn't do this,
and I found it a bit annoying that I have to navigate the outline again
to find back to where the point was before using the Agenda.

Patch attached.

regards,
andreas

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index c68038d..9f35069 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6082,6 +6082,7 @@
 	 (pos (marker-position marker)))
     (switch-to-buffer-other-window buffer)
     (widen)
+    (push-mark)
     (goto-char pos)
     (when (org-mode-p)
       (org-show-context 'agenda)

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

* Re: [patch] org-agenda-goto should push mark before moving point
  2010-04-22 20:57 [patch] org-agenda-goto should push mark before moving point Andreas Seltenreich
@ 2010-04-23  6:35 ` Carsten Dominik
  2010-04-23  8:42   ` Andreas Seltenreich
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2010-04-23  6:35 UTC (permalink / raw)
  To: Andreas Seltenreich; +Cc: emacs-orgmode

Hi Andreas,

On Apr 22, 2010, at 10:57 PM, Andreas Seltenreich wrote:

> Hi,
>
> many commands in Emacs that move the point long distances push the  
> mark
> so you can go back using C-u C-<SPC>.  org-agenda-goto doesn't do  
> this,
> and I found it a bit annoying that I have to navigate the outline  
> again
> to find back to where the point was before using the Agenda.
>
> Patch attached.
>
> regards,
> andreas
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index c68038d..9f35069 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -6082,6 +6082,7 @@
> 	 (pos (marker-position marker)))
>     (switch-to-buffer-other-window buffer)
>     (widen)
> +    (push-mark)
>     (goto-char pos)
>     (when (org-mode-p)
>       (org-show-context 'agenda)

I am no sure this is the right thing to do.  Because, often you will  
show *many* places from the agenda before going back to the buffer.   
Org-agenda-goto is called by many other functions like org-agenda- 
show, org-agenda-recenter etc.

This might work better:

(defun my-org-agenda ()
    (interactive)
    (push-mark)
    (call-interactively 'org-agenda))

(define-key global-map "\C-ca" 'my-org-agenda)

Maybe you can test this and report back?

- Carsten

>
>
> _______________________________________________
> 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

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

* Re: [patch] org-agenda-goto should push mark before moving point
  2010-04-23  6:35 ` Carsten Dominik
@ 2010-04-23  8:42   ` Andreas Seltenreich
  2010-04-27 10:00     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Seltenreich @ 2010-04-23  8:42 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik writes:

> On Apr 22, 2010, at 10:57 PM, Andreas Seltenreich wrote:
>>     (switch-to-buffer-other-window buffer)
>>     (widen)
>> +   (push-mark)
>>     (goto-char pos)
>
> I am no sure this is the right thing to do.  Because, often you will
> show *many* places from the agenda before going back to the buffer.
> Org-agenda-goto is called by many other functions like org-agenda- 
> show, org-agenda-recenter etc.

Well, I'd prefer too many marks over too few.  Popping multiple marks
off the local mark ring is still faster than moving point around
manually.

> This might work better:
>
> (defun my-org-agenda ()
>    (interactive)
>    (push-mark)
>    (call-interactively 'org-agenda))
>
> (define-key global-map "\C-ca" 'my-org-agenda)
>
> Maybe you can test this and report back?

Won't work for me since most of the time I don't call the Agenda from
the affected buffers.  I guess advising goto-char and checking the
backtrace for org-agenda-goto isn't a good idea either since goto-char
is a C function...  I'm afraid having git merge along that change
indefinitely is the only option for me as long as I'm the only one
deeming it a good thing.

Thanks,
andreas

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

* Re: [patch] org-agenda-goto should push mark before moving point
  2010-04-23  8:42   ` Andreas Seltenreich
@ 2010-04-27 10:00     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-04-27 10:00 UTC (permalink / raw)
  To: Andreas Seltenreich; +Cc: emacs-orgmode

Hi Andreas,

I have applied your patch.

Thanks.

- Carsten

On Apr 23, 2010, at 10:42 AM, Andreas Seltenreich wrote:

> Carsten Dominik writes:
>
>> On Apr 22, 2010, at 10:57 PM, Andreas Seltenreich wrote:
>>>    (switch-to-buffer-other-window buffer)
>>>    (widen)
>>> +   (push-mark)
>>>    (goto-char pos)
>>
>> I am no sure this is the right thing to do.  Because, often you will
>> show *many* places from the agenda before going back to the buffer.
>> Org-agenda-goto is called by many other functions like org-agenda-
>> show, org-agenda-recenter etc.
>
> Well, I'd prefer too many marks over too few.  Popping multiple marks
> off the local mark ring is still faster than moving point around
> manually.
>
>> This might work better:
>>
>> (defun my-org-agenda ()
>>   (interactive)
>>   (push-mark)
>>   (call-interactively 'org-agenda))
>>
>> (define-key global-map "\C-ca" 'my-org-agenda)
>>
>> Maybe you can test this and report back?
>
> Won't work for me since most of the time I don't call the Agenda from
> the affected buffers.  I guess advising goto-char and checking the
> backtrace for org-agenda-goto isn't a good idea either since goto-char
> is a C function...  I'm afraid having git merge along that change
> indefinitely is the only option for me as long as I'm the only one
> deeming it a good thing.
>
> Thanks,
> andreas

- Carsten

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

end of thread, other threads:[~2010-04-27 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-22 20:57 [patch] org-agenda-goto should push mark before moving point Andreas Seltenreich
2010-04-23  6:35 ` Carsten Dominik
2010-04-23  8:42   ` Andreas Seltenreich
2010-04-27 10:00     ` 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).