aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1993-01-26 01:58:16 +0000
committerJim Blandy1993-01-26 01:58:16 +0000
commitdbc4e1c12940079cad7b24e1654a0badcda8d6fc (patch)
treee0fbea5b15bd13d2839c8b59b624cec80f31bfd8
parent72766144811cd7258b2a59e56f6e3657537ea508 (diff)
downloademacs-dbc4e1c12940079cad7b24e1654a0badcda8d6fc.tar.gz
emacs-dbc4e1c12940079cad7b24e1654a0badcda8d6fc.zip
JimB's changes since January 18th
-rw-r--r--Makefile.in26
-rw-r--r--lisp/comint.el2
-rw-r--r--lisp/ebuff-menu.el6
-rw-r--r--lisp/ehelp.el4
-rw-r--r--lisp/electric.el4
-rw-r--r--lisp/emacs-lisp/disass.el9
-rw-r--r--lisp/emacs-lisp/edebug.el2
-rw-r--r--lisp/emerge.el2
-rw-r--r--lisp/emulation/vip.el8
-rw-r--r--lisp/frame.el2
-rw-r--r--lisp/gnus.el2
-rw-r--r--lisp/help.el2
-rw-r--r--lisp/info.el2
-rw-r--r--lisp/isearch.el16
-rw-r--r--lisp/map-ynp.el4
-rw-r--r--lisp/mouse.el724
-rw-r--r--lisp/progmodes/c-mode.el10
-rw-r--r--lisp/progmodes/fortran.el6
-rw-r--r--lisp/progmodes/simula.el2
-rw-r--r--lisp/scroll-bar.el8
-rw-r--r--lisp/simple.el13
-rw-r--r--lisp/subr.el6
-rw-r--r--lisp/term/sun-mouse.el6
-rw-r--r--lisp/terminal.el2
-rw-r--r--src/Makefile.in13
-rw-r--r--src/buffer.c15
-rw-r--r--src/buffer.h3
-rw-r--r--src/callint.c43
-rw-r--r--src/commands.h6
-rw-r--r--src/data.c20
-rw-r--r--src/dispnew.c17
-rw-r--r--src/emacs.c4
-rw-r--r--src/fns.c9
-rw-r--r--src/frame.c84
-rw-r--r--src/frame.h4
-rw-r--r--src/insdel.c8
-rw-r--r--src/keyboard.c138
-rw-r--r--src/keyboard.h3
-rw-r--r--src/keymap.c10
-rw-r--r--src/lread.c12
-rw-r--r--src/minibuf.c4
-rw-r--r--src/term.c12
-rw-r--r--src/termhooks.h11
-rw-r--r--src/window.c48
-rw-r--r--src/xfns.c86
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xselect.c.old128
-rw-r--r--src/xterm.c429
-rw-r--r--src/xterm.h19
49 files changed, 1120 insertions, 876 deletions
diff --git a/Makefile.in b/Makefile.in
index 7fb652284d1..c28918af947 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -231,7 +231,6 @@ lib-src/Makefile: ${srcdir}/lib-src/Makefile.in Makefile
231 -e 's|^LOADLIBES *=.*$$|LOADLIBES='"${libsrc_libs}"'|' \ 231 -e 's|^LOADLIBES *=.*$$|LOADLIBES='"${libsrc_libs}"'|' \
232 -e '/^# DIST: /d') > lib-src/Makefile.tmp 232 -e '/^# DIST: /d') > lib-src/Makefile.tmp
233 ${srcdir}/move-if-change lib-src/Makefile.tmp lib-src/Makefile 233 ${srcdir}/move-if-change lib-src/Makefile.tmp lib-src/Makefile
234 # Remind people not to edit this.
235 chmod -w lib-src/Makefile 234 chmod -w lib-src/Makefile
236 235
237src/Makefile: ${srcdir}/src/Makefile.in Makefile 236src/Makefile: ${srcdir}/src/Makefile.in Makefile
@@ -248,7 +247,6 @@ src/Makefile: ${srcdir}/src/Makefile.in Makefile
248 -e 's|^CONFIG_CFLAGS *=.*$$|CONFIG_CFLAGS='"${CONFIG_CFLAGS}"'|' \ 247 -e 's|^CONFIG_CFLAGS *=.*$$|CONFIG_CFLAGS='"${CONFIG_CFLAGS}"'|' \
249 -e '/^# DIST: /d') > src/Makefile.tmp 248 -e '/^# DIST: /d') > src/Makefile.tmp
250 ${srcdir}/move-if-change src/Makefile.tmp src/Makefile 249 ${srcdir}/move-if-change src/Makefile.tmp src/Makefile
251 # Remind people not to edit this.
252 chmod -w src/Makefile 250 chmod -w src/Makefile
253 251
254oldXMenu/Makefile: ${srcdir}/oldXMenu/Makefile Makefile 252oldXMenu/Makefile: ${srcdir}/oldXMenu/Makefile Makefile
@@ -262,10 +260,10 @@ Makefile:
262 260
263# ==================== Installation ==================== 261# ==================== Installation ====================
264 262
263## If we let lib-src do its own installation, that means we
264## don't have to duplicate the list of utilities to install in
265## this Makefile as well.
265install: all mkdir 266install: all mkdir
266 ## If we let lib-src do its own installation, that means we
267 ## don't have to duplicate the list of utilities to install in
268 ## this Makefile as well.
269 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir}) 267 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
270 -set ${COPYDESTS} ; \ 268 -set ${COPYDESTS} ; \
271 for dir in ${COPYDIR} ; do \ 269 for dir in ${COPYDIR} ; do \
@@ -297,10 +295,10 @@ install: all mkdir
297 -rm -f ${bindir}/emacs 295 -rm -f ${bindir}/emacs
298 ln ${bindir}/emacs-${version} ${bindir}/emacs 296 ln ${bindir}/emacs-${version} ${bindir}/emacs
299 297
298## If we let lib-src do its own installation, that means we
299## don't have to duplicate the list of utilities to install in
300## this Makefile as well.
300install.sysv: all mkdir 301install.sysv: all mkdir
301 ## If we let lib-src do its own installation, that means we
302 ## don't have to duplicate the list of utilities to install in
303 ## this Makefile as well.
304 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir}) 302 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
305 -set ${COPYDESTS} ; \ 303 -set ${COPYDESTS} ; \
306 for dir in ${COPYDIR} ; do \ 304 for dir in ${COPYDIR} ; do \
@@ -330,10 +328,10 @@ install.sysv: all mkdir
330 -cpset src/emacs ${bindir}/emacs-${version} 1755 bin bin 328 -cpset src/emacs ${bindir}/emacs-${version} 1755 bin bin
331 -ln ${bindir}/emacs-${version} ${bindir}/emacs 329 -ln ${bindir}/emacs-${version} ${bindir}/emacs
332 330
331## If we let lib-src do its own installation, that means we
332## don't have to duplicate the list of utilities to install in
333## this Makefile as well.
333install.xenix: all mkdir 334install.xenix: all mkdir
334 ## If we let lib-src do its own installation, that means we
335 ## don't have to duplicate the list of utilities to install in
336 ## this Makefile as well.
337 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir}) 335 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
338 -set ${COPYDESTS} ; \ 336 -set ${COPYDESTS} ; \
339 for dir in ${COPYDIR} ; do \ 337 for dir in ${COPYDIR} ; do \
@@ -368,10 +366,10 @@ install.xenix: all mkdir
368 chmod 1755 ${bindir}/emacs 366 chmod 1755 ${bindir}/emacs
369 -rm -f ${bindir}/emacs.old 367 -rm -f ${bindir}/emacs.old
370 368
369## If we let lib-src do its own installation, that means we
370## don't have to duplicate the list of utilities to install in
371## this Makefile as well.
371install.aix: all mkdir 372install.aix: all mkdir
372 ## If we let lib-src do its own installation, that means we
373 ## don't have to duplicate the list of utilities to install in
374 ## this Makefile as well.
375 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir}) 373 (cd lib-src; $(MAKE) install ${MFLAGS} bindir=${bindir} libdir=${libdir})
376 -set ${COPYDESTS} ; \ 374 -set ${COPYDESTS} ; \
377 for dir in ${COPYDIR} ; do \ 375 for dir in ${COPYDIR} ; do \
diff --git a/lisp/comint.el b/lisp/comint.el
index 94e5201cd9f..0c2022e53bf 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1091,7 +1091,7 @@ it just adds completion characters to the end of the filename."
1091 (let ((ch (read-char))) 1091 (let ((ch (read-char)))
1092 (if (= ch ?\ ) 1092 (if (= ch ?\ )
1093 (set-window-configuration conf) 1093 (set-window-configuration conf)
1094 (setq unread-command-event ch)))))))) 1094 (setq unread-command-events (list ch)))))))))
1095 1095
1096;;; Converting process modes to use comint mode 1096;;; Converting process modes to use comint mode
1097;;; =========================================================================== 1097;;; ===========================================================================
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index d39b819a1de..d0feab9ca70 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -63,8 +63,8 @@ Calls value of `electric-buffer-menu-mode-hook' on entry if non-nil.
63 (setq select 63 (setq select
64 (catch 'electric-buffer-menu-select 64 (catch 'electric-buffer-menu-select
65 (message "<<< Press Space to bury the buffer list >>>") 65 (message "<<< Press Space to bury the buffer list >>>")
66 (if (= (setq unread-command-event (read-char)) ?\ ) 66 (if (= (setq unread-command-events (list (read-char))) ?\ )
67 (progn (setq unread-command-event nil) 67 (progn (setq unread-command-events nil)
68 (throw 'electric-buffer-menu-select nil))) 68 (throw 'electric-buffer-menu-select nil)))
69 (let ((first (progn (goto-char (point-min)) 69 (let ((first (progn (goto-char (point-min))
70 (forward-line 2) 70 (forward-line 2)
@@ -196,7 +196,7 @@ electric-buffer-menu-mode-hook if it is non-nil."
196 196
197(defun Electric-buffer-menu-exit () 197(defun Electric-buffer-menu-exit ()
198 (interactive) 198 (interactive)
199 (setq unread-command-event last-input-char) 199 (setq unread-command-events (list last-input-char))
200 ;; for robustness 200 ;; for robustness
201 (condition-case () 201 (condition-case ()
202 (throw 'electric-buffer-menu-select nil) 202 (throw 'electric-buffer-menu-select nil)
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index c6a7b77716a..327d48936ba 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -119,8 +119,8 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit"
119 (catch 'exit 119 (catch 'exit
120 (if (pos-visible-in-window-p (point-max)) 120 (if (pos-visible-in-window-p (point-max))
121 (progn (message "<<< Press Space to bury the help buffer >>>") 121 (progn (message "<<< Press Space to bury the help buffer >>>")
122 (if (= (setq unread-command-event (read-char)) ?\ ) 122 (if (= (setq unread-command-events (list (read-char))) ?\ )
123 (progn (setq unread-command-event nil) 123 (progn (setq unread-command-events nil)
124 (throw 'exit t))))) 124 (throw 'exit t)))))
125 (let (up down both neither 125 (let (up down both neither
126 (standard (and (eq (key-binding " ") 126 (standard (and (eq (key-binding " ")
diff --git a/lisp/electric.el b/lisp/electric.el
index acc002abaac..3f91adf2093 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -85,7 +85,7 @@
85 cmd this-command) 85 cmd this-command)
86 (if (or (prog1 quit-flag (setq quit-flag nil)) 86 (if (or (prog1 quit-flag (setq quit-flag nil))
87 (= last-input-char ?\C-g)) 87 (= last-input-char ?\C-g))
88 (progn (setq unread-command-event nil 88 (progn (setq unread-command-events nil
89 prefix-arg nil) 89 prefix-arg nil)
90 ;; If it wasn't cancelling a prefix character, then quit. 90 ;; If it wasn't cancelling a prefix character, then quit.
91 (if (or (= (length (this-command-keys)) 1) 91 (if (or (= (length (this-command-keys)) 1)
@@ -101,7 +101,7 @@
101 (setq last-command this-command) 101 (setq last-command this-command)
102 (if (or (prog1 quit-flag (setq quit-flag nil)) 102 (if (or (prog1 quit-flag (setq quit-flag nil))
103 (= last-input-char ?\C-g)) 103 (= last-input-char ?\C-g))
104 (progn (setq unread-command-event nil) 104 (progn (setq unread-command-events nil)
105 (if (not inhibit-quit) 105 (if (not inhibit-quit)
106 (progn (ding) 106 (progn (ding)
107 (message "Quit") 107 (message "Quit")
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 09f6ea3d687..aca4f015bb1 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -41,6 +41,7 @@
41 41
42(defvar disassemble-recursive-indent 3 "*") 42(defvar disassemble-recursive-indent 3 "*")
43 43
44;;;###autoload
44(defun disassemble (object &optional buffer indent interactive-p) 45(defun disassemble (object &optional buffer indent interactive-p)
45 "Print disassembled code for OBJECT in (optional) BUFFER. 46 "Print disassembled code for OBJECT in (optional) BUFFER.
46OBJECT can be a symbol defined as a function, or a function itself 47OBJECT can be a symbol defined as a function, or a function itself
@@ -136,7 +137,7 @@ redefine OBJECT if it is a symbol."
136 (insert "\n")))) 137 (insert "\n"))))
137 (cond ((and (consp obj) (assq 'byte-code obj)) 138 (cond ((and (consp obj) (assq 'byte-code obj))
138 (disassemble-1 (assq 'byte-code obj) indent)) 139 (disassemble-1 (assq 'byte-code obj) indent))
139 ((compiled-function-p obj) 140 ((byte-code-function-p obj)
140 (disassemble-1 obj indent)) 141 (disassemble-1 obj indent))
141 (t 142 (t
142 (insert "Uncompiled body: ") 143 (insert "Uncompiled body: ")
@@ -195,14 +196,14 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler."
195 (setq arg (car arg)) 196 (setq arg (car arg))
196 ;; but if the value of the constant is compiled code, then 197 ;; but if the value of the constant is compiled code, then
197 ;; recursively disassemble it. 198 ;; recursively disassemble it.
198 (cond ((or (compiled-function-p arg) 199 (cond ((or (byte-code-function-p arg)
199 (and (eq (car-safe arg) 'lambda) 200 (and (eq (car-safe arg) 'lambda)
200 (assq 'byte-code arg)) 201 (assq 'byte-code arg))
201 (and (eq (car-safe arg) 'macro) 202 (and (eq (car-safe arg) 'macro)
202 (or (compiled-function-p (cdr arg)) 203 (or (byte-code-function-p (cdr arg))
203 (and (eq (car-safe (cdr arg)) 'lambda) 204 (and (eq (car-safe (cdr arg)) 'lambda)
204 (assq 'byte-code (cdr arg)))))) 205 (assq 'byte-code (cdr arg))))))
205 (cond ((compiled-function-p arg) 206 (cond ((byte-code-function-p arg)
206 (insert "<compiled-function>\n")) 207 (insert "<compiled-function>\n"))
207 ((eq (car-safe arg) 'lambda) 208 ((eq (car-safe arg) 'lambda)
208 (insert "<compiled lambda>")) 209 (insert "<compiled lambda>"))
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 1f5f6dca46f..1003e15d4c7 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1480,7 +1480,7 @@ Should be 0 at the top level.")
1480 (last-command last-command) 1480 (last-command last-command)
1481 (this-command this-command) 1481 (this-command this-command)
1482 (last-input-char last-input-char) 1482 (last-input-char last-input-char)
1483 ;; Assume no edebug command sets unread-command-char. 1483 ;; Assume no edebug command sets unread-command-events.
1484;; (unread-command-char -1) 1484;; (unread-command-char -1)
1485 1485
1486 (debug-on-error debug-on-error) 1486 (debug-on-error debug-on-error)
diff --git a/lisp/emerge.el b/lisp/emerge.el
index e70bf3969c6..2309c6db93a 100644
--- a/lisp/emerge.el
+++ b/lisp/emerge.el
@@ -2910,7 +2910,7 @@ SPC, it is ignored; if it is anything else, it is processed as a command."
2910 (enlarge-window 1)) 2910 (enlarge-window 1))
2911 (let ((c (read-char))) 2911 (let ((c (read-char)))
2912 (if (/= c 32) 2912 (if (/= c 32)
2913 (setq unread-command-event c)))))))) 2913 (setq unread-command-events (list c)))))))))
2914 2914
2915;; Improved auto-save file names. 2915;; Improved auto-save file names.
2916;; This function fixes many problems with the standard auto-save file names: 2916;; This function fixes many problems with the standard auto-save file names:
diff --git a/lisp/emulation/vip.el b/lisp/emulation/vip.el
index 9c57fdcec69..14da705e602 100644
--- a/lisp/emulation/vip.el
+++ b/lisp/emulation/vip.el
@@ -333,9 +333,9 @@ vi mode. ARG is used as the prefix value for the executed command. If
333CHAR is given it becomes the first character of the command." 333CHAR is given it becomes the first character of the command."
334 (interactive "P") 334 (interactive "P")
335 (let (com (buff (current-buffer)) (first t)) 335 (let (com (buff (current-buffer)) (first t))
336 (if char (setq unread-command-event char)) 336 (if char (setq unread-command-events (list char)))
337 (setq prefix-arg arg) 337 (setq prefix-arg arg)
338 (while (or first unread-command-event) 338 (while (or first unread-command-events)
339 ;; this while loop is executed until unread command char will be 339 ;; this while loop is executed until unread command char will be
340 ;; exhausted. 340 ;; exhausted.
341 (setq first nil) 341 (setq first nil)
@@ -393,7 +393,7 @@ obtained so far, and COM is the command part obtained so far."
393 (while (= char ?U) 393 (while (= char ?U)
394 (vip-describe-arg prefix-arg) 394 (vip-describe-arg prefix-arg)
395 (setq char (read-char))) 395 (setq char (read-char)))
396 (setq unread-command-event char)) 396 (setq unread-command-events (list char)))
397 397
398(defun vip-prefix-arg-com (char value com) 398(defun vip-prefix-arg-com (char value com)
399 "Vi operator as prefix argument." 399 "Vi operator as prefix argument."
@@ -447,7 +447,7 @@ obtained so far, and COM is the command part obtained so far."
447 (while (= char ?U) 447 (while (= char ?U)
448 (vip-describe-arg prefix-arg) 448 (vip-describe-arg prefix-arg)
449 (setq char (read-char))) 449 (setq char (read-char)))
450 (setq unread-command-event char)) 450 (setq unread-command-events (list char)))
451 ;; as com is non-nil, this means that we have a command to execute 451 ;; as com is non-nil, this means that we have a command to execute
452 (if (or (= (car com) ?r) (= (car com) ?R)) 452 (if (or (= (car com) ?r) (= (car com) ?R))
453 ;; execute apropriate region command. 453 ;; execute apropriate region command.
diff --git a/lisp/frame.el b/lisp/frame.el
index 59f87e3f858..d8060baf9ea 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -113,7 +113,7 @@ These supercede the values given in default-frame-alist.")
113;;; need to see if it should go away or change. Create a text frame 113;;; need to see if it should go away or change. Create a text frame
114;;; here. 114;;; here.
115(defun frame-notice-user-settings () 115(defun frame-notice-user-settings ()
116 (if (live-frame-p frame-initial-frame) 116 (if (frame-live-p frame-initial-frame)
117 (progn 117 (progn
118 ;; If the user wants a minibuffer-only frame, we'll have to 118 ;; If the user wants a minibuffer-only frame, we'll have to
119 ;; make a new one; you can't remove or add a root window to/from 119 ;; make a new one; you can't remove or add a root window to/from
diff --git a/lisp/gnus.el b/lisp/gnus.el
index c472ed04216..4859096721f 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -2287,7 +2287,7 @@ If argument UNREAD is non-nil, only unread article is selected."
2287 (let ((char (read-char))) 2287 (let ((char (read-char)))
2288 (if (= char cmd) 2288 (if (= char cmd)
2289 (gnus-Subject-next-group nil) 2289 (gnus-Subject-next-group nil)
2290 (setq unread-command-event char)))) 2290 (setq unread-command-events (list char)))))
2291 ) 2291 )
2292 )) 2292 ))
2293 ))) 2293 )))
diff --git a/lisp/help.el b/lisp/help.el
index f7cdbf35414..d968aedb7a7 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -293,7 +293,7 @@ C-w print information on absence of warranty for GNU Emacs."
293 (princ (cond ((stringp def) "a keyboard macro.") 293 (princ (cond ((stringp def) "a keyboard macro.")
294 ((subrp def) 294 ((subrp def)
295 (concat beg "built-in function.")) 295 (concat beg "built-in function."))
296 ((compiled-function-p def) 296 ((byte-code-function-p def)
297 (concat beg "compiled Lisp function.")) 297 (concat beg "compiled Lisp function."))
298 ((symbolp def) 298 ((symbolp def)
299 (format "alias for `%s'." def)) 299 (format "alias for `%s'." def))
diff --git a/lisp/info.el b/lisp/info.el
index 4f463b1dd85..5ed08baab28 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -768,7 +768,7 @@ N is the digit argument used to invoke this command."
768 (message (if flag "Type Space to see more" 768 (message (if flag "Type Space to see more"
769 "Type Space to return to Info")) 769 "Type Space to return to Info"))
770 (if (/= ?\ (setq ch (read-char))) 770 (if (/= ?\ (setq ch (read-char)))
771 (progn (setq unread-command-event ch) nil) 771 (progn (setq unread-command-events (list ch)) nil)
772 flag)) 772 flag))
773 (scroll-up))))) 773 (scroll-up)))))
774 774
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 2057e40c3f0..6a110214906 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -4,7 +4,7 @@
4;; LCD Archive Entry: 4;; LCD Archive Entry:
5;; isearch-mode|Daniel LaLiberte|liberte@cs.uiuc.edu 5;; isearch-mode|Daniel LaLiberte|liberte@cs.uiuc.edu
6;; |A minor mode replacement for isearch.el. 6;; |A minor mode replacement for isearch.el.
7;; |$Date: 1992/11/07 06:17:04 $|$Revision: 1.15 $|~/modes/isearch-mode.el 7;; |$Date: 1992/11/16 01:37:06 $|$Revision: 1.16 $|~/modes/isearch-mode.el
8 8
9;; This file is not yet part of GNU Emacs, but it is based almost 9;; This file is not yet part of GNU Emacs, but it is based almost
10;; entirely on isearch.el which is part of GNU Emacs. 10;; entirely on isearch.el which is part of GNU Emacs.
@@ -88,8 +88,15 @@
88;;;==================================================================== 88;;;====================================================================
89;;; Change History 89;;; Change History
90 90
91;;; $Header: /home/gd/gnu/emacs/19.0/lisp/RCS/isearch-mode.el,v 1.15 1992/11/07 06:17:04 jimb Exp jimb $ 91;;; $Header: /home/gd/gnu/emacs/19.0/lisp/RCS/isearch-mode.el,v 1.16 1992/11/16 01:37:06 jimb Exp jimb $
92;;; $Log: isearch-mode.el,v $ 92;;; $Log: isearch-mode.el,v $
93; Revision 1.16 1992/11/16 01:37:06 jimb
94; * bytecomp.el: Declare unread-command-char an obsolete variable.
95; * vip.el (vip-escape-to-emacs, vip-prefix-arg-value,
96; vip-prefix-arg-com): Use unread-command-event instead of
97; unread-command-char; respect its new semantics.
98; * isearch-mode.el (isearch-update, isearch-unread): Same.
99;
93; Revision 1.15 1992/11/07 06:17:04 jimb 100; Revision 1.15 1992/11/07 06:17:04 jimb
94; * isearch.el (isearch-frames-exist): This isn't what we want - 101; * isearch.el (isearch-frames-exist): This isn't what we want -
95; replaced by... 102; replaced by...
@@ -557,7 +564,7 @@ is treated as a regexp. See \\[isearch-forward] for more info."
557 (if (if isearch-event-data-type 564 (if (if isearch-event-data-type
558 (null unread-command-event) 565 (null unread-command-event)
559 (if isearch-gnu-emacs-events 566 (if isearch-gnu-emacs-events
560 (null unread-command-event) 567 (null unread-command-events)
561 (< unread-command-char 0))) 568 (< unread-command-char 0)))
562 (progn 569 (progn
563 (if (not (input-pending-p)) 570 (if (not (input-pending-p))
@@ -1413,6 +1420,7 @@ have special meaning in a regexp."
1413 1420
1414;; To quiet the byte-compiler. 1421;; To quiet the byte-compiler.
1415(defvar unread-command-event) 1422(defvar unread-command-event)
1423(defvar unread-command-events)
1416(defvar last-command-event) 1424(defvar last-command-event)
1417 1425
1418(defun isearch-char-to-string (c) 1426(defun isearch-char-to-string (c)
@@ -1429,7 +1437,7 @@ have special meaning in a regexp."
1429 (isearch-event-data-type 1437 (isearch-event-data-type
1430 (setq unread-command-event char-or-event)) 1438 (setq unread-command-event char-or-event))
1431 (isearch-gnu-emacs-events 1439 (isearch-gnu-emacs-events
1432 (setq unread-command-event char-or-event)) 1440 (setq unread-command-events (list char-or-event)))
1433 (t 1441 (t
1434 (setq unread-command-char char-or-event)))) 1442 (setq unread-command-char char-or-event))))
1435 1443
diff --git a/lisp/map-ynp.el b/lisp/map-ynp.el
index 37f9e702c86..ddc91d32776 100644
--- a/lisp/map-ynp.el
+++ b/lisp/map-ynp.el
@@ -100,7 +100,7 @@ the current %s and exit."
100 prompt char elt tail 100 prompt char elt tail
101 (next (if (or (symbolp list) 101 (next (if (or (symbolp list)
102 (subrp list) 102 (subrp list)
103 (compiled-function-p list) 103 (byte-code-function-p list)
104 (and (consp list) 104 (and (consp list)
105 (eq (car list) 'lambda))) 105 (eq (car list) 'lambda)))
106 (function (lambda () 106 (function (lambda ()
@@ -157,7 +157,7 @@ the current %s and exit."
157 (funcall actor elt) 157 (funcall actor elt)
158 (setq actions (1+ actions)))))) 158 (setq actions (1+ actions))))))
159 ((= ?? char) 159 ((= ?? char)
160 (setq unread-command-event help-char) 160 (setq unread-command-events (list help-char))
161 (setq next (` (lambda () 161 (setq next (` (lambda ()
162 (setq next '(, next)) 162 (setq next '(, next))
163 '(, elt))))) 163 '(, elt)))))
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 27db7536758..7994db2a92d 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1,6 +1,6 @@
1;;; mouse.el --- window system-independent mouse support. 1;;; mouse.el --- window system-independent mouse support.
2 2
3;;; Copyright (C) 1988, 1992 Free Software Foundation, Inc. 3;;; Copyright (C) 1988, 1992, 1993 Free Software Foundation, Inc.
4 4
5;; Maintainer: FSF 5;; Maintainer: FSF
6;; Keywords: hardware 6;; Keywords: hardware
@@ -40,11 +40,12 @@ The `posn-' functions access elements of such lists."
40 (nth 1 event)) 40 (nth 1 event))
41 41
42(defsubst event-end (event) 42(defsubst event-end (event)
43 "Return the ending location of EVENT. EVENT should be a drag event. 43 "Return the ending location of EVENT. EVENT should be a click or drag event.
44If EVENT is a click event, this function is the same as `event-start'.
44The return value is of the form 45The return value is of the form
45 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP) 46 (WINDOW BUFFER-POSITION (COL . ROW) TIMESTAMP)
46The `posn-' functions access elements of such lists." 47The `posn-' functions access elements of such lists."
47 (nth 2 event)) 48 (nth (1- (length event)) event))
48 49
49(defsubst posn-window (position) 50(defsubst posn-window (position)
50 "Return the window in POSITION. 51 "Return the window in POSITION.
@@ -113,7 +114,7 @@ This command must be bound to a mouse click."
113The window is split at the column clicked on. 114The window is split at the column clicked on.
114This command must be bound to a mouse click." 115This command must be bound to a mouse click."
115 (interactive "@e") 116 (interactive "@e")
116 (split-window-horizontally (1+ (car (mouse-coords click))))) 117 (split-window-horizontally (1+ (car (posn-col-row (event-end click))))))
117 118
118(defun mouse-set-point (click) 119(defun mouse-set-point (click)
119 "Move point to the position clicked on with the mouse. 120 "Move point to the position clicked on with the mouse.
@@ -173,6 +174,14 @@ This does not delete the region; it acts like \\[kill-ring-save]."
173 (mouse-set-mark click) 174 (mouse-set-mark click)
174 (call-interactively 'kill-ring-save)) 175 (call-interactively 'kill-ring-save))
175 176
177;;; This function used to delete the text between point and the mouse
178;;; whenever it was equal to the front of the kill ring, but some
179;;; people found that confusing.
180
181;;; A list (TEXT START END), describing the text and position of the last
182;;; invocation of mouse-save-then-kill.
183(defvar mouse-save-then-kill-posn nil)
184
176(defun mouse-save-then-kill (click) 185(defun mouse-save-then-kill (click)
177 "Save text to point in kill ring; the second time, kill the text. 186 "Save text to point in kill ring; the second time, kill the text.
178If the text between point and the mouse is the same as what's 187If the text between point and the mouse is the same as what's
@@ -181,18 +190,24 @@ Otherwise, it adds the text to the kill ring, like \\[kill-ring-save],
181which prepares for a second click to delete the text." 190which prepares for a second click to delete the text."
182 (interactive "e") 191 (interactive "e")
183 (let ((click-posn (posn-point (event-start click)))) 192 (let ((click-posn (posn-point (event-start click))))
184 (if (string= (buffer-substring (point) click-posn) (car kill-ring)) 193 (if (and (eq last-command 'kill-region)
185 ;; If this text was already saved in kill ring, 194 mouse-save-then-kill-posn
186 ;; now delete it from the buffer. 195 (eq (car mouse-save-then-kill-posn) (car kill-ring))
196 (equal (cdr mouse-save-then-kill-posn) (list (point) click-posn)))
197 ;; If this is the second time we've called
198 ;; mouse-save-then-kill, delete the text from the buffer.
187 (progn 199 (progn
188 (let ((buffer-undo-list t)) 200 (let ((buffer-undo-list t))
189 (delete-region (point) (mark))) 201 (delete-region (point) (mark)))
190 ;; Make the undo list by hand so it is shared. 202 ;; Make the undo list by hand so it is shared.
191 (setq buffer-undo-list 203 (if (not (eq buffer-undo-list t))
192 (cons (cons (car kill-ring) (point)) buffer-undo-list))) 204 (setq buffer-undo-list
205 (cons (cons (car kill-ring) (point)) buffer-undo-list))))
193 ;; Otherwise, save this region. 206 ;; Otherwise, save this region.
194 (mouse-set-mark click) 207 (mouse-set-mark click)
195 (call-interactively 'kill-ring-save)))) 208 (call-interactively 'kill-ring-save)
209 (setq mouse-save-then-kill-posn
210 (list (car kill-ring) (point) click-posn)))))
196 211
197(defun mouse-buffer-menu (event) 212(defun mouse-buffer-menu (event)
198 "Pop up a menu of buffers for selection with the mouse. 213 "Pop up a menu of buffers for selection with the mouse.
@@ -225,329 +240,331 @@ and selects that window."
225 (select-window window) 240 (select-window window)
226 (switch-to-buffer buf)))))) 241 (switch-to-buffer buf))))))
227 242
228;; Commands for the scroll bar. 243;;; These need to be rewritten for the new scrollbar implementation.
229 244
230(defun mouse-scroll-down (click) 245;;;!! ;; Commands for the scroll bar.
231 (interactive "@e") 246;;;!!
232 (scroll-down (1+ (cdr (mouse-coords click))))) 247;;;!! (defun mouse-scroll-down (click)
233 248;;;!! (interactive "@e")
234(defun mouse-scroll-up (click) 249;;;!! (scroll-down (1+ (cdr (mouse-coords click)))))
235 (interactive "@e") 250;;;!!
236 (scroll-up (1+ (cdr (mouse-coords click))))) 251;;;!! (defun mouse-scroll-up (click)
237 252;;;!! (interactive "@e")
238(defun mouse-scroll-down-full () 253;;;!! (scroll-up (1+ (cdr (mouse-coords click)))))
239 (interactive "@") 254;;;!!
240 (scroll-down nil)) 255;;;!! (defun mouse-scroll-down-full ()
241 256;;;!! (interactive "@")
242(defun mouse-scroll-up-full () 257;;;!! (scroll-down nil))
243 (interactive "@") 258;;;!!
244 (scroll-up nil)) 259;;;!! (defun mouse-scroll-up-full ()
245 260;;;!! (interactive "@")
246(defun mouse-scroll-move-cursor (click) 261;;;!! (scroll-up nil))
247 (interactive "@e") 262;;;!!
248 (move-to-window-line (1+ (cdr (mouse-coords click))))) 263;;;!! (defun mouse-scroll-move-cursor (click)
249 264;;;!! (interactive "@e")
250(defun mouse-scroll-absolute (event) 265;;;!! (move-to-window-line (1+ (cdr (mouse-coords click)))))
251 (interactive "@e") 266;;;!!
252 (let* ((pos (car event)) 267;;;!! (defun mouse-scroll-absolute (event)
253 (position (car pos)) 268;;;!! (interactive "@e")
254 (length (car (cdr pos)))) 269;;;!! (let* ((pos (car event))
255 (if (<= length 0) (setq length 1)) 270;;;!! (position (car pos))
256 (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size))))) 271;;;!! (length (car (cdr pos))))
257 (newpos (* (/ (* (/ (buffer-size) scale-factor) 272;;;!! (if (<= length 0) (setq length 1))
258 position) 273;;;!! (let* ((scale-factor (max 1 (/ length (/ 8000000 (buffer-size)))))
259 length) 274;;;!! (newpos (* (/ (* (/ (buffer-size) scale-factor)
260 scale-factor))) 275;;;!! position)
261 (goto-char newpos) 276;;;!! length)
262 (recenter '(4))))) 277;;;!! scale-factor)))
263 278;;;!! (goto-char newpos)
264(defun mouse-scroll-left (click) 279;;;!! (recenter '(4)))))
265 (interactive "@e") 280;;;!!
266 (scroll-left (1+ (car (mouse-coords click))))) 281;;;!! (defun mouse-scroll-left (click)
267 282;;;!! (interactive "@e")
268(defun mouse-scroll-right (click) 283;;;!! (scroll-left (1+ (car (mouse-coords click)))))
269 (interactive "@e") 284;;;!!
270 (scroll-right (1+ (car (mouse-coords click))))) 285;;;!! (defun mouse-scroll-right (click)
271 286;;;!! (interactive "@e")
272(defun mouse-scroll-left-full () 287;;;!! (scroll-right (1+ (car (mouse-coords click)))))
273 (interactive "@") 288;;;!!
274 (scroll-left nil)) 289;;;!! (defun mouse-scroll-left-full ()
275 290;;;!! (interactive "@")
276(defun mouse-scroll-right-full () 291;;;!! (scroll-left nil))
277 (interactive "@") 292;;;!!
278 (scroll-right nil)) 293;;;!! (defun mouse-scroll-right-full ()
279 294;;;!! (interactive "@")
280(defun mouse-scroll-move-cursor-horizontally (click) 295;;;!! (scroll-right nil))
281 (interactive "@e") 296;;;!!
282 (move-to-column (1+ (car (mouse-coords click))))) 297;;;!! (defun mouse-scroll-move-cursor-horizontally (click)
283 298;;;!! (interactive "@e")
284(defun mouse-scroll-absolute-horizontally (event) 299;;;!! (move-to-column (1+ (car (mouse-coords click)))))
285 (interactive "@e") 300;;;!!
286 (let* ((pos (car event)) 301;;;!! (defun mouse-scroll-absolute-horizontally (event)
287 (position (car pos)) 302;;;!! (interactive "@e")
288 (length (car (cdr pos)))) 303;;;!! (let* ((pos (car event))
289 (set-window-hscroll (selected-window) 33))) 304;;;!! (position (car pos))
290 305;;;!! (length (car (cdr pos))))
291(global-set-key [scroll-bar mouse-1] 'mouse-scroll-up) 306;;;!! (set-window-hscroll (selected-window) 33)))
292(global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute) 307;;;!!
293(global-set-key [scroll-bar mouse-3] 'mouse-scroll-down) 308;;;!! (global-set-key [scroll-bar mouse-1] 'mouse-scroll-up)
294 309;;;!! (global-set-key [scroll-bar mouse-2] 'mouse-scroll-absolute)
295(global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor) 310;;;!! (global-set-key [scroll-bar mouse-3] 'mouse-scroll-down)
296(global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor) 311;;;!!
297(global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor) 312;;;!! (global-set-key [vertical-slider mouse-1] 'mouse-scroll-move-cursor)
298 313;;;!! (global-set-key [vertical-slider mouse-2] 'mouse-scroll-move-cursor)
299(global-set-key [thumbup mouse-1] 'mouse-scroll-up-full) 314;;;!! (global-set-key [vertical-slider mouse-3] 'mouse-scroll-move-cursor)
300(global-set-key [thumbup mouse-2] 'mouse-scroll-up-full) 315;;;!!
301(global-set-key [thumbup mouse-3] 'mouse-scroll-up-full) 316;;;!! (global-set-key [thumbup mouse-1] 'mouse-scroll-up-full)
302 317;;;!! (global-set-key [thumbup mouse-2] 'mouse-scroll-up-full)
303(global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full) 318;;;!! (global-set-key [thumbup mouse-3] 'mouse-scroll-up-full)
304(global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full) 319;;;!!
305(global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full) 320;;;!! (global-set-key [thumbdown mouse-1] 'mouse-scroll-down-full)
306 321;;;!! (global-set-key [thumbdown mouse-2] 'mouse-scroll-down-full)
307(global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left) 322;;;!! (global-set-key [thumbdown mouse-3] 'mouse-scroll-down-full)
308(global-set-key [horizontal-scroll-bar mouse-2] 323;;;!!
309 'mouse-scroll-absolute-horizontally) 324;;;!! (global-set-key [horizontal-scroll-bar mouse-1] 'mouse-scroll-left)
310(global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right) 325;;;!! (global-set-key [horizontal-scroll-bar mouse-2]
311 326;;;!! 'mouse-scroll-absolute-horizontally)
312(global-set-key [horizontal-slider mouse-1] 327;;;!! (global-set-key [horizontal-scroll-bar mouse-3] 'mouse-scroll-right)
313 'mouse-scroll-move-cursor-horizontally) 328;;;!!
314(global-set-key [horizontal-slider mouse-2] 329;;;!! (global-set-key [horizontal-slider mouse-1]
315 'mouse-scroll-move-cursor-horizontally) 330;;;!! 'mouse-scroll-move-cursor-horizontally)
316(global-set-key [horizontal-slider mouse-3] 331;;;!! (global-set-key [horizontal-slider mouse-2]
317 'mouse-scroll-move-cursor-horizontally) 332;;;!! 'mouse-scroll-move-cursor-horizontally)
318 333;;;!! (global-set-key [horizontal-slider mouse-3]
319(global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full) 334;;;!! 'mouse-scroll-move-cursor-horizontally)
320(global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full) 335;;;!!
321(global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full) 336;;;!! (global-set-key [thumbleft mouse-1] 'mouse-scroll-left-full)
322 337;;;!! (global-set-key [thumbleft mouse-2] 'mouse-scroll-left-full)
323(global-set-key [thumbright mouse-1] 'mouse-scroll-right-full) 338;;;!! (global-set-key [thumbleft mouse-3] 'mouse-scroll-left-full)
324(global-set-key [thumbright mouse-2] 'mouse-scroll-right-full) 339;;;!!
325(global-set-key [thumbright mouse-3] 'mouse-scroll-right-full) 340;;;!! (global-set-key [thumbright mouse-1] 'mouse-scroll-right-full)
326 341;;;!! (global-set-key [thumbright mouse-2] 'mouse-scroll-right-full)
327(global-set-key [horizontal-scroll-bar S-mouse-2] 342;;;!! (global-set-key [thumbright mouse-3] 'mouse-scroll-right-full)
328 'mouse-split-window-horizontally) 343;;;!!
329(global-set-key [mode-line S-mouse-2] 344;;;!! (global-set-key [horizontal-scroll-bar S-mouse-2]
330 'mouse-split-window-horizontally) 345;;;!! 'mouse-split-window-horizontally)
331(global-set-key [vertical-scroll-bar S-mouse-2] 346;;;!! (global-set-key [mode-line S-mouse-2]
332 'mouse-split-window) 347;;;!! 'mouse-split-window-horizontally)
348;;;!! (global-set-key [vertical-scroll-bar S-mouse-2]
349;;;!! 'mouse-split-window)
333 350
334;;;; 351;;;!! ;;;;
335;;;; Here are experimental things being tested. Mouse events 352;;;!! ;;;; Here are experimental things being tested. Mouse events
336;;;; are of the form: 353;;;!! ;;;; are of the form:
337;;;; ((x y) window screen-part key-sequence timestamp) 354;;;!! ;;;; ((x y) window screen-part key-sequence timestamp)
338;; 355;;;!! ;;
339;;;; 356;;;!! ;;;;
340;;;; Dynamically track mouse coordinates 357;;;!! ;;;; Dynamically track mouse coordinates
341;;;; 358;;;!! ;;;;
342;; 359;;;!! ;;
343;;(defun track-mouse (event) 360;;;!! ;;(defun track-mouse (event)
344;; "Track the coordinates, absolute and relative, of the mouse." 361;;;!! ;; "Track the coordinates, absolute and relative, of the mouse."
345;; (interactive "@e") 362;;;!! ;; (interactive "@e")
346;; (while mouse-grabbed 363;;;!! ;; (while mouse-grabbed
347;; (let* ((pos (read-mouse-position (selected-screen))) 364;;;!! ;; (let* ((pos (read-mouse-position (selected-screen)))
348;; (abs-x (car pos)) 365;;;!! ;; (abs-x (car pos))
349;; (abs-y (cdr pos)) 366;;;!! ;; (abs-y (cdr pos))
350;; (relative-coordinate (coordinates-in-window-p 367;;;!! ;; (relative-coordinate (coordinates-in-window-p
351;; (list (car pos) (cdr pos)) 368;;;!! ;; (list (car pos) (cdr pos))
352;; (selected-window)))) 369;;;!! ;; (selected-window))))
353;; (if (consp relative-coordinate) 370;;;!! ;; (if (consp relative-coordinate)
354;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y 371;;;!! ;; (message "mouse: [%d %d], (%d %d)" abs-x abs-y
355;; (car relative-coordinate) 372;;;!! ;; (car relative-coordinate)
356;; (car (cdr relative-coordinate))) 373;;;!! ;; (car (cdr relative-coordinate)))
357;; (message "mouse: [%d %d]" abs-x abs-y))))) 374;;;!! ;; (message "mouse: [%d %d]" abs-x abs-y)))))
358 375;;;!!
359;; 376;;;!! ;;
360;; Dynamically put a box around the line indicated by point 377;;;!! ;; Dynamically put a box around the line indicated by point
361;; 378;;;!! ;;
362;; 379;;;!! ;;
363;;(require 'backquote) 380;;;!! ;;(require 'backquote)
364;; 381;;;!! ;;
365;;(defun mouse-select-buffer-line (event) 382;;;!! ;;(defun mouse-select-buffer-line (event)
366;; (interactive "@e") 383;;;!! ;; (interactive "@e")
367;; (let ((relative-coordinate 384;;;!! ;; (let ((relative-coordinate
368;; (coordinates-in-window-p (car event) (selected-window))) 385;;;!! ;; (coordinates-in-window-p (car event) (selected-window)))
369;; (abs-y (car (cdr (car event))))) 386;;;!! ;; (abs-y (car (cdr (car event)))))
370;; (if (consp relative-coordinate) 387;;;!! ;; (if (consp relative-coordinate)
371;; (progn 388;;;!! ;; (progn
372;; (save-excursion 389;;;!! ;; (save-excursion
373;; (move-to-window-line (car (cdr relative-coordinate))) 390;;;!! ;; (move-to-window-line (car (cdr relative-coordinate)))
374;; (x-draw-rectangle 391;;;!! ;; (x-draw-rectangle
375;; (selected-screen) 392;;;!! ;; (selected-screen)
376;; abs-y 0 393;;;!! ;; abs-y 0
377;; (save-excursion 394;;;!! ;; (save-excursion
378;; (move-to-window-line (car (cdr relative-coordinate))) 395;;;!! ;; (move-to-window-line (car (cdr relative-coordinate)))
379;; (end-of-line) 396;;;!! ;; (end-of-line)
380;; (push-mark nil t) 397;;;!! ;; (push-mark nil t)
381;; (beginning-of-line) 398;;;!! ;; (beginning-of-line)
382;; (- (region-end) (region-beginning))) 1)) 399;;;!! ;; (- (region-end) (region-beginning))) 1))
383;; (sit-for 1) 400;;;!! ;; (sit-for 1)
384;; (x-erase-rectangle (selected-screen)))))) 401;;;!! ;; (x-erase-rectangle (selected-screen))))))
385;; 402;;;!! ;;
386;;(defvar last-line-drawn nil) 403;;;!! ;;(defvar last-line-drawn nil)
387;;(defvar begin-delim "[^ \t]") 404;;;!! ;;(defvar begin-delim "[^ \t]")
388;;(defvar end-delim "[^ \t]") 405;;;!! ;;(defvar end-delim "[^ \t]")
389;; 406;;;!! ;;
390;;(defun mouse-boxing (event) 407;;;!! ;;(defun mouse-boxing (event)
391;; (interactive "@e") 408;;;!! ;; (interactive "@e")
392;; (save-excursion 409;;;!! ;; (save-excursion
393;; (let ((screen (selected-screen))) 410;;;!! ;; (let ((screen (selected-screen)))
394;; (while (= (x-mouse-events) 0) 411;;;!! ;; (while (= (x-mouse-events) 0)
395;; (let* ((pos (read-mouse-position screen)) 412;;;!! ;; (let* ((pos (read-mouse-position screen))
396;; (abs-x (car pos)) 413;;;!! ;; (abs-x (car pos))
397;; (abs-y (cdr pos)) 414;;;!! ;; (abs-y (cdr pos))
398;; (relative-coordinate 415;;;!! ;; (relative-coordinate
399;; (coordinates-in-window-p (` ((, abs-x) (, abs-y))) 416;;;!! ;; (coordinates-in-window-p (` ((, abs-x) (, abs-y)))
400;; (selected-window))) 417;;;!! ;; (selected-window)))
401;; (begin-reg nil) 418;;;!! ;; (begin-reg nil)
402;; (end-reg nil) 419;;;!! ;; (end-reg nil)
403;; (end-column nil) 420;;;!! ;; (end-column nil)
404;; (begin-column nil)) 421;;;!! ;; (begin-column nil))
405;; (if (and (consp relative-coordinate) 422;;;!! ;; (if (and (consp relative-coordinate)
406;; (or (not last-line-drawn) 423;;;!! ;; (or (not last-line-drawn)
407;; (not (= last-line-drawn abs-y)))) 424;;;!! ;; (not (= last-line-drawn abs-y))))
408;; (progn 425;;;!! ;; (progn
409;; (move-to-window-line (car (cdr relative-coordinate))) 426;;;!! ;; (move-to-window-line (car (cdr relative-coordinate)))
410;; (if (= (following-char) 10) 427;;;!! ;; (if (= (following-char) 10)
411;; () 428;;;!! ;; ()
412;; (progn 429;;;!! ;; (progn
413;; (setq begin-reg (1- (re-search-forward end-delim))) 430;;;!! ;; (setq begin-reg (1- (re-search-forward end-delim)))
414;; (setq begin-column (1- (current-column))) 431;;;!! ;; (setq begin-column (1- (current-column)))
415;; (end-of-line) 432;;;!! ;; (end-of-line)
416;; (setq end-reg (1+ (re-search-backward begin-delim))) 433;;;!! ;; (setq end-reg (1+ (re-search-backward begin-delim)))
417;; (setq end-column (1+ (current-column))) 434;;;!! ;; (setq end-column (1+ (current-column)))
418;; (message "%s" (buffer-substring begin-reg end-reg)) 435;;;!! ;; (message "%s" (buffer-substring begin-reg end-reg))
419;; (x-draw-rectangle screen 436;;;!! ;; (x-draw-rectangle screen
420;; (setq last-line-drawn abs-y) 437;;;!! ;; (setq last-line-drawn abs-y)
421;; begin-column 438;;;!! ;; begin-column
422;; (- end-column begin-column) 1)))))))))) 439;;;!! ;; (- end-column begin-column) 1))))))))))
423;; 440;;;!! ;;
424;;(defun mouse-erase-box () 441;;;!! ;;(defun mouse-erase-box ()
425;; (interactive) 442;;;!! ;; (interactive)
426;; (if last-line-drawn 443;;;!! ;; (if last-line-drawn
427;; (progn 444;;;!! ;; (progn
428;; (x-erase-rectangle (selected-screen)) 445;;;!! ;; (x-erase-rectangle (selected-screen))
429;; (setq last-line-drawn nil)))) 446;;;!! ;; (setq last-line-drawn nil))))
430 447;;;!!
431;;; (defun test-x-rectangle () 448;;;!! ;;; (defun test-x-rectangle ()
432;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap))) 449;;;!! ;;; (use-local-mouse-map (setq rectangle-test-map (make-sparse-keymap)))
433;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing) 450;;;!! ;;; (define-key rectangle-test-map mouse-motion-button-left 'mouse-boxing)
434;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box)) 451;;;!! ;;; (define-key rectangle-test-map mouse-button-left-up 'mouse-erase-box))
435 452;;;!!
436;; 453;;;!! ;;
437;; Here is how to do double clicking in lisp. About to change. 454;;;!! ;; Here is how to do double clicking in lisp. About to change.
438;; 455;;;!! ;;
439 456;;;!!
440(defvar double-start nil) 457;;;!! (defvar double-start nil)
441(defconst double-click-interval 300 458;;;!! (defconst double-click-interval 300
442 "Max ticks between clicks") 459;;;!! "Max ticks between clicks")
443 460;;;!!
444(defun double-down (event) 461;;;!! (defun double-down (event)
445 (interactive "@e") 462;;;!! (interactive "@e")
446 (if double-start 463;;;!! (if double-start
447 (let ((interval (- (nth 4 event) double-start))) 464;;;!! (let ((interval (- (nth 4 event) double-start)))
448 (if (< interval double-click-interval) 465;;;!! (if (< interval double-click-interval)
449 (progn 466;;;!! (progn
450 (backward-up-list 1) 467;;;!! (backward-up-list 1)
451 ;; (message "Interval %d" interval) 468;;;!! ;; (message "Interval %d" interval)
452 (sleep-for 1))) 469;;;!! (sleep-for 1)))
453 (setq double-start nil)) 470;;;!! (setq double-start nil))
454 (setq double-start (nth 4 event)))) 471;;;!! (setq double-start (nth 4 event))))
455 472;;;!!
456(defun double-up (event) 473;;;!! (defun double-up (event)
457 (interactive "@e") 474;;;!! (interactive "@e")
458 (and double-start 475;;;!! (and double-start
459 (> (- (nth 4 event ) double-start) double-click-interval) 476;;;!! (> (- (nth 4 event ) double-start) double-click-interval)
460 (setq double-start nil))) 477;;;!! (setq double-start nil)))
461 478;;;!!
462;;; (defun x-test-doubleclick () 479;;;!! ;;; (defun x-test-doubleclick ()
463;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap))) 480;;;!! ;;; (use-local-mouse-map (setq doubleclick-test-map (make-sparse-keymap)))
464;;; (define-key doubleclick-test-map mouse-button-left 'double-down) 481;;;!! ;;; (define-key doubleclick-test-map mouse-button-left 'double-down)
465;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up)) 482;;;!! ;;; (define-key doubleclick-test-map mouse-button-left-up 'double-up))
466 483;;;!!
467;; 484;;;!! ;;
468;; This scrolls while button is depressed. Use preferable in scrollbar. 485;;;!! ;; This scrolls while button is depressed. Use preferable in scrollbar.
469;; 486;;;!! ;;
470 487;;;!!
471(defvar scrolled-lines 0) 488;;;!! (defvar scrolled-lines 0)
472(defconst scroll-speed 1) 489;;;!! (defconst scroll-speed 1)
473 490;;;!!
474(defun incr-scroll-down (event) 491;;;!! (defun incr-scroll-down (event)
475 (interactive "@e") 492;;;!! (interactive "@e")
476 (setq scrolled-lines 0) 493;;;!! (setq scrolled-lines 0)
477 (incremental-scroll scroll-speed)) 494;;;!! (incremental-scroll scroll-speed))
478 495;;;!!
479(defun incr-scroll-up (event) 496;;;!! (defun incr-scroll-up (event)
480 (interactive "@e") 497;;;!! (interactive "@e")
481 (setq scrolled-lines 0) 498;;;!! (setq scrolled-lines 0)
482 (incremental-scroll (- scroll-speed))) 499;;;!! (incremental-scroll (- scroll-speed)))
483 500;;;!!
484(defun incremental-scroll (n) 501;;;!! (defun incremental-scroll (n)
485 (while (= (x-mouse-events) 0) 502;;;!! (while (= (x-mouse-events) 0)
486 (setq scrolled-lines (1+ (* scroll-speed scrolled-lines))) 503;;;!! (setq scrolled-lines (1+ (* scroll-speed scrolled-lines)))
487 (scroll-down n) 504;;;!! (scroll-down n)
488 (sit-for 300 t))) 505;;;!! (sit-for 300 t)))
489 506;;;!!
490(defun incr-scroll-stop (event) 507;;;!! (defun incr-scroll-stop (event)
491 (interactive "@e") 508;;;!! (interactive "@e")
492 (message "Scrolled %d lines" scrolled-lines) 509;;;!! (message "Scrolled %d lines" scrolled-lines)
493 (setq scrolled-lines 0) 510;;;!! (setq scrolled-lines 0)
494 (sleep-for 1)) 511;;;!! (sleep-for 1))
495 512;;;!!
496;;; (defun x-testing-scroll () 513;;;!! ;;; (defun x-testing-scroll ()
497;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix))) 514;;;!! ;;; (let ((scrolling-map (function mouse-vertical-scroll-bar-prefix)))
498;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down) 515;;;!! ;;; (define-key scrolling-map mouse-button-left 'incr-scroll-down)
499;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up) 516;;;!! ;;; (define-key scrolling-map mouse-button-right 'incr-scroll-up)
500;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop) 517;;;!! ;;; (define-key scrolling-map mouse-button-left-up 'incr-scroll-stop)
501;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop))) 518;;;!! ;;; (define-key scrolling-map mouse-button-right-up 'incr-scroll-stop)))
502 519;;;!!
503;; 520;;;!! ;;
504;; Some playthings suitable for picture mode? They need work. 521;;;!! ;; Some playthings suitable for picture mode? They need work.
505;; 522;;;!! ;;
506 523;;;!!
507(defun mouse-kill-rectangle (event) 524;;;!! (defun mouse-kill-rectangle (event)
508 "Kill the rectangle between point and the mouse cursor." 525;;;!! "Kill the rectangle between point and the mouse cursor."
509 (interactive "@e") 526;;;!! (interactive "@e")
510 (let ((point-save (point))) 527;;;!! (let ((point-save (point)))
511 (save-excursion 528;;;!! (save-excursion
512 (mouse-set-point event) 529;;;!! (mouse-set-point event)
513 (push-mark nil t) 530;;;!! (push-mark nil t)
514 (if (> point-save (point)) 531;;;!! (if (> point-save (point))
515 (kill-rectangle (point) point-save) 532;;;!! (kill-rectangle (point) point-save)
516 (kill-rectangle point-save (point)))))) 533;;;!! (kill-rectangle point-save (point))))))
517 534;;;!!
518(defun mouse-open-rectangle (event) 535;;;!! (defun mouse-open-rectangle (event)
519 "Kill the rectangle between point and the mouse cursor." 536;;;!! "Kill the rectangle between point and the mouse cursor."
520 (interactive "@e") 537;;;!! (interactive "@e")
521 (let ((point-save (point))) 538;;;!! (let ((point-save (point)))
522 (save-excursion 539;;;!! (save-excursion
523 (mouse-set-point event) 540;;;!! (mouse-set-point event)
524 (push-mark nil t) 541;;;!! (push-mark nil t)
525 (if (> point-save (point)) 542;;;!! (if (> point-save (point))
526 (open-rectangle (point) point-save) 543;;;!! (open-rectangle (point) point-save)
527 (open-rectangle point-save (point)))))) 544;;;!! (open-rectangle point-save (point))))))
528 545;;;!!
529;; Must be a better way to do this. 546;;;!! ;; Must be a better way to do this.
530 547;;;!!
531(defun mouse-multiple-insert (n char) 548;;;!! (defun mouse-multiple-insert (n char)
532 (while (> n 0) 549;;;!! (while (> n 0)
533 (insert char) 550;;;!! (insert char)
534 (setq n (1- n)))) 551;;;!! (setq n (1- n))))
535 552;;;!!
536;; What this could do is not finalize until button was released. 553;;;!! ;; What this could do is not finalize until button was released.
537 554;;;!!
538(defun mouse-move-text (event) 555;;;!! (defun mouse-move-text (event)
539 "Move text from point to cursor position, inserting spaces." 556;;;!! "Move text from point to cursor position, inserting spaces."
540 (interactive "@e") 557;;;!! (interactive "@e")
541 (let* ((relative-coordinate 558;;;!! (let* ((relative-coordinate
542 (coordinates-in-window-p (car event) (selected-window)))) 559;;;!! (coordinates-in-window-p (car event) (selected-window))))
543 (if (consp relative-coordinate) 560;;;!! (if (consp relative-coordinate)
544 (cond ((> (current-column) (car relative-coordinate)) 561;;;!! (cond ((> (current-column) (car relative-coordinate))
545 (delete-char 562;;;!! (delete-char
546 (- (car relative-coordinate) (current-column)))) 563;;;!! (- (car relative-coordinate) (current-column))))
547 ((< (current-column) (car relative-coordinate)) 564;;;!! ((< (current-column) (car relative-coordinate))
548 (mouse-multiple-insert 565;;;!! (mouse-multiple-insert
549 (- (car relative-coordinate) (current-column)) " ")) 566;;;!! (- (car relative-coordinate) (current-column)) " "))
550 ((= (current-column) (car relative-coordinate)) (ding)))))) 567;;;!! ((= (current-column) (car relative-coordinate)) (ding))))))
551 568
552;; Font selection. 569;; Font selection.
553 570
@@ -604,44 +621,47 @@ and selects that window."
604 ) 621 )
605 "X fonts suitable for use in Emacs.") 622 "X fonts suitable for use in Emacs.")
606 623
607(defun mouse-set-font (font) 624(defun mouse-set-font (&optional font)
608 "Select an emacs font from a list of known good fonts" 625 "Select an emacs font from a list of known good fonts"
609 (interactive 626 (interactive
610 (x-popup-menu last-nonmenu-event x-fixed-font-alist)) 627 (x-popup-menu last-nonmenu-event x-fixed-font-alist))
611 (modify-frame-parameters (selected-frame) 628 (if font
612 (list (cons 'font font)))) 629 (modify-frame-parameters (selected-frame)
630 (list (cons 'font font)))))
613 631
614;;; Bindings for mouse commands. 632;;; Bindings for mouse commands.
615 633
616;; This won't be needed once the drag and down events 634;; This won't be needed once the drag and down events
617;; are properly implemented. 635;; are properly implemented.
618(global-set-key [mouse-1] 'mouse-set-point) 636(global-set-key [mouse-1] 'mouse-set-point)
619
620(global-set-key [drag-mouse-1] 'mouse-set-region)
621(global-set-key [mouse-2] 'mouse-yank-at-click)
622(global-set-key [mouse-3] 'mouse-save-then-kill)
623 637
624(global-set-key [C-mouse-1] 'mouse-buffer-menu) 638(global-set-key [drag-mouse-1] 'mouse-set-region)
639(global-set-key [mouse-2] 'mouse-yank-at-click)
640(global-set-key [mouse-3] 'mouse-save-then-kill)
625 641
626(global-set-key [C-mouse-3] 'mouse-set-font) 642;; By binding these to down-going events, we let the user use the up-going
643;; event to make the selection, saving a click.
644(global-set-key [C-down-mouse-1] 'mouse-buffer-menu)
645(global-set-key [C-down-mouse-3] 'mouse-set-font)
627 646
628;; Replaced with dragging mouse-1 647;; Replaced with dragging mouse-1
629;; (global-set-key [S-mouse-1] 'mouse-set-mark) 648;; (global-set-key [S-mouse-1] 'mouse-set-mark)
630 649
631(global-set-key [mode-line mouse-1] 'mouse-delete-other-windows) 650(global-set-key [mode-line mouse-1] 'mouse-delete-other-windows)
632(global-set-key [mode-line mouse-3] 'mouse-delete-window) 651(global-set-key [mode-line mouse-3] 'mouse-delete-window)
652(global-set-key [mode-line S-mouse-2] 'mouse-split-window-horizontally)
633 653
634;; Define the mouse help menu tree. 654;; Define the mouse help menu tree.
635 655
636(defvar help-menu-map '(keymap "Help")) 656(defvar help-menu-map '(keymap "Help"))
637(global-set-key [C-mouse-2] help-menu-map) 657(global-set-key [C-down-mouse-2] help-menu-map)
638 658
639(defvar help-apropos-map '(keymap "Is there a command that...")) 659(defvar help-apropos-map (make-sparse-keymap "Is there a command that..."))
640(defvar help-keys-map '(keymap "Key Commands <==> Functions")) 660(defvar help-keys-map (make-sparse-keymap "Key Commands <==> Functions"))
641(defvar help-manual-map '(keymap "Manual and tutorial")) 661(defvar help-manual-map (make-sparse-keymap "Manual and tutorial"))
642(defvar help-misc-map '(keymap "Odds and ends")) 662(defvar help-misc-map (make-sparse-keymap "Odds and ends"))
643(defvar help-modes-map '(keymap "Modes")) 663(defvar help-modes-map (make-sparse-keymap "Modes"))
644(defvar help-admin-map '(keymap "Administrivia")) 664(defvar help-admin-map (make-sparse-keymap "Administrivia"))
645 665
646(define-key help-menu-map [apropos] 666(define-key help-menu-map [apropos]
647 (cons "@Is there a command that..." help-apropos-map)) 667 (cons "@Is there a command that..." help-apropos-map))
diff --git a/lisp/progmodes/c-mode.el b/lisp/progmodes/c-mode.el
index 7bdfbdf8031..b39182f02af 100644
--- a/lisp/progmodes/c-mode.el
+++ b/lisp/progmodes/c-mode.el
@@ -322,11 +322,13 @@ preserving the comment indentation or line-starting decorations."
322 (paragraph-start 322 (paragraph-start
323 ;; Lines containing just a comment start or just an end 323 ;; Lines containing just a comment start or just an end
324 ;; should not be filled into paragraphs they are next to. 324 ;; should not be filled into paragraphs they are next to.
325 (concat paragraph-start 325 (concat
326 "\\|^[ \t]*/\\*[ \t]*$\\|^[ \t]*\\*/[ \t]*$\\|^[^ \t/*]")) 326 paragraph-start
327 "\\|^[ \t]*/\\*[ \t]*$\\|^[ \t]*\\*/[ \t]*$\\|^[ \t/*]*$"))
327 (paragraph-separate 328 (paragraph-separate
328 (concat paragraph-separate 329 (concat
329 "\\|^[ \t]*/\\*[ \t]*$\\|^[ \t]*\\*/[ \t]*$\\|^[^ \t/*]")) 330 paragraph-separate
331 "\\|^[ \t]*/\\*[ \t]*$\\|^[ \t]*\\*/[ \t]*$\\|^[ \t/*]*$"))
330 (chars-to-delete 0)) 332 (chars-to-delete 0))
331 (save-restriction 333 (save-restriction
332 ;; Don't fill the comment together with the code following it. 334 ;; Don't fill the comment together with the code following it.
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index 96addc99e42..5a0aa4511f8 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -39,7 +39,7 @@
39;;; This file may be used with GNU Emacs version 18.xx if the following 39;;; This file may be used with GNU Emacs version 18.xx if the following
40;;; variable and function substutions are made. 40;;; variable and function substutions are made.
41;;; Replace: 41;;; Replace:
42;;; unread-command-event with unread-command-char 42;;; unread-command-events with unread-command-char
43;;; frame-width with screen-width 43;;; frame-width with screen-width
44;;; auto-fill-function with auto-fill-hook 44;;; auto-fill-function with auto-fill-hook
45 45
@@ -469,7 +469,7 @@ Any other key combination is executed normally."
469 (if (or (= (setq c (read-char)) ??) ;insert char if not equal to `?' 469 (if (or (= (setq c (read-char)) ??) ;insert char if not equal to `?'
470 (= c help-char)) 470 (= c help-char))
471 (fortran-abbrev-help) 471 (fortran-abbrev-help)
472 (setq unread-command-event c)))) 472 (setq unread-command-events (list c)))))
473 473
474(defun fortran-abbrev-help () 474(defun fortran-abbrev-help ()
475 "List the currently defined abbrevs in Fortran mode." 475 "List the currently defined abbrevs in Fortran mode."
@@ -535,7 +535,7 @@ See also `fortran-window-create'."
535 (progn (message "Type SPC to continue editing.") 535 (progn (message "Type SPC to continue editing.")
536 (let ((char (read-char))) 536 (let ((char (read-char)))
537 (or (equal char (string-to-char " ")) 537 (or (equal char (string-to-char " "))
538 (setq unread-command-event char)))))) 538 (setq unread-command-events (list char)))))))
539 (fortran-window-create))) 539 (fortran-window-create)))
540 540
541(defun fortran-split-line () 541(defun fortran-split-line ()
diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el
index 4873ce1a1dc..7649c0ca048 100644
--- a/lisp/progmodes/simula.el
+++ b/lisp/progmodes/simula.el
@@ -401,7 +401,7 @@ The relative indentation among the lines of the statement are preserved."
401 (case-fold-search t) 401 (case-fold-search t)
402 ;; don't mix a label with an assignment operator := :- 402 ;; don't mix a label with an assignment operator := :-
403 ;; therefore look at next typed character... 403 ;; therefore look at next typed character...
404 (next-char (setq unread-command-event (read-char))) 404 (next-char (setq unread-command-events (list (read-char))))
405 (com-char last-command-char)) 405 (com-char last-command-char))
406 (unwind-protect 406 (unwind-protect
407 ;; Problem: find out if character just read is a command char 407 ;; Problem: find out if character just read is a command char
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index fbbc91a870d..e0d38e3d30c 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -21,6 +21,8 @@
21;;; along with GNU Emacs; see the file COPYING. If not, write to 21;;; along with GNU Emacs; see the file COPYING. If not, write to
22;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 22;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 23
24(require 'mouse)
25
24 26
25;;;; Utilities. 27;;;; Utilities.
26 28
@@ -43,7 +45,7 @@ that scrollbar position."
43 "Set the window start according to where the scrollbar is dragged. 45 "Set the window start according to where the scrollbar is dragged.
44EVENT should be a scrollbar click or drag event." 46EVENT should be a scrollbar click or drag event."
45 (interactive "e") 47 (interactive "e")
46 (let* ((end-position (nth (1- (length event)) event)) 48 (let* ((end-position (event-end event))
47 (window (nth 0 end-position)) 49 (window (nth 0 end-position))
48 (portion-whole (nth 2 end-position))) 50 (portion-whole (nth 2 end-position)))
49 (save-excursion 51 (save-excursion
@@ -60,7 +62,7 @@ EVENT should be a scrollbar click."
60 (let ((old-selected-window (selected-window))) 62 (let ((old-selected-window (selected-window)))
61 (unwind-protect 63 (unwind-protect
62 (progn 64 (progn
63 (let* ((end-position (nth (1- (length event)) event)) 65 (let* ((end-position (event-end event))
64 (window (nth 0 end-position)) 66 (window (nth 0 end-position))
65 (portion-whole (nth 2 end-position))) 67 (portion-whole (nth 2 end-position)))
66 (select-window window) 68 (select-window window)
@@ -75,7 +77,7 @@ EVENT should be a scrollbar click."
75 (let ((old-selected-window (selected-window))) 77 (let ((old-selected-window (selected-window)))
76 (unwind-protect 78 (unwind-protect
77 (progn 79 (progn
78 (let* ((end-position (nth (1- (length event)) event)) 80 (let* ((end-position (event-end event))
79 (window (nth 0 end-position)) 81 (window (nth 0 end-position))
80 (portion-whole (nth 2 end-position))) 82 (portion-whole (nth 2 end-position)))
81 (select-window window) 83 (select-window window)
diff --git a/lisp/simple.el b/lisp/simple.el
index e0a027c660d..ee49c57900d 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -59,7 +59,10 @@ With arg N, insert N newlines."
59(defun quoted-insert (arg) 59(defun quoted-insert (arg)
60 "Read next input character and insert it. 60 "Read next input character and insert it.
61This is useful for inserting control characters. 61This is useful for inserting control characters.
62You may also type up to 3 octal digits, to insert a character with that code" 62You may also type up to 3 octal digits, to insert a character with that code.
63`quoted-insert' inserts the character even in overstrike mode; if you
64use overstrike as your normal editing mode, you can use this function
65to insert characters when necessary."
63 (interactive "*p") 66 (interactive "*p")
64 (let ((char (read-quoted-char))) 67 (let ((char (read-quoted-char)))
65 (while (> arg 0) 68 (while (> arg 0)
@@ -789,13 +792,7 @@ Repeating \\[universal-argument] without digits or minus sign
789 (progn 792 (progn
790 (describe-arg value sign) 793 (describe-arg value sign)
791 (setq key (read-key-sequence nil t)))) 794 (setq key (read-key-sequence nil t))))
792 (if (= (length key) 1) 795 (setq unread-command-events (append key '()))))
793 ;; Make sure self-insert-command finds the proper character;
794 ;; unread the character and let the command loop process it.
795 (setq unread-command-event (aref key 0))
796 ;; We can't push back a longer string, so we'll emulate the
797 ;; command loop ourselves.
798 (command-execute (key-binding key)))))
799 796
800(defun describe-arg (value sign) 797(defun describe-arg (value sign)
801 (cond ((numberp value) 798 (cond ((numberp value)
diff --git a/lisp/subr.el b/lisp/subr.el
index 5ae06d130ef..23256306b89 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -65,7 +65,7 @@ Optional argument PROMPT specifies a string to use to prompt the user."
65 (and prompt (message (setq prompt 65 (and prompt (message (setq prompt
66 (format "%s %c" prompt char))))) 66 (format "%s %c" prompt char)))))
67 ((> count 0) 67 ((> count 0)
68 (setq unread-command-event char count 259)) 68 (setq unread-command-events (list char) count 259))
69 (t (setq code char count 259)))) 69 (t (setq code char count 259))))
70 (logand 255 code))) 70 (logand 255 code)))
71 71
@@ -222,6 +222,7 @@ Accept any number of arguments, but ignore them."
222(fset 'show-buffer 'set-window-buffer) 222(fset 'show-buffer 'set-window-buffer)
223(fset 'buffer-flush-undo 'buffer-disable-undo) 223(fset 'buffer-flush-undo 'buffer-disable-undo)
224(fset 'eval-current-buffer 'eval-buffer) 224(fset 'eval-current-buffer 'eval-buffer)
225(fset 'compiled-function-p 'byte-code-function-p)
225 226
226; alternate names 227; alternate names
227(fset 'string= 'string-equal) 228(fset 'string= 'string-equal)
@@ -229,7 +230,6 @@ Accept any number of arguments, but ignore them."
229(fset 'move-marker 'set-marker) 230(fset 'move-marker 'set-marker)
230(fset 'eql 'eq) 231(fset 'eql 'eq)
231(fset 'not 'null) 232(fset 'not 'null)
232(fset 'numberp 'integerp)
233(fset 'rplaca 'setcar) 233(fset 'rplaca 'setcar)
234(fset 'rplacd 'setcdr) 234(fset 'rplacd 'setcdr)
235(fset 'beep 'ding) ;preserve lingual purtity 235(fset 'beep 'ding) ;preserve lingual purtity
@@ -325,7 +325,7 @@ If MESSAGE is nil, instructions to type EXIT-CHAR are displayed there."
325 (single-key-description exit-char)) 325 (single-key-description exit-char))
326 (let ((char (read-char))) 326 (let ((char (read-char)))
327 (or (eq char exit-char) 327 (or (eq char exit-char)
328 (setq unread-command-event char)))) 328 (setq unread-command-events (list char)))))
329 (if insert-end 329 (if insert-end
330 (save-excursion 330 (save-excursion
331 (delete-region pos insert-end))) 331 (delete-region pos insert-end)))
diff --git a/lisp/term/sun-mouse.el b/lisp/term/sun-mouse.el
index 282225ea4e3..0ac9e46f4ea 100644
--- a/lisp/term/sun-mouse.el
+++ b/lisp/term/sun-mouse.el
@@ -318,12 +318,14 @@ but that uses minibuffer, and mucks up last-command."
318 (let ((pc1 (read-char))) 318 (let ((pc1 (read-char)))
319 (if (or (not (equal pc1 mouse-prefix1)) 319 (if (or (not (equal pc1 mouse-prefix1))
320 (sit-for-millisecs 3)) ; a mouse prefix will have second char 320 (sit-for-millisecs 3)) ; a mouse prefix will have second char
321 (progn (setq unread-command-event pc1) ; Can get away with one unread. 321 ;; Can get away with one unread.
322 (progn (setq unread-command-events (list pc1))
322 nil) ; Next input not mouse event. 323 nil) ; Next input not mouse event.
323 (let ((pc2 (read-char))) 324 (let ((pc2 (read-char)))
324 (if (not (equal pc2 mouse-prefix2)) 325 (if (not (equal pc2 mouse-prefix2))
325 (progn (setq unread-command-event pc1) ; put back the ^X 326 (progn (setq unread-command-events (list pc1)) ; put back the ^X
326;;; Too bad can't do two: (setq unread-command-event (list pc1 pc2)) 327;;; Too bad can't do two: (setq unread-command-event (list pc1 pc2))
328;;; Well, now we can, but I don't understand this code well enough to fix it...
327 (ding) ; user will have to retype that pc2. 329 (ding) ; user will have to retype that pc2.
328 nil) ; This input is not a mouse event. 330 nil) ; This input is not a mouse event.
329 ;; Next input has mouse prefix and is within time limit. 331 ;; Next input has mouse prefix and is within time limit.
diff --git a/lisp/terminal.el b/lisp/terminal.el
index c1f30dda707..07e03ff9069 100644
--- a/lisp/terminal.el
+++ b/lisp/terminal.el
@@ -223,7 +223,7 @@ Other chars following \"%s\" are interpreted as follows:\n"
223;; not used. 223;; not used.
224(defun te-escape-extended-command-unread () 224(defun te-escape-extended-command-unread ()
225 (interactive) 225 (interactive)
226 (setq unread-command-event last-input-char) 226 (setq unread-command-events (list last-input-char))
227 (te-escape-extended-command)) 227 (te-escape-extended-command))
228 228
229(defun te-set-escape-char (c) 229(defun te-set-escape-char (c)
diff --git a/src/Makefile.in b/src/Makefile.in
index 468e312abd6..5e19aa0248e 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -47,14 +47,17 @@ temacs: dotemacs
47dotemacs: xmakefile 47dotemacs: xmakefile
48 $(MAKE) CC='${CC}' -f xmakefile ${MFLAGS} temacs 48 $(MAKE) CC='${CC}' -f xmakefile ${MFLAGS} temacs
49 49
50# If you have a problem with cc -E here, changing 50### Some makes, like Ultrix's make, complain if you put a comment in
51# the definition of CPP above may fix it. 51### the middle of a rule's command list! Dummies.
52
53### The flags for optimization and debugging depend on the
54### system, so take an ordinary CFLAGS value and choose the
55### appropriate CPP symbols to use in ymakefile.
56### If you have a problem with cc -E here, changing
57### the definition of CPP above may fix it.
52xmakefile: ymakefile config.h 58xmakefile: ymakefile config.h
53 -rm -f xmakefile xmakefile.new junk.c junk.cpp 59 -rm -f xmakefile xmakefile.new junk.c junk.cpp
54 cp ymakefile junk.c 60 cp ymakefile junk.c
55 ## The flags for optimization and debugging depend on the
56 ## system, so take an ordinary CFLAGS value and choose the
57 ## appropriate CPP symbols to use in ymakefile.
58 $(CPP) junk.c > junk.cpp \ 61 $(CPP) junk.c > junk.cpp \
59 -DC_SWITCH_SITE="`echo ${CFLAGS}' ' \ 62 -DC_SWITCH_SITE="`echo ${CFLAGS}' ' \
60 | sed -e 's/-g /C_DEBUG_SWITCH /' \ 63 | sed -e 's/-g /C_DEBUG_SWITCH /' \
diff --git a/src/buffer.c b/src/buffer.c
index 4a78b568176..4057fffbf7d 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -112,8 +112,9 @@ Lisp_Object Vbuffer_alist;
112Lisp_Object Vbefore_change_function; 112Lisp_Object Vbefore_change_function;
113Lisp_Object Vafter_change_function; 113Lisp_Object Vafter_change_function;
114 114
115/* Function to call before changing an unmodified buffer. */ 115/* List of functions to call before changing an unmodified buffer. */
116Lisp_Object Vfirst_change_function; 116Lisp_Object Vfirst_change_hook;
117Lisp_Object Qfirst_change_hook;
117 118
118Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local; 119Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local;
119 120
@@ -1655,10 +1656,12 @@ While executing the `after-change-function', changes to buffers do not\n\
1655cause calls to any `before-change-function' or `after-change-function'."); 1656cause calls to any `before-change-function' or `after-change-function'.");
1656 Vafter_change_function = Qnil; 1657 Vafter_change_function = Qnil;
1657 1658
1658 DEFVAR_LISP ("first-change-function", &Vfirst_change_function, 1659 DEFVAR_LISP ("first-change-hook", &Vfirst_change_hook,
1659 "Function to call before changing a buffer which is unmodified.\n\ 1660 "A list of functions to call before changing a buffer which is unmodified.\n\
1660The function is called, with no arguments, if it is non-nil."); 1661The functions are run using the `run-hooks' function.");
1661 Vfirst_change_function = Qnil; 1662 Vfirst_change_hook = Qnil;
1663 Qfirst_change_hook = intern ("first-change-hook");
1664 staticpro (&Qfirst_change_hook);
1662 1665
1663 DEFVAR_PER_BUFFER ("buffer-undo-list", &current_buffer->undo_list, Qnil, 1666 DEFVAR_PER_BUFFER ("buffer-undo-list", &current_buffer->undo_list, Qnil,
1664 "List of undo entries in current buffer.\n\ 1667 "List of undo entries in current buffer.\n\
diff --git a/src/buffer.h b/src/buffer.h
index 6e3f7a8ee23..77784d27da0 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -340,7 +340,8 @@ extern void reset_buffer ();
340/* Functions to call before and after each text change. */ 340/* Functions to call before and after each text change. */
341extern Lisp_Object Vbefore_change_function; 341extern Lisp_Object Vbefore_change_function;
342extern Lisp_Object Vafter_change_function; 342extern Lisp_Object Vafter_change_function;
343extern Lisp_Object Vfirst_change_function; 343extern Lisp_Object Vfirst_change_hook;
344extern Lisp_Object Qfirst_change_hook;
344 345
345/* Fields. 346/* Fields.
346 347
diff --git a/src/callint.c b/src/callint.c
index 53cad4a4a78..ffa2fa39539 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -1,11 +1,11 @@
1/* Call a Lisp function interactively. 1/* Call a Lisp function interactively.
2 Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
6GNU Emacs is free software; you can redistribute it and/or modify 6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by 7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option) 8the Free Software Foundation; either version 2, or (at your option)
9any later version. 9any later version.
10 10
11GNU Emacs is distributed in the hope that it will be useful, 11GNU Emacs is distributed in the hope that it will be useful,
@@ -89,10 +89,11 @@ X -- Lisp expression read and evaluated.\n\
89In addition, if the string begins with `*'\n\ 89In addition, if the string begins with `*'\n\
90 then an error is signaled if the buffer is read-only.\n\ 90 then an error is signaled if the buffer is read-only.\n\
91 This happens before reading any arguments.\n\ 91 This happens before reading any arguments.\n\
92If the string begins with `@', then the window the mouse is over is selected\n\ 92If the string begins with `@', then Emacs searches the key sequence\n\
93 before anything else is done. You may use both `@' and `*';\n\ 93 which invoked the command for its first mouse click (or any other\n\
94they are processed in the order that they appear." 94 event which specifies a window), and selects that window before\n\
95*/ 95 reading any arguments. You may use both `@' and `*'; they are\n\
96 processed in the order that they appear." */
96 97
97/* ARGSUSED */ 98/* ARGSUSED */
98DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0, 99DEFUN ("interactive", Finteractive, Sinteractive, 0, UNEVALLED, 0,
@@ -167,7 +168,7 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
167 168
168 /* The index of the next element of this_command_keys to examine for 169 /* The index of the next element of this_command_keys to examine for
169 the 'e' interactive code. */ 170 the 'e' interactive code. */
170 int next_event = 0; 171 int next_event;
171 172
172 Lisp_Object prefix_arg; 173 Lisp_Object prefix_arg;
173 unsigned char *string; 174 unsigned char *string;
@@ -296,6 +297,12 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
296 297
297 /* Here if function specifies a string to control parsing the defaults */ 298 /* Here if function specifies a string to control parsing the defaults */
298 299
300 /* Set next_event to point to the first event with parameters. */
301 for (next_event = 0; next_event < this_command_key_count; next_event++)
302 if (EVENT_HAS_PARAMETERS
303 (XVECTOR (this_command_keys)->contents[next_event]))
304 break;
305
299 /* Handle special starting chars `*' and `@'. */ 306 /* Handle special starting chars `*' and `@'. */
300 while (1) 307 while (1)
301 { 308 {
@@ -307,9 +314,15 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
307 } 314 }
308 else if (*string == '@') 315 else if (*string == '@')
309 { 316 {
317 Lisp_Object event =
318 XVECTOR (this_command_keys)->contents[next_event];
319
320 if (EVENT_HAS_PARAMETERS (event)
321 && XTYPE (event = XCONS (event)->cdr) == Lisp_Cons
322 && XTYPE (event = XCONS (event)->car) == Lisp_Cons
323 && XTYPE (event = XCONS (event)->car) == Lisp_Window)
324 Fselect_window (event);
310 string++; 325 string++;
311 if (!NILP (Vmouse_window))
312 Fselect_window (Vmouse_window);
313 } 326 }
314 else break; 327 else break;
315 } 328 }
@@ -433,11 +446,6 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
433 break; 446 break;
434 447
435 case 'e': /* The invoking event. */ 448 case 'e': /* The invoking event. */
436 /* Find the next parameterized event. */
437 while (next_event < this_command_key_count
438 && ! (EVENT_HAS_PARAMETERS
439 (XVECTOR (this_command_keys)->contents[next_event])))
440 next_event++;
441 if (next_event >= this_command_key_count) 449 if (next_event >= this_command_key_count)
442 error ("%s must be bound to an event with parameters", 450 error ("%s must be bound to an event with parameters",
443 (XTYPE (function) == Lisp_Symbol 451 (XTYPE (function) == Lisp_Symbol
@@ -445,6 +453,13 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
445 : "command")); 453 : "command"));
446 args[i] = XVECTOR (this_command_keys)->contents[next_event++]; 454 args[i] = XVECTOR (this_command_keys)->contents[next_event++];
447 varies[i] = -1; 455 varies[i] = -1;
456
457 /* Find the next parameterized event. */
458 while (next_event < this_command_key_count
459 && ! (EVENT_HAS_PARAMETERS
460 (XVECTOR (this_command_keys)->contents[next_event])))
461 next_event++;
462
448 break; 463 break;
449 464
450 case 'm': /* Value of mark. Does not do I/O. */ 465 case 'm': /* Value of mark. Does not do I/O. */
diff --git a/src/commands.h b/src/commands.h
index 4e3d67d166e..4abdcac56f1 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -49,12 +49,12 @@ extern Lisp_Object last_command_char;
49 reached by the mouse. */ 49 reached by the mouse. */
50extern Lisp_Object last_nonmenu_event; 50extern Lisp_Object last_nonmenu_event;
51 51
52/* Command event to be re-read, or Qnil. */ 52/* List of command events to be re-read, or Qnil. */
53extern Lisp_Object unread_command_event; 53extern Lisp_Object unread_command_events;
54 54
55/* If not Qnil, this is a switch-frame event which we decided to put 55/* If not Qnil, this is a switch-frame event which we decided to put
56 off until the end of a key sequence. This should be read as the 56 off until the end of a key sequence. This should be read as the
57 next command input, after any unread_command_event. 57 next command input, after any unread_command_events.
58 58
59 read_key_sequence uses this to delay switch-frame events until the 59 read_key_sequence uses this to delay switch-frame events until the
60 end of the key sequence; Fread_char uses it to put off switch-frame 60 end of the key sequence; Fread_char uses it to put off switch-frame
diff --git a/src/data.c b/src/data.c
index 3a19314873c..071cfe853b7 100644
--- a/src/data.c
+++ b/src/data.c
@@ -256,8 +256,8 @@ DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0, "T if OBJECT is a built-in function.")
256 return Qnil; 256 return Qnil;
257} 257}
258 258
259DEFUN ("compiled-function-p", Fcompiled_function_p, Scompiled_function_p, 259DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p,
260 1, 1, 0, "T if OBJECT is a compiled function object.") 260 1, 1, 0, "T if OBJECT is a byte-compiled function object.")
261 (obj) 261 (obj)
262 Lisp_Object obj; 262 Lisp_Object obj;
263{ 263{
@@ -308,13 +308,10 @@ DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0,
308 (obj) 308 (obj)
309 Lisp_Object obj; 309 Lisp_Object obj;
310{ 310{
311 if (0 311 if (NUMBERP (obj))
312#ifdef LISP_FLOAT_TYPE
313 || XTYPE (obj) == Lisp_Float
314#endif
315 || XTYPE (obj) == Lisp_Int)
316 return Qt; 312 return Qt;
317 return Qnil; 313 else
314 return Qnil;
318} 315}
319 316
320DEFUN ("number-or-marker-p", Fnumber_or_marker_p, 317DEFUN ("number-or-marker-p", Fnumber_or_marker_p,
@@ -323,10 +320,7 @@ DEFUN ("number-or-marker-p", Fnumber_or_marker_p,
323 (obj) 320 (obj)
324 Lisp_Object obj; 321 Lisp_Object obj;
325{ 322{
326 if (XTYPE (obj) == Lisp_Int 323 if (NUMBERP (obj)
327#ifdef LISP_FLOAT_TYPE
328 || XTYPE (obj) == Lisp_Float
329#endif
330 || XTYPE (obj) == Lisp_Marker) 324 || XTYPE (obj) == Lisp_Marker)
331 return Qt; 325 return Qt;
332 return Qnil; 326 return Qnil;
@@ -2037,7 +2031,7 @@ syms_of_data ()
2037 defsubr (&Sbufferp); 2031 defsubr (&Sbufferp);
2038 defsubr (&Smarkerp); 2032 defsubr (&Smarkerp);
2039 defsubr (&Ssubrp); 2033 defsubr (&Ssubrp);
2040 defsubr (&Scompiled_function_p); 2034 defsubr (&Sbyte_code_function_p);
2041 defsubr (&Schar_or_string_p); 2035 defsubr (&Schar_or_string_p);
2042 defsubr (&Scar); 2036 defsubr (&Scar);
2043 defsubr (&Scdr); 2037 defsubr (&Scdr);
diff --git a/src/dispnew.c b/src/dispnew.c
index edcb7223f0b..5570129c389 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -173,7 +173,22 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
173 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) 173 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
174 { 174 {
175 frame = XCONS (tail)->car; 175 frame = XCONS (tail)->car;
176 if (FRAME_VISIBLE_P (XFRAME (frame))) 176
177 /* If we simply redrew all visible frames, whether or not they
178 were garbaged, then this would make all frames clear and
179 redraw whenever a new frame is created or an existing frame
180 is de-iconified; those events set the global frame_garbaged
181 flag, to which redisplay responds by calling this function.
182
183 This used to redraw all visible frames; the only advantage of
184 that approach is that if a frame changes from invisible to
185 visible without setting its garbaged flag, it still gets
186 redisplayed. But that should never happen; since invisible
187 frames are not updated, they should always be marked as
188 garbaged when they become visible again. If that doesn't
189 happen, it's a bug in the visibility code, not a bug here. */
190 if (FRAME_VISIBLE_P (XFRAME (frame))
191 && FRAME_GARBAGED_P (XFRAME (frame)))
177 Fredraw_frame (frame); 192 Fredraw_frame (frame);
178 } 193 }
179 return Qnil; 194 return Qnil;
diff --git a/src/emacs.c b/src/emacs.c
index da5916990d5..9209e4f7d6b 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -519,10 +519,8 @@ main (argc, argv, envp)
519#ifdef HAVE_X11 519#ifdef HAVE_X11
520 syms_of_xselect (); 520 syms_of_xselect ();
521#endif 521#endif
522#ifdef HAVE_X_WINDOWS 522#ifdef HAVE_X_MENU
523#ifndef NO_X_MENU
524 syms_of_xmenu (); 523 syms_of_xmenu ();
525#endif /* not NO_X_MENU */
526#endif /* HAVE_X_MENU */ 524#endif /* HAVE_X_MENU */
527#endif /* HAVE_X_WINDOWS */ 525#endif /* HAVE_X_WINDOWS */
528 526
diff --git a/src/fns.c b/src/fns.c
index 144d6ef345e..9f818e886f2 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -836,8 +836,12 @@ internal_equal (o1, o2, depth)
836 error ("Stack overflow in equal"); 836 error ("Stack overflow in equal");
837do_cdr: 837do_cdr:
838 QUIT; 838 QUIT;
839 if (EQ (o1, o2)) return Qt;
840 if (NUMBERP (o1) && NUMBERP (o2))
841 {
842 return (extract_float (o1) == extract_float (o2)) ? Qt : Qnil;
843 }
839 if (XTYPE (o1) != XTYPE (o2)) return Qnil; 844 if (XTYPE (o1) != XTYPE (o2)) return Qnil;
840 if (XINT (o1) == XINT (o2)) return Qt;
841 if (XTYPE (o1) == Lisp_Cons) 845 if (XTYPE (o1) == Lisp_Cons)
842 { 846 {
843 Lisp_Object v1; 847 Lisp_Object v1;
@@ -853,7 +857,8 @@ do_cdr:
853 && XMARKER (o1)->bufpos == XMARKER (o2)->bufpos) 857 && XMARKER (o1)->bufpos == XMARKER (o2)->bufpos)
854 ? Qt : Qnil; 858 ? Qt : Qnil;
855 } 859 }
856 if (XTYPE (o1) == Lisp_Vector) 860 if (XTYPE (o1) == Lisp_Vector
861 || XTYPE (o1) == Lisp_Compiled)
857 { 862 {
858 register int index; 863 register int index;
859 if (XVECTOR (o1)->size != XVECTOR (o2)->size) 864 if (XVECTOR (o1)->size != XVECTOR (o2)->size)
diff --git a/src/frame.c b/src/frame.c
index 7184c20b797..ca48c73105f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -74,7 +74,7 @@ Lisp_Object Vdefault_frame_alist;
74 74
75/*&&& symbols declared here &&&*/ 75/*&&& symbols declared here &&&*/
76Lisp_Object Qframep; 76Lisp_Object Qframep;
77Lisp_Object Qlive_frame_p; 77Lisp_Object Qframe_live_p;
78Lisp_Object Qheight; 78Lisp_Object Qheight;
79Lisp_Object Qicon; 79Lisp_Object Qicon;
80Lisp_Object Qminibuffer; 80Lisp_Object Qminibuffer;
@@ -110,7 +110,7 @@ Also see `live-frame-p'.")
110 } 110 }
111} 111}
112 112
113DEFUN ("live-frame-p", Flive_frame_p, Slive_frame_p, 1, 1, 0, 113DEFUN ("frame-live-p", Fframe_live_p, Sframe_live_p, 1, 1, 0,
114 "Return non-nil if OBJECT is a frame which has not been deleted.\n\ 114 "Return non-nil if OBJECT is a frame which has not been deleted.\n\
115Value is nil if OBJECT is not a live frame. If object is a live\n\ 115Value is nil if OBJECT is not a live frame. If object is a live\n\
116frame, the return value indicates what sort of output device it is\n\ 116frame, the return value indicates what sort of output device it is\n\
@@ -381,15 +381,14 @@ Changing the selected frame can change focus redirections. See\n\
381 381
382 Fselect_window (XFRAME (frame)->selected_window); 382 Fselect_window (XFRAME (frame)->selected_window);
383 383
384 /* I think this should be done with a hook. */
384#ifdef HAVE_X_WINDOWS 385#ifdef HAVE_X_WINDOWS
385#ifdef MULTI_FRAME
386 if (FRAME_X_P (XFRAME (frame)) 386 if (FRAME_X_P (XFRAME (frame))
387 && NILP (no_enter)) 387 && NILP (no_enter))
388 { 388 {
389 Ffocus_frame (frame); 389 Ffocus_frame (frame);
390 } 390 }
391#endif 391#endif
392#endif
393 choose_minibuf_frame (); 392 choose_minibuf_frame ();
394 393
395 return frame; 394 return frame;
@@ -450,8 +449,6 @@ DEFUN ("frame-list", Fframe_list, Sframe_list,
450 return Fcopy_sequence (Vframe_list); 449 return Fcopy_sequence (Vframe_list);
451} 450}
452 451
453#ifdef MULTI_FRAME
454
455/* Return the next frame in the frame list after FRAME. 452/* Return the next frame in the frame list after FRAME.
456 If MINIBUF is nil, exclude minibuffer-only frames. 453 If MINIBUF is nil, exclude minibuffer-only frames.
457 If MINIBUF is a window, include only frames using that window for 454 If MINIBUF is a window, include only frames using that window for
@@ -469,6 +466,10 @@ next_frame (frame, minibuf)
469 if (! CONSP (Vframe_list)) 466 if (! CONSP (Vframe_list))
470 abort (); 467 abort ();
471 468
469 /* If this frame is dead, it won't be in Vframe_list, and we'll loop
470 forever. Forestall that. */
471 CHECK_LIVE_FRAME (frame, 0);
472
472 while (1) 473 while (1)
473 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) 474 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
474 { 475 {
@@ -503,9 +504,6 @@ next_frame (frame, minibuf)
503 } 504 }
504} 505}
505 506
506#if 0
507/* Nobody seems to be using this code right now. */
508
509/* Return the previous frame in the frame list before FRAME. 507/* Return the previous frame in the frame list before FRAME.
510 If MINIBUF is nil, exclude minibuffer-only frames. 508 If MINIBUF is nil, exclude minibuffer-only frames.
511 If MINIBUF is a window, include only frames using that window for 509 If MINIBUF is a window, include only frames using that window for
@@ -561,7 +559,6 @@ prev_frame (frame, minibuf)
561 acceptable frame in the list, return it. */ 559 acceptable frame in the list, return it. */
562 return prev; 560 return prev;
563} 561}
564#endif
565 562
566DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0, 563DEFUN ("next-frame", Fnext_frame, Snext_frame, 0, 2, 0,
567 "Return the next frame in the frame list after FRAME.\n\ 564 "Return the next frame in the frame list after FRAME.\n\
@@ -583,7 +580,7 @@ If MINIFRAME is non-nil and not a window, include all frames.")
583 580
584 return next_frame (frame, miniframe); 581 return next_frame (frame, miniframe);
585} 582}
586#endif /* MULTI_FRAME */ 583
587 584
588DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 1, "", 585DEFUN ("delete-frame", Fdelete_frame, Sdelete_frame, 0, 1, "",
589 "Delete FRAME, permanently eliminating it from use.\n\ 586 "Delete FRAME, permanently eliminating it from use.\n\
@@ -659,6 +656,8 @@ A frame may not be deleted if its minibuffer is used by other frames.")
659 now, then we may trip up the event-handling code. Instead, we'll 656 now, then we may trip up the event-handling code. Instead, we'll
660 promise that the display of the frame must be valid until we have 657 promise that the display of the frame must be valid until we have
661 called the window-system-dependent frame destruction routine. */ 658 called the window-system-dependent frame destruction routine. */
659
660 /* I think this should be done with a hook. */
662#ifdef HAVE_X_WINDOWS 661#ifdef HAVE_X_WINDOWS
663 if (FRAME_X_P (f)) 662 if (FRAME_X_P (f))
664 x_destroy_window (f); 663 x_destroy_window (f);
@@ -739,19 +738,25 @@ to read the mouse position, it returns the selected frame for FRAME\n\
739and nil for X and Y.") 738and nil for X and Y.")
740 () 739 ()
741{ 740{
742 Lisp_Object x, y, dummy;
743 FRAME_PTR f; 741 FRAME_PTR f;
742 Lisp_Object lispy_dummy;
743 enum scrollbar_part party_dummy;
744 Lisp_Object x, y;
745 unsigned long long_dummy;
744 746
745 if (mouse_position_hook) 747 if (mouse_position_hook)
746 (*mouse_position_hook) (&f, &x, &y, &dummy); 748 (*mouse_position_hook) (&f,
749 &lispy_dummy, &party_dummy,
750 &x, &y,
751 &long_dummy);
747 else 752 else
748 { 753 {
749 f = selected_frame; 754 f = selected_frame;
750 x = y = Qnil; 755 x = y = Qnil;
751 } 756 }
752 757
753 XSET (dummy, Lisp_Frame, f); 758 XSET (lispy_dummy, Lisp_Frame, f);
754 return Fcons (dummy, Fcons (make_number (x), make_number (y))); 759 return Fcons (lispy_dummy, Fcons (make_number (x), make_number (y)));
755} 760}
756 761
757DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0, 762DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
@@ -764,6 +769,7 @@ WARNING: If you use this under X, you should do `unfocus-frame' afterwards.")
764 CHECK_NUMBER (x, 2); 769 CHECK_NUMBER (x, 2);
765 CHECK_NUMBER (y, 1); 770 CHECK_NUMBER (y, 1);
766 771
772 /* I think this should be done with a hook. */
767#ifdef HAVE_X_WINDOWS 773#ifdef HAVE_X_WINDOWS
768 if (FRAME_X_P (XFRAME (frame))) 774 if (FRAME_X_P (XFRAME (frame)))
769 /* Warping the mouse will cause enternotify and focus events. */ 775 /* Warping the mouse will cause enternotify and focus events. */
@@ -842,6 +848,7 @@ If omitted, FRAME defaults to the currently selected frame.")
842 848
843 CHECK_LIVE_FRAME (frame, 0); 849 CHECK_LIVE_FRAME (frame, 0);
844 850
851 /* I think this should be done with a hook. */
845#ifdef HAVE_X_WINDOWS 852#ifdef HAVE_X_WINDOWS
846 if (FRAME_X_P (XFRAME (frame))) 853 if (FRAME_X_P (XFRAME (frame)))
847 x_make_frame_visible (XFRAME (frame)); 854 x_make_frame_visible (XFRAME (frame));
@@ -862,6 +869,7 @@ If omitted, FRAME defaults to the currently selected frame.")
862 869
863 CHECK_LIVE_FRAME (frame, 0); 870 CHECK_LIVE_FRAME (frame, 0);
864 871
872 /* I think this should be done with a hook. */
865#ifdef HAVE_X_WINDOWS 873#ifdef HAVE_X_WINDOWS
866 if (FRAME_X_P (XFRAME (frame))) 874 if (FRAME_X_P (XFRAME (frame)))
867 x_make_frame_invisible (XFRAME (frame)); 875 x_make_frame_invisible (XFRAME (frame));
@@ -882,6 +890,7 @@ If omitted, FRAME defaults to the currently selected frame.")
882 890
883 CHECK_LIVE_FRAME (frame, 0); 891 CHECK_LIVE_FRAME (frame, 0);
884 892
893 /* I think this should be done with a hook. */
885#ifdef HAVE_X_WINDOWS 894#ifdef HAVE_X_WINDOWS
886 if (FRAME_X_P (XFRAME (frame))) 895 if (FRAME_X_P (XFRAME (frame)))
887 x_iconify_frame (XFRAME (frame)); 896 x_iconify_frame (XFRAME (frame));
@@ -931,6 +940,37 @@ DEFUN ("visible-frame-list", Fvisible_frame_list, Svisible_frame_list,
931} 940}
932 941
933 942
943DEFUN ("frame-to-front", Fframe_to_front, Sframe_to_front, 1, 1, 0,
944 "Bring FRAME to the front, so it occludes any frames it overlaps.\n\
945If FRAME is invisible, make it visible.\n\
946If Emacs is displaying on an ordinary terminal or some other device which\n\
947doesn't support multiple overlapping frames, this function does nothing.")
948 (frame)
949 Lisp_Object frame;
950{
951 CHECK_LIVE_FRAME (frame, 0);
952
953 if (frame_raise_lower_hook)
954 (*frame_raise_lower_hook) (XFRAME (frame), 1);
955
956 return Qnil;
957}
958
959DEFUN ("frame-to-back", Fframe_to_back, Sframe_to_back, 1, 1, 0,
960 "Send FRAME to the back, so it is occluded by any frames that overlap it.\n\
961If Emacs is displaying on an ordinary terminal or some other device which\n\
962doesn't support multiple overlapping frames, this function does nothing.")
963 (frame)
964 Lisp_Object frame;
965{
966 CHECK_LIVE_FRAME (frame, 0);
967
968 if (frame_raise_lower_hook)
969 (*frame_raise_lower_hook) (XFRAME (frame), 0);
970
971 return Qnil;
972}
973
934 974
935DEFUN ("redirect-frame-focus", Fredirect_frame_focus, Sredirect_frame_focus, 975DEFUN ("redirect-frame-focus", Fredirect_frame_focus, Sredirect_frame_focus,
936 1, 2, 0, 976 1, 2, 0,
@@ -1075,6 +1115,7 @@ If FRAME is omitted, return information on the currently selected frame.")
1075 : FRAME_MINIBUF_WINDOW (f)))); 1115 : FRAME_MINIBUF_WINDOW (f))));
1076 store_in_alist (&alist, Qunsplittable, (f->no_split ? Qt : Qnil)); 1116 store_in_alist (&alist, Qunsplittable, (f->no_split ? Qt : Qnil));
1077 1117
1118 /* I think this should be done with a hook. */
1078#ifdef HAVE_X_WINDOWS 1119#ifdef HAVE_X_WINDOWS
1079 if (FRAME_X_P (f)) 1120 if (FRAME_X_P (f))
1080 x_report_frame_params (f, &alist); 1121 x_report_frame_params (f, &alist);
@@ -1102,6 +1143,7 @@ The meaningful PARMs depend on the kind of frame; undefined PARMs are ignored.")
1102 f = XFRAME (frame); 1143 f = XFRAME (frame);
1103 } 1144 }
1104 1145
1146 /* I think this should be done with a hook. */
1105#ifdef HAVE_X_WINDOWS 1147#ifdef HAVE_X_WINDOWS
1106 if (FRAME_X_P (f)) 1148 if (FRAME_X_P (f))
1107#if 1 1149#if 1
@@ -1180,6 +1222,7 @@ but that the idea of the actual height of the frame should not be changed.")
1180 f = XFRAME (frame); 1222 f = XFRAME (frame);
1181 } 1223 }
1182 1224
1225 /* I think this should be done with a hook. */
1183#ifdef HAVE_X_WINDOWS 1226#ifdef HAVE_X_WINDOWS
1184 if (FRAME_X_P (f)) 1227 if (FRAME_X_P (f))
1185 { 1228 {
@@ -1209,6 +1252,7 @@ but that the idea of the actual width of the frame should not be changed.")
1209 f = XFRAME (frame); 1252 f = XFRAME (frame);
1210 } 1253 }
1211 1254
1255 /* I think this should be done with a hook. */
1212#ifdef HAVE_X_WINDOWS 1256#ifdef HAVE_X_WINDOWS
1213 if (FRAME_X_P (f)) 1257 if (FRAME_X_P (f))
1214 { 1258 {
@@ -1234,6 +1278,7 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
1234 CHECK_NUMBER (rows, 1); 1278 CHECK_NUMBER (rows, 1);
1235 f = XFRAME (frame); 1279 f = XFRAME (frame);
1236 1280
1281 /* I think this should be done with a hook. */
1237#ifdef HAVE_X_WINDOWS 1282#ifdef HAVE_X_WINDOWS
1238 if (FRAME_X_P (f)) 1283 if (FRAME_X_P (f))
1239 { 1284 {
@@ -1264,6 +1309,7 @@ off the screen.")
1264 CHECK_NUMBER (yoffset, 2); 1309 CHECK_NUMBER (yoffset, 2);
1265 f = XFRAME (frame); 1310 f = XFRAME (frame);
1266 1311
1312 /* I think this should be done with a hook. */
1267#ifdef HAVE_X_WINDOWS 1313#ifdef HAVE_X_WINDOWS
1268 if (FRAME_X_P (f)) 1314 if (FRAME_X_P (f))
1269 x_set_offset (f, XINT (xoffset), XINT (yoffset)); 1315 x_set_offset (f, XINT (xoffset), XINT (yoffset));
@@ -1338,8 +1384,8 @@ syms_of_frame ()
1338 /*&&& init symbols here &&&*/ 1384 /*&&& init symbols here &&&*/
1339 Qframep = intern ("framep"); 1385 Qframep = intern ("framep");
1340 staticpro (&Qframep); 1386 staticpro (&Qframep);
1341 Qlive_frame_p = intern ("live-frame-p"); 1387 Qframe_live_p = intern ("frame-live-p");
1342 staticpro (&Qlive_frame_p); 1388 staticpro (&Qframe_live_p);
1343 Qheight = intern ("height"); 1389 Qheight = intern ("height");
1344 staticpro (&Qheight); 1390 staticpro (&Qheight);
1345 Qicon = intern ("icon"); 1391 Qicon = intern ("icon");
@@ -1396,7 +1442,7 @@ For values specific to the separate minibuffer frame, see\n\
1396 Vdefault_frame_alist = Qnil; 1442 Vdefault_frame_alist = Qnil;
1397 1443
1398 defsubr (&Sframep); 1444 defsubr (&Sframep);
1399 defsubr (&Slive_frame_p); 1445 defsubr (&Sframe_live_p);
1400 defsubr (&Sselect_frame); 1446 defsubr (&Sselect_frame);
1401 defsubr (&Sselected_frame); 1447 defsubr (&Sselected_frame);
1402 defsubr (&Swindow_frame); 1448 defsubr (&Swindow_frame);
@@ -1416,6 +1462,8 @@ For values specific to the separate minibuffer frame, see\n\
1416 defsubr (&Siconify_frame); 1462 defsubr (&Siconify_frame);
1417 defsubr (&Sframe_visible_p); 1463 defsubr (&Sframe_visible_p);
1418 defsubr (&Svisible_frame_list); 1464 defsubr (&Svisible_frame_list);
1465 defsubr (&Sframe_to_front);
1466 defsubr (&Sframe_to_back);
1419 defsubr (&Sredirect_frame_focus); 1467 defsubr (&Sredirect_frame_focus);
1420 defsubr (&Sframe_focus); 1468 defsubr (&Sframe_focus);
1421 defsubr (&Sframe_parameters); 1469 defsubr (&Sframe_parameters);
diff --git a/src/frame.h b/src/frame.h
index 5a3f45a080d..194b62147da 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -306,7 +306,7 @@ typedef struct frame *FRAME_PTR;
306 { \ 306 { \
307 if (! FRAMEP (x) \ 307 if (! FRAMEP (x) \
308 || ! FRAME_LIVE_P (XFRAME (x))) \ 308 || ! FRAME_LIVE_P (XFRAME (x))) \
309 x = wrong_type_argument (Qlive_frame_p, (x)); \ 309 x = wrong_type_argument (Qframe_live_p, (x)); \
310 } 310 }
311 311
312/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a 312/* FOR_EACH_FRAME (LIST_VAR, FRAME_VAR) followed by a statement is a
@@ -325,7 +325,7 @@ typedef struct frame *FRAME_PTR;
325 list_var = XCONS (list_var)->cdr) 325 list_var = XCONS (list_var)->cdr)
326 326
327 327
328extern Lisp_Object Qframep, Qlive_frame_p; 328extern Lisp_Object Qframep, Qframe_live_p;
329 329
330extern struct frame *selected_frame; 330extern struct frame *selected_frame;
331extern struct frame *last_nonminibuf_frame; 331extern struct frame *last_nonminibuf_frame;
diff --git a/src/insdel.c b/src/insdel.c
index 256102dfe9d..7f25a967d46 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -545,10 +545,10 @@ signal_before_change (start, end)
545{ 545{
546 /* If buffer is unmodified, run a special hook for that case. */ 546 /* If buffer is unmodified, run a special hook for that case. */
547 if (current_buffer->save_modified >= MODIFF 547 if (current_buffer->save_modified >= MODIFF
548 && !NILP (Vfirst_change_function)) 548 && !NILP (Vfirst_change_hook)
549 { 549 && !NILP (Vrun_hooks))
550 call0 (Vfirst_change_function); 550 call1 (Vrun_hooks, Qfirst_change_hook);
551 } 551
552 /* Now in any case run the before-change-function if any. */ 552 /* Now in any case run the before-change-function if any. */
553 if (!NILP (Vbefore_change_function)) 553 if (!NILP (Vbefore_change_function))
554 { 554 {
diff --git a/src/keyboard.c b/src/keyboard.c
index 3c139c68644..6585c29a914 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -152,12 +152,12 @@ Lisp_Object last_nonmenu_event;
152/* Last input character read for any purpose. */ 152/* Last input character read for any purpose. */
153Lisp_Object last_input_char; 153Lisp_Object last_input_char;
154 154
155/* If not Qnil, an object to be read as the next command input. */ 155/* If not Qnil, a list of objects to be read as subsequent command input. */
156Lisp_Object unread_command_event; 156Lisp_Object unread_command_events;
157 157
158/* If not Qnil, this is a switch-frame event which we decided to put 158/* If not Qnil, this is a switch-frame event which we decided to put
159 off until the end of a key sequence. This should be read as the 159 off until the end of a key sequence. This should be read as the
160 next command input, after any unread_command_event. 160 next command input, after any unread_command_events.
161 161
162 read_key_sequence uses this to delay switch-frame events until the 162 read_key_sequence uses this to delay switch-frame events until the
163 end of the key sequence; Fread_char uses it to put off switch-frame 163 end of the key sequence; Fread_char uses it to put off switch-frame
@@ -867,7 +867,7 @@ command_loop_1 ()
867 if (!NILP (Vquit_flag)) 867 if (!NILP (Vquit_flag))
868 { 868 {
869 Vquit_flag = Qnil; 869 Vquit_flag = Qnil;
870 unread_command_event = make_number (quit_char); 870 unread_command_events = Fcons (make_number (quit_char), Qnil);
871 } 871 }
872 } 872 }
873 873
@@ -1145,10 +1145,10 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1145 int count; 1145 int count;
1146 jmp_buf save_jump; 1146 jmp_buf save_jump;
1147 1147
1148 if (!NILP (unread_command_event)) 1148 if (CONSP (unread_command_events))
1149 { 1149 {
1150 c = unread_command_event; 1150 c = XCONS (unread_command_events)->car;
1151 unread_command_event = Qnil; 1151 unread_command_events = XCONS (unread_command_events)->cdr;
1152 1152
1153 if (this_command_key_count == 0) 1153 if (this_command_key_count == 0)
1154 goto reread_first; 1154 goto reread_first;
@@ -1229,7 +1229,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1229 /* After a mouse event, start echoing right away. 1229 /* After a mouse event, start echoing right away.
1230 This is because we are probably about to display a menu, 1230 This is because we are probably about to display a menu,
1231 and we don't want to delay before doing so. */ 1231 and we don't want to delay before doing so. */
1232 if (XTYPE (prev_event) == Lisp_Cons) 1232 if (EVENT_HAS_PARAMETERS (prev_event))
1233 echo (); 1233 echo ();
1234 else 1234 else
1235 { 1235 {
@@ -1880,7 +1880,8 @@ make_lispy_event (event)
1880 { 1880 {
1881 int button = XFASTINT (event->code); 1881 int button = XFASTINT (event->code);
1882 Lisp_Object position; 1882 Lisp_Object position;
1883 Lisp_Object *start_pos; 1883 Lisp_Object *start_pos_ptr;
1884 Lisp_Object start_pos;
1884 1885
1885 if (button < 0 || button >= NUM_MOUSE_BUTTONS) 1886 if (button < 0 || button >= NUM_MOUSE_BUTTONS)
1886 abort (); 1887 abort ();
@@ -1899,21 +1900,20 @@ make_lispy_event (event)
1899 posn = Qnil; 1900 posn = Qnil;
1900 else 1901 else
1901 { 1902 {
1903 XSETINT (event->x,
1904 (XINT (event->x) - XINT (XWINDOW (window)->left)));
1905 XSETINT (event->y,
1906 (XINT (event->y) - XINT (XWINDOW (window)->top)));
1907
1902 if (part == 1) 1908 if (part == 1)
1903 posn = Qmode_line; 1909 posn = Qmode_line;
1904 else if (part == 2) 1910 else if (part == 2)
1905 posn = Qvertical_line; 1911 posn = Qvertical_line;
1906 else 1912 else
1907 { 1913 XSET (posn, Lisp_Int,
1908 XSETINT (event->x, (XINT (event->x) 1914 buffer_posn_from_coords (XWINDOW (window),
1909 - XINT (XWINDOW (window)->left))); 1915 XINT (event->x),
1910 XSETINT (event->y, (XINT (event->y) 1916 XINT (event->y)));
1911 - XINT (XWINDOW (window)->top)));
1912 XSET (posn, Lisp_Int,
1913 buffer_posn_from_coords (XWINDOW (window),
1914 XINT (event->x),
1915 XINT (event->y)));
1916 }
1917 } 1917 }
1918 1918
1919 position = 1919 position =
@@ -1938,29 +1938,43 @@ make_lispy_event (event)
1938 Qnil))))); 1938 Qnil)))));
1939 } 1939 }
1940 1940
1941 start_pos = &XVECTOR (button_down_location)->contents[button]; 1941 start_pos_ptr = &XVECTOR (button_down_location)->contents[button];
1942
1943 start_pos = *start_pos_ptr;
1944 *start_pos_ptr = Qnil;
1942 1945
1943 /* If this is a button press, squirrel away the location, so 1946 /* If this is a button press, squirrel away the location, so
1944 we can decide later whether it was a click or a drag. */ 1947 we can decide later whether it was a click or a drag. */
1945 if (event->modifiers & down_modifier) 1948 if (event->modifiers & down_modifier)
1946 *start_pos = Fcopy_alist (position); 1949 *start_pos_ptr = Fcopy_alist (position);
1947 1950
1948 /* Now we're releasing a button - check the co-ordinates to 1951 /* Now we're releasing a button - check the co-ordinates to
1949 see if this was a click or a drag. */ 1952 see if this was a click or a drag. */
1950 else if (event->modifiers & up_modifier) 1953 else if (event->modifiers & up_modifier)
1951 { 1954 {
1952 Lisp_Object down = Fnth (make_number (2), *start_pos); 1955 /* Is there a start position stored at all for this
1953 1956 button?
1954 /* The third element of every position should be the (x,y) 1957
1955 pair. */ 1958 It would be nice if we could assume that if we're
1956 if (! CONSP (down)) 1959 getting a button release, we must therefore have gotten
1957 abort (); 1960 a button press. Unfortunately, the X menu code thwarts
1958 1961 this assumption, so we'll have to be more robust. We
1962 treat a button release with no stored start position as
1963 a click. */
1959 event->modifiers &= ~up_modifier; 1964 event->modifiers &= ~up_modifier;
1960 event->modifiers |= ((EQ (event->x, XCONS (down)->car) 1965 if (XTYPE (start_pos) != Lisp_Cons)
1961 && EQ (event->y, XCONS (down)->cdr)) 1966 event->modifiers |= click_modifier;
1962 ? click_modifier 1967 else
1963 : drag_modifier); 1968 {
1969 /* The third element of every position should be the (x,y)
1970 pair. */
1971 Lisp_Object down = Fnth (make_number (2), start_pos);
1972
1973 event->modifiers |= ((EQ (event->x, XCONS (down)->car)
1974 && EQ (event->y, XCONS (down)->cdr))
1975 ? click_modifier
1976 : drag_modifier);
1977 }
1964 } 1978 }
1965 else 1979 else
1966 /* Every mouse event should either have the down_modifier or 1980 /* Every mouse event should either have the down_modifier or
@@ -1978,18 +1992,10 @@ make_lispy_event (event)
1978 / sizeof (lispy_mouse_names[0]))); 1992 / sizeof (lispy_mouse_names[0])));
1979 1993
1980 if (event->modifiers & drag_modifier) 1994 if (event->modifiers & drag_modifier)
1981 { 1995 return Fcons (head,
1982 Lisp_Object lispy_event = 1996 Fcons (start_pos,
1983 Fcons (head, 1997 Fcons (position,
1984 Fcons (*start_pos, 1998 Qnil)));
1985 Fcons (position,
1986 Qnil)));
1987
1988 /* Allow this to be GC'd. */
1989 *start_pos = Qnil;
1990
1991 return lispy_event;
1992 }
1993 else 1999 else
1994 return Fcons (head, 2000 return Fcons (head,
1995 Fcons (position, 2001 Fcons (position,
@@ -2454,21 +2460,6 @@ modify_event_symbol (symbol_num, modifiers, symbol_kind, name_table,
2454} 2460}
2455 2461
2456 2462
2457DEFUN ("mouse-click-p", Fmouse_click_p, Smouse_click_p, 1, 1, 0,
2458 "Return non-nil iff OBJECT is a representation of a mouse event.\n\
2459A mouse event is a list of five elements whose car is a symbol of the\n\
2460form <MODIFIERS>mouse-<DIGIT>. I hope this is a temporary hack.")
2461 (object)
2462 Lisp_Object object;
2463{
2464 if (EVENT_HAS_PARAMETERS (object)
2465 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (object)),
2466 Qmouse_click))
2467 return Qt;
2468 else
2469 return Qnil;
2470}
2471
2472/* Store into *addr a value nonzero if terminal input chars are available. 2463/* Store into *addr a value nonzero if terminal input chars are available.
2473 Serves the purpose of ioctl (0, FIONREAD, addr) 2464 Serves the purpose of ioctl (0, FIONREAD, addr)
2474 but works even if FIONREAD does not exist. 2465 but works even if FIONREAD does not exist.
@@ -2686,7 +2677,9 @@ static int echo_flag;
2686static int echo_now; 2677static int echo_now;
2687 2678
2688/* Read a character like read_char but optionally prompt based on maps 2679/* Read a character like read_char but optionally prompt based on maps
2689 in the array MAPS. NMAPS is the length of MAPS. 2680 in the array MAPS. NMAPS is the length of MAPS. Return nil if we
2681 decided not to read a character, because there are no menu items in
2682 MAPS.
2690 2683
2691 PREV_EVENT is the previous input event, or nil if we are reading 2684 PREV_EVENT is the previous input event, or nil if we are reading
2692 the first event of a key sequence. 2685 the first event of a key sequence.
@@ -2730,14 +2723,14 @@ read_char_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
2730 } 2723 }
2731 2724
2732 /* If we don't have any menus, just read a character normally. */ 2725 /* If we don't have any menus, just read a character normally. */
2733 if (NILP (name)) 2726 if (mapno >= nmaps)
2734 return Qnil; 2727 return Qnil;
2735 2728
2736#ifdef HAVE_X_WINDOW 2729#ifdef HAVE_X_WINDOWS
2737#ifndef NO_X_MENU 2730#ifdef HAVE_X_MENU
2738 /* If we got to this point via a mouse click, 2731 /* If we got to this point via a mouse click,
2739 use a real menu for mouse selection. */ 2732 use a real menu for mouse selection. */
2740 if (XTYPE (prev_event) == Lisp_Cons) 2733 if (EVENT_HAS_PARAMETERS (prev_event))
2741 { 2734 {
2742 /* Display the menu and get the selection. */ 2735 /* Display the menu and get the selection. */
2743 Lisp_Object *realmaps 2736 Lisp_Object *realmaps
@@ -2757,8 +2750,8 @@ read_char_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
2757 *used_mouse_menu = 1; 2750 *used_mouse_menu = 1;
2758 return value; 2751 return value;
2759 } 2752 }
2760#endif /* not NO_X_MENU */ 2753#endif /* HAVE_X_MENU */
2761#endif /* HAVE_X_WINDOW */ 2754#endif /* HAVE_X_WINDOWS */
2762 2755
2763 /* Prompt string always starts with map's prompt, and a space. */ 2756 /* Prompt string always starts with map's prompt, and a space. */
2764 strcpy (menu, XSTRING (name)->data); 2757 strcpy (menu, XSTRING (name)->data);
@@ -3677,7 +3670,7 @@ DEFUN ("input-pending-p", Finput_pending_p, Sinput_pending_p, 0, 0, 0,
3677Actually, the value is nil only if we can be sure that no input is available.") 3670Actually, the value is nil only if we can be sure that no input is available.")
3678 () 3671 ()
3679{ 3672{
3680 if (!NILP (unread_command_event)) 3673 if (!NILP (unread_command_events))
3681 return (Qt); 3674 return (Qt);
3682 3675
3683 return detect_input_pending () ? Qt : Qnil; 3676 return detect_input_pending () ? Qt : Qnil;
@@ -3749,7 +3742,7 @@ Also cancel any kbd macro being defined.")
3749 defining_kbd_macro = 0; 3742 defining_kbd_macro = 0;
3750 update_mode_lines++; 3743 update_mode_lines++;
3751 3744
3752 unread_command_event = Qnil; 3745 unread_command_events = Qnil;
3753 3746
3754 discard_tty_input (); 3747 discard_tty_input ();
3755 3748
@@ -3997,7 +3990,7 @@ quit_throw_to_read_char ()
3997 clear_waiting_for_input (); 3990 clear_waiting_for_input ();
3998 input_pending = 0; 3991 input_pending = 0;
3999 3992
4000 unread_command_event = Qnil; 3993 unread_command_events = Qnil;
4001 3994
4002 _longjmp (getcjmp, 1); 3995 _longjmp (getcjmp, 1);
4003} 3996}
@@ -4051,7 +4044,7 @@ init_keyboard ()
4051 command_loop_level = -1; 4044 command_loop_level = -1;
4052 immediate_quit = 0; 4045 immediate_quit = 0;
4053 quit_char = Ctl ('g'); 4046 quit_char = Ctl ('g');
4054 unread_command_event = Qnil; 4047 unread_command_events = Qnil;
4055 total_keys = 0; 4048 total_keys = 0;
4056 recent_keys_index = 0; 4049 recent_keys_index = 0;
4057 kbd_fetch_ptr = kbd_buffer; 4050 kbd_fetch_ptr = kbd_buffer;
@@ -4219,7 +4212,6 @@ syms_of_keyboard ()
4219 defsubr (&Sread_key_sequence); 4212 defsubr (&Sread_key_sequence);
4220 defsubr (&Srecursive_edit); 4213 defsubr (&Srecursive_edit);
4221 defsubr (&Strack_mouse); 4214 defsubr (&Strack_mouse);
4222 defsubr (&Smouse_click_p);
4223 defsubr (&Sinput_pending_p); 4215 defsubr (&Sinput_pending_p);
4224 defsubr (&Scommand_execute); 4216 defsubr (&Scommand_execute);
4225 defsubr (&Srecent_keys); 4217 defsubr (&Srecent_keys);
@@ -4250,8 +4242,8 @@ so that you can determine whether the command was run by mouse or not.");
4250 DEFVAR_LISP ("last-input-char", &last_input_char, 4242 DEFVAR_LISP ("last-input-char", &last_input_char,
4251 "Last terminal input key."); 4243 "Last terminal input key.");
4252 4244
4253 DEFVAR_LISP ("unread-command-event", &unread_command_event, 4245 DEFVAR_LISP ("unread-command-events", &unread_command_events,
4254 "Object to be read as next input from input stream, or nil if none."); 4246 "Lisp of object to be read as next input from input stream, or nil if none.");
4255 4247
4256 DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char, 4248 DEFVAR_LISP ("meta-prefix-char", &meta_prefix_char,
4257 "Meta-prefix character code. Meta-foo as command input\n\ 4249 "Meta-prefix character code. Meta-foo as command input\n\
diff --git a/src/keyboard.h b/src/keyboard.h
index c7048fd6c0c..1d4a82256d0 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -1,5 +1,5 @@
1/* Declarations useful when processing input. 1/* Declarations useful when processing input.
2 Copyright (C) 1985, 1986, 1987, 1992 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -84,7 +84,6 @@ extern Lisp_Object Qmode_line, Qvertical_line;
84extern Lisp_Object get_keymap_1 (); 84extern Lisp_Object get_keymap_1 ();
85extern Lisp_Object Fkeymapp (); 85extern Lisp_Object Fkeymapp ();
86extern Lisp_Object reorder_modifiers (); 86extern Lisp_Object reorder_modifiers ();
87extern Lisp_Object Fmouse_click_p ();
88extern Lisp_Object read_char (); 87extern Lisp_Object read_char ();
89/* User-supplied string to translate input characters through. */ 88/* User-supplied string to translate input characters through. */
90extern Lisp_Object Vkeyboard_translate_table; 89extern Lisp_Object Vkeyboard_translate_table;
diff --git a/src/keymap.c b/src/keymap.c
index 5282711bac0..e1b61f5db90 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -555,8 +555,14 @@ the front of KEYMAP.")
555 555
556 keymap = get_keymap_1 (cmd, 0, 1); 556 keymap = get_keymap_1 (cmd, 0, 1);
557 if (NILP (keymap)) 557 if (NILP (keymap))
558 error ("Key sequence %s uses invalid prefix characters", 558 {
559 XSTRING (key)->data); 559 /* We must use Fkey_description rather than just passing key to
560 error; key might be a vector, not a string. */
561 Lisp_Object description = Fkey_description (key);
562
563 error ("Key sequence %s uses invalid prefix characters",
564 XSTRING (description)->data);
565 }
560 } 566 }
561} 567}
562 568
diff --git a/src/lread.c b/src/lread.c
index 0198dda9aca..721955c358b 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -203,7 +203,7 @@ If you want to read non-character events, or ignore them, call\n\
203 /* Only ASCII characters are acceptable. */ 203 /* Only ASCII characters are acceptable. */
204 if (XTYPE (val) != Lisp_Int) 204 if (XTYPE (val) != Lisp_Int)
205 { 205 {
206 unread_command_event = val; 206 unread_command_events = Fcons (val, Qnil);
207 error ("Object read was not a character"); 207 error ("Object read was not a character");
208 } 208 }
209 } 209 }
@@ -1045,9 +1045,17 @@ read1 (readcharfun)
1045 if (p1 != p) 1045 if (p1 != p)
1046 { 1046 {
1047 while (p1 != p && (c = *p1) >= '0' && c <= '9') p1++; 1047 while (p1 != p && (c = *p1) >= '0' && c <= '9') p1++;
1048#ifdef LISP_FLOAT_TYPE
1049 /* Integers can have trailing decimal points. */
1050 if (p1 < p && *p1 == '.') p1++;
1051#endif
1048 if (p1 == p) 1052 if (p1 == p)
1049 /* It is. */ 1053 /* It is an integer. */
1050 { 1054 {
1055#ifdef LISP_FLOAT_TYPE
1056 if (p1[-1] == '.')
1057 p1[-1] = '\0';
1058#endif
1051 XSET (val, Lisp_Int, atoi (read_buffer)); 1059 XSET (val, Lisp_Int, atoi (read_buffer));
1052 return val; 1060 return val;
1053 } 1061 }
diff --git a/src/minibuf.c b/src/minibuf.c
index c3625565000..bc1074c89d0 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1,5 +1,5 @@
1/* Minibuffer input and completion. 1/* Minibuffer input and completion.
2 Copyright (C) 1985, 1986, 1992 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1992, 1993 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -930,7 +930,7 @@ temp_echo_area_glyphs (m)
930 if (!NILP (Vquit_flag)) 930 if (!NILP (Vquit_flag))
931 { 931 {
932 Vquit_flag = Qnil; 932 Vquit_flag = Qnil;
933 XFASTINT (unread_command_event) = Ctl ('g'); 933 unread_command_events = Fcons (make_number (Ctl ('g')), Qnil);
934 } 934 }
935 Vinhibit_quit = oinhibit; 935 Vinhibit_quit = oinhibit;
936} 936}
diff --git a/src/term.c b/src/term.c
index f0cb67b8f6d..cd9e5a84a44 100644
--- a/src/term.c
+++ b/src/term.c
@@ -125,6 +125,18 @@ void (*mouse_position_hook) ( /* FRAME_PTR *f,
125 the highlight. */ 125 the highlight. */
126void (*frame_rehighlight_hook) ( /* FRAME_PTR f */ ); 126void (*frame_rehighlight_hook) ( /* FRAME_PTR f */ );
127 127
128/* If we're displaying frames using a window system that can stack
129 frames on top of each other, this hook allows you to bring a frame
130 to the front, or bury it behind all the other windows. If this
131 hook is zero, that means the device we're displaying on doesn't
132 support overlapping frames, so there's no need to raise or lower
133 anything.
134
135 If RAISE is non-zero, F is brought to the front, before all other
136 windows. If RAISE is zero, F is sent to the back, behind all other
137 windows. */
138void (*frame_raise_lower_hook) ( /* FRAME_PTR f, int raise */ );
139
128/* Set the vertical scrollbar for WINDOW to have its upper left corner 140/* Set the vertical scrollbar for WINDOW to have its upper left corner
129 at (TOP, LEFT), and be LENGTH rows high. Set its handle to 141 at (TOP, LEFT), and be LENGTH rows high. Set its handle to
130 indicate that we are displaying PORTION characters out of a total 142 indicate that we are displaying PORTION characters out of a total
diff --git a/src/termhooks.h b/src/termhooks.h
index 9b2c0146ce0..ce9e2ed3d45 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -96,6 +96,17 @@ extern int mouse_moved;
96 X, this means that Emacs lies about where the focus is. */ 96 X, this means that Emacs lies about where the focus is. */
97extern void (*frame_rehighlight_hook) ( /* void */ ); 97extern void (*frame_rehighlight_hook) ( /* void */ );
98 98
99/* If we're displaying frames using a window system that can stack
100 frames on top of each other, this hook allows you to bring a frame
101 to the front, or bury it behind all the other windows. If this
102 hook is zero, that means the device we're displaying on doesn't
103 support overlapping frames, so there's no need to raise or lower
104 anything.
105
106 If RAISE is non-zero, F is brought to the front, before all other
107 windows. If RAISE is zero, F is sent to the back, behind all other
108 windows. */
109extern void (*frame_raise_lower_hook) ( /* FRAME_PTR f, int raise */ );
99 110
100 111
101/* Scrollbar hooks. */ 112/* Scrollbar hooks. */
diff --git a/src/window.c b/src/window.c
index a14599bf786..b788c8f3fae 100644
--- a/src/window.c
+++ b/src/window.c
@@ -60,9 +60,6 @@ Lisp_Object Vminibuf_scroll_window;
60/* Non-nil means this is the buffer whose window C-M-v should scroll. */ 60/* Non-nil means this is the buffer whose window C-M-v should scroll. */
61Lisp_Object Vother_window_scroll_buffer; 61Lisp_Object Vother_window_scroll_buffer;
62 62
63/* Window that the mouse is over (nil if no mouse support). */
64Lisp_Object Vmouse_window;
65
66/* Last mouse click data structure (nil if no mouse support). */ 63/* Last mouse click data structure (nil if no mouse support). */
67Lisp_Object Vmouse_event; 64Lisp_Object Vmouse_event;
68 65
@@ -811,7 +808,12 @@ minibuffer does not count, only windows from WINDOW's frame count.\n\
811\n\ 808\n\
812Optional third arg ALL-FRAMES t means include windows on all frames.\n\ 809Optional third arg ALL-FRAMES t means include windows on all frames.\n\
813ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ 810ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
814above. If neither nil nor t, restrict to WINDOW's frame.") 811above. If neither nil nor t, restrict to WINDOW's frame.\n\
812\n\
813If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
814`next-window' to iterate through the entire cycle of acceptable\n\
815windows, eventually ending up back at the window you started with.\n\
816`previous-window' traverses the same cycle, in the reverse order.")
815 (window, minibuf, all_frames) 817 (window, minibuf, all_frames)
816 register Lisp_Object window, minibuf, all_frames; 818 register Lisp_Object window, minibuf, all_frames;
817{ 819{
@@ -908,7 +910,12 @@ count.\n\
908\n\ 910\n\
909Optional third arg ALL-FRAMES t means include windows on all frames.\n\ 911Optional third arg ALL-FRAMES t means include windows on all frames.\n\
910ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ 912ALL-FRAMES nil or omitted means cycle within the frames as specified\n\
911above. If neither nil nor t, restrict to WINDOW's frame.") 913above. If neither nil nor t, restrict to WINDOW's frame.\n\
914\n\
915If you use consistent values for MINIBUF and ALL-FRAMES, you can use\n\
916`previous-window' to iterate through the entire cycle of acceptable\n\
917windows, eventually ending up back at the window you started with.\n\
918`next-window' traverses the same cycle, in the reverse order.")
912 (window, minibuf, all_frames) 919 (window, minibuf, all_frames)
913 register Lisp_Object window, minibuf, all_frames; 920 register Lisp_Object window, minibuf, all_frames;
914{ 921{
@@ -955,7 +962,16 @@ above. If neither nil nor t, restrict to WINDOW's frame.")
955 tem = WINDOW_FRAME (XWINDOW (window)); 962 tem = WINDOW_FRAME (XWINDOW (window));
956#ifdef MULTI_FRAME 963#ifdef MULTI_FRAME
957 if (! NILP (all_frames)) 964 if (! NILP (all_frames))
958 tem = next_frame (tem, all_frames); 965 /* It's actually important that we use prev_frame here,
966 rather than next_frame. All the windows acceptable
967 according to the given parameters should form a ring;
968 Fnext_window and Fprevious_window should go back and
969 forth around the ring. If we use next_frame here,
970 then Fnext_window and Fprevious_window take different
971 paths through the set of acceptable windows.
972 window_loop assumes that these `ring' requirement are
973 met. */
974 tem = prev_frame (tem, all_frames);
959#endif 975#endif
960 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); 976 tem = FRAME_ROOT_WINDOW (XFRAME (tem));
961 977
@@ -2205,8 +2221,20 @@ showing that buffer, popping the buffer up if necessary.")
2205 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt); 2221 window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt);
2206 } 2222 }
2207 else 2223 else
2208 /* Nothing specified; pick a neighboring window. */ 2224 {
2209 window = Fnext_window (selected_window, Qnil, Qt); 2225 /* Nothing specified; look for a neighboring window on the same
2226 frame. */
2227 window = Fnext_window (selected_window, Qnil, Qnil);
2228
2229 if (EQ (window, selected_window))
2230 /* That didn't get us anywhere; look for a window on another
2231 visible frame. */
2232 do
2233 window = Fnext_window (window, Qnil, Qt);
2234 while (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (window))))
2235 && ! EQ (window, selected_window));
2236 }
2237
2210 CHECK_LIVE_WINDOW (window, 0); 2238 CHECK_LIVE_WINDOW (window, 0);
2211 2239
2212 if (EQ (window, selected_window)) 2240 if (EQ (window, selected_window))
@@ -2866,10 +2894,6 @@ Commands such as `switch-to-buffer-other-window' and `find-file-other-window'\n\
2866work using this function."); 2894work using this function.");
2867 Vdisplay_buffer_function = Qnil; 2895 Vdisplay_buffer_function = Qnil;
2868 2896
2869 DEFVAR_LISP ("mouse-window", &Vmouse_window,
2870 "Window that the last mouse click occurred on.");
2871 Vmouse_window = Qnil;
2872
2873 DEFVAR_LISP ("mouse-event", &Vmouse_event, 2897 DEFVAR_LISP ("mouse-event", &Vmouse_event,
2874 "The last mouse-event object. A list of four elements:\n\ 2898 "The last mouse-event object. A list of four elements:\n\
2875 ((X-POS Y-POS) WINDOW FRAME-PART KEYSEQ).\n\ 2899 ((X-POS Y-POS) WINDOW FRAME-PART KEYSEQ).\n\
diff --git a/src/xfns.c b/src/xfns.c
index cb5aaca7af7..5b9f7da731f 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -37,6 +37,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
37#ifdef HAVE_X_WINDOWS 37#ifdef HAVE_X_WINDOWS
38extern void abort (); 38extern void abort ();
39 39
40#include <X11/bitmaps/gray>
41
40#define min(a,b) ((a) < (b) ? (a) : (b)) 42#define min(a,b) ((a) < (b) ? (a) : (b))
41#define max(a,b) ((a) > (b) ? (a) : (b)) 43#define max(a,b) ((a) > (b) ? (a) : (b))
42 44
@@ -58,9 +60,6 @@ Lisp_Object Vx_pointer_shape, Vx_nontext_pointer_shape, Vx_mode_pointer_shape;
58/* Color of chars displayed in cursor box. */ 60/* Color of chars displayed in cursor box. */
59Lisp_Object Vx_cursor_fore_pixel; 61Lisp_Object Vx_cursor_fore_pixel;
60 62
61/* If non-nil, use vertical bar cursor. */
62Lisp_Object Vbar_cursor;
63
64/* The X Visual we are using for X windows (the default) */ 63/* The X Visual we are using for X windows (the default) */
65Visual *screen_visual; 64Visual *screen_visual;
66 65
@@ -115,7 +114,6 @@ static char *x_visual_strings[] =
115Lisp_Object Vmouse_depressed; 114Lisp_Object Vmouse_depressed;
116 115
117extern unsigned int x_mouse_x, x_mouse_y, x_mouse_grabbed; 116extern unsigned int x_mouse_x, x_mouse_y, x_mouse_grabbed;
118extern Lisp_Object unread_command_event;
119 117
120/* Atom for indicating window state to the window manager. */ 118/* Atom for indicating window state to the window manager. */
121Atom Xatom_wm_change_state; 119Atom Xatom_wm_change_state;
@@ -123,9 +121,6 @@ Atom Xatom_wm_change_state;
123/* When emacs became the selection owner. */ 121/* When emacs became the selection owner. */
124extern Time x_begin_selection_own; 122extern Time x_begin_selection_own;
125 123
126/* The value of the current emacs selection. */
127extern Lisp_Object Vx_selection_value;
128
129/* Emacs' selection property identifier. */ 124/* Emacs' selection property identifier. */
130extern Atom Xatom_emacs_selection; 125extern Atom Xatom_emacs_selection;
131 126
@@ -228,9 +223,12 @@ Time mouse_timestamp;
228Lisp_Object Qauto_raise; 223Lisp_Object Qauto_raise;
229Lisp_Object Qauto_lower; 224Lisp_Object Qauto_lower;
230Lisp_Object Qbackground_color; 225Lisp_Object Qbackground_color;
226Lisp_Object Qbar;
231Lisp_Object Qborder_color; 227Lisp_Object Qborder_color;
232Lisp_Object Qborder_width; 228Lisp_Object Qborder_width;
229Lisp_Object Qbox;
233Lisp_Object Qcursor_color; 230Lisp_Object Qcursor_color;
231Lisp_Object Qcursor_type;
234Lisp_Object Qfont; 232Lisp_Object Qfont;
235Lisp_Object Qforeground_color; 233Lisp_Object Qforeground_color;
236Lisp_Object Qgeometry; 234Lisp_Object Qgeometry;
@@ -261,14 +259,6 @@ extern Lisp_Object Vglobal_mouse_map;
261 259
262/* Points to table of defined typefaces. */ 260/* Points to table of defined typefaces. */
263struct face *x_face_table[MAX_FACES_AND_GLYPHS]; 261struct face *x_face_table[MAX_FACES_AND_GLYPHS];
264
265static char gray_bits[] =
266 {
267 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
268 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
269 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa,
270 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa
271 };
272 262
273/* Return the Emacs frame-object corresponding to an X window. 263/* Return the Emacs frame-object corresponding to an X window.
274 It could be the frame's main window or an icon window. */ 264 It could be the frame's main window or an icon window. */
@@ -330,6 +320,7 @@ void x_set_background_color ();
330void x_set_mouse_color (); 320void x_set_mouse_color ();
331void x_set_cursor_color (); 321void x_set_cursor_color ();
332void x_set_border_color (); 322void x_set_border_color ();
323void x_set_cursor_type ();
333void x_set_icon_type (); 324void x_set_icon_type ();
334void x_set_font (); 325void x_set_font ();
335void x_set_border_width (); 326void x_set_border_width ();
@@ -346,6 +337,7 @@ static struct x_frame_parm_table x_frame_parms[] =
346 "mouse-color", x_set_mouse_color, 337 "mouse-color", x_set_mouse_color,
347 "cursor-color", x_set_cursor_color, 338 "cursor-color", x_set_cursor_color,
348 "border-color", x_set_border_color, 339 "border-color", x_set_border_color,
340 "cursor-type", x_set_cursor_type,
349 "icon-type", x_set_icon_type, 341 "icon-type", x_set_icon_type,
350 "font", x_set_font, 342 "font", x_set_font,
351 "border-width", x_set_border_width, 343 "border-width", x_set_border_width,
@@ -808,7 +800,8 @@ x_set_border_pixel (f, pix)
808 pix); 800 pix);
809#else 801#else
810 if (pix < 0) 802 if (pix < 0)
811 temp = XMakePixmap ((Bitmap) XStoreBitmap (16, 16, gray_bits), 803 temp = XMakePixmap ((Bitmap) XStoreBitmap (gray_width, gray_height,
804 gray_bits),
812 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); 805 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT);
813 else 806 else
814 temp = XMakeTile (pix); 807 temp = XMakeTile (pix);
@@ -823,6 +816,24 @@ x_set_border_pixel (f, pix)
823} 816}
824 817
825void 818void
819x_set_cursor_type (f, arg, oldval)
820 FRAME_PTR f;
821 Lisp_Object arg, oldval;
822{
823 if (EQ (arg, Qbar))
824 FRAME_DESIRED_CURSOR (f) = bar_cursor;
825 else if (EQ (arg, Qbox))
826 FRAME_DESIRED_CURSOR (f) = filled_box_cursor;
827 else
828 error
829 ("the `cursor-type' frame parameter should be either `bar' or `box'");
830
831 /* Make sure the cursor gets redrawn. This is overkill, but how
832 often do people change cursor types? */
833 update_mode_lines++;
834}
835
836void
826x_set_icon_type (f, arg, oldval) 837x_set_icon_type (f, arg, oldval)
827 struct frame *f; 838 struct frame *f;
828 Lisp_Object arg, oldval; 839 Lisp_Object arg, oldval;
@@ -1796,31 +1807,12 @@ x_make_gc (f)
1796 the frame. Since this depends on the frame's pixel values, 1807 the frame. Since this depends on the frame's pixel values,
1797 this must be done on a per-frame basis. */ 1808 this must be done on a per-frame basis. */
1798 f->display.x->border_tile = 1809 f->display.x->border_tile =
1799 XCreatePixmap (x_current_display, ROOT_WINDOW, 16, 16, 1810 XCreatePixmapFromBitmapData
1800 DefaultDepth (x_current_display, 1811 (x_current_display, ROOT_WINDOW,
1801 XDefaultScreen (x_current_display))); 1812 gray_bits, gray_width, gray_height,
1802 gc_values.foreground = f->display.x->foreground_pixel; 1813 f->display.x->foreground_pixel,
1803 gc_values.background = f->display.x->background_pixel; 1814 f->display.x->background_pixel,
1804 temp_gc = XCreateGC (x_current_display, 1815 DefaultDepth (x_current_display, XDefaultScreen (x_current_display)));
1805 (Drawable) f->display.x->border_tile,
1806 GCForeground | GCBackground, &gc_values);
1807
1808 /* These are things that should be determined by the server, in
1809 Fx_open_connection */
1810 tileimage.height = 16;
1811 tileimage.width = 16;
1812 tileimage.xoffset = 0;
1813 tileimage.format = XYBitmap;
1814 tileimage.data = gray_bits;
1815 tileimage.byte_order = LSBFirst;
1816 tileimage.bitmap_unit = 8;
1817 tileimage.bitmap_bit_order = LSBFirst;
1818 tileimage.bitmap_pad = 8;
1819 tileimage.bytes_per_line = (16 + 7) >> 3;
1820 tileimage.depth = 1;
1821 XPutImage (x_current_display, f->display.x->border_tile, temp_gc,
1822 &tileimage, 0, 0, 0, 0, 16, 16);
1823 XFreeGC (x_current_display, temp_gc);
1824} 1816}
1825#endif /* HAVE_X11 */ 1817#endif /* HAVE_X11 */
1826 1818
@@ -1930,6 +1922,8 @@ be shared by the new frame.")
1930 "autoRaise", "AutoRaiseLower", boolean); 1922 "autoRaise", "AutoRaiseLower", boolean);
1931 x_default_parameter (f, parms, Qauto_lower, Qnil, 1923 x_default_parameter (f, parms, Qauto_lower, Qnil,
1932 "autoLower", "AutoRaiseLower", boolean); 1924 "autoLower", "AutoRaiseLower", boolean);
1925 x_default_parameter (f, parms, Qcursor_type, Qbox,
1926 "cursorType", "CursorType", symbol);
1933 1927
1934 /* Dimensions, especially f->height, must be done via change_frame_size. 1928 /* Dimensions, especially f->height, must be done via change_frame_size.
1935 Change will not be effected unless different from the current 1929 Change will not be effected unless different from the current
@@ -3784,12 +3778,18 @@ syms_of_xfns ()
3784 staticpro (&Qauto_lower); 3778 staticpro (&Qauto_lower);
3785 Qbackground_color = intern ("background-color"); 3779 Qbackground_color = intern ("background-color");
3786 staticpro (&Qbackground_color); 3780 staticpro (&Qbackground_color);
3781 Qbar = intern ("bar");
3782 staticpro (&Qbar);
3787 Qborder_color = intern ("border-color"); 3783 Qborder_color = intern ("border-color");
3788 staticpro (&Qborder_color); 3784 staticpro (&Qborder_color);
3789 Qborder_width = intern ("border-width"); 3785 Qborder_width = intern ("border-width");
3790 staticpro (&Qborder_width); 3786 staticpro (&Qborder_width);
3787 Qbox = intern ("box");
3788 staticpro (&Qbox);
3791 Qcursor_color = intern ("cursor-color"); 3789 Qcursor_color = intern ("cursor-color");
3792 staticpro (&Qcursor_color); 3790 staticpro (&Qcursor_color);
3791 Qcursor_type = intern ("cursor-type");
3792 staticpro (&Qcursor_type);
3793 Qfont = intern ("font"); 3793 Qfont = intern ("font");
3794 staticpro (&Qfont); 3794 staticpro (&Qfont);
3795 Qforeground_color = intern ("foreground-color"); 3795 Qforeground_color = intern ("foreground-color");
@@ -3851,10 +3851,6 @@ syms_of_xfns ()
3851 "The shape of the pointer when over the mode line."); 3851 "The shape of the pointer when over the mode line.");
3852 Vx_mode_pointer_shape = Qnil; 3852 Vx_mode_pointer_shape = Qnil;
3853 3853
3854 DEFVAR_LISP ("x-bar-cursor", &Vbar_cursor,
3855 "*If non-nil, use a vertical bar cursor. Otherwise, use the traditional box.");
3856 Vbar_cursor = Qnil;
3857
3858 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel, 3854 DEFVAR_LISP ("x-cursor-fore-pixel", &Vx_cursor_fore_pixel,
3859 "A string indicating the foreground color of the cursor box."); 3855 "A string indicating the foreground color of the cursor box.");
3860 Vx_cursor_fore_pixel = Qnil; 3856 Vx_cursor_fore_pixel = Qnil;
diff --git a/src/xmenu.c b/src/xmenu.c
index 025b61e4084..70f635ac2f5 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -103,7 +103,7 @@ Alternatively, you can specify a menu of multiple panes\n\
103 with a list of the form\n\ 103 with a list of the form\n\
104\(TITLE PANE1 PANE2...), where each pane is a list of form\n\ 104\(TITLE PANE1 PANE2...), where each pane is a list of form\n\
105\(TITLE (LINE ITEM)...). Each line should be a string, and item should\n\ 105\(TITLE (LINE ITEM)...). Each line should be a string, and item should\n\
106be the return value for that line (i.e. if it is selected.") 106be the return value for that line (i.e. if it is selected).")
107 (position, menu) 107 (position, menu)
108 Lisp_Object position, menu; 108 Lisp_Object position, menu;
109{ 109{
diff --git a/src/xselect.c.old b/src/xselect.c.old
index fcbae4b4203..8a3e0443270 100644
--- a/src/xselect.c.old
+++ b/src/xselect.c.old
@@ -1,5 +1,5 @@
1/* X Selection processing for emacs 1/* X Selection processing for emacs
2 Copyright (C) 1990, 1992 Free Software Foundation. 2 Copyright (C) 1990, 1992, 1993 Free Software Foundation.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -188,17 +188,41 @@ own_selection (selection_type, time)
188 If we are already the owner, merely change data and timestamp values. 188 If we are already the owner, merely change data and timestamp values.
189 This avoids generating SelectionClear events for ourselves. */ 189 This avoids generating SelectionClear events for ourselves. */
190 190
191DEFUN ("x-own-selection", Fx_own_selection, Sx_own_selection, 191DEFUN ("x-set-selection", Fx_set_selection, Sx_set_selection,
192 1, 2, "", 192 2, 2, "",
193 "Make STRING the selection value. Default is the primary selection,\n\ 193 "Set the value of SELECTION to STRING.\n\
194but optional second argument TYPE may specify secondary or clipboard.\n\ 194SELECTION may be `primary', `secondary', or `clipboard'.\n\
195\n\ 195\n\
196TYPE may also be cut-buffer0, indicating that Emacs should set the X\n\ 196Selections are a mechanism for cutting and pasting information between\n\
197cut buffer 0 to STRING. This is for compatibility with older X\n\ 197X Windows clients. Emacs's kill ring commands set the `primary'\n\
198applications which still use the cut buffers; new applications should\n\ 198selection to the top string of the kill ring, making it available to\n\
199use X selections.") 199other clients, like xterm. Those commands also use the `primary'\n\
200 (string, type) 200selection to retrieve information from other clients.\n\
201 register Lisp_Object string, type; 201\n\
202According to the Inter-Client Communications Conventions Manual:\n\
203\n\
204The `primary' selection \"... is used for all commands that take only a\n\
205 single argument and is the principal means of communication between\n\
206 clients that use the selection mechanism.\" In Emacs, this means\n\
207 that the kill ring commands set the primary selection to the text\n\
208 put in the kill ring.\n\
209\n\
210The `secondary' selection \"... is used as the second argument to\n\
211 commands taking two arguments (for example, `exchange primary and\n\
212 secondary selections'), and as a means of obtaining data when there\n\
213 is a primary selection and the user does not want to disturb it.\"\n\
214 I am not sure how Emacs should use the secondary selection; if you\n\
215 come up with ideas, this function will at least let you get at it.\n\
216\n\
217The `clipboard' selection \"... is used to hold data that is being\n\
218 transferred between clients, that is, data that usually is being\n\
219 cut or copied, and then pasted.\" It seems that the `clipboard'\n\
220 selection is for the most part equivalent to the `primary'\n\
221 selection, so Emacs sets them both.\n\
222\n\
223Also see `x-selection', and the `interprogram-cut-function' variable.")
224 (selection, string)
225 register Lisp_Object selection, string;
202{ 226{
203 Atom selection_type; 227 Atom selection_type;
204 Lisp_Object val; 228 Lisp_Object val;
@@ -207,7 +231,7 @@ use X selections.")
207 231
208 val = Qnil; 232 val = Qnil;
209 233
210 if (NILP (type) || EQ (type, Qprimary)) 234 if (NILP (selection) || EQ (selection, Qprimary))
211 { 235 {
212 BLOCK_INPUT; 236 BLOCK_INPUT;
213 if (own_selection (XA_PRIMARY, event_time)) 237 if (own_selection (XA_PRIMARY, event_time))
@@ -217,7 +241,7 @@ use X selections.")
217 } 241 }
218 UNBLOCK_INPUT; 242 UNBLOCK_INPUT;
219 } 243 }
220 else if (EQ (type, Qsecondary)) 244 else if (EQ (selection, Qsecondary))
221 { 245 {
222 BLOCK_INPUT; 246 BLOCK_INPUT;
223 if (own_selection (XA_SECONDARY, event_time)) 247 if (own_selection (XA_SECONDARY, event_time))
@@ -227,7 +251,7 @@ use X selections.")
227 } 251 }
228 UNBLOCK_INPUT; 252 UNBLOCK_INPUT;
229 } 253 }
230 else if (EQ (type, Qclipboard)) 254 else if (EQ (selection, Qclipboard))
231 { 255 {
232 BLOCK_INPUT; 256 BLOCK_INPUT;
233 if (own_selection (Xatom_clipboard, event_time)) 257 if (own_selection (Xatom_clipboard, event_time))
@@ -237,33 +261,6 @@ use X selections.")
237 } 261 }
238 UNBLOCK_INPUT; 262 UNBLOCK_INPUT;
239 } 263 }
240#if 0
241 else if (EQ (type, Qcut_buffer0))
242 {
243 /* DECwindows and some other servers don't seem to like setting
244 properties to values larger than about 20k. For very large
245 values, they signal an error, but for intermediate values
246 they just seem to hang.
247
248 We could just truncate the request, but it's better to let
249 the user know that the strategy he/she's using isn't going to
250 work than to have it work partially, but incorrectly. */
251 BLOCK_INPUT;
252 if (XSTRING (string)->size > MAX_SELECTION (x_current_display))
253 {
254 XStoreBytes (x_current_display, (char *) 0, 0);
255 val = Qnil;
256 }
257 else
258 {
259 XStoreBytes (x_current_display,
260 (char *) XSTRING (string)->data,
261 XSTRING (string)->size);
262 val = string;
263 }
264 UNBLOCK_INPUT;
265 }
266#endif
267 else 264 else
268 error ("Invalid X selection type"); 265 error ("Invalid X selection type");
269 266
@@ -621,54 +618,45 @@ get_selection_value (type)
621 simply return our selection value. If we are not the owner, this 618 simply return our selection value. If we are not the owner, this
622 will block until all of the data has arrived. */ 619 will block until all of the data has arrived. */
623 620
624DEFUN ("x-selection-value", Fx_selection_value, Sx_selection_value, 621DEFUN ("x-selection", Fx_selection, Sx_selection,
625 0, 1, "", 622 1, 1, "",
626 "Return the value of one of the selections. Default is the primary\n\ 623 "Return the value of SELECTION.\n\
627selection, but optional argument TYPE may specify secondary or clipboard.") 624SELECTION is one of `primary', `secondary', or `clipboard'.\n\
628 (type) 625\n\
629 register Lisp_Object type; 626Selections are a mechanism for cutting and pasting information between\n\
627X Windows clients. When the user selects text in an X application,\n\
628the application should set the primary selection to that text; Emacs's\n\
629kill ring commands will then check the value of the `primary'\n\
630selection, and return it as the most recent kill.\n\
631The documentation for `x-set-selection' gives more information on how\n\
632the different selection types are intended to be used.\n\
633Also see the `interprogram-paste-function' variable.")
634 (selection)
635 register Lisp_Object selection;
630{ 636{
631 Atom selection_type; 637 Atom selection_type;
632 638
633 if (NILP (type) || EQ (type, Qprimary)) 639 if (NILP (selection) || EQ (selection, Qprimary))
634 { 640 {
635 if (!NILP (Vx_selection_value)) 641 if (!NILP (Vx_selection_value))
636 return Vx_selection_value; 642 return Vx_selection_value;
637 643
638 return get_selection_value (XA_PRIMARY); 644 return get_selection_value (XA_PRIMARY);
639 } 645 }
640 else if (EQ (type, Qsecondary)) 646 else if (EQ (selection, Qsecondary))
641 { 647 {
642 if (!NILP (Vx_secondary_selection_value)) 648 if (!NILP (Vx_secondary_selection_value))
643 return Vx_secondary_selection_value; 649 return Vx_secondary_selection_value;
644 650
645 return get_selection_value (XA_SECONDARY); 651 return get_selection_value (XA_SECONDARY);
646 } 652 }
647 else if (EQ (type, Qclipboard)) 653 else if (EQ (selection, Qclipboard))
648 { 654 {
649 if (!NILP (Vx_clipboard_value)) 655 if (!NILP (Vx_clipboard_value))
650 return Vx_clipboard_value; 656 return Vx_clipboard_value;
651 657
652 return get_selection_value (Xatom_clipboard); 658 return get_selection_value (Xatom_clipboard);
653 } 659 }
654#if 0
655 else if (EQ (type, Qcut_buffer0))
656 {
657 char *data;
658 int size;
659 Lisp_Object string;
660
661 BLOCK_INPUT;
662 data = XFetchBytes (x_current_display, &size);
663 if (data == 0)
664 string = Qnil;
665 else
666 string = make_string (data, size);
667 UNBLOCK_INPUT;
668
669 return string;
670 }
671#endif
672 else 660 else
673 error ("Invalid X selection type"); 661 error ("Invalid X selection type");
674} 662}
@@ -950,8 +938,8 @@ syms_of_xselect ()
950 Qclipboard = intern ("clipboard"); 938 Qclipboard = intern ("clipboard");
951 staticpro (&Qclipboard); 939 staticpro (&Qclipboard);
952 940
953 defsubr (&Sx_own_selection); 941 defsubr (&Sx_set_selection);
954 defsubr (&Sx_selection_value); 942 defsubr (&Sx_selection);
955 943
956 cut_buffer_value = Fmake_vector (make_number (NUM_CUT_BUFFERS), Qnil); 944 cut_buffer_value = Fmake_vector (make_number (NUM_CUT_BUFFERS), Qnil);
957 staticpro (&cut_buffer_value); 945 staticpro (&cut_buffer_value);
diff --git a/src/xterm.c b/src/xterm.c
index b534751dbf7..712a64ac26d 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -657,95 +657,128 @@ XTclear_frame ()
657 curs_y = 0; 657 curs_y = 0;
658 658
659 BLOCK_INPUT; 659 BLOCK_INPUT;
660
660 XClear (FRAME_X_WINDOW (f)); 661 XClear (FRAME_X_WINDOW (f));
662
663 /* We have to clear the scrollbars, too. If we have changed
664 colors or something like that, then they should be notified. */
665 x_scrollbar_clear (f);
666
661#ifndef HAVE_X11 667#ifndef HAVE_X11
662 dumpborder (f, 0); 668 dumpborder (f, 0);
663#endif /* HAVE_X11 */ 669#endif /* HAVE_X11 */
670
664 XFlushQueue (); 671 XFlushQueue ();
665 UNBLOCK_INPUT; 672 UNBLOCK_INPUT;
666} 673}
667 674
668/* Paint horzontal bars down the frame for a visible bell. 675/* Invert the middle quarter of the frame for .15 sec. */
669 Note that this may be way too slow on some machines. */ 676
677/* We use the select system call to do the waiting, so we have to make sure
678 it's avaliable. If it isn't, we just won't do visual bells. */
679#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
680
681/* Subtract the `struct timeval' values X and Y,
682 storing the result in RESULT.
683 Return 1 if the difference is negative, otherwise 0. */
684
685static int
686timeval_subtract (result, x, y)
687 struct timeval *result, x, y;
688{
689 /* Perform the carry for the later subtraction by updating y.
690 This is safer because on some systems
691 the tv_sec member is unsigned. */
692 if (x.tv_usec < y.tv_usec)
693 {
694 int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1;
695 y.tv_usec -= 1000000 * nsec;
696 y.tv_sec += nsec;
697 }
698 if (x.tv_usec - y.tv_usec > 1000000)
699 {
700 int nsec = (y.tv_usec - x.tv_usec) / 1000000;
701 y.tv_usec += 1000000 * nsec;
702 y.tv_sec -= nsec;
703 }
704
705 /* Compute the time remaining to wait. tv_usec is certainly positive. */
706 result->tv_sec = x.tv_sec - y.tv_sec;
707 result->tv_usec = x.tv_usec - y.tv_usec;
708
709 /* Return indication of whether the result should be considered negative. */
710 return x.tv_sec < y.tv_sec;
711}
670 712
671XTflash (f) 713XTflash (f)
672 struct frame *f; 714 struct frame *f;
673{ 715{
674 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f); 716 BLOCK_INPUT;
675 register int i;
676 int x, y;
677 717
678 if (updating_frame != 0) 718 {
679 abort (); 719 GC gc;
680 720
681 BLOCK_INPUT; 721 /* Create a GC that will use the GXxor function to flip foreground pixels
682#ifdef HAVE_X11 722 into background pixels. */
683#if 0 723 {
684 for (i = f->height * FONT_HEIGHT (f->display.x->font) - 10; 724 XGCValues values;
685 i >= 0;
686 i -= 100) /* Should be NO LOWER than 75 for speed reasons. */
687 XFillRectangle (x_current_display, FRAME_X_WINDOW (f),
688 f->display.x->cursor_gc,
689 0, i, f->width * FONT_WIDTH (f->display.x->font)
690 + 2 * f->display.x->internal_border_width, 25);
691#endif /* ! 0 */
692 725
693 x = (f->width * FONT_WIDTH (f->display.x->font)) / 4; 726 values.function = GXxor;
694 y = (f->height * FONT_HEIGHT (f->display.x->font)) / 4; 727 values.foreground = (f->display.x->foreground_pixel
695 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), 728 ^ f->display.x->background_pixel);
696 f->display.x->cursor_gc, 729
697 x, y, 2 * x, 2 * y); 730 gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f),
698 dumpglyphs (f, (x + f->display.x->internal_border_width), 731 GCFunction | GCForeground, &values);
699 (y + f->display.x->internal_border_width), 732 }
700 &active_frame->glyphs[(f->height / 4) + 1][(f->width / 4)],
701 1, 0, f->display.x->font);
702 733
703#else /* ! defined (HAVE_X11) */ 734 {
704 for (i = f->height * FONT_HEIGHT (f->display.x->font) - 10; 735 int width = PIXEL_WIDTH (f);
705 i >= 0; 736 int height = PIXEL_HEIGHT (f);
706 i -= 50)
707 XPixFill (FRAME_X_WINDOW (f), 0, i,
708 f->width * FONT_WIDTH (f->display.x->font)
709 + 2 * f->display.x->internal_border_width, 10,
710 WHITE_PIX_DEFAULT, ClipModeClipped, GXinvert, AllPlanes);
711#endif /* ! defined (HAVE_X11) */
712 737
713 XFlushQueue (); 738 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), gc,
714 UNBLOCK_INPUT; 739 width/4, height/4, width/2, height/2);
715} 740 XFlush (x_current_display);
716 741
717/* Flip background and forground colors of the frame. */ 742 {
743 struct timeval wakeup, now;
718 744
719x_invert_frame (f) 745 gettimeofday (&wakeup, (struct timezone *) 0);
720 struct frame *f;
721{
722#ifdef HAVE_X11
723 GC temp;
724 unsigned long pix_temp;
725 746
726 x_display_cursor (f, 0); 747 /* Compute time to wait until, propagating carry from usecs. */
727 XClearWindow (x_current_display, FRAME_X_WINDOW (f)); 748 wakeup.tv_usec += 150000;
728 temp = f->display.x->normal_gc; 749 wakeup.tv_sec += (wakeup.tv_usec / 1000000);
729 f->display.x->normal_gc = f->display.x->reverse_gc; 750 wakeup.tv_usec %= 1000000;
730 f->display.x->reverse_gc = temp; 751
731 pix_temp = f->display.x->foreground_pixel; 752 /* Keep waiting until past the time wakeup. */
732 f->display.x->foreground_pixel = f->display.x->background_pixel; 753 while (1)
733 f->display.x->background_pixel = pix_temp; 754 {
734 755 struct timeval timeout;
735 XSetWindowBackground (x_current_display, FRAME_X_WINDOW (f), 756
736 f->display.x->background_pixel); 757 gettimeofday (&timeout, (struct timezone *)0);
737 if (f->display.x->background_pixel == f->display.x->cursor_pixel) 758
738 { 759 /* In effect, timeout = wakeup - timeout.
739 f->display.x->cursor_pixel = f->display.x->foreground_pixel; 760 Break if result would be negative. */
740 XSetBackground (x_current_display, f->display.x->cursor_gc, 761 if (timeval_subtract (&timeout, wakeup, timeout))
741 f->display.x->cursor_pixel); 762 break;
742 XSetForeground (x_current_display, f->display.x->cursor_gc, 763
743 f->display.x->background_pixel); 764 /* Try to wait that long--but we might wake up sooner. */
765 select (0, 0, 0, 0, &timeout);
766 }
767 }
768
769 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), gc,
770 width/4, height/4, width/2, height/2);
771 XFreeGC (x_current_display, gc);
772 XFlush (x_current_display);
744 } 773 }
745 redraw_frame (f); 774 }
746#endif /* ! defined (HAVE_X11) */ 775
776 UNBLOCK_INPUT;
747} 777}
748 778
779#endif
780
781
749/* Make audible bell. */ 782/* Make audible bell. */
750 783
751#ifdef HAVE_X11 784#ifdef HAVE_X11
@@ -756,15 +789,11 @@ x_invert_frame (f)
756 789
757XTring_bell () 790XTring_bell ()
758{ 791{
792#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
759 if (visible_bell) 793 if (visible_bell)
760#if 0
761 XTflash (selected_frame); 794 XTflash (selected_frame);
762#endif /* ! 0 */
763 {
764 x_invert_frame (selected_frame);
765 x_invert_frame (selected_frame);
766 }
767 else 795 else
796#endif
768 { 797 {
769 BLOCK_INPUT; 798 BLOCK_INPUT;
770 XRINGBELL; 799 XRINGBELL;
@@ -1758,9 +1787,8 @@ x_scrollbar_create (window, top, left, width, height)
1758 | ButtonMotionMask | PointerMotionHintMask 1787 | ButtonMotionMask | PointerMotionHintMask
1759 | ExposureMask); 1788 | ExposureMask);
1760 a.cursor = x_vertical_scrollbar_cursor; 1789 a.cursor = x_vertical_scrollbar_cursor;
1761 a.win_gravity = EastGravity;
1762 1790
1763 mask = (CWBackPixel | CWEventMask | CWCursor | CWWinGravity); 1791 mask = (CWBackPixel | CWEventMask | CWCursor);
1764 1792
1765 SET_SCROLLBAR_X_WINDOW 1793 SET_SCROLLBAR_X_WINDOW
1766 (bar, 1794 (bar,
@@ -2321,6 +2349,24 @@ x_scrollbar_report_motion (f, bar_window, part, x, y, time)
2321} 2349}
2322 2350
2323 2351
2352/* The screen has been cleared so we may have changed foreground or
2353 background colors, and the scrollbars may need to be redrawn.
2354 Clear out the scrollbars, and ask for expose events, so we can
2355 redraw them. */
2356
2357x_scrollbar_clear (f)
2358 FRAME_PTR f;
2359{
2360 Lisp_Object bar;
2361
2362 for (bar = FRAME_SCROLLBARS (f);
2363 XTYPE (bar) == Lisp_Vector;
2364 bar = XSCROLLBAR (bar)->next)
2365 XClearArea (x_current_display, SCROLLBAR_X_WINDOW (XSCROLLBAR (bar)),
2366 0, 0, 0, 0, True);
2367}
2368
2369
2324 2370
2325/* The main X event-reading loop - XTread_socket. */ 2371/* The main X event-reading loop - XTread_socket. */
2326 2372
@@ -2865,33 +2911,30 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
2865 break; 2911 break;
2866 2912
2867 case ConfigureNotify: 2913 case ConfigureNotify:
2868 { 2914 f = x_window_to_frame (event.xconfigure.window);
2869 int rows, columns; 2915 if (f)
2870 f = x_window_to_frame (event.xconfigure.window); 2916 {
2871 if (!f) 2917 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height);
2872 break; 2918 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width);
2873 2919
2874 columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); 2920 /* Even if the number of character rows and columns has
2875 rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); 2921 not changed, the font size may have changed, so we need
2876 2922 to check the pixel dimensions as well. */
2877 /* Even if the number of character rows and columns has 2923 if (columns != f->width
2878 not changed, the font size may have changed, so we need 2924 || rows != f->height
2879 to check the pixel dimensions as well. */ 2925 || event.xconfigure.width != f->display.x->pixel_width
2880 if (columns != f->width 2926 || event.xconfigure.height != f->display.x->pixel_height)
2881 || rows != f->height 2927 {
2882 || event.xconfigure.width != f->display.x->pixel_width 2928 change_frame_size (f, rows, columns, 0, 1);
2883 || event.xconfigure.height != f->display.x->pixel_height) 2929 SET_FRAME_GARBAGED (f);
2884 { 2930 }
2885 change_frame_size (f, rows, columns, 0, 1);
2886 SET_FRAME_GARBAGED (f);
2887 }
2888 2931
2889 f->display.x->pixel_width = event.xconfigure.width; 2932 f->display.x->pixel_width = event.xconfigure.width;
2890 f->display.x->pixel_height = event.xconfigure.height; 2933 f->display.x->pixel_height = event.xconfigure.height;
2891 f->display.x->left_pos = event.xconfigure.x; 2934 f->display.x->left_pos = event.xconfigure.x;
2892 f->display.x->top_pos = event.xconfigure.y; 2935 f->display.x->top_pos = event.xconfigure.y;
2893 break; 2936 }
2894 } 2937 break;
2895 2938
2896 case ButtonPress: 2939 case ButtonPress:
2897 case ButtonRelease: 2940 case ButtonRelease:
@@ -3153,52 +3196,6 @@ clear_cursor (f)
3153 f->phys_cursor_x = -1; 3196 f->phys_cursor_x = -1;
3154} 3197}
3155 3198
3156static void
3157x_display_bar_cursor (f, on)
3158 struct frame *f;
3159 int on;
3160{
3161 register int phys_x = f->phys_cursor_x;
3162 register int phys_y = f->phys_cursor_y;
3163 register int x1;
3164 register int y1;
3165 register int y2;
3166
3167 if (! FRAME_VISIBLE_P (f) || (! on && f->phys_cursor_x < 0))
3168 return;
3169
3170#ifdef HAVE_X11
3171 if (phys_x >= 0 &&
3172 (!on || phys_x != f->cursor_x || phys_y != f->cursor_y))
3173 {
3174 x1 = CHAR_TO_PIXEL_COL (f, phys_x);
3175 y1 = CHAR_TO_PIXEL_ROW (f, phys_y) - 1;
3176 y2 = y1 + FONT_HEIGHT (f->display.x->font) + 1;
3177
3178 XDrawLine (x_current_display, FRAME_X_WINDOW (f),
3179 f->display.x->reverse_gc, x1, y1, x1, y2);
3180
3181 f->phys_cursor_x = phys_x = -1;
3182 }
3183
3184 if (on && f == x_highlight_frame)
3185 {
3186 x1 = CHAR_TO_PIXEL_COL (f, f->cursor_x);
3187 y1 = CHAR_TO_PIXEL_ROW (f, f->cursor_y) - 1;
3188 y2 = y1 + FONT_HEIGHT (f->display.x->font) + 1;
3189
3190 XDrawLine (x_current_display, FRAME_X_WINDOW (f),
3191 f->display.x->cursor_gc, x1, y1, x1, y2);
3192
3193 f->phys_cursor_x = f->cursor_x;
3194 f->phys_cursor_y = f->cursor_y;
3195 }
3196#else /* ! defined (HAVE_X11) */
3197 Give it up, dude.
3198#endif /* ! defined (HAVE_X11) */
3199}
3200
3201
3202/* Redraw the glyph at ROW, COLUMN on frame F, in the style 3199/* Redraw the glyph at ROW, COLUMN on frame F, in the style
3203 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the 3200 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the
3204 glyph drawn. */ 3201 glyph drawn. */
@@ -3216,17 +3213,19 @@ x_draw_single_glyph (f, row, column, glyph, highlight)
3216 &glyph, 1, highlight, f->display.x->font); 3213 &glyph, 1, highlight, f->display.x->font);
3217} 3214}
3218 3215
3219/* Turn the displayed cursor of frame F on or off according to ON.
3220 If ON is nonzero, where to put the cursor is specified
3221 by F->cursor_x and F->cursor_y. */
3222
3223static void 3216static void
3224x_display_box_cursor (f, on) 3217x_display_bar_cursor (f, on)
3225 struct frame *f; 3218 struct frame *f;
3226 int on; 3219 int on;
3227{ 3220{
3228 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); 3221 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f);
3229 3222
3223 if (! FRAME_VISIBLE_P (f))
3224 return;
3225
3226 if (! on && f->phys_cursor_x < 0)
3227 return;
3228
3230 /* If we're not updating, then we want to use the current frame's 3229 /* If we're not updating, then we want to use the current frame's
3231 cursor position, not our local idea of where the cursor ought to be. */ 3230 cursor position, not our local idea of where the cursor ought to be. */
3232 if (f != updating_frame) 3231 if (f != updating_frame)
@@ -3235,6 +3234,58 @@ x_display_box_cursor (f, on)
3235 curs_y = FRAME_CURSOR_Y (f); 3234 curs_y = FRAME_CURSOR_Y (f);
3236 } 3235 }
3237 3236
3237 /* If there is anything wrong with the current cursor state, remove it. */
3238 if (f->phys_cursor_x >= 0
3239 && (!on
3240 || f->phys_cursor_x != curs_x
3241 || f->phys_cursor_y != curs_y
3242 || f->display.x->current_cursor != bar_cursor))
3243 {
3244 /* Erase the cursor by redrawing the character underneath it. */
3245 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x,
3246 f->phys_cursor_glyph,
3247 current_glyphs->highlight[f->phys_cursor_y]);
3248 f->phys_cursor_x = -1;
3249 }
3250
3251 /* If we now need a cursor in the new place or in the new form, do it so. */
3252 if (on
3253 && (f->phys_cursor_x < 0
3254 || (f->display.x->current_cursor != bar_cursor)))
3255 {
3256 f->phys_cursor_glyph
3257 = ((current_glyphs->enable[curs_y]
3258 && curs_x < current_glyphs->used[curs_y])
3259 ? current_glyphs->glyphs[curs_y][curs_x]
3260 : SPACEGLYPH);
3261 XFillRectangle (x_current_display, FRAME_X_WINDOW (f),
3262 f->display.x->cursor_gc,
3263 CHAR_TO_PIXEL_COL (f, curs_x),
3264 CHAR_TO_PIXEL_ROW (f, curs_y),
3265 1, FONT_HEIGHT (f->display.x->font));
3266
3267 f->phys_cursor_x = curs_x;
3268 f->phys_cursor_y = curs_y;
3269
3270 f->display.x->current_cursor = bar_cursor;
3271 }
3272
3273 if (updating_frame != f)
3274 XFlushQueue ();
3275}
3276
3277
3278/* Turn the displayed cursor of frame F on or off according to ON.
3279 If ON is nonzero, where to put the cursor is specified
3280 by F->cursor_x and F->cursor_y. */
3281
3282static void
3283x_display_box_cursor (f, on)
3284 struct frame *f;
3285 int on;
3286{
3287 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f);
3288
3238 if (! FRAME_VISIBLE_P (f)) 3289 if (! FRAME_VISIBLE_P (f))
3239 return; 3290 return;
3240 3291
@@ -3242,6 +3293,14 @@ x_display_box_cursor (f, on)
3242 if (!on && f->phys_cursor_x < 0) 3293 if (!on && f->phys_cursor_x < 0)
3243 return; 3294 return;
3244 3295
3296 /* If we're not updating, then we want to use the current frame's
3297 cursor position, not our local idea of where the cursor ought to be. */
3298 if (f != updating_frame)
3299 {
3300 curs_x = FRAME_CURSOR_X (f);
3301 curs_y = FRAME_CURSOR_Y (f);
3302 }
3303
3245 /* If cursor is currently being shown and we don't want it to be 3304 /* If cursor is currently being shown and we don't want it to be
3246 or it is in the wrong place, 3305 or it is in the wrong place,
3247 or we want a hollow box and it's not so, (pout!) 3306 or we want a hollow box and it's not so, (pout!)
@@ -3250,7 +3309,7 @@ x_display_box_cursor (f, on)
3250 && (!on 3309 && (!on
3251 || f->phys_cursor_x != curs_x 3310 || f->phys_cursor_x != curs_x
3252 || f->phys_cursor_y != curs_y 3311 || f->phys_cursor_y != curs_y
3253 || (f->display.x->text_cursor_kind != hollow_box_cursor 3312 || (f->display.x->current_cursor != hollow_box_cursor
3254 && (f != x_highlight_frame)))) 3313 && (f != x_highlight_frame))))
3255 { 3314 {
3256 /* Erase the cursor by redrawing the character underneath it. */ 3315 /* Erase the cursor by redrawing the character underneath it. */
@@ -3265,7 +3324,7 @@ x_display_box_cursor (f, on)
3265 write it in the right place. */ 3324 write it in the right place. */
3266 if (on 3325 if (on
3267 && (f->phys_cursor_x < 0 3326 && (f->phys_cursor_x < 0
3268 || (f->display.x->text_cursor_kind != filled_box_cursor 3327 || (f->display.x->current_cursor != filled_box_cursor
3269 && f == x_highlight_frame))) 3328 && f == x_highlight_frame)))
3270 { 3329 {
3271 f->phys_cursor_glyph 3330 f->phys_cursor_glyph
@@ -3276,13 +3335,13 @@ x_display_box_cursor (f, on)
3276 if (f != x_highlight_frame) 3335 if (f != x_highlight_frame)
3277 { 3336 {
3278 x_draw_box (f); 3337 x_draw_box (f);
3279 f->display.x->text_cursor_kind = hollow_box_cursor; 3338 f->display.x->current_cursor = hollow_box_cursor;
3280 } 3339 }
3281 else 3340 else
3282 { 3341 {
3283 x_draw_single_glyph (f, curs_y, curs_x, 3342 x_draw_single_glyph (f, curs_y, curs_x,
3284 f->phys_cursor_glyph, 2); 3343 f->phys_cursor_glyph, 2);
3285 f->display.x->text_cursor_kind = filled_box_cursor; 3344 f->display.x->current_cursor = filled_box_cursor;
3286 } 3345 }
3287 3346
3288 f->phys_cursor_x = curs_x; 3347 f->phys_cursor_x = curs_x;
@@ -3293,16 +3352,17 @@ x_display_box_cursor (f, on)
3293 XFlushQueue (); 3352 XFlushQueue ();
3294} 3353}
3295 3354
3296extern Lisp_Object Vbar_cursor;
3297
3298x_display_cursor (f, on) 3355x_display_cursor (f, on)
3299 struct frame *f; 3356 struct frame *f;
3300 int on; 3357 int on;
3301{ 3358{
3302 if (EQ (Vbar_cursor, Qnil)) 3359 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor)
3303 x_display_box_cursor (f, on); 3360 x_display_box_cursor (f, on);
3304 else 3361 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor)
3305 x_display_bar_cursor (f, on); 3362 x_display_bar_cursor (f, on);
3363 else
3364 /* Those are the only two we have implemented! */
3365 abort ();
3306} 3366}
3307 3367
3308/* Icons. */ 3368/* Icons. */
@@ -3347,8 +3407,7 @@ refreshicon (f)
3347#endif /* ! defined (HAVE_X11) */ 3407#endif /* ! defined (HAVE_X11) */
3348} 3408}
3349 3409
3350/* Make the x-window of frame F use the kitchen-sink icon 3410/* Make the x-window of frame F use the gnu icon bitmap. */
3351 that's a window generated by Emacs. */
3352 3411
3353int 3412int
3354x_bitmap_icon (f) 3413x_bitmap_icon (f)
@@ -3424,12 +3483,6 @@ x_text_icon (f, icon_name)
3424 if (FRAME_X_WINDOW (f) == 0) 3483 if (FRAME_X_WINDOW (f) == 0)
3425 return 1; 3484 return 1;
3426 3485
3427 if (icon_font_info == 0)
3428 icon_font_info
3429 = XGetFont (XGetDefault (XDISPLAY
3430 (char *) XSTRING (invocation_name)->data,
3431 "BodyFont"));
3432
3433#ifdef HAVE_X11 3486#ifdef HAVE_X11
3434 if (icon_name) 3487 if (icon_name)
3435 f->display.x->icon_label = icon_name; 3488 f->display.x->icon_label = icon_name;
@@ -3443,6 +3496,12 @@ x_text_icon (f, icon_name)
3443 f->display.x->icon_bitmap_flag = 0; 3496 f->display.x->icon_bitmap_flag = 0;
3444 x_wm_set_icon_pixmap (f, 0); 3497 x_wm_set_icon_pixmap (f, 0);
3445#else /* ! defined (HAVE_X11) */ 3498#else /* ! defined (HAVE_X11) */
3499 if (icon_font_info == 0)
3500 icon_font_info
3501 = XGetFont (XGetDefault (XDISPLAY
3502 (char *) XSTRING (invocation_name)->data,
3503 "BodyFont"));
3504
3446 if (f->display.x->icon_desc) 3505 if (f->display.x->icon_desc)
3447 { 3506 {
3448 XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f)); 3507 XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f));
@@ -3801,12 +3860,24 @@ x_set_window_size (f, cols, rows)
3801 /* Now, strictly speaking, we can't be sure that this is accurate, 3860 /* Now, strictly speaking, we can't be sure that this is accurate,
3802 but the window manager will get around to dealing with the size 3861 but the window manager will get around to dealing with the size
3803 change request eventually, and we'll hear how it went when the 3862 change request eventually, and we'll hear how it went when the
3804 ConfigureNotify event gets here. */ 3863 ConfigureNotify event gets here.
3864
3865 We could just not bother storing any of this information here,
3866 and let the ConfigureNotify event set everything up, but that
3867 might be kind of confusing to the lisp code, since size changes
3868 wouldn't be reported in the frame parameters until some random
3869 point in the future when the ConfigureNotify event arrives. */
3805 FRAME_WIDTH (f) = cols; 3870 FRAME_WIDTH (f) = cols;
3806 FRAME_HEIGHT (f) = rows; 3871 FRAME_HEIGHT (f) = rows;
3807 PIXEL_WIDTH (f) = pixelwidth; 3872 PIXEL_WIDTH (f) = pixelwidth;
3808 PIXEL_HEIGHT (f) = pixelheight; 3873 PIXEL_HEIGHT (f) = pixelheight;
3809 3874
3875 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
3876 receive in the ConfigureNotify event; if we get what we asked
3877 for, then the event won't cause the screen to become garbaged, so
3878 we have to make sure to do it here. */
3879 SET_FRAME_GARBAGED (f);
3880
3810 XFlushQueue (); 3881 XFlushQueue ();
3811 UNBLOCK_INPUT; 3882 UNBLOCK_INPUT;
3812} 3883}
@@ -3903,6 +3974,18 @@ x_lower_frame (f)
3903 } 3974 }
3904} 3975}
3905 3976
3977static void
3978XTframe_raise_lower (f, raise)
3979 FRAME_PTR f;
3980 int raise;
3981{
3982 if (raise)
3983 x_raise_frame (f);
3984 else
3985 x_lower_frame (f);
3986}
3987
3988
3906/* Change from withdrawn state to mapped state. */ 3989/* Change from withdrawn state to mapped state. */
3907 3990
3908x_make_frame_visible (f) 3991x_make_frame_visible (f)
@@ -4259,8 +4342,13 @@ x_wm_set_icon_pixmap (f, icon_pixmap)
4259{ 4342{
4260 Window window = FRAME_X_WINDOW (f); 4343 Window window = FRAME_X_WINDOW (f);
4261 4344
4262 f->display.x->wm_hints.flags |= IconPixmapHint; 4345 if (icon_pixmap)
4263 f->display.x->wm_hints.icon_pixmap = icon_pixmap ? icon_pixmap : None; 4346 {
4347 f->display.x->wm_hints.icon_pixmap = icon_pixmap;
4348 f->display.x->wm_hints.flags |= IconPixmapHint;
4349 }
4350 else
4351 f->display.x->wm_hints.flags &= ~IconPixmapHint;
4264 4352
4265 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); 4353 XSetWMHints (x_current_display, window, &f->display.x->wm_hints);
4266} 4354}
@@ -4395,6 +4483,7 @@ x_term_init (display_name)
4395 reassert_line_highlight_hook = XTreassert_line_highlight; 4483 reassert_line_highlight_hook = XTreassert_line_highlight;
4396 mouse_position_hook = XTmouse_position; 4484 mouse_position_hook = XTmouse_position;
4397 frame_rehighlight_hook = XTframe_rehighlight; 4485 frame_rehighlight_hook = XTframe_rehighlight;
4486 frame_raise_lower_hook = XTframe_raise_lower;
4398 set_vertical_scrollbar_hook = XTset_vertical_scrollbar; 4487 set_vertical_scrollbar_hook = XTset_vertical_scrollbar;
4399 condemn_scrollbars_hook = XTcondemn_scrollbars; 4488 condemn_scrollbars_hook = XTcondemn_scrollbars;
4400 redeem_scrollbar_hook = XTredeem_scrollbar; 4489 redeem_scrollbar_hook = XTredeem_scrollbar;
diff --git a/src/xterm.h b/src/xterm.h
index 9bf083fa788..025e277a22f 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -239,9 +239,6 @@ enum text_cursor_kinds {
239 filled_box_cursor, hollow_box_cursor, bar_cursor 239 filled_box_cursor, hollow_box_cursor, bar_cursor
240}; 240};
241 241
242#define PIXEL_WIDTH(f) ((f)->display.x->pixel_width)
243#define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height)
244
245/* Each X frame object points to its own struct x_display object 242/* Each X frame object points to its own struct x_display object
246 in the display.x field. The x_display structure contains all 243 in the display.x field. The x_display structure contains all
247 the information that is specific to X windows. */ 244 the information that is specific to X windows. */
@@ -316,9 +313,13 @@ struct x_display
316 /* Flag to set when the X window needs to be completely repainted. */ 313 /* Flag to set when the X window needs to be completely repainted. */
317 int needs_exposure; 314 int needs_exposure;
318 315
319 /* What kind of text cursor is drawn in this window right now? (If 316 /* What kind of text cursor is drawn in this window right now?
320 there is no cursor (phys_cursor_x < 0), then this means nothing. */ 317 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
321 enum text_cursor_kinds text_cursor_kind; 318 enum text_cursor_kinds current_cursor;
319
320 /* What kind of text cursor should we draw in the future?
321 This should always be filled_box_cursor or bar_cursor. */
322 enum text_cursor_kinds desired_cursor;
322 323
323 /* These are the current window manager hints. It seems that 324 /* These are the current window manager hints. It seems that
324 XSetWMHints, when presented with an unset bit in the `flags' 325 XSetWMHints, when presented with an unset bit in the `flags'
@@ -341,6 +342,12 @@ struct x_display
341/* Return the window associated with the frame F. */ 342/* Return the window associated with the frame F. */
342#define FRAME_X_WINDOW(f) ((f)->display.x->window_desc) 343#define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
343 344
345/* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
346#define PIXEL_WIDTH(f) ((f)->display.x->pixel_width)
347#define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height)
348
349#define FRAME_DESIRED_CURSOR(f) ((f)->display.x->desired_cursor)
350
344 351
345/* When X windows are used, a glyf may be a 16 bit unsigned datum. 352/* When X windows are used, a glyf may be a 16 bit unsigned datum.
346 The high order byte is the face number and is used as an index 353 The high order byte is the face number and is used as an index