aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/dframe.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-06-19 22:07:44 +0200
committerLars Ingebrigtsen2019-06-19 22:08:19 +0200
commite46fc9b01774d0e6de8db877ca6a86b36ee832ff (patch)
tree037d0234e05d69527b015ece962e57393880429f /lisp/dframe.el
parent613d3848b8cd09bd8f9ec94362c210d23e788cdd (diff)
downloademacs-e46fc9b01774d0e6de8db877ca6a86b36ee832ff.tar.gz
emacs-e46fc9b01774d0e6de8db877ca6a86b36ee832ff.zip
Remove XEmacs compat code from dframe.el
* lisp/dframe.el (dframe-update-speed, dframe-update-keymap) (dframe-frame-mode, dframe-detach, dframe-set-timer-internal) (dframe-popup-kludge, dframe-mouse-event-p) (dframe-track-mouse, dframe-help-echo, dframe-mouse-set-point) (dframe-double-click, dframe-temp-buffer-show-function) (dframe-hack-buffer-menu, dframe-mouse-hscroll): Remove XEmacs compat code (and some ancient Emacs compat code).
Diffstat (limited to 'lisp/dframe.el')
-rw-r--r--lisp/dframe.el330
1 files changed, 84 insertions, 246 deletions
diff --git a/lisp/dframe.el b/lisp/dframe.el
index 473f826ad27..72deb0c45e4 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -135,9 +135,7 @@
135This is nil for terminals, since updating a frame in a terminal 135This is nil for terminals, since updating a frame in a terminal
136is not useful to the user.") 136is not useful to the user.")
137 137
138(defcustom dframe-update-speed 138(defcustom dframe-update-speed 1
139 (if (featurep 'xemacs) 2 ; 1 is too obtrusive in XEmacs
140 1)
141 "Idle time in seconds needed before dframe will update itself. 139 "Idle time in seconds needed before dframe will update itself.
142Updates occur to allow dframe to display directory information 140Updates occur to allow dframe to display directory information
143relevant to the buffer you are currently editing." 141relevant to the buffer you are currently editing."
@@ -204,40 +202,28 @@ Local to those buffers, as a function called that created it.")
204 'dframe-switch-buffer-attached-frame 202 'dframe-switch-buffer-attached-frame
205 map global-map) 203 map global-map)
206 204
207 (if (featurep 'xemacs) 205 ;; mouse bindings so we can manipulate the items on each line
208 (progn 206 ;; (define-key map [down-mouse-1] 'dframe-double-click)
209 ;; mouse bindings so we can manipulate the items on each line 207 (define-key map [follow-link] 'mouse-face)
210 (define-key map 'button2 'dframe-click) 208 (define-key map [mouse-2] 'dframe-click)
211 (define-key map '(shift button2) 'dframe-power-click) 209 ;; This is the power click for new frames, or refreshing a cache
212 ;; Info doc fix from Bob Weiner 210 (define-key map [S-mouse-2] 'dframe-power-click)
213 (if (featurep 'infodoc) 211 ;; This adds a small unnecessary visual effect
214 nil 212 ;;(define-key map [down-mouse-2] 'dframe-quick-mouse)
215 (define-key map 'button3 'dframe-popup-kludge)) 213
216 ) 214 (define-key map [down-mouse-3] 'dframe-popup-kludge)
217 215
218 ;; mouse bindings so we can manipulate the items on each line 216 ;; This lets the user scroll as if we had a scrollbar... well maybe not
219 ;; (define-key map [down-mouse-1] 'dframe-double-click) 217 (define-key map [mode-line mouse-2] 'dframe-mouse-hscroll)
220 (define-key map [follow-link] 'mouse-face) 218 ;; another handy place users might click to get our menu.
221 (define-key map [mouse-2] 'dframe-click) 219 (define-key map [mode-line down-mouse-1]
222 ;; This is the power click for new frames, or refreshing a cache 220 'dframe-popup-kludge)
223 (define-key map [S-mouse-2] 'dframe-power-click) 221
224 ;; This adds a small unnecessary visual effect 222 ;; We can't switch buffers with the buffer mouse menu. Lets hack it.
225 ;;(define-key map [down-mouse-2] 'dframe-quick-mouse) 223 (define-key map [C-down-mouse-1] 'dframe-hack-buffer-menu)
226 224
227 (define-key map [down-mouse-3] 'dframe-popup-kludge) 225 ;; Lastly, we want to track the mouse. Play here
228 226 (define-key map [mouse-movement] 'dframe-track-mouse))
229 ;; This lets the user scroll as if we had a scrollbar... well maybe not
230 (define-key map [mode-line mouse-2] 'dframe-mouse-hscroll)
231 ;; another handy place users might click to get our menu.
232 (define-key map [mode-line down-mouse-1]
233 'dframe-popup-kludge)
234
235 ;; We can't switch buffers with the buffer mouse menu. Lets hack it.
236 (define-key map [C-down-mouse-1] 'dframe-hack-buffer-menu)
237
238 ;; Lastly, we want to track the mouse. Play here
239 (define-key map [mouse-movement] 'dframe-track-mouse)
240 ))
241 227
242(defun dframe-live-p (frame) 228(defun dframe-live-p (frame)
243 "Return non-nil if FRAME is currently available." 229 "Return non-nil if FRAME is currently available."
@@ -296,40 +282,10 @@ CREATE-HOOK is a hook to run after creating a frame."
296 ;; Declare this buffer a dedicated frame 282 ;; Declare this buffer a dedicated frame
297 (setq dframe-controlled local-mode-fn) 283 (setq dframe-controlled local-mode-fn)
298 284
299 (if (featurep 'xemacs) 285 ;; Enable mouse tracking in emacs
300 (progn 286 (if dframe-track-mouse-function
301 ;; Hack the XEmacs mouse-motion handler 287 (set (make-local-variable 'track-mouse) t)) ;this could be messy.
302 (set (make-local-variable 'mouse-motion-handler) 288
303 'dframe-track-mouse-xemacs)
304 ;; Hack the double click handler
305 (make-local-variable 'mouse-track-click-hook)
306 (add-hook 'mouse-track-click-hook
307 (lambda (event count)
308 (if (/= (event-button event) 1)
309 nil ; Do normal operations.
310 (cond ((eq count 1)
311 (dframe-quick-mouse event))
312 ((or (eq count 2)
313 (eq count 3))
314 (dframe-click event)
315 (dframe-quick-mouse event)))
316 ;; Don't do normal operations.
317 t))))
318 ;; Enable mouse tracking in emacs
319 (if dframe-track-mouse-function
320 (set (make-local-variable 'track-mouse) t))) ;this could be messy.
321;;;; DISABLED: This causes problems for users with multiple frames.
322;;;; ;; Set this up special just for the passed in buffer
323;;;; ;; Terminal minibuffer stuff does not require this.
324;;;; (if (and (or (assoc 'minibuffer parameters)
325;;;; ;; XEmacs plist is not an association list
326;;;; (member 'minibuffer parameters))
327;;;; window-system (not (eq window-system 'pc))
328;;;; (null default-minibuffer-frame))
329;;;; (progn
330;;;; (make-local-variable 'default-minibuffer-frame)
331;;;; (setq default-minibuffer-frame dframe-attached-frame))
332;;;; )
333 ;; Override `temp-buffer-show-hook' so that help and such 289 ;; Override `temp-buffer-show-hook' so that help and such
334 ;; put their stuff into a frame other than our own. 290 ;; put their stuff into a frame other than our own.
335 ;; Correct use of `temp-buffer-show-function': Bob Weiner 291 ;; Correct use of `temp-buffer-show-function': Bob Weiner
@@ -350,8 +306,7 @@ CREATE-HOOK is a hook to run after creating a frame."
350 (funcall dframe-controlled -1) 306 (funcall dframe-controlled -1)
351 (set buffer-var nil) 307 (set buffer-var nil)
352 ))))) 308 )))))
353 t t) 309 t t))
354 )
355 ;; Get the frame to work in 310 ;; Get the frame to work in
356 (if (frame-live-p (symbol-value cache-var)) 311 (if (frame-live-p (symbol-value cache-var))
357 (progn 312 (progn
@@ -367,39 +322,32 @@ CREATE-HOOK is a hook to run after creating a frame."
367 (if (frame-live-p (symbol-value frame-var)) 322 (if (frame-live-p (symbol-value frame-var))
368 (raise-frame (symbol-value frame-var)) 323 (raise-frame (symbol-value frame-var))
369 (set frame-var 324 (set frame-var
370 (if (featurep 'xemacs) 325 (let* ((mh (dframe-frame-parameter dframe-attached-frame
371 ;; Only guess height if it is not specified. 326 'menu-bar-lines))
372 (if (member 'height parameters) 327 (paramsa
373 (make-frame parameters) 328 ;; Only add a guessed height if one is not specified
374 (make-frame (nconc (list 'height 329 ;; in the input parameters.
375 (dframe-needed-height)) 330 (if (assoc 'height parameters)
376 parameters))) 331 parameters
377 (let* ((mh (dframe-frame-parameter dframe-attached-frame 332 (append
378 'menu-bar-lines)) 333 parameters
379 (paramsa 334 (list (cons 'height (+ (or mh 0) (frame-height)))))))
380 ;; Only add a guessed height if one is not specified 335 (params
381 ;; in the input parameters. 336 ;; Only add a guessed width if one is not specified
382 (if (assoc 'height parameters) 337 ;; in the input parameters.
383 parameters 338 (if (assoc 'width parameters)
384 (append 339 paramsa
385 parameters 340 (append
386 (list (cons 'height (+ (or mh 0) (frame-height))))))) 341 paramsa
387 (params 342 (list (cons 'width (frame-width))))))
388 ;; Only add a guessed width if one is not specified 343 (frame
389 ;; in the input parameters. 344 (if (not (eq window-system 'x))
390 (if (assoc 'width parameters) 345 (make-frame params)
391 paramsa 346 (let ((x-pointer-shape x-pointer-top-left-arrow)
392 (append 347 (x-sensitive-text-pointer-shape
393 paramsa 348 x-pointer-hand2))
394 (list (cons 'width (frame-width)))))) 349 (make-frame params)))))
395 (frame 350 frame))
396 (if (not (eq window-system 'x))
397 (make-frame params)
398 (let ((x-pointer-shape x-pointer-top-left-arrow)
399 (x-sensitive-text-pointer-shape
400 x-pointer-hand2))
401 (make-frame params)))))
402 frame)))
403 ;; Put the buffer into the frame 351 ;; Put the buffer into the frame
404 (save-excursion 352 (save-excursion
405 (select-frame (symbol-value frame-var)) 353 (select-frame (symbol-value frame-var))
@@ -416,21 +364,13 @@ CREATE-HOOK is a hook to run after creating a frame."
416 ;; On a terminal, raise the frame or the user will 364 ;; On a terminal, raise the frame or the user will
417 ;; be confused. 365 ;; be confused.
418 (if (not window-system) 366 (if (not window-system)
419 (select-frame (symbol-value frame-var))) 367 (select-frame (symbol-value frame-var)))))))
420 ))) )
421
422(defun dframe-reposition-frame (new-frame parent-frame location)
423 "Move NEW-FRAME to be relative to PARENT-FRAME.
424LOCATION can be one of `random', `left', `right', `left-right', or `top-bottom'."
425 (if (featurep 'xemacs)
426 (dframe-reposition-frame-xemacs new-frame parent-frame location)
427 (dframe-reposition-frame-emacs new-frame parent-frame location)))
428 368
429;; Not defined in builds without X, but behind window-system test. 369;; Not defined in builds without X, but behind window-system test.
430(declare-function x-display-pixel-width "xfns.c" (&optional terminal)) 370(declare-function x-display-pixel-width "xfns.c" (&optional terminal))
431(declare-function x-display-pixel-height "xfns.c" (&optional terminal)) 371(declare-function x-display-pixel-height "xfns.c" (&optional terminal))
432 372
433(defun dframe-reposition-frame-emacs (new-frame parent-frame location) 373(defun dframe-reposition-frame (new-frame parent-frame location)
434 "Move NEW-FRAME to be relative to PARENT-FRAME. 374 "Move NEW-FRAME to be relative to PARENT-FRAME.
435LOCATION can be one of `random', `left-right', `top-bottom', or 375LOCATION can be one of `random', `left-right', `top-bottom', or
436a cons cell indicating a position of the form (LEFT . TOP)." 376a cons cell indicating a position of the form (LEFT . TOP)."
@@ -513,22 +453,6 @@ a cons cell indicating a position of the form (LEFT . TOP)."
513 (list (cons 'left newleft) 453 (list (cons 'left newleft)
514 (cons 'top newtop)))))) 454 (cons 'top newtop))))))
515 455
516(defun dframe-reposition-frame-xemacs (_new-frame _parent-frame _location)
517 "Move NEW-FRAME to be relative to PARENT-FRAME.
518LOCATION can be one of `random', `left-right', or `top-bottom'."
519 ;; Not yet implemented
520 )
521
522;; XEmacs function only.
523(defun dframe-needed-height (&optional frame)
524 "The needed height for the tool bar FRAME (in characters)."
525 (or frame (setq frame (selected-frame)))
526 ;; The 1 is the missing mode line or minibuffer
527 (+ 1 (/ (frame-pixel-height frame)
528 ;; This obscure code avoids a byte compiler warning in Emacs.
529 (let ((f 'face-height))
530 (funcall f 'default frame)))))
531
532(defun dframe-detach (frame-var cache-var buffer-var) 456(defun dframe-detach (frame-var cache-var buffer-var)
533 "Detach the frame in symbol FRAME-VAR. 457 "Detach the frame in symbol FRAME-VAR.
534CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'." 458CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'."
@@ -540,8 +464,7 @@ CACHE-VAR and BUFFER-VAR are symbols as in `dframe-frame-mode'."
540 (set cache-var nil) 464 (set cache-var nil)
541 ;; FIXME: Looks very suspicious. Luckily this function is unused. 465 ;; FIXME: Looks very suspicious. Luckily this function is unused.
542 (make-variable-buffer-local frame-var) 466 (make-variable-buffer-local frame-var)
543 (set frame-var oldframe) 467 (set frame-var oldframe))))
544 )))
545 468
546;;; Special frame event proxies 469;;; Special frame event proxies
547(defvar dframe-setup-hook nil 470(defvar dframe-setup-hook nil
@@ -748,16 +671,10 @@ who requested the timer. NULL-ON-ERROR is ignored."
748(defun dframe-set-timer-internal (timeout &optional _null-on-error) 671(defun dframe-set-timer-internal (timeout &optional _null-on-error)
749 "Apply a timer with TIMEOUT to call the dframe timer manager." 672 "Apply a timer with TIMEOUT to call the dframe timer manager."
750 (when dframe-timer 673 (when dframe-timer
751 (if (featurep 'xemacs) 674 (cancel-timer dframe-timer)
752 (delete-itimer dframe-timer)
753 (cancel-timer dframe-timer))
754 (setq dframe-timer nil)) 675 (setq dframe-timer nil))
755 (when timeout 676 (when timeout
756 (setq dframe-timer 677 (setq dframe-timer (run-with-idle-timer timeout t 'dframe-timer-fn))))
757 (if (featurep 'xemacs)
758 (start-itimer "dframe" 'dframe-timer-fn
759 timeout timeout t)
760 (run-with-idle-timer timeout t 'dframe-timer-fn)))))
761 678
762(defun dframe-timer-fn () 679(defun dframe-timer-fn ()
763 "Called due to the dframe timer. 680 "Called due to the dframe timer.
@@ -768,90 +685,40 @@ Evaluates all cached timer functions in sequence."
768 (funcall (car l))) 685 (funcall (car l)))
769 (setq l (cdr l))))) 686 (setq l (cdr l)))))
770 687
771;;; Menu hacking for mouse-3
772;;
773(defconst dframe-pass-event-to-popup-mode-menu
774 (let (max-args)
775 (and (fboundp 'popup-mode-menu)
776 (fboundp 'function-max-args)
777 (setq max-args (function-max-args 'popup-mode-menu))
778 (not (zerop max-args))))
779 "The EVENT arg to `popup-mode-menu' was introduced in XEmacs 21.4.0.")
780
781;; In XEmacs, we make popup menus work on the item over mouse (as
782;; opposed to where the point happens to be.) We attain this by
783;; temporarily moving the point to that place.
784;; Hrvoje Nikšić <hrvoje.niksic@avl.com>
785(defalias 'dframe-popup-kludge 688(defalias 'dframe-popup-kludge
786 (if (featurep 'xemacs) 689 (lambda (e)
787 (lambda (event) ; XEmacs. 690 "Pop up a menu related to the clicked on item.
788 "Pop up a menu related to the clicked on item.
789Must be bound to EVENT."
790 (interactive "e")
791 (save-excursion
792 (if dframe-pass-event-to-popup-mode-menu
793 (popup-mode-menu event)
794 (goto-char (event-closest-point event))
795 (beginning-of-line)
796 (forward-char (min 5 (- (line-end-position)
797 (line-beginning-position))))
798 (popup-mode-menu))
799 ;; Wait for menu to bail out. `popup-mode-menu' (and other popup
800 ;; menu functions) return immediately.
801 (let (new)
802 (while (not (misc-user-event-p (setq new (next-event))))
803 (dispatch-event new))
804 (dispatch-event new))))
805
806 (lambda (e) ; Emacs.
807 "Pop up a menu related to the clicked on item.
808Must be bound to event E." 691Must be bound to event E."
809 (interactive "e") 692 (interactive "e")
810 (save-excursion 693 (save-excursion
811 (mouse-set-point e) 694 (mouse-set-point e)
812 ;; This gets the cursor where the user can see it. 695 ;; This gets the cursor where the user can see it.
813 (if (not (bolp)) (forward-char -1)) 696 (if (not (bolp)) (forward-char -1))
814 (sit-for 0) 697 (sit-for 0)
815 (if (fboundp 'mouse-menu-major-mode-map) 698 (popup-menu (mouse-menu-major-mode-map) e))))
816 (popup-menu (mouse-menu-major-mode-map) e)
817 (with-no-warnings ; don't warn about obsolete fallback
818 (mouse-major-mode-menu e nil)))))))
819 699
820;;; Interactive user functions for the mouse 700;;; Interactive user functions for the mouse
821;; 701;;
822(defalias 'dframe-mouse-event-p 702(defalias 'dframe-mouse-event-p
823 (if (featurep 'xemacs) 703 (lambda (event)
824 'button-press-event-p 704 "Return t if the event is a mouse related event."
825 (lambda (event) 705 (if (and (listp event)
826 "Return t if the event is a mouse related event." 706 (member (event-basic-type event)
827 (if (and (listp event) 707 '(mouse-1 mouse-2 mouse-3)))
828 (member (event-basic-type event) 708 t
829 '(mouse-1 mouse-2 mouse-3))) 709 nil)))
830 t
831 nil))))
832 710
833(defun dframe-track-mouse (event) 711(defun dframe-track-mouse (event)
834 "For motion EVENT, display info about the current line." 712 "For motion EVENT, display info about the current line."
835 (interactive "e") 713 (interactive "e")
836 (when (and dframe-track-mouse-function 714 (when (and dframe-track-mouse-function
837 (or (featurep 'xemacs) ;; XEmacs always safe? 715 (windowp (posn-window (event-end event)))) ; Sometimes
838 (windowp (posn-window (event-end event))) ; Sometimes
839 ; there is no window to jump into. 716 ; there is no window to jump into.
840 ))
841
842 (funcall dframe-track-mouse-function event))) 717 (funcall dframe-track-mouse-function event)))
843 718
844(defun dframe-track-mouse-xemacs (event)
845 "For motion EVENT, display info about the current line."
846 (if (functionp (default-value 'mouse-motion-handler))
847 (funcall (default-value 'mouse-motion-handler) event))
848 (if dframe-track-mouse-function
849 (funcall dframe-track-mouse-function event)))
850
851(defun dframe-help-echo (_window &optional buffer position) 719(defun dframe-help-echo (_window &optional buffer position)
852 "Display help based context. 720 "Display help based context.
853The context is in WINDOW, viewing BUFFER, at POSITION. 721The context is in WINDOW, viewing BUFFER, at POSITION."
854BUFFER and POSITION are optional because XEmacs doesn't use them."
855 (when (and (not dframe-track-mouse-function) 722 (when (and (not dframe-track-mouse-function)
856 (bufferp buffer) 723 (bufferp buffer)
857 dframe-help-echo-function) 724 dframe-help-echo-function)
@@ -862,22 +729,8 @@ BUFFER and POSITION are optional because XEmacs doesn't use them."
862 (funcall dframe-help-echo-function)))))) 729 (funcall dframe-help-echo-function))))))
863 730
864(defun dframe-mouse-set-point (e) 731(defun dframe-mouse-set-point (e)
865 "Set point based on event E. 732 "Set point based on event E."
866Handles clicking on images in XEmacs." 733 (mouse-set-point e))
867 (if (and (featurep 'xemacs)
868 (save-excursion
869 (save-window-excursion
870 (mouse-set-point e)
871 (event-over-glyph-p e))))
872 ;; We are in XEmacs, and clicked on a picture
873 (let ((ext (event-glyph-extent e)))
874 ;; This position is back inside the extent where the
875 ;; junk we pushed into the property list lives.
876 (if (extent-end-position ext)
877 (goto-char (1- (extent-end-position ext)))
878 (mouse-set-point e)))
879 ;; We are not in XEmacs, OR we didn't click on a picture.
880 (mouse-set-point e)))
881 734
882(defun dframe-quick-mouse (e) 735(defun dframe-quick-mouse (e)
883 "Since mouse events are strange, this will keep the mouse nicely positioned. 736 "Since mouse events are strange, this will keep the mouse nicely positioned.
@@ -912,7 +765,6 @@ E is the event causing the click."
912This must be bound to a mouse event. 765This must be bound to a mouse event.
913This should be bound to mouse event E." 766This should be bound to mouse event E."
914 (interactive "e") 767 (interactive "e")
915 ;; Emacs only. XEmacs handles this via `mouse-track-click-hook'.
916 (cond ((eq (car e) 'down-mouse-1) 768 (cond ((eq (car e) 'down-mouse-1)
917 (dframe-mouse-set-point e)) 769 (dframe-mouse-set-point e))
918 ((eq (car e) 'mouse-1) 770 ((eq (car e) 'mouse-1)
@@ -933,15 +785,7 @@ redirected into a window on the attached frame."
933 (if dframe-attached-frame (dframe-select-attached-frame)) 785 (if dframe-attached-frame (dframe-select-attached-frame))
934 (pop-to-buffer buffer nil) 786 (pop-to-buffer buffer nil)
935 (other-window -1) 787 (other-window -1)
936 ;; Fix for using this hook on some platforms: Bob Weiner 788 (run-hooks 'temp-buffer-show-hook))
937 (cond ((not (featurep 'xemacs))
938 (run-hooks 'temp-buffer-show-hook))
939 ((fboundp 'run-hook-with-args)
940 (run-hook-with-args 'temp-buffer-show-hook buffer))
941 ((and (boundp 'temp-buffer-show-hook)
942 (listp temp-buffer-show-hook))
943 (mapcar (function (lambda (hook) (funcall hook buffer)))
944 temp-buffer-show-hook))))
945 789
946(defun dframe-hack-buffer-menu (_e) 790(defun dframe-hack-buffer-menu (_e)
947 "Control mouse 1 is buffer menu. 791 "Control mouse 1 is buffer menu.
@@ -949,9 +793,7 @@ This hack overrides it so that the right thing happens in the main
949Emacs frame, not in the dedicated frame. 793Emacs frame, not in the dedicated frame.
950Argument E is the event causing this activity." 794Argument E is the event causing this activity."
951 (interactive "e") 795 (interactive "e")
952 (let ((fn (lookup-key global-map (if (featurep 'xemacs) 796 (let ((fn (lookup-key global-map [C-down-mouse-1]))
953 '(control button1)
954 [C-down-mouse-1])))
955 (oldbuff (current-buffer)) 797 (oldbuff (current-buffer))
956 (newbuff nil)) 798 (newbuff nil))
957 (unwind-protect 799 (unwind-protect
@@ -977,19 +819,15 @@ broken because of the dedicated frame."
977 (switch-to-buffer buffer) 819 (switch-to-buffer buffer)
978 (call-interactively 'switch-to-buffer nil nil))) 820 (call-interactively 'switch-to-buffer nil nil)))
979 821
980;; XEmacs: this can be implemented using mode line keymaps, but there
981;; is no use, as we have horizontal scrollbar (as the docstring
982;; hints.)
983(defun dframe-mouse-hscroll (e) 822(defun dframe-mouse-hscroll (e)
984 "Read a mouse event E from the mode line, and horizontally scroll. 823 "Read a mouse event E from the mode line, and horizontally scroll.
985If the mouse is being clicked on the far left, or far right of the 824If the mouse is being clicked on the far left, or far right of
986mode-line. This is only useful for non-XEmacs." 825the mode-line."
987 (interactive "e") 826 (interactive "e")
988 (let* ((x-point (car (nth 2 (car (cdr e))))) 827 (let* ((x-point (car (nth 2 (car (cdr e)))))
989 (pixels-per-10-col (/ (* 10 (frame-pixel-width)) 828 (pixels-per-10-col (/ (* 10 (frame-pixel-width))
990 (frame-width))) 829 (frame-width)))
991 (click-col (1+ (/ (* 10 x-point) pixels-per-10-col))) 830 (click-col (1+ (/ (* 10 x-point) pixels-per-10-col))))
992 )
993 (cond ((< click-col 3) 831 (cond ((< click-col 3)
994 (scroll-left 2)) 832 (scroll-left 2))
995 ((> click-col (- (window-width) 5)) 833 ((> click-col (- (window-width) 5))