From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: Re: odd behaviour in a function - looking for advice Date: Fri, 17 Jun 2011 07:26:56 +0530 Message-ID: <81y611kyon.fsf@gmail.com> References: <8139j9mdr0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:48315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXOJE-0001t4-Ap for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 21:57:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXOJC-0006GD-Qp for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 21:57:20 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:42340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXOJC-0006G2-BA for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 21:57:18 -0400 Received: by pzk4 with SMTP id 4so1766356pzk.0 for ; Thu, 16 Jun 2011 18:57:16 -0700 (PDT) In-Reply-To: <8139j9mdr0.fsf@gmail.com> (Jambunathan K.'s message of "Fri, 17 Jun 2011 07:16:11 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Filippo A. Salustri" Cc: emacs-orgmode mailing list Jambunathan K writes: > "Filippo A. Salustri" writes: > >> Hi all, >> >> I've got this function: >> >> (defun fas/org-priority (&optional p) >> "Change the priority of the current item, then refresh agenda." >> (interactive) >> (save-excursion >> (if (org-priority p) >> (org-agenda-redo)))) >> >> I set up my window to have 2 frames side by side. The org agenda is >> in the left frame. In the right frame is whatever org file I'm >> working on. >> In the org file (right frame), I call the above function, having bound >> it to \C-, >> It does what it's supposed to to the priority, but then the point >> moves to the agenda frame and goes to the end of the agenda buffer. >> I would have thought 'save-excursion' would have returned the point to >> wherever I was when I called the function. >> > > save-window-excursion maybe? > Or you could solve the problem by one switch-to-buffer-other-window. > > Just a quick hint. Also look at window-buffer or functions that start with window-configuration-*. Disclaimer: I cannot assure that the solution I suggest would work or is correct but they sound like good starting points. > >> Anyone got any idea what I'm doing wrong? >> Cheers. >> Fil