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:16:11 +0530 Message-ID: <8139j9mdr0.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXO8o-0007wR-FB for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 21:46:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXO8m-0004at-WA for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 21:46:34 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:60519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXO8m-0004am-MH for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 21:46:32 -0400 Received: by pzk4 with SMTP id 4so1760676pzk.0 for ; Thu, 16 Jun 2011 18:46:31 -0700 (PDT) In-Reply-To: (Filippo A. Salustri's message of "Thu, 16 Jun 2011 21:34:39 -0400") 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 "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. > Anyone got any idea what I'm doing wrong? > Cheers. > Fil --