diff options
| author | Stefan Monnier | 2007-08-23 18:18:26 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-08-23 18:18:26 +0000 |
| commit | 78b35906a97051307f2a1da76fd9786331e3f3bf (patch) | |
| tree | 7d5b6dc28790fbcfba920ce81461e2c68aeb6a2a | |
| parent | c30da265105157b391bca96d15a593e020efafa5 (diff) | |
| download | emacs-78b35906a97051307f2a1da76fd9786331e3f3bf.tar.gz emacs-78b35906a97051307f2a1da76fd9786331e3f3bf.zip | |
Remove spurious * in custom docstrings.
(dframe-xemacsp): Remove, use (featurep 'xemacs) instead.
(dframe-xemacs20p): Remove, inline at the sole use point.
(defface): Don't defvar the face, don't use old-style backquote.
(defcustom): Don't use old-style backquote.
(dframe-frame-parameter, dframe-mouse-event-p):
Make it obvious that it's always defined.
(dframe-popup-kludge): New function to replace
dframe-xemacs-popup-kludge and dframe-xemacs-popup-kludge.
(dframe-frame-mode, dframe-set-timer-internal)
(dframe-mouse-set-point): Remove use of with-no-warnings from
XEmacs-specific code.
(dframe-set-timer-internal): Fix very old bug with
post-command-idle-hook.
| -rw-r--r-- | lisp/ChangeLog | 17 | ||||
| -rw-r--r-- | lisp/dframe.el | 182 |
2 files changed, 101 insertions, 98 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f6c8615dd0f..560b47f1344 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,6 +1,21 @@ | |||
| 1 | 2007-08-23 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-08-23 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * emacs-lisp/byte-opt.el (byte-optimize-featurep): Also handle `sxemacs'. | 3 | * dframe.el: Remove spurious * in custom docstrings. |
| 4 | (dframe-xemacsp): Remove, use (featurep 'xemacs) instead. | ||
| 5 | (dframe-xemacs20p): Remove, inline at the sole use point. | ||
| 6 | (defface): Don't defvar the face, don't use old-style backquote. | ||
| 7 | (defcustom): Don't use old-style backquote. | ||
| 8 | (dframe-frame-parameter, dframe-mouse-event-p): | ||
| 9 | Make it obvious that it's always defined. | ||
| 10 | (dframe-popup-kludge): New function to replace | ||
| 11 | dframe-xemacs-popup-kludge and dframe-xemacs-popup-kludge. | ||
| 12 | (dframe-frame-mode, dframe-set-timer-internal) | ||
| 13 | (dframe-mouse-set-point): Remove use of with-no-warnings from | ||
| 14 | XEmacs-specific code. | ||
| 15 | (dframe-set-timer-internal): Fix very old bug with | ||
| 16 | post-command-idle-hook. | ||
| 17 | |||
| 18 | * emacs-lisp/byte-opt.el (byte-optimize-featurep): Handle `sxemacs'. | ||
| 4 | 19 | ||
| 5 | 2007-08-22 Chong Yidong <cyd@stupidchicken.com> | 20 | 2007-08-22 Chong Yidong <cyd@stupidchicken.com> |
| 6 | 21 | ||
diff --git a/lisp/dframe.el b/lisp/dframe.el index b90d15e74db..53a07ff3811 100644 --- a/lisp/dframe.el +++ b/lisp/dframe.el | |||
| @@ -114,10 +114,6 @@ | |||
| 114 | (defvar x-pointer-top-left-arrow) | 114 | (defvar x-pointer-top-left-arrow) |
| 115 | 115 | ||
| 116 | ;;; Code: | 116 | ;;; Code: |
| 117 | (defvar dframe-xemacsp (string-match "XEmacs" emacs-version) | ||
| 118 | "Non-nil if we are running in the XEmacs environment.") | ||
| 119 | (defvar dframe-xemacs20p (and dframe-xemacsp | ||
| 120 | (>= emacs-major-version 20))) | ||
| 121 | 117 | ||
| 122 | ;; From custom web page for compatibility between versions of custom | 118 | ;; From custom web page for compatibility between versions of custom |
| 123 | ;; with help from ptype@dera.gov.uk (Proto Type) | 119 | ;; with help from ptype@dera.gov.uk (Proto Type) |
| @@ -138,27 +134,23 @@ | |||
| 138 | (if (boundp 'defface) | 134 | (if (boundp 'defface) |
| 139 | nil | 135 | nil |
| 140 | (defmacro defface (var values doc &rest args) | 136 | (defmacro defface (var values doc &rest args) |
| 141 | (` (progn | 137 | ;; To make colors for your faces you need to set your .Xdefaults |
| 142 | (defvar (, var) (quote (, var))) | 138 | ;; or set them up ahead of time in your .emacs file. |
| 143 | ;; To make colors for your faces you need to set your .Xdefaults | 139 | `(make-face ,var) |
| 144 | ;; or set them up ahead of time in your .emacs file. | 140 | )) |
| 145 | (make-face (, var)) | ||
| 146 | )))) | ||
| 147 | (if (boundp 'defcustom) | 141 | (if (boundp 'defcustom) |
| 148 | nil | 142 | nil |
| 149 | (defmacro defcustom (var value doc &rest args) | 143 | (defmacro defcustom (var value doc &rest args) |
| 150 | (` (defvar (, var) (, value) (, doc))))))) | 144 | `(defvar ,var ,value ,doc))))) |
| 151 | 145 | ||
| 152 | 146 | ||
| 153 | ;;; Compatibility functions | 147 | ;;; Compatibility functions |
| 154 | ;; | 148 | ;; |
| 155 | (if (fboundp 'frame-parameter) | 149 | (defalias 'dframe-frame-parameter |
| 156 | 150 | (if (fboundp 'frame-parameter) 'frame-parameter | |
| 157 | (defalias 'dframe-frame-parameter 'frame-parameter) | 151 | (lambda (frame parameter) |
| 158 | 152 | "Return FRAME's PARAMETER value." | |
| 159 | (defun dframe-frame-parameter (frame parameter) | 153 | (cdr (assoc parameter (frame-parameters frame)))))) |
| 160 | "Return FRAME's PARAMETER value." | ||
| 161 | (cdr (assoc parameter (frame-parameters frame))))) | ||
| 162 | 154 | ||
| 163 | 155 | ||
| 164 | ;;; Variables | 156 | ;;; Variables |
| @@ -178,26 +170,26 @@ | |||
| 178 | "Non-nil means that timers are available for this Emacs.") | 170 | "Non-nil means that timers are available for this Emacs.") |
| 179 | 171 | ||
| 180 | (defcustom dframe-update-speed | 172 | (defcustom dframe-update-speed |
| 181 | (if dframe-xemacsp | 173 | (if (featurep 'xemacs) |
| 182 | (if dframe-xemacs20p | 174 | (if (>= emacs-major-version 20) |
| 183 | 2 ; 1 is too obrusive in XEmacs | 175 | 2 ; 1 is too obrusive in XEmacs |
| 184 | 5) ; when no idleness, need long delay | 176 | 5) ; when no idleness, need long delay |
| 185 | 1) | 177 | 1) |
| 186 | "*Idle time in seconds needed before dframe will update itself. | 178 | "Idle time in seconds needed before dframe will update itself. |
| 187 | Updates occur to allow dframe to display directory information | 179 | Updates occur to allow dframe to display directory information |
| 188 | relevant to the buffer you are currently editing." | 180 | relevant to the buffer you are currently editing." |
| 189 | :group 'dframe | 181 | :group 'dframe |
| 190 | :type 'integer) | 182 | :type 'integer) |
| 191 | 183 | ||
| 192 | (defcustom dframe-activity-change-focus-flag nil | 184 | (defcustom dframe-activity-change-focus-flag nil |
| 193 | "*Non-nil means the selected frame will change based on activity. | 185 | "Non-nil means the selected frame will change based on activity. |
| 194 | Thus, if a file is selected for edit, the buffer will appear in the | 186 | Thus, if a file is selected for edit, the buffer will appear in the |
| 195 | selected frame and the focus will change to that frame." | 187 | selected frame and the focus will change to that frame." |
| 196 | :group 'dframe | 188 | :group 'dframe |
| 197 | :type 'boolean) | 189 | :type 'boolean) |
| 198 | 190 | ||
| 199 | (defcustom dframe-after-select-attached-frame-hook nil | 191 | (defcustom dframe-after-select-attached-frame-hook nil |
| 200 | "*Hook run after dframe has selected the attached frame." | 192 | "Hook run after dframe has selected the attached frame." |
| 201 | :group 'dframe | 193 | :group 'dframe |
| 202 | :type 'hook) | 194 | :type 'hook) |
| 203 | 195 | ||
| @@ -249,7 +241,7 @@ Local to those buffers, as a function called that created it.") | |||
| 249 | 'dframe-switch-buffer-attached-frame | 241 | 'dframe-switch-buffer-attached-frame |
| 250 | map global-map) | 242 | map global-map) |
| 251 | 243 | ||
| 252 | (if dframe-xemacsp | 244 | (if (featurep 'xemacs) |
| 253 | (progn | 245 | (progn |
| 254 | ;; mouse bindings so we can manipulate the items on each line | 246 | ;; mouse bindings so we can manipulate the items on each line |
| 255 | (define-key map 'button2 'dframe-click) | 247 | (define-key map 'button2 'dframe-click) |
| @@ -257,7 +249,7 @@ Local to those buffers, as a function called that created it.") | |||
| 257 | ;; Info doc fix from Bob Weiner | 249 | ;; Info doc fix from Bob Weiner |
| 258 | (if (featurep 'infodoc) | 250 | (if (featurep 'infodoc) |
| 259 | nil | 251 | nil |
| 260 | (define-key map 'button3 'dframe-xemacs-popup-kludge)) | 252 | (define-key map 'button3 'dframe-popup-kludge)) |
| 261 | ) | 253 | ) |
| 262 | 254 | ||
| 263 | ;; mouse bindings so we can manipulate the items on each line | 255 | ;; mouse bindings so we can manipulate the items on each line |
| @@ -269,13 +261,13 @@ Local to those buffers, as a function called that created it.") | |||
| 269 | ;; This adds a small unecessary visual effect | 261 | ;; This adds a small unecessary visual effect |
| 270 | ;;(define-key map [down-mouse-2] 'dframe-quick-mouse) | 262 | ;;(define-key map [down-mouse-2] 'dframe-quick-mouse) |
| 271 | 263 | ||
| 272 | (define-key map [down-mouse-3] 'dframe-emacs-popup-kludge) | 264 | (define-key map [down-mouse-3] 'dframe-popup-kludge) |
| 273 | 265 | ||
| 274 | ;; This lets the user scroll as if we had a scrollbar... well maybe not | 266 | ;; This lets the user scroll as if we had a scrollbar... well maybe not |
| 275 | (define-key map [mode-line mouse-2] 'dframe-mouse-hscroll) | 267 | (define-key map [mode-line mouse-2] 'dframe-mouse-hscroll) |
| 276 | ;; another handy place users might click to get our menu. | 268 | ;; another handy place users might click to get our menu. |
| 277 | (define-key map [mode-line down-mouse-1] | 269 | (define-key map [mode-line down-mouse-1] |
| 278 | 'dframe-emacs-popup-kludge) | 270 | 'dframe-popup-kludge) |
| 279 | 271 | ||
| 280 | ;; We can't switch buffers with the buffer mouse menu. Lets hack it. | 272 | ;; We can't switch buffers with the buffer mouse menu. Lets hack it. |
| 281 | (define-key map [C-down-mouse-1] 'dframe-hack-buffer-menu) | 273 | (define-key map [C-down-mouse-1] 'dframe-hack-buffer-menu) |
| @@ -327,14 +319,12 @@ CREATE-HOOK are hooks to run after creating a frame." | |||
| 327 | (run-hooks 'popup-hook) | 319 | (run-hooks 'popup-hook) |
| 328 | ;; Updated the buffer passed in to contain all the hacks needed | 320 | ;; Updated the buffer passed in to contain all the hacks needed |
| 329 | ;; to make it work well in a dedicated window. | 321 | ;; to make it work well in a dedicated window. |
| 330 | (save-excursion | 322 | (with-current-buffer (symbol-value buffer-var) |
| 331 | (set-buffer (symbol-value buffer-var)) | ||
| 332 | ;; Declare this buffer a dedicated frame | 323 | ;; Declare this buffer a dedicated frame |
| 333 | (setq dframe-controlled local-mode-fn) | 324 | (setq dframe-controlled local-mode-fn) |
| 334 | 325 | ||
| 335 | (if dframe-xemacsp | 326 | (if (featurep 'xemacs) |
| 336 | ;; Hack the XEmacs mouse-motion handler | 327 | (progn |
| 337 | (with-no-warnings | ||
| 338 | ;; Hack the XEmacs mouse-motion handler | 328 | ;; Hack the XEmacs mouse-motion handler |
| 339 | (set (make-local-variable 'mouse-motion-handler) | 329 | (set (make-local-variable 'mouse-motion-handler) |
| 340 | 'dframe-track-mouse-xemacs) | 330 | 'dframe-track-mouse-xemacs) |
| @@ -355,7 +345,7 @@ CREATE-HOOK are hooks to run after creating a frame." | |||
| 355 | ;; Enable mouse tracking in emacs | 345 | ;; Enable mouse tracking in emacs |
| 356 | (if dframe-track-mouse-function | 346 | (if dframe-track-mouse-function |
| 357 | (set (make-local-variable 'track-mouse) t))) ;this could be messy. | 347 | (set (make-local-variable 'track-mouse) t))) ;this could be messy. |
| 358 | ;;;; DISABLED: This causes problems for users with multiple frames. | 348 | ;;;; DISABLED: This causes problems for users with multiple frames. |
| 359 | ;;;; ;; Set this up special just for the passed in buffer | 349 | ;;;; ;; Set this up special just for the passed in buffer |
| 360 | ;;;; ;; Terminal minibuffer stuff does not require this. | 350 | ;;;; ;; Terminal minibuffer stuff does not require this. |
| 361 | ;;;; (if (and (or (assoc 'minibuffer parameters) | 351 | ;;;; (if (and (or (assoc 'minibuffer parameters) |
| @@ -404,7 +394,7 @@ CREATE-HOOK are hooks to run after creating a frame." | |||
| 404 | (if (frame-live-p (symbol-value frame-var)) | 394 | (if (frame-live-p (symbol-value frame-var)) |
| 405 | (raise-frame (symbol-value frame-var)) | 395 | (raise-frame (symbol-value frame-var)) |
| 406 | (set frame-var | 396 | (set frame-var |
| 407 | (if dframe-xemacsp | 397 | (if (featurep 'xemacs) |
| 408 | ;; Only guess height if it is not specified. | 398 | ;; Only guess height if it is not specified. |
| 409 | (if (member 'height parameters) | 399 | (if (member 'height parameters) |
| 410 | (make-frame parameters) | 400 | (make-frame parameters) |
| @@ -460,7 +450,7 @@ CREATE-HOOK are hooks to run after creating a frame." | |||
| 460 | (defun dframe-reposition-frame (new-frame parent-frame location) | 450 | (defun dframe-reposition-frame (new-frame parent-frame location) |
| 461 | "Move NEW-FRAME to be relative to PARENT-FRAME. | 451 | "Move NEW-FRAME to be relative to PARENT-FRAME. |
| 462 | LOCATION can be one of 'random, 'left, 'right, 'left-right, or 'top-bottom." | 452 | LOCATION can be one of 'random, 'left, 'right, 'left-right, or 'top-bottom." |
| 463 | (if dframe-xemacsp | 453 | (if (featurep 'xemacs) |
| 464 | (dframe-reposition-frame-xemacs new-frame parent-frame location) | 454 | (dframe-reposition-frame-xemacs new-frame parent-frame location) |
| 465 | (dframe-reposition-frame-emacs new-frame parent-frame location))) | 455 | (dframe-reposition-frame-emacs new-frame parent-frame location))) |
| 466 | 456 | ||
| @@ -570,13 +560,13 @@ LOCATION can be one of 'random, 'left-right, or 'top-bottom." | |||
| 570 | (defun dframe-detach (frame-var cache-var buffer-var) | 560 | (defun dframe-detach (frame-var cache-var buffer-var) |
| 571 | "Detatch the frame in symbol FRAME-VAR. | 561 | "Detatch the frame in symbol FRAME-VAR. |
| 572 | CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'" | 562 | CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'" |
| 573 | (save-excursion | 563 | (with-current-buffer (symbol-value buffer-var) |
| 574 | (set-buffer (symbol-value buffer-var)) | ||
| 575 | (rename-buffer (buffer-name) t) | 564 | (rename-buffer (buffer-name) t) |
| 576 | (let ((oldframe (symbol-value frame-var))) | 565 | (let ((oldframe (symbol-value frame-var))) |
| 577 | (set buffer-var nil) | 566 | (set buffer-var nil) |
| 578 | (set frame-var nil) | 567 | (set frame-var nil) |
| 579 | (set cache-var nil) | 568 | (set cache-var nil) |
| 569 | ;; FIXME: Looks very suspicious. Luckily this function is unused. | ||
| 580 | (make-variable-buffer-local frame-var) | 570 | (make-variable-buffer-local frame-var) |
| 581 | (set frame-var oldframe) | 571 | (set frame-var oldframe) |
| 582 | ))) | 572 | ))) |
| @@ -787,18 +777,16 @@ If NULL-ON-ERROR is a symbol, set it to nil if we cannot create a timer." | |||
| 787 | If NULL-ON-ERROR is a symbol, set it to nil if we cannot create a timer." | 777 | If NULL-ON-ERROR is a symbol, set it to nil if we cannot create a timer." |
| 788 | (cond | 778 | (cond |
| 789 | ;; XEmacs | 779 | ;; XEmacs |
| 790 | (dframe-xemacsp | 780 | ((featurep 'xemacs) |
| 791 | (with-no-warnings | ||
| 792 | (if dframe-timer | 781 | (if dframe-timer |
| 793 | (progn (delete-itimer dframe-timer) | 782 | (progn (delete-itimer dframe-timer) |
| 794 | (setq dframe-timer nil))) | 783 | (setq dframe-timer nil))) |
| 795 | (if timeout | 784 | (if timeout |
| 796 | (if (and dframe-xemacsp | 785 | (if (or (>= emacs-major-version 21) |
| 797 | (or (>= emacs-major-version 21) | 786 | (and (= emacs-major-version 20) |
| 798 | (and (= emacs-major-version 20) | 787 | (> emacs-minor-version 0)) |
| 799 | (> emacs-minor-version 0)) | 788 | (and (= emacs-major-version 19) |
| 800 | (and (= emacs-major-version 19) | 789 | (>= emacs-minor-version 15))) |
| 801 | (>= emacs-minor-version 15)))) | ||
| 802 | (setq dframe-timer (start-itimer "dframe" | 790 | (setq dframe-timer (start-itimer "dframe" |
| 803 | 'dframe-timer-fn | 791 | 'dframe-timer-fn |
| 804 | timeout | 792 | timeout |
| @@ -807,7 +795,7 @@ If NULL-ON-ERROR is a symbol, set it to nil if we cannot create a timer." | |||
| 807 | (setq dframe-timer (start-itimer "dframe" | 795 | (setq dframe-timer (start-itimer "dframe" |
| 808 | 'dframe-timer-fn | 796 | 'dframe-timer-fn |
| 809 | timeout | 797 | timeout |
| 810 | nil)))))) | 798 | nil))))) |
| 811 | ;; Post 19.31 Emacs | 799 | ;; Post 19.31 Emacs |
| 812 | ((fboundp 'run-with-idle-timer) | 800 | ((fboundp 'run-with-idle-timer) |
| 813 | (if dframe-timer | 801 | (if dframe-timer |
| @@ -817,7 +805,7 @@ If NULL-ON-ERROR is a symbol, set it to nil if we cannot create a timer." | |||
| 817 | (setq dframe-timer | 805 | (setq dframe-timer |
| 818 | (run-with-idle-timer timeout t 'dframe-timer-fn)))) | 806 | (run-with-idle-timer timeout t 'dframe-timer-fn)))) |
| 819 | ;; Emacs 19.30 (Thanks twice: ptype@dra.hmg.gb) | 807 | ;; Emacs 19.30 (Thanks twice: ptype@dra.hmg.gb) |
| 820 | ((fboundp 'post-command-idle-hook) | 808 | ((boundp 'post-command-idle-hook) |
| 821 | (if timeout | 809 | (if timeout |
| 822 | (add-hook 'post-command-idle-hook 'dframe-timer-fn) | 810 | (add-hook 'post-command-idle-hook 'dframe-timer-fn) |
| 823 | (remove-hook 'post-command-idle-hook 'dframe-timer-fn))) | 811 | (remove-hook 'post-command-idle-hook 'dframe-timer-fn))) |
| @@ -851,57 +839,58 @@ Evaluates all cached timer functions in sequence." | |||
| 851 | ;; opposed to where the point happens to be.) We attain this by | 839 | ;; opposed to where the point happens to be.) We attain this by |
| 852 | ;; temporarily moving the point to that place. | 840 | ;; temporarily moving the point to that place. |
| 853 | ;; Hrvoje Niksic <hniksic@srce.hr> | 841 | ;; Hrvoje Niksic <hniksic@srce.hr> |
| 854 | (with-no-warnings | 842 | (defalias 'dframe-popup-kludge |
| 855 | (defun dframe-xemacs-popup-kludge (event) | 843 | (if (featurep 'xemacs) |
| 856 | "Pop up a menu related to the clicked on item. | 844 | (lambda (event) ; XEmacs. |
| 845 | "Pop up a menu related to the clicked on item. | ||
| 857 | Must be bound to EVENT." | 846 | Must be bound to EVENT." |
| 858 | (interactive "e") | 847 | (interactive "e") |
| 859 | (save-excursion | 848 | (save-excursion |
| 860 | (if dframe-pass-event-to-popup-mode-menu | 849 | (if dframe-pass-event-to-popup-mode-menu |
| 861 | (popup-mode-menu event) | 850 | (popup-mode-menu event) |
| 862 | (goto-char (event-closest-point event)) | 851 | (goto-char (event-closest-point event)) |
| 863 | (beginning-of-line) | 852 | (beginning-of-line) |
| 864 | (forward-char (min 5 (- (save-excursion (end-of-line) (point)) | 853 | (forward-char (min 5 (- (save-excursion (end-of-line) (point)) |
| 865 | (save-excursion (beginning-of-line) (point))))) | 854 | (save-excursion (beginning-of-line) (point))))) |
| 866 | (popup-mode-menu)) | 855 | (popup-mode-menu)) |
| 867 | ;; Wait for menu to bail out. `popup-mode-menu' (and other popup | 856 | ;; Wait for menu to bail out. `popup-mode-menu' (and other popup |
| 868 | ;; menu functions) return immediately. | 857 | ;; menu functions) return immediately. |
| 869 | (let (new) | 858 | (let (new) |
| 870 | (while (not (misc-user-event-p (setq new (next-event)))) | 859 | (while (not (misc-user-event-p (setq new (next-event)))) |
| 871 | (dispatch-event new)) | 860 | (dispatch-event new)) |
| 872 | (dispatch-event new)))) | 861 | (dispatch-event new)))) |
| 873 | );with-no-warnings | 862 | |
| 874 | 863 | (lambda (e) ; Emacs. | |
| 875 | (defun dframe-emacs-popup-kludge (e) | 864 | "Pop up a menu related to the clicked on item. |
| 876 | "Pop up a menu related to the clicked on item. | ||
| 877 | Must be bound to event E." | 865 | Must be bound to event E." |
| 878 | (interactive "e") | 866 | (interactive "e") |
| 879 | (save-excursion | 867 | (save-excursion |
| 880 | (mouse-set-point e) | 868 | (mouse-set-point e) |
| 881 | ;; This gets the cursor where the user can see it. | 869 | ;; This gets the cursor where the user can see it. |
| 882 | (if (not (bolp)) (forward-char -1)) | 870 | (if (not (bolp)) (forward-char -1)) |
| 883 | (sit-for 0) | 871 | (sit-for 0) |
| 884 | (if (< emacs-major-version 20) | 872 | (if (< emacs-major-version 20) |
| 885 | (mouse-major-mode-menu e) | 873 | (mouse-major-mode-menu e) |
| 886 | (mouse-major-mode-menu e nil)))) | 874 | (mouse-major-mode-menu e nil)))))) |
| 887 | 875 | ||
| 888 | ;;; Interactive user functions for the mouse | 876 | ;;; Interactive user functions for the mouse |
| 889 | ;; | 877 | ;; |
| 890 | (if dframe-xemacsp | 878 | (defalias 'dframe-mouse-event-p |
| 891 | (defalias 'dframe-mouse-event-p 'button-press-event-p) | 879 | (if (featurep 'xemacs) |
| 892 | (defun dframe-mouse-event-p (event) | 880 | 'button-press-event-p |
| 893 | "Return t if the event is a mouse related event." | 881 | (lambda (event) |
| 894 | (if (and (listp event) | 882 | "Return t if the event is a mouse related event." |
| 895 | (member (event-basic-type event) | 883 | (if (and (listp event) |
| 896 | '(mouse-1 mouse-2 mouse-3))) | 884 | (member (event-basic-type event) |
| 897 | t | 885 | '(mouse-1 mouse-2 mouse-3))) |
| 898 | nil))) | 886 | t |
| 887 | nil)))) | ||
| 899 | 888 | ||
| 900 | (defun dframe-track-mouse (event) | 889 | (defun dframe-track-mouse (event) |
| 901 | "For motion EVENT, display info about the current line." | 890 | "For motion EVENT, display info about the current line." |
| 902 | (interactive "e") | 891 | (interactive "e") |
| 903 | (when (and dframe-track-mouse-function | 892 | (when (and dframe-track-mouse-function |
| 904 | (or dframe-xemacsp ;; XEmacs always safe? | 893 | (or (featurep 'xemacs) ;; XEmacs always safe? |
| 905 | (windowp (posn-window (event-end event))) ; Sometimes | 894 | (windowp (posn-window (event-end event))) ; Sometimes |
| 906 | ; there is no window to jump into. | 895 | ; there is no window to jump into. |
| 907 | )) | 896 | )) |
| @@ -931,19 +920,18 @@ BUFFER and POSITION are optional because XEmacs doesn't use them." | |||
| 931 | (defun dframe-mouse-set-point (e) | 920 | (defun dframe-mouse-set-point (e) |
| 932 | "Set POINT based on event E. | 921 | "Set POINT based on event E. |
| 933 | Handles clicking on images in XEmacs." | 922 | Handles clicking on images in XEmacs." |
| 934 | (if (save-excursion | 923 | (if (and (featurep 'xemacs) |
| 935 | (save-window-excursion | 924 | (save-excursion |
| 936 | (mouse-set-point e) | 925 | (save-window-excursion |
| 937 | (and (fboundp 'event-over-glyph-p) (event-over-glyph-p e)))) | 926 | (mouse-set-point e) |
| 927 | (event-over-glyph-p e)))) | ||
| 938 | ;; We are in XEmacs, and clicked on a picture | 928 | ;; We are in XEmacs, and clicked on a picture |
| 939 | (with-no-warnings | ||
| 940 | (let ((ext (event-glyph-extent e))) | 929 | (let ((ext (event-glyph-extent e))) |
| 941 | ;; This position is back inside the extent where the | 930 | ;; This position is back inside the extent where the |
| 942 | ;; junk we pushed into the property list lives. | 931 | ;; junk we pushed into the property list lives. |
| 943 | (if (extent-end-position ext) | 932 | (if (extent-end-position ext) |
| 944 | (goto-char (1- (extent-end-position ext))) | 933 | (goto-char (1- (extent-end-position ext))) |
| 945 | (mouse-set-point e))) | 934 | (mouse-set-point e))) |
| 946 | );with-no-warnings | ||
| 947 | ;; We are not in XEmacs, OR we didn't click on a picture. | 935 | ;; We are not in XEmacs, OR we didn't click on a picture. |
| 948 | (mouse-set-point e))) | 936 | (mouse-set-point e))) |
| 949 | 937 | ||
| @@ -1002,7 +990,7 @@ redirected into a window on the attached frame." | |||
| 1002 | (pop-to-buffer buffer nil) | 990 | (pop-to-buffer buffer nil) |
| 1003 | (other-window -1) | 991 | (other-window -1) |
| 1004 | ;; Fix for using this hook on some platforms: Bob Weiner | 992 | ;; Fix for using this hook on some platforms: Bob Weiner |
| 1005 | (cond ((not dframe-xemacsp) | 993 | (cond ((not (featurep 'xemacs)) |
| 1006 | (run-hooks 'temp-buffer-show-hook)) | 994 | (run-hooks 'temp-buffer-show-hook)) |
| 1007 | ((fboundp 'run-hook-with-args) | 995 | ((fboundp 'run-hook-with-args) |
| 1008 | (run-hook-with-args 'temp-buffer-show-hook buffer)) | 996 | (run-hook-with-args 'temp-buffer-show-hook buffer)) |
| @@ -1017,8 +1005,8 @@ This hack overrides it so that the right thing happens in the main | |||
| 1017 | Emacs frame, not in the dedicated frame. | 1005 | Emacs frame, not in the dedicated frame. |
| 1018 | Argument E is the event causing this activity." | 1006 | Argument E is the event causing this activity." |
| 1019 | (interactive "e") | 1007 | (interactive "e") |
| 1020 | (let ((fn (lookup-key global-map (if dframe-xemacsp | 1008 | (let ((fn (lookup-key global-map (if (featurep 'xemacs) |
| 1021 | '(control button1) | 1009 | '(control button1) |
| 1022 | [C-down-mouse-1]))) | 1010 | [C-down-mouse-1]))) |
| 1023 | (oldbuff (current-buffer)) | 1011 | (oldbuff (current-buffer)) |
| 1024 | (newbuff nil)) | 1012 | (newbuff nil)) |