From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: odd behaviour in a function - looking for advice Date: Thu, 16 Jun 2011 22:01:26 -0400 Message-ID: References: <8139j9mdr0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXONF-0002rv-Tc for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 22:01:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXONE-00070f-2H for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 22:01:29 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:41220) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXOND-00070Z-Mg for emacs-orgmode@gnu.org; Thu, 16 Jun 2011 22:01:27 -0400 Received: by wyf19 with SMTP id 19so1762173wyf.0 for ; Thu, 16 Jun 2011 19:01:26 -0700 (PDT) In-Reply-To: <8139j9mdr0.fsf@gmail.com> 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: Jambunathan K Cc: emacs-orgmode mailing list save-window-excursion did the trick. Never heard of that one. Thanks! Cheers. Fil On 16 June 2011 21:46, Jambunathan K wrote: > "Filippo A. Salustri" writes: > >> Hi all, >> >> I've got this function: >> >> (defun fas/org-priority (&optional p) >> =A0 "Change the priority of the current item, then refresh agenda." >> =A0 (interactive) >> =A0 (save-excursion >> =A0 =A0 (if (org-priority p) >> =A0 =A0 =A0 =A0 (org-agenda-redo)))) >> >> I set up my window to have 2 frames side by side. =A0The org agenda is >> in the left frame. =A0In 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 > > -- > --=20 \V/_ Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/