diff options
| author | YAMAMOTO Mitsuharu | 2006-05-24 08:06:27 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-05-24 08:06:27 +0000 |
| commit | dc47c8243dd83bbaab5c593a6e387f416f107b9a (patch) | |
| tree | 6e9a7077f2be6f3f6e4203da17f45b9bac6197fd | |
| parent | 69da8f9466f3cad0d669dd1e5ea7458c07ce048f (diff) | |
| download | emacs-dc47c8243dd83bbaab5c593a6e387f416f107b9a.tar.gz emacs-dc47c8243dd83bbaab5c593a6e387f416f107b9a.zip | |
Set idle timer to clean up expired Apple events.
(mac-ae-get-url): Redispatch Apple event on unknown scheme.
(mac-dispatch-apple-event): Resume Apple event if it is suspended.
Optionally set error message in reply.
| -rw-r--r-- | lisp/term/mac-win.el | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index 8eb8e6a0460..318503db974 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -1649,7 +1649,7 @@ Currently the `mailto' scheme is supported." | |||
| 1649 | (parsed-url (url-generic-parse-url (mac-ae-text ae)))) | 1649 | (parsed-url (url-generic-parse-url (mac-ae-text ae)))) |
| 1650 | (if (string= (url-type parsed-url) "mailto") | 1650 | (if (string= (url-type parsed-url) "mailto") |
| 1651 | (url-mailto parsed-url) | 1651 | (url-mailto parsed-url) |
| 1652 | (error "Unsupported URL scheme: %s" (url-type parsed-url))))) | 1652 | (mac-resume-apple-event ae t)))) |
| 1653 | 1653 | ||
| 1654 | (setq mac-apple-event-map (make-sparse-keymap)) | 1654 | (setq mac-apple-event-map (make-sparse-keymap)) |
| 1655 | 1655 | ||
| @@ -1800,9 +1800,9 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1800 | "Dispatch EVENT according to the keymap `mac-apple-event-map'." | 1800 | "Dispatch EVENT according to the keymap `mac-apple-event-map'." |
| 1801 | (interactive "e") | 1801 | (interactive "e") |
| 1802 | (let* ((binding (lookup-key mac-apple-event-map (mac-event-spec event))) | 1802 | (let* ((binding (lookup-key mac-apple-event-map (mac-event-spec event))) |
| 1803 | (service-message | 1803 | (ae (mac-event-ae event)) |
| 1804 | (and (keymapp binding) | 1804 | (service-message (and (keymapp binding) |
| 1805 | (cdr (mac-ae-parameter (mac-event-ae event) "svmg"))))) | 1805 | (cdr (mac-ae-parameter ae "svmg"))))) |
| 1806 | (when service-message | 1806 | (when service-message |
| 1807 | (setq service-message | 1807 | (setq service-message |
| 1808 | (intern (decode-coding-string service-message 'utf-8))) | 1808 | (intern (decode-coding-string service-message 'utf-8))) |
| @@ -1810,7 +1810,16 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1810 | ;; Replace (cadr event) with a dummy position so that event-start | 1810 | ;; Replace (cadr event) with a dummy position so that event-start |
| 1811 | ;; returns it. | 1811 | ;; returns it. |
| 1812 | (setcar (cdr event) (list (selected-window) (point) '(0 . 0) 0)) | 1812 | (setcar (cdr event) (list (selected-window) (point) '(0 . 0) 0)) |
| 1813 | (call-interactively binding))) | 1813 | (if (null (mac-ae-parameter ae 'emacs-suspension-id)) |
| 1814 | (call-interactively binding) | ||
| 1815 | (condition-case err | ||
| 1816 | (progn | ||
| 1817 | (call-interactively binding) | ||
| 1818 | (mac-resume-apple-event ae)) | ||
| 1819 | (error | ||
| 1820 | (mac-ae-set-reply-parameter ae "errs" | ||
| 1821 | (cons "TEXT" (error-message-string err))) | ||
| 1822 | (mac-resume-apple-event ae -10000)))))) ; errAEEventFailed | ||
| 1814 | 1823 | ||
| 1815 | (global-set-key [mac-apple-event] 'mac-dispatch-apple-event) | 1824 | (global-set-key [mac-apple-event] 'mac-dispatch-apple-event) |
| 1816 | 1825 | ||
| @@ -1820,6 +1829,8 @@ With numeric ARG, display the font panel if and only if ARG is positive." | |||
| 1820 | ;; the files should be opened. | 1829 | ;; the files should be opened. |
| 1821 | (add-hook 'after-init-hook 'mac-process-deferred-apple-events) | 1830 | (add-hook 'after-init-hook 'mac-process-deferred-apple-events) |
| 1822 | 1831 | ||
| 1832 | (run-with-idle-timer 5 t 'mac-cleanup-expired-apple-events) | ||
| 1833 | |||
| 1823 | 1834 | ||
| 1824 | ;;;; Drag and drop | 1835 | ;;;; Drag and drop |
| 1825 | 1836 | ||