From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Goldman Subject: Patch for windowing problem Date: Thu, 16 Jul 2009 14:32:48 -0500 Message-ID: <4A5F8060.3060607@sift.info> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090705040605050300020206" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRWhO-0000mR-AW for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 15:32:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRWhJ-0000kY-ID for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 15:32:58 -0400 Received: from [199.232.76.173] (port=58323 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRWhJ-0000kQ-Ch for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 15:32:53 -0400 Received: from outbound-mail-07.bluehost.com ([69.89.17.207]:44212) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MRWhI-0003DV-Nm for emacs-orgmode@gnu.org; Thu, 16 Jul 2009 15:32:53 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------090705040605050300020206 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit In an earlier posting, I mentioned that I had a problem with org-mode on aquamacs; the cursor (really input focus) was getting "trapped" in a different frame when the *Calendar* buffer was not in the same frame as the source of the org-schedule command (either an org-mode buffer or a remember buffer). The attached patch to org.el fixes this problem for me. Would some of you all mind testing it out? It just wraps current frame save and pop around the use of the calendar (frames aren't managed by the save-excursion and save-window-excursion that already wrap this interaction). Thanks, Robert --------------090705040605050300020206 Content-Type: text/plain; x-mac-type="54455854"; x-mac-creator="454D4178"; name="git-schedule-frame.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="git-schedule-frame.patch" index feaa115..be07d58 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12010,6 +12010,15 @@ So these are more for recording a certain time/date." (defvar org-read-date-history nil) (defvar org-read-date-final-answer nil) +(defmacro save-frame-excursion (&rest body) + "Carry out some operations and then return to the currently +selected frame." + (let ((frame-var (gensym "FRAME"))) + `(let ((,frame-var (selected-frame))) + (unwind-protect + (progn ,@body) + (select-frame-set-input-focus ,frame-var) )))) + (defun org-read-date (&optional with-time to-time from-string prompt default-time default-input) "Read a date, possibly a time, and make things smooth for the user. @@ -12088,77 +12097,78 @@ user." (org-read-date-popup-calendar (save-excursion (save-window-excursion - (calendar) - (calendar-forward-day (- (time-to-days def) - (calendar-absolute-from-gregorian - (calendar-current-date)))) - (org-eval-in-calendar nil t) - (let* ((old-map (current-local-map)) - (map (copy-keymap calendar-mode-map)) - (minibuffer-local-map (copy-keymap minibuffer-local-map))) - (org-defkey map (kbd "RET") 'org-calendar-select) - (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1]) - 'org-calendar-select-mouse) - (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2]) - 'org-calendar-select-mouse) - (org-defkey minibuffer-local-map [(meta shift left)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-backward-month 1)))) - (org-defkey minibuffer-local-map [(meta shift right)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-forward-month 1)))) - (org-defkey minibuffer-local-map [(meta shift up)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-backward-year 1)))) - (org-defkey minibuffer-local-map [(meta shift down)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-forward-year 1)))) - (org-defkey minibuffer-local-map [?\e (shift left)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-backward-month 1)))) - (org-defkey minibuffer-local-map [?\e (shift right)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-forward-month 1)))) - (org-defkey minibuffer-local-map [?\e (shift up)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-backward-year 1)))) - (org-defkey minibuffer-local-map [?\e (shift down)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-forward-year 1)))) - (org-defkey minibuffer-local-map [(shift up)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-backward-week 1)))) - (org-defkey minibuffer-local-map [(shift down)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-forward-week 1)))) - (org-defkey minibuffer-local-map [(shift left)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-backward-day 1)))) - (org-defkey minibuffer-local-map [(shift right)] - (lambda () (interactive) - (org-eval-in-calendar '(calendar-forward-day 1)))) - (org-defkey minibuffer-local-map ">" - (lambda () (interactive) - (org-eval-in-calendar '(scroll-calendar-left 1)))) - (org-defkey minibuffer-local-map "<" - (lambda () (interactive) - (org-eval-in-calendar '(scroll-calendar-right 1)))) - (run-hooks 'org-read-date-minibuffer-setup-hook) - (unwind-protect - (progn - (use-local-map map) - (add-hook 'post-command-hook 'org-read-date-display) - (setq org-ans0 (read-string prompt default-input - 'org-read-date-history nil)) - ;; org-ans0: from prompt - ;; org-ans1: from mouse click - ;; org-ans2: from calendar motion - (setq ans (concat org-ans0 " " (or org-ans1 org-ans2)))) - (remove-hook 'post-command-hook 'org-read-date-display) - (use-local-map old-map) - (when org-read-date-overlay - (org-delete-overlay org-read-date-overlay) - (setq org-read-date-overlay nil))))))) + (save-frame-excursion + (calendar) + (calendar-forward-day (- (time-to-days def) + (calendar-absolute-from-gregorian + (calendar-current-date)))) + (org-eval-in-calendar nil t) + (let* ((old-map (current-local-map)) + (map (copy-keymap calendar-mode-map)) + (minibuffer-local-map (copy-keymap minibuffer-local-map))) + (org-defkey map (kbd "RET") 'org-calendar-select) + (org-defkey map (if (featurep 'xemacs) [button1] [mouse-1]) + 'org-calendar-select-mouse) + (org-defkey map (if (featurep 'xemacs) [button2] [mouse-2]) + 'org-calendar-select-mouse) + (org-defkey minibuffer-local-map [(meta shift left)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-month 1)))) + (org-defkey minibuffer-local-map [(meta shift right)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-month 1)))) + (org-defkey minibuffer-local-map [(meta shift up)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-year 1)))) + (org-defkey minibuffer-local-map [(meta shift down)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-year 1)))) + (org-defkey minibuffer-local-map [?\e (shift left)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-month 1)))) + (org-defkey minibuffer-local-map [?\e (shift right)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-month 1)))) + (org-defkey minibuffer-local-map [?\e (shift up)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-year 1)))) + (org-defkey minibuffer-local-map [?\e (shift down)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-year 1)))) + (org-defkey minibuffer-local-map [(shift up)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-week 1)))) + (org-defkey minibuffer-local-map [(shift down)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-week 1)))) + (org-defkey minibuffer-local-map [(shift left)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-backward-day 1)))) + (org-defkey minibuffer-local-map [(shift right)] + (lambda () (interactive) + (org-eval-in-calendar '(calendar-forward-day 1)))) + (org-defkey minibuffer-local-map ">" + (lambda () (interactive) + (org-eval-in-calendar '(scroll-calendar-left 1)))) + (org-defkey minibuffer-local-map "<" + (lambda () (interactive) + (org-eval-in-calendar '(scroll-calendar-right 1)))) + (run-hooks 'org-read-date-minibuffer-setup-hook) + (unwind-protect + (progn + (use-local-map map) + (add-hook 'post-command-hook 'org-read-date-display) + (setq org-ans0 (read-string prompt default-input + 'org-read-date-history nil)) + ;; org-ans0: from prompt + ;; org-ans1: from mouse click + ;; org-ans2: from calendar motion + (setq ans (concat org-ans0 " " (or org-ans1 org-ans2)))) + (remove-hook 'post-command-hook 'org-read-date-display) + (use-local-map old-map) + (when org-read-date-overlay + (org-delete-overlay org-read-date-overlay) + (setq org-read-date-overlay nil)))))))) (t ; Naked prompt only (unwind-protect --------------090705040605050300020206 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --------------090705040605050300020206--