save-window-excursion did the trick. Never heard of that one. Thanks! Cheers. Fil
On 16 June 2011 21:46, Jambunathan K <kjambunat...@gmail.com> wrote: > "Filippo A. Salustri" <salus...@ryerson.ca> 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 > > -- > -- \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: salus...@ryerson.ca http://deseng.ryerson.ca/~fil/