aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2004-05-31 13:48:26 +0000
committerKaroly Lorentey2004-05-31 13:48:26 +0000
commit190a56d6e02f134591a9d8861b8c4aa55bbec79b (patch)
treed1ea16845ca26efed987116be6e6b4fc6fc60000
parenta596810c6c3c3c2fd450717f5083a5ff5207d243 (diff)
parent64df673db44e48ae6e2f57849f42961a78103075 (diff)
downloademacs-190a56d6e02f134591a9d8861b8c4aa55bbec79b.tar.gz
emacs-190a56d6e02f134591a9d8861b8c4aa55bbec79b.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-356 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-183
-rw-r--r--etc/ChangeLog5
-rw-r--r--etc/NEWS4
-rw-r--r--etc/PROBLEMS12
-rw-r--r--lisp/ChangeLog155
-rw-r--r--lisp/autorevert.el8
-rw-r--r--lisp/dired.el4
-rw-r--r--lisp/dos-fns.el10
-rw-r--r--lisp/emacs-lisp/lisp-mode.el10
-rw-r--r--lisp/files.el31
-rw-r--r--lisp/font-lock.el1
-rw-r--r--lisp/imenu.el4
-rw-r--r--lisp/net/ange-ftp.el7
-rw-r--r--lisp/net/browse-url.el11
-rw-r--r--lisp/net/tramp-smb.el3
-rw-r--r--lisp/net/tramp-uu.el10
-rw-r--r--lisp/net/tramp.el129
-rw-r--r--lisp/progmodes/gdb-ui.el30
-rw-r--r--lisp/replace.el6
-rw-r--r--lisp/subr.el13
-rw-r--r--lisp/thumbs.el283
-rw-r--r--lisp/w32-fns.el10
-rw-r--r--lisp/window.el3
-rw-r--r--lispref/ChangeLog17
-rw-r--r--lispref/files.texi7
-rw-r--r--lispref/loading.texi11
-rw-r--r--lispref/modes.texi5
-rw-r--r--lispref/variables.texi4
-rw-r--r--mac/ChangeLog6
-rw-r--r--mac/INSTALL4
-rw-r--r--mac/README18
-rw-r--r--man/ChangeLog162
-rw-r--r--man/Makefile.in10
-rw-r--r--man/cc-mode.texi126
-rw-r--r--man/cl.texi9
-rw-r--r--man/custom.texi2
-rw-r--r--man/emacs.texi1
-rw-r--r--man/flymake.texi771
-rw-r--r--man/makefile.w32-in14
-rw-r--r--man/trampver.texi2
-rw-r--r--src/ChangeLog89
-rw-r--r--src/alloc.c22
-rw-r--r--src/lisp.h2
-rw-r--r--src/macfns.c391
-rw-r--r--src/macgui.h15
-rw-r--r--src/macmenu.c18
-rw-r--r--src/macterm.c1327
-rw-r--r--src/undo.c22
-rw-r--r--src/xdisp.c6
48 files changed, 2616 insertions, 1194 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog
index faeb5f4f21c..09595de261d 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,8 @@
12004-05-29 Steven Tamm <steventamm@mac.com>
2
3 * PROBLEMS: Document the workaround for the Mac OS X port not
4 picking up the environment variables from dotfiles.
5
12004-05-16 Juri Linkov <juri@jurta.org> 62004-05-16 Juri Linkov <juri@jurta.org>
2 7
3 * TUTORIAL.pt_BR: Add coding: latin-1, sentence-end-double-space: nil. 8 * TUTORIAL.pt_BR: Add coding: latin-1, sentence-end-double-space: nil.
diff --git a/etc/NEWS b/etc/NEWS
index bc0ddefdb9f..07f0f09739a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2042,6 +2042,10 @@ configuration files.
2042 2042
2043* Lisp Changes in Emacs 21.4 2043* Lisp Changes in Emacs 21.4
2044 2044
2045** If the buffer's undo list for the current command gets longer than
2046undo-outer-limit, garbage collection empties it. This is to prevent
2047it from using up the available memory and choking Emacs.
2048
2045** New function quail-find-key returns a list of keys to type in the 2049** New function quail-find-key returns a list of keys to type in the
2046current input method to input a character. 2050current input method to input a character.
2047 2051
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index c3be7f83a7c..abc04f3dd11 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -1,6 +1,18 @@
1This file describes various problems that have been encountered 1This file describes various problems that have been encountered
2in compiling, installing and running GNU Emacs. 2in compiling, installing and running GNU Emacs.
3 3
4* Environment Variables from dotfiles are ignored with Mac OS X (Carbon).
5
6When starting Emacs from the Dock or the Finder on Mac OS X, the
7environment variables that are set up in dotfiles, such as .cshrc or
8.profile, are ignored. This is because the Finder and Dock are not
9started from a shell, but instead from the Window Manager itself.
10
11The workaround for this is to create a .MacOSX/environment.plist file to
12setup these environment variables. These environment variables will
13apply to all processes regardless of where they are started.
14For me information, see http://developer.apple.com/qa/qa2001/qa1067.html.
15
4* Segfault on GNU/Linux using certain recent versions of the Linux kernel. 16* Segfault on GNU/Linux using certain recent versions of the Linux kernel.
5 17
6With certain recent Linux kernels (like the one of Redhat Fedora Core 18With certain recent Linux kernels (like the one of Redhat Fedora Core
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 28f6d394230..bf08d2643f3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,158 @@
12004-05-30 Luc Teirlinck <teirllm@auburn.edu>
2
3 * replace.el (query-replace-interactive): Convert defvar into
4 defcustom.
5
6 * autorevert.el: Update `Commentary' section.
7
82004-05-30 Juanma Barranquero <lektu@terra.es>
9
10 * dos-fns.el (convert-standard-filename):
11 * files.el (convert-standard-filename):
12 * w32-fns.el (convert-standard-filename):
13 Rework docstring (wording by Eli Zaretskii and Kai Grossjohann).
14
152004-05-30 Kai Grossjohann <kai.grossjohann@gmx.net>
16
17 Sync with Tramp.
18
19 * net/tramp.el (tramp-let-maybe): Reverse args of `get'.
20 (tramp-let-maybe): Move to an earlier spot in the file. Patch by
21 Andreas Schwab.
22
232004-05-30 Andreas Schwab <schwab@suse.de>
24
25 * dired.el (dired-get-filename): Don't use dired-re-dot.
26
272004-05-30 Richard M. Stallman <rms@gnu.org>
28
29 * files.el (find-file): Doc fix.
30
31 * font-lock.el (lisp-font-lock-keywords-2): Add multiple-value-bind.
32
332004-05-30 Nick Roberts <nickrob@gnu.org>
34
35 * progmodes/gdb-ui.el (gdb-current-frame, gud-watch)
36 (gdb-locals-mode, gdb-frame-handler): Display current frame in the
37 modeline of the locals buffer.
38 (gdb-goto-breakpoint): Handle gdbmi.
39 (gdb-get-frame-number): Change for gdbmi.
40
412004-05-30 Michael Albinus <michael.albinus@gmx.de>
42
43 * files.el (file-remote-p): Apply file name handler for operation
44 `file-remote-p'. It isn' a property any longer.
45 (file-relative-name): `fh' and `fd' get the required value via
46 `find-file-name-handler' already.
47
48 * ange-ftp.el (ange-ftp-file-remote-p): New defun.
49 (top): Remove setting of `file-remote-p' property for
50 `ange-ftp-hook-function'. Add `ange-ftp' property to
51 `file-remote-p'.
52
532004-05-29 Michael Albinus <michael.albinus@gmx.de>
54
55 Version 2.0.41 of Tramp released.
56
57 * tramp.el (tramp-wait-for-regexp, tramp-wait-for-output): Throw
58 away if process has died. Reported by Luc Teirlinck
59 <teirllm@dms.auburn.edu>.
60 (tramp-out-of-band-prompt-regexp): Renamed to
61 `tramp-process-alive-regexp', because its usage is widen.
62 (tramp-actions-copy-out-of-band): Apply it.
63 (tramp-actions-before-shell, tramp-multi-actions): Add
64 `tramp-action-process-alive' action.
65 (tramp-action-process-alive): New defun.
66 (tramp-file-name-handler-alist, tramp-file-name-for-operation):
67 Add entry for `file-remote-p'.
68 (tramp-handle-file-remote-p): New defun.
69 (top): Remove setting of `file-remote-p'. Don't set
70 `inhibit-file-name-handlers' and `inhibit-file-name-operation'.
71
72 * tramp-smb.el (tramp-smb-file-name-handler-alist): Add entry for
73 `file-remote-p'.
74
75 * tramp-uu.el (tramp-uuencode-region): Padding characters aren't
76 counted for (last) line. Reported by Aaron Ucko
77 <ucko@ncbi.nlm.nih.gov>.
78
792004-05-29 Kai Grossjohann <kai.grossjohann@gmx.net>
80
81 * tramp.el (tramp-initial-commands): Add "unset HISTFILE"; this is
82 not really necessary but seems to keep the shell history smaller
83 in some cases. It is no substitute for setting HISTFILE and
84 HISTSIZE from tramp-open-connection-setup-interactive-shell,
85 though. Suggested by Luc Teirlinck.
86 (tramp-open-connection-setup-interactive-shell): Export variables
87 HISTFILE and HISTSIZE, do not just set them. From Luc Teirlinck.
88 (tramp-set-process-query-on-exit-flag): New compat function.
89 (tramp-open-connection-multi, tramp-open-connection-su)
90 (tramp-open-connection-rsh, tramp-open-connection-telnet)
91 (tramp-do-copy-or-rename-file-out-of-band): Use it.
92 (tramp-let-maybe): New macro, let-binds a variable only if it
93 isn't obsolete.
94 (tramp-check-ls-commands, tramp-handle-expand-file-name)
95 (tramp-handle-file-truename): Use it.
96 (tramp-completion-file-name-regexp-unified): Avoid matching
97 filenames starting with "/:" -- those are reserved for
98 file-name-non-special.
99
100 * tramp-smb.el (tramp-smb-open-connection): Use
101 tramp-set-process-query-on-exit-flag compat function.
102
1032004-05-29 Richard M. Stallman <rms@gnu.org>
104
105 * net/browse-url.el (browse-url-interactive-arg): Doc fix.
106
107 * emacs-lisp/lisp-mode.el (prin1-char): Catch errors from `string'.
108 (eval-last-sexp-print-value): Print char equivalent regardless
109 of standard-output value.
110
111 * thumbs.el (thumbs-subst-char-in-string): Deleted.
112 (thumbs-thumbname): Use subst-char-in-string.
113 (thumbs-resize-image): Use condition-case, not ignore-errors.
114 (thumbs-kill-buffer): Likewise.
115
116 * thumbs.el: Don't include cl. Don't bother with old Emacs versions.
117 (thumbs-mode): Make buffer read-only.
118 (thumbs-make-thumb): Unconditionally accept an existing file.
119 (thumbs-insert-thumb): Add thumb-image-file property to the image.
120 (thumbs-do-thumbs-insertion): Be smarter about where to put newlines.
121 (thumbs-show-thumbs-list): Error if images not supported.
122 (thumbs-save-current-image): Improve prompt string.
123 (thumbs-mode-map): Define u, R, x.
124 (thumbs-unmark): New command.
125 (thumbs-emboss-image): Minor cleanup.
126 (thumbs-forward-char, thumbs-backward-char): Skip chars with no image.
127 (thumbs-rename-images): New command.
128 (thumbs-show-image-num): Rewrite. Don't rename the buffer.
129
130 * thumbs.el (thumbs-current-image): New function.
131 (thumbs-file-list, thumbs-file-alist): New functions.
132 (thumbs-find-image): Delete arg L.
133 Don't set up thumbs-fileL as buffer-local global var.
134 (thumbs-find-image-at-point): Use thumbs-current-image.
135 (thumbs-set-image-at-point-to-root-window): Likewise.
136 (thumbs-delete-images): Use thumbs-current-image, thumbs-file-alist.
137 Record and warn about errors. Update thumbs-markedL for deletions.
138 (thumbs-next-image, thumbs-previous-image): Use thumbs-file-alist.
139 (thumbs-redraw-buffer): Use thumbs-file-list.
140 (thumbs-mark): Use thumbs-current-image.
141 (thumbs-show-name): Use thumbs-current-image.
142
143 * imenu.el (imenu--menubar-select): Set imenu-menubar-modified-tick
144 and imenu--last-menubar-index-alist.
145
146 * subr.el (with-selected-window): Undo previous change.
147
1482004-05-29 John Paul Wallington <jpw@gnu.org>
149
150 * thumbs.el (thumbs-show-name): Do nothing if no image at point.
151 (thumbs-mouse-find-image): New command.
152 (thumbs-mode-map): Bind it to mouse-2.
153 (thumbs-mode): Make mode-class special.
154 (thumbs-view-image-mode): Likewise.
155
12004-05-29 Pavel Kobiakov <pk_at_work@yahoo.com> 1562004-05-29 Pavel Kobiakov <pk_at_work@yahoo.com>
2 157
3 * flymake.el: New file. 158 * flymake.el: New file.
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index 1ba48a54236..7987e880ec1 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -36,8 +36,12 @@
36;; Auto-Revert Mode. Both modes automatically revert buffers 36;; Auto-Revert Mode. Both modes automatically revert buffers
37;; whenever the corresponding files have been changed on disk. 37;; whenever the corresponding files have been changed on disk.
38;; 38;;
39;; Auto-Revert Mode can be activated for individual buffers. 39;; Auto-Revert Mode can be activated for individual buffers. Global
40;; Global Auto-Revert Mode applies to all file buffers. 40;; Auto-Revert Mode applies to all file buffers. (If the user option
41;; `global-auto-revert-non-file-buffers' is non-nil, it also applies
42;; to some non-file buffers. This option is disabled by default.)
43;; Since checking a remote file is too slow, these modes do not check
44;; or revert remote files.
41;; 45;;
42;; Both modes operate by checking the time stamp of all files at 46;; Both modes operate by checking the time stamp of all files at
43;; intervals of `auto-revert-interval'. The default is every five 47;; intervals of `auto-revert-interval'. The default is every five
diff --git a/lisp/dired.el b/lisp/dired.el
index 8bdfe1befce..3d4491cc819 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1634,9 +1634,7 @@ Otherwise, an error occurs in these cases."
1634 ((eq localp 'verbatim) 1634 ((eq localp 'verbatim)
1635 file) 1635 file)
1636 ((and (not no-error-if-not-filep) 1636 ((and (not no-error-if-not-filep)
1637 (save-excursion 1637 (member file '("." "..")))
1638 (beginning-of-line)
1639 (looking-at dired-re-dot)))
1640 (error "Cannot operate on `.' or `..'")) 1638 (error "Cannot operate on `.' or `..'"))
1641 ((and (eq localp 'no-dir) already-absolute) 1639 ((and (eq localp 'no-dir) already-absolute)
1642 (file-name-nondirectory file)) 1640 (file-name-nondirectory file))
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index 65b6c0063c0..1253b7b5811 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -31,9 +31,13 @@
31;; This overrides a trivial definition in files.el. 31;; This overrides a trivial definition in files.el.
32(defun convert-standard-filename (filename) 32(defun convert-standard-filename (filename)
33 "Convert a standard file's name to something suitable for the current OS. 33 "Convert a standard file's name to something suitable for the current OS.
34This function's standard definition is trivial; it just returns the argument. 34This means to guarantee valid names and perhaps to canonicalize
35However, on some systems, the function is redefined 35certain patterns.
36with a definition that really does change some file names." 36
37On Windows and DOS, replace invalid characters. On DOS, make
38sure to obey the 8.3 limitations. On Windows, turn Cygwin names
39into native names, and also turn slashes into backslashes if the
40shell requires it (see `w32-shell-dos-semantics')."
37 (if (or (not (stringp filename)) 41 (if (or (not (stringp filename))
38 ;; This catches the case where FILENAME is "x:" or "x:/" or 42 ;; This catches the case where FILENAME is "x:" or "x:/" or
39 ;; "/", thus preventing infinite recursion. 43 ;; "/", thus preventing infinite recursion.
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 1f53d9e630f..d6ac05642ba 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -470,7 +470,10 @@ If CHAR is not a character, return nil."
470 (cond 470 (cond
471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) 471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c))
472 ((eq c 127) "\\C-?") 472 ((eq c 127) "\\C-?")
473 (t (string c))))))) 473 (t
474 (condition-case nil
475 (string c)
476 (error nil))))))))
474 477
475(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) 478(defun eval-last-sexp-1 (eval-last-sexp-arg-internal)
476 "Evaluate sexp before point; print value in minibuffer. 479 "Evaluate sexp before point; print value in minibuffer.
@@ -538,9 +541,8 @@ With argument, print output into current buffer."
538 end) 541 end)
539 (prog1 542 (prog1
540 (prin1 value) 543 (prin1 value)
541 (if (eq standard-output t) 544 (let ((str (eval-expression-print-format value)))
542 (let ((str (eval-expression-print-format value))) 545 (if str (princ str)))
543 (if str (princ str))))
544 (setq end (point)) 546 (setq end (point))
545 (when (and (bufferp standard-output) 547 (when (and (bufferp standard-output)
546 (or (not (null print-length)) 548 (or (not (null print-length))
diff --git a/lisp/files.el b/lisp/files.el
index 27e0ded28e2..81e014d2283 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -481,10 +481,15 @@ Runs the usual ange-ftp hook, but only for completion operations."
481 481
482(defun convert-standard-filename (filename) 482(defun convert-standard-filename (filename)
483 "Convert a standard file's name to something suitable for the current OS. 483 "Convert a standard file's name to something suitable for the current OS.
484This function's standard definition is trivial; it just returns the argument. 484This means to guarantee valid names and perhaps to canonicalize
485However, on some systems, the function is redefined with a definition 485certain patterns.
486that really does change some file names to canonicalize certain 486
487patterns and to guarantee valid names." 487This function's standard definition is trivial; it just returns
488the argument. However, on Windows and DOS, replace invalid
489characters. On DOS, make sure to obey the 8.3 limitations. On
490Windows, turn Cygwin names into native names, and also turn
491slashes into backslashes if the shell requires it (see
492`w32-shell-dos-semantics')."
488 filename) 493 filename)
489 494
490(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial) 495(defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
@@ -642,9 +647,10 @@ This is an interface to the function `load'."
642 647
643(defun file-remote-p (file) 648(defun file-remote-p (file)
644 "Test whether FILE specifies a location on a remote system." 649 "Test whether FILE specifies a location on a remote system."
645 (let ((handler (find-file-name-handler file 'file-local-copy))) 650 (let ((handler (find-file-name-handler file 'file-remote-p)))
646 (if handler 651 (if handler
647 (get handler 'file-remote-p)))) 652 (funcall handler 'file-remote-p file)
653 nil)))
648 654
649(defun file-local-copy (file) 655(defun file-local-copy (file)
650 "Copy the file FILE into a temporary file on this machine. 656 "Copy the file FILE into a temporary file on this machine.
@@ -905,8 +911,11 @@ but the visited file name is available through the minibuffer history:
905type M-n to pull it into the minibuffer. 911type M-n to pull it into the minibuffer.
906 912
907Interactively, or if WILDCARDS is non-nil in a call from Lisp, 913Interactively, or if WILDCARDS is non-nil in a call from Lisp,
908expand wildcards (if any) and visit multiple files. Wildcard expansion 914expand wildcards (if any) and visit multiple files. You can
909can be suppressed by setting `find-file-wildcards'." 915suppress wildcard expansion by setting `find-file-wildcards'.
916
917To visit a file without any kind of conversion and without
918automatically choosing a major mode, use \\[find-file-literally]."
910 (interactive 919 (interactive
911 (find-file-read-args "Find file: " nil)) 920 (find-file-read-args "Find file: " nil))
912 (let ((value (find-file-noselect filename nil nil wildcards))) 921 (let ((value (find-file-noselect filename nil nil wildcards)))
@@ -2903,10 +2912,8 @@ on a DOS/Windows machine, it returns FILENAME on expanded form."
2903 (file-name-as-directory (expand-file-name (or directory 2912 (file-name-as-directory (expand-file-name (or directory
2904 default-directory)))) 2913 default-directory))))
2905 (setq filename (expand-file-name filename)) 2914 (setq filename (expand-file-name filename))
2906 (let ((hf (find-file-name-handler filename 'file-local-copy)) 2915 (let ((hf (find-file-name-handler filename 'file-remote-p))
2907 (hd (find-file-name-handler directory 'file-local-copy))) 2916 (hd (find-file-name-handler directory 'file-remote-p)))
2908 (when (and hf (not (get hf 'file-remote-p))) (setq hf nil))
2909 (when (and hd (not (get hd 'file-remote-p))) (setq hd nil))
2910 (if ;; Conditions for separate trees 2917 (if ;; Conditions for separate trees
2911 (or 2918 (or
2912 ;; Test for different drives on DOS/Windows 2919 ;; Test for different drives on DOS/Windows
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 96caba543c7..89e403f7502 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1910,6 +1910,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
1910 "proclaim" "declaim" "declare" "symbol-macrolet" 1910 "proclaim" "declaim" "declare" "symbol-macrolet"
1911 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let" 1911 "lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
1912 "destructuring-bind" "macrolet" "tagbody" "block" 1912 "destructuring-bind" "macrolet" "tagbody" "block"
1913 "multiple-value-bind"
1913 "return" "return-from" 1914 "return" "return-from"
1914 "with-accessors" "with-compilation-unit" 1915 "with-accessors" "with-compilation-unit"
1915 "with-condition-restarts" "with-hash-table-iterator" 1916 "with-condition-restarts" "with-hash-table-iterator"
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 42f50fba3a4..e0b57440fd8 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -890,6 +890,7 @@ Returns t for rescan and otherwise a position number."
890 (setq name (completing-read prompt 890 (setq name (completing-read prompt
891 prepared-index-alist 891 prepared-index-alist
892 nil t nil 'imenu--history-list name))) 892 nil t nil 'imenu--history-list name)))
893
893 (cond ((not (stringp name)) nil) 894 (cond ((not (stringp name)) nil)
894 ((string= name (car imenu--rescan-item)) t) 895 ((string= name (car imenu--rescan-item)) t)
895 (t 896 (t
@@ -1015,7 +1016,10 @@ This value becomes local in every buffer when it is set.")
1015 (if (equal item imenu--rescan-item) 1016 (if (equal item imenu--rescan-item)
1016 (progn 1017 (progn
1017 (imenu--cleanup) 1018 (imenu--cleanup)
1019 ;; Make sure imenu-update-menubar redoes everything.
1020 (setq imenu-menubar-modified-tick -1)
1018 (setq imenu--index-alist nil) 1021 (setq imenu--index-alist nil)
1022 (setq imenu--last-menubar-index-alist nil)
1019 (imenu-update-menubar) 1023 (imenu-update-menubar)
1020 t) 1024 t)
1021 (imenu item) 1025 (imenu item)
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 8e1068a5bed..09448e87329 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4116,6 +4116,9 @@ directory, so that Emacs will know its current contents."
4116 (format "Getting %s" fn1)) 4116 (format "Getting %s" fn1))
4117 tmp1)))) 4117 tmp1))))
4118 4118
4119(defun ange-ftp-file-remote-p (file)
4120 (when (ange-ftp-ftp-name file) t))
4121
4119(defun ange-ftp-load (file &optional noerror nomessage nosuffix) 4122(defun ange-ftp-load (file &optional noerror nomessage nosuffix)
4120 (if (ange-ftp-ftp-name file) 4123 (if (ange-ftp-ftp-name file)
4121 (let ((tryfiles (if nosuffix 4124 (let ((tryfiles (if nosuffix
@@ -4257,9 +4260,6 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4257 (let ((fn (get operation 'ange-ftp))) 4260 (let ((fn (get operation 'ange-ftp)))
4258 (if fn (save-match-data (apply fn args)) 4261 (if fn (save-match-data (apply fn args))
4259 (ange-ftp-run-real-handler operation args)))) 4262 (ange-ftp-run-real-handler operation args))))
4260;;;###autoload
4261;;; These file names are remote file names.
4262(put 'ange-ftp-hook-function 'file-remote-p t)
4263 4263
4264;; The following code is commented out because Tramp now deals with 4264;; The following code is commented out because Tramp now deals with
4265;; Ange-FTP filenames, too. 4265;; Ange-FTP filenames, too.
@@ -4327,6 +4327,7 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4327(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion) 4327(put 'file-name-completion 'ange-ftp 'ange-ftp-file-name-completion)
4328(put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory) 4328(put 'insert-directory 'ange-ftp 'ange-ftp-insert-directory)
4329(put 'file-local-copy 'ange-ftp 'ange-ftp-file-local-copy) 4329(put 'file-local-copy 'ange-ftp 'ange-ftp-file-local-copy)
4330(put 'file-remote-p 'ange-ftp 'ange-ftp-file-remote-p)
4330(put 'unhandled-file-name-directory 'ange-ftp 4331(put 'unhandled-file-name-directory 'ange-ftp
4331 'ange-ftp-unhandled-file-name-directory) 4332 'ange-ftp-unhandled-file-name-directory)
4332(put 'file-name-sans-versions 'ange-ftp 'ange-ftp-file-name-sans-versions) 4333(put 'file-name-sans-versions 'ange-ftp 'ange-ftp-file-name-sans-versions)
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index e98b3d815ab..1dbd97f0073 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -578,11 +578,12 @@ down (this *won't* always work)."
578(defun browse-url-interactive-arg (prompt) 578(defun browse-url-interactive-arg (prompt)
579 "Read a URL from the minibuffer, prompting with PROMPT. 579 "Read a URL from the minibuffer, prompting with PROMPT.
580If `transient-mark-mode' is non-nil and the mark is active, 580If `transient-mark-mode' is non-nil and the mark is active,
581defaults to the current region, else to the URL at or before 581it defaults to the current region, else to the URL at or before
582point. If invoked with a mouse button, set point to the 582point. If invoked with a mouse button, it moves point to the
583position clicked first. Return a list for use in `interactive' 583position clicked before acting.
584containing the URL and `browse-url-new-window-flag' or its 584
585negation if a prefix argument was given." 585This function returns a list (URL NEW-WINDOW-FLAG)
586for use in `interactive'."
586 (let ((event (elt (this-command-keys) 0))) 587 (let ((event (elt (this-command-keys) 0)))
587 (and (listp event) (mouse-set-point event))) 588 (and (listp event) (mouse-set-point event)))
588 (list (read-string prompt (or (and transient-mark-mode mark-active 589 (list (read-string prompt (or (and transient-mark-mode mark-active
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 781814a9d55..cca01d169b6 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -144,6 +144,7 @@ This variable is local to each buffer.")
144 (file-executable-p . tramp-smb-handle-file-exists-p) 144 (file-executable-p . tramp-smb-handle-file-exists-p)
145 (file-exists-p . tramp-smb-handle-file-exists-p) 145 (file-exists-p . tramp-smb-handle-file-exists-p)
146 (file-local-copy . tramp-smb-handle-file-local-copy) 146 (file-local-copy . tramp-smb-handle-file-local-copy)
147 (file-remote-p . tramp-handle-file-remote-p)
147 (file-modes . tramp-handle-file-modes) 148 (file-modes . tramp-handle-file-modes)
148 (file-name-all-completions . tramp-smb-handle-file-name-all-completions) 149 (file-name-all-completions . tramp-smb-handle-file-name-all-completions)
149 ;; `file-name-as-directory' performed by default handler 150 ;; `file-name-as-directory' performed by default handler
@@ -1003,7 +1004,7 @@ Domain names in USER and port numbers in HOST are acknowledged."
1003 tramp-smb-program args))) 1004 tramp-smb-program args)))
1004 1005
1005 (tramp-message 9 "Started process %s" (process-command p)) 1006 (tramp-message 9 "Started process %s" (process-command p))
1006 (process-kill-without-query p) 1007 (tramp-set-process-query-on-exit-flag p nil)
1007 (set-buffer buffer) 1008 (set-buffer buffer)
1008 (setq tramp-smb-share share) 1009 (setq tramp-smb-share share)
1009 1010
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 1047e62a3cb..d18af101c48 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,7 +1,7 @@
1;;; -*- coding: iso-2022-7bit; -*- 1;;; -*- coding: iso-2022-7bit; -*-
2;;; tramp-uu.el --- uuencode in Lisp 2;;; tramp-uu.el --- uuencode in Lisp
3 3
4;; Copyright (C) 2002 Free Software Foundation, Inc. 4;; Copyright (C) 2002, 2004 Free Software Foundation, Inc.
5 5
6;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> 6;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
7;; Keywords: comm, terminals 7;; Keywords: comm, terminals
@@ -63,10 +63,10 @@
63 (setq c (char-after (point))) 63 (setq c (char-after (point)))
64 (delete-char 1) 64 (delete-char 1)
65 (if (equal c ?=) 65 (if (equal c ?=)
66 ;; "=" means padding. Insert "`" instead. 66 ;; "=" means padding. Insert "`" instead. Not counted for length.
67 (insert "`") 67 (progn (insert "`") (setq len (1- len)))
68 (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c)))) 68 (insert (tramp-uu-byte-to-uu-char (tramp-uu-b64-char-to-byte c)))
69 (setq i (1+ i)) 69 (setq i (1+ i)))
70 ;; Every 60 characters, add "M" at beginning of line (as 70 ;; Every 60 characters, add "M" at beginning of line (as
71 ;; length byte) and insert a newline. 71 ;; length byte) and insert a newline.
72 (when (zerop (% i 60)) 72 (when (zerop (% i 60))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0fd955b27bc..769ad3f51f6 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -911,12 +911,13 @@ The answer will be provided by `tramp-action-terminal', which see."
911 :group 'tramp 911 :group 'tramp
912 :type 'regexp) 912 :type 'regexp)
913 913
914(defcustom tramp-out-of-band-prompt-regexp 914(defcustom tramp-process-alive-regexp
915 "" 915 ""
916 "Regular expression indicating an out-of-band copy has finished. 916 "Regular expression indicating a process has finished.
917In fact this expression is empty by intention, it will be used only to 917In fact this expression is empty by intention, it will be used only to
918check regularly the status of the associated process. 918check regularly the status of the associated process.
919The answer will be provided by `tramp-action-out-of-band', which see." 919The answer will be provided by `tramp-action-process-alive' and
920`tramp-action-out-of-band', which see."
920 :group 'tramp 921 :group 'tramp
921 :type 'regexp) 922 :type 'regexp)
922 923
@@ -1146,7 +1147,7 @@ Also see `tramp-file-name-structure'."
1146 1147
1147;;;###autoload 1148;;;###autoload
1148(defconst tramp-completion-file-name-regexp-unified 1149(defconst tramp-completion-file-name-regexp-unified
1149 "^/[^/]*$" 1150 "^/$\\|^/[^/:][^/]*$"
1150 "Value for `tramp-completion-file-name-regexp' for unified remoting. 1151 "Value for `tramp-completion-file-name-regexp' for unified remoting.
1151Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and 1152Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
1152Tramp. See `tramp-file-name-structure-unified' for more explanations.") 1153Tramp. See `tramp-file-name-structure-unified' for more explanations.")
@@ -1288,7 +1289,8 @@ but it might be slow on large directories."
1288 (tramp-wrong-passwd-regexp tramp-action-permission-denied) 1289 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
1289 (tramp-yesno-prompt-regexp tramp-action-yesno) 1290 (tramp-yesno-prompt-regexp tramp-action-yesno)
1290 (tramp-yn-prompt-regexp tramp-action-yn) 1291 (tramp-yn-prompt-regexp tramp-action-yn)
1291 (tramp-terminal-prompt-regexp tramp-action-terminal)) 1292 (tramp-terminal-prompt-regexp tramp-action-terminal)
1293 (tramp-process-alive-regexp tramp-action-process-alive))
1292 "List of pattern/action pairs. 1294 "List of pattern/action pairs.
1293Whenever a pattern matches, the corresponding action is performed. 1295Whenever a pattern matches, the corresponding action is performed.
1294Each item looks like (PATTERN ACTION). 1296Each item looks like (PATTERN ACTION).
@@ -1306,7 +1308,7 @@ corresponding PATTERN matches, the ACTION function is called."
1306(defcustom tramp-actions-copy-out-of-band 1308(defcustom tramp-actions-copy-out-of-band
1307 '((tramp-password-prompt-regexp tramp-action-password) 1309 '((tramp-password-prompt-regexp tramp-action-password)
1308 (tramp-wrong-passwd-regexp tramp-action-permission-denied) 1310 (tramp-wrong-passwd-regexp tramp-action-permission-denied)
1309 (tramp-out-of-band-prompt-regexp tramp-action-out-of-band)) 1311 (tramp-process-alive-regexp tramp-action-out-of-band))
1310 "List of pattern/action pairs. 1312 "List of pattern/action pairs.
1311This list is used for copying/renaming with out-of-band methods. 1313This list is used for copying/renaming with out-of-band methods.
1312See `tramp-actions-before-shell' for more info." 1314See `tramp-actions-before-shell' for more info."
@@ -1318,7 +1320,8 @@ See `tramp-actions-before-shell' for more info."
1318 (tramp-login-prompt-regexp tramp-multi-action-login) 1320 (tramp-login-prompt-regexp tramp-multi-action-login)
1319 (shell-prompt-pattern tramp-multi-action-succeed) 1321 (shell-prompt-pattern tramp-multi-action-succeed)
1320 (tramp-shell-prompt-pattern tramp-multi-action-succeed) 1322 (tramp-shell-prompt-pattern tramp-multi-action-succeed)
1321 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)) 1323 (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied)
1324 (tramp-process-alive-regexp tramp-action-process-alive))
1322 "List of pattern/action pairs. 1325 "List of pattern/action pairs.
1323This list is used for each hop in multi-hop connections. 1326This list is used for each hop in multi-hop connections.
1324See `tramp-actions-before-shell' for more info." 1327See `tramp-actions-before-shell' for more info."
@@ -1326,7 +1329,8 @@ See `tramp-actions-before-shell' for more info."
1326 :type '(repeat (list variable function))) 1329 :type '(repeat (list variable function)))
1327 1330
1328(defcustom tramp-initial-commands 1331(defcustom tramp-initial-commands
1329 '("unset correct" 1332 '("unset HISTORY"
1333 "unset correct"
1330 "unset autocorrect") 1334 "unset autocorrect")
1331 "List of commands to send to the first remote shell that we see. 1335 "List of commands to send to the first remote shell that we see.
1332These commands will be sent to any shell, and thus they should be 1336These commands will be sent to any shell, and thus they should be
@@ -1768,6 +1772,7 @@ on the FILENAME argument, even if VISIT was a string.")
1768 (insert-directory . tramp-handle-insert-directory) 1772 (insert-directory . tramp-handle-insert-directory)
1769 (expand-file-name . tramp-handle-expand-file-name) 1773 (expand-file-name . tramp-handle-expand-file-name)
1770 (file-local-copy . tramp-handle-file-local-copy) 1774 (file-local-copy . tramp-handle-file-local-copy)
1775 (file-remote-p . tramp-handle-file-remote-p)
1771 (insert-file-contents . tramp-handle-insert-file-contents) 1776 (insert-file-contents . tramp-handle-insert-file-contents)
1772 (write-region . tramp-handle-write-region) 1777 (write-region . tramp-handle-write-region)
1773 (find-backup-file-name . tramp-handle-find-backup-file-name) 1778 (find-backup-file-name . tramp-handle-find-backup-file-name)
@@ -1880,6 +1885,16 @@ If VAR is nil, then we bind `v' to the structure and `multi-method',
1880;; To be activated for debugging containing this macro 1885;; To be activated for debugging containing this macro
1881(def-edebug-spec with-parsed-tramp-file-name t) 1886(def-edebug-spec with-parsed-tramp-file-name t)
1882 1887
1888(defmacro tramp-let-maybe (variable value &rest body)
1889 "Let-bind VARIABLE to VALUE in BODY, but only if VARIABLE is not obsolete.
1890BODY is executed whether or not the variable is obsolete.
1891The intent is to protect against `obsolete variable' warnings."
1892 `(if (get ',variable 'byte-obsolete-variable)
1893 (progn ,@body)
1894 (let ((,variable ,value))
1895 ,@body)))
1896(put 'tramp-let-maybe 'lisp-indent-function 2)
1897
1883;;; Config Manipulation Functions: 1898;;; Config Manipulation Functions:
1884 1899
1885(defun tramp-set-completion-function (method function-list) 1900(defun tramp-set-completion-function (method function-list)
@@ -2042,8 +2057,8 @@ target of the symlink differ."
2042 "Like `file-truename' for tramp files." 2057 "Like `file-truename' for tramp files."
2043 (with-parsed-tramp-file-name filename nil 2058 (with-parsed-tramp-file-name filename nil
2044 (let* ((steps (tramp-split-string localname "/")) 2059 (let* ((steps (tramp-split-string localname "/"))
2045 (localnamedir (let ((directory-sep-char ?/)) 2060 (localnamedir (tramp-let-maybe directory-sep-char ?/ ;for XEmacs
2046 (file-name-as-directory localname))) 2061 (file-name-as-directory localname)))
2047 (is-dir (string= localname localnamedir)) 2062 (is-dir (string= localname localnamedir))
2048 (thisstep nil) 2063 (thisstep nil)
2049 (numchase 0) 2064 (numchase 0)
@@ -2984,7 +2999,7 @@ be a local filename. The method used must be an out-of-band method."
2984 ;; Use rcp-like program for file transfer. 2999 ;; Use rcp-like program for file transfer.
2985 (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf 3000 (let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
2986 copy-program copy-args))) 3001 copy-program copy-args)))
2987 (process-kill-without-query p) 3002 (tramp-set-process-query-on-exit-flag p nil)
2988 (tramp-process-actions p multi-method method user host 3003 (tramp-process-actions p multi-method method user host
2989 tramp-actions-copy-out-of-band)) 3004 tramp-actions-copy-out-of-band))
2990 (kill-buffer trampbuf) 3005 (kill-buffer trampbuf)
@@ -3297,7 +3312,7 @@ the result will be a local, non-Tramp, filename."
3297 ;; expand-file-name (this does "/./" and "/../"). We bind 3312 ;; expand-file-name (this does "/./" and "/../"). We bind
3298 ;; directory-sep-char here for XEmacs on Windows, which 3313 ;; directory-sep-char here for XEmacs on Windows, which
3299 ;; would otherwise use backslash. 3314 ;; would otherwise use backslash.
3300 (let ((directory-sep-char ?/)) 3315 (tramp-let-maybe directory-sep-char ?/
3301 (tramp-make-tramp-file-name 3316 (tramp-make-tramp-file-name
3302 multi-method (or method (tramp-find-default-method user host)) 3317 multi-method (or method (tramp-find-default-method user host))
3303 user host 3318 user host
@@ -3525,6 +3540,9 @@ This will break if COMMAND prints a newline, followed by the value of
3525 (t (error "Wrong method specification for `%s'" method))) 3540 (t (error "Wrong method specification for `%s'" method)))
3526 tmpfil))) 3541 tmpfil)))
3527 3542
3543(defun tramp-handle-file-remote-p (filename)
3544 "Like `file-remote-p' for tramp files."
3545 (when (tramp-tramp-file-p filename) t))
3528 3546
3529(defun tramp-handle-insert-file-contents 3547(defun tramp-handle-insert-file-contents
3530 (filename &optional visit beg end replace) 3548 (filename &optional visit beg end replace)
@@ -3845,10 +3863,10 @@ pass to the OPERATION."
3845 3863
3846;; We handle here all file primitives. Most of them have the file 3864;; We handle here all file primitives. Most of them have the file
3847;; name as first parameter; nevertheless we check for them explicitly 3865;; name as first parameter; nevertheless we check for them explicitly
3848;; in order to be be signalled if a new primitive appears. This 3866;; in order to be signalled if a new primitive appears. This
3849;; scenario is needed because there isn't a way to decide by 3867;; scenario is needed because there isn't a way to decide by
3850;; syntactical means whether a foreign method must be called. It would 3868;; syntactical means whether a foreign method must be called. It would
3851;; ease the live if `file-name-handler-alist' would support a decision 3869;; ease the life if `file-name-handler-alist' would support a decision
3852;; function as well but regexp only. 3870;; function as well but regexp only.
3853(defun tramp-file-name-for-operation (operation &rest args) 3871(defun tramp-file-name-for-operation (operation &rest args)
3854 "Return file name related to OPERATION file primitive. 3872 "Return file name related to OPERATION file primitive.
@@ -3862,16 +3880,16 @@ ARGS are the arguments OPERATION has been called with."
3862 'dired-compress-file 'dired-uncache 3880 'dired-compress-file 'dired-uncache
3863 'file-accessible-directory-p 'file-attributes 3881 'file-accessible-directory-p 'file-attributes
3864 'file-directory-p 'file-executable-p 'file-exists-p 3882 'file-directory-p 'file-executable-p 'file-exists-p
3865 'file-local-copy 'file-modes 'file-name-as-directory 3883 'file-local-copy 'file-remote-p 'file-modes
3866 'file-name-directory 'file-name-nondirectory 3884 'file-name-as-directory 'file-name-directory
3867 'file-name-sans-versions 'file-ownership-preserved-p 3885 'file-name-nondirectory 'file-name-sans-versions
3868 'file-readable-p 'file-regular-p 'file-symlink-p 3886 'file-ownership-preserved-p 'file-readable-p
3869 'file-truename 'file-writable-p 'find-backup-file-name 3887 'file-regular-p 'file-symlink-p 'file-truename
3870 'find-file-noselect 'get-file-buffer 'insert-directory 3888 'file-writable-p 'find-backup-file-name 'find-file-noselect
3871 'insert-file-contents 'load 'make-directory 3889 'get-file-buffer 'insert-directory 'insert-file-contents
3872 'make-directory-internal 'set-file-modes 3890 'load 'make-directory 'make-directory-internal
3873 'substitute-in-file-name 'unhandled-file-name-directory 3891 'set-file-modes 'substitute-in-file-name
3874 'vc-registered 3892 'unhandled-file-name-directory 'vc-registered
3875 ; XEmacs only 3893 ; XEmacs only
3876 'abbreviate-file-name 'create-file-buffer 3894 'abbreviate-file-name 'create-file-buffer
3877 'dired-file-modtime 'dired-make-compressed-filename 3895 'dired-file-modtime 'dired-make-compressed-filename
@@ -3940,9 +3958,6 @@ Falls back to normal file name handler if no tramp file name handler exists."
3940 (foreign (apply foreign operation args)) 3958 (foreign (apply foreign operation args))
3941 (t (tramp-run-real-handler operation args)))))) 3959 (t (tramp-run-real-handler operation args))))))
3942 3960
3943;;;###autoload
3944(put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p
3945
3946(defun tramp-sh-file-name-handler (operation &rest args) 3961(defun tramp-sh-file-name-handler (operation &rest args)
3947 "Invoke remote-shell Tramp file name handler. 3962 "Invoke remote-shell Tramp file name handler.
3948Fall back to normal file name handler if no Tramp handler exists." 3963Fall back to normal file name handler if no Tramp handler exists."
@@ -4887,16 +4902,16 @@ otherwise."
4887 "Checks whether the given `ls' executable in one of the dirs groks `-n'. 4902 "Checks whether the given `ls' executable in one of the dirs groks `-n'.
4888Returns nil if none was found, else the command is returned." 4903Returns nil if none was found, else the command is returned."
4889 (let ((dl dirlist) 4904 (let ((dl dirlist)
4890 (result nil) 4905 (result nil))
4891 (directory-sep-char ?/)) ;for XEmacs 4906 (tramp-let-maybe directory-sep-char ?/ ;for XEmacs
4892 ;; It would be better to use the CL function `find', but 4907 ;; It would be better to use the CL function `find', but
4893 ;; we don't want run-time dependencies on CL. 4908 ;; we don't want run-time dependencies on CL.
4894 (while (and dl (not result)) 4909 (while (and dl (not result))
4895 (let ((x (concat (file-name-as-directory (car dl)) cmd))) 4910 (let ((x (concat (file-name-as-directory (car dl)) cmd)))
4896 (when (tramp-check-ls-command multi-method method user host x) 4911 (when (tramp-check-ls-command multi-method method user host x)
4897 (setq result x))) 4912 (setq result x)))
4898 (setq dl (cdr dl))) 4913 (setq dl (cdr dl)))
4899 result)) 4914 result)))
4900 4915
4901(defun tramp-find-ls-command (multi-method method user host) 4916(defun tramp-find-ls-command (multi-method method user host)
4902 "Finds an `ls' command which groks the `-n' option, returning nil if failed. 4917 "Finds an `ls' command which groks the `-n' option, returning nil if failed.
@@ -4976,6 +4991,11 @@ The terminal type can be configured with `tramp-terminal-type'."
4976 (process-send-string nil (concat tramp-terminal-type 4991 (process-send-string nil (concat tramp-terminal-type
4977 tramp-rsh-end-of-line))) 4992 tramp-rsh-end-of-line)))
4978 4993
4994(defun tramp-action-process-alive (p multi-method method user host)
4995 "Check whether a process has finished."
4996 (unless (memq (process-status p) '(run open))
4997 (throw 'tramp-action 'process-died)))
4998
4979(defun tramp-action-out-of-band (p multi-method method user host) 4999(defun tramp-action-out-of-band (p multi-method method user host)
4980 "Check whether an out-of-band copy has finished." 5000 "Check whether an out-of-band copy has finished."
4981 (cond ((and (memq (process-status p) '(stop exit)) 5001 (cond ((and (memq (process-status p) '(stop exit))
@@ -5165,7 +5185,7 @@ Maybe the different regular expressions need to be tuned.
5165 user host 'tramp-login-args))) 5185 user host 'tramp-login-args)))
5166 (found nil) 5186 (found nil)
5167 (pw nil)) 5187 (pw nil))
5168 (process-kill-without-query p) 5188 (tramp-set-process-query-on-exit-flag p nil)
5169 (set-buffer (tramp-get-buffer multi-method method user host)) 5189 (set-buffer (tramp-get-buffer multi-method method user host))
5170 (erase-buffer) 5190 (erase-buffer)
5171 (tramp-process-actions p multi-method method user host 5191 (tramp-process-actions p multi-method method user host
@@ -5232,7 +5252,7 @@ arguments, and xx will be used as the host name to connect to.
5232 (apply #'start-process bufnam buf login-program 5252 (apply #'start-process bufnam buf login-program
5233 host login-args))) 5253 host login-args)))
5234 (found nil)) 5254 (found nil))
5235 (process-kill-without-query p) 5255 (tramp-set-process-query-on-exit-flag p nil)
5236 5256
5237 (set-buffer buf) 5257 (set-buffer buf)
5238 (tramp-process-actions p multi-method method user host 5258 (tramp-process-actions p multi-method method user host
@@ -5293,7 +5313,7 @@ prompt than you do, so it is not at all unlikely that the variable
5293 user host 'tramp-login-args)))) 5313 user host 'tramp-login-args))))
5294 (found nil) 5314 (found nil)
5295 (pw nil)) 5315 (pw nil))
5296 (process-kill-without-query p) 5316 (tramp-set-process-query-on-exit-flag p nil)
5297 (set-buffer (tramp-get-buffer multi-method method user host)) 5317 (set-buffer (tramp-get-buffer multi-method method user host))
5298 (tramp-process-actions p multi-method method user host 5318 (tramp-process-actions p multi-method method user host
5299 tramp-actions-before-shell) 5319 tramp-actions-before-shell)
@@ -5346,7 +5366,7 @@ log in as u2 to h2."
5346 tramp-multi-sh-program)) 5366 tramp-multi-sh-program))
5347 (num-hops (length method)) 5367 (num-hops (length method))
5348 (i 0)) 5368 (i 0))
5349 (process-kill-without-query p) 5369 (tramp-set-process-query-on-exit-flag p nil)
5350 (tramp-message 9 "Waiting 60s for local shell to come up...") 5370 (tramp-message 9 "Waiting 60s for local shell to come up...")
5351 (unless (tramp-wait-for-regexp 5371 (unless (tramp-wait-for-regexp
5352 p 60 (format "\\(%s\\)\\'\\|\\(%s\\)\\'" 5372 p 60 (format "\\(%s\\)\\'\\|\\(%s\\)\\'"
@@ -5466,12 +5486,16 @@ nil."
5466 (with-timeout (timeout) 5486 (with-timeout (timeout)
5467 (while (not found) 5487 (while (not found)
5468 (accept-process-output proc 1) 5488 (accept-process-output proc 1)
5489 (unless (memq (process-status proc) '(run open))
5490 (error "Process has died"))
5469 (goto-char (point-min)) 5491 (goto-char (point-min))
5470 (setq found (when (re-search-forward regexp nil t) 5492 (setq found (when (re-search-forward regexp nil t)
5471 (tramp-match-string-list))))))) 5493 (tramp-match-string-list)))))))
5472 (t 5494 (t
5473 (while (not found) 5495 (while (not found)
5474 (accept-process-output proc 1) 5496 (accept-process-output proc 1)
5497 (unless (memq (process-status proc) '(run open))
5498 (error "Process has died"))
5475 (goto-char (point-min)) 5499 (goto-char (point-min))
5476 (setq found (when (re-search-forward regexp nil t) 5500 (setq found (when (re-search-forward regexp nil t)
5477 (tramp-match-string-list)))))) 5501 (tramp-match-string-list))))))
@@ -5526,7 +5550,7 @@ Uses PROMPT as a prompt and sends the password to process P."
5526 5550
5527;; HHH: Not Changed. This might handle the case where USER is not 5551;; HHH: Not Changed. This might handle the case where USER is not
5528;; given in the "File name" very poorly. Then, the local 5552;; given in the "File name" very poorly. Then, the local
5529;; variable tramp-current user will be set to nil. 5553;; variable tramp-current-user will be set to nil.
5530(defun tramp-pre-connection (multi-method method user host) 5554(defun tramp-pre-connection (multi-method method user host)
5531 "Do some setup before actually logging in. 5555 "Do some setup before actually logging in.
5532METHOD, USER and HOST specify the connection." 5556METHOD, USER and HOST specify the connection."
@@ -5621,9 +5645,10 @@ to set up. METHOD, USER and HOST specify the connection."
5621 "stty -onlcr")))) 5645 "stty -onlcr"))))
5622 (erase-buffer) 5646 (erase-buffer)
5623 (tramp-message 5647 (tramp-message
5624 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'") 5648 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE'")
5625 (tramp-send-command-internal multi-method method user host 5649 (tramp-send-command-internal
5626 "HISTFILE=$HOME/.tramp_history; HISTSIZE=1") 5650 multi-method method user host
5651 "HISTFILE=$HOME/.tramp_history; HISTSIZE=1; export HISTFILE; export HISTSIZE")
5627 (erase-buffer) 5652 (erase-buffer)
5628 (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'") 5653 (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'")
5629 (tramp-send-command-internal multi-method method user host 5654 (tramp-send-command-internal multi-method method user host
@@ -6079,12 +6104,16 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
6079 (with-timeout (timeout) 6104 (with-timeout (timeout)
6080 (while (not found) 6105 (while (not found)
6081 (accept-process-output proc 1) 6106 (accept-process-output proc 1)
6107 (unless (memq (process-status proc) '(run open))
6108 (error "Process has died"))
6082 (goto-char (point-max)) 6109 (goto-char (point-max))
6083 (forward-line -1) 6110 (forward-line -1)
6084 (setq found (looking-at end-of-output)))))) 6111 (setq found (looking-at end-of-output))))))
6085 (t 6112 (t
6086 (while (not found) 6113 (while (not found)
6087 (accept-process-output proc 1) 6114 (accept-process-output proc 1)
6115 (unless (memq (process-status proc) '(run open))
6116 (error "Process has died"))
6088 (goto-char (point-max)) 6117 (goto-char (point-max))
6089 (forward-line -1) 6118 (forward-line -1)
6090 (setq found (looking-at end-of-output)))))) 6119 (setq found (looking-at end-of-output))))))
@@ -6762,6 +6791,16 @@ If you want to use it for something else, you'll have to check whether
6762it does the right thing." 6791it does the right thing."
6763 (delete "" (split-string string pattern))) 6792 (delete "" (split-string string pattern)))
6764 6793
6794(defun tramp-set-process-query-on-exit-flag (process flag)
6795 "Specify if query is needed for process when Emacs is exited.
6796If the second argument flag is non-nil, Emacs will query the user before
6797exiting if process is running."
6798 (if (fboundp 'set-process-query-on-exit-flag)
6799 (set-process-query-on-exit-flag process flag)
6800 (funcall (symbol-function 'process-kill-without-query)
6801 process flag)))
6802
6803
6765;; ------------------------------------------------------------ 6804;; ------------------------------------------------------------
6766;; -- Kludges section -- 6805;; -- Kludges section --
6767;; ------------------------------------------------------------ 6806;; ------------------------------------------------------------
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 6fce273f6ee..2f267787707 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -40,8 +40,15 @@
40;; Kingdon and uses GDB's annotation interface. You don't need to know about 40;; Kingdon and uses GDB's annotation interface. You don't need to know about
41;; annotations to use this mode as a debugger, but if you are interested 41;; annotations to use this mode as a debugger, but if you are interested
42;; developing the mode itself, then see the Annotations section in the GDB 42;; developing the mode itself, then see the Annotations section in the GDB
43;; info manual. Some GDB/MI commands are also used through th CLI command 43;; info manual.
44;; 'interpreter mi <mi-command>'. 44;;
45;; GDB developers plan to make the annotation interface obsolete. A new
46;; interface called GDB/MI (machine interface) has been designed to replace
47;; it. Some GDB/MI commands are used in this file through the CLI command
48;; 'interpreter mi <mi-command>'. A file called gdb-mi.el is included in the
49;; GDB repository for future releases (6.2 onwards) that uses GDB/MI as the
50;; primary interface to GDB. It is still under development and is part of a
51;; process to migrate Emacs from annotations to GDB/MI.
45;; 52;;
46;; Known Bugs: 53;; Known Bugs:
47;; 54;;
@@ -53,7 +60,7 @@
53(defvar gdb-current-address "main" "Initialisation for Assembler buffer.") 60(defvar gdb-current-address "main" "Initialisation for Assembler buffer.")
54(defvar gdb-previous-address nil) 61(defvar gdb-previous-address nil)
55(defvar gdb-previous-frame nil) 62(defvar gdb-previous-frame nil)
56(defvar gdb-current-frame "main") 63(defvar gdb-current-frame nil)
57(defvar gdb-current-language nil) 64(defvar gdb-current-language nil)
58(defvar gdb-view-source t "Non-nil means that source code can be viewed.") 65(defvar gdb-view-source t "Non-nil means that source code can be viewed.")
59(defvar gdb-selected-view 'source "Code type that user wishes to view.") 66(defvar gdb-selected-view 'source "Code type that user wishes to view.")
@@ -175,7 +182,7 @@ detailed description of this mode.
175 (setq gdb-current-address "main") 182 (setq gdb-current-address "main")
176 (setq gdb-previous-address nil) 183 (setq gdb-previous-address nil)
177 (setq gdb-previous-frame nil) 184 (setq gdb-previous-frame nil)
178 (setq gdb-current-frame "main") 185 (setq gdb-current-frame nil)
179 (setq gdb-view-source t) 186 (setq gdb-view-source t)
180 (setq gdb-selected-view 'source) 187 (setq gdb-selected-view 'source)
181 (setq gdb-var-list nil) 188 (setq gdb-var-list nil)
@@ -214,7 +221,7 @@ speedbar."
214 (require 'tooltip) 221 (require 'tooltip)
215 (let ((expr (tooltip-identifier-from-point (point)))) 222 (let ((expr (tooltip-identifier-from-point (point))))
216 (if (and (string-equal gdb-current-language "c") 223 (if (and (string-equal gdb-current-language "c")
217 gdb-use-colon-colon-notation) 224 gdb-use-colon-colon-notation gdb-current-frame)
218 (setq expr (concat gdb-current-frame "::" expr))) 225 (setq expr (concat gdb-current-frame "::" expr)))
219 (catch 'already-watched 226 (catch 'already-watched
220 (dolist (var gdb-var-list) 227 (dolist (var gdb-var-list)
@@ -1219,8 +1226,10 @@ static char *magick[] = {
1219 (interactive) 1226 (interactive)
1220 (save-excursion 1227 (save-excursion
1221 (beginning-of-line 1) 1228 (beginning-of-line 1)
1222 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t) 1229 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdbmi))
1223 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")) 1230 (looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*.\\s-*\\S-*\\s-*\\(\\S-*\\):\\([0-9]+\\)")
1231 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
1232 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")))
1224 (if (match-string 2) 1233 (if (match-string 2)
1225 (let ((line (match-string 2)) 1234 (let ((line (match-string 2))
1226 (file (match-string 1))) 1235 (file (match-string 1)))
@@ -1311,7 +1320,7 @@ static char *magick[] = {
1311 1320
1312(defun gdb-get-frame-number () 1321(defun gdb-get-frame-number ()
1313 (save-excursion 1322 (save-excursion
1314 (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t)) 1323 (let* ((pos (re-search-backward "^#*\\([0-9]*\\)" nil t))
1315 (n (or (and pos (match-string-no-properties 1)) "0"))) 1324 (n (or (and pos (match-string-no-properties 1)) "0")))
1316 n))) 1325 n)))
1317 1326
@@ -1502,7 +1511,7 @@ static char *magick[] = {
1502 1511
1503\\{gdb-locals-mode-map}" 1512\\{gdb-locals-mode-map}"
1504 (setq major-mode 'gdb-locals-mode) 1513 (setq major-mode 'gdb-locals-mode)
1505 (setq mode-name "Locals") 1514 (setq mode-name (concat "Locals:" gdb-current-frame))
1506 (setq buffer-read-only t) 1515 (setq buffer-read-only t)
1507 (use-local-map gdb-locals-mode-map) 1516 (use-local-map gdb-locals-mode-map)
1508 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba)) 1517 (if (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))
@@ -1999,6 +2008,9 @@ BUFFER nil or omitted means use the current buffer."
1999 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ") 2008 (if (looking-at ".*=\\s-+0x\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\);? ")
2000 (progn 2009 (progn
2001 (setq gdb-current-frame (match-string 2)) 2010 (setq gdb-current-frame (match-string 2))
2011 (if (gdb-get-buffer 'gdb-locals-buffer)
2012 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
2013 (setq mode-name (concat "Locals:" gdb-current-frame))))
2002 (let ((address (match-string 1))) 2014 (let ((address (match-string 1)))
2003 ;; remove leading 0s from output of info frame command. 2015 ;; remove leading 0s from output of info frame command.
2004 (if (string-match "^0+\\(.*\\)" address) 2016 (if (string-match "^0+\\(.*\\)" address)
diff --git a/lisp/replace.el b/lisp/replace.el
index e14e1314352..f7afcd594cf 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -36,9 +36,11 @@
36 36
37(defvar query-replace-history nil) 37(defvar query-replace-history nil)
38 38
39(defvar query-replace-interactive nil 39(defcustom query-replace-interactive nil
40 "Non-nil means `query-replace' uses the last search string. 40 "Non-nil means `query-replace' uses the last search string.
41That becomes the \"string to replace\".") 41That becomes the \"string to replace\"."
42 :type 'boolean
43 :group 'matching)
42 44
43(defcustom query-replace-from-history-variable 'query-replace-history 45(defcustom query-replace-from-history-variable 'query-replace-history
44 "History list to use for the FROM argument of `query-replace' commands. 46 "History list to use for the FROM argument of `query-replace' commands.
diff --git a/lisp/subr.el b/lisp/subr.el
index 59620d1bb7e..cd52efcebde 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1796,10 +1796,21 @@ The value returned is the value of the last form in BODY.
1796This does not alter the buffer list ordering. 1796This does not alter the buffer list ordering.
1797See also `with-temp-buffer'." 1797See also `with-temp-buffer'."
1798 (declare (indent 1) (debug t)) 1798 (declare (indent 1) (debug t))
1799 `(let ((save-selected-window-window (selected-window))) 1799 ;; Most of this code is a copy of save-selected-window.
1800 `(let ((save-selected-window-window (selected-window))
1801 ;; It is necessary to save all of these, because calling
1802 ;; select-window changes frame-selected-window for whatever
1803 ;; frame that window is in.
1804 (save-selected-window-alist
1805 (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
1806 (frame-list))))
1800 (unwind-protect 1807 (unwind-protect
1801 (progn (select-window ,window 'norecord) 1808 (progn (select-window ,window 'norecord)
1802 ,@body) 1809 ,@body)
1810 (dolist (elt save-selected-window-alist)
1811 (and (frame-live-p (car elt))
1812 (window-live-p (cadr elt))
1813 (set-frame-selected-window (car elt) (cadr elt))))
1803 (if (window-live-p save-selected-window-window) 1814 (if (window-live-p save-selected-window-window)
1804 (select-window save-selected-window-window 'norecord))))) 1815 (select-window save-selected-window-window 'norecord)))))
1805 1816
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 206492dee08..1fbf2d224a2 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -1,15 +1,10 @@
1;;; thumbs.el --- Thumbnails previewer for images files 1;;; thumbs.el --- Thumbnails previewer for images files
2;;; 2
3;; Copyright 2004 Free Software Foundation, Inc
4
3;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca> 5;; Author: Jean-Philippe Theberge <jphiltheberge@videotron.ca>
4;;
5;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
6;; The peoples at #emacs@freenode.net for numerous help
7;; RMS for emacs and the GNU project.
8;;
9;; Keywords: Multimedia 6;; Keywords: Multimedia
10 7
11(defconst thumbs-version "2.0")
12
13;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
14 9
15;; GNU Emacs is free software; you can redistribute it and/or modify 10;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -26,6 +21,11 @@
26;; along with GNU Emacs; see the file COPYING. If not, write to the 21;; along with GNU Emacs; see the file COPYING. If not, write to the
27;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28;; Boston, MA 02111-1307, USA. 23;; Boston, MA 02111-1307, USA.
24;;
25;; Thanks: Alex Schroeder <alex@gnu.org> for maintaining the package at some time
26;; The peoples at #emacs@freenode.net for numerous help
27;; RMS for emacs and the GNU project.
28;;
29 29
30;;; Commentary: 30;;; Commentary:
31 31
@@ -56,19 +56,8 @@
56 56
57;;; Code: 57;;; Code:
58 58
59(eval-when-compile
60 (require 'cl))
61(require 'dired) 59(require 'dired)
62 60
63;; Abort if in-line imaging isn't supported (i.e. Emacs-20.7)
64
65(when (not (display-images-p))
66 (error "Your Emacs version (%S) doesn't support in-line images,
67was not compiled with image support or is run in console mode.
68Upgrade to Emacs 21.1 or newer, compile it with image support
69or use a window-system"
70 emacs-version))
71
72;; CUSTOMIZATIONS 61;; CUSTOMIZATIONS
73 62
74(defgroup thumbs nil 63(defgroup thumbs nil
@@ -212,9 +201,9 @@ reached."
212 (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) filesL)))) 201 (dirsize (apply '+ (mapcar (lambda (x) (cadr x)) filesL))))
213 (while (> dirsize thumbs-thumbsdir-max-size) 202 (while (> dirsize thumbs-thumbsdir-max-size)
214 (progn 203 (progn
215 (message "Deleting file %s" (caddar filesL))) 204 (message "Deleting file %s" (cadr (cdar filesL))))
216 (delete-file (caddar filesL)) 205 (delete-file (cadr (cdar filesL)))
217 (setq dirsize (- dirsize (cadar filesL))) 206 (setq dirsize (- dirsize (car (cdar filesL))))
218 (setq filesL (cdr filesL))))) 207 (setq filesL (cdr filesL)))))
219 208
220;; Check the thumbsnail directory size and clean it if necessary. 209;; Check the thumbsnail directory size and clean it if necessary.
@@ -272,11 +261,12 @@ if INCREMENT is set, make the image bigger, else smaller.
272Or, alternatively, a SIZE may be specified." 261Or, alternatively, a SIZE may be specified."
273 (interactive) 262 (interactive)
274 ;; cleaning of old temp file 263 ;; cleaning of old temp file
275 (ignore-errors 264 (condition-case nil
276 (apply 'delete-file 265 (apply 'delete-file
277 (directory-files 266 (directory-files
278 thumbs-temp-dir t 267 thumbs-temp-dir t
279 thumbs-temp-prefix))) 268 thumbs-temp-prefix))
269 (error nil))
280 (let ((buffer-read-only nil) 270 (let ((buffer-read-only nil)
281 (x (if size 271 (x (if size
282 size 272 size
@@ -309,22 +299,10 @@ Or, alternatively, a SIZE may be specified."
309 (interactive) 299 (interactive)
310 (thumbs-resize-image t)) 300 (thumbs-resize-image t))
311 301
312(defun thumbs-subst-char-in-string (orig rep string)
313 "Replace occurrences of character ORIG with character REP in STRING.
314Return the resulting (new) string. -- (defun borowed to Dave Love)"
315 (let ((string (copy-sequence string))
316 (l (length string))
317 (i 0))
318 (while (< i l)
319 (if (= (aref string i) orig)
320 (aset string i rep))
321 (setq i (1+ i)))
322 string))
323
324(defun thumbs-thumbname (img) 302(defun thumbs-thumbname (img)
325 "Return a thumbnail name for the image IMG." 303 "Return a thumbnail name for the image IMG."
326 (concat thumbs-thumbsdir "/" 304 (concat thumbs-thumbsdir "/"
327 (thumbs-subst-char-in-string 305 (subst-char-in-string
328 ?\ ?\_ 306 ?\ ?\_
329 (apply 307 (apply
330 'concat 308 'concat
@@ -336,7 +314,11 @@ Return the resulting (new) string. -- (defun borowed to Dave Love)"
336 (let* ((fn (expand-file-name img)) 314 (let* ((fn (expand-file-name img))
337 (tn (thumbs-thumbname img))) 315 (tn (thumbs-thumbname img)))
338 (if (or (not (file-exists-p tn)) 316 (if (or (not (file-exists-p tn))
339 (not (equal (thumbs-file-size tn) thumbs-geometry))) 317 ;; This is not the right fix, but I don't understand
318 ;; the external program or why it produces a geometry
319 ;; unequal to the one requested -- rms.
320;;; (not (equal (thumbs-file-size tn) thumbs-geometry))
321 )
340 (thumbs-call-convert fn tn "sample" thumbs-geometry)) 322 (thumbs-call-convert fn tn "sample" thumbs-geometry))
341 tn)) 323 tn))
342 324
@@ -380,30 +362,28 @@ if MARKED is non-nil, the image is marked."
380 "Insert the thumbnail for IMG at point. 362 "Insert the thumbnail for IMG at point.
381if MARKED is non-nil, the image is marked" 363if MARKED is non-nil, the image is marked"
382 (thumbs-insert-image 364 (thumbs-insert-image
383 (thumbs-make-thumb img) 'jpeg thumbs-relief marked)) 365 (thumbs-make-thumb img) 'jpeg thumbs-relief marked)
366 (put-text-property (1- (point)) (point)
367 'thumb-image-file img))
384 368
385(defun thumbs-do-thumbs-insertion (L) 369(defun thumbs-do-thumbs-insertion (L)
386 "Insert all thumbs in list L." 370 "Insert all thumbs in list L."
387 (setq thumbs-fileL nil)
388 (let ((i 0)) 371 (let ((i 0))
389 (while L 372 (dolist (img L)
373 (thumbs-insert-thumb img
374 (member img thumbs-markedL))
390 (when (= 0 (mod (setq i (1+ i)) thumbs-per-line)) 375 (when (= 0 (mod (setq i (1+ i)) thumbs-per-line))
391 (newline)) 376 (newline)))
392 (setq thumbs-fileL (cons (cons (point) 377 (unless (bobp) (newline))))
393 (car L))
394 thumbs-fileL))
395 (thumbs-insert-thumb (car L)
396 (member (car L) thumbs-markedL))
397 (setq L (cdr L)))))
398 378
399(defun thumbs-show-thumbs-list (L &optional buffer-name same-window) 379(defun thumbs-show-thumbs-list (L &optional buffer-name same-window)
380 (when (not (display-images-p))
381 (error "Images are not supported in this Emacs session"))
400 (funcall (if same-window 'switch-to-buffer 'pop-to-buffer) 382 (funcall (if same-window 'switch-to-buffer 'pop-to-buffer)
401 (or buffer-name "*THUMB-View*")) 383 (or buffer-name "*THUMB-View*"))
402 (let ((inhibit-read-only t)) 384 (let ((inhibit-read-only t))
403 (erase-buffer) 385 (erase-buffer)
404 (thumbs-mode) 386 (thumbs-mode)
405 (make-variable-buffer-local 'thumbs-fileL)
406 (setq thumbs-fileL nil)
407 (thumbs-do-thumbs-insertion L) 387 (thumbs-do-thumbs-insertion L)
408 (goto-char (point-min)) 388 (goto-char (point-min))
409 (setq thumbs-current-dir default-directory) 389 (setq thumbs-current-dir default-directory)
@@ -435,8 +415,8 @@ and SAME-WINDOW to show thumbs in the same window."
435;;;###autoload 415;;;###autoload
436(defalias 'thumbs 'thumbs-show-all-from-dir) 416(defalias 'thumbs 'thumbs-show-all-from-dir)
437 417
438(defun thumbs-find-image (img L &optional num otherwin) 418(defun thumbs-find-image (img &optional num otherwin)
439 (funcall 419 (funcall
440 (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer) 420 (if otherwin 'switch-to-buffer-other-window 'switch-to-buffer)
441 (concat "*Image: " (file-name-nondirectory img) " - " 421 (concat "*Image: " (file-name-nondirectory img) " - "
442 (number-to-string (or num 0)) "*")) 422 (number-to-string (or num 0)) "*"))
@@ -449,8 +429,6 @@ and SAME-WINDOW to show thumbs in the same window."
449 (make-variable-buffer-local 'thumbs-current-tmp-filename) 429 (make-variable-buffer-local 'thumbs-current-tmp-filename)
450 (make-variable-buffer-local 'thumbs-current-image-size) 430 (make-variable-buffer-local 'thumbs-current-image-size)
451 (make-variable-buffer-local 'thumbs-image-num) 431 (make-variable-buffer-local 'thumbs-image-num)
452 (make-variable-buffer-local 'thumbs-fileL)
453 (setq thumbs-fileL L)
454 (delete-region (point-min)(point-max)) 432 (delete-region (point-min)(point-max))
455 (thumbs-insert-image img (thumbs-image-type img) 0))) 433 (thumbs-insert-image img (thumbs-image-type img) 0)))
456 434
@@ -458,10 +436,8 @@ and SAME-WINDOW to show thumbs in the same window."
458 "Display image IMG for thumbnail at point. 436 "Display image IMG for thumbnail at point.
459use another window it OTHERWIN is t." 437use another window it OTHERWIN is t."
460 (interactive) 438 (interactive)
461 (let* ((L thumbs-fileL) 439 (let* ((i (or img (thumbs-current-image))))
462 (n (point)) 440 (thumbs-find-image i (point) otherwin)))
463 (i (or img (cdr (assoc n L)))))
464 (thumbs-find-image i L n otherwin)))
465 441
466(defun thumbs-find-image-at-point-other-window () 442(defun thumbs-find-image-at-point-other-window ()
467 "Display image for thumbnail at point in the preview buffer. 443 "Display image for thumbnail at point in the preview buffer.
@@ -469,6 +445,12 @@ Open another window."
469 (interactive) 445 (interactive)
470 (thumbs-find-image-at-point nil t)) 446 (thumbs-find-image-at-point nil t))
471 447
448(defun thumbs-mouse-find-image (event)
449 "Display image for thumbnail at mouse click EVENT."
450 (interactive "e")
451 (mouse-set-point event)
452 (thumbs-find-image-at-point))
453
472(defun thumbs-call-setroot-command (img) 454(defun thumbs-call-setroot-command (img)
473 "Call the setroot program for IMG." 455 "Call the setroot program for IMG."
474 (run-hooks 'thumbs-before-setroot-hook) 456 (run-hooks 'thumbs-before-setroot-hook)
@@ -481,7 +463,8 @@ Open another window."
481(defun thumbs-set-image-at-point-to-root-window () 463(defun thumbs-set-image-at-point-to-root-window ()
482 "Set the image at point as the desktop wallpaper." 464 "Set the image at point as the desktop wallpaper."
483 (interactive) 465 (interactive)
484 (thumbs-call-setroot-command (cdr (assoc (point) thumbs-fileL)))) 466 (thumbs-call-setroot-command
467 (thumbs-current-image)))
485 468
486(defun thumbs-set-root () 469(defun thumbs-set-root ()
487 "Set the current image as root." 470 "Set the current image as root."
@@ -490,36 +473,102 @@ Open another window."
490 (or thumbs-current-tmp-filename 473 (or thumbs-current-tmp-filename
491 thumbs-current-image-filename))) 474 thumbs-current-image-filename)))
492 475
476(defun thumbs-file-alist ()
477 "Make an alist of elements (POS . FILENAME) for all images in thumb buffer."
478 (save-excursion
479 (let (list)
480 (goto-char (point-min))
481 (while (not (eobp))
482 (if (thumbs-current-image)
483 (push (cons (point-marker)
484 (thumbs-current-image))
485 list))
486 (forward-char 1))
487 list)))
488
489(defun thumbs-file-list ()
490 "Make a list of file names for all images in thumb buffer."
491 (save-excursion
492 (let (list)
493 (goto-char (point-min))
494 (while (not (eobp))
495 (if (thumbs-current-image)
496 (push (thumbs-current-image) list))
497 (forward-char 1))
498 (nreverse list))))
499
493(defun thumbs-delete-images () 500(defun thumbs-delete-images ()
494 "Delete the image at point (and it's thumbnail) (or marked files if any)." 501 "Delete the image at point (and it's thumbnail) (or marked files if any)."
495 (interactive) 502 (interactive)
496 (let ((f (or thumbs-markedL (list (cdr (assoc (point) thumbs-fileL)))))) 503 (let ((files (or thumbs-markedL (list (thumbs-current-image)))))
497 (if (yes-or-no-p (format "Really delete %d files? " (length f))) 504 (if (yes-or-no-p (format "Really delete %d files? " (length files)))
498 (progn 505 (let ((thumbs-fileL (thumbs-file-alist))
499 (mapcar (lambda (x) 506 (inhibit-read-only t))
500 (setq thumbs-fileL (delete (rassoc x thumbs-fileL) thumbs-fileL)) 507 (dolist (x files)
508 (let (failure)
509 (condition-case ()
510 (progn
501 (delete-file x) 511 (delete-file x)
502 (delete-file (thumbs-thumbname x))) f) 512 (delete-file (thumbs-thumbname x)))
503 (thumbs-redraw-buffer))))) 513 (file-error (setq failure t)))
514 (unless failure
515 (when (rassoc x thumbs-fileL)
516 (goto-char (car (rassoc x thumbs-fileL)))
517 (delete-region (point) (1+ (point))))
518 (setq thumbs-markedL
519 (delq x thumbs-markedL)))))))))
520
521(defun thumbs-rename-images (newfile)
522 "Rename the image at point (and it's thumbnail) (or marked files if any)."
523 (interactive "FRename to file or directory: ")
524 (let ((files (or thumbs-markedL (list (thumbs-current-image))))
525 failures)
526 (if (and (not (file-directory-p newfile))
527 thumbs-markedL)
528 (if (file-exists-p newfile)
529 (error "Renaming marked files to file name `%s'" newfile)
530 (make-directory newfile t)))
531 (if (yes-or-no-p (format "Really rename %d files? " (length files)))
532 (let ((thumbs-fileL (thumbs-file-alist))
533 (inhibit-read-only t))
534 (dolist (file files)
535 (let (failure)
536 (condition-case ()
537 (if (file-directory-p newfile)
538 (rename-file file
539 (expand-file-name
540 (file-name-nondirectory file)
541 newfile))
542 (rename-file file newfile))
543 (file-error (setq failure t)
544 (push file failures)))
545 (unless failure
546 (when (rassoc file thumbs-fileL)
547 (goto-char (car (rassoc file thumbs-fileL)))
548 (delete-region (point) (1+ (point))))
549 (setq thumbs-markedL
550 (delq file thumbs-markedL)))))))
551 (if failures
552 (display-warning 'file-error
553 (format "Rename failures for %s into %s"
554 failures newfile)
555 :error))))
504 556
505(defun thumbs-kill-buffer () 557(defun thumbs-kill-buffer ()
506 "Kill the current buffer." 558 "Kill the current buffer."
507 (interactive) 559 (interactive)
508 (let ((buffer (current-buffer))) 560 (let ((buffer (current-buffer)))
509 (ignore-errors (delete-window (selected-window))) 561 (condition-case nil
562 (delete-window (selected-window))
563 (error nil))
510 (kill-buffer buffer))) 564 (kill-buffer buffer)))
511 565
512(defun thumbs-show-image-num (num) 566(defun thumbs-show-image-num (num)
513 "Show the image with number NUM." 567 "Show the image with number NUM."
514 (let ((inhibit-read-only t)) 568 (let ((image-buffer (get-buffer-create "*Image*")))
515 (delete-region (point-min)(point-max)) 569 (let ((i (thumbs-current-image)))
516 (let ((i (cdr (assoc num thumbs-fileL)))) 570 (with-current-buffer image-buffer
517 (thumbs-insert-image i (thumbs-image-type i) 0) 571 (thumbs-insert-image i (thumbs-image-type i) 0))
518 (sleep-for 2)
519 (rename-buffer (concat "*Image: "
520 (file-name-nondirectory i)
521 " - "
522 (number-to-string num) "*"))
523 (setq thumbs-image-num num 572 (setq thumbs-image-num num
524 thumbs-current-image-filename i)))) 573 thumbs-current-image-filename i))))
525 574
@@ -527,40 +576,54 @@ Open another window."
527 "Show next image." 576 "Show next image."
528 (interactive) 577 (interactive)
529 (let* ((i (1+ thumbs-image-num)) 578 (let* ((i (1+ thumbs-image-num))
530 (l (caar thumbs-fileL)) 579 (list (thumbs-file-alist))
531 (num 580 (l (caar list)))
532 (cond ((assoc i thumbs-fileL) i) 581 (while (and (/= i thumbs-image-num) (not (assoc i list)))
533 ((>= i l) 1) 582 (setq i (if (>= i l) 1 (1+ i))))
534 (t (1+ i))))) 583 (thumbs-show-image-num i)))
535 (thumbs-show-image-num num)))
536 584
537(defun thumbs-previous-image () 585(defun thumbs-previous-image ()
538 "Show the previous image." 586 "Show the previous image."
539 (interactive) 587 (interactive)
540 (let* ((i (- thumbs-image-num 1)) 588 (let* ((i (- thumbs-image-num 1))
541 (l (caar thumbs-fileL)) 589 (list (thumbs-file-alist))
542 (num 590 (l (caar list)))
543 (cond ((assoc i thumbs-fileL) i) 591 (while (and (/= i thumbs-image-num) (not (assoc i list)))
544 ((<= i 1) l) 592 (setq i (if (<= i 1) l (1- i))))
545 (t (- i 1))))) 593 (thumbs-show-image-num i)))
546 (thumbs-show-image-num num)))
547 594
548(defun thumbs-redraw-buffer () 595(defun thumbs-redraw-buffer ()
549 "Redraw the current thumbs buffer." 596 "Redraw the current thumbs buffer."
550 (let ((p (point)) 597 (let ((p (point))
551 (inhibit-read-only t)) 598 (inhibit-read-only t)
552 (delete-region (point-min)(point-max)) 599 (files (thumbs-file-list)))
553 (thumbs-do-thumbs-insertion (reverse (mapcar 'cdr thumbs-fileL))) 600 (erase-buffer)
554 (goto-char (1+ p)))) 601 (thumbs-do-thumbs-insertion files)
602 (goto-char p)))
555 603
556(defun thumbs-mark () 604(defun thumbs-mark ()
557 "Mark the image at point." 605 "Mark the image at point."
558 (interactive) 606 (interactive)
559 (setq thumbs-markedL (cons (cdr (assoc (point) thumbs-fileL)) thumbs-markedL)) 607 (let ((elt (thumbs-current-image)))
560 (let ((inhibit-read-only t)) 608 (unless elt
561 (delete-char 1) 609 (error "No image here"))
562 (thumbs-insert-thumb (cdr (assoc (point) thumbs-fileL)) t)) 610 (push elt thumbs-markedL)
563 (when (eolp)(forward-char))) 611 (let ((inhibit-read-only t))
612 (delete-char 1)
613 (thumbs-insert-thumb elt t)))
614 (when (eolp) (forward-char)))
615
616(defun thumbs-unmark ()
617 "Unmark the image at point."
618 (interactive)
619 (let ((elt (thumbs-current-image)))
620 (unless elt
621 (error "No image here"))
622 (setq thumbs-markedL (delete elt thumbs-markedL))
623 (let ((inhibit-read-only t))
624 (delete-char 1)
625 (thumbs-insert-thumb elt nil)))
626 (when (eolp) (forward-char)))
564 627
565;; Image modification routines 628;; Image modification routines
566 629
@@ -587,8 +650,8 @@ ACTION and ARG should be legal convert command."
587(defun thumbs-emboss-image (emboss) 650(defun thumbs-emboss-image (emboss)
588 "Emboss the image with value EMBOSS." 651 "Emboss the image with value EMBOSS."
589 (interactive "nEmboss value: ") 652 (interactive "nEmboss value: ")
590 (if (or (< emboss 3) (> emboss 31) (zerop (logand emboss 1))) 653 (if (or (< emboss 3) (> emboss 31) (zerop (% emboss 2)))
591 (error "Arg must be a odd number between 3 and 31")) 654 (error "Arg must be an odd number between 3 and 31"))
592 (thumbs-modify-image "emboss" (number-to-string emboss))) 655 (thumbs-modify-image "emboss" (number-to-string emboss)))
593 656
594(defun thumbs-monochrome-image () 657(defun thumbs-monochrome-image ()
@@ -611,17 +674,24 @@ ACTION and ARG should be legal convert command."
611 (interactive) 674 (interactive)
612 (thumbs-modify-image "rotate" "90")) 675 (thumbs-modify-image "rotate" "90"))
613 676
677(defun thumbs-current-image ()
678 "Return the name of the image file name at point."
679 (get-text-property (point) 'thumb-image-file))
680
614(defun thumbs-forward-char () 681(defun thumbs-forward-char ()
615 "Move forward one image." 682 "Move forward one image."
616 (interactive) 683 (interactive)
617 (forward-char) 684 (forward-char)
618 (when (eolp)(forward-char)) 685 (while (and (not (eobp)) (not (thumbs-current-image)))
686 (forward-char))
619 (thumbs-show-name)) 687 (thumbs-show-name))
620 688
621(defun thumbs-backward-char () 689(defun thumbs-backward-char ()
622 "Move backward one image." 690 "Move backward one image."
623 (interactive) 691 (interactive)
624 (forward-char -1) 692 (forward-char -1)
693 (while (and (not (bobp)) (not (thumbs-current-image)))
694 (forward-char -1))
625 (thumbs-show-name)) 695 (thumbs-show-name))
626 696
627(defun thumbs-forward-line () 697(defun thumbs-forward-line ()
@@ -639,15 +709,15 @@ ACTION and ARG should be legal convert command."
639(defun thumbs-show-name () 709(defun thumbs-show-name ()
640 "Show the name of the current file." 710 "Show the name of the current file."
641 (interactive) 711 (interactive)
642 (let ((f (cdr (assoc (point) thumbs-fileL)))) 712 (let ((f (thumbs-current-image)))
643 (message "%s [%s]" f (thumbs-file-size f)))) 713 (and f (message "%s [%s]" f (thumbs-file-size f)))))
644 714
645(defun thumbs-save-current-image () 715(defun thumbs-save-current-image ()
646 "Save the current image." 716 "Save the current image."
647 (interactive) 717 (interactive)
648 (let ((f (or thumbs-current-tmp-filename 718 (let ((f (or thumbs-current-tmp-filename
649 thumbs-current-image-filename)) 719 thumbs-current-image-filename))
650 (sa (read-from-minibuffer "save file as: " 720 (sa (read-from-minibuffer "Save image file as: "
651 thumbs-current-image-filename))) 721 thumbs-current-image-filename)))
652 (copy-file f sa))) 722 (copy-file f sa)))
653 723
@@ -661,6 +731,7 @@ ACTION and ARG should be legal convert command."
661(defvar thumbs-mode-map 731(defvar thumbs-mode-map
662 (let ((map (make-sparse-keymap))) 732 (let ((map (make-sparse-keymap)))
663 (define-key map [return] 'thumbs-find-image-at-point) 733 (define-key map [return] 'thumbs-find-image-at-point)
734 (define-key map [mouse-2] 'thumbs-mouse-find-image)
664 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window) 735 (define-key map [(meta return)] 'thumbs-find-image-at-point-other-window)
665 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window) 736 (define-key map [(control return)] 'thumbs-set-image-at-point-to-root-window)
666 (define-key map [delete] 'thumbs-delete-images) 737 (define-key map [delete] 'thumbs-delete-images)
@@ -670,15 +741,20 @@ ACTION and ARG should be legal convert command."
670 (define-key map [down] 'thumbs-forward-line) 741 (define-key map [down] 'thumbs-forward-line)
671 (define-key map "d" 'thumbs-dired) 742 (define-key map "d" 'thumbs-dired)
672 (define-key map "m" 'thumbs-mark) 743 (define-key map "m" 'thumbs-mark)
744 (define-key map "u" 'thumbs-unmark)
745 (define-key map "R" 'thumbs-rename-images)
746 (define-key map "x" 'thumbs-delete-images)
673 (define-key map "s" 'thumbs-show-name) 747 (define-key map "s" 'thumbs-show-name)
674 (define-key map "q" 'thumbs-kill-buffer) 748 (define-key map "q" 'thumbs-kill-buffer)
675 map) 749 map)
676 "Keymap for `thumbs-mode'.") 750 "Keymap for `thumbs-mode'.")
677 751
752(put 'thumbs-mode 'mode-class 'special)
678(define-derived-mode thumbs-mode 753(define-derived-mode thumbs-mode
679 fundamental-mode "thumbs" 754 fundamental-mode "thumbs"
680 "Preview images in a thumbnails buffer" 755 "Preview images in a thumbnails buffer"
681 (make-variable-buffer-local 'thumbs-markedL) 756 (make-variable-buffer-local 'thumbs-markedL)
757 (setq buffer-read-only t)
682 (setq thumbs-markedL nil)) 758 (setq thumbs-markedL nil))
683 759
684(defvar thumbs-view-image-mode-map 760(defvar thumbs-view-image-mode-map
@@ -698,6 +774,7 @@ ACTION and ARG should be legal convert command."
698 "Keymap for `thumbs-view-image-mode'.") 774 "Keymap for `thumbs-view-image-mode'.")
699 775
700;; thumbs-view-image-mode 776;; thumbs-view-image-mode
777(put 'thumbs-view-image-mode 'mode-class 'special)
701(define-derived-mode thumbs-view-image-mode 778(define-derived-mode thumbs-view-image-mode
702 fundamental-mode "image-view-mode") 779 fundamental-mode "image-view-mode")
703 780
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index 4a485414d7a..86703a3b9b5 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -230,9 +230,13 @@ You should set this to t when using a non-system shell.\n\n"))))
230 230
231(defun convert-standard-filename (filename) 231(defun convert-standard-filename (filename)
232 "Convert a standard file's name to something suitable for the current OS. 232 "Convert a standard file's name to something suitable for the current OS.
233This function's standard definition is trivial; it just returns the argument. 233This means to guarantee valid names and perhaps to canonicalize
234However, on some systems, the function is redefined 234certain patterns.
235with a definition that really does change some file names." 235
236On Windows and DOS, replace invalid characters. On DOS, make
237sure to obey the 8.3 limitations. On Windows, turn Cygwin names
238into native names, and also turn slashes into backslashes if the
239shell requires it (see `w32-shell-dos-semantics')."
236 (let ((name 240 (let ((name
237 (save-match-data 241 (save-match-data
238 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename) 242 (if (string-match "\\`/cygdrive/\\([a-zA-Z]\\)/" filename)
diff --git a/lisp/window.el b/lisp/window.el
index 2b5a4ab161d..188b3acf311 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -36,6 +36,9 @@ of this construct.
36However, if a window has become dead, don't get an error, 36However, if a window has become dead, don't get an error,
37just refrain from reselecting it." 37just refrain from reselecting it."
38 `(let ((save-selected-window-window (selected-window)) 38 `(let ((save-selected-window-window (selected-window))
39 ;; It is necessary to save all of these, because calling
40 ;; select-window changes frame-selected-window for whatever
41 ;; frame that window is in.
39 (save-selected-window-alist 42 (save-selected-window-alist
40 (mapcar (lambda (frame) (list frame (frame-selected-window frame))) 43 (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
41 (frame-list)))) 44 (frame-list))))
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index aa49c8d1d17..efa5eb94091 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,20 @@
12004-05-30 Richard M. Stallman <rms@gnu.org>
2
3 * loading.texi (Named Features): Clarify return value
4 and meaning of NOERROR.
5
6 * variables.texi (File Local Variables): Minor cleanup.
7
82004-05-30 Michael Albinus <michael.albinus@gmx.de>
9
10 * files.texi (Magic File Names): Add `file-remote-p' as operation
11 of file name handlers.
12
132004-05-29 Richard M. Stallman <rms@gnu.org>
14
15 * modes.texi (Minor Mode Conventions): (-) has no special meaning
16 as arg to a minor mode command.
17
12004-05-22 Richard M. Stallman <rms@gnu.org> 182004-05-22 Richard M. Stallman <rms@gnu.org>
2 19
3 * syntax.texi (Syntax Class Table): Word syntax not just for English. 20 * syntax.texi (Syntax Class Table): Word syntax not just for English.
diff --git a/lispref/files.texi b/lispref/files.texi
index 7ea482efa51..aa5b0c397b1 100644
--- a/lispref/files.texi
+++ b/lispref/files.texi
@@ -2493,7 +2493,7 @@ Here are the operations that a magic file name handler gets to handle:
2493@code{file-attributes}, 2493@code{file-attributes},
2494@code{file-directory-p}, 2494@code{file-directory-p},
2495@code{file-executable-p}, @code{file-exists-p}, 2495@code{file-executable-p}, @code{file-exists-p},
2496@code{file-local-copy}, 2496@code{file-local-copy}, @code{file-remote-p},
2497@code{file-modes}, @code{file-name-all-completions}, 2497@code{file-modes}, @code{file-name-all-completions},
2498@code{file-name-as-directory}, 2498@code{file-name-as-directory},
2499@code{file-name-completion}, 2499@code{file-name-completion},
@@ -2537,7 +2537,7 @@ Here are the operations that a magic file name handler gets to handle:
2537@code{file-attributes}, 2537@code{file-attributes},
2538@code{file-direct@discretionary{}{}{}ory-p}, 2538@code{file-direct@discretionary{}{}{}ory-p},
2539@code{file-executable-p}, @code{file-exists-p}, 2539@code{file-executable-p}, @code{file-exists-p},
2540@code{file-local-copy}, 2540@code{file-local-copy}, @code{file-remote-p},
2541@code{file-modes}, @code{file-name-all-completions}, 2541@code{file-modes}, @code{file-name-all-completions},
2542@code{file-name-as-directory}, 2542@code{file-name-as-directory},
2543@code{file-name-completion}, 2543@code{file-name-completion},
@@ -2645,8 +2645,7 @@ of the local copy file.
2645@end defun 2645@end defun
2646 2646
2647@defun file-remote-p filename 2647@defun file-remote-p filename
2648This function returns @code{t} if @var{filename} is a remote file---that is, 2648This function returns @code{t} if @var{filename} is a remote file.
2649a magic file name that handles @code{file-local-copy}.
2650@end defun 2649@end defun
2651 2650
2652@defun unhandled-file-name-directory filename 2651@defun unhandled-file-name-directory filename
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 893b41d2e51..4d13e48def5 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -687,9 +687,14 @@ However, in this case, @code{require} insists on finding @var{feature}
687with an added suffix; a file whose name is just @var{feature} won't be 687with an added suffix; a file whose name is just @var{feature} won't be
688used. 688used.
689 689
690If loading the file fails to provide @var{feature}, @code{require} 690If @var{noerror} is non-@code{nil}, that suppresses errors from actual
691signals an error, @samp{Required feature @var{feature} was not 691loading of the file. In that case, @code{require} returns @code{nil}
692provided}, unless @var{noerror} is non-@code{nil}. 692if loading the file fails. Normally, @code{require} returns
693@var{feature}.
694
695If loading the file succeeds but does not provide @var{feature},
696@code{require} signals an error, @samp{Required feature @var{feature}
697was not provided}.
693@end defun 698@end defun
694 699
695@defun featurep feature &optional subfeature 700@defun featurep feature &optional subfeature
diff --git a/lispref/modes.texi b/lispref/modes.texi
index d92ea309ed7..040c229bb00 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -879,8 +879,9 @@ The command should accept one optional argument. If the argument is
879off if it is on). It should turn the mode on if the argument is a 879off if it is on). It should turn the mode on if the argument is a
880positive integer, the symbol @code{t}, or a list whose @sc{car} is one 880positive integer, the symbol @code{t}, or a list whose @sc{car} is one
881of those. It should turn the mode off if the argument is a negative 881of those. It should turn the mode off if the argument is a negative
882integer or zero, the symbol @code{-}, or a list whose @sc{car} is one 882integer or zero, the symbol @code{-}, or a list whose @sc{car} is a
883of those. The meaning of other arguments is not specified. 883negative integer or zero. The meaning of other arguments is not
884specified.
884 885
885Here is an example taken from the definition of @code{transient-mark-mode}. 886Here is an example taken from the definition of @code{transient-mark-mode}.
886It shows the use of @code{transient-mark-mode} as a variable that enables or 887It shows the use of @code{transient-mark-mode} as a variable that enables or
diff --git a/lispref/variables.texi b/lispref/variables.texi
index f4c56ede4d9..c395702a40a 100644
--- a/lispref/variables.texi
+++ b/lispref/variables.texi
@@ -1769,8 +1769,8 @@ nor any other file local variable. It does not check whether a mode
1769is specified in the local variables list at the end of the file. 1769is specified in the local variables list at the end of the file.
1770@end defun 1770@end defun
1771 1771
1772 If a file local variable list could specify a function that will 1772 If a file local variable list could specify a function that would
1773be called later, or an expression that will be executed later, simply 1773be called later, or an expression that would be executed later, simply
1774visiting a file could take over your Emacs. To prevent this, Emacs 1774visiting a file could take over your Emacs. To prevent this, Emacs
1775takes care not to allow local variable lists to set such variables. 1775takes care not to allow local variable lists to set such variables.
1776 1776
diff --git a/mac/ChangeLog b/mac/ChangeLog
index aa6e9844fee..7283b3e2aed 100644
--- a/mac/ChangeLog
+++ b/mac/ChangeLog
@@ -1,3 +1,9 @@
12004-05-29 Steven Tamm <steventamm@mac.com>
2
3 * INSTALL: Fixing typos
4 * README: Updating list of TODOs to remove image support and
5 environment variable problem.
6
12004-01-14 Stefan Monnier <monnier@iro.umontreal.ca> 72004-01-14 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * src/Emacs.r: Update TOO_MUCH_RAM error message. 9 * src/Emacs.r: Update TOO_MUCH_RAM error message.
diff --git a/mac/INSTALL b/mac/INSTALL
index def7913f83a..88306ae0573 100644
--- a/mac/INSTALL
+++ b/mac/INSTALL
@@ -165,7 +165,7 @@ to build Emacs. MPW-GM can be downloaded free of charge from Apple.
165In either case, you will need MPW-GM to build the make-docfile utility 165In either case, you will need MPW-GM to build the make-docfile utility
166and to generate the doc string file DOC. 166and to generate the doc string file DOC.
167 167
168### IMPORTANT ### You can use StuffIf Expander to decompress and untar 168### IMPORTANT ### You can use StuffIt Expander to decompress and untar
169the distribution. However, you *must* set the radio button in the 169the distribution. However, you *must* set the radio button in the
170Preferences->Cross Platform->Convert text files to Macintosh format to 170Preferences->Cross Platform->Convert text files to Macintosh format to
171"Never". Otherwise the compiled Lisp files will be corrupted. 171"Never". Otherwise the compiled Lisp files will be corrupted.
@@ -200,7 +200,7 @@ dialog and include the Profiler PPC.Lib library.
200 200
201* NOTES 201* NOTES
202 202
203Emacs should build and run on a PowerMac running Mac OS 8.6 - 10.2. 203Emacs should build and run on a PowerMac running Mac OS 8.6 - 10.3.
204 204
205You will need around 100 MB of disk space for the source files and 205You will need around 100 MB of disk space for the source files and
206intermediate files. 206intermediate files.
diff --git a/mac/README b/mac/README
index 1e0a71006db..2163ea191c3 100644
--- a/mac/README
+++ b/mac/README
@@ -1,6 +1,6 @@
1Emacs for Mac OS 8/9 and Mac OS X 1Emacs for Mac OS 8/9 and Mac OS X
2 2
3Copyright (c) 2001, 2002 Free Software Foundation, Inc. 3Copyright (c) 2001-4 Free Software Foundation, Inc.
4 4
5 Permission is granted to anyone to make or distribute verbatim 5 Permission is granted to anyone to make or distribute verbatim
6 copies of this document as received, in any medium, provided that 6 copies of this document as received, in any medium, provided that
@@ -45,18 +45,18 @@ use Emacs on the Mac.
45 45
46A number of things do not work yet: 46A number of things do not work yet:
47 47
48+ On Mac OS X, environment variables are not set up correctly when 48+ Emacs does not respond correctly to C-g under certain circumstances.
49 Emacs is started from the Finder. 49 Sending the Emacs process a SIGINT externally will cause it
50 to interrupt. This is due to the architecture of OSX's
51 Window Manager.
50 52
51+ Emacs does not respond correctly to C-g when it is not reading 53+ Support for certain image types (such as XPM) is not as extensive as
52 input. 54 on other plaforms.
53
54+ No image support yet.
55 55
56If your Mac is connected to the Internet, report bugs by typing `M-x 56If your Mac is connected to the Internet, report bugs by typing `M-x
57report-emacs-bug' or by choosing the entry `Send Bug Report...' in 57report-emacs-bug' or by choosing the entry `Send Bug Report...' in
58the `Help' menu. This will send the bug report to the address 58the `Help' menu. This will send the bug report to the address
59emacs-pretest-bug@gnu.org. 59emacs-pretest-bug@gnu.org.
60 60
61Andrew. 61Steven
62<akochoi@mac.com> 62<steven.tamm@mac.com>
diff --git a/man/ChangeLog b/man/ChangeLog
index ffd8bae6a2e..9d0e220fe96 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,57 @@
12004-05-29 Michael Albinus <michael.albinus@gmx.de>
2
3 Version 2.0.41 of Tramp released.
4
52004-05-29 Juanma Barranquero <lektu@terra.es>
6
7 * makefile.w32-in (../info/flymake, flymake.dvi): New targets.
8 (INFO_TARGETS, DVI_TARGETS): Add Flymake.
9
102004-05-29 Richard M. Stallman <rms@gnu.org>
11
12 * custom.texi (Init File): Two dashes start --no-site-file.
13
14 * cl.texi (Top): Call this chapter `Introduction'.
15 (Overview): In TeX, no section heading here.
16
17 * cc-mode.texi: Put commas after i.e. and e.g. Minor cleanups.
18
192004-05-29 Alan Mackenzie <acm@muc.de>
20
21 * programs.texi: Update for CC Mode 5.30 and incidental amendments.
22 ("AWK"): Is consistently thus spelt throughout.
23 (AWK, Pike): Document as "C-like modes".
24 (@kbd{M-j}): Document as alternative to @kbd{C-M-j}.
25 (M-x man): Supersedes M-x manual-entry.
26 Add numerous index entries. Correct "ESC a/e" to "M-a/e".
27
28 ("Comments in C"): Delete node; the info is in CC Mode manual.
29 (c-comment-only-line-offset): Remove description.
30
31 (C-c ., C-c C-c): Describe new C Mode bindings.
32
33 (C-u TAB, indent-code-rigidly, c-indent-exp, c-tab-always-indent)
34 (@dfn{Style}, c-default-style, comment-column, comment-padding)
35 (c-up-conditional, c-beginning-of-statement, c-end-of-statement):
36 Amend definitions.
37
38 (c-beginning-of-defun, c-end-of-defun, c-context-line-break):
39 Describe functions.
40
41 (c-comment-start-regexp, c-hanging-comment-ender-p)
42 (c-hanging-comment-starter-p): Remove obsolete definitions.
43
44 * emacs.texi: Remove the menu entry "Comments in C".
45
462004-05-29 Eli Zaretskii <eliz@gnu.org>
47
48 * Makefile.in (../info/flymake, flymake.dvi): New targets.
49 (INFO_TARGETS, DVI_TARGETS): Add Flymake.
50
512004-05-29 Pavel Kobiakov <pk_at_work@yahoo.com>
52
53 * flymake.texi: New file.
54
12004-05-28 Simon Josefsson <jas@extundo.com> 552004-05-28 Simon Josefsson <jas@extundo.com>
2 56
3 * smtpmail.texi (Authentication): Improve STARTTLS discussion. 57 * smtpmail.texi (Authentication): Improve STARTTLS discussion.
@@ -28,7 +82,8 @@
28 82
29 * tramp.texi (Auto-save and Backup): Explain exploitation of new 83 * tramp.texi (Auto-save and Backup): Explain exploitation of new
30 variables `tramp-backup-directory-alist' and 84 variables `tramp-backup-directory-alist' and
31 `tramp-bkup-backup-directory-info'. (Overview, Connection types) 85 `tramp-bkup-backup-directory-info'.
86 (Overview, Connection types)
32 (External transfer methods, Default Method) 87 (External transfer methods, Default Method)
33 (Windows setup hints): Remove restriction of password entering 88 (Windows setup hints): Remove restriction of password entering
34 with external methods. 89 with external methods.
@@ -46,7 +101,7 @@
46 101
472004-05-04 Jason Rumney <jasonr@gnu.org> 1022004-05-04 Jason Rumney <jasonr@gnu.org>
48 103
49 * makefile.w32-in: Revert last change 104 * makefile.w32-in: Revert last change.
50 105
512004-05-03 Jason Rumney <jasonr@gnu.org> 1062004-05-03 Jason Rumney <jasonr@gnu.org>
52 107
@@ -54,8 +109,7 @@
54 109
552004-04-28 Masatake YAMATO <jet@gyve.org> 1102004-04-28 Masatake YAMATO <jet@gyve.org>
56 111
57 * widget.texi (Programming Example): Remove 112 * widget.texi (Programming Example): Remove overlays.
58 overlays.
59 113
602004-04-27 Jesper Harder <harder@ifa.au.dk> 1142004-04-27 Jesper Harder <harder@ifa.au.dk>
61 115
@@ -192,7 +246,7 @@
192 246
193 * ses.texi (Advanced Features): New functionality for 247 * ses.texi (Advanced Features): New functionality for
194 ses-set-header-row (defaults to current row unless C-u used). 248 ses-set-header-row (defaults to current row unless C-u used).
195 (Acknowledgements): Added Stefan Monnier. 249 (Acknowledgements): Add Stefan Monnier.
196 250
1972004-02-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 2512004-02-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
198 252
@@ -254,7 +308,7 @@
254 308
2552003-11-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 3092003-11-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
256 310
257 * frames.texi (Dialog Boxes): Added use-file-dialog. 311 * frames.texi (Dialog Boxes): Add use-file-dialog.
258 312
2592003-11-26 Thien-Thi Nguyen <ttn@gnu.org> 3132003-11-26 Thien-Thi Nguyen <ttn@gnu.org>
260 314
@@ -267,7 +321,7 @@
267 321
2682003-11-22 Martin Stjernholm <bug-cc-mode@gnu.org> 3222003-11-22 Martin Stjernholm <bug-cc-mode@gnu.org>
269 323
270 * cc-mode.texi: Updated for CC Mode 5.30. 324 * cc-mode.texi: Update for CC Mode 5.30.
271 325
272 Note: Please refrain from doing purely cosmetic changes like 326 Note: Please refrain from doing purely cosmetic changes like
273 removing trailing whitespace in this manual; it clobbers cvs 327 removing trailing whitespace in this manual; it clobbers cvs
@@ -320,8 +374,8 @@
320 374
3212003-10-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 3752003-10-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
322 376
323 * xresources.texi (GTK resources): Added a note that some themes 377 * xresources.texi (GTK resources): Add a note that some themes
324 disallow customizations. Added scroll theme example. 378 disallow customizations. Add scroll theme example.
325 379
3262003-10-08 Nick Roberts <nick@nick.uklinux.net> 3802003-10-08 Nick Roberts <nick@nick.uklinux.net>
327 381
@@ -379,7 +433,7 @@
379 433
3802003-09-21 Karl Berry <karl@gnu.org> 4342003-09-21 Karl Berry <karl@gnu.org>
381 435
382 * info.texi (] and [ commands): no period at end of section title. 436 * info.texi (] and [ commands): No period at end of section title.
383 437
3842003-09-08 Lute Kamstra <lute@gnu.org> 4382003-09-08 Lute Kamstra <lute@gnu.org>
385 439
@@ -392,7 +446,7 @@
3922003-09-07 Luc Teirlinck <teirllm@mail.auburn.edu> 4462003-09-07 Luc Teirlinck <teirllm@mail.auburn.edu>
393 447
394 * xresources.texi (Resources): Refer to `editres' man page. 448 * xresources.texi (Resources): Refer to `editres' man page.
395 (Lucid Resources): Update defaults. Expand desciption of 449 (Lucid Resources): Update defaults. Expand description of
396 `shadowThickness'. 450 `shadowThickness'.
397 451
3982003-09-04 Miles Bader <miles@gnu.org> 4522003-09-04 Miles Bader <miles@gnu.org>
@@ -432,7 +486,7 @@
432 section. 486 section.
433 * emacs.texi (Intro): Include kmacro.texi after custom.texi. 487 * emacs.texi (Intro): Include kmacro.texi after custom.texi.
434 (Suggested by Kim Storm.) 488 (Suggested by Kim Storm.)
435 * Makefile (EMACSSOURCES): Add kmacro.texi. (Suggested by Kim 489 * Makefile (EMACSSOURCES): Add kmacro.texi. (Suggested by Kim
436 Storm.) 490 Storm.)
437 491
4382003-08-18 Kim F. Storm <storm@cua.dk> 4922003-08-18 Kim F. Storm <storm@cua.dk>
@@ -472,7 +526,7 @@
472 526
4732003-08-03 Karl Berry <karl@gnu.org> 5272003-08-03 Karl Berry <karl@gnu.org>
474 528
475 * info.texi: need @contents. 529 * info.texi: Need @contents.
476 530
4772003-08-03 Glenn Morris <gmorris@ast.cam.ac.uk> 5312003-08-03 Glenn Morris <gmorris@ast.cam.ac.uk>
478 532
@@ -610,7 +664,7 @@
6102003-03-29 Richard M. Stallman <rms@gnu.org> 6642003-03-29 Richard M. Stallman <rms@gnu.org>
611 665
612 * tramp.texi (Top): Undo the previous renaming. 666 * tramp.texi (Top): Undo the previous renaming.
613 (emacs-other-name, emacs-other-dir, emacs-other-file-name): Deleted. 667 (emacs-other-name, emacs-other-dir, emacs-other-file-name): Delete.
614 668
6152003-03-29 Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net> 6692003-03-29 Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net>
616 670
@@ -714,7 +768,7 @@
714 768
7152003-01-09 Francesco Potort,Al(B <pot@gnu.org> 7692003-01-09 Francesco Potort,Al(B <pot@gnu.org>
716 770
717 * maintaining.texi (Create Tags Table): Added reference to the new 771 * maintaining.texi (Create Tags Table): Add reference to the new
718 `etags --help --lang=LANG' option. 772 `etags --help --lang=LANG' option.
719 773
7202002-12-26 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> 7742002-12-26 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de>
@@ -724,7 +778,7 @@
724 778
7252002-11-05 Karl Berry <karl@gnu.org> 7792002-11-05 Karl Berry <karl@gnu.org>
726 780
727 * info.texi (Info-fontify): reorder face list to avoid bad line 781 * info.texi (Info-fontify): Reorder face list to avoid bad line
728 breaks. 782 breaks.
729 783
7302002-10-06 Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> 7842002-10-06 Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
@@ -742,8 +796,8 @@
742 Per rms, update all manuals to use @copying instead of @ifinfo. 796 Per rms, update all manuals to use @copying instead of @ifinfo.
743 Also use @ifnottex instead of @ifinfo around the top node, where 797 Also use @ifnottex instead of @ifinfo around the top node, where
744 needed for the sake of the HTML output. 798 needed for the sake of the HTML output.
745 (The gnus manual is not fixed since it's not clear to me how it 799 (The Gnus manual is not fixed since it's not clear to me how it
746 works; and the tramp manual already uses @copying, although in an 800 works; and the Tramp manual already uses @copying, although in an
747 unusual way. All others were changed.) 801 unusual way. All others were changed.)
748 802
7492002-09-10 Jonathan Yavner <jyavner@engineer.com> 8032002-09-10 Jonathan Yavner <jyavner@engineer.com>
@@ -754,7 +808,7 @@
754 808
7552002-09-06 Pavel Jan,Bm(Bk <Pavel@Janik.cz> 8092002-09-06 Pavel Jan,Bm(Bk <Pavel@Janik.cz>
756 810
757 * texinfo.tex: Updated to texinfo 4.2. 811 * texinfo.tex: Update to texinfo 4.2.
758 812
7592002-08-27 Carsten Dominik <dominik@sand.science.uva.nl> 8132002-08-27 Carsten Dominik <dominik@sand.science.uva.nl>
760 814
@@ -812,11 +866,11 @@
812 866
8132000-10-19 Eric M. Ludlam <zappo@ultranet.com> 8672000-10-19 Eric M. Ludlam <zappo@ultranet.com>
814 868
815 * Makefile.in (Speedbar): Added build targets for speedbar.texi. 869 * Makefile.in (Speedbar): Add build targets for speedbar.texi.
816 870
8172000-10-13 John Wiegley <johnw@gnu.org> 8712000-10-13 John Wiegley <johnw@gnu.org>
818 872
819 * Makefile.in: Added build targets for eshell.texi. 873 * Makefile.in: Add build targets for eshell.texi.
820 874
8212000-09-25 Gerd Moellmann <gerd@gnu.org> 8752000-09-25 Gerd Moellmann <gerd@gnu.org>
822 876
@@ -848,14 +902,14 @@
8482000-01-13 Gerd Moellmann <gerd@gnu.org> 9022000-01-13 Gerd Moellmann <gerd@gnu.org>
849 903
850 * Makefile.in (INFO_TARGETS): Add eudc. 904 * Makefile.in (INFO_TARGETS): Add eudc.
851 (DVI_TARGETS): Add eudc.dvi 905 (DVI_TARGETS): Add eudc.dvi.
852 (../info/eudc, eudc.dvi): New targets. 906 (../info/eudc, eudc.dvi): New targets.
853 907
8542000-01-05 Eli Zaretskii <eliz@is.elta.co.il> 9082000-01-05 Eli Zaretskii <eliz@is.elta.co.il>
855 909
856 * Makefile.in (INFO_TARGETS): Rename emacs-faq to efaq (for 910 * Makefile.in (INFO_TARGETS): Rename emacs-faq to efaq (for
857 compatibility with 8+3 filesystems). 911 compatibility with 8+3 filesystems).
858 (../info/efaq): Renamed from emacs-faq. 912 (../info/efaq): Rename from emacs-faq.
859 913
8602000-01-03 Eli Zaretskii <eliz@is.elta.co.il> 9142000-01-03 Eli Zaretskii <eliz@is.elta.co.il>
861 915
@@ -868,7 +922,7 @@
868 922
8691999-10-12 Stefan Monnier <monnier@cs.yale.edu> 9231999-10-12 Stefan Monnier <monnier@cs.yale.edu>
870 924
871 * Makefile.in (faq): use ../info/emacs-faq.info (as specified in the 925 * Makefile.in (faq): Use ../info/emacs-faq.info (as specified in the
872 faq.texi file) rather than ../info/faq. 926 faq.texi file) rather than ../info/faq.
873 927
8741999-10-07 Gerd Moellmann <gerd@gnu.org> 9281999-10-07 Gerd Moellmann <gerd@gnu.org>
@@ -907,7 +961,7 @@
907 961
9081998-03-11 Carsten Dominik <cd@delysid.gnu.org> 9621998-03-11 Carsten Dominik <cd@delysid.gnu.org>
909 963
910 * reftex.texi Updated for RefTeX version 3.22. 964 * reftex.texi: Update for RefTeX version 3.22.
911 965
9121998-02-08 Richard Stallman <rms@psilocin.gnu.org> 9661998-02-08 Richard Stallman <rms@psilocin.gnu.org>
913 967
@@ -918,7 +972,7 @@
918 972
919 * Makefile.in: Merge changes mistakenly made to `Makefile'. 973 * Makefile.in: Merge changes mistakenly made to `Makefile'.
920 (INFO_TARGETS): Change ../info/custom to ../info/customize. 974 (INFO_TARGETS): Change ../info/custom to ../info/customize.
921 (../info/customize): Renamed from ../info/custom. 975 (../info/customize): Rename from ../info/custom.
922 (../info/viper, viper.dvi): Remove dependency on viper-cmd.texi. 976 (../info/viper, viper.dvi): Remove dependency on viper-cmd.texi.
923 977
9241997-09-19 Richard Stallman <rms@psilocin.gnu.ai.mit.edu> 9781997-09-19 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
@@ -973,7 +1027,7 @@
973 1027
9741996-01-07 Richard Stallman <rms@whiz-bang.gnu.ai.mit.edu> 10281996-01-07 Richard Stallman <rms@whiz-bang.gnu.ai.mit.edu>
975 1029
976 * Makefile.in (../info/ccmode): Renamed from ../info/cc-mode. 1030 * Makefile.in (../info/ccmode): Rename from ../info/cc-mode.
977 (INFO_TARGETS): Use new name. This avoids name conflict on MSDOS. 1031 (INFO_TARGETS): Use new name. This avoids name conflict on MSDOS.
978 1032
9791995-11-29 Richard Stallman <rms@mole.gnu.ai.mit.edu> 10331995-11-29 Richard Stallman <rms@mole.gnu.ai.mit.edu>
@@ -1022,7 +1076,7 @@
1022 1076
10231995-02-07 Richard Stallman <rms@pogo.gnu.ai.mit.edu> 10771995-02-07 Richard Stallman <rms@pogo.gnu.ai.mit.edu>
1024 1078
1025 * Makefile.in (maintainer-clean): Renamed from realclean. 1079 * Makefile.in (maintainer-clean): Rename from realclean.
1026 1080
10271994-11-23 Richard Stallman <rms@mole.gnu.ai.mit.edu> 10811994-11-23 Richard Stallman <rms@mole.gnu.ai.mit.edu>
1028 1082
@@ -1073,7 +1127,7 @@
1073 1127
10741994-01-08 Richard Stallman (rms@mole.gnu.ai.mit.edu) 11281994-01-08 Richard Stallman (rms@mole.gnu.ai.mit.edu)
1075 1129
1076 * Makefile (../info/sc): Renamed frin sc.info. 1130 * Makefile (../info/sc): Rename frin sc.info.
1077 (../info/cl): Likewise. 1131 (../info/cl): Likewise.
1078 (INFO_TARGETS): Use new names. 1132 (INFO_TARGETS): Use new names.
1079 1133
@@ -1088,7 +1142,7 @@
1088 1142
10891993-12-03 Richard Stallman (rms@srarc2) 11431993-12-03 Richard Stallman (rms@srarc2)
1090 1144
1091 * Makefile (../info/sc.info): Renamed from ../info/sc. 1145 * Makefile (../info/sc.info): Rename from ../info/sc.
1092 (TEXI2DVI): New variable. 1146 (TEXI2DVI): New variable.
1093 (emacs.dvi, cl.dvi forms.dvi, sc.dvi, vip.dvi, gnus.dvi, info.dvi): 1147 (emacs.dvi, cl.dvi forms.dvi, sc.dvi, vip.dvi, gnus.dvi, info.dvi):
1094 Add explicit commands. 1148 Add explicit commands.
@@ -1108,7 +1162,7 @@
1108 1162
11091993-11-15 Paul Eggert (eggert@twinsun.com) 11631993-11-15 Paul Eggert (eggert@twinsun.com)
1110 1164
1111 * man/Makefile (../info/cl.info): Renamed from ../info/cl. 1165 * man/Makefile (../info/cl.info): Rename from ../info/cl.
1112 1166
11131993-11-15 Richard Stallman (rms@mole.gnu.ai.mit.edu) 11671993-11-15 Richard Stallman (rms@mole.gnu.ai.mit.edu)
1114 1168
@@ -1122,7 +1176,7 @@
11221993-10-25 Brian Fox (bfox@albert.gnu.ai.mit.edu) 11761993-10-25 Brian Fox (bfox@albert.gnu.ai.mit.edu)
1123 1177
1124 * forms.texi: Fix forms.texi so that it will format correctly. 1178 * forms.texi: Fix forms.texi so that it will format correctly.
1125 Added missing `@end iftex', fixed bad reference. 1179 Add missing `@end iftex', fix bad reference.
1126 1180
1127 * info.texi, info-stn.texi: New files implement texinfo version of 1181 * info.texi, info-stn.texi: New files implement texinfo version of
1128 `info' file. 1182 `info' file.
@@ -1135,7 +1189,7 @@
1135 * Makefile: Fix targets for texindex, new info.texi files. 1189 * Makefile: Fix targets for texindex, new info.texi files.
1136 * info-stnd.texi: New file implements info for standalone info 1190 * info-stnd.texi: New file implements info for standalone info
1137 reader. 1191 reader.
1138 * info.texi: Updated to include recent changes to "../info/info". 1192 * info.texi: Update to include recent changes to "../info/info".
1139 New source file for ../info/info; includes info-stnd.texi. 1193 New source file for ../info/info; includes info-stnd.texi.
1140 1194
1141 * texindex.c: Include "../src/config.h" if building in emacs. 1195 * texindex.c: Include "../src/config.h" if building in emacs.
@@ -1155,8 +1209,8 @@
1155 1209
1156 * sc.texinfo: Fix info file name. 1210 * sc.texinfo: Fix info file name.
1157 1211
1158 * Makefile (info): Added gnus and sc. 1212 * Makefile (info): Add gnus and sc.
1159 (dvi): Added gnus.dvi and sc.dvi. 1213 (dvi): Add gnus.dvi and sc.dvi.
1160 (../info/sc, sc.dvi): New targets. 1214 (../info/sc, sc.dvi): New targets.
1161 1215
11621993-08-08 Richard Stallman (rms@mole.gnu.ai.mit.edu) 12161993-08-08 Richard Stallman (rms@mole.gnu.ai.mit.edu)
@@ -1228,42 +1282,42 @@
1228 1282
12291993-04-25 Eric S. Raymond (eric@mole.gnu.ai.mit.edu) 12831993-04-25 Eric S. Raymond (eric@mole.gnu.ai.mit.edu)
1230 1284
1231 * basic.texi: Documented next-line-add-lines variable used to 1285 * basic.texi: Document next-line-add-lines variable used to
1232 implement down-arrow. 1286 implement down-arrow.
1233 1287
1234 * killing.texi: Documented kill-whole-line. 1288 * killing.texi: Document kill-whole-line.
1235 1289
12361993-04-18 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) 12901993-04-18 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu)
1237 1291
1238 * text.texi: Updated unix TeX ordering information. 1292 * text.texi: Update unix TeX ordering information.
1239 1293
12401993-03-26 Eric S. Raymond (eric@geech.gnu.ai.mit.edu) 12941993-03-26 Eric S. Raymond (eric@geech.gnu.ai.mit.edu)
1241 1295
1242 * news.texi: Mentioned fill-rectangle in keybinding list. 1296 * news.texi: Mention fill-rectangle in keybinding list.
1243 1297
1244 * killing.texi: Documented fill-rectangle. 1298 * killing.texi: Document fill-rectangle.
1245 1299
12461993-03-17 Eric S. Raymond (eric@mole.gnu.ai.mit.edu) 13001993-03-17 Eric S. Raymond (eric@mole.gnu.ai.mit.edu)
1247 1301
1248 * vc.texi: Brought the docs up to date with VC 5.2. 1302 * vc.texi: Bring the docs up to date with VC 5.2.
1249 1303
12501992-01-10 Eric S. Raymond (eric@mole.gnu.ai.mit.edu) 13041992-01-10 Eric S. Raymond (eric@mole.gnu.ai.mit.edu)
1251 1305
1252 * emacs.tex: Mentioned blackbox and gomoku under Amusements. 1306 * emacs.tex: Mention blackbox and gomoku under Amusements.
1253 Assembler mode is now mentioned and appropriately 1307 Assembler mode is now mentioned and appropriately indexed
1254 indexed under Programming Modes. 1308 under Programming Modes.
1255 1309
12561991-02-15 Robert J. Chassell (bob@wookumz.ai.mit.edu) 13101991-02-15 Robert J. Chassell (bob@wookumz.ai.mit.edu)
1257 1311
1258 * emacs.tex: Updated TeX ordering information. 1312 * emacs.tex: Update TeX ordering information.
1259 1313
12601990-08-30 David Lawrence (tale@pogo.ai.mit.edu) 13141990-08-30 David Lawrence (tale@pogo.ai.mit.edu)
1261 1315
1262 * gnus.texinfo: New file. Removed installation instructions. 1316 * gnus.texinfo: New file. Removed installation instructions.
1263 1317
12641990-06-26 David Lawrence (tale@geech) 13181990-06-26 David Lawrence (tale@geech)
1265 1319
1266 * emacs.tex: Noted that completion-ignored-extensions is not used 1320 * emacs.tex: Note that completion-ignored-extensions is not used
1267 to filter out names when all completions are displayed in 1321 to filter out names when all completions are displayed in
1268 *Completions*. 1322 *Completions*.
1269 1323
@@ -1277,22 +1331,22 @@
1277 1331
12781989-01-17 Robert J. Chassell (bob@rice-chex.ai.mit.edu) 13321989-01-17 Robert J. Chassell (bob@rice-chex.ai.mit.edu)
1279 1333
1280 * texinfo.tex: Changed spelling of `\sc' font to `\smallcaps' and 1334 * texinfo.tex: Change spelling of `\sc' font to `\smallcaps' and
1281 then defined `\sc' as the command for smallcaps in Texinfo. This 1335 then define `\sc' as the command for smallcaps in Texinfo. This
1282 measns that the @sc command will produce small caps. bfox has 1336 means that the @sc command will produce small caps. bfox has
1283 made the corresponding change to makeinfo and texinfm.el. 1337 made the corresponding change to makeinfo and texinfm.el.
1284 1338
12851988-08-16 Robert J. Chassell (bob@frosted-flakes.ai.mit.edu) 13391988-08-16 Robert J. Chassell (bob@frosted-flakes.ai.mit.edu)
1286 1340
1287 * emacs.tex: Corrected two typos. No other changes before 1341 * emacs.tex: Correct two typos. No other changes before
1288 Version 19 will be made. 1342 Version 19 will be made.
1289 1343
1290 * vip.texinfo: Removed menu entry Adding Lisp Code in node 1344 * vip.texinfo: Remove menu entry Adding Lisp Code in node
1291 Customization since the menu entry did not point to anything. 1345 Customization since the menu entry did not point to anything.
1292 Also added an @finalout command to remove overfull hboxes from the 1346 Also add an @finalout command to remove overfull hboxes from the
1293 printed output. 1347 printed output.
1294 1348
1295 * cl.texinfo: Added @bye, \input line and @settitle to file. 1349 * cl.texinfo: Add @bye, \input line and @settitle to file.
1296 This file is clearly intended to be a chapter of some other work, 1350 This file is clearly intended to be a chapter of some other work,
1297 but the other work does not yet exist. 1351 but the other work does not yet exist.
1298 1352
diff --git a/man/Makefile.in b/man/Makefile.in
index e1b971010b0..99970c3c0ab 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -40,13 +40,14 @@ INFO_TARGETS = ../info/emacs ../info/ccmode ../info/cl \
40 ../info/efaq ../info/ada-mode ../info/autotype ../info/calc \ 40 ../info/efaq ../info/ada-mode ../info/autotype ../info/calc \
41 ../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \ 41 ../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \
42 ../info/woman ../info/emacs-mime ../info/eshell \ 42 ../info/woman ../info/emacs-mime ../info/eshell \
43 ../info/speedbar ../info/tramp ../info/ses ../info/smtpmail 43 ../info/speedbar ../info/tramp ../info/ses ../info/smtpmail \
44 ../info/flymake
44DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \ 45DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
45 ediff.dvi forms.dvi gnus.dvi message.dvi mh-e.dvi \ 46 ediff.dvi forms.dvi gnus.dvi message.dvi mh-e.dvi \
46 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \ 47 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
47 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \ 48 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
48 pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \ 49 pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \
49 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi 50 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi
50INFOSOURCES = info.texi 51INFOSOURCES = info.texi
51 52
52# The following rule does not work with all versions of `make'. 53# The following rule does not work with all versions of `make'.
@@ -287,6 +288,11 @@ ses.dvi: ses.texi
287smtpmail.dvi: smtpmail.texi 288smtpmail.dvi: smtpmail.texi
288 $(ENVADD) $(TEXI2DVI) ${srcdir}/smtpmail.texi 289 $(ENVADD) $(TEXI2DVI) ${srcdir}/smtpmail.texi
289 290
291../info/flymake: flymake.texi
292 cd $(srcdir); $(MAKEINFO) flymake.texi
293flymake.dvi: flymake.texi
294 $(ENVADD) $(TEXI2DVI) ${srcdir}/flymake.texi
295
290mostlyclean: 296mostlyclean:
291 rm -f *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.* 297 rm -f *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
292 298
diff --git a/man/cc-mode.texi b/man/cc-mode.texi
index 0f1e65051d8..c3b7dd4833f 100644
--- a/man/cc-mode.texi
+++ b/man/cc-mode.texi
@@ -354,7 +354,7 @@ Syntactic analysis for indentation is done when this is non-@code{nil}
354indented to the same level as the previous one, and @kbd{TAB} 354indented to the same level as the previous one, and @kbd{TAB}
355(@code{c-indent-command}) adjusts the indentation in steps of 355(@code{c-indent-command}) adjusts the indentation in steps of
356@code{c-basic-offset}. The indentation style has no effect, nor any of 356@code{c-basic-offset}. The indentation style has no effect, nor any of
357the indentation associated variables, e.g. @code{c-special-indent-hook}. 357the indentation associated variables, e.g., @code{c-special-indent-hook}.
358@end defopt 358@end defopt
359 359
360@menu 360@menu
@@ -381,7 +381,7 @@ elements (in lisp parlance, a @emph{cons cell}), the first being
381a @dfn{syntactic symbol}, the second being a @dfn{relative 381a @dfn{syntactic symbol}, the second being a @dfn{relative
382buffer position}. Syntactic symbols describe elements of C code 382buffer position}. Syntactic symbols describe elements of C code
383@footnote{Unless otherwise noted, the term ``C code'' refers to all 383@footnote{Unless otherwise noted, the term ``C code'' refers to all
384the C-like languages.}, e.g. @code{statement}, @code{substatement}, 384the C-like languages.}, e.g., @code{statement}, @code{substatement},
385@code{class-open}, @code{class-close}, etc. @xref{Syntactic Symbols}, 385@code{class-open}, @code{class-close}, etc. @xref{Syntactic Symbols},
386for a complete list of currently recognized syntactic symbols and their 386for a complete list of currently recognized syntactic symbols and their
387semantics. The style variable @code{c-offsets-alist} also contains the 387semantics. The style variable @code{c-offsets-alist} also contains the
@@ -411,7 +411,7 @@ We can use the command @kbd{C-c C-s} (bound to
411@code{c-show-syntactic-information}) to simply report what the 411@code{c-show-syntactic-information}) to simply report what the
412syntactic analysis is for the current line. Running this command on 412syntactic analysis is for the current line. Running this command on
413line 4 of this example, we'd see in the echo area@footnote{With a 413line 4 of this example, we'd see in the echo area@footnote{With a
414universal argument (i.e. @kbd{C-u C-c C-s}) the analysis is inserted 414universal argument (i.e., @kbd{C-u C-c C-s}) the analysis is inserted
415into the buffer as a comment on the current line.}: 415into the buffer as a comment on the current line.}:
416 416
417@example 417@example
@@ -677,7 +677,7 @@ definition. These constructs are also known as @dfn{syntactic
677whitespace} since they are usually ignored when scanning C code.}. 677whitespace} since they are usually ignored when scanning C code.}.
678 678
679@item 679@item
680No numeric argument was supplied to the command (i.e. it was typed as 680No numeric argument was supplied to the command (i.e., it was typed as
681normal, with no @kbd{C-u} prefix). 681normal, with no @kbd{C-u} prefix).
682@end itemize 682@end itemize
683 683
@@ -702,7 +702,7 @@ normal, with no @kbd{C-u} prefix).
702@kindex @{ 702@kindex @{
703@kindex @} 703@kindex @}
704 704
705When you type either an open or close brace (i.e. @kbd{@{} or @kbd{@}}), 705When you type either an open or close brace (i.e., @kbd{@{} or @kbd{@}}),
706the electric command @code{c-electric-brace} gets run. This command has 706the electric command @code{c-electric-brace} gets run. This command has
707two electric formatting behaviors. First, it will perform some 707two electric formatting behaviors. First, it will perform some
708reindentation of the line the brace was typed on, and second, it will 708reindentation of the line the brace was typed on, and second, it will
@@ -973,7 +973,7 @@ modes except IDL mode, since CORBA IDL doesn't have any statements.
973@dfn{Clean-ups} are mechanisms complementary to colon and brace hanging. 973@dfn{Clean-ups} are mechanisms complementary to colon and brace hanging.
974On the surface, it would seem that clean-ups overlap the functionality 974On the surface, it would seem that clean-ups overlap the functionality
975provided by the @code{c-hanging-*-alist} variables. Clean-ups are 975provided by the @code{c-hanging-*-alist} variables. Clean-ups are
976however used to adjust code ``after-the-fact,'' i.e. to adjust the 976however used to adjust code ``after-the-fact,'' i.e., to adjust the
977whitespace in constructs after they are typed. 977whitespace in constructs after they are typed.
978 978
979Most of the clean-ups are only applicable to counteract automatically 979Most of the clean-ups are only applicable to counteract automatically
@@ -1146,7 +1146,7 @@ minor mode:
1146@item space-before-funcall 1146@item space-before-funcall
1147Insert a space between the function name and the opening parenthesis of 1147Insert a space between the function name and the opening parenthesis of
1148a function call. This produces function calls in the style mandated by 1148a function call. This produces function calls in the style mandated by
1149the GNU coding standards, e.g. @samp{signal (SIGINT, SIG_IGN)} and 1149the GNU coding standards, e.g., @samp{signal (SIGINT, SIG_IGN)} and
1150@samp{abort ()}. Clean up occurs when the opening parenthesis is typed. 1150@samp{abort ()}. Clean up occurs when the opening parenthesis is typed.
1151 1151
1152@item compact-empty-funcall 1152@item compact-empty-funcall
@@ -1154,7 +1154,7 @@ Clean up any space between the function name and the opening parenthesis
1154of a function call that has no arguments. This is typically used 1154of a function call that has no arguments. This is typically used
1155together with @code{space-before-funcall} if you prefer the GNU function 1155together with @code{space-before-funcall} if you prefer the GNU function
1156call style for functions with arguments but think it looks ugly when 1156call style for functions with arguments but think it looks ugly when
1157it's only an empty parenthesis pair. I.e. you will get @samp{signal 1157it's only an empty parenthesis pair. I.e., you will get @samp{signal
1158(SIGINT, SIG_IGN)}, but @samp{abort()}. Clean up occurs when the 1158(SIGINT, SIG_IGN)}, but @samp{abort()}. Clean up occurs when the
1159closing parenthesis is typed. 1159closing parenthesis is typed.
1160@end table 1160@end table
@@ -1278,7 +1278,7 @@ whether hungry-delete mode is enabled or not).
1278 1278
1279Since there's a lot of normal text in comments and string literals, 1279Since there's a lot of normal text in comments and string literals,
1280@ccmode{} provides features to edit these like in text mode. The goal 1280@ccmode{} provides features to edit these like in text mode. The goal
1281is to do it as seamlessly as possible, i.e. you can use auto fill mode, 1281is to do it as seamlessly as possible, i.e., you can use auto fill mode,
1282sentence and paragraph movement, paragraph filling, adaptive filling etc 1282sentence and paragraph movement, paragraph filling, adaptive filling etc
1283wherever there's a piece of normal text without having to think much 1283wherever there's a piece of normal text without having to think much
1284about it. @ccmode{} should keep the indentation, fix the comment line 1284about it. @ccmode{} should keep the indentation, fix the comment line
@@ -1333,7 +1333,7 @@ like
1333@noindent 1333@noindent
1334with zero or more stars at the beginning of every line. If you change 1334with zero or more stars at the beginning of every line. If you change
1335this variable, please make sure it still matches the comment starter 1335this variable, please make sure it still matches the comment starter
1336(i.e. @code{//}) of line comments @emph{and} the line prefix inside 1336(i.e., @code{//}) of line comments @emph{and} the line prefix inside
1337block comments. 1337block comments.
1338 1338
1339@findex c-setup-paragraph-variables 1339@findex c-setup-paragraph-variables
@@ -1352,7 +1352,7 @@ mode hook, since @ccmode{} sets up all variables before calling them.
1352@cindex paragraph filling 1352@cindex paragraph filling
1353Line breaks are by default handled (almost) the same regardless whether 1353Line breaks are by default handled (almost) the same regardless whether
1354they are made by auto fill mode (@pxref{Auto Fill,,, emacs, The Emacs 1354they are made by auto fill mode (@pxref{Auto Fill,,, emacs, The Emacs
1355Editor}), paragraph filling (e.g. with @kbd{M-q}), or explicitly with 1355Editor}), paragraph filling (e.g., with @kbd{M-q}), or explicitly with
1356@kbd{M-j} or similar methods. In string literals, the new line gets the 1356@kbd{M-j} or similar methods. In string literals, the new line gets the
1357same indentation as the previous nonempty line (may be changed with the 1357same indentation as the previous nonempty line (may be changed with the
1358@code{string} syntactic symbol). In comments, @ccmode{} uses 1358@code{string} syntactic symbol). In comments, @ccmode{} uses
@@ -1364,7 +1364,7 @@ lines in the comment.
1364@ccmode{} uses adaptive fill mode (@pxref{Adaptive Fill,,, emacs, The 1364@ccmode{} uses adaptive fill mode (@pxref{Adaptive Fill,,, emacs, The
1365Emacs Editor}) to make Emacs correctly keep the line prefix when filling 1365Emacs Editor}) to make Emacs correctly keep the line prefix when filling
1366paragraphs. That also makes Emacs preserve the text indentation 1366paragraphs. That also makes Emacs preserve the text indentation
1367@emph{inside} the comment line prefix. E.g. in the following comment, 1367@emph{inside} the comment line prefix. e.g., in the following comment,
1368both paragraphs will be filled with the left margins of the texts kept 1368both paragraphs will be filled with the left margins of the texts kept
1369intact: 1369intact:
1370 1370
@@ -1394,7 +1394,7 @@ by default). A patch for that is available from
1394@uref{http://cc-mode.sourceforge.net/,, the CC Mode web site}.}, 1394@uref{http://cc-mode.sourceforge.net/,, the CC Mode web site}.},
1395which handles things like bulleted lists nicely. There's a convenience 1395which handles things like bulleted lists nicely. There's a convenience
1396function @code{c-setup-filladapt} that tunes the relevant variables in 1396function @code{c-setup-filladapt} that tunes the relevant variables in
1397Filladapt for use in @ccmode{}. Call it from a mode hook, e.g. with 1397Filladapt for use in @ccmode{}. Call it from a mode hook, e.g., with
1398something like this in your @file{.emacs}: 1398something like this in your @file{.emacs}:
1399 1399
1400@example 1400@example
@@ -1443,7 +1443,7 @@ most common comment styles, see @ref{Indentation Functions}.
1443@defopt c-ignore-auto-fill 1443@defopt c-ignore-auto-fill
1444@vindex ignore-auto-fill (c-) 1444@vindex ignore-auto-fill (c-)
1445When auto fill mode is enabled, @ccmode{} can selectively ignore it 1445When auto fill mode is enabled, @ccmode{} can selectively ignore it
1446depending on the context the line break would occur in, e.g. to never 1446depending on the context the line break would occur in, e.g., to never
1447break a line automatically inside a string literal. This variable 1447break a line automatically inside a string literal. This variable
1448takes a list of symbols for the different contexts where auto-filling 1448takes a list of symbols for the different contexts where auto-filling
1449never should occur: 1449never should occur:
@@ -1458,7 +1458,7 @@ Inside a C++ style line comment.
1458@item cpp 1458@item cpp
1459Inside a preprocessor directive. 1459Inside a preprocessor directive.
1460@item code 1460@item code
1461Anywhere else, i.e. in normal code. 1461Anywhere else, i.e., in normal code.
1462@end table 1462@end table
1463 1463
1464By default, @code{c-ignore-auto-fill} is set to @code{'(string cpp 1464By default, @code{c-ignore-auto-fill} is set to @code{'(string cpp
@@ -1514,7 +1514,7 @@ Note that @ccmode{} sets @code{comment-multi-line} to @code{t} at
1514startup. The reason is that @kbd{M-j} could otherwise produce sequences 1514startup. The reason is that @kbd{M-j} could otherwise produce sequences
1515of single line block comments for texts that should logically be treated 1515of single line block comments for texts that should logically be treated
1516as one comment, and the rest of the paragraph handling code 1516as one comment, and the rest of the paragraph handling code
1517(e.g. @kbd{M-q} and @kbd{M-a}) can't cope with that, which would lead to 1517(e.g., @kbd{M-q} and @kbd{M-a}) can't cope with that, which would lead to
1518inconsistent behavior. 1518inconsistent behavior.
1519 1519
1520@item @kbd{M-x c-context-line-break} 1520@item @kbd{M-x c-context-line-break}
@@ -1523,7 +1523,7 @@ inconsistent behavior.
1523This is a function that works like @code{indent-new-comment-line} in 1523This is a function that works like @code{indent-new-comment-line} in
1524comments and @code{newline-and-indent} elsewhere, thus combining those 1524comments and @code{newline-and-indent} elsewhere, thus combining those
1525two in a way that uses each one in the context it's best suited for. 1525two in a way that uses each one in the context it's best suited for.
1526I.e. in comments the comment line prefix and indentation is kept for 1526I.e., in comments the comment line prefix and indentation is kept for
1527the new line, and in normal code it's indented according to context by 1527the new line, and in normal code it's indented according to context by
1528the indentation engine. 1528the indentation engine.
1529 1529
@@ -1540,7 +1540,7 @@ It's not bound to a key by default, but it's intended to be used on the
1540@findex c-context-open-line 1540@findex c-context-open-line
1541@findex context-open-line (c-) 1541@findex context-open-line (c-)
1542This is to @kbd{C-o} (@kbd{M-x open-line}) as 1542This is to @kbd{C-o} (@kbd{M-x open-line}) as
1543@code{c-context-line-break} is to @kbd{RET}. I.e. it works just like 1543@code{c-context-line-break} is to @kbd{RET}. I.e., it works just like
1544@code{c-context-line-break} but leaves the point before the inserted 1544@code{c-context-line-break} but leaves the point before the inserted
1545line break. 1545line break.
1546@end table 1546@end table
@@ -1555,13 +1555,13 @@ line break.
1555@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1555@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1556 1556
1557Preprocessor directives are handled as syntactic whitespace from other 1557Preprocessor directives are handled as syntactic whitespace from other
1558code, i.e. they can be interspersed anywhere without affecting the 1558code, i.e., they can be interspersed anywhere without affecting the
1559syntactic analysis, just like comments. 1559syntactic analysis, just like comments.
1560 1560
1561The code inside macro definitions is still analyzed syntactically so 1561The code inside macro definitions is still analyzed syntactically so
1562that you get relative indentation there just as you'd get if the same 1562that you get relative indentation there just as you'd get if the same
1563code was outside a macro. However, since there is no hint about the 1563code was outside a macro. However, since there is no hint about the
1564syntactic context, i.e. whether the macro expands to an expression, to some 1564syntactic context, i.e., whether the macro expands to an expression, to some
1565statements, or perhaps to whole functions, the syntactic recognition can be 1565statements, or perhaps to whole functions, the syntactic recognition can be
1566wrong. @ccmode{} manages to figure it out correctly most of the time, 1566wrong. @ccmode{} manages to figure it out correctly most of the time,
1567though. @xref{Syntactic Symbols}, for details about the indentation. 1567though. @xref{Syntactic Symbols}, for details about the indentation.
@@ -1601,7 +1601,7 @@ the region ends at the start of a line, it always deletes the backslash
1601These variables control the alignment columns for line continuation 1601These variables control the alignment columns for line continuation
1602backslashes in multiline macros. They are used by the functions that 1602backslashes in multiline macros. They are used by the functions that
1603automatically insert or align such backslashes, 1603automatically insert or align such backslashes,
1604e.g. @code{c-backslash-region} and @code{c-context-line-break}. 1604e.g., @code{c-backslash-region} and @code{c-context-line-break}.
1605 1605
1606@code{c-backslash-column} specifies the minimum column for the 1606@code{c-backslash-column} specifies the minimum column for the
1607backslashes. If any line in the macro exceeds it then the next tab 1607backslashes. If any line in the macro exceeds it then the next tab
@@ -1616,7 +1616,7 @@ lines which are too long ``stick out'' instead.
1616@vindex auto-align-backslashes (c-) 1616@vindex auto-align-backslashes (c-)
1617Align automatically inserted line continuation backslashes if 1617Align automatically inserted line continuation backslashes if
1618non-@code{nil}. When line continuation backslashes are inserted 1618non-@code{nil}. When line continuation backslashes are inserted
1619automatically for line breaks in multiline macros, e.g. by 1619automatically for line breaks in multiline macros, e.g., by
1620@code{c-context-line-break}, they are aligned with the other backslashes 1620@code{c-context-line-break}, they are aligned with the other backslashes
1621in the same macro if this flag is set. Otherwise the inserted 1621in the same macro if this flag is set. Otherwise the inserted
1622backslashes are preceded by a single space. 1622backslashes are preceded by a single space.
@@ -1738,7 +1738,7 @@ additional regexps to match those you use:
1738For each language there's a variable @code{*-font-lock-extra-types}, 1738For each language there's a variable @code{*-font-lock-extra-types},
1739where @samp{*} stands for the language in question. It contains a list 1739where @samp{*} stands for the language in question. It contains a list
1740of regexps that matches identifiers that should be recognized as types, 1740of regexps that matches identifiers that should be recognized as types,
1741e.g. @samp{\\sw+_t} to recognize all identifiers ending with @samp{_t} 1741e.g., @samp{\\sw+_t} to recognize all identifiers ending with @samp{_t}
1742as is customary in C code. Each regexp should not match more than a 1742as is customary in C code. Each regexp should not match more than a
1743single identifier. 1743single identifier.
1744 1744
@@ -1835,7 +1835,7 @@ labels.
1835@vindex font-lock-builtin-face 1835@vindex font-lock-builtin-face
1836@vindex font-lock-reference-face 1836@vindex font-lock-reference-face
1837Preprocessor directives get @code{font-lock-preprocessor-face} if it 1837Preprocessor directives get @code{font-lock-preprocessor-face} if it
1838exists (i.e. XEmacs). In Emacs they get @code{font-lock-builtin-face} 1838exists (i.e., XEmacs). In Emacs they get @code{font-lock-builtin-face}
1839or @code{font-lock-reference-face}, for lack of a closer equivalent. 1839or @code{font-lock-reference-face}, for lack of a closer equivalent.
1840 1840
1841@item 1841@item
@@ -1861,14 +1861,14 @@ since those aren't syntactic errors in themselves.
1861@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1861@comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1862 1862
1863There are various tools to supply documentation in the source as 1863There are various tools to supply documentation in the source as
1864specially structured comments, e.g. the standard Javadoc tool in Java. 1864specially structured comments, e.g., the standard Javadoc tool in Java.
1865@ccmode{} provides an extensible mechanism to fontify such comments and 1865@ccmode{} provides an extensible mechanism to fontify such comments and
1866the special markup inside them. 1866the special markup inside them.
1867 1867
1868@defopt c-doc-comment-style 1868@defopt c-doc-comment-style
1869@vindex doc-comment-style (c-) 1869@vindex doc-comment-style (c-)
1870This is a style variable that specifies which documentation comment 1870This is a style variable that specifies which documentation comment
1871style to recognize, e.g. @code{javadoc} for Javadoc comments. 1871style to recognize, e.g., @code{javadoc} for Javadoc comments.
1872 1872
1873The value may also be a list of styles, in which case all of them are 1873The value may also be a list of styles, in which case all of them are
1874recognized simultaneously (presumably with markup cues that don't 1874recognized simultaneously (presumably with markup cues that don't
@@ -1883,7 +1883,7 @@ and its value is used instead.
1883Note that @ccmode{} uses this variable to set other variables that 1883Note that @ccmode{} uses this variable to set other variables that
1884handle fontification etc. That's done at mode initialization or when 1884handle fontification etc. That's done at mode initialization or when
1885you switch to a style which sets this variable. Thus, if you change it 1885you switch to a style which sets this variable. Thus, if you change it
1886in some other way, e.g. interactively in a CC Mode buffer, you will need 1886in some other way, e.g., interactively in a CC Mode buffer, you will need
1887to do @kbd{M-x java-mode} (or whatever mode you're currently using) to 1887to do @kbd{M-x java-mode} (or whatever mode you're currently using) to
1888reinitialize. 1888reinitialize.
1889 1889
@@ -1993,7 +1993,7 @@ Indents the entire top-level function, class or macro definition
1993encompassing point. It leaves point unchanged. This function can't be 1993encompassing point. It leaves point unchanged. This function can't be
1994used to reindent a nested brace construct, such as a nested class or 1994used to reindent a nested brace construct, such as a nested class or
1995function, or a Java method. The top-level construct being reindented 1995function, or a Java method. The top-level construct being reindented
1996must be complete, i.e. it must have both a beginning brace and an ending 1996must be complete, i.e., it must have both a beginning brace and an ending
1997brace. 1997brace.
1998 1998
1999@item @kbd{C-M-\} (@code{indent-region}) 1999@item @kbd{C-M-\} (@code{indent-region})
@@ -2239,7 +2239,7 @@ whether to do sentence motion in or near comments and multiline strings.
2239A popular programming style, especially for object-oriented languages 2239A popular programming style, especially for object-oriented languages
2240such as C++ is to write symbols in a mixed case format, where the first 2240such as C++ is to write symbols in a mixed case format, where the first
2241letter of each word is capitalized, and not separated by underscores. 2241letter of each word is capitalized, and not separated by underscores.
2242E.g. @samp{SymbolsWithMixedCaseAndNoUnderlines}. 2242e.g., @samp{SymbolsWithMixedCaseAndNoUnderlines}.
2243 2243
2244This command moves point forward to next capitalized word. With prefix 2244This command moves point forward to next capitalized word. With prefix
2245argument @var{n}, move @var{n} times. 2245argument @var{n}, move @var{n} times.
@@ -2295,7 +2295,7 @@ styles.
2295Only syntactic symbols not already bound on @code{c-offsets-alist} will 2295Only syntactic symbols not already bound on @code{c-offsets-alist} will
2296be set from styles. This means that any association you set on it, be 2296be set from styles. This means that any association you set on it, be
2297it before or after mode initialization, will not be changed. The 2297it before or after mode initialization, will not be changed. The
2298@code{c-offsets-alist} variable may therefore be used from e.g. the 2298@code{c-offsets-alist} variable may therefore be used from e.g., the
2299Customization interface@footnote{Available in Emacs 20 and later, and 2299Customization interface@footnote{Available in Emacs 20 and later, and
2300XEmacs 19.15 and later.} to easily change indentation offsets without 2300XEmacs 19.15 and later.} to easily change indentation offsets without
2301having to bother about styles. Initially @code{c-offsets-alist} is 2301having to bother about styles. Initially @code{c-offsets-alist} is
@@ -2563,7 +2563,7 @@ this manual does not cover how that works.
2563 2563
2564Variables set like this at the top level in @file{.emacs} take effect in 2564Variables set like this at the top level in @file{.emacs} take effect in
2565all @ccmode{} buffers, regardless of language. The indentation style 2565all @ccmode{} buffers, regardless of language. The indentation style
2566related variables, e.g. @code{c-offsets-alist}, that you don't set this 2566related variables, e.g., @code{c-offsets-alist}, that you don't set this
2567way get their value from the style system (@pxref{Styles}), and they 2567way get their value from the style system (@pxref{Styles}), and they
2568therefore depend on the setting of @code{c-default-style}. Note that if 2568therefore depend on the setting of @code{c-default-style}. Note that if
2569you use Customize, this means that the greyed-out default values 2569you use Customize, this means that the greyed-out default values
@@ -2571,7 +2571,7 @@ presented there might not be the ones you actually get, since the actual
2571values depend on the style, which may very well be different for 2571values depend on the style, which may very well be different for
2572different languages. 2572different languages.
2573 2573
2574If you want to make more advanced configurations, e.g. language-specific 2574If you want to make more advanced configurations, e.g., language-specific
2575customization, setting global variables isn't enough. For that you can 2575customization, setting global variables isn't enough. For that you can
2576use the language hooks, see @ref{Hooks}, and/or the style system, see 2576use the language hooks, see @ref{Hooks}, and/or the style system, see
2577@ref{Styles}. 2577@ref{Styles}.
@@ -2940,8 +2940,8 @@ This variable takes an association list similar to what is allowed in
2940automatically institute these offsets using @code{c-set-offset}. 2940automatically institute these offsets using @code{c-set-offset}.
2941@end defvar 2941@end defvar
2942 2942
2943Note that file style settings (i.e. @code{c-file-style}) are applied 2943Note that file style settings (i.e., @code{c-file-style}) are applied
2944before file offset settings (i.e. @code{c-file-offsets}). Also, if 2944before file offset settings (i.e., @code{c-file-offsets}). Also, if
2945either of these are set in a file's local variable section, all the 2945either of these are set in a file's local variable section, all the
2946style variable values are made local to that buffer. 2946style variable values are made local to that buffer.
2947 2947
@@ -3086,7 +3086,7 @@ These @var{action} functions are called with two arguments: the
3086syntactic symbol for the brace, and the buffer position at which the 3086syntactic symbol for the brace, and the buffer position at which the
3087brace was inserted. The @var{action} function is expected to return a 3087brace was inserted. The @var{action} function is expected to return a
3088list containing some combination of @code{before} and @code{after}, 3088list containing some combination of @code{before} and @code{after},
3089including neither of them (i.e. @code{nil}). This return value has the 3089including neither of them (i.e., @code{nil}). This return value has the
3090normal brace hanging semantics. 3090normal brace hanging semantics.
3091 3091
3092As an example, @ccmode{} itself uses this feature to dynamically 3092As an example, @ccmode{} itself uses this feature to dynamically
@@ -3181,7 +3181,7 @@ No determination is made, and the next function in the list is called.
3181If every function in the list is called without a determination being 3181If every function in the list is called without a determination being
3182made, then no newline is added. The default value for this variable is a 3182made, then no newline is added. The default value for this variable is a
3183list containing a single function which inserts newlines only after 3183list containing a single function which inserts newlines only after
3184semicolons which do not appear inside parenthesis lists (i.e. those 3184semicolons which do not appear inside parenthesis lists (i.e., those
3185that separate @code{for}-clause statements). 3185that separate @code{for}-clause statements).
3186@end defopt 3186@end defopt
3187 3187
@@ -3215,7 +3215,7 @@ statements. In addition to
3215@ccmode{} also comes with the criteria function 3215@ccmode{} also comes with the criteria function
3216@code{c-semi&comma-no-newlines-for-oneline-inliners}, which suppresses 3216@code{c-semi&comma-no-newlines-for-oneline-inliners}, which suppresses
3217newlines after semicolons inside one-line inline method definitions 3217newlines after semicolons inside one-line inline method definitions
3218(e.g. in C++ or Java). 3218(e.g., in C++ or Java).
3219@end defun 3219@end defun
3220 3220
3221 3221
@@ -3242,7 +3242,7 @@ every line is indented by @ccmode{}. You can use it to do any special
3242indentation or line adjustments your style dictates, such as adding 3242indentation or line adjustments your style dictates, such as adding
3243extra indentation to constructors or destructor declarations in a 3243extra indentation to constructors or destructor declarations in a
3244class definition, etc. Note that you should not change point or mark 3244class definition, etc. Note that you should not change point or mark
3245inside your @code{c-special-indent-hook} functions, i.e. you'll 3245inside your @code{c-special-indent-hook} functions, i.e., you'll
3246probably want to wrap your function in a @code{save-excursion}. 3246probably want to wrap your function in a @code{save-excursion}.
3247 3247
3248Setting @code{c-special-indent-hook} in your style definition is 3248Setting @code{c-special-indent-hook} in your style definition is
@@ -3388,7 +3388,7 @@ Lines continuing an Objective-C method definition.
3388@item objc-method-call-cont 3388@item objc-method-call-cont
3389Lines continuing an Objective-C method call. 3389Lines continuing an Objective-C method call.
3390@item extern-lang-open 3390@item extern-lang-open
3391Brace that opens an @code{extern} block (e.g. @code{extern "C" @{...@}}). 3391Brace that opens an @code{extern} block (e.g., @code{extern "C" @{...@}}).
3392@item extern-lang-close 3392@item extern-lang-close
3393Brace that closes an @code{extern} block. 3393Brace that closes an @code{extern} block.
3394@item inextern-lang 3394@item inextern-lang
@@ -3411,9 +3411,9 @@ Analogous to the above, but for CORBA CIDL @code{composition} blocks.
3411C++ template argument list continuations. 3411C++ template argument list continuations.
3412@item inlambda 3412@item inlambda
3413Analogous to @code{inclass} syntactic symbol, but used inside lambda 3413Analogous to @code{inclass} syntactic symbol, but used inside lambda
3414(i.e. anonymous) functions. Only used in Pike mode. 3414(i.e., anonymous) functions. Only used in Pike mode.
3415@item lambda-intro-cont 3415@item lambda-intro-cont
3416Lines continuing the header of a lambda function, i.e. between the 3416Lines continuing the header of a lambda function, i.e., between the
3417@code{lambda} keyword and the function body. Only used in Pike mode. 3417@code{lambda} keyword and the function body. Only used in Pike mode.
3418@item inexpr-statement 3418@item inexpr-statement
3419A statement block inside an expression. The gcc C extension of this is 3419A statement block inside an expression. The gcc C extension of this is
@@ -3468,7 +3468,7 @@ top-level construct introduction so it has the syntax
3468the brace that opens a top-level function definition. Line 9 is the 3468the brace that opens a top-level function definition. Line 9 is the
3469corresponding 3469corresponding
3470@code{defun-close} since it contains the brace that closes the top-level 3470@code{defun-close} since it contains the brace that closes the top-level
3471function definition. Line 4 is a @code{defun-block-intro}, i.e. it is 3471function definition. Line 4 is a @code{defun-block-intro}, i.e., it is
3472the first line of a brace-block, enclosed in a 3472the first line of a brace-block, enclosed in a
3473top-level function definition. 3473top-level function definition.
3474 3474
@@ -3793,7 +3793,7 @@ where @code{inextern-lang} is a modifier similar in purpose to
3793 3793
3794There are various other top level blocks like @code{extern}, and they 3794There are various other top level blocks like @code{extern}, and they
3795are all treated in the same way except that the symbols are named after 3795are all treated in the same way except that the symbols are named after
3796the keyword that introduces the block. E.g. C++ namespace blocks get 3796the keyword that introduces the block. e.g., C++ namespace blocks get
3797the three symbols @code{namespace-open}, @code{namespace-close} and 3797the three symbols @code{namespace-open}, @code{namespace-close} and
3798@code{innamespace}. The currently recognized top level blocks are: 3798@code{innamespace}. The currently recognized top level blocks are:
3799 3799
@@ -3950,9 +3950,9 @@ Line 17 is assigned @code{stream-op} syntax.
3950@cindex syntactic whitespace 3950@cindex syntactic whitespace
3951@ssindex cpp-define-intro 3951@ssindex cpp-define-intro
3952Multiline preprocessor macro definitions are normally handled just like 3952Multiline preprocessor macro definitions are normally handled just like
3953other code, i.e. the lines inside them are indented according to the 3953other code, i.e., the lines inside them are indented according to the
3954syntactic analysis of the preceding lines inside the macro. The first 3954syntactic analysis of the preceding lines inside the macro. The first
3955line inside a macro definition (i.e. the line after the starting line of 3955line inside a macro definition (i.e., the line after the starting line of
3956the cpp directive itself) gets @code{cpp-define-intro}. In this example: 3956the cpp directive itself) gets @code{cpp-define-intro}. In this example:
3957 3957
3958@example 3958@example
@@ -3968,7 +3968,7 @@ line 1 is given the syntactic symbol @code{cpp-macro}. The first line
3968of a cpp directive is always given that symbol. Line 2 is given 3968of a cpp directive is always given that symbol. Line 2 is given
3969@code{cpp-define-intro}, so that you can give the macro body as a whole 3969@code{cpp-define-intro}, so that you can give the macro body as a whole
3970some extra indentation. Lines 3 through 5 are then analyzed as normal 3970some extra indentation. Lines 3 through 5 are then analyzed as normal
3971code, i.e. @code{substatement} on lines 3 and 4, and @code{else-clause} 3971code, i.e., @code{substatement} on lines 3 and 4, and @code{else-clause}
3972on line 5. 3972on line 5.
3973 3973
3974The syntactic analysis inside macros can be turned off with 3974The syntactic analysis inside macros can be turned off with
@@ -4094,7 +4094,7 @@ code @footnote{a.k.a. K&R C, or Kernighan & Ritchie C}:
4094 4094
4095Here, line 2 is the first line in an argument declaration list and so is 4095Here, line 2 is the first line in an argument declaration list and so is
4096given the @code{knr-argdecl-intro} syntactic symbol. Subsequent lines 4096given the @code{knr-argdecl-intro} syntactic symbol. Subsequent lines
4097(i.e. lines 3 and 4 in this example), are given @code{knr-argdecl} 4097(i.e., lines 3 and 4 in this example), are given @code{knr-argdecl}
4098syntax. 4098syntax.
4099 4099
4100 4100
@@ -4322,7 +4322,7 @@ if ( x < 10
4322 4322
4323Since this function doesn't do anything for lines without an infix 4323Since this function doesn't do anything for lines without an infix
4324operator you typically want to use it together with some other lineup 4324operator you typically want to use it together with some other lineup
4325settings, e.g. as follows (the @code{arglist-close} setting is just a 4325settings, e.g., as follows (the @code{arglist-close} setting is just a
4326suggestion to get a consistent style): 4326suggestion to get a consistent style):
4327 4327
4328@example 4328@example
@@ -4383,7 +4383,7 @@ to handle most of the common comment styles. Some examples:
4383@end example 4383@end example
4384 4384
4385The style variable @code{c-comment-prefix-regexp} is used to recognize 4385The style variable @code{c-comment-prefix-regexp} is used to recognize
4386the comment line prefix, e.g. the @samp{*} that usually starts every 4386the comment line prefix, e.g., the @samp{*} that usually starts every
4387line inside a comment. 4387line inside a comment.
4388 4388
4389@workswith The @code{c} syntactic symbol. 4389@workswith The @code{c} syntactic symbol.
@@ -4512,7 +4512,7 @@ int dribble() @{
4512 4512
4513If @code{c-syntactic-indentation-in-macros} is non-@code{nil}, the 4513If @code{c-syntactic-indentation-in-macros} is non-@code{nil}, the
4514function returns the relative indentation to the macro start line to 4514function returns the relative indentation to the macro start line to
4515allow accumulation with other offsets. E.g. in the following cases, 4515allow accumulation with other offsets. e.g., in the following cases,
4516@code{cpp-define-intro} is combined with the 4516@code{cpp-define-intro} is combined with the
4517@code{statement-block-intro} that comes from the @samp{do @{} that hangs 4517@code{statement-block-intro} that comes from the @samp{do @{} that hangs
4518on the @samp{#define} line: 4518on the @samp{#define} line:
@@ -4611,7 +4611,7 @@ arglist lineups, e.g.
4611@defun c-lineup-inexpr-block 4611@defun c-lineup-inexpr-block
4612@findex lineup-inexpr-block (c-) 4612@findex lineup-inexpr-block (c-)
4613This can be used with the in-expression block symbols to indent the 4613This can be used with the in-expression block symbols to indent the
4614whole block to the column where the construct is started. E.g. for Java 4614whole block to the column where the construct is started. e.g., for Java
4615anonymous classes, this lines up the class under the @samp{new} keyword, 4615anonymous classes, this lines up the class under the @samp{new} keyword,
4616and in Pike it lines up the lambda function body under the @samp{lambda} 4616and in Pike it lines up the lambda function body under the @samp{lambda}
4617keyword. Returns @code{nil} if the block isn't part of such a 4617keyword. Returns @code{nil} if the block isn't part of such a
@@ -4828,7 +4828,7 @@ expressions.
4828 4828
4829@defun c-lineup-streamop 4829@defun c-lineup-streamop
4830@findex lineup-streamop (c-) 4830@findex lineup-streamop (c-)
4831Line up C++ stream operators (i.e. @samp{<<} and @samp{>>}). 4831Line up C++ stream operators (i.e., @samp{<<} and @samp{>>}).
4832 4832
4833@workswith @code{stream-op}. 4833@workswith @code{stream-op}.
4834@end defun 4834@end defun
@@ -4956,7 +4956,7 @@ In the first case the indentation is kept unchanged, in the second
4956@workswith @code{defun-close}, @code{defun-block-intro}, 4956@workswith @code{defun-close}, @code{defun-block-intro},
4957@code{block-close}, @code{brace-list-close}, @code{brace-list-intro}, 4957@code{block-close}, @code{brace-list-close}, @code{brace-list-intro},
4958@code{statement-block-intro} and all @code{in*} symbols, 4958@code{statement-block-intro} and all @code{in*} symbols,
4959e.g. @code{inclass} and @code{inextern-lang}. 4959e.g., @code{inclass} and @code{inextern-lang}.
4960@end defun 4960@end defun
4961 4961
4962 4962
@@ -5050,7 +5050,7 @@ pairs. See @ref{AWK Mode Defuns} for a description of commands which
5050work on AWK ``defuns''. 5050work on AWK ``defuns''.
5051 5051
5052Since there is no preprocessor in AWK, the commands which move to 5052Since there is no preprocessor in AWK, the commands which move to
5053preprocessor directives (e.g. @code{c-up-conditional}) are meaningless 5053preprocessor directives (e.g., @code{c-up-conditional}) are meaningless
5054in AWK mode and are not bound in the AWK mode keymap. 5054in AWK mode and are not bound in the AWK mode keymap.
5055 5055
5056@item Auto-newline Insertion and Clean-ups 5056@item Auto-newline Insertion and Clean-ups
@@ -5230,7 +5230,7 @@ present on the association list, CC Mode won't set
5230 5230
5231The default is to set @code{require-final-newline} to @code{t} in the 5231The default is to set @code{require-final-newline} to @code{t} in the
5232languages that mandates that source files should end with newlines, 5232languages that mandates that source files should end with newlines,
5233i.e. C, C++ and Objective-C. 5233i.e., C, C++ and Objective-C.
5234@end defopt 5234@end defopt
5235 5235
5236@defopt c-echo-syntactic-information-p 5236@defopt c-echo-syntactic-information-p
@@ -5271,9 +5271,9 @@ pathological code can cause @ccmode{} to perform fairly badly. This
5271section gives some insight in how @ccmode{} operates, how that interacts 5271section gives some insight in how @ccmode{} operates, how that interacts
5272with some coding styles, and what you can use to improve performance. 5272with some coding styles, and what you can use to improve performance.
5273 5273
5274The overall goal is that @ccmode{} shouldn't be overly slow (i.e. take 5274The overall goal is that @ccmode{} shouldn't be overly slow (i.e., take
5275more than a fraction of a second) in any interactive operation. 5275more than a fraction of a second) in any interactive operation.
5276I.e. it's tuned to limit the maximum response time in single operations, 5276i.e., it's tuned to limit the maximum response time in single operations,
5277which sometimes is at the expense of batch-like operations like 5277which sometimes is at the expense of batch-like operations like
5278reindenting whole blocks. If you find that @ccmode{} gradually gets 5278reindenting whole blocks. If you find that @ccmode{} gradually gets
5279slower and slower in certain situations, perhaps as the file grows in 5279slower and slower in certain situations, perhaps as the file grows in
@@ -5292,7 +5292,7 @@ gets.
5292@findex beginning-of-defun 5292@findex beginning-of-defun
5293@findex defun-prompt-regexp 5293@findex defun-prompt-regexp
5294One of the simplest things you can do to reduce scan time, is make sure 5294One of the simplest things you can do to reduce scan time, is make sure
5295any brace that opens a top-level construct@footnote{E.g. a function in 5295any brace that opens a top-level construct@footnote{e.g., a function in
5296C, or outermost class definition in C++ or Java.} always appears in the 5296C, or outermost class definition in C++ or Java.} always appears in the
5297leftmost column. This is actually an Emacs constraint, as embodied in 5297leftmost column. This is actually an Emacs constraint, as embodied in
5298the @code{beginning-of-defun} function which @ccmode{} uses heavily. If 5298the @code{beginning-of-defun} function which @ccmode{} uses heavily. If
@@ -5334,7 +5334,7 @@ XEmacs users can set the variable
5334tells @ccmode{} to use XEmacs-specific built-in functions which, in some 5334tells @ccmode{} to use XEmacs-specific built-in functions which, in some
5335circumstances, can locate the top-most opening brace much more quickly than 5335circumstances, can locate the top-most opening brace much more quickly than
5336@code{beginning-of-defun}. Preliminary testing has shown that for 5336@code{beginning-of-defun}. Preliminary testing has shown that for
5337styles where these braces are hung (e.g. most JDK-derived Java styles), 5337styles where these braces are hung (e.g., most JDK-derived Java styles),
5338this hack can improve performance of the core syntax parsing routines 5338this hack can improve performance of the core syntax parsing routines
5339from 3 to 60 times. However, for styles which @emph{do} conform to 5339from 3 to 60 times. However, for styles which @emph{do} conform to
5340Emacs' recommended style of putting top-level braces in column zero, 5340Emacs' recommended style of putting top-level braces in column zero,
@@ -5345,7 +5345,7 @@ in Emacs since the necessary built-in functions don't exist (in Emacs
534521.3 as of this writing in May 2003). 534521.3 as of this writing in May 2003).
5346 5346
5347Text properties are used to speed up skipping over syntactic whitespace, 5347Text properties are used to speed up skipping over syntactic whitespace,
5348i.e. comments and preprocessor directives. Indenting a line after a 5348i.e., comments and preprocessor directives. Indenting a line after a
5349huge macro definition can be slow the first time, but after that the 5349huge macro definition can be slow the first time, but after that the
5350text properties are in place and it should be fast (even after you've 5350text properties are in place and it should be fast (even after you've
5351edited other parts of the file and then moved back). 5351edited other parts of the file and then moved back).
@@ -5353,7 +5353,7 @@ edited other parts of the file and then moved back).
5353Font locking can be a CPU hog, especially the font locking done on 5353Font locking can be a CPU hog, especially the font locking done on
5354decoration level 3 which tries to be very accurate. Note that that 5354decoration level 3 which tries to be very accurate. Note that that
5355level is designed to be used with a font lock support mode that only 5355level is designed to be used with a font lock support mode that only
5356fontifies the text that's actually shown, i.e. Lazy Lock or Just-in-time 5356fontifies the text that's actually shown, i.e., Lazy Lock or Just-in-time
5357Lock mode, so make sure you use one of them. Fontification of a whole 5357Lock mode, so make sure you use one of them. Fontification of a whole
5358buffer with some thousand lines can often take over a minute. That is 5358buffer with some thousand lines can often take over a minute. That is
5359a known weakness; the idea is that it never should happen. 5359a known weakness; the idea is that it never should happen.
@@ -5386,7 +5386,7 @@ geared to be used interactively to edit new code. There's currently no
5386intention to change this goal. 5386intention to change this goal.
5387 5387
5388If you want to reformat old code, you're probably better off using some 5388If you want to reformat old code, you're probably better off using some
5389other tool instead, e.g. @ref{Top, , GNU indent, indent, The `indent' 5389other tool instead, e.g., @ref{Top, , GNU indent, indent, The `indent'
5390Manual}, which has more powerful reformatting capabilities than 5390Manual}, which has more powerful reformatting capabilities than
5391@ccmode{}. 5391@ccmode{}.
5392 5392
@@ -5526,7 +5526,7 @@ to include any code that appears @emph{before} your bug example, if
5526you think it might affect our ability to reproduce it. 5526you think it might affect our ability to reproduce it.
5527 5527
5528Please try to produce the problem in an Emacs instance without any 5528Please try to produce the problem in an Emacs instance without any
5529customizations loaded (i.e. start it with the @code{-q -no-site-file} 5529customizations loaded (i.e., start it with the @samp{-q --no-site-file}
5530arguments). If it works correctly there, the problem might be caused by 5530arguments). If it works correctly there, the problem might be caused by
5531faulty customizations in either your own or your site configuration. In 5531faulty customizations in either your own or your site configuration. In
5532that case, we'd appreciate if you isolate the Emacs Lisp code that trigs 5532that case, we'd appreciate if you isolate the Emacs Lisp code that trigs
diff --git a/man/cl.texi b/man/cl.texi
index bc4db1cb927..455465a27a3 100644
--- a/man/cl.texi
+++ b/man/cl.texi
@@ -50,7 +50,7 @@ license to the document, as described in section 6 of the license.
50@end titlepage 50@end titlepage
51 51
52@node Top, Overview, (dir), (dir) 52@node Top, Overview, (dir), (dir)
53@chapter Overview 53@chapter Introduction
54 54
55@noindent 55@noindent
56This document describes a set of Emacs Lisp facilities borrowed from 56This document describes a set of Emacs Lisp facilities borrowed from
@@ -82,12 +82,9 @@ does assume a basic familiarity with Emacs Lisp.
82@end menu 82@end menu
83 83
84@node Overview, Program Structure, Top, Top 84@node Overview, Program Structure, Top, Top
85@ifinfo 85@ifnottex
86@chapter Overview 86@chapter Overview
87@end ifinfo 87@end ifnottex
88@iftex
89@section Overview
90@end iftex
91 88
92@noindent 89@noindent
93Common Lisp is a huge language, and Common Lisp systems tend to be 90Common Lisp is a huge language, and Common Lisp systems tend to be
diff --git a/man/custom.texi b/man/custom.texi
index ab29bd83e09..2502ae2a43d 100644
--- a/man/custom.texi
+++ b/man/custom.texi
@@ -1946,7 +1946,7 @@ loaded.
1946@file{site-start.el}, if it exists. Like @file{default.el}, Emacs 1946@file{site-start.el}, if it exists. Like @file{default.el}, Emacs
1947finds this file via the standard search path for Lisp libraries. 1947finds this file via the standard search path for Lisp libraries.
1948Emacs loads this library before it loads your init file. To inhibit 1948Emacs loads this library before it loads your init file. To inhibit
1949loading of this library, use the option @samp{-no-site-file}. 1949loading of this library, use the option @samp{--no-site-file}.
1950@xref{Initial Options}. 1950@xref{Initial Options}.
1951 1951
1952 You can place @file{default.el} and @file{site-start.el} in any of 1952 You can place @file{default.el} and @file{site-start.el} in any of
diff --git a/man/emacs.texi b/man/emacs.texi
index b5f40a6d9e6..893f01e3baf 100644
--- a/man/emacs.texi
+++ b/man/emacs.texi
@@ -541,7 +541,6 @@ C and Related Modes
541* Hungry Delete:: A more powerful DEL command. 541* Hungry Delete:: A more powerful DEL command.
542* Other C Commands:: Filling comments, viewing expansion of macros, 542* Other C Commands:: Filling comments, viewing expansion of macros,
543 and other neat features. 543 and other neat features.
544* Comments in C:: Options for customizing comment style.
545 544
546Fortran Mode 545Fortran Mode
547 546
diff --git a/man/flymake.texi b/man/flymake.texi
new file mode 100644
index 00000000000..e710b903361
--- /dev/null
+++ b/man/flymake.texi
@@ -0,0 +1,771 @@
1\input texinfo @c -*-texinfo-*-
2@comment %**start of header
3@setfilename ../info/flymake
4@set VERSION 0.3
5@set UPDATED April 2004
6@settitle GNU Flymake @value{VERSION}
7@syncodeindex pg cp
8@comment %**end of header
9
10@copying
11This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}),
12which is a universal on-the-fly syntax checker for GNU Emacs.
13
14Copyright @copyright{} 2004 Free Software Foundation, Inc.
15
16@quotation
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.1 or
19any later version published by the Free Software Foundation; with no
20Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
21and with the Back-Cover Texts as in (a) below. A copy of the license
22is included in the section entitled ``GNU Free Documentation License''
23in the Emacs manual.
24
25(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
26this GNU Manual, like GNU software. Copies published by the Free
27Software Foundation raise funds for GNU development.''
28
29This document is part of a collection distributed under the GNU Free
30Documentation License. If you want to distribute this document
31separately from the collection, you can do so by adding a copy of the
32license to the document, as described in section 6 of the license.
33@end quotation
34@end copying
35
36@dircategory Emacs
37@direntry
38* Flymake: (flymake). A universal on-the-fly syntax checker.
39@end direntry
40
41@titlepage
42@title GNU Flymake
43@subtitle for version @value{VERSION}, @value{UPDATED}
44@author Pavel Kobiakov(@email{pk_at_work@@yahoo.com})
45@page
46@vskip 0pt plus 1filll
47@end titlepage
48
49@contents
50
51@ifnottex
52@node Top
53@top GNU Flymake
54@end ifnottex
55
56@menu
57* Overview of Flymake::
58* Obtaining Flymake::
59* Installing Flymake::
60* Using Flymake::
61* Configuring Flymake::
62* Flymake Implementation::
63* Index::
64@end menu
65
66@node Overview of Flymake
67@chapter Overview
68@cindex Overview of Flymake
69
70Flymake is a universal on-the-fly syntax checker implemented as an
71Emacs minor mode. Flymake runs the pre-configured syntax check tool
72(compiler for C++ files, @code{perl} for perl files, etc.) in the
73background, passing it a temporary copy of the current buffer, and
74parses the output for known error/warning message patterns. Flymake
75then highlights erroneous lines (i.e. lines for which at least one
76error or warning has been reported by the syntax check tool), and
77displays an overall buffer status in the mode line. Status information
78displayed by Flymake contains total number of errors and warnings
79reported for the buffer during the last syntax check.
80
81@code{flymake-goto-next-error} and @code{flymake-goto-prev-error}
82functions allow for easy navigation to the next/previous erroneous
83line, respectively.
84
85Calling @code{flymake-display-err-menu-for-current-line} will popup a
86menu containing error messages reported by the syntax check tool for
87the current line. Errors/warnings belonging to another file, such as a
88@code{.h} header file included by a @code{.c} file, are shown in the
89current buffer as belonging to the first line. Menu items for such
90messages also contain a filename and a line number. Selecting such a
91menu item will automatically open the file and jump to the line with
92error.
93
94Syntax check is done 'on-the-fly'. It is started whenever
95
96@itemize @bullet
97@item buffer is loaded
98@item a newline character is added to the buffer
99@item some changes were made to the buffer more than @code{0.5} seconds ago (the
100delay is configurable).
101@end itemize
102
103Flymake is a universal syntax checker in the sense that it's easily
104extended to support new syntax check tools and error message
105patterns. @xref{Configuring Flymake}.
106
107@node Obtaining Flymake
108@chapter Obtaining Flymake
109@cindex Getting Flymake
110
111Release versions of Flymake can be downloaded from
112@* @url{https://sourceforge.net/project/showfiles.php?group_id=77501}.
113You can also try current version available via CVS at @url{https://}.
114
115Flymake's homepage is at @url{http://flymake.sourceforge.net}.
116
117@node Installing Flymake
118@chapter Installing
119@cindex Installing Flymake
120
121
122Flymake is packaged in a single file, @code{flymake.el}.
123
124To install/update Flymake, place @code{flymake.el} to a directory
125somewhere on Emacs load path. You might also want to byte-compile
126@code{flymake.el} to improve performance.
127
128Also, place the following line in the @code{.emacs} file.
129
130@lisp
131(require 'flymake)
132@end lisp
133
134You might also map the most frequently used Flymake functions, such as
135@code{flymake-goto-next-error}, to some keyboard shortcuts:
136
137@lisp
138(global-set-key [f3] 'flymake-display-err-menu-for-current-line)
139(global-set-key [f4] 'flymake-goto-next-error)
140@end lisp
141
142@node Using Flymake
143@chapter Using Flymake
144@cindex Using Flymake
145
146@menu
147* Flymake mode::
148* Running the syntax check::
149* Navigating to error lines::
150* Viewing error messages::
151* Syntax check statuses::
152* Troubleshooting::
153@end menu
154
155@node Flymake mode
156@section Flymake mode
157@cindex flymake-mode
158
159Flymake is an Emacs minor mode. To use Flymake, you
160must first activate @code{flymake-mode} by using the
161@code{flymake-mode} function.
162
163Instead of manually activating @code{flymake-mode}, you can configure
164Flymake to automatically enable @code{flymake-mode} upon opening any
165file for which syntax check is possible. To do so, place the following
166line in @code{.emacs}:
167
168@lisp
169(add-hook 'find-file-hooks 'flymake-find-file-hook)
170@end lisp
171
172@node Running the syntax check
173@section Running the syntax check
174@cindex Manually starting the syntax check
175
176When @code{flymake-mode} is active, syntax check is started
177automatically on any of the three conditions mentioned above. Syntax
178check can also be started manually by using the
179@code{flymake-start-syntax-check-for-current-buffer} function. This
180can be used, for example, when changes were made to some other buffer
181affecting the current buffer.
182
183@node Navigating to error lines
184@section Navigating to error lines
185@cindex Navigating to error lines
186
187After syntax check is completed, lines for which at least one error or
188warning has been reported are highlighted, and total number of errors
189and warning is shown in the mode line. Use the following functions to
190navigate the highlighted lines.
191
192@multitable @columnfractions 0.25 0.75
193
194@item @code{flymake-goto-next-error}
195@tab Moves point to the next erroneous line, if any.
196
197@item @code{flymake-goto-prev-error}
198@tab Moves point to the previous erroneous line.
199
200@end multitable
201
202These functions treat erroneous lines as a linked list. Therefore,
203@code{flymake-goto-next-error} will go to the first erroneous line
204when invoked in the end of the buffer.
205
206@node Viewing error messages
207@section Viewing error messages
208@cindex Viewing error messages
209
210To view error messages belonging to the current line, use the
211@code{flymake-display-err-menu-for-current-line} function. If there's
212at least one error or warning reported for the current line, this
213function will display a popup menu with error/warning texts.
214Selecting the menu item whose error belongs to another file brings
215forward that file with the help of the
216@code{flymake-goto-file-and-line} function.
217
218@node Syntax check statuses
219@section Syntax check statuses
220@cindex Syntax check statuses
221
222After syntax check is finished, its status is displayed in the mode line.
223The following statuses are defined.
224
225@multitable @columnfractions 0.25 0.75
226@item Flymake* or Flymake:E/W*
227@tab Flymake is currently running. For the second case, E/W contains the
228 error and warning count for the previous run.
229
230@item Flymake
231@tab Syntax check is not running. Usually this means syntax check was
232 successfully passed (no errors, no warnings). Other possibilities are:
233 syntax check was killed as a result of executing
234 @code{flymake-compile}, or syntax check cannot start as compilation
235 is currently in progress.
236
237@item Flymake:E/W
238@tab Number of errors/warnings found by the syntax check process.
239
240@item Flymake:!
241@tab Flymake was unable to find master file for the current buffer.
242@end multitable
243
244The following errors cause a warning message and switch flymake mode
245OFF for the buffer.
246
247@multitable @columnfractions 0.25 0.75
248@item CFGERR
249@tab Syntax check process returned nonzero exit code, but no
250 errors/warnings were reported. This indicates a possible configuration
251 error (for example, no suitable error message patterns for the
252 syntax check tool).
253
254@item NOMASTER
255@tab Flymake was unable to find master file for the current buffer.
256
257@item NOMK
258@tab Flymake was unable to find a suitable buildfile for the current buffer.
259
260@item PROCERR
261@tab Flymake was unable to launch a syntax check process.
262@end multitable
263
264
265@node Troubleshooting
266@section Troubleshooting
267@cindex Logging
268@cindex Troubleshooting
269
270Flymake uses a simple logging facility for indicating important points
271in the control flow. The logging facility sends logging messages to
272the @code{*Messages*} buffer. The information logged can be used for
273resolving various problems related to Flymake.
274
275Logging output is controlled by the @code{flymake-log-level}
276variable. @code{3} is the most verbose level, and @code{-1} switches
277logging off.
278
279@node Configuring Flymake
280@chapter Configuring and Extending Flymake
281@cindex Configuring and Extending Flymake
282
283@menu
284* Customizable variables::
285* Adding support for a new syntax check tool::
286@end menu
287
288Flymake was designed to be easily extended for supporting new syntax
289check tools and error message patterns.
290
291@node Customizable variables
292@section Customizable variables
293@cindex Customizable variables
294
295This section summarises variables used for Flymake
296configuration.
297
298@table @code
299@item flymake-log-level
300Controls logging output, see @ref{Troubleshooting}.
301
302@item flymake-allowed-file-name-masks
303A list of @code{(filename-regexp, init-function, cleanup-function
304getfname-function)} for configuring syntax check tools. @xref{Adding
305support for a new syntax check tool}.
306
307@item flymake-buildfile-dirs
308A list of directories (relative paths) for searching a
309buildfile. @xref{Locating the buildfile}.
310
311@item flymake-master-file-dirs
312A list of directories for searching a master file. @xref{Locating a
313master file}.
314
315@item flymake-get-project-include-dirs-function
316A function used for obtaining a list of project include dirs (C/C++
317specific). @xref{Getting the include directories}.
318
319@item flymake-master-file-count-limit
320@itemx flymake-check-file-limit
321Used when looking for a master file. @xref{Locating a master file}.
322
323@item flymake-err-line-patterns
324Patterns for error/warning messages in the form @code{(regexp file-idx
325line-idx err-text-idx)}. @xref{Parsing the output}.
326
327@item flymake-compilation-prevents-syntax-check
328A flag indicating whether compilation and syntax check of the same
329file cannot be run simultaneously.
330
331@item flymake-no-changes-timeout
332If any changes are made to the buffer, syntax check is automatically
333started after @code{flymake-no-changes-timeout} seconds.
334
335@item flymake-gui-warnings-enabled
336A boolean flag indicating whether Flymake will show message boxes for
337non-recoverable errors. If @code{flymake-gui-warnings-enabled} is
338@code{nil}, these errors will only be logged to the @code{*Messages*}
339buffer.
340
341@item flymake-start-syntax-check-on-newline
342A boolean flag indicating whether to start syntax check after a
343newline character is added to the buffer.
344
345@item flymake-errline-face
346A custom face for highlighting lines for which at least one error has
347been reported.
348
349@item flymake-warnline-face
350A custom face for highlighting lines for which at least one warning
351and no errors have been reported.
352
353@end table
354
355@node Adding support for a new syntax check tool
356@section Adding support for a new syntax check tool
357@cindex Adding support for a new syntax check tool
358
359@menu
360* Example -- Configuring a tool called directly::
361* Example -- Configuring a tool called via make::
362@end menu
363
364Syntax check tools are configured using the
365@code{flymake-allowed-file-name-masks} list. Each item of this list
366has the following format:
367
368@lisp
369(filename-regexp, init-function, cleanup-function, getfname-function)
370@end lisp
371
372@table @code
373@item filename-regexp
374This field is used as a key for locating init/cleanup/getfname
375functions for the buffer. Items in
376@code{flymake-allowed-file-name-masks} are searched sequentially. The
377first item with @code{filename-regexp} matching buffer filename is
378selected. If no match is found, @code{flymake-mode} is switched off.
379
380@item init-function
381@code{init-function} is required to initialise the syntax check,
382usually by creating a temporary copy of the buffer contents. The
383function must return @code{(list cmd-name arg-list)}. If
384@code{init-function} returns null, syntax check is aborted, by
385@code{flymake-mode} is not switched off.
386
387@item cleanup-function
388@code{cleanup-function} is called after the syntax check process is
389complete and should take care of proper deinitialization, which is
390usually deleting a temporary copy created by the @code{init-function}.
391
392@item getfname-function
393This function is used for translating filenames reported by the syntax
394check tool into ``real'' filenames. Filenames reported by the tool
395will be different from the real ones, as actually the tool works with
396the temporary copy. In most cases, the default implementation
397provided by Flymake, @code{flymake-get-real-file-name}, can be used as
398@code{getfname-function}.
399
400@end table
401
402To add support for a new syntax check tool, write corresponding
403@code{init-function}, and, optionally @code{cleanup-function} and
404@code{getfname-function}. If the format of error messages reported by
405the new tool is not yet supported by Flymake, add a new entry to
406the @code{flymake-err-line-patterns} list.
407
408The following sections contain some examples of configuring Flymake
409support for various syntax check tools.
410
411@node Example -- Configuring a tool called directly
412@subsection Example -- Configuring a tool called directly
413@cindex Adding support for perl
414
415In this example, we will add support for @code{perl} as a syntax check
416tool. @code{perl} supports the @code{-c} option which does syntax
417checking.
418
419First, we write the @code{init-function}:
420
421@lisp
422(defun flymake-perl-init(buffer)
423 (let* ((temp-file (flymake-init-create-temp-buffer-copy
424 buffer
425 'flymake-create-temp-inplace))
426 (local-file (concat (flymake-build-relative-path
427 (file-name-directory
428 (buffer-file-name
429 (current-buffer)))
430 (file-name-directory temp-file))
431 (file-name-nondirectory temp-file))))
432 (list "perl" (list "-wc " local-file))
433 )
434)
435@end lisp
436
437@code{flymake-perl-init} creates a temporary copy of the buffer
438contents with the help of
439@code{flymake-init-create-temp-buffer-copy}, and builds an appropriate
440command line.
441
442Next, we add a new entry to the
443@code{flymake-allowed-file-name-masks}:
444
445@lisp
446(setq flymake-allowed-file-name-masks
447 (cons '(".+\\.pl$"
448 flymake-perl-init
449 flymake-simple-cleanup
450 flymake-get-real-file-name)
451 flymake-allowed-file-name-masks))
452@end lisp
453
454Note that we use standard @code{cleanup-function} and
455@code{getfname-function}.
456
457Finally, we add an entry to @code{flymake-err-line-patterns}:
458
459@lisp
460(setq flymake-err-line-patterns
461 (cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
462 flymake-err-line-patterns))
463@end lisp
464
465@node Example -- Configuring a tool called via make
466@subsection Example -- Configuring a tool called via make
467@cindex Adding support for C (gcc+make)
468
469In this example we will add support for C files syntax checked by
470@code{gcc} called via @code{make}.
471
472We're not required to write any new functions, as Flymake already has
473functions for @code{make}. We just add a new entry to the
474@code{flymake-allowed-file-name-masks}:
475
476@lisp
477(setq flymake-allowed-file-name-masks
478 (cons '(".+\\.c$"
479 flymake-simple-make-init
480 flymake-simple-cleanup
481 flymake-get-real-file-name)
482 flymake-allowed-file-name-masks))
483@end lisp
484
485@code{flymake-simple-make-init} builds the following @code{make}
486command line:
487
488@lisp
489(list "make"
490 (list "-s"
491 "-C"
492 base-dir
493 (concat "CHK_SOURCES=" source)
494 "SYNTAX_CHECK_MODE=1"
495 "check-syntax"))
496@end lisp
497
498@code{base-dir} is a directory containing @code{Makefile}, see @ref{Locating the buildfile}.
499
500Thus, @code{Makefile} must contain the @code{check-syntax} target. In
501our case this target might look like this:
502
503@verbatim
504check-syntax:
505 gcc -o nul -S ${CHK_SOURCES}
506@end verbatim
507
508The format of error messages reported by @code{gcc} is already
509supported by Flymake, so we don't have to add a new entry to
510@code{flymake-err-line-patterns}.
511
512@node Flymake Implementation
513@chapter Flymake Implementation
514@cindex Implementation details
515
516@menu
517* Determining whether syntax check is possible::
518* Making a temporary copy::
519* Locating a master file::
520* Getting the include directories::
521* Locating the buildfile::
522* Starting the syntax check process::
523* Parsing the output::
524* Highlighting erroneous lines::
525* Interaction with other modes::
526@end menu
527
528Syntax check is started by calling @code{flymake-start-syntax-check-for-current-buffer}.
529Flymake first determines whether it is able to do syntax
530check. It then saves a copy of the buffer in a temporary file in the
531buffer's directory (or in the system temp directory -- for java
532files), creates a syntax check command and launches a process with
533this command. The output is parsed using a list of error message patterns,
534and error information (file name, line number, type and text) is
535saved. After the process has finished, Flymake highlights erroneous
536lines in the buffer using the accumulated error information.
537
538@node Determining whether syntax check is possible
539@section Determining whether syntax check is possible
540@cindex Syntax check models
541@cindex Master file
542
543Syntax check is considered possible if there's an entry in
544@code{flymake-allowed-file-name-masks} matching buffer's filename and
545its @code{init-function} returns non-nil value.
546
547Two syntax check modes are distinguished:
548
549@enumerate
550
551@item
552Buffer can be syntax checked in a standalone fashion, that is, the
553file (its temporary copy, in fact) can be passed over to the compiler to
554do the syntax check. Examples are C/C++ (.c, .cpp) and Java (.java)
555sources.
556
557@item
558Buffer can be syntax checked, but additional file, called master file,
559is required to perform this operation. A master file is a file that
560includes the current file, so that running a syntax check tool on it
561will also check syntax in the current file. Examples are C/C++ (.h,
562.hpp) headers.
563
564@end enumerate
565
566These modes are handled inside init/cleanup/getfname functions, see
567@ref{Adding support for a new syntax check tool}.
568
569Flymake contains implementations of all functionality required to
570support different syntax check modes described above (making
571temporary copies, finding master files, etc.), as well as some
572tool-specific (routines for @code{make}, @code{Ant}, etc.) code.
573
574
575@node Making a temporary copy
576@section Making a temporary copy
577@cindex Temporary copy of the buffer
578@cindex Master file
579
580After the possibility of the syntax check has been determined, a
581temporary copy of the current buffer is made so that the most recent
582unsaved changes could be seen by the syntax check tool. Making a copy
583is quite straightforward in a standalone case (mode @code{1}), as it's
584just saving buffer contents to a temporary file.
585
586Things get trickier, however, when master file is involved, as it
587requires to
588
589@itemize @bullet
590@item locate a master file
591@item patch it to include the current file using its new (temporary)
592name.
593@end itemize
594
595Locating a master file is discussed in the following section.
596
597Patching just changes all appropriate lines of the master file so that they
598use the new (temporary) name of the current file. For example, suppose current
599file name is @code{file.h}, the master file is @code{file.cpp}, and
600it includes current file via @code{#include "file.h"}. Current file's copy
601is saved to file @code{file_flymake.h}, so the include line must be
602changed to @code{#include "file_flymake.h"}. Finally, patched master file
603is saved to @code{file_flymake_master.cpp}, and the last one is passed to
604the syntax check tool.
605
606@node Locating a master file
607@section Locating a master file
608@cindex Master file
609
610Master file is located in two steps.
611
612First, a list of possible master files is built. A simple name
613matching is used to find the files. For a C++ header @code{file.h},
614Flymake searches for all @code{.cpp} files in the directories whose relative paths are
615stored in a customizable variable @code{flymake-master-file-dirs}, which
616usually contains something like @code{("." "./src")}. No more than
617@code{flymake-master-file-count-limit} entries is added to the master file
618list. The list is then sorted to move files with names @code{file.cpp} to
619the top.
620
621Next, each master file in a list is checked to contain the appropriate
622include directives. No more than @code{flymake-check-file-limit} of each
623file are parsed.
624
625For @code{file.h}, the include directives to look for are
626@code{#include "file.h"}, @code{#include "../file.h"}, etc. Each
627include is checked against a list of include directories
628(see @ref{Getting the include directories}) to be sure it points to the
629correct @code{file.h}.
630
631First matching master file found stops the search. The master file is then
632patched and saved to disk. In case no master file is found, syntax check is
633aborted, and corresponding status (!) is reported in the mode line.
634
635@node Getting the include directories
636@section Getting the include directories
637@cindex Include directories (C/C++ specific)
638
639Two sets of include directories are distinguished: system include directories
640and project include directories. The former is just the contents of the
641@code{INCLUDE} environment variable. The latter is not so easy to obtain,
642and the way it can be obtained can vary greatly for different projects.
643Therefore, a customizable variable
644@code{flymake-get-project-include-dirs-function} is used to provide the
645way to implement the desired behaviour.
646
647The default implementation, @code{flymake-get-project-include-dirs-imp},
648uses a @code{make} call. This requires a correct base directory, that is, a
649directory containing a correct @code{Makefile}, to be determined.
650
651As obtaining the project include directories might be a costly operation, its
652return value is cached in the hash table. The cache is cleared in the beginning
653of every syntax check attempt.
654
655@node Locating the buildfile
656@section Locating the buildfile
657@cindex Locating the buildfile
658@cindex buildfile, locating
659@cindex Makefile, locating
660
661Flymake can be configured to use different tools for performing syntax
662checks. For example, it can use direct compiler call to syntax check a perl
663script or a call to @code{make} for a more complicated case of a
664@code{C/C++} source. The general idea is that simple files, like perl
665scripts and html pages, can be checked by directly invoking a
666corresponding tool. Files that are usually more complex and generally
667used as part of larger projects, might require non-trivial options to
668be passed to the syntax check tool, like include directories for
669C++. The latter files are syntax checked using some build tool, like
670@code{make} or @code{Ant}.
671
672All @code{make} configuration data is usually stored in a file called
673@code{Makefile}. To allow for future extensions, flymake uses a notion of
674buildfile to reference the 'project configuration' file.
675
676Special function, @code{flymake-find-buildfile} is provided for locating buildfiles.
677Searching for a buildfile is done in a manner similar to that of searching
678for possible master files. A customizable variable
679@code{flymake-buildfile-dirs} holds a list of relative paths to the
680buildfile. They are checked sequentially until a buildfile is found. In case
681there's no build file, syntax check is aborted.
682
683Buildfile values are also cached.
684
685@node Starting the syntax check process
686@section Starting the syntax check process
687@cindex Syntax check process
688
689The command line (command name and the list of arguments) for launching a process is returned by the
690initialization function. Flymake then just calls @code{start-process}
691to start an asynchronous process and configures process filter and
692sentinel which is used for processing the output of the syntax check
693tool.
694
695@node Parsing the output
696@section Parsing the output
697@cindex Parsing the output
698
699The output generated by the syntax check tool is parsed in the process
700filter/sentinel using the error message patterns stored in the
701@code{flymake-err-line-patterns} variable. This variable contains a
702list of items of the form @code{(regexp file-idx line-idx
703err-text-idx)}, used to determine whether a particular line is an
704error message and extract file name, line number and error text,
705respectively. Error type (error/warning) is also guessed by matching
706error text with the '@code{^[wW]arning}' pattern. Anything that was not
707classified as a warning is considered an error. Type is then used to
708sort error menu items, which shows error messages first.
709
710Flymake is also able to interpret error message patterns missing err-text-idx
711information. This is done by merely taking the rest of the matched line
712(@code{(substring line (match-end 0))}) as error text. This trick allows
713to make use of a huge collection of error message line patterns from
714@code{compile.el}. All these error patterns are appended to
715the end of @code{flymake-err-line-patterns}.
716
717The error information obtained is saved in a buffer local
718variable. The buffer for which the process output belongs is
719determined from the process-id@w{}->@w{}buffer mapping updated
720after every process launch/exit.
721
722@node Highlighting erroneous lines
723@section Highlighting erroneous lines
724@cindex Erroneous lines, faces
725
726Highlighting is implemented with overlays and happens in the process
727sentinel, after calling the cleanup function. Two customizable faces
728are used: @code{flymake-errline-face} and
729@code{flymake-warnline-face}. Errors belonging outside the current
730buffer are considered to belong to line 1 of the current buffer.
731
732@node Interaction with other modes
733@section Interaction with other modes
734@cindex Interaction with other modes
735@cindex Interaction with compile mode
736
737The only mode flymake currently knows about is @code{compile}.
738
739Flymake can be configured to not start syntax check if it thinks the
740compilation is in progress. The check is made by the
741@code{flymake-compilation-is-running}, which tests the
742@code{compilation-in-progress} variable. The reason why this might be
743useful is saving CPU time in case both syntax check and compilation
744are very CPU intensive. The original reason for adding this feature,
745though, was working around a locking problem with MS Visual C++ compiler.
746
747Flymake also provides an alternative command for starting compilation,
748@code{flymake-compile}:
749
750@lisp
751(defun flymake-compile()
752 "kill all flymake syntax checks, start compilation"
753 (interactive)
754 (flymake-stop-all-syntax-checks)
755 (call-interactively 'compile)
756)
757@end lisp
758
759It just kills all the active syntax check processes before calling
760@code{compile}.
761
762@node Index
763@unnumbered Index
764
765@printindex cp
766
767@bye
768
769@ignore
770 arch-tag: 9f0db077-5598-49ab-90b9-8df9248a63ec
771@end ignore
diff --git a/man/makefile.w32-in b/man/makefile.w32-in
index 4ca90f18dba..ece0c97175c 100644
--- a/man/makefile.w32-in
+++ b/man/makefile.w32-in
@@ -1,6 +1,6 @@
1#### -*- Makefile -*- for the Emacs Manual and other documentation. 1#### -*- Makefile -*- for the Emacs Manual and other documentation.
2 2
3# Copyright (C) 2003 3# Copyright (C) 2003, 2004
4# Free Software Foundation, Inc. 4# Free Software Foundation, Inc.
5 5
6# This file is part of GNU Emacs. 6# This file is part of GNU Emacs.
@@ -45,13 +45,14 @@ INFO_TARGETS = $(infodir)/emacs $(infodir)/ccmode \
45 $(infodir)/pcl-cvs $(infodir)/woman \ 45 $(infodir)/pcl-cvs $(infodir)/woman \
46 $(infodir)/emacs-mime $(infodir)/eshell \ 46 $(infodir)/emacs-mime $(infodir)/eshell \
47 $(infodir)/speedbar $(infodir)/tramp \ 47 $(infodir)/speedbar $(infodir)/tramp \
48 $(infodir)/ses $(infodir)/smtpmail 48 $(infodir)/ses $(infodir)/smtpmail \
49 $(infodir)/flymake
49DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \ 50DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \
50 ediff.dvi forms.dvi gnus.dvi message.dvi mh-e.dvi \ 51 ediff.dvi forms.dvi gnus.dvi message.dvi mh-e.dvi \
51 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \ 52 reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \
52 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \ 53 ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \
53 pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \ 54 pcl-cvs.dvi woman.dvi emacs-mime.dvi eshell.dvi \
54 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi 55 speedbar.dvi tramp.dvi ses.dvi smtpmail.dvi flymake.dvi
55INFOSOURCES = info.texi 56INFOSOURCES = info.texi
56 57
57# The following rule does not work with all versions of `make'. 58# The following rule does not work with all versions of `make'.
@@ -177,6 +178,11 @@ $(infodir)/ediff: ediff.texi
177ediff.dvi: ediff.texi 178ediff.dvi: ediff.texi
178 $(ENVADD) $(TEXI2DVI) $(srcdir)/ediff.texi 179 $(ENVADD) $(TEXI2DVI) $(srcdir)/ediff.texi
179 180
181$(infodir)/flymake: flymake.texi
182 $(MAKEINFO) flymake.texi
183flymake.dvi: flymake.texi
184 $(ENVADD) $(TEXI2DVI) $(srcdir)/flymake.texi
185
180$(infodir)/forms: forms.texi 186$(infodir)/forms: forms.texi
181 $(MAKEINFO) forms.texi 187 $(MAKEINFO) forms.texi
182forms.dvi: forms.texi 188forms.dvi: forms.texi
@@ -185,7 +191,7 @@ forms.dvi: forms.texi
185$(infodir)/gnus: gnus.texi 191$(infodir)/gnus: gnus.texi
186 $(MAKEINFO) gnus.texi 192 $(MAKEINFO) gnus.texi
187gnus.dvi: gnus.texi 193gnus.dvi: gnus.texi
188 sed -e '/@iflatex/,/@end iflatex/d' $(srcdir)/gnus.texi > gnustmp.texi 194 sed -e '/@iflatex/,/@end iflatex/d' $(srcdir)/gnus.texi > gnustmp.texi
189 $(ENVADD) $(TEXI2DVI) gnustmp.texi 195 $(ENVADD) $(TEXI2DVI) gnustmp.texi
190 cp gnustmp.dvi $*.dvi 196 cp gnustmp.dvi $*.dvi
191 rm gnustmp.* 197 rm gnustmp.*
diff --git a/man/trampver.texi b/man/trampver.texi
index b125e9a20b6..4ffc14a48c2 100644
--- a/man/trampver.texi
+++ b/man/trampver.texi
@@ -4,7 +4,7 @@
4@c In the Tramp CVS, the version number is auto-frobbed from 4@c In the Tramp CVS, the version number is auto-frobbed from
5@c configure.ac, so you should edit that file and run 5@c configure.ac, so you should edit that file and run
6@c "autoconf && ./configure" to change the version number. 6@c "autoconf && ./configure" to change the version number.
7@set trampver 2.0.40 7@set trampver 2.0.41
8 8
9@c Other flags from configuration 9@c Other flags from configuration
10@set prefix /usr/local 10@set prefix /usr/local
diff --git a/src/ChangeLog b/src/ChangeLog
index df10f95e500..4be50d1108d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,92 @@
12004-05-29 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * macfns.c: Don't include ccl.h.
4 [MAC_OSX]: Don't include QuickTime/QuickTime.h.
5 [!MAC_OSX]: Don't include alloca.h, Windows.h, Gestalt.h, or
6 TextUtils.h.
7 (Fx_create_frame): Sync with xfns.c. Initialize cursor
8 descriptors.
9 (Fx_display_mm_height, Fx_display_mm_width): Calculate length from
10 display height/width.
11 (compute_tip_xy, Vx_max_tooltip_size): Declare.
12 (unwind_create_tip_frame, compute_tip_xy): New functions.
13 (x_create_tip_frame, Fx_show_tip, Fx_hide_tip): Sync with xfns.c.
14 (syms_of_macfns): Initialize Qcancel_timer, Vx_max_tooltip_size,
15 and last_show_tip_args.
16
17 * macgui.h [!MAC_OSX]: Include Gestalt.h.
18 (Cursor, No_Cursor): New defines.
19 [!TARGET_API_MAC_CARBON] (SetPortWindowPort): New compatibility
20 macro.
21 [!TARGET_API_MAC_CARBON] (arrow_cursor): Declare.
22
23 * macmenu.c (mac_menu_show, mac_dialog): Use SetPortWindowPort.
24
25 * macterm.c: Don't include Gestalt.h.
26 (enum mouse_tracking_type, mouse_tracking_in_progress): Remove.
27 (XDrawLine, XClearArea, XClearWindow, mac_draw_bitmap)
28 (mac_set_clip_rectangle, mac_reset_clipping, XCreatePixmap)
29 (XFillRectangle, mac_draw_rectangle, mac_draw_string_common)
30 (mac_copy_area, mac_copy_area_with_mask, x_update_end)
31 (construct_mouse_click, XTmouse_position)
32 (x_scroll_bar_report_motion, x_calc_absolute_position)
33 (do_mouse_moved, do_zoom_window, mac_do_receive_drag)
34 (XTread_socket, make_mac_frame): Use SetPortWindowPort.
35 (note_mouse_movement): Clear the mouse face and reset the pointer
36 shape when the pointer goes outside the frame without grabbing.
37 (mac_front_window): New function.
38 (mac_window_to_frame): New macro.
39 (XTmouse_position, x_scroll_bar_report_motion, do_window_update)
40 (do_window_activate, do_window_deactivate, do_app_resume)
41 (do_app_suspend, do_mouse_moved, do_menu_choice, do_grow_window)
42 (do_zoom_window, mac_do_receive_drag, XTread_socket)
43 (mac_check_for_quit_char): Use mac_front_window and/or
44 mac_window_to_frame.
45 (x_scroll_bar_handle_click): Set `(PORTION . WHOLE)' part in a
46 scroll-bar click event.
47 (mac_define_frame_cursor): Change the pointer shape.
48 (x_free_frame_resources): Reset tip_window to NULL when it is
49 disposed.
50 [!TARGET_API_MAC_CARBON] (arrow_cursor): New variable.
51 [!TARGET_API_MAC_CARBON] (do_init_managers): Initialize
52 arrow_cursor.
53 (do_window_update): Don't do anything if the updated window is the
54 tooltip window.
55 (do_mouse_moved): Handle mouse movement events here (previously in
56 XTread_socket). Clear the mouse face if
57 dpyinfo->mouse_face_hidden is set.
58 (do_os_event, do_events): Remove (now in XTread_socket).
59 (XTread_socket): Immediately return if interrupt_input_blocked.
60 Loop until all the events in the queue are processed. Rearrange
61 codes for mouse grabbing. Add tooltip support. Include the
62 contents of do_os_event and do_events. Remove mouse movement
63 handling (now in do_mouse_moved). Add the case where
64 Vmouse_highlight has an integer value.
65 (NewMacWindow): Remove.
66 (make_mac_frame): Do what NewMacWindow previously did. Don't do
67 excess initializations.
68 (make_mac_terminal_frame): Previous initializations in
69 make_mac_frame are moved here.
70 (mac_initialize_display_info): Initialize
71 dpyinfo->mouse_face_overlay and dpyinfo->mouse_face_hidden.
72
73 * xdisp.c [MAC_OS] (No_Cursor): Remove variable.
74 (define_frame_cursor1): Don't treat HAVE_CARBON as a special case.
75
762004-05-29 Richard M. Stallman <rms@gnu.org>
77
78 * lisp.h (truncate_undo_list): Update decl.
79
80 * alloc.c (undo_outer_limit): New variable.
81 (syms_of_alloc): Defvar it.
82 (Fgarbage_collect): Pass undo_outer_limit to truncate_undo_list.
83
84 * undo.c (truncate_undo_list): New arg LIMITSIZE.
85
86 * alloc.c (lisp_align_malloc): Check for base == 0
87 regardless of HAVE_POSIX_MEMALIGN.
88 Clean up HAVE_POSIX_MEMALIGN handling of `err'.
89
12004-05-28 Stefan Monnier <monnier@iro.umontreal.ca> 902004-05-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 91
3 * alloc.c: Undo Kim's recent changes and fix the same bug differently. 92 * alloc.c: Undo Kim's recent changes and fix the same bug differently.
diff --git a/src/alloc.c b/src/alloc.c
index adedb414aad..3a3628f40fd 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -155,6 +155,7 @@ int malloc_sbrk_unused;
155 155
156EMACS_INT undo_limit; 156EMACS_INT undo_limit;
157EMACS_INT undo_strong_limit; 157EMACS_INT undo_strong_limit;
158EMACS_INT undo_outer_limit;
158 159
159/* Number of live and free conses etc. */ 160/* Number of live and free conses etc. */
160 161
@@ -755,17 +756,20 @@ lisp_align_malloc (nbytes, type)
755#ifdef HAVE_POSIX_MEMALIGN 756#ifdef HAVE_POSIX_MEMALIGN
756 { 757 {
757 int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES); 758 int err = posix_memalign (&base, BLOCK_ALIGN, ABLOCKS_BYTES);
758 abase = err ? (base = NULL) : base; 759 if (err)
760 base = NULL;
761 abase = base;
759 } 762 }
760#else 763#else
761 base = malloc (ABLOCKS_BYTES); 764 base = malloc (ABLOCKS_BYTES);
762 abase = ALIGN (base, BLOCK_ALIGN); 765 abase = ALIGN (base, BLOCK_ALIGN);
766#endif
767
763 if (base == 0) 768 if (base == 0)
764 { 769 {
765 UNBLOCK_INPUT; 770 UNBLOCK_INPUT;
766 memory_full (); 771 memory_full ();
767 } 772 }
768#endif
769 773
770 aligned = (base == abase); 774 aligned = (base == abase);
771 if (!aligned) 775 if (!aligned)
@@ -4381,7 +4385,7 @@ returns nil, because real GC can't be done. */)
4381 if (! EQ (nextb->undo_list, Qt)) 4385 if (! EQ (nextb->undo_list, Qt))
4382 nextb->undo_list 4386 nextb->undo_list
4383 = truncate_undo_list (nextb->undo_list, undo_limit, 4387 = truncate_undo_list (nextb->undo_list, undo_limit,
4384 undo_strong_limit); 4388 undo_strong_limit, undo_outer_limit);
4385 4389
4386 /* Shrink buffer gaps, but skip indirect and dead buffers. */ 4390 /* Shrink buffer gaps, but skip indirect and dead buffers. */
4387 if (nextb->base_buffer == 0 && !NILP (nextb->name)) 4391 if (nextb->base_buffer == 0 && !NILP (nextb->name))
@@ -5668,12 +5672,20 @@ which includes both saved text and other data. */);
5668 5672
5669 DEFVAR_INT ("undo-strong-limit", &undo_strong_limit, 5673 DEFVAR_INT ("undo-strong-limit", &undo_strong_limit,
5670 doc: /* Don't keep more than this much size of undo information. 5674 doc: /* Don't keep more than this much size of undo information.
5671A command which pushes past this size is itself forgotten. 5675A previous command which pushes the undo list past this size
5672This limit is applied when garbage collection happens. 5676is entirely forgotten when GC happens.
5673The size is counted as the number of bytes occupied, 5677The size is counted as the number of bytes occupied,
5674which includes both saved text and other data. */); 5678which includes both saved text and other data. */);
5675 undo_strong_limit = 30000; 5679 undo_strong_limit = 30000;
5676 5680
5681 DEFVAR_INT ("undo-outer-limit", &undo_outer_limit,
5682 doc: /* Don't keep more than this much size of undo information.
5683If the current command has produced more than this much undo information,
5684GC discards it. This is a last-ditch limit to prevent memory overflow.
5685The size is counted as the number of bytes occupied,
5686which includes both saved text and other data. */);
5687 undo_outer_limit = 300000;
5688
5677 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages, 5689 DEFVAR_BOOL ("garbage-collection-messages", &garbage_collection_messages,
5678 doc: /* Non-nil means display messages at start and end of garbage collection. */); 5690 doc: /* Non-nil means display messages at start and end of garbage collection. */);
5679 garbage_collection_messages = 0; 5691 garbage_collection_messages = 0;
diff --git a/src/lisp.h b/src/lisp.h
index ca060cb4c2f..fdf76399e5d 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3009,7 +3009,7 @@ extern void syms_of_macros P_ ((void));
3009/* defined in undo.c */ 3009/* defined in undo.c */
3010extern Lisp_Object Qinhibit_read_only; 3010extern Lisp_Object Qinhibit_read_only;
3011EXFUN (Fundo_boundary, 0); 3011EXFUN (Fundo_boundary, 0);
3012extern Lisp_Object truncate_undo_list P_ ((Lisp_Object, int, int)); 3012extern Lisp_Object truncate_undo_list P_ ((Lisp_Object, int, int, int));
3013extern void record_marker_adjustment P_ ((Lisp_Object, int)); 3013extern void record_marker_adjustment P_ ((Lisp_Object, int));
3014extern void record_insert P_ ((int, int)); 3014extern void record_insert P_ ((int, int));
3015extern void record_delete P_ ((int, Lisp_Object)); 3015extern void record_delete P_ ((int, Lisp_Object));
diff --git a/src/macfns.c b/src/macfns.c
index 625ca29336c..4147325c288 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */
42#include "epaths.h" 42#include "epaths.h"
43#include "termhooks.h" 43#include "termhooks.h"
44#include "coding.h" 44#include "coding.h"
45#include "ccl.h"
46#include "systime.h" 45#include "systime.h"
47 46
48/* #include "bitmaps/gray.xbm" */ 47/* #include "bitmaps/gray.xbm" */
@@ -59,17 +58,6 @@ static unsigned char gray_bits[] = {
59 58
60#include <stdlib.h> 59#include <stdlib.h>
61#include <string.h> 60#include <string.h>
62#ifndef MAC_OSX
63#include <alloca.h>
64#endif
65
66#ifdef MAC_OSX
67#include <QuickTime/QuickTime.h>
68#else /* not MAC_OSX */
69#include <Windows.h>
70#include <Gestalt.h>
71#include <TextUtils.h>
72#endif /* not MAC_OSX */
73 61
74/*extern void free_frame_menubar (); 62/*extern void free_frame_menubar ();
75extern double atof (); 63extern double atof ();
@@ -2580,8 +2568,6 @@ This function is an internal primitive--use `make-frame' instead. */)
2580 f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output)); 2568 f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output));
2581 bzero (f->output_data.mac, sizeof (struct mac_output)); 2569 bzero (f->output_data.mac, sizeof (struct mac_output));
2582 FRAME_FONTSET (f) = -1; 2570 FRAME_FONTSET (f) = -1;
2583 f->output_data.mac->scroll_bar_foreground_pixel = -1;
2584 f->output_data.mac->scroll_bar_background_pixel = -1;
2585 record_unwind_protect (unwind_create_frame, frame); 2571 record_unwind_protect (unwind_create_frame, frame);
2586 2572
2587 f->icon_name 2573 f->icon_name
@@ -2717,25 +2703,32 @@ This function is an internal primitive--use `make-frame' instead. */)
2717 2703
2718 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; 2704 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
2719 2705
2720 /* MAC_TODO: specify 1 below when toolbars are implemented. */ 2706#if TARGET_API_MAC_CARBON
2721 window_prompting = x_figure_window_size (f, parms, 0); 2707 f->output_data.mac->text_cursor = kThemeIBeamCursor;
2708 f->output_data.mac->nontext_cursor = kThemeArrowCursor;
2709 f->output_data.mac->modeline_cursor = kThemeArrowCursor;
2710 f->output_data.mac->hand_cursor = kThemePointingHandCursor;
2711 f->output_data.mac->hourglass_cursor = kThemeWatchCursor;
2712 f->output_data.mac->horizontal_drag_cursor = kThemeResizeLeftRightCursor;
2713#else
2714 f->output_data.mac->text_cursor = GetCursor (iBeamCursor);
2715 f->output_data.mac->nontext_cursor = &arrow_cursor;
2716 f->output_data.mac->modeline_cursor = &arrow_cursor;
2717 f->output_data.mac->hand_cursor = &arrow_cursor;
2718 f->output_data.mac->hourglass_cursor = GetCursor (watchCursor);
2719 f->output_data.mac->horizontal_drag_cursor = &arrow_cursor;
2720#endif
2721
2722 /* Compute the size of the window. */
2723 window_prompting = x_figure_window_size (f, parms, 1);
2722 2724
2723 tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); 2725 tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN);
2724 f->no_split = minibuffer_only || EQ (tem, Qt); 2726 f->no_split = minibuffer_only || EQ (tem, Qt);
2725 2727
2726 /* Create the window. Add the tool-bar height to the initial frame
2727 height so that the user gets a text display area of the size he
2728 specified with -g or via the registry. Later changes of the
2729 tool-bar height don't change the frame size. This is done so that
2730 users can create tall Emacs frames without having to guess how
2731 tall the tool-bar will get. */
2732 FRAME_LINES (f) += FRAME_TOOL_BAR_LINES (f);
2733
2734 /* mac_window (f, window_prompting, minibuffer_only); */ 2728 /* mac_window (f, window_prompting, minibuffer_only); */
2735 make_mac_frame (f); 2729 make_mac_frame (f);
2736 2730
2737 x_icon (f, parms); 2731 x_icon (f, parms);
2738
2739 x_make_gc (f); 2732 x_make_gc (f);
2740 2733
2741 /* Now consider the frame official. */ 2734 /* Now consider the frame official. */
@@ -2754,7 +2747,8 @@ This function is an internal primitive--use `make-frame' instead. */)
2754 x_default_parameter (f, parms, Qcursor_type, Qbox, 2747 x_default_parameter (f, parms, Qcursor_type, Qbox,
2755 "cursorType", "CursorType", RES_TYPE_SYMBOL); 2748 "cursorType", "CursorType", RES_TYPE_SYMBOL);
2756 x_default_parameter (f, parms, Qscroll_bar_width, Qnil, 2749 x_default_parameter (f, parms, Qscroll_bar_width, Qnil,
2757 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER); 2750 "scrollBarWidth", "ScrollBarWidth",
2751 RES_TYPE_NUMBER);
2758 2752
2759 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size. 2753 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
2760 Change will not be effected unless different from the current 2754 Change will not be effected unless different from the current
@@ -2762,13 +2756,10 @@ This function is an internal primitive--use `make-frame' instead. */)
2762 width = FRAME_COLS (f); 2756 width = FRAME_COLS (f);
2763 height = FRAME_LINES (f); 2757 height = FRAME_LINES (f);
2764 2758
2765 FRAME_LINES (f) = 0;
2766 SET_FRAME_COLS (f, 0); 2759 SET_FRAME_COLS (f, 0);
2760 FRAME_LINES (f) = 0;
2767 change_frame_size (f, height, width, 1, 0, 0); 2761 change_frame_size (f, height, width, 1, 0, 0);
2768 2762
2769 /* Set up faces after all frame parameters are known. */
2770 call1 (Qface_set_after_frame_default, frame);
2771
2772#if 0 /* MAC_TODO: when we have window manager hints */ 2763#if 0 /* MAC_TODO: when we have window manager hints */
2773 /* Tell the server what size and position, etc, we want, and how 2764 /* Tell the server what size and position, etc, we want, and how
2774 badly we want them. This should be done after we have the menu 2765 badly we want them. This should be done after we have the menu
@@ -3025,11 +3016,8 @@ If omitted or nil, that stands for the selected frame's display. */)
3025 /* MAC_TODO: this is an approximation, and only of the main display */ 3016 /* MAC_TODO: this is an approximation, and only of the main display */
3026 3017
3027 struct mac_display_info *dpyinfo = check_x_display_info (display); 3018 struct mac_display_info *dpyinfo = check_x_display_info (display);
3028 short h, v;
3029 3019
3030 ScreenRes (&h, &v); 3020 return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy));
3031
3032 return make_number ((int) (v / 72.0 * 25.4));
3033} 3021}
3034 3022
3035DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, 3023DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
@@ -3043,11 +3031,8 @@ If omitted or nil, that stands for the selected frame's display. */)
3043 /* MAC_TODO: this is an approximation, and only of the main display */ 3031 /* MAC_TODO: this is an approximation, and only of the main display */
3044 3032
3045 struct mac_display_info *dpyinfo = check_x_display_info (display); 3033 struct mac_display_info *dpyinfo = check_x_display_info (display);
3046 short h, v;
3047
3048 ScreenRes (&h, &v);
3049 3034
3050 return make_number ((int) (h / 72.0 * 25.4)); 3035 return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx));
3051} 3036}
3052 3037
3053DEFUN ("x-display-backing-store", Fx_display_backing_store, 3038DEFUN ("x-display-backing-store", Fx_display_backing_store,
@@ -3595,9 +3580,11 @@ hide_hourglass ()
3595 ***********************************************************************/ 3580 ***********************************************************************/
3596 3581
3597static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *, 3582static Lisp_Object x_create_tip_frame P_ ((struct mac_display_info *,
3598 Lisp_Object)); 3583 Lisp_Object, Lisp_Object));
3584static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
3585 Lisp_Object, int, int, int *, int *));
3599 3586
3600/* The frame of a currently visible tooltip, or null. */ 3587/* The frame of a currently visible tooltip. */
3601 3588
3602Lisp_Object tip_frame; 3589Lisp_Object tip_frame;
3603 3590
@@ -3612,15 +3599,42 @@ Window tip_window;
3612 3599
3613Lisp_Object last_show_tip_args; 3600Lisp_Object last_show_tip_args;
3614 3601
3602/* Maximum size for tooltips; a cons (COLUMNS . ROWS). */
3603
3604Lisp_Object Vx_max_tooltip_size;
3605
3606
3607static Lisp_Object
3608unwind_create_tip_frame (frame)
3609 Lisp_Object frame;
3610{
3611 Lisp_Object deleted;
3612
3613 deleted = unwind_create_frame (frame);
3614 if (EQ (deleted, Qt))
3615 {
3616 tip_window = NULL;
3617 tip_frame = Qnil;
3618 }
3619
3620 return deleted;
3621}
3622
3623
3615/* Create a frame for a tooltip on the display described by DPYINFO. 3624/* Create a frame for a tooltip on the display described by DPYINFO.
3616 PARMS is a list of frame parameters. Value is the frame. */ 3625 PARMS is a list of frame parameters. TEXT is the string to
3626 display in the tip frame. Value is the frame.
3627
3628 Note that functions called here, esp. x_default_parameter can
3629 signal errors, for instance when a specified color name is
3630 undefined. We have to make sure that we're in a consistent state
3631 when this happens. */
3617 3632
3618static Lisp_Object 3633static Lisp_Object
3619x_create_tip_frame (dpyinfo, parms) 3634x_create_tip_frame (dpyinfo, parms, text)
3620 struct mac_display_info *dpyinfo; 3635 struct mac_display_info *dpyinfo;
3621 Lisp_Object parms; 3636 Lisp_Object parms, text;
3622{ 3637{
3623#if 0 /* MAC_TODO : Mac version */
3624 struct frame *f; 3638 struct frame *f;
3625 Lisp_Object frame, tem; 3639 Lisp_Object frame, tem;
3626 Lisp_Object name; 3640 Lisp_Object name;
@@ -3629,8 +3643,11 @@ x_create_tip_frame (dpyinfo, parms)
3629 int count = SPECPDL_INDEX (); 3643 int count = SPECPDL_INDEX ();
3630 struct gcpro gcpro1, gcpro2, gcpro3; 3644 struct gcpro gcpro1, gcpro2, gcpro3;
3631 struct kboard *kb; 3645 struct kboard *kb;
3646 int face_change_count_before = face_change_count;
3647 Lisp_Object buffer;
3648 struct buffer *old_buffer;
3632 3649
3633 check_x (); 3650 check_mac ();
3634 3651
3635 /* Use this general default value to start with until we know if 3652 /* Use this general default value to start with until we know if
3636 this frame has a specified name. */ 3653 this frame has a specified name. */
@@ -3643,7 +3660,7 @@ x_create_tip_frame (dpyinfo, parms)
3643#endif 3660#endif
3644 3661
3645 /* Get the name of the frame to use for resource lookup. */ 3662 /* Get the name of the frame to use for resource lookup. */
3646 name = w32_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING); 3663 name = mac_get_arg (parms, Qname, "name", "Name", RES_TYPE_STRING);
3647 if (!STRINGP (name) 3664 if (!STRINGP (name)
3648 && !EQ (name, Qunbound) 3665 && !EQ (name, Qunbound)
3649 && !NILP (name)) 3666 && !NILP (name))
@@ -3652,31 +3669,50 @@ x_create_tip_frame (dpyinfo, parms)
3652 3669
3653 frame = Qnil; 3670 frame = Qnil;
3654 GCPRO3 (parms, name, frame); 3671 GCPRO3 (parms, name, frame);
3655 tip_frame = f = make_frame (1); 3672 f = make_frame (1);
3656 XSETFRAME (frame, f); 3673 XSETFRAME (frame, f);
3674
3675 buffer = Fget_buffer_create (build_string (" *tip*"));
3676 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
3677 old_buffer = current_buffer;
3678 set_buffer_internal_1 (XBUFFER (buffer));
3679 current_buffer->truncate_lines = Qnil;
3680 specbind (Qinhibit_read_only, Qt);
3681 specbind (Qinhibit_modification_hooks, Qt);
3682 Ferase_buffer ();
3683 Finsert (1, &text);
3684 set_buffer_internal_1 (old_buffer);
3685
3657 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0; 3686 FRAME_CAN_HAVE_SCROLL_BARS (f) = 0;
3687 record_unwind_protect (unwind_create_tip_frame, frame);
3658 3688
3659 f->output_method = output_w32; 3689 /* By setting the output method, we're essentially saying that
3660 f->output_data.w32 = 3690 the frame is live, as per FRAME_LIVE_P. If we get a signal
3661 (struct w32_output *) xmalloc (sizeof (struct w32_output)); 3691 from this point on, x_destroy_window might screw up reference
3662 bzero (f->output_data.w32, sizeof (struct w32_output)); 3692 counts etc. */
3663#if 0 3693 f->output_method = output_mac;
3664 f->output_data.w32->icon_bitmap = -1; 3694 f->output_data.mac =
3665#endif 3695 (struct mac_output *) xmalloc (sizeof (struct mac_output));
3666 FRAME_FONTSET (f) = -1; 3696 bzero (f->output_data.mac, sizeof (struct mac_output));
3697
3698 FRAME_FONTSET (f) = -1;
3667 f->icon_name = Qnil; 3699 f->icon_name = Qnil;
3668 3700
3701#if 0 /* GLYPH_DEBUG TODO: image support. */
3702 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
3703 dpyinfo_refcount = dpyinfo->reference_count;
3704#endif /* GLYPH_DEBUG */
3669#ifdef MULTI_KBOARD 3705#ifdef MULTI_KBOARD
3670 FRAME_KBOARD (f) = kb; 3706 FRAME_KBOARD (f) = kb;
3671#endif 3707#endif
3672 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; 3708 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
3673 f->output_data.w32->explicit_parent = 0; 3709 f->output_data.mac->explicit_parent = 0;
3674 3710
3675 /* Set the name; the functions to which we pass f expect the name to 3711 /* Set the name; the functions to which we pass f expect the name to
3676 be set. */ 3712 be set. */
3677 if (EQ (name, Qunbound) || NILP (name)) 3713 if (EQ (name, Qunbound) || NILP (name))
3678 { 3714 {
3679 f->name = build_string (dpyinfo->x_id_name); 3715 f->name = build_string (dpyinfo->mac_id_name);
3680 f->explicit_name = 0; 3716 f->explicit_name = 0;
3681 } 3717 }
3682 else 3718 else
@@ -3687,12 +3723,12 @@ x_create_tip_frame (dpyinfo, parms)
3687 specbind (Qx_resource_name, name); 3723 specbind (Qx_resource_name, name);
3688 } 3724 }
3689 3725
3690 /* Extract the window parameters from the supplied values 3726 /* Extract the window parameters from the supplied values that are
3691 that are needed to determine window geometry. */ 3727 needed to determine window geometry. */
3692 { 3728 {
3693 Lisp_Object font; 3729 Lisp_Object font;
3694 3730
3695 font = w32_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING); 3731 font = mac_get_arg (parms, Qfont, "font", "Font", RES_TYPE_STRING);
3696 3732
3697 BLOCK_INPUT; 3733 BLOCK_INPUT;
3698 /* First, try whatever font the caller has specified. */ 3734 /* First, try whatever font the caller has specified. */
@@ -3706,22 +3742,16 @@ x_create_tip_frame (dpyinfo, parms)
3706 } 3742 }
3707 3743
3708 /* Try out a font which we hope has bold and italic variations. */ 3744 /* Try out a font which we hope has bold and italic variations. */
3709 if (!STRINGP (font))
3710 font = x_new_font (f, "-adobe-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-1");
3711 if (!STRINGP (font))
3712 font = x_new_font (f, "-misc-fixed-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
3713 if (! STRINGP (font))
3714 font = x_new_font (f, "-*-*-medium-r-normal-*-*-140-*-*-c-*-iso8859-1");
3715 if (! STRINGP (font)) 3745 if (! STRINGP (font))
3716 /* This was formerly the first thing tried, but it finds too many fonts 3746 font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
3717 and takes too long. */
3718 font = x_new_font (f, "-*-*-medium-r-*-*-*-*-*-*-c-*-iso8859-1");
3719 /* If those didn't work, look for something which will at least work. */ 3747 /* If those didn't work, look for something which will at least work. */
3720 if (! STRINGP (font)) 3748 if (! STRINGP (font))
3721 font = x_new_font (f, "-*-fixed-*-*-*-*-*-140-*-*-c-*-iso8859-1"); 3749 font = x_new_font (f, "-*-monaco-*-12-*-mac-roman");
3750 if (! STRINGP (font))
3751 font = x_new_font (f, "-*-courier-*-10-*-mac-roman");
3722 UNBLOCK_INPUT; 3752 UNBLOCK_INPUT;
3723 if (! STRINGP (font)) 3753 if (! STRINGP (font))
3724 font = build_string ("fixed"); 3754 error ("Cannot find any usable font");
3725 3755
3726 x_default_parameter (f, parms, Qfont, font, 3756 x_default_parameter (f, parms, Qfont, font,
3727 "font", "Font", RES_TYPE_STRING); 3757 "font", "Font", RES_TYPE_STRING);
@@ -3737,7 +3767,7 @@ x_create_tip_frame (dpyinfo, parms)
3737 { 3767 {
3738 Lisp_Object value; 3768 Lisp_Object value;
3739 3769
3740 value = w32_get_arg (parms, Qinternal_border_width, 3770 value = mac_get_arg (parms, Qinternal_border_width,
3741 "internalBorder", "internalBorder", RES_TYPE_NUMBER); 3771 "internalBorder", "internalBorder", RES_TYPE_NUMBER);
3742 if (! EQ (value, Qunbound)) 3772 if (! EQ (value, Qunbound))
3743 parms = Fcons (Fcons (Qinternal_border_width, value), 3773 parms = Fcons (Fcons (Qinternal_border_width, value),
@@ -3768,34 +3798,26 @@ x_create_tip_frame (dpyinfo, parms)
3768 happen. */ 3798 happen. */
3769 init_frame_faces (f); 3799 init_frame_faces (f);
3770 3800
3771 f->output_data.w32->parent_desc = FRAME_W32_DISPLAY_INFO (f)->root_window; 3801 f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window;
3772 3802
3773 window_prompting = x_figure_window_size (f, parms, 0); 3803 window_prompting = x_figure_window_size (f, parms, 0);
3774 3804
3775 { 3805 {
3776 XSetWindowAttributes attrs;
3777 unsigned long mask;
3778
3779 BLOCK_INPUT; 3806 BLOCK_INPUT;
3780 mask = CWBackPixel | CWOverrideRedirect | CWSaveUnder | CWEventMask; 3807 Rect r;
3781 /* Window managers looks at the override-redirect flag to 3808
3782 determine whether or net to give windows a decoration (Xlib 3809 SetRect (&r, 0, 0, 1, 1);
3783 3.2.8). */ 3810 if (CreateNewWindow (kHelpWindowClass,
3784 attrs.override_redirect = True; 3811 kWindowNoActivatesAttribute
3785 attrs.save_under = True; 3812 | kWindowIgnoreClicksAttribute,
3786 attrs.background_pixel = FRAME_BACKGROUND_PIXEL (f); 3813 &r, &tip_window) == noErr)
3787 /* Arrange for getting MapNotify and UnmapNotify events. */ 3814 {
3788 attrs.event_mask = StructureNotifyMask; 3815 FRAME_MAC_WINDOW (f) = tip_window;
3789 tip_window 3816 SetWRefCon (tip_window, (long) f->output_data.mac);
3790 = FRAME_W32_WINDOW (f) 3817 /* so that update events can find this mac_output struct */
3791 = XCreateWindow (FRAME_W32_DISPLAY (f), 3818 f->output_data.mac->mFP = f;
3792 FRAME_W32_DISPLAY_INFO (f)->root_window, 3819 ShowWindow (tip_window);
3793 /* x, y, width, height */ 3820 }
3794 0, 0, 1, 1,
3795 /* Border. */
3796 1,
3797 CopyFromParent, InputOutput, CopyFromParent,
3798 mask, &attrs);
3799 UNBLOCK_INPUT; 3821 UNBLOCK_INPUT;
3800 } 3822 }
3801 3823
@@ -3813,8 +3835,8 @@ x_create_tip_frame (dpyinfo, parms)
3813 FRAME_LINES (f). */ 3835 FRAME_LINES (f). */
3814 width = FRAME_COLS (f); 3836 width = FRAME_COLS (f);
3815 height = FRAME_LINES (f); 3837 height = FRAME_LINES (f);
3816 FRAME_LINES (f) = 0;
3817 SET_FRAME_COLS (f, 0); 3838 SET_FRAME_COLS (f, 0);
3839 FRAME_LINES (f) = 0;
3818 change_frame_size (f, height, width, 1, 0, 0); 3840 change_frame_size (f, height, width, 1, 0, 0);
3819 3841
3820 /* Add `tooltip' frame parameter's default value. */ 3842 /* Add `tooltip' frame parameter's default value. */
@@ -3822,6 +3844,26 @@ x_create_tip_frame (dpyinfo, parms)
3822 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt), 3844 Fmodify_frame_parameters (frame, Fcons (Fcons (intern ("tooltip"), Qt),
3823 Qnil)); 3845 Qnil));
3824 3846
3847 /* Set up faces after all frame parameters are known. This call
3848 also merges in face attributes specified for new frames.
3849
3850 Frame parameters may be changed if .Xdefaults contains
3851 specifications for the default font. For example, if there is an
3852 `Emacs.default.attributeBackground: pink', the `background-color'
3853 attribute of the frame get's set, which let's the internal border
3854 of the tooltip frame appear in pink. Prevent this. */
3855 {
3856 Lisp_Object bg = Fframe_parameter (frame, Qbackground_color);
3857
3858 /* Set tip_frame here, so that */
3859 tip_frame = frame;
3860 call1 (Qface_set_after_frame_default, frame);
3861
3862 if (!EQ (bg, Fframe_parameter (frame, Qbackground_color)))
3863 Fmodify_frame_parameters (frame, Fcons (Fcons (Qbackground_color, bg),
3864 Qnil));
3865 }
3866
3825 f->no_split = 1; 3867 f->no_split = 1;
3826 3868
3827 UNGCPRO; 3869 UNGCPRO;
@@ -3833,17 +3875,80 @@ x_create_tip_frame (dpyinfo, parms)
3833 3875
3834 /* Now that the frame is official, it counts as a reference to 3876 /* Now that the frame is official, it counts as a reference to
3835 its display. */ 3877 its display. */
3836 FRAME_W32_DISPLAY_INFO (f)->reference_count++; 3878 FRAME_MAC_DISPLAY_INFO (f)->reference_count++;
3879
3880 /* Setting attributes of faces of the tooltip frame from resources
3881 and similar will increment face_change_count, which leads to the
3882 clearing of all current matrices. Since this isn't necessary
3883 here, avoid it by resetting face_change_count to the value it
3884 had before we created the tip frame. */
3885 face_change_count = face_change_count_before;
3837 3886
3887 /* Discard the unwind_protect. */
3838 return unbind_to (count, frame); 3888 return unbind_to (count, frame);
3839#endif /* MAC_TODO */ 3889}
3840 return Qnil; 3890
3891
3892/* Compute where to display tip frame F. PARMS is the list of frame
3893 parameters for F. DX and DY are specified offsets from the current
3894 location of the mouse. WIDTH and HEIGHT are the width and height
3895 of the tooltip. Return coordinates relative to the root window of
3896 the display in *ROOT_X, and *ROOT_Y. */
3897
3898static void
3899compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
3900 struct frame *f;
3901 Lisp_Object parms, dx, dy;
3902 int width, height;
3903 int *root_x, *root_y;
3904{
3905 Lisp_Object left, top;
3906
3907 /* User-specified position? */
3908 left = Fcdr (Fassq (Qleft, parms));
3909 top = Fcdr (Fassq (Qtop, parms));
3910
3911 /* Move the tooltip window where the mouse pointer is. Resize and
3912 show it. */
3913 if (!INTEGERP (left) || !INTEGERP (top))
3914 {
3915 Point mouse_pos;
3916
3917 BLOCK_INPUT;
3918 GetMouse (&mouse_pos);
3919 LocalToGlobal (&mouse_pos);
3920 *root_x = mouse_pos.h;
3921 *root_y = mouse_pos.v;
3922 UNBLOCK_INPUT;
3923 }
3924
3925 if (INTEGERP (top))
3926 *root_y = XINT (top);
3927 else if (*root_y + XINT (dy) - height < 0)
3928 *root_y -= XINT (dy);
3929 else
3930 {
3931 *root_y -= height;
3932 *root_y += XINT (dy);
3933 }
3934
3935 if (INTEGERP (left))
3936 *root_x = XINT (left);
3937 else if (*root_x + XINT (dx) + width <= FRAME_MAC_DISPLAY_INFO (f)->width)
3938 /* It fits to the right of the pointer. */
3939 *root_x += XINT (dx);
3940 else if (width + XINT (dx) <= *root_x)
3941 /* It fits to the left of the pointer. */
3942 *root_x -= width + XINT (dx);
3943 else
3944 /* Put it left-justified on the screen -- it ought to fit that way. */
3945 *root_x = 0;
3841} 3946}
3842 3947
3843 3948
3844DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, 3949DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
3845 doc : /* Show STRING in a "tooltip" window on frame FRAME. 3950 doc: /* Show STRING in a "tooltip" window on frame FRAME.
3846A tooltip window is a small window displaying a string. 3951A tooltip window is a small X window displaying a string.
3847 3952
3848FRAME nil or omitted means use the selected frame. 3953FRAME nil or omitted means use the selected frame.
3849 3954
@@ -3859,19 +3964,19 @@ displayed at the mouse position, with offset DX added (default is 5 if
3859DX isn't specified). Likewise for the y-position; if a `top' frame 3964DX isn't specified). Likewise for the y-position; if a `top' frame
3860parameter is specified, it determines the y-position of the tooltip 3965parameter is specified, it determines the y-position of the tooltip
3861window, otherwise it is displayed at the mouse position, with offset 3966window, otherwise it is displayed at the mouse position, with offset
3862DY added (default is 10). */) 3967DY added (default is -10).
3863 (string, frame, parms, timeout, dx, dy) 3968
3969A tooltip's maximum size is specified by `x-max-tooltip-size'.
3970Text larger than the specified size is clipped. */)
3971 (string, frame, parms, timeout, dx, dy)
3864 Lisp_Object string, frame, parms, timeout, dx, dy; 3972 Lisp_Object string, frame, parms, timeout, dx, dy;
3865{ 3973{
3866 struct frame *f; 3974 struct frame *f;
3867 struct window *w; 3975 struct window *w;
3868 Window root, child; 3976 int root_x, root_y;
3869 Lisp_Object buffer, top, left;
3870 struct buffer *old_buffer; 3977 struct buffer *old_buffer;
3871 struct text_pos pos; 3978 struct text_pos pos;
3872 int i, width, height; 3979 int i, width, height;
3873 int root_x, root_y, win_x, win_y;
3874 unsigned pmask;
3875 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 3980 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
3876 int old_windows_or_buffers_changed = windows_or_buffers_changed; 3981 int old_windows_or_buffers_changed = windows_or_buffers_changed;
3877 int count = SPECPDL_INDEX (); 3982 int count = SPECPDL_INDEX ();
@@ -3920,13 +4025,11 @@ DY added (default is 10). */)
3920 call1 (Qcancel_timer, timer); 4025 call1 (Qcancel_timer, timer);
3921 } 4026 }
3922 4027
3923#if 0 /* MAC_TODO : Mac specifics */
3924 BLOCK_INPUT; 4028 BLOCK_INPUT;
3925 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y); 4029 compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f),
3926 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 4030 FRAME_PIXEL_HEIGHT (f), &root_x, &root_y);
3927 root_x, root_y - FRAME_PIXEL_HEIGHT (f)); 4031 MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false);
3928 UNBLOCK_INPUT; 4032 UNBLOCK_INPUT;
3929#endif /* MAC_TODO */
3930 goto start_timer; 4033 goto start_timer;
3931 } 4034 }
3932 } 4035 }
@@ -3953,26 +4056,36 @@ DY added (default is 10). */)
3953 4056
3954 /* Create a frame for the tooltip, and record it in the global 4057 /* Create a frame for the tooltip, and record it in the global
3955 variable tip_frame. */ 4058 variable tip_frame. */
3956 frame = x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f), parms); 4059 frame = x_create_tip_frame (FRAME_MAC_DISPLAY_INFO (f), parms, string);
3957 f = XFRAME (frame); 4060 f = XFRAME (frame);
3958 4061
3959 /* Set up the frame's root window. Currently we use a size of 80 4062 /* Set up the frame's root window. */
3960 columns x 40 lines. If someone wants to show a larger tip, he
3961 will loose. I don't think this is a realistic case. */
3962 w = XWINDOW (FRAME_ROOT_WINDOW (f)); 4063 w = XWINDOW (FRAME_ROOT_WINDOW (f));
3963 w->left_col = w->top_line = make_number (0); 4064 w->left_col = w->top_line = make_number (0);
3964 w->total_cols = make_number (80); 4065
3965 w->total_lines = make_number (40); 4066 if (CONSP (Vx_max_tooltip_size)
4067 && INTEGERP (XCAR (Vx_max_tooltip_size))
4068 && XINT (XCAR (Vx_max_tooltip_size)) > 0
4069 && INTEGERP (XCDR (Vx_max_tooltip_size))
4070 && XINT (XCDR (Vx_max_tooltip_size)) > 0)
4071 {
4072 w->total_cols = XCAR (Vx_max_tooltip_size);
4073 w->total_lines = XCDR (Vx_max_tooltip_size);
4074 }
4075 else
4076 {
4077 w->total_cols = make_number (80);
4078 w->total_lines = make_number (40);
4079 }
4080
4081 FRAME_TOTAL_COLS (f) = XINT (w->total_cols);
3966 adjust_glyphs (f); 4082 adjust_glyphs (f);
3967 w->pseudo_window_p = 1; 4083 w->pseudo_window_p = 1;
3968 4084
3969 /* Display the tooltip text in a temporary buffer. */ 4085 /* Display the tooltip text in a temporary buffer. */
3970 buffer = Fget_buffer_create (build_string (" *tip*"));
3971 Fset_window_buffer (FRAME_ROOT_WINDOW (f), buffer, Qnil);
3972 old_buffer = current_buffer; 4086 old_buffer = current_buffer;
3973 set_buffer_internal_1 (XBUFFER (buffer)); 4087 set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer));
3974 Ferase_buffer (); 4088 current_buffer->truncate_lines = Qnil;
3975 Finsert (1, &string);
3976 clear_glyph_matrix (w->desired_matrix); 4089 clear_glyph_matrix (w->desired_matrix);
3977 clear_glyph_matrix (w->current_matrix); 4090 clear_glyph_matrix (w->current_matrix);
3978 SET_TEXT_POS (pos, BEGV, BEGV_BYTE); 4091 SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
@@ -3993,7 +4106,7 @@ DY added (default is 10). */)
3993 /* Let the row go over the full width of the frame. */ 4106 /* Let the row go over the full width of the frame. */
3994 row->full_width_p = 1; 4107 row->full_width_p = 1;
3995 4108
3996 /* There's a glyph at the end of rows that is use to place 4109 /* There's a glyph at the end of rows that is used to place
3997 the cursor there. Don't include the width of this glyph. */ 4110 the cursor there. Don't include the width of this glyph. */
3998 if (row->used[TEXT_AREA]) 4111 if (row->used[TEXT_AREA])
3999 { 4112 {
@@ -4014,17 +4127,13 @@ DY added (default is 10). */)
4014 4127
4015 /* Move the tooltip window where the mouse pointer is. Resize and 4128 /* Move the tooltip window where the mouse pointer is. Resize and
4016 show it. */ 4129 show it. */
4017#if 0 /* TODO : Mac specifics */ 4130 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
4018 compute_tip_xy (f, parms, dx, dy, &root_x, &root_y);
4019 4131
4020 BLOCK_INPUT; 4132 BLOCK_INPUT;
4021 XQueryPointer (FRAME_W32_DISPLAY (f), FRAME_W32_DISPLAY_INFO (f)->root_window, 4133 MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false);
4022 &root, &child, &root_x, &root_y, &win_x, &win_y, &pmask); 4134 SizeWindow (FRAME_MAC_WINDOW (f), width, height, true);
4023 XMoveResizeWindow (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), 4135 BringToFront (FRAME_MAC_WINDOW (f));
4024 root_x + 5, root_y - height - 5, width, height);
4025 XMapRaised (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f));
4026 UNBLOCK_INPUT; 4136 UNBLOCK_INPUT;
4027#endif /* MAC_TODO */
4028 4137
4029 /* Draw into the window. */ 4138 /* Draw into the window. */
4030 w->must_be_updated_p = 1; 4139 w->must_be_updated_p = 1;
@@ -4046,8 +4155,8 @@ DY added (default is 10). */)
4046 4155
4047DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, 4156DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
4048 doc: /* Hide the current tooltip window, if there is any. 4157 doc: /* Hide the current tooltip window, if there is any.
4049Value is t is tooltip was open, nil otherwise. */) 4158Value is t if tooltip was open, nil otherwise. */)
4050 () 4159 ()
4051{ 4160{
4052 int count; 4161 int count;
4053 Lisp_Object deleted, frame, timer; 4162 Lisp_Object deleted, frame, timer;
@@ -4249,7 +4358,8 @@ syms_of_macfns ()
4249 staticpro (&Qsuppress_icon); 4358 staticpro (&Qsuppress_icon);
4250 Qundefined_color = intern ("undefined-color"); 4359 Qundefined_color = intern ("undefined-color");
4251 staticpro (&Qundefined_color); 4360 staticpro (&Qundefined_color);
4252 /* This is the end of symbol initialization. */ 4361 Qcancel_timer = intern ("cancel-timer");
4362 staticpro (&Qcancel_timer);
4253 4363
4254 Qhyper = intern ("hyper"); 4364 Qhyper = intern ("hyper");
4255 staticpro (&Qhyper); 4365 staticpro (&Qhyper);
@@ -4265,6 +4375,7 @@ syms_of_macfns ()
4265 staticpro (&Qcontrol); 4375 staticpro (&Qcontrol);
4266 Qshift = intern ("shift"); 4376 Qshift = intern ("shift");
4267 staticpro (&Qshift); 4377 staticpro (&Qshift);
4378 /* This is the end of symbol initialization. */
4268 4379
4269 /* Text property `display' should be nonsticky by default. */ 4380 /* Text property `display' should be nonsticky by default. */
4270 Vtext_property_default_nonsticky 4381 Vtext_property_default_nonsticky
@@ -4314,6 +4425,11 @@ or when you set the mouse color. */);
4314 doc: /* A string indicating the foreground color of the cursor box. */); 4425 doc: /* A string indicating the foreground color of the cursor box. */);
4315 Vx_cursor_fore_pixel = Qnil; 4426 Vx_cursor_fore_pixel = Qnil;
4316 4427
4428 DEFVAR_LISP ("x-max-tooltip-size", &Vx_max_tooltip_size,
4429 doc: /* Maximum size for tooltips. Value is a pair (COLUMNS . ROWS).
4430Text larger than this is clipped. */);
4431 Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
4432
4317 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager, 4433 DEFVAR_LISP ("x-no-window-manager", &Vx_no_window_manager,
4318 doc: /* Non-nil if no window manager is in use. 4434 doc: /* Non-nil if no window manager is in use.
4319Emacs doesn't try to figure this out; this is always nil 4435Emacs doesn't try to figure this out; this is always nil
@@ -4386,6 +4502,9 @@ Chinese, Japanese, and Korean. */);
4386 tip_frame = Qnil; 4502 tip_frame = Qnil;
4387 staticpro (&tip_frame); 4503 staticpro (&tip_frame);
4388 4504
4505 last_show_tip_args = Qnil;
4506 staticpro (&last_show_tip_args);
4507
4389#if 0 /* MAC_TODO */ 4508#if 0 /* MAC_TODO */
4390 defsubr (&Sx_file_dialog); 4509 defsubr (&Sx_file_dialog);
4391#endif 4510#endif
diff --git a/src/macgui.h b/src/macgui.h
index 2bb346e9d30..58081df52b4 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -57,16 +57,27 @@ typedef unsigned long Time;
57#undef init_process 57#undef init_process
58#define init_process emacs_init_process 58#define init_process emacs_init_process
59#undef INFINITY 59#undef INFINITY
60typedef struct OpaqueWindowPtr* Window;
61#else 60#else
62#include <QuickDraw.h> /* for WindowPtr */ 61#include <QuickDraw.h> /* for WindowPtr */
63#include <QDOffscreen.h> /* for GWorldPtr */ 62#include <QDOffscreen.h> /* for GWorldPtr */
64#include <Controls.h> /* for ControlHandle in xdisp.c */ 63#include <Controls.h> /* for ControlHandle in xdisp.c */
65typedef WindowPtr Window; 64#include <Gestalt.h>
66#endif 65#endif
67 66
68typedef GWorldPtr Pixmap; 67typedef GWorldPtr Pixmap;
69 68
69#if TARGET_API_MAC_CARBON
70typedef struct OpaqueWindowPtr *Window;
71#define Cursor ThemeCursor
72#define No_Cursor (-1)
73#else
74typedef WindowPtr Window;
75#define SetPortWindowPort(w) SetPort(w)
76#define Cursor CursHandle
77#define No_Cursor (0)
78extern CursPtr arrow_cursor;
79#endif
80
70#define FACE_DEFAULT (~0) 81#define FACE_DEFAULT (~0)
71 82
72 83
diff --git a/src/macmenu.c b/src/macmenu.c
index de768d4aea5..d205ee3b877 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -1784,11 +1784,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1784 pos.h = x; 1784 pos.h = x;
1785 pos.v = y; 1785 pos.v = y;
1786 1786
1787#if TARGET_API_MAC_CARBON 1787 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1788 SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
1789#else
1790 SetPort (FRAME_MAC_WINDOW (f));
1791#endif
1792 1788
1793 LocalToGlobal (&pos); 1789 LocalToGlobal (&pos);
1794 1790
@@ -1942,11 +1938,7 @@ mac_dialog (widget_value *wv)
1942 1938
1943 window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowPtr) -1); 1939 window_ptr = GetNewCWindow (DIALOG_WINDOW_RESOURCE, NULL, (WindowPtr) -1);
1944 1940
1945#if TARGET_API_MAC_CARBON 1941 SetPortWindowPort (window_ptr);
1946 SetPort (GetWindowPort (window_ptr));
1947#else
1948 SetPort (window_ptr);
1949#endif
1950 1942
1951 TextFont (0); 1943 TextFont (0);
1952 /* Left and right margins in the dialog are 13 pixels each.*/ 1944 /* Left and right margins in the dialog are 13 pixels each.*/
@@ -1964,11 +1956,7 @@ mac_dialog (widget_value *wv)
1964 SizeWindow (window_ptr, dialog_width, 78, 0); 1956 SizeWindow (window_ptr, dialog_width, 78, 0);
1965 ShowWindow (window_ptr); 1957 ShowWindow (window_ptr);
1966 1958
1967#if TARGET_API_MAC_CARBON 1959 SetPortWindowPort (window_ptr);
1968 SetPort (GetWindowPort (window_ptr));
1969#else
1970 SetPort (window_ptr);
1971#endif
1972 1960
1973 TextFont (0); 1961 TextFont (0);
1974 1962
diff --git a/src/macterm.c b/src/macterm.c
index 9351fd5e36f..6a3cad56f46 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -53,7 +53,6 @@ Boston, MA 02111-1307, USA. */
53#if defined (__MRC__) || (__MSL__ >= 0x6000) 53#if defined (__MRC__) || (__MSL__ >= 0x6000)
54#include <ControlDefinitions.h> 54#include <ControlDefinitions.h>
55#endif 55#endif
56#include <Gestalt.h>
57 56
58#if __profile__ 57#if __profile__
59#include <profiler.h> 58#include <profiler.h>
@@ -196,14 +195,6 @@ static Lisp_Object last_mouse_scroll_bar;
196 195
197static Time last_mouse_movement_time; 196static Time last_mouse_movement_time;
198 197
199enum mouse_tracking_type {
200 mouse_tracking_none,
201 mouse_tracking_mouse_movement,
202 mouse_tracking_scroll_bar
203};
204
205enum mouse_tracking_type mouse_tracking_in_progress = mouse_tracking_none;
206
207struct scroll_bar *tracked_scroll_bar = NULL; 198struct scroll_bar *tracked_scroll_bar = NULL;
208 199
209/* Incremented by XTread_socket whenever it really tries to read 200/* Incremented by XTread_socket whenever it really tries to read
@@ -364,11 +355,7 @@ XDrawLine (display, w, gc, x1, y1, x2, y2)
364 GC gc; 355 GC gc;
365 int x1, y1, x2, y2; 356 int x1, y1, x2, y2;
366{ 357{
367#if TARGET_API_MAC_CARBON 358 SetPortWindowPort (w);
368 SetPort (GetWindowPort (w));
369#else
370 SetPort (w);
371#endif
372 359
373 mac_set_colors (gc); 360 mac_set_colors (gc);
374 361
@@ -416,11 +403,7 @@ XClearArea (display, w, x, y, width, height, exposures)
416 xgc.foreground = mwp->x_compatible.foreground_pixel; 403 xgc.foreground = mwp->x_compatible.foreground_pixel;
417 xgc.background = mwp->x_compatible.background_pixel; 404 xgc.background = mwp->x_compatible.background_pixel;
418 405
419#if TARGET_API_MAC_CARBON 406 SetPortWindowPort (w);
420 SetPort (GetWindowPort (w));
421#else
422 SetPort (w);
423#endif
424 407
425 mac_set_colors (&xgc); 408 mac_set_colors (&xgc);
426 SetRect (&r, x, y, x + width, y + height); 409 SetRect (&r, x, y, x + width, y + height);
@@ -441,11 +424,7 @@ XClearWindow (display, w)
441 xgc.foreground = mwp->x_compatible.foreground_pixel; 424 xgc.foreground = mwp->x_compatible.foreground_pixel;
442 xgc.background = mwp->x_compatible.background_pixel; 425 xgc.background = mwp->x_compatible.background_pixel;
443 426
444#if TARGET_API_MAC_CARBON 427 SetPortWindowPort (w);
445 SetPort (GetWindowPort (w));
446#else
447 SetPort (w);
448#endif
449 428
450 mac_set_colors (&xgc); 429 mac_set_colors (&xgc);
451 430
@@ -480,11 +459,7 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p)
480 bitmap.baseAddr = (char *)bits; 459 bitmap.baseAddr = (char *)bits;
481 SetRect (&(bitmap.bounds), 0, 0, width, height); 460 SetRect (&(bitmap.bounds), 0, 0, width, height);
482 461
483#if TARGET_API_MAC_CARBON 462 SetPortWindowPort (w);
484 SetPort (GetWindowPort (w));
485#else
486 SetPort (w);
487#endif
488 463
489 mac_set_colors (gc); 464 mac_set_colors (gc);
490 SetRect (&r, x, y, x + width, y + height); 465 SetRect (&r, x, y, x + width, y + height);
@@ -509,11 +484,7 @@ mac_set_clip_rectangle (display, w, r)
509 WindowPtr w; 484 WindowPtr w;
510 Rect *r; 485 Rect *r;
511{ 486{
512#if TARGET_API_MAC_CARBON 487 SetPortWindowPort (w);
513 SetPort (GetWindowPort (w));
514#else
515 SetPort (w);
516#endif
517 488
518 ClipRect (r); 489 ClipRect (r);
519} 490}
@@ -528,11 +499,7 @@ mac_reset_clipping (display, w)
528{ 499{
529 Rect r; 500 Rect r;
530 501
531#if TARGET_API_MAC_CARBON 502 SetPortWindowPort (w);
532 SetPort (GetWindowPort (w));
533#else
534 SetPort (w);
535#endif
536 503
537 SetRect (&r, -32767, -32767, 32767, 32767); 504 SetRect (&r, -32767, -32767, 32767, 32767);
538 ClipRect (&r); 505 ClipRect (&r);
@@ -601,11 +568,7 @@ XCreatePixmap (display, w, width, height, depth)
601 Rect r; 568 Rect r;
602 QDErr err; 569 QDErr err;
603 570
604#if TARGET_API_MAC_CARBON 571 SetPortWindowPort (w);
605 SetPort (GetWindowPort (w));
606#else
607 SetPort (w);
608#endif
609 572
610 SetRect (&r, 0, 0, width, height); 573 SetRect (&r, 0, 0, width, height);
611 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0); 574 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0);
@@ -666,11 +629,7 @@ XFillRectangle (display, w, gc, x, y, width, height)
666{ 629{
667 Rect r; 630 Rect r;
668 631
669#if TARGET_API_MAC_CARBON 632 SetPortWindowPort (w);
670 SetPort (GetWindowPort (w));
671#else
672 SetPort (w);
673#endif
674 633
675 mac_set_colors (gc); 634 mac_set_colors (gc);
676 SetRect (&r, x, y, x + width, y + height); 635 SetRect (&r, x, y, x + width, y + height);
@@ -716,11 +675,7 @@ mac_draw_rectangle (display, w, gc, x, y, width, height)
716{ 675{
717 Rect r; 676 Rect r;
718 677
719#if TARGET_API_MAC_CARBON 678 SetPortWindowPort (w);
720 SetPort (GetWindowPort (w));
721#else
722 SetPort (w);
723#endif
724 679
725 mac_set_colors (gc); 680 mac_set_colors (gc);
726 SetRect (&r, x, y, x + width + 1, y + height + 1); 681 SetRect (&r, x, y, x + width + 1, y + height + 1);
@@ -766,11 +721,7 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
766 char *buf; 721 char *buf;
767 int nchars, mode, bytes_per_char; 722 int nchars, mode, bytes_per_char;
768{ 723{
769#if TARGET_API_MAC_CARBON 724 SetPortWindowPort (w);
770 SetPort (GetWindowPort (w));
771#else
772 SetPort (w);
773#endif
774 725
775 mac_set_colors (gc); 726 mac_set_colors (gc);
776 727
@@ -861,11 +812,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x,
861{ 812{
862 Rect src_r, dest_r; 813 Rect src_r, dest_r;
863 814
864#if TARGET_API_MAC_CARBON 815 SetPortWindowPort (dest);
865 SetPort (GetWindowPort (dest));
866#else
867 SetPort (dest);
868#endif
869 816
870 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 817 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
871 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); 818 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -901,11 +848,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y,
901{ 848{
902 Rect src_r, dest_r; 849 Rect src_r, dest_r;
903 850
904#if TARGET_API_MAC_CARBON 851 SetPortWindowPort (dest);
905 SetPort (GetWindowPort (dest));
906#else
907 SetPort (dest);
908#endif
909 852
910 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 853 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
911 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); 854 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
@@ -965,7 +908,7 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y)
965 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 908 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
966 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); 909 SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height);
967 910
968 SetPort (GetWindowPort (w)); 911 SetPortWindowPort (w);
969 912
970 ForeColor (blackColor); 913 ForeColor (blackColor);
971 BackColor (whiteColor); 914 BackColor (whiteColor);
@@ -1290,7 +1233,7 @@ x_update_window_begin (w)
1290 { 1233 {
1291 int i; 1234 int i;
1292 1235
1293 for (i = 0; i < w->desired_matrix->nrows; ++i) 1236 for (i = 0; i < w->desired_matrix->nrows; ++i)
1294 if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i)) 1237 if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i))
1295 break; 1238 break;
1296 1239
@@ -1385,11 +1328,7 @@ x_update_end (f)
1385 /* Reset the background color of Mac OS Window to that of the frame after 1328 /* Reset the background color of Mac OS Window to that of the frame after
1386 update so that it is used by Mac Toolbox to clear the update region before 1329 update so that it is used by Mac Toolbox to clear the update region before
1387 an update event is generated. */ 1330 an update event is generated. */
1388#if TARGET_API_MAC_CARBON 1331 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1389 SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
1390#else
1391 SetPort (FRAME_MAC_WINDOW (f));
1392#endif
1393 1332
1394 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); 1333 mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f));
1395 1334
@@ -3745,11 +3684,7 @@ construct_mouse_click (result, event, f)
3745 3684
3746 mouseLoc = event->where; 3685 mouseLoc = event->where;
3747 3686
3748#if TARGET_API_MAC_CARBON 3687 SetPortWindowPort (FRAME_MAC_WINDOW (f));
3749 SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
3750#else
3751 SetPort (FRAME_MAC_WINDOW (f));
3752#endif
3753 3688
3754 GlobalToLocal (&mouseLoc); 3689 GlobalToLocal (&mouseLoc);
3755 XSETINT (result->x, mouseLoc.h); 3690 XSETINT (result->x, mouseLoc.h);
@@ -3778,6 +3713,7 @@ note_mouse_movement (frame, pos)
3778 FRAME_PTR frame; 3713 FRAME_PTR frame;
3779 Point *pos; 3714 Point *pos;
3780{ 3715{
3716 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (frame);
3781#if TARGET_API_MAC_CARBON 3717#if TARGET_API_MAC_CARBON
3782 Rect r; 3718 Rect r;
3783#endif 3719#endif
@@ -3792,9 +3728,17 @@ note_mouse_movement (frame, pos)
3792 if (!PtInRect (*pos, &FRAME_MAC_WINDOW (frame)->portRect)) 3728 if (!PtInRect (*pos, &FRAME_MAC_WINDOW (frame)->portRect))
3793#endif 3729#endif
3794 { 3730 {
3795 frame->mouse_moved = 1; 3731 if (frame == dpyinfo->mouse_face_mouse_frame)
3796 last_mouse_scroll_bar = Qnil; 3732 /* This case corresponds to LeaveNotify in X11. */
3797 note_mouse_highlight (frame, -1, -1); 3733 {
3734 /* If we move outside the frame, then we're certainly no
3735 longer on any text in the frame. */
3736 clear_mouse_face (dpyinfo);
3737 dpyinfo->mouse_face_mouse_frame = 0;
3738 if (!dpyinfo->grabbed)
3739 rif->define_frame_cursor (frame,
3740 frame->output_data.mac->nontext_cursor);
3741 }
3798 } 3742 }
3799 /* Has the mouse moved off the glyph it was on at the last sighting? */ 3743 /* Has the mouse moved off the glyph it was on at the last sighting? */
3800 else if (pos->h < last_mouse_glyph.left 3744 else if (pos->h < last_mouse_glyph.left
@@ -3942,6 +3886,23 @@ remember_mouse_glyph (f1, gx, gy)
3942} 3886}
3943 3887
3944 3888
3889static WindowPtr
3890mac_front_window ()
3891{
3892#if TARGET_API_MAC_CARBON
3893 return GetFrontWindowOfClass (kDocumentWindowClass, true);
3894#else
3895 WindowPtr front_window = FrontWindow ();
3896
3897 if (tip_window && front_window == tip_window)
3898 return GetNextWindow (front_window);
3899 else
3900 return front_window;
3901#endif
3902}
3903
3904#define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP)
3905
3945/* Return the current position of the mouse. 3906/* Return the current position of the mouse.
3946 *fp should be a frame which indicates which display to ask about. 3907 *fp should be a frame which indicates which display to ask about.
3947 3908
@@ -3973,12 +3934,12 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3973{ 3934{
3974 Point mouse_pos; 3935 Point mouse_pos;
3975 int ignore1, ignore2; 3936 int ignore1, ignore2;
3976 WindowPtr wp = FrontWindow (); 3937 WindowPtr wp = mac_front_window ();
3977 struct frame *f; 3938 struct frame *f;
3978 Lisp_Object frame, tail; 3939 Lisp_Object frame, tail;
3979 3940
3980 if (is_emacs_window(wp)) 3941 if (is_emacs_window(wp))
3981 f = ((mac_output *) GetWRefCon (wp))->mFP; 3942 f = mac_window_to_frame (wp);
3982 3943
3983 BLOCK_INPUT; 3944 BLOCK_INPUT;
3984 3945
@@ -3992,11 +3953,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3992 3953
3993 last_mouse_scroll_bar = Qnil; 3954 last_mouse_scroll_bar = Qnil;
3994 3955
3995#if TARGET_API_MAC_CARBON 3956 SetPortWindowPort (wp);
3996 SetPort (GetWindowPort (wp));
3997#else
3998 SetPort (wp);
3999#endif
4000 3957
4001 GetMouse (&mouse_pos); 3958 GetMouse (&mouse_pos);
4002 3959
@@ -4491,6 +4448,8 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp)
4491 EventRecord *er; 4448 EventRecord *er;
4492 struct input_event *bufp; 4449 struct input_event *bufp;
4493{ 4450{
4451 int win_y, top_range;
4452
4494 if (! GC_WINDOWP (bar->window)) 4453 if (! GC_WINDOWP (bar->window))
4495 abort (); 4454 abort ();
4496 4455
@@ -4525,6 +4484,24 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp)
4525 bufp->part = scroll_bar_handle; 4484 bufp->part = scroll_bar_handle;
4526 break; 4485 break;
4527 } 4486 }
4487
4488 win_y = XINT (bufp->y) - XINT (bar->top);
4489 top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (0/*dummy*/, XINT (bar->height));
4490
4491 win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER;
4492
4493 win_y -= 24;
4494
4495 if (! NILP (bar->dragging))
4496 win_y -= XINT (bar->dragging);
4497
4498 if (win_y < 0)
4499 win_y = 0;
4500 if (win_y > top_range)
4501 win_y = top_range;
4502
4503 XSETINT (bufp->x, win_y);
4504 XSETINT (bufp->y, top_range);
4528} 4505}
4529 4506
4530 4507
@@ -4574,16 +4551,12 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
4574 unsigned long *time; 4551 unsigned long *time;
4575{ 4552{
4576 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 4553 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
4577 WindowPtr wp = FrontWindow (); 4554 WindowPtr wp = mac_front_window ();
4578 Point mouse_pos; 4555 Point mouse_pos;
4579 struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP; 4556 struct frame *f = mac_window_to_frame (wp);
4580 int win_y, top_range; 4557 int win_y, top_range;
4581 4558
4582#if TARGET_API_MAC_CARBON 4559 SetPortWindowPort (wp);
4583 SetPort (GetWindowPort (wp));
4584#else
4585 SetPort (wp);
4586#endif
4587 4560
4588 GetMouse (&mouse_pos); 4561 GetMouse (&mouse_pos);
4589 4562
@@ -4810,7 +4783,11 @@ mac_define_frame_cursor (f, cursor)
4810 struct frame *f; 4783 struct frame *f;
4811 Cursor cursor; 4784 Cursor cursor;
4812{ 4785{
4813 /* MAC TODO */ 4786#if TARGET_API_MAC_CARBON
4787 SetThemeCursor (cursor);
4788#else
4789 SetCursor (*cursor);
4790#endif
4814} 4791}
4815 4792
4816 4793
@@ -5078,11 +5055,7 @@ x_calc_absolute_position (f)
5078 GrafPtr savePort; 5055 GrafPtr savePort;
5079 GetPort (&savePort); 5056 GetPort (&savePort);
5080 5057
5081#if TARGET_API_MAC_CARBON 5058 SetPortWindowPort (FRAME_MAC_WINDOW (f));
5082 SetPort (GetWindowPort (FRAME_MAC_WINDOW (f)));
5083#else
5084 SetPort (FRAME_MAC_WINDOW (f));
5085#endif
5086 5059
5087#if TARGET_API_MAC_CARBON 5060#if TARGET_API_MAC_CARBON
5088 { 5061 {
@@ -5457,10 +5430,15 @@ x_free_frame_resources (f)
5457 struct frame *f; 5430 struct frame *f;
5458{ 5431{
5459 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); 5432 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
5433 WindowPtr wp = FRAME_MAC_WINDOW (f);
5460 5434
5461 BLOCK_INPUT; 5435 BLOCK_INPUT;
5462 5436
5463 DisposeWindow (FRAME_MAC_WINDOW (f)); 5437 DisposeWindow (wp);
5438 if (wp == tip_window)
5439 /* Neither WaitNextEvent nor ReceiveNextEvent receives `window
5440 closed' event. So we reset tip_window here. */
5441 tip_window = NULL;
5464 5442
5465 free_frame_menubar (f); 5443 free_frame_menubar (f);
5466 5444
@@ -6984,6 +6962,11 @@ Lisp_Object drag_and_drop_file_list;
6984 6962
6985Point saved_menu_event_location; 6963Point saved_menu_event_location;
6986 6964
6965#if !TARGET_API_MAC_CARBON
6966/* Place holder for the default arrow cursor. */
6967CursPtr arrow_cursor;
6968#endif
6969
6987/* Apple Events */ 6970/* Apple Events */
6988static void init_required_apple_events (void); 6971static void init_required_apple_events (void);
6989static pascal OSErr 6972static pascal OSErr
@@ -7170,6 +7153,8 @@ do_init_managers (void)
7170 InitCursor (); 7153 InitCursor ();
7171 7154
7172#if !TARGET_API_MAC_CARBON 7155#if !TARGET_API_MAC_CARBON
7156 arrow_cursor = &qd.arrow;
7157
7173 /* set up some extra stack space for use by emacs */ 7158 /* set up some extra stack space for use by emacs */
7174 SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC)); 7159 SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC));
7175 7160
@@ -7198,8 +7183,12 @@ do_check_ram_size (void)
7198static void 7183static void
7199do_window_update (WindowPtr win) 7184do_window_update (WindowPtr win)
7200{ 7185{
7201 struct mac_output *mwp = (mac_output *) GetWRefCon (win); 7186 struct frame *f = mac_window_to_frame (win);
7202 struct frame *f = mwp->mFP; 7187
7188 if (win == tip_window)
7189 /* The tooltip has been drawn already. Avoid the
7190 SET_FRAME_GARBAGED below. */
7191 return;
7203 7192
7204 if (f) 7193 if (f)
7205 { 7194 {
@@ -7250,13 +7239,11 @@ is_emacs_window (WindowPtr win)
7250static void 7239static void
7251do_window_activate (WindowPtr win) 7240do_window_activate (WindowPtr win)
7252{ 7241{
7253 mac_output *mwp;
7254 struct frame *f; 7242 struct frame *f;
7255 7243
7256 if (is_emacs_window (win)) 7244 if (is_emacs_window (win))
7257 { 7245 {
7258 mwp = (mac_output *) GetWRefCon (win); 7246 f = mac_window_to_frame (win);
7259 f = mwp->mFP;
7260 7247
7261 if (f) 7248 if (f)
7262 { 7249 {
@@ -7269,13 +7256,11 @@ do_window_activate (WindowPtr win)
7269static void 7256static void
7270do_window_deactivate (WindowPtr win) 7257do_window_deactivate (WindowPtr win)
7271{ 7258{
7272 mac_output *mwp;
7273 struct frame *f; 7259 struct frame *f;
7274 7260
7275 if (is_emacs_window (win)) 7261 if (is_emacs_window (win))
7276 { 7262 {
7277 mwp = (mac_output *) GetWRefCon (win); 7263 f = mac_window_to_frame (win);
7278 f = mwp->mFP;
7279 7264
7280 if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) 7265 if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame)
7281 { 7266 {
@@ -7289,14 +7274,12 @@ static void
7289do_app_resume () 7274do_app_resume ()
7290{ 7275{
7291 WindowPtr wp; 7276 WindowPtr wp;
7292 mac_output *mwp;
7293 struct frame *f; 7277 struct frame *f;
7294 7278
7295 wp = FrontWindow(); 7279 wp = mac_front_window ();
7296 if (is_emacs_window (wp)) 7280 if (is_emacs_window (wp))
7297 { 7281 {
7298 mwp = (mac_output *) GetWRefCon (wp); 7282 f = mac_window_to_frame (wp);
7299 f = mwp->mFP;
7300 7283
7301 if (f) 7284 if (f)
7302 { 7285 {
@@ -7313,14 +7296,12 @@ static void
7313do_app_suspend () 7296do_app_suspend ()
7314{ 7297{
7315 WindowPtr wp; 7298 WindowPtr wp;
7316 mac_output *mwp;
7317 struct frame *f; 7299 struct frame *f;
7318 7300
7319 wp = FrontWindow(); 7301 wp = mac_front_window ();
7320 if (is_emacs_window (wp)) 7302 if (is_emacs_window (wp))
7321 { 7303 {
7322 mwp = (mac_output *) GetWRefCon (wp); 7304 f = mac_window_to_frame (wp);
7323 f = mwp->mFP;
7324 7305
7325 if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) 7306 if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame)
7326 { 7307 {
@@ -7335,67 +7316,38 @@ do_app_suspend ()
7335 7316
7336 7317
7337static void 7318static void
7338do_mouse_moved (Point mouse_pos) 7319do_mouse_moved (mouse_pos, f)
7320 Point mouse_pos;
7321 FRAME_PTR *f;
7339{ 7322{
7340 WindowPtr wp = FrontWindow (); 7323 WindowPtr wp = mac_front_window ();
7341 struct frame *f; 7324 struct x_display_info *dpyinfo;
7342 7325
7343 if (is_emacs_window (wp)) 7326 if (is_emacs_window (wp))
7344 { 7327 {
7345 f = ((mac_output *) GetWRefCon (wp))->mFP; 7328 *f = mac_window_to_frame (wp);
7329 dpyinfo = FRAME_MAC_DISPLAY_INFO (*f);
7346 7330
7347#if TARGET_API_MAC_CARBON 7331 if (dpyinfo->mouse_face_hidden)
7348 SetPort (GetWindowPort (wp)); 7332 {
7349#else 7333 dpyinfo->mouse_face_hidden = 0;
7350 SetPort (wp); 7334 clear_mouse_face (dpyinfo);
7351#endif 7335 }
7352
7353 GlobalToLocal (&mouse_pos);
7354 7336
7355 note_mouse_movement (f, &mouse_pos); 7337 SetPortWindowPort (wp);
7356 }
7357}
7358 7338
7339 GlobalToLocal (&mouse_pos);
7359 7340
7360static void 7341 if (dpyinfo->grabbed && tracked_scroll_bar)
7361do_os_event (EventRecord *erp) 7342 x_scroll_bar_note_movement (tracked_scroll_bar,
7362{ 7343 mouse_pos.v
7363 switch((erp->message >> 24) & 0x000000FF) 7344 - XINT (tracked_scroll_bar->top),
7364 { 7345 TickCount() * (1000 / 60));
7365 case suspendResumeMessage:
7366 if((erp->message & resumeFlag) == 1)
7367 do_app_resume ();
7368 else 7346 else
7369 do_app_suspend (); 7347 note_mouse_movement (*f, &mouse_pos);
7370 break;
7371
7372 case mouseMovedMessage:
7373 do_mouse_moved (erp->where);
7374 break;
7375 } 7348 }
7376} 7349}
7377 7350
7378static void
7379do_events (EventRecord *erp)
7380{
7381 switch (erp->what)
7382 {
7383 case updateEvt:
7384 do_window_update ((WindowPtr) erp->message);
7385 break;
7386
7387 case osEvt:
7388 do_os_event (erp);
7389 break;
7390
7391 case activateEvt:
7392 if ((erp->modifiers & activeFlag) != 0)
7393 do_window_activate ((WindowPtr) erp->message);
7394 else
7395 do_window_deactivate ((WindowPtr) erp->message);
7396 break;
7397 }
7398}
7399 7351
7400static void 7352static void
7401do_apple_menu (SInt16 menu_item) 7353do_apple_menu (SInt16 menu_item)
@@ -7433,8 +7385,7 @@ do_menu_choice (SInt32 menu_choice)
7433 7385
7434 default: 7386 default:
7435 { 7387 {
7436 WindowPtr wp = FrontWindow (); 7388 struct frame *f = mac_window_to_frame (mac_front_window ());
7437 struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP;
7438 MenuHandle menu = GetMenuHandle (menu_id); 7389 MenuHandle menu = GetMenuHandle (menu_id);
7439 if (menu) 7390 if (menu)
7440 { 7391 {
@@ -7459,8 +7410,7 @@ do_grow_window (WindowPtr w, EventRecord *e)
7459 long grow_size; 7410 long grow_size;
7460 Rect limit_rect; 7411 Rect limit_rect;
7461 int rows, columns; 7412 int rows, columns;
7462 mac_output *mwp = (mac_output *) GetWRefCon (w); 7413 struct frame *f = mac_window_to_frame (w);
7463 struct frame *f = mwp->mFP;
7464 7414
7465 SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE); 7415 SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE);
7466 7416
@@ -7489,16 +7439,11 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7489 Rect zoom_rect, port_rect; 7439 Rect zoom_rect, port_rect;
7490 Point top_left; 7440 Point top_left;
7491 int w_title_height, columns, rows, width, height, dummy, x, y; 7441 int w_title_height, columns, rows, width, height, dummy, x, y;
7492 mac_output *mwp = (mac_output *) GetWRefCon (w); 7442 struct frame *f = mac_window_to_frame (w);
7493 struct frame *f = mwp->mFP;
7494 7443
7495 GetPort (&save_port); 7444 GetPort (&save_port);
7496 7445
7497#if TARGET_API_MAC_CARBON 7446 SetPortWindowPort (w);
7498 SetPort (GetWindowPort (w));
7499#else
7500 SetPort (w);
7501#endif
7502 7447
7503 /* Clear window to avoid flicker. */ 7448 /* Clear window to avoid flicker. */
7504#if TARGET_API_MAC_CARBON 7449#if TARGET_API_MAC_CARBON
@@ -7551,7 +7496,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7551 } 7496 }
7552#endif /* not TARGET_API_MAC_CARBON */ 7497#endif /* not TARGET_API_MAC_CARBON */
7553 7498
7554 ZoomWindow (w, zoom_in_or_out, w == FrontWindow ()); 7499 ZoomWindow (w, zoom_in_or_out, w == mac_front_window ());
7555 7500
7556 /* retrieve window size and update application values */ 7501 /* retrieve window size and update application values */
7557#if TARGET_API_MAC_CARBON 7502#if TARGET_API_MAC_CARBON
@@ -7561,7 +7506,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
7561#endif 7506#endif
7562 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top); 7507 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
7563 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left); 7508 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
7564 x_set_window_size (mwp->mFP, 0, columns, rows); 7509 x_set_window_size (f, 0, columns, rows);
7565 7510
7566 SetPort (save_port); 7511 SetPort (save_port);
7567} 7512}
@@ -7892,8 +7837,8 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon,
7892 { 7837 {
7893 struct input_event event; 7838 struct input_event event;
7894 Lisp_Object frame; 7839 Lisp_Object frame;
7895 struct frame *f = ((mac_output *) GetWRefCon(window))->mFP; 7840 struct frame *f = mac_window_to_frame (window);
7896 SetPort (GetWindowPort (window)); 7841 SetPortWindowPort (window);
7897 GlobalToLocal (&mouse); 7842 GlobalToLocal (&mouse);
7898 7843
7899 event.kind = DRAG_N_DROP_EVENT; 7844 event.kind = DRAG_N_DROP_EVENT;
@@ -8067,26 +8012,26 @@ keycode_to_xkeysym (int keyCode, int *xKeySym)
8067/* Emacs calls this whenever it wants to read an input event from the 8012/* Emacs calls this whenever it wants to read an input event from the
8068 user. */ 8013 user. */
8069int 8014int
8070XTread_socket (int sd, int expected, struct input_event *hold_quit) 8015XTread_socket (sd, expected, hold_quit)
8016 int sd, expected;
8017 struct input_event *hold_quit;
8071{ 8018{
8072 struct input_event inev; 8019 struct input_event inev;
8073 int count = 0; 8020 int count = 0;
8074#if USE_CARBON_EVENTS 8021#if USE_CARBON_EVENTS
8075 OSStatus rneResult;
8076 EventRef eventRef; 8022 EventRef eventRef;
8077 EventMouseButton mouseBtn; 8023 EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget ();
8024#else
8025 EventMask event_mask;
8078#endif 8026#endif
8079 EventRecord er; 8027 EventRecord er;
8080 int the_modifiers; 8028 struct mac_display_info *dpyinfo = &one_mac_display_info;
8081 EventMask event_mask;
8082 8029
8083#if 0
8084 if (interrupt_input_blocked) 8030 if (interrupt_input_blocked)
8085 { 8031 {
8086 interrupt_input_pending = 1; 8032 interrupt_input_pending = 1;
8087 return -1; 8033 return -1;
8088 } 8034 }
8089#endif
8090 8035
8091 interrupt_input_pending = 0; 8036 interrupt_input_pending = 0;
8092 BLOCK_INPUT; 8037 BLOCK_INPUT;
@@ -8108,26 +8053,33 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8108 if (terminate_flag) 8053 if (terminate_flag)
8109 Fkill_emacs (make_number (1)); 8054 Fkill_emacs (make_number (1));
8110 8055
8111 /* It is necessary to set this (additional) argument slot of an 8056#if !USE_CARBON_EVENTS
8112 event to nil because keyboard.c protects incompletely processed
8113 event from being garbage collected by placing them in the
8114 kbd_buffer_gcpro vector. */
8115 EVENT_INIT (inev);
8116 inev.kind = NO_EVENT;
8117 inev.arg = Qnil;
8118
8119 event_mask = everyEvent; 8057 event_mask = everyEvent;
8120 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) 8058 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop)))
8121 event_mask -= highLevelEventMask; 8059 event_mask -= highLevelEventMask;
8122 8060
8123#if USE_CARBON_EVENTS 8061 while (WaitNextEvent (event_mask, &er,
8124 rneResult = ReceiveNextEvent (0, NULL, 8062 (expected ? app_sleep_time : 0L), NULL))
8125 expected 8063#else
8126 ? TicksToEventTime (app_sleep_time) 8064 while (!ReceiveNextEvent (0, NULL,
8127 : 0, 8065 (expected ? TicksToEventTime (app_sleep_time) : 0),
8128 kEventRemoveFromQueue, &eventRef); 8066 kEventRemoveFromQueue, &eventRef))
8129 if (!rneResult) 8067#endif /* !USE_CARBON_EVENTS */
8130 { 8068 {
8069 int do_help = 0;
8070 struct frame *f;
8071
8072 expected = 0;
8073
8074 /* It is necessary to set this (additional) argument slot of an
8075 event to nil because keyboard.c protects incompletely
8076 processed event from being garbage collected by placing them
8077 in the kbd_buffer_gcpro vector. */
8078 EVENT_INIT (inev);
8079 inev.kind = NO_EVENT;
8080 inev.arg = Qnil;
8081
8082#if USE_CARBON_EVENTS
8131 /* Handle new events */ 8083 /* Handle new events */
8132 if (!mac_convert_event_ref (eventRef, &er)) 8084 if (!mac_convert_event_ref (eventRef, &er))
8133 switch (GetEventClass (eventRef)) 8085 switch (GetEventClass (eventRef))
@@ -8137,13 +8089,12 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8137 { 8089 {
8138 SInt32 delta; 8090 SInt32 delta;
8139 Point point; 8091 Point point;
8140 WindowPtr window_ptr = FrontNonFloatingWindow (); 8092 WindowPtr window_ptr = mac_front_window ();
8141 struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr); 8093
8142 if (!IsValidWindowPtr (window_ptr)) 8094 if (!IsValidWindowPtr (window_ptr))
8143 { 8095 {
8144 SysBeep(1); 8096 SysBeep(1);
8145 UNBLOCK_INPUT; 8097 break;
8146 return 0;
8147 } 8098 }
8148 8099
8149 GetEventParameter(eventRef, kEventParamMouseWheelDelta, 8100 GetEventParameter(eventRef, kEventParamMouseWheelDelta,
@@ -8154,459 +8105,557 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8154 NULL, &point); 8105 NULL, &point);
8155 inev.kind = WHEEL_EVENT; 8106 inev.kind = WHEEL_EVENT;
8156 inev.code = 0; 8107 inev.code = 0;
8157 inev.modifiers = (mac_event_to_emacs_modifiers(eventRef) 8108 inev.modifiers = (mac_event_to_emacs_modifiers (eventRef)
8158 | ((delta < 0) ? down_modifier 8109 | ((delta < 0) ? down_modifier
8159 : up_modifier)); 8110 : up_modifier));
8160 SetPort (GetWindowPort (window_ptr)); 8111 SetPortWindowPort (window_ptr);
8161 GlobalToLocal (&point); 8112 GlobalToLocal (&point);
8162 XSETINT (inev.x, point.h); 8113 XSETINT (inev.x, point.h);
8163 XSETINT (inev.y, point.v); 8114 XSETINT (inev.y, point.v);
8164 XSETFRAME (inev.frame_or_window, mwp->mFP); 8115 XSETFRAME (inev.frame_or_window,
8116 mac_window_to_frame (window_ptr));
8165 inev.timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60); 8117 inev.timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60);
8166 } 8118 }
8167 else 8119 else
8168 SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); 8120 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8169 8121
8170 break; 8122 break;
8171 default: 8123 default:
8172 /* Send the event to the appropriate receiver. */ 8124 /* Send the event to the appropriate receiver. */
8173 SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); 8125 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8174 } 8126 }
8175 else 8127 else
8176#else
8177 if (WaitNextEvent (event_mask, &er, (expected ? app_sleep_time : 0L), NULL))
8178#endif /* USE_CARBON_EVENTS */ 8128#endif /* USE_CARBON_EVENTS */
8179 switch (er.what) 8129 switch (er.what)
8180 {
8181 case mouseDown:
8182 case mouseUp:
8183 { 8130 {
8184 WindowPtr window_ptr = FrontWindow (); 8131 case mouseDown:
8185 SInt16 part_code; 8132 case mouseUp:
8133 {
8134 WindowPtr window_ptr;
8135 SInt16 part_code;
8136 int tool_bar_p = 0;
8137
8138 if (dpyinfo->grabbed && last_mouse_frame
8139 && FRAME_LIVE_P (last_mouse_frame))
8140 {
8141 window_ptr = FRAME_MAC_WINDOW (last_mouse_frame);
8142 part_code = inContent;
8143 }
8144 else
8145 {
8146 window_ptr = FrontWindow ();
8147 if (tip_window && window_ptr == tip_window)
8148 {
8149 HideWindow (tip_window);
8150 window_ptr = FrontWindow ();
8151 }
8186 8152
8187#if USE_CARBON_EVENTS 8153#if USE_CARBON_EVENTS
8188 /* This is needed to send mouse events like aqua window buttons 8154 /* This is needed to send mouse events like aqua
8189 to the correct handler. */ 8155 window buttons to the correct handler. */
8190 if (eventNotHandledErr != SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) { 8156 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
8191 break; 8157 != eventNotHandledErr)
8192 } 8158 break;
8193 8159
8194 if (!is_emacs_window(window_ptr)) 8160 if (!is_emacs_window (window_ptr))
8195 break; 8161 break;
8196#endif 8162#endif
8163 part_code = FindWindow (er.where, &window_ptr);
8164 }
8165
8166 switch (part_code)
8167 {
8168 case inMenuBar:
8169 if (er.what == mouseDown)
8170 {
8171 f = mac_window_to_frame (mac_front_window ());
8172 saved_menu_event_location = er.where;
8173 inev.kind = MENU_BAR_ACTIVATE_EVENT;
8174 XSETFRAME (inev.frame_or_window, f);
8175 }
8176 break;
8197 8177
8198 if (mouse_tracking_in_progress == mouse_tracking_scroll_bar 8178 case inContent:
8199 && er.what == mouseUp) 8179 if (window_ptr != mac_front_window ())
8200 { 8180 SelectWindow (window_ptr);
8201 struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr); 8181 else
8202 Point mouse_loc = er.where; 8182 {
8183 SInt16 control_part_code;
8184 ControlHandle ch;
8185 Point mouse_loc = er.where;
8186
8187 f = mac_window_to_frame (window_ptr);
8188 /* convert to local coordinates of new window */
8189 SetPortWindowPort (window_ptr);
8203 8190
8204 /* Convert to local coordinates of new window. */ 8191 GlobalToLocal (&mouse_loc);
8205#if TARGET_API_MAC_CARBON 8192#if TARGET_API_MAC_CARBON
8206 SetPort (GetWindowPort (window_ptr)); 8193 ch = FindControlUnderMouse (mouse_loc, window_ptr,
8194 &control_part_code);
8207#else 8195#else
8208 SetPort (window_ptr); 8196 control_part_code = FindControl (mouse_loc, window_ptr,
8197 &ch);
8209#endif 8198#endif
8210 8199
8211 GlobalToLocal (&mouse_loc);
8212
8213#if USE_CARBON_EVENTS 8200#if USE_CARBON_EVENTS
8214 inev.code = mac_get_mouse_btn (eventRef); 8201 inev.code = mac_get_mouse_btn (eventRef);
8202 inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
8215#else 8203#else
8216 inev.code = mac_get_emulate_btn (er.modifiers); 8204 inev.code = mac_get_emulated_btn (er.modifiers);
8205 inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
8217#endif 8206#endif
8218 inev.kind = SCROLL_BAR_CLICK_EVENT; 8207 XSETINT (inev.x, mouse_loc.h);
8219 inev.frame_or_window = tracked_scroll_bar->window; 8208 XSETINT (inev.y, mouse_loc.v);
8220 inev.part = scroll_bar_handle; 8209 inev.timestamp = er.when * (1000 / 60);
8221#if USE_CARBON_EVENTS 8210 /* ticks to milliseconds */
8222 inev.modifiers = mac_event_to_emacs_modifiers (eventRef); 8211
8212 if (dpyinfo->grabbed && tracked_scroll_bar
8213#if TARGET_API_MAC_CARBON
8214 || ch != 0
8223#else 8215#else
8224 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); 8216 || control_part_code != 0
8225#endif 8217#endif
8226 inev.modifiers |= up_modifier; 8218 )
8227 inev.timestamp = er.when * (1000 / 60); 8219 {
8228 /* ticks to milliseconds */ 8220 struct scroll_bar *bar;
8221
8222 if (dpyinfo->grabbed && tracked_scroll_bar)
8223 {
8224 bar = tracked_scroll_bar;
8225 control_part_code = kControlIndicatorPart;
8226 }
8227 else
8228 bar = (struct scroll_bar *) GetControlReference (ch);
8229 x_scroll_bar_handle_click (bar, control_part_code,
8230 &er, &inev);
8231 if (er.what == mouseDown
8232 && control_part_code == kControlIndicatorPart)
8233 tracked_scroll_bar = bar;
8234 else
8235 tracked_scroll_bar = NULL;
8236 }
8237 else
8238 {
8239 Lisp_Object window;
8240 int x = mouse_loc.h;
8241 int y = mouse_loc.v;
8242
8243 window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
8244 if (EQ (window, f->tool_bar_window))
8245 {
8246 if (er.what == mouseDown)
8247 handle_tool_bar_click (f, x, y, 1, 0);
8248 else
8249 handle_tool_bar_click (f, x, y, 0,
8250 inev.modifiers);
8251 tool_bar_p = 1;
8252 }
8253 else
8254 {
8255 XSETFRAME (inev.frame_or_window, f);
8256 inev.kind = MOUSE_CLICK_EVENT;
8257 }
8258 }
8259
8260 if (er.what == mouseDown)
8261 {
8262 dpyinfo->grabbed |= (1 << inev.code);
8263 last_mouse_frame = f;
8264 /* Ignore any mouse motion that happened
8265 before this event; any subsequent
8266 mouse-movement Emacs events should reflect
8267 only motion after the ButtonPress. */
8268 if (f != 0)
8269 f->mouse_moved = 0;
8270
8271 if (!tool_bar_p)
8272 last_tool_bar_item = -1;
8273 }
8274 else
8275 {
8276 if (dpyinfo->grabbed & (1 << inev.code) == 0)
8277 /* If a button is released though it was not
8278 previously pressed, that would be because
8279 of multi-button emulation. */
8280 dpyinfo->grabbed = 0;
8281 else
8282 dpyinfo->grabbed &= ~(1 << inev.code);
8283 }
8284
8285 switch (er.what)
8286 {
8287 case mouseDown:
8288 inev.modifiers |= down_modifier;
8289 break;
8290 case mouseUp:
8291 inev.modifiers |= up_modifier;
8292 break;
8293 }
8294 }
8295 break;
8229 8296
8230 XSETINT (inev.x, XFASTINT (tracked_scroll_bar->left) + 2); 8297 case inDrag:
8231 XSETINT (inev.y, mouse_loc.v - 24); 8298#if TARGET_API_MAC_CARBON
8232 tracked_scroll_bar->dragging = Qnil; 8299 if (er.what == mouseDown)
8233 mouse_tracking_in_progress = mouse_tracking_none; 8300 {
8234 tracked_scroll_bar = NULL; 8301 BitMap bm;
8235 break;
8236 }
8237 8302
8238 part_code = FindWindow (er.where, &window_ptr); 8303 GetQDGlobalsScreenBits (&bm);
8304 DragWindow (window_ptr, er.where, &bm.bounds);
8305 }
8306#else /* not TARGET_API_MAC_CARBON */
8307 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
8308#endif /* not TARGET_API_MAC_CARBON */
8309 break;
8239 8310
8240 switch (part_code) 8311 case inGoAway:
8241 { 8312 if (TrackGoAway (window_ptr, er.where))
8242 case inMenuBar: 8313 {
8243 if (er.what == mouseDown) 8314 inev.kind = DELETE_WINDOW_EVENT;
8244 { 8315 XSETFRAME (inev.frame_or_window,
8245 struct frame *f = ((mac_output *) 8316 mac_window_to_frame (window_ptr));
8246 GetWRefCon (FrontWindow ()))->mFP; 8317 }
8247 saved_menu_event_location = er.where; 8318 break;
8248 inev.kind = MENU_BAR_ACTIVATE_EVENT;
8249 XSETFRAME (inev.frame_or_window, f);
8250 }
8251 break;
8252 8319
8253 case inContent: 8320 /* window resize handling added --ben */
8254 if (window_ptr != FrontWindow ()) 8321 case inGrow:
8255 SelectWindow (window_ptr); 8322 if (er.what == mouseDown)
8256 else 8323 {
8257 { 8324 do_grow_window(window_ptr, &er);
8258 SInt16 control_part_code; 8325 break;
8259 ControlHandle ch; 8326 }
8260 struct mac_output *mwp = (mac_output *)
8261 GetWRefCon (window_ptr);
8262 Point mouse_loc = er.where;
8263
8264 /* convert to local coordinates of new window */
8265#if TARGET_API_MAC_CARBON
8266 SetPort (GetWindowPort (window_ptr));
8267#else
8268 SetPort (window_ptr);
8269#endif
8270 8327
8271 GlobalToLocal (&mouse_loc); 8328 /* window zoom handling added --ben */
8272#if TARGET_API_MAC_CARBON 8329 case inZoomIn:
8273 ch = FindControlUnderMouse (mouse_loc, window_ptr, 8330 case inZoomOut:
8274 &control_part_code); 8331 if (TrackBox (window_ptr, er.where, part_code))
8275#else 8332 do_zoom_window (window_ptr, part_code);
8276 control_part_code = FindControl (mouse_loc, window_ptr, &ch); 8333 break;
8277#endif
8278 8334
8279#if USE_CARBON_EVENTS 8335 default:
8280 inev.code = mac_get_mouse_btn (eventRef); 8336 break;
8281#else 8337 }
8282 inev.code = mac_get_emulate_btn (er.modifiers); 8338 }
8283#endif 8339 break;
8284 XSETINT (inev.x, mouse_loc.h);
8285 XSETINT (inev.y, mouse_loc.v);
8286 inev.timestamp = er.when * (1000 / 60);
8287 /* ticks to milliseconds */
8288 8340
8289#if TARGET_API_MAC_CARBON 8341 case updateEvt:
8290 if (ch != 0)
8291#else
8292 if (control_part_code != 0)
8293#endif
8294 {
8295 struct scroll_bar *bar = (struct scroll_bar *)
8296 GetControlReference (ch);
8297 x_scroll_bar_handle_click (bar, control_part_code, &er,
8298 &inev);
8299 if (er.what == mouseDown
8300 && control_part_code == kControlIndicatorPart)
8301 {
8302 mouse_tracking_in_progress
8303 = mouse_tracking_scroll_bar;
8304 tracked_scroll_bar = bar;
8305 }
8306 else
8307 {
8308 mouse_tracking_in_progress = mouse_tracking_none;
8309 tracked_scroll_bar = NULL;
8310 }
8311 }
8312 else
8313 {
8314 Lisp_Object window;
8315 int x = mouse_loc.h;
8316 int y = mouse_loc.v;
8317
8318 XSETFRAME (inev.frame_or_window, mwp->mFP);
8319 if (er.what == mouseDown)
8320 mouse_tracking_in_progress
8321 = mouse_tracking_mouse_movement;
8322 else
8323 mouse_tracking_in_progress = mouse_tracking_none;
8324 window = window_from_coordinates (mwp->mFP, x, y, 0, 0, 0, 1);
8325
8326 if (EQ (window, mwp->mFP->tool_bar_window))
8327 {
8328 if (er.what == mouseDown)
8329 handle_tool_bar_click (mwp->mFP, x, y, 1, 0);
8330 else
8331 handle_tool_bar_click (mwp->mFP, x, y, 0,
8332#if USE_CARBON_EVENTS 8342#if USE_CARBON_EVENTS
8333 mac_event_to_emacs_modifiers (eventRef) 8343 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
8334#else 8344 != eventNotHandledErr)
8335 er.modifiers 8345 break;
8336#endif 8346#endif
8337 ); 8347 do_window_update ((WindowPtr) er.message);
8338 break; 8348 break;
8339 }
8340 else
8341 inev.kind = MOUSE_CLICK_EVENT;
8342 }
8343 8349
8350 case osEvt:
8344#if USE_CARBON_EVENTS 8351#if USE_CARBON_EVENTS
8345 inev.modifiers = mac_event_to_emacs_modifiers (eventRef); 8352 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
8346#else 8353 != eventNotHandledErr)
8347 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); 8354 break;
8348#endif 8355#endif
8349 8356 switch ((er.message >> 24) & 0x000000FF)
8350 switch (er.what) 8357 {
8351 { 8358 case suspendResumeMessage:
8352 case mouseDown: 8359 if ((er.message & resumeFlag) == 1)
8353 inev.modifiers |= down_modifier; 8360 do_app_resume ();
8354 break; 8361 else
8355 case mouseUp: 8362 do_app_suspend ();
8356 inev.modifiers |= up_modifier;
8357 break;
8358 }
8359 }
8360 break; 8363 break;
8361 8364
8362 case inDrag: 8365 case mouseMovedMessage:
8363#if TARGET_API_MAC_CARBON 8366 previous_help_echo_string = help_echo_string;
8364 if (er.what == mouseDown) 8367 help_echo_string = help_echo_object = help_echo_window = Qnil;
8365 { 8368 help_echo_pos = -1;
8366 BitMap bm;
8367 8369
8368 GetQDGlobalsScreenBits (&bm); 8370 do_mouse_moved (er.where, &f);
8369 DragWindow (window_ptr, er.where, &bm.bounds);
8370 }
8371#else /* not TARGET_API_MAC_CARBON */
8372 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
8373#endif /* not TARGET_API_MAC_CARBON */
8374 break;
8375 8371
8376 case inGoAway: 8372 /* If the contents of the global variable
8377 if (TrackGoAway (window_ptr, er.where)) 8373 help_echo_string has changed, generate a
8378 { 8374 HELP_EVENT. */
8379 inev.kind = DELETE_WINDOW_EVENT; 8375 if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
8380 XSETFRAME (inev.frame_or_window, 8376 do_help = 1;
8381 ((mac_output *) GetWRefCon (window_ptr))->mFP);
8382 }
8383 break;
8384
8385 /* window resize handling added --ben */
8386 case inGrow:
8387 if (er.what == mouseDown)
8388 {
8389 do_grow_window(window_ptr, &er);
8390 break;
8391 }
8392
8393 /* window zoom handling added --ben */
8394 case inZoomIn:
8395 case inZoomOut:
8396 if (TrackBox (window_ptr, er.where, part_code))
8397 do_zoom_window (window_ptr, part_code);
8398 break;
8399
8400 default:
8401 break; 8377 break;
8402 } 8378 }
8403 } 8379 break;
8404 break; 8380
8381 case activateEvt:
8382 {
8383 WindowPtr window_ptr = (WindowPtr) er.message;
8405 8384
8406 case updateEvt:
8407 case osEvt:
8408 case activateEvt:
8409#if USE_CARBON_EVENTS 8385#if USE_CARBON_EVENTS
8410 if (eventNotHandledErr == SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) 8386 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
8387 != eventNotHandledErr)
8388 break;
8411#endif 8389#endif
8412 do_events (&er); 8390 if (window_ptr == tip_window)
8413 break; 8391 {
8392 HideWindow (tip_window);
8393 break;
8394 }
8414 8395
8415 case keyDown: 8396 if ((er.modifiers & activeFlag) != 0)
8416 case autoKey: 8397 {
8417 { 8398 Point mouse_loc = er.where;
8418 int keycode = (er.message & keyCodeMask) >> 8;
8419 int xkeysym;
8420 8399
8421#if USE_CARBON_EVENTS 8400 do_window_activate (window_ptr);
8422 /* When using Carbon Events, we need to pass raw keyboard events
8423 to the TSM ourselves. If TSM handles it, it will pass back
8424 noErr, otherwise it will pass back "eventNotHandledErr" and
8425 we can process it normally. */
8426 if ((!NILP (Vmac_pass_command_to_system)
8427 || !(er.modifiers & cmdKey))
8428 && (!NILP (Vmac_pass_control_to_system)
8429 || !(er.modifiers & controlKey)))
8430 {
8431 OSStatus err;
8432 err = SendEventToEventTarget (eventRef,
8433 GetEventDispatcherTarget ());
8434 if (err != eventNotHandledErr)
8435 break;
8436 }
8437#endif
8438 8401
8439 if (!IsValidWindowPtr (FrontNonFloatingWindow ())) 8402 SetPortWindowPort (window_ptr);
8440 { 8403 GlobalToLocal (&mouse_loc);
8441 SysBeep (1); 8404 /* activateEvt counts as mouse movement,
8442 UNBLOCK_INPUT; 8405 so update things that depend on mouse position. */
8443 return 0; 8406 note_mouse_movement (mac_window_to_frame (window_ptr),
8444 } 8407 &mouse_loc);
8408 }
8409 else
8410 {
8411 do_window_deactivate (window_ptr);
8445 8412
8446 ObscureCursor (); 8413 f = mac_window_to_frame (window_ptr);
8414 if (f == dpyinfo->mouse_face_mouse_frame)
8415 {
8416 /* If we move outside the frame, then we're
8417 certainly no longer on any text in the
8418 frame. */
8419 clear_mouse_face (dpyinfo);
8420 dpyinfo->mouse_face_mouse_frame = 0;
8421 }
8447 8422
8448 if (keycode_to_xkeysym (keycode, &xkeysym)) 8423 /* Generate a nil HELP_EVENT to cancel a help-echo.
8449 { 8424 Do it only if there's something to cancel.
8450 inev.code = 0xff00 | xkeysym; 8425 Otherwise, the startup message is cleared when the
8451 inev.kind = NON_ASCII_KEYSTROKE_EVENT; 8426 mouse leaves the frame. */
8452 } 8427 if (any_help_event_p)
8453 else 8428 do_help = -1;
8454 { 8429 }
8455 if (er.modifiers & (controlKey | 8430 }
8456 (NILP (Vmac_command_key_is_meta) ? optionKey 8431 break;
8457 : cmdKey)))
8458 {
8459 /* This code comes from Keyboard Resource, Appendix
8460 C of IM - Text. This is necessary since shift is
8461 ignored in KCHR table translation when option or
8462 command is pressed. It also does not translate
8463 correctly control-shift chars like C-% so mask off
8464 shift here also */
8465 int new_modifiers = er.modifiers & 0xe600;
8466 /* mask off option and command */
8467 int new_keycode = keycode | new_modifiers;
8468 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
8469 unsigned long some_state = 0;
8470 inev.code = KeyTranslate (kchr_ptr, new_keycode,
8471 &some_state) & 0xff;
8472 }
8473 else
8474 inev.code = er.message & charCodeMask;
8475 inev.kind = ASCII_KEYSTROKE_EVENT;
8476 }
8477 }
8478 8432
8479 /* If variable mac-convert-keyboard-input-to-latin-1 is non-nil, 8433 case keyDown:
8480 convert non-ASCII characters typed at the Mac keyboard 8434 case autoKey:
8481 (presumed to be in the Mac Roman encoding) to iso-latin-1
8482 encoding before they are passed to Emacs. This enables the
8483 Mac keyboard to be used to enter non-ASCII iso-latin-1
8484 characters directly. */
8485 if (mac_keyboard_text_encoding != kTextEncodingMacRoman
8486 && inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128)
8487 { 8435 {
8488 static TECObjectRef converter = NULL; 8436 int keycode = (er.message & keyCodeMask) >> 8;
8489 OSStatus the_err = noErr; 8437 int xkeysym;
8490 OSStatus convert_status = noErr;
8491 8438
8492 if (converter == NULL) 8439#if USE_CARBON_EVENTS
8440 /* When using Carbon Events, we need to pass raw keyboard
8441 events to the TSM ourselves. If TSM handles it, it
8442 will pass back noErr, otherwise it will pass back
8443 "eventNotHandledErr" and we can process it
8444 normally. */
8445 if ((!NILP (Vmac_pass_command_to_system)
8446 || !(er.modifiers & cmdKey))
8447 && (!NILP (Vmac_pass_control_to_system)
8448 || !(er.modifiers & controlKey)))
8449 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
8450 != eventNotHandledErr)
8451 break;
8452#endif
8453
8454#if TARGET_API_MAC_CARBON
8455 if (!IsValidWindowPtr (mac_front_window ()))
8493 { 8456 {
8494 the_err = TECCreateConverter (&converter, 8457 SysBeep (1);
8495 kTextEncodingMacRoman, 8458 break;
8496 mac_keyboard_text_encoding);
8497 current_mac_keyboard_text_encoding
8498 = mac_keyboard_text_encoding;
8499 } 8459 }
8500 else if (mac_keyboard_text_encoding 8460#endif
8501 != current_mac_keyboard_text_encoding) 8461
8462 ObscureCursor ();
8463
8464 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
8502 { 8465 {
8503 /* Free the converter for the current encoding before 8466 clear_mouse_face (dpyinfo);
8504 creating a new one. */ 8467 dpyinfo->mouse_face_hidden = 1;
8505 TECDisposeConverter (converter);
8506 the_err = TECCreateConverter (&converter,
8507 kTextEncodingMacRoman,
8508 mac_keyboard_text_encoding);
8509 current_mac_keyboard_text_encoding
8510 = mac_keyboard_text_encoding;
8511 } 8468 }
8512 8469
8513 if (the_err == noErr) 8470 if (keycode_to_xkeysym (keycode, &xkeysym))
8514 { 8471 {
8515 unsigned char ch = inev.code; 8472 inev.code = 0xff00 | xkeysym;
8516 ByteCount actual_input_length, actual_output_length; 8473 inev.kind = NON_ASCII_KEYSTROKE_EVENT;
8517 unsigned char outch; 8474 }
8518 8475 else
8519 convert_status = TECConvertText (converter, &ch, 1, 8476 {
8520 &actual_input_length, 8477 if (er.modifiers & (controlKey |
8521 &outch, 1, 8478 (NILP (Vmac_command_key_is_meta) ? optionKey
8522 &actual_output_length); 8479 : cmdKey)))
8523 if (convert_status == noErr 8480 {
8524 && actual_input_length == 1 8481 /* This code comes from Keyboard Resource,
8525 && actual_output_length == 1) 8482 Appendix C of IM - Text. This is necessary
8526 inev.code = outch; 8483 since shift is ignored in KCHR table
8484 translation when option or command is pressed.
8485 It also does not translate correctly
8486 control-shift chars like C-% so mask off shift
8487 here also */
8488 int new_modifiers = er.modifiers & 0xe600;
8489 /* mask off option and command */
8490 int new_keycode = keycode | new_modifiers;
8491 Ptr kchr_ptr = (Ptr) GetScriptManagerVariable (smKCHRCache);
8492 unsigned long some_state = 0;
8493 inev.code = KeyTranslate (kchr_ptr, new_keycode,
8494 &some_state) & 0xff;
8495 }
8496 else
8497 inev.code = er.message & charCodeMask;
8498 inev.kind = ASCII_KEYSTROKE_EVENT;
8527 } 8499 }
8528 } 8500 }
8529 8501
8502 /* If variable mac-convert-keyboard-input-to-latin-1 is
8503 non-nil, convert non-ASCII characters typed at the Mac
8504 keyboard (presumed to be in the Mac Roman encoding) to
8505 iso-latin-1 encoding before they are passed to Emacs.
8506 This enables the Mac keyboard to be used to enter
8507 non-ASCII iso-latin-1 characters directly. */
8508 if (mac_keyboard_text_encoding != kTextEncodingMacRoman
8509 && inev.kind == ASCII_KEYSTROKE_EVENT && inev.code >= 128)
8510 {
8511 static TECObjectRef converter = NULL;
8512 OSStatus the_err = noErr;
8513 OSStatus convert_status = noErr;
8514
8515 if (converter == NULL)
8516 {
8517 the_err = TECCreateConverter (&converter,
8518 kTextEncodingMacRoman,
8519 mac_keyboard_text_encoding);
8520 current_mac_keyboard_text_encoding
8521 = mac_keyboard_text_encoding;
8522 }
8523 else if (mac_keyboard_text_encoding
8524 != current_mac_keyboard_text_encoding)
8525 {
8526 /* Free the converter for the current encoding
8527 before creating a new one. */
8528 TECDisposeConverter (converter);
8529 the_err = TECCreateConverter (&converter,
8530 kTextEncodingMacRoman,
8531 mac_keyboard_text_encoding);
8532 current_mac_keyboard_text_encoding
8533 = mac_keyboard_text_encoding;
8534 }
8535
8536 if (the_err == noErr)
8537 {
8538 unsigned char ch = inev.code;
8539 ByteCount actual_input_length, actual_output_length;
8540 unsigned char outch;
8541
8542 convert_status = TECConvertText (converter, &ch, 1,
8543 &actual_input_length,
8544 &outch, 1,
8545 &actual_output_length);
8546 if (convert_status == noErr
8547 && actual_input_length == 1
8548 && actual_output_length == 1)
8549 inev.code = outch;
8550 }
8551 }
8552
8530#if USE_CARBON_EVENTS 8553#if USE_CARBON_EVENTS
8531 inev.modifiers = mac_event_to_emacs_modifiers (eventRef); 8554 inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
8532#else 8555#else
8533 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); 8556 inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
8534#endif 8557#endif
8558 XSETFRAME (inev.frame_or_window,
8559 mac_window_to_frame (mac_front_window ()));
8560 inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
8561 break;
8535 8562
8536 { 8563 case kHighLevelEvent:
8537 mac_output *mwp 8564 drag_and_drop_file_list = Qnil;
8538 = (mac_output *) GetWRefCon (FrontNonFloatingWindow ());
8539 XSETFRAME (inev.frame_or_window, mwp->mFP);
8540 }
8541
8542 inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */
8543 break;
8544
8545 case kHighLevelEvent:
8546 drag_and_drop_file_list = Qnil;
8547 8565
8548 AEProcessAppleEvent(&er); 8566 AEProcessAppleEvent(&er);
8549 8567
8550 /* Build a DRAG_N_DROP_EVENT type event as is done in 8568 /* Build a DRAG_N_DROP_EVENT type event as is done in
8551 constuct_drag_n_drop in w32term.c. */ 8569 constuct_drag_n_drop in w32term.c. */
8552 if (!NILP (drag_and_drop_file_list)) 8570 if (!NILP (drag_and_drop_file_list))
8553 { 8571 {
8554 struct frame *f = NULL; 8572 struct frame *f = NULL;
8555 WindowPtr wp; 8573 WindowPtr wp;
8556 Lisp_Object frame; 8574 Lisp_Object frame;
8557 8575
8558 wp = FrontNonFloatingWindow (); 8576 wp = mac_front_window ();
8559 8577
8560 if (!wp) 8578 if (!wp)
8561 { 8579 {
8562 struct frame *f = XFRAME (XCAR (Vframe_list)); 8580 struct frame *f = XFRAME (XCAR (Vframe_list));
8563 CollapseWindow (FRAME_MAC_WINDOW (f), false); 8581 CollapseWindow (FRAME_MAC_WINDOW (f), false);
8564 wp = FrontNonFloatingWindow (); 8582 wp = mac_front_window ();
8565 } 8583 }
8566 8584
8567 if (wp && is_emacs_window(wp)) 8585 if (wp && is_emacs_window (wp))
8568 f = ((mac_output *) GetWRefCon (wp))->mFP; 8586 f = mac_window_to_frame (wp);
8569 8587
8570 inev.kind = DRAG_N_DROP_EVENT; 8588 inev.kind = DRAG_N_DROP_EVENT;
8571 inev.code = 0; 8589 inev.code = 0;
8572 inev.timestamp = er.when * (1000 / 60); 8590 inev.timestamp = er.when * (1000 / 60);
8573 /* ticks to milliseconds */ 8591 /* ticks to milliseconds */
8574#if USE_CARBON_EVENTS 8592#if USE_CARBON_EVENTS
8575 inev.modifiers = mac_event_to_emacs_modifiers (eventRef); 8593 inev.modifiers = mac_event_to_emacs_modifiers (eventRef);
8576#else 8594#else
8577 inev.modifiers = mac_to_emacs_modifiers (er.modifiers); 8595 inev.modifiers = mac_to_emacs_modifiers (er.modifiers);
8578#endif 8596#endif
8579 8597
8580 XSETINT (inev.x, 0); 8598 XSETINT (inev.x, 0);
8581 XSETINT (inev.y, 0); 8599 XSETINT (inev.y, 0);
8582 8600
8583 XSETFRAME (frame, f); 8601 XSETFRAME (frame, f);
8584 inev.frame_or_window = Fcons (frame, drag_and_drop_file_list); 8602 inev.frame_or_window = Fcons (frame, drag_and_drop_file_list);
8585 8603
8586 /* Regardless of whether Emacs was suspended or in the 8604 /* Regardless of whether Emacs was suspended or in the
8587 foreground, ask it to redraw its entire screen. 8605 foreground, ask it to redraw its entire screen.
8588 Otherwise parts of the screen can be left in an 8606 Otherwise parts of the screen can be left in an
8589 inconsistent state. */ 8607 inconsistent state. */
8590 if (wp) 8608 if (wp)
8591#if TARGET_API_MAC_CARBON 8609#if TARGET_API_MAC_CARBON
8592 { 8610 {
8593 Rect r; 8611 Rect r;
8594 8612
8595 GetWindowPortBounds (wp, &r); 8613 GetWindowPortBounds (wp, &r);
8596 InvalWindowRect (wp, &r); 8614 InvalWindowRect (wp, &r);
8597 } 8615 }
8598#else /* not TARGET_API_MAC_CARBON */ 8616#else /* not TARGET_API_MAC_CARBON */
8599 InvalRect (&(wp->portRect)); 8617 InvalRect (&(wp->portRect));
8600#endif /* not TARGET_API_MAC_CARBON */ 8618#endif /* not TARGET_API_MAC_CARBON */
8601 } 8619 }
8602 default: 8620 default:
8603 break; 8621 break;
8604 } 8622 }
8605#if USE_CARBON_EVENTS 8623#if USE_CARBON_EVENTS
8606 ReleaseEvent (eventRef); 8624 ReleaseEvent (eventRef);
8607 }
8608#endif 8625#endif
8609 8626
8627 if (inev.kind != NO_EVENT)
8628 {
8629 kbd_buffer_store_event_hold (&inev, hold_quit);
8630 count++;
8631 }
8632
8633 if (do_help
8634 && !(hold_quit && hold_quit->kind != NO_EVENT))
8635 {
8636 Lisp_Object frame;
8637
8638 if (f)
8639 XSETFRAME (frame, f);
8640 else
8641 frame = Qnil;
8642
8643 if (do_help > 0)
8644 {
8645 any_help_event_p = 1;
8646 gen_help_event (help_echo_string, frame, help_echo_window,
8647 help_echo_object, help_echo_pos);
8648 }
8649 else
8650 {
8651 help_echo_string = Qnil;
8652 gen_help_event (Qnil, frame, Qnil, Qnil, 0);
8653 }
8654 count++;
8655 }
8656
8657 }
8658
8610 /* If the focus was just given to an autoraising frame, 8659 /* If the focus was just given to an autoraising frame,
8611 raise it now. */ 8660 raise it now. */
8612 /* ??? This ought to be able to handle more than one such frame. */ 8661 /* ??? This ought to be able to handle more than one such frame. */
@@ -8620,58 +8669,6 @@ XTread_socket (int sd, int expected, struct input_event *hold_quit)
8620 check_alarm (); /* simulate the handling of a SIGALRM */ 8669 check_alarm (); /* simulate the handling of a SIGALRM */
8621#endif 8670#endif
8622 8671
8623 {
8624 static Point old_mouse_pos = { -1, -1 };
8625
8626 if (app_is_suspended)
8627 {
8628 old_mouse_pos.h = -1;
8629 old_mouse_pos.v = -1;
8630 }
8631 else
8632 {
8633 Point mouse_pos;
8634 WindowPtr wp;
8635 struct frame *f;
8636 Lisp_Object bar;
8637 struct scroll_bar *sb;
8638
8639 wp = FrontWindow ();
8640 if (is_emacs_window (wp))
8641 {
8642 f = ((mac_output *) GetWRefCon (wp))->mFP;
8643
8644#if TARGET_API_MAC_CARBON
8645 SetPort (GetWindowPort (wp));
8646#else
8647 SetPort (wp);
8648#endif
8649
8650 GetMouse (&mouse_pos);
8651
8652 if (!EqualPt (mouse_pos, old_mouse_pos))
8653 {
8654 if (mouse_tracking_in_progress == mouse_tracking_scroll_bar
8655 && tracked_scroll_bar)
8656 x_scroll_bar_note_movement (tracked_scroll_bar,
8657 mouse_pos.v
8658 - XINT (tracked_scroll_bar->top),
8659 TickCount() * (1000 / 60));
8660 else
8661 note_mouse_movement (f, &mouse_pos);
8662
8663 old_mouse_pos = mouse_pos;
8664 }
8665 }
8666 }
8667 }
8668
8669 if (inev.kind != NO_EVENT)
8670 {
8671 kbd_buffer_store_event_hold (&inev, hold_quit);
8672 count++;
8673 }
8674
8675 UNBLOCK_INPUT; 8672 UNBLOCK_INPUT;
8676 return count; 8673 return count;
8677} 8674}
@@ -8700,7 +8697,7 @@ __convert_from_newlines (unsigned char * p, size_t * n)
8700 ROWS Macintosh window, using font with name FONTNAME and size 8697 ROWS Macintosh window, using font with name FONTNAME and size
8701 FONTSIZE. */ 8698 FONTSIZE. */
8702void 8699void
8703NewMacWindow (FRAME_PTR fp) 8700make_mac_frame (FRAME_PTR fp)
8704{ 8701{
8705 mac_output *mwp; 8702 mac_output *mwp;
8706#if TARGET_API_MAC_CARBON 8703#if TARGET_API_MAC_CARBON
@@ -8719,33 +8716,52 @@ NewMacWindow (FRAME_PTR fp)
8719 making_terminal_window = 0; 8716 making_terminal_window = 0;
8720 } 8717 }
8721 else 8718 else
8722 if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1))) 8719 {
8723 abort (); 8720#if TARGET_API_MAC_CARBON
8721 Rect r;
8722
8723 SetRect (&r, 0, 0, 1, 1);
8724 if (CreateNewWindow (kDocumentWindowClass,
8725 kWindowStandardDocumentAttributes
8726 /* | kWindowToolbarButtonAttribute */,
8727 &r, &mwp->mWP) != noErr)
8728#else
8729 if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1)))
8730#endif
8731 abort ();
8732 }
8724 8733
8725 SetWRefCon (mwp->mWP, (long) mwp); 8734 SetWRefCon (mwp->mWP, (long) mwp);
8726 /* so that update events can find this mac_output struct */ 8735 /* so that update events can find this mac_output struct */
8727 mwp->mFP = fp; /* point back to emacs frame */ 8736 mwp->mFP = fp; /* point back to emacs frame */
8728 8737
8729#if TARGET_API_MAC_CARBON 8738 SetPortWindowPort (mwp->mWP);
8730 SetPort (GetWindowPort (mwp->mWP));
8731#else
8732 SetPort (mwp->mWP);
8733#endif
8734
8735 mwp->fontset = -1;
8736 8739
8737 SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false); 8740 SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
8738 ShowWindow (mwp->mWP);
8739
8740} 8741}
8741 8742
8742 8743
8743void 8744void
8744make_mac_frame (struct frame *f) 8745make_mac_terminal_frame (struct frame *f)
8745{ 8746{
8746 FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR; 8747 Lisp_Object frame;
8748
8749 XSETFRAME (frame, f);
8750
8751 f->output_method = output_mac;
8752 f->output_data.mac = (struct mac_output *)
8753 xmalloc (sizeof (struct mac_output));
8754 bzero (f->output_data.mac, sizeof (struct mac_output));
8755
8756 XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);
8747 8757
8748 NewMacWindow(f); 8758 FRAME_COLS (f) = 96;
8759 FRAME_LINES (f) = 4;
8760
8761 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
8762 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_right;
8763
8764 FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR;
8749 8765
8750 f->output_data.mac->cursor_pixel = 0; 8766 f->output_data.mac->cursor_pixel = 0;
8751 f->output_data.mac->border_pixel = 0x00ff00; 8767 f->output_data.mac->border_pixel = 0x00ff00;
@@ -8753,8 +8769,6 @@ make_mac_frame (struct frame *f)
8753 f->output_data.mac->cursor_foreground_pixel = 0x0000ff; 8769 f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
8754 8770
8755 FRAME_FONTSET (f) = -1; 8771 FRAME_FONTSET (f) = -1;
8756 f->output_data.mac->scroll_bar_foreground_pixel = -1;
8757 f->output_data.mac->scroll_bar_background_pixel = -1;
8758 f->output_data.mac->explicit_parent = 0; 8772 f->output_data.mac->explicit_parent = 0;
8759 f->left_pos = 4; 8773 f->left_pos = 4;
8760 f->top_pos = 4; 8774 f->top_pos = 4;
@@ -8762,37 +8776,11 @@ make_mac_frame (struct frame *f)
8762 8776
8763 f->internal_border_width = 0; 8777 f->internal_border_width = 0;
8764 8778
8765 f->output_method = output_mac;
8766
8767 f->auto_raise = 1; 8779 f->auto_raise = 1;
8768 f->auto_lower = 1; 8780 f->auto_lower = 1;
8769 8781
8770 f->new_text_cols = 0; 8782 f->new_text_cols = 0;
8771 f->new_text_lines = 0; 8783 f->new_text_lines = 0;
8772}
8773
8774void
8775make_mac_terminal_frame (struct frame *f)
8776{
8777 Lisp_Object frame;
8778
8779 XSETFRAME (frame, f);
8780
8781 f->output_method = output_mac;
8782 f->output_data.mac = (struct mac_output *)
8783 xmalloc (sizeof (struct mac_output));
8784 bzero (f->output_data.mac, sizeof (struct mac_output));
8785 FRAME_FONTSET (f) = -1;
8786 f->output_data.mac->scroll_bar_foreground_pixel = -1;
8787 f->output_data.mac->scroll_bar_background_pixel = -1;
8788
8789 XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);
8790
8791 FRAME_COLS (f) = 96;
8792 FRAME_LINES (f) = 4;
8793
8794 FRAME_CAN_HAVE_SCROLL_BARS (f) = 1;
8795 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_right;
8796 8784
8797 make_mac_frame (f); 8785 make_mac_frame (f);
8798 8786
@@ -8810,6 +8798,8 @@ make_mac_terminal_frame (struct frame *f)
8810 Fmodify_frame_parameters (frame, 8798 Fmodify_frame_parameters (frame,
8811 Fcons (Fcons (Qbackground_color, 8799 Fcons (Fcons (Qbackground_color,
8812 build_string ("white")), Qnil)); 8800 build_string ("white")), Qnil));
8801
8802 ShowWindow (f->output_data.mac->mWP);
8813} 8803}
8814 8804
8815 8805
@@ -8864,6 +8854,8 @@ mac_initialize_display_info ()
8864 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 8854 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
8865 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; 8855 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
8866 dpyinfo->mouse_face_window = Qnil; 8856 dpyinfo->mouse_face_window = Qnil;
8857 dpyinfo->mouse_face_overlay = Qnil;
8858 dpyinfo->mouse_face_hidden = 0;
8867} 8859}
8868 8860
8869struct mac_display_info * 8861struct mac_display_info *
@@ -9020,8 +9012,7 @@ mac_check_for_quit_char ()
9020 if (event) 9012 if (event)
9021 { 9013 {
9022 struct input_event e; 9014 struct input_event e;
9023 struct mac_output *mwp = 9015
9024 (mac_output *) GetWRefCon (FrontNonFloatingWindow ());
9025 /* Use an input_event to emulate what the interrupt handler does. */ 9016 /* Use an input_event to emulate what the interrupt handler does. */
9026 EVENT_INIT (e); 9017 EVENT_INIT (e);
9027 e.kind = ASCII_KEYSTROKE_EVENT; 9018 e.kind = ASCII_KEYSTROKE_EVENT;
@@ -9029,7 +9020,7 @@ mac_check_for_quit_char ()
9029 e.arg = Qnil; 9020 e.arg = Qnil;
9030 e.modifiers = NULL; 9021 e.modifiers = NULL;
9031 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); 9022 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
9032 XSETFRAME (e.frame_or_window, mwp->mFP); 9023 XSETFRAME (e.frame_or_window, mac_window_to_frame (mac_front_window ()));
9033 /* Remove event from queue to prevent looping. */ 9024 /* Remove event from queue to prevent looping. */
9034 RemoveEventFromQueue (GetMainEventQueue (), event); 9025 RemoveEventFromQueue (GetMainEventQueue (), event);
9035 ReleaseEvent (event); 9026 ReleaseEvent (event);
diff --git a/src/undo.c b/src/undo.c
index dd086db6c40..9fdc46a3b13 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -292,14 +292,15 @@ but another undo command will undo to the previous boundary. */)
292 292
293/* At garbage collection time, make an undo list shorter at the end, 293/* At garbage collection time, make an undo list shorter at the end,
294 returning the truncated list. 294 returning the truncated list.
295 MINSIZE and MAXSIZE are the limits on size allowed, as described below. 295 MINSIZE, MAXSIZE and LIMITSIZE are the limits on size allowed,
296 In practice, these are the values of undo-limit and 296 as described below.
297 undo-strong-limit. */ 297 In practice, these are the values of undo-limit,
298 undo-strong-limit, and undo-outer-limit. */
298 299
299Lisp_Object 300Lisp_Object
300truncate_undo_list (list, minsize, maxsize) 301truncate_undo_list (list, minsize, maxsize, limitsize)
301 Lisp_Object list; 302 Lisp_Object list;
302 int minsize, maxsize; 303 int minsize, maxsize, limitsize;
303{ 304{
304 Lisp_Object prev, next, last_boundary; 305 Lisp_Object prev, next, last_boundary;
305 int size_so_far = 0; 306 int size_so_far = 0;
@@ -308,7 +309,8 @@ truncate_undo_list (list, minsize, maxsize)
308 next = list; 309 next = list;
309 last_boundary = Qnil; 310 last_boundary = Qnil;
310 311
311 /* Always preserve at least the most recent undo record. 312 /* Always preserve at least the most recent undo record
313 unless it is really horribly big.
312 If the first element is an undo boundary, skip past it. 314 If the first element is an undo boundary, skip past it.
313 315
314 Skip, skip, skip the undo, skip, skip, skip the undo, 316 Skip, skip, skip the undo, skip, skip, skip the undo,
@@ -323,6 +325,7 @@ truncate_undo_list (list, minsize, maxsize)
323 prev = next; 325 prev = next;
324 next = XCDR (next); 326 next = XCDR (next);
325 } 327 }
328
326 while (CONSP (next) && ! NILP (XCAR (next))) 329 while (CONSP (next) && ! NILP (XCAR (next)))
327 { 330 {
328 Lisp_Object elt; 331 Lisp_Object elt;
@@ -338,13 +341,20 @@ truncate_undo_list (list, minsize, maxsize)
338 + SCHARS (XCAR (elt))); 341 + SCHARS (XCAR (elt)));
339 } 342 }
340 343
344 /* If we reach LIMITSIZE before the first boundary,
345 we're heading for memory full, so truncate the list to nothing. */
346 if (size_so_far > limitsize)
347 return Qnil;
348
341 /* Advance to next element. */ 349 /* Advance to next element. */
342 prev = next; 350 prev = next;
343 next = XCDR (next); 351 next = XCDR (next);
344 } 352 }
353
345 if (CONSP (next)) 354 if (CONSP (next))
346 last_boundary = prev; 355 last_boundary = prev;
347 356
357 /* Keep more if it fits. */
348 while (CONSP (next)) 358 while (CONSP (next))
349 { 359 {
350 Lisp_Object elt; 360 Lisp_Object elt;
diff --git a/src/xdisp.c b/src/xdisp.c
index 48f73c5c738..67049a151cc 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -198,8 +198,6 @@ Boston, MA 02111-1307, USA. */
198#endif 198#endif
199#ifdef MAC_OS 199#ifdef MAC_OS
200#include "macterm.h" 200#include "macterm.h"
201
202Cursor No_Cursor;
203#endif 201#endif
204 202
205#ifndef FRAME_X_OUTPUT 203#ifndef FRAME_X_OUTPUT
@@ -20636,11 +20634,7 @@ define_frame_cursor1 (f, cursor, pointer)
20636 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 20634 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
20637 } 20635 }
20638 20636
20639#ifndef HAVE_CARBON
20640 if (cursor != No_Cursor) 20637 if (cursor != No_Cursor)
20641#else
20642 if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
20643#endif
20644 FRAME_RIF (f)->define_frame_cursor (f, cursor); 20638 FRAME_RIF (f)->define_frame_cursor (f, cursor);
20645} 20639}
20646 20640