emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Cc: Bernt Hansen <bernt@norang.ca>
Subject: [PATCH 2/2] Keep window position in agenda when changing todo states
Date: Sat, 14 Jun 2014 10:46:51 -0400	[thread overview]
Message-ID: <1402757211-30510-3-git-send-email-bernt@norang.ca> (raw)
In-Reply-To: <1402757211-30510-1-git-send-email-bernt@norang.ca>

Allow changing task state in agenda without moving point.  I
use this when reviewing projects weekly and I need to change the
state of some of the tasks.  I found jumping to the top of the
agenda after each state change especially annoying when it causes
the agenda to scroll.
---
 lisp/org-agenda.el |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 2d1bafe..d7632b4 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8907,9 +8907,10 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
 	    (org-agenda-highlight-todo 'line)
 	    (beginning-of-line 1))
 	   (t (error "Line update did not work")))
-	  (save-restriction
-	    (narrow-to-region (point-at-bol) (point-at-eol))
-	    (org-agenda-finalize)))
+	  (save-window-excursion
+	    (save-restriction
+	      (narrow-to-region (point-at-bol) (point-at-eol))
+	      (org-agenda-finalize))))
 	(beginning-of-line 0)))))
 
 (defun org-agenda-align-tags (&optional line)
-- 
1.7.9.48.g85da4d

  parent reply	other threads:[~2014-06-14 14:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-14 14:46 Two patches I have been using for 6-12 months Bernt Hansen
2014-06-14 14:46 ` [PATCH 1/2] Remove striction when finding task by id Bernt Hansen
2014-06-14 15:12   ` Nicolas Goaziou
2014-06-14 15:25     ` Bernt Hansen
2014-06-15  2:50       ` [PATCH] Remove restriction when locating markers Bernt Hansen
2014-06-15  7:31         ` Nicolas Goaziou
2014-06-14 14:46 ` Bernt Hansen [this message]
2014-06-14 15:51   ` [PATCH 2/2] Keep window position in agenda when changing todo states Bastien
2014-06-14 17:01     ` Bernt Hansen
2014-06-14 17:45       ` Bernt Hansen
2014-06-15  7:34         ` Bastien

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=1402757211-30510-3-git-send-email-bernt@norang.ca \
    --to=bernt@norang.ca \
    --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).