diff options
93 files changed, 3569 insertions, 1846 deletions
| @@ -98,6 +98,11 @@ types any more. Add -DUSE_LISP_UNION_TYPE if you want union types. | |||
| 98 | 98 | ||
| 99 | * Changes in Emacs 21.4 | 99 | * Changes in Emacs 21.4 |
| 100 | 100 | ||
| 101 | ** calculator.el now has radix grouping mode. In this mode a | ||
| 102 | separator character is used between every few digits, making it | ||
| 103 | easier to indicate byte boundries etc. See the documentation of | ||
| 104 | the `calculator-radix-grouping-mode' custom variable. | ||
| 105 | |||
| 101 | ** You can now follow links by clicking Mouse-1 on the link. | 106 | ** You can now follow links by clicking Mouse-1 on the link. |
| 102 | 107 | ||
| 103 | Traditionally, Emacs uses a Mouse-1 click to set point and a Mouse-2 | 108 | Traditionally, Emacs uses a Mouse-1 click to set point and a Mouse-2 |
| @@ -981,6 +986,9 @@ be navigated with the arrow keys (like Gtk+, Mac and W32). | |||
| 981 | ESC, like they do for Gtk+, Mac and W32. | 986 | ESC, like they do for Gtk+, Mac and W32. |
| 982 | 987 | ||
| 983 | --- | 988 | --- |
| 989 | ** Dialogs and menus pop down when pressing C-g. | ||
| 990 | |||
| 991 | --- | ||
| 984 | ** The menu item "Open File..." has been split into two items, "New File..." | 992 | ** The menu item "Open File..." has been split into two items, "New File..." |
| 985 | and "Open File...". "Open File..." now opens only existing files. This is | 993 | and "Open File...". "Open File..." now opens only existing files. This is |
| 986 | to support existing GUI file selection dialogs better. | 994 | to support existing GUI file selection dialogs better. |
| @@ -2143,6 +2151,11 @@ anyone has committed to the repository since you last executed | |||
| 2143 | "checkout", "update" or "commit". That means using cvs diff options | 2151 | "checkout", "update" or "commit". That means using cvs diff options |
| 2144 | -rBASE -rHEAD. | 2152 | -rBASE -rHEAD. |
| 2145 | 2153 | ||
| 2154 | ** New variable `hs-set-up-overlay' allows customization of the overlay | ||
| 2155 | used to effect hiding for hideshow minor mode. Integration with isearch | ||
| 2156 | handles the overlay property `display' specially, preserving it during | ||
| 2157 | temporary overlay showing in the course of an isearch operation. | ||
| 2158 | |||
| 2146 | 2159 | ||
| 2147 | * New modes and packages in Emacs 21.4 | 2160 | * New modes and packages in Emacs 21.4 |
| 2148 | 2161 | ||
| @@ -2390,6 +2403,15 @@ configuration files. | |||
| 2390 | 2403 | ||
| 2391 | * Lisp Changes in Emacs 21.4 | 2404 | * Lisp Changes in Emacs 21.4 |
| 2392 | 2405 | ||
| 2406 | +++ | ||
| 2407 | ** If a buffer sets buffer-save-without-query to non-nil, | ||
| 2408 | save-some-buffers will always save that buffer without asking | ||
| 2409 | (if it's modified). | ||
| 2410 | |||
| 2411 | +++ | ||
| 2412 | ** The function symbol-file tells you which file defined | ||
| 2413 | a certain function or variable. | ||
| 2414 | |||
| 2393 | ** Lisp code can now test if a given buffer position is inside a | 2415 | ** Lisp code can now test if a given buffer position is inside a |
| 2394 | clickable link with the new function `mouse-on-link-p'. This is the | 2416 | clickable link with the new function `mouse-on-link-p'. This is the |
| 2395 | function used by the new `mouse-1-click-follows-link' functionality. | 2417 | function used by the new `mouse-1-click-follows-link' functionality. |
| @@ -3100,6 +3122,10 @@ which means FUNNAME was previously defined as an autoload (before the | |||
| 3100 | current file redefined it). | 3122 | current file redefined it). |
| 3101 | 3123 | ||
| 3102 | +++ | 3124 | +++ |
| 3125 | ** `load-history' now records (defun . FUNNAME) when a function is | ||
| 3126 | defined. For a variable, it records just the variable name. | ||
| 3127 | |||
| 3128 | +++ | ||
| 3103 | ** New Lisp library testcover.el works with edebug to help you determine | 3129 | ** New Lisp library testcover.el works with edebug to help you determine |
| 3104 | whether you've tested all your Lisp code. Function testcover-start | 3130 | whether you've tested all your Lisp code. Function testcover-start |
| 3105 | instruments all functions in a given file. Then test your code. Function | 3131 | instruments all functions in a given file. Then test your code. Function |
| @@ -15,6 +15,8 @@ to the FSF. | |||
| 15 | ought to be possible to omit text which is invisible (due to a | 15 | ought to be possible to omit text which is invisible (due to a |
| 16 | text-property, overlay, or selective display) from the kill-ring. | 16 | text-property, overlay, or selective display) from the kill-ring. |
| 17 | 17 | ||
| 18 | ** battery.el display-battery should be replaced with a minor mode. | ||
| 19 | |||
| 18 | ** Redefine define-generic-mode as a macro, so the compiler | 20 | ** Redefine define-generic-mode as a macro, so the compiler |
| 19 | sees the definitions it generates. | 21 | sees the definitions it generates. |
| 20 | 22 | ||
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index d913fbaf2c9..92d06473a80 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2004-12-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * make-docfile.c: Include stdlib.h even if WINDOWSNT is not | ||
| 4 | defined. | ||
| 5 | |||
| 1 | 2004-12-15 Andreas Schwab <schwab@suse.de> | 6 | 2004-12-15 Andreas Schwab <schwab@suse.de> |
| 2 | 7 | ||
| 3 | * etags.c (main): Fix typo in conversion of LONG_OPTIONS from | 8 | * etags.c (main): Fix typo in conversion of LONG_OPTIONS from |
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index e502061b759..02ddbabe7a7 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -43,11 +43,11 @@ Boston, MA 02111-1307, USA. */ | |||
| 43 | #undef chdir | 43 | #undef chdir |
| 44 | 44 | ||
| 45 | #include <stdio.h> | 45 | #include <stdio.h> |
| 46 | #include <stdlib.h> | ||
| 46 | #ifdef MSDOS | 47 | #ifdef MSDOS |
| 47 | #include <fcntl.h> | 48 | #include <fcntl.h> |
| 48 | #endif /* MSDOS */ | 49 | #endif /* MSDOS */ |
| 49 | #ifdef WINDOWSNT | 50 | #ifdef WINDOWSNT |
| 50 | #include <stdlib.h> | ||
| 51 | #include <fcntl.h> | 51 | #include <fcntl.h> |
| 52 | #include <direct.h> | 52 | #include <direct.h> |
| 53 | #endif /* WINDOWSNT */ | 53 | #endif /* WINDOWSNT */ |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2795cbf26d4..6f75d7141b2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,154 @@ | |||
| 1 | 2004-12-27 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * simple.el (undo): Fix previous change. | ||
| 4 | |||
| 5 | 2004-12-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 6 | |||
| 7 | * term/mac-win.el: Sync with x-win.el. Rearrange the contents. | ||
| 8 | Call mac-clear-font-name-table if invoked on Mac OS 8/9. Call | ||
| 9 | x-open-connection on Mac OS X. | ||
| 10 | |||
| 11 | 2004-12-27 Richard M. Stallman <rms@gnu.org> | ||
| 12 | |||
| 13 | * files.el (buffer-save-without-query): New var (buffer-local). | ||
| 14 | (save-some-buffers): Save those buffers first, w/o asking. | ||
| 15 | |||
| 16 | * files.el (insert-directory-ls-version): New variable. | ||
| 17 | (insert-directory): When ls returns an error, test the version | ||
| 18 | number to decide what the return code means. | ||
| 19 | With --dired output format, detect and distinguish lines | ||
| 20 | that are really error messages. | ||
| 21 | (insert-directory-adj-pos): New function. | ||
| 22 | |||
| 23 | * bookmark.el (bookmark-jump): Nice error if BOOKMARK is nil. | ||
| 24 | |||
| 25 | * battery.el (battery-mode-line-format): Remove initial spaces. | ||
| 26 | |||
| 27 | * uniquify.el (uniquify-rationalize-file-buffer-names): | ||
| 28 | Delete interactive spec. | ||
| 29 | |||
| 30 | * type-break.el (type-break-mode): Set buffer-save-without-query. | ||
| 31 | Remove code that tried to set save-some-buffers-always. | ||
| 32 | (type-break-file-keystroke-count): Bind deactivate-mark. | ||
| 33 | |||
| 34 | * mouse.el (mouse-drag-region): Bind mouse-autoselect-window. | ||
| 35 | |||
| 36 | * simple.el (next-error-buffer-p): New arg AVOID-CURRENT. | ||
| 37 | Test that the buffer is live, and maybe reject current buffer too. | ||
| 38 | Clarify. | ||
| 39 | (next-error-find-buffer): Rewrite for clarity. | ||
| 40 | |||
| 41 | * loadup.el: Don't use buffer-disable-undo; do it directly. | ||
| 42 | |||
| 43 | * help-fns.el (describe-function-1): Call symbol-file with `defun'. | ||
| 44 | (describe-variable): Call symbol-file with `defvar'. | ||
| 45 | |||
| 46 | * subr.el (messages-buffer-max-lines): Alias for message-log-max. | ||
| 47 | (symbol-file): Rewritten to handle new load-history format. | ||
| 48 | Now takes an arg TYPE to specify looking for a particular | ||
| 49 | type of definition only. | ||
| 50 | |||
| 51 | * emacs-lisp/debug.el (debugger-make-xrefs): | ||
| 52 | Call symbol-file with `defun'. | ||
| 53 | |||
| 54 | * emacs-lisp/find-func.el (find-function-noselect): | ||
| 55 | Call symbol-file with `defun'. | ||
| 56 | (find-variable-noselect): Call symbol-file with `defvar'. | ||
| 57 | |||
| 58 | * eshell/esh-cmd.el (eshell-find-alias-function): | ||
| 59 | Call symbol-file with `defun'. | ||
| 60 | |||
| 61 | * eshell/esh-test.el (eshell-test-goto-func): | ||
| 62 | Call symbol-file with `defun'. | ||
| 63 | |||
| 64 | * mail/rmail.el (rmail-resend): | ||
| 65 | Let MAIL-ALIAS-FILE arg override mail-personal-alias-file. | ||
| 66 | |||
| 67 | * net/goto-addr.el (goto-address-mail-regexp): Allow = in username. | ||
| 68 | |||
| 69 | * progmodes/compile.el (compilation-find-buffer): Rename arg. | ||
| 70 | |||
| 71 | * textmodes/texinfmt.el (texinfo-format-buffer-1): | ||
| 72 | Call buffer-disable-undo. | ||
| 73 | |||
| 74 | * simple.el (undo-list-saved): New variable (buffer-local). | ||
| 75 | (undo): Set and test it. | ||
| 76 | (buffer-disable-undo): Moved here from buffer.c. | ||
| 77 | Clear out undo-list-saved. | ||
| 78 | |||
| 79 | * international/mule.el (decode-coding-inserted-region): | ||
| 80 | Set buffer-undo-list in a correct and optimal way. | ||
| 81 | |||
| 82 | * progmodes/cperl-mode.el (cperl-find-bad-style): Use with-no-warnings. | ||
| 83 | (cperl-font-lock-unfontify-region-function): No need to save and | ||
| 84 | restore info, since font-lock.el does it for us. | ||
| 85 | |||
| 86 | * ansi-color.el (save-buffer-state): Definition deleted. | ||
| 87 | (ansi-color-unfontify-region): Don't use save-buffer-state. | ||
| 88 | |||
| 89 | 2004-12-27 Dave Love <fx@gnu.org> | ||
| 90 | |||
| 91 | * wid-edit.el (function): Use restricted-sexp as parent. | ||
| 92 | |||
| 93 | 2004-12-27 Kevin Ryde <user42@zip.com.au> | ||
| 94 | |||
| 95 | * simple.el (next-matching-history-element): Use same | ||
| 96 | `interactive' form as previous-matching-history-element. | ||
| 97 | |||
| 98 | * ffap.el (ffap-string-at-point-mode-alist): Add "*" to url chars, | ||
| 99 | it can appear unencoded and has been seen from yahoo. | ||
| 100 | |||
| 101 | 2004-12-27 Sergey Poznyakoff <gray@Mirddin.farlep.net> | ||
| 102 | |||
| 103 | * mail/smtpmail.el (smtpmail-try-auth-methods): Send AUTH CRAM-MD5 | ||
| 104 | in upper case. Reported by Wojciech Polak <polak@gnu.org>. | ||
| 105 | |||
| 106 | 2004-12-27 Kenichi Handa <handa@m17n.org> | ||
| 107 | |||
| 108 | * international/utf-8.el (utf-translate-cjk-load-tables): Bind | ||
| 109 | coding-system-for-read to nil while loading subst-*. | ||
| 110 | |||
| 111 | 2004-12-26 Jay Belanger <belanger@truman.edu> | ||
| 112 | |||
| 113 | * calc/calc-store.el (calc-read-var-name): Remove "var-" from | ||
| 114 | default input. | ||
| 115 | |||
| 116 | 2004-12-26 Luc Teirlinck <teirllm@auburn.edu> | ||
| 117 | |||
| 118 | * buff-menu.el (Buffer-menu-revert-function): Clear out undo info | ||
| 119 | before reverting and disable undo recording while reverting. | ||
| 120 | |||
| 121 | 2004-12-26 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 122 | |||
| 123 | * progmodes/hideshow.el (hs-set-up-overlay): New user var. | ||
| 124 | (hs-make-overlay): New function. | ||
| 125 | (hs-isearch-show-temporary): Handle `display' overlay prop specially. | ||
| 126 | (hs-flag-region): Delete function. | ||
| 127 | (hs-hide-comment-region): No longer use `hs-flag-region'. | ||
| 128 | Instead, use `hs-discard-overlays' and `hs-make-overlay'. | ||
| 129 | (hs-hide-block-at-point): Likewise. | ||
| 130 | (hs-hide-level-recursive): Use `hs-discard-overlays'. | ||
| 131 | (hs-hide-all, hs-show-all): Likewise. | ||
| 132 | (hs-show-block): Likewise. | ||
| 133 | Also, use overlay prop `hs-b-offset', not `hs-ofs'. | ||
| 134 | |||
| 135 | 2004-12-24 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 136 | |||
| 137 | * progmodes/hideshow.el: Require `cl' when compiling. | ||
| 138 | Remove XEmacs and Emacs 19 compatibility. | ||
| 139 | Use `dolist' and `add-to-list' for load-time actions. | ||
| 140 | (hs-discard-overlays): Use `dolist'. | ||
| 141 | (hs-show-block): Likewise. | ||
| 142 | |||
| 143 | 2004-12-23 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 144 | |||
| 145 | * faces.el (mode-line, mode-line-inactive): Use min-colors. | ||
| 146 | |||
| 147 | 2004-12-23 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 148 | |||
| 149 | * progmodes/hideshow.el (hs-inside-comment-p): Fix omission bug: | ||
| 150 | When extending backwards, move outside the current comment first. | ||
| 151 | |||
| 1 | 2004-12-22 Kenichi Handa <handa@m17n.org> | 152 | 2004-12-22 Kenichi Handa <handa@m17n.org> |
| 2 | 153 | ||
| 3 | * international/quail.el (quail-start-translation): Fix prompt | 154 | * international/quail.el (quail-start-translation): Fix prompt |
| @@ -23,21 +174,33 @@ | |||
| 23 | (undo-outer-limit-function): Use undo-outer-limit-truncate. | 174 | (undo-outer-limit-function): Use undo-outer-limit-truncate. |
| 24 | 175 | ||
| 25 | 2004-12-21 Eli Barzilay <eli@barzilay.org> | 176 | 2004-12-21 Eli Barzilay <eli@barzilay.org> |
| 26 | 177 | ||
| 27 | * calculator.el: (calculator-radix-grouping-mode) | 178 | * calculator.el: (calculator-radix-grouping-mode) |
| 28 | (calculator-radix-grouping-digits) | 179 | (calculator-radix-grouping-digits) |
| 29 | (calculator-radix-grouping-separator): | 180 | (calculator-radix-grouping-separator): |
| 30 | New defcustoms for the new radix grouping mode functionality. | 181 | New defcustoms for the new radix grouping mode functionality. |
| 31 | (calculator-mode-hook): Now used in electric mode too. | 182 | (calculator-mode-hook): Now used in electric mode too, |
| 183 | (calculator): Call it. | ||
| 32 | (calculator-mode-map): Some new keys. | 184 | (calculator-mode-map): Some new keys. |
| 33 | (calculator-message): New function. Some new calls. | 185 | (calculator-message): New function. Some new calls. |
| 34 | (calculator-string-to-number): New function, | 186 | (calculator-op, calculator-set-register): Use it. |
| 187 | (calculator-string-to-number): New function, mostly moved and | ||
| 188 | updated code from calculator-curnum-value. | ||
| 35 | (calculator-curnum-value): Use it. | 189 | (calculator-curnum-value): Use it. |
| 36 | (calculator-rotate-displayer, calculator-rotate-displayer-back) | 190 | (calculator-paste): Use it, and update grabbing the |
| 37 | (calculator-displayer-prev, calculator-displayer-next): | 191 | current-kill. |
| 38 | Change digit group size when in radix mode. | 192 | (calculator-rotate-displayer) |
| 39 | (calculator-number-to-string): Renamed from calculator-num-to-string. | 193 | (calculator-rotate-displayer-back): Toggle digit grouping when |
| 40 | Now deals with digit grouping in radix mode. | 194 | in radix mode, use calculator-message. |
| 195 | (calculator-displayer-prev, calculator-displayer-next): Change | ||
| 196 | digit group size when in radix mode. | ||
| 197 | (calculator-number-to-string): Renamed from | ||
| 198 | calculator-num-to-string. Now deals with digit grouping in | ||
| 199 | radix mode. | ||
| 200 | (calculator-update-display, calculator-put-value): Use the new | ||
| 201 | name. | ||
| 202 | (calculator-fact): Return a floating point number. | ||
| 203 | (calculator-mode): Doc fix. | ||
| 41 | 204 | ||
| 42 | 2004-12-20 Glenn Morris <gmorris@ast.cam.ac.uk> | 205 | 2004-12-20 Glenn Morris <gmorris@ast.cam.ac.uk> |
| 43 | 206 | ||
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 30350d69a9a..e505f91e901 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el | |||
| @@ -220,23 +220,6 @@ This is a good function to put in `comint-output-filter-functions'." | |||
| 220 | 220 | ||
| 221 | ;; Alternative font-lock-unfontify-region-function for Emacs only | 221 | ;; Alternative font-lock-unfontify-region-function for Emacs only |
| 222 | 222 | ||
| 223 | |||
| 224 | (eval-when-compile | ||
| 225 | ;; We use this to preserve or protect things when modifying text | ||
| 226 | ;; properties. Stolen from lazy-lock and font-lock. Ugly!!! | ||
| 227 | ;; Probably most of this is not needed? | ||
| 228 | (defmacro save-buffer-state (varlist &rest body) | ||
| 229 | "Bind variables according to VARLIST and eval BODY restoring buffer state." | ||
| 230 | `(let* (,@(append varlist | ||
| 231 | '((modified (buffer-modified-p)) (buffer-undo-list t) | ||
| 232 | (inhibit-read-only t) (inhibit-point-motion-hooks t) | ||
| 233 | before-change-functions after-change-functions | ||
| 234 | deactivate-mark buffer-file-name buffer-file-truename))) | ||
| 235 | ,@body | ||
| 236 | (when (and (not modified) (buffer-modified-p)) | ||
| 237 | (set-buffer-modified-p nil)))) | ||
| 238 | (put 'save-buffer-state 'lisp-indent-function 1)) | ||
| 239 | |||
| 240 | (defun ansi-color-unfontify-region (beg end &rest xemacs-stuff) | 223 | (defun ansi-color-unfontify-region (beg end &rest xemacs-stuff) |
| 241 | "Replacement function for `font-lock-default-unfontify-region'. | 224 | "Replacement function for `font-lock-default-unfontify-region'. |
| 242 | 225 | ||
| @@ -259,21 +242,20 @@ A possible way to install this would be: | |||
| 259 | \(function (lambda () | 242 | \(function (lambda () |
| 260 | \(setq font-lock-unfontify-region-function | 243 | \(setq font-lock-unfontify-region-function |
| 261 | 'ansi-color-unfontify-region))))" | 244 | 'ansi-color-unfontify-region))))" |
| 262 | ;; save-buffer-state is a macro in font-lock.el! | 245 | ;; Simplified now that font-lock-unfontify-region uses save-buffer-state. |
| 263 | (save-buffer-state nil | 246 | (when (boundp 'font-lock-syntactic-keywords) |
| 264 | (when (boundp 'font-lock-syntactic-keywords) | 247 | (remove-text-properties beg end '(syntax-table nil))) |
| 265 | (remove-text-properties beg end '(syntax-table nil))) | 248 | ;; instead of just using (remove-text-properties beg end '(face |
| 266 | ;; instead of just using (remove-text-properties beg end '(face | 249 | ;; nil)), we find regions with a non-nil face test-property, skip |
| 267 | ;; nil)), we find regions with a non-nil face test-property, skip | 250 | ;; positions with the ansi-color property set, and remove the |
| 268 | ;; positions with the ansi-color property set, and remove the | 251 | ;; remaining face test-properties. |
| 269 | ;; remaining face test-properties. | 252 | (while (setq beg (text-property-not-all beg end 'face nil)) |
| 270 | (while (setq beg (text-property-not-all beg end 'face nil)) | 253 | (setq beg (or (text-property-not-all beg end 'ansi-color t) end)) |
| 271 | (setq beg (or (text-property-not-all beg end 'ansi-color t) end)) | 254 | (when (get-text-property beg 'face) |
| 272 | (when (get-text-property beg 'face) | 255 | (let ((end-face (or (text-property-any beg end 'face nil) |
| 273 | (let ((end-face (or (text-property-any beg end 'face nil) | 256 | end))) |
| 274 | end))) | 257 | (remove-text-properties beg end-face '(face nil)) |
| 275 | (remove-text-properties beg end-face '(face nil)) | 258 | (setq beg end-face))))) |
| 276 | (setq beg end-face)))))) | ||
| 277 | 259 | ||
| 278 | ;; Working with strings | 260 | ;; Working with strings |
| 279 | 261 | ||
diff --git a/lisp/battery.el b/lisp/battery.el index 7b172321602..b8790450735 100644 --- a/lisp/battery.el +++ b/lisp/battery.el | |||
| @@ -73,12 +73,13 @@ string are substituted as defined by the current value of the variable | |||
| 73 | 73 | ||
| 74 | (defvar battery-mode-line-string nil | 74 | (defvar battery-mode-line-string nil |
| 75 | "String to display in the mode line.") | 75 | "String to display in the mode line.") |
| 76 | ;;;###autoload (put 'battery-mode-line-string 'risky-local-variable t) | ||
| 76 | 77 | ||
| 77 | (defcustom battery-mode-line-format | 78 | (defcustom battery-mode-line-format |
| 78 | (cond ((eq battery-status-function 'battery-linux-proc-apm) | 79 | (cond ((eq battery-status-function 'battery-linux-proc-apm) |
| 79 | " [%b%p%%]") | 80 | "[%b%p%%]") |
| 80 | ((eq battery-status-function 'battery-linux-proc-acpi) | 81 | ((eq battery-status-function 'battery-linux-proc-acpi) |
| 81 | " [%b%p%%,%d°C]")) | 82 | "[%b%p%%,%d°C]")) |
| 82 | "*Control string formatting the string to display in the mode line. | 83 | "*Control string formatting the string to display in the mode line. |
| 83 | Ordinary characters in the control string are printed as-is, while | 84 | Ordinary characters in the control string are printed as-is, while |
| 84 | conversion specifications introduced by a `%' character in the control | 85 | conversion specifications introduced by a `%' character in the control |
| @@ -128,13 +129,14 @@ seconds." | |||
| 128 | 129 | ||
| 129 | (defun battery-update () | 130 | (defun battery-update () |
| 130 | "Update battery status information in the mode line." | 131 | "Update battery status information in the mode line." |
| 131 | (setq battery-mode-line-string (propertize (if (and battery-mode-line-format | 132 | (setq battery-mode-line-string |
| 132 | battery-status-function) | 133 | (propertize (if (and battery-mode-line-format |
| 133 | (battery-format | 134 | battery-status-function) |
| 134 | battery-mode-line-format | 135 | (battery-format |
| 135 | (funcall battery-status-function)) | 136 | battery-mode-line-format |
| 136 | "") | 137 | (funcall battery-status-function)) |
| 137 | 'help-echo "Battery status information")) | 138 | "") |
| 139 | 'help-echo "Battery status information")) | ||
| 138 | (force-mode-line-update)) | 140 | (force-mode-line-update)) |
| 139 | 141 | ||
| 140 | 142 | ||
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index b25c261c1e7..949434baffb 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -1049,6 +1049,8 @@ of the old one in the permanent bookmark record." | |||
| 1049 | (interactive | 1049 | (interactive |
| 1050 | (list (bookmark-completing-read "Jump to bookmark" | 1050 | (list (bookmark-completing-read "Jump to bookmark" |
| 1051 | bookmark-current-bookmark))) | 1051 | bookmark-current-bookmark))) |
| 1052 | (unless bookmark | ||
| 1053 | (error "No bookmark specified")) | ||
| 1052 | (bookmark-maybe-historicize-string bookmark) | 1054 | (bookmark-maybe-historicize-string bookmark) |
| 1053 | (let ((cell (bookmark-jump-noselect bookmark))) | 1055 | (let ((cell (bookmark-jump-noselect bookmark))) |
| 1054 | (and cell | 1056 | (and cell |
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el index 1c3fa704041..8e1a3e69295 100644 --- a/lisp/buff-menu.el +++ b/lisp/buff-menu.el | |||
| @@ -198,11 +198,15 @@ Letters do not insert themselves; instead, they are commands. | |||
| 198 | (revert-buffer)) | 198 | (revert-buffer)) |
| 199 | 199 | ||
| 200 | (defun Buffer-menu-revert-function (ignore1 ignore2) | 200 | (defun Buffer-menu-revert-function (ignore1 ignore2) |
| 201 | (or (eq buffer-undo-list t) | ||
| 202 | (setq buffer-undo-list nil)) | ||
| 201 | ;; We can not use save-excursion here. The buffer gets erased. | 203 | ;; We can not use save-excursion here. The buffer gets erased. |
| 202 | (let ((ocol (current-column)) | 204 | (let ((ocol (current-column)) |
| 203 | (oline (progn (move-to-column 4) | 205 | (oline (progn (move-to-column 4) |
| 204 | (get-text-property (point) 'buffer))) | 206 | (get-text-property (point) 'buffer))) |
| 205 | (prop (point-min))) | 207 | (prop (point-min)) |
| 208 | ;; do not make undo records for the reversion. | ||
| 209 | (buffer-undo-list t)) | ||
| 206 | (list-buffers-noselect Buffer-menu-files-only) | 210 | (list-buffers-noselect Buffer-menu-files-only) |
| 207 | (while (setq prop (next-single-property-change prop 'buffer)) | 211 | (while (setq prop (next-single-property-change prop 'buffer)) |
| 208 | (when (eq (get-text-property prop 'buffer) oline) | 212 | (when (eq (get-text-property prop 'buffer) oline) |
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 2dca53b46bb..a3c401e734e 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el | |||
| @@ -174,13 +174,17 @@ | |||
| 174 | (defun calc-read-var-name (prompt &optional calc-store-opers) | 174 | (defun calc-read-var-name (prompt &optional calc-store-opers) |
| 175 | (setq calc-given-value nil | 175 | (setq calc-given-value nil |
| 176 | calc-aborted-prefix nil) | 176 | calc-aborted-prefix nil) |
| 177 | (let ((var (let ((minibuffer-completion-table obarray) | 177 | (let ((var (concat |
| 178 | (minibuffer-completion-predicate 'boundp) | 178 | "var-" |
| 179 | (minibuffer-completion-confirm t)) | 179 | (let ((minibuffer-completion-table |
| 180 | (read-from-minibuffer prompt "var-" calc-var-name-map nil)))) | 180 | (mapcar (lambda (x) (substring x 4)) |
| 181 | (all-completions "var-" obarray))) | ||
| 182 | (minibuffer-completion-predicate | ||
| 183 | (lambda (x) (boundp (intern (concat "var-" x))))) | ||
| 184 | (minibuffer-completion-confirm t)) | ||
| 185 | (read-from-minibuffer prompt nil calc-var-name-map nil))))) | ||
| 181 | (setq calc-aborted-prefix "") | 186 | (setq calc-aborted-prefix "") |
| 182 | (and (not (equal var "")) | 187 | (and (not (equal var "var-")) |
| 183 | (not (equal var "var-")) | ||
| 184 | (if (string-match "\\`\\([-a-zA-Z0-9]+\\) *:?=" var) | 188 | (if (string-match "\\`\\([-a-zA-Z0-9]+\\) *:?=" var) |
| 185 | (if (null calc-given-value-flag) | 189 | (if (null calc-given-value-flag) |
| 186 | (error "Assignment is not allowed in this command") | 190 | (error "Assignment is not allowed in this command") |
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 6e10b596e23..a84a7aca52c 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el | |||
| @@ -352,7 +352,7 @@ That buffer should be current already." | |||
| 352 | (end (progn (skip-syntax-forward "w_") (point))) | 352 | (end (progn (skip-syntax-forward "w_") (point))) |
| 353 | (sym (intern-soft (buffer-substring-no-properties | 353 | (sym (intern-soft (buffer-substring-no-properties |
| 354 | beg end))) | 354 | beg end))) |
| 355 | (file (and sym (symbol-file sym)))) | 355 | (file (and sym (symbol-file sym 'defun)))) |
| 356 | (when file | 356 | (when file |
| 357 | (goto-char beg) | 357 | (goto-char beg) |
| 358 | ;; help-xref-button needs to operate on something matched | 358 | ;; help-xref-button needs to operate on something matched |
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 2a58c10f827..a70adb4d423 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el | |||
| @@ -242,7 +242,7 @@ in `load-path'." | |||
| 242 | (let ((library | 242 | (let ((library |
| 243 | (cond ((eq (car-safe def) 'autoload) | 243 | (cond ((eq (car-safe def) 'autoload) |
| 244 | (nth 1 def)) | 244 | (nth 1 def)) |
| 245 | ((symbol-file function))))) | 245 | ((symbol-file function 'defun))))) |
| 246 | (find-function-search-for-symbol function nil library)))) | 246 | (find-function-search-for-symbol function nil library)))) |
| 247 | 247 | ||
| 248 | (defalias 'function-at-point 'function-called-at-point) | 248 | (defalias 'function-at-point 'function-called-at-point) |
| @@ -347,8 +347,7 @@ The library where VARIABLE is defined is searched for in FILE or | |||
| 347 | `find-function-source-path', if non nil, otherwise in `load-path'." | 347 | `find-function-source-path', if non nil, otherwise in `load-path'." |
| 348 | (if (not variable) | 348 | (if (not variable) |
| 349 | (error "You didn't specify a variable")) | 349 | (error "You didn't specify a variable")) |
| 350 | ;; Fixme: I think `symbol-file' should be fixed instead. -- fx | 350 | (let ((library (or file (symbol-file variable 'defvar)))) |
| 351 | (let ((library (or file (symbol-file (cons 'defvar variable))))) | ||
| 352 | (find-function-search-for-symbol variable 'variable library))) | 351 | (find-function-search-for-symbol variable 'variable library))) |
| 353 | 352 | ||
| 354 | ;;;###autoload | 353 | ;;;###autoload |
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index 477d8b410ec..d7c65066ac6 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -1285,7 +1285,7 @@ COMMAND may result in an alias being executed, or a plain command." | |||
| 1285 | (defun eshell-find-alias-function (name) | 1285 | (defun eshell-find-alias-function (name) |
| 1286 | "Check whether a function called `eshell/NAME' exists." | 1286 | "Check whether a function called `eshell/NAME' exists." |
| 1287 | (let* ((sym (intern-soft (concat "eshell/" name))) | 1287 | (let* ((sym (intern-soft (concat "eshell/" name))) |
| 1288 | (file (symbol-file sym))) | 1288 | (file (symbol-file sym 'defun))) |
| 1289 | ;; If the function exists, but is defined in an eshell module | 1289 | ;; If the function exists, but is defined in an eshell module |
| 1290 | ;; that's not currently enabled, don't report it as found | 1290 | ;; that's not currently enabled, don't report it as found |
| 1291 | (if (and file | 1291 | (if (and file |
diff --git a/lisp/eshell/esh-test.el b/lisp/eshell/esh-test.el index 076505da14e..c1b121bbf73 100644 --- a/lisp/eshell/esh-test.el +++ b/lisp/eshell/esh-test.el | |||
| @@ -125,7 +125,7 @@ | |||
| 125 | (let ((fsym (get-text-property (point) 'test-func))) | 125 | (let ((fsym (get-text-property (point) 'test-func))) |
| 126 | (when fsym | 126 | (when fsym |
| 127 | (let* ((def (symbol-function fsym)) | 127 | (let* ((def (symbol-function fsym)) |
| 128 | (library (locate-library (symbol-file fsym))) | 128 | (library (locate-library (symbol-file fsym 'defun))) |
| 129 | (name (substring (symbol-name fsym) | 129 | (name (substring (symbol-name fsym) |
| 130 | (length "eshell-test--"))) | 130 | (length "eshell-test--"))) |
| 131 | (inhibit-redisplay t)) | 131 | (inhibit-redisplay t)) |
diff --git a/lisp/faces.el b/lisp/faces.el index a9189d5f8f6..f3d211d60fd 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1813,7 +1813,7 @@ created." | |||
| 1813 | 1813 | ||
| 1814 | 1814 | ||
| 1815 | (defface mode-line | 1815 | (defface mode-line |
| 1816 | '((((type x w32 mac) (class color)) | 1816 | '((((class color) (min-colors 88)) |
| 1817 | :box (:line-width -1 :style released-button) | 1817 | :box (:line-width -1 :style released-button) |
| 1818 | :background "grey75" :foreground "black") | 1818 | :background "grey75" :foreground "black") |
| 1819 | (t | 1819 | (t |
| @@ -1826,11 +1826,11 @@ created." | |||
| 1826 | (defface mode-line-inactive | 1826 | (defface mode-line-inactive |
| 1827 | '((default | 1827 | '((default |
| 1828 | :inherit mode-line) | 1828 | :inherit mode-line) |
| 1829 | (((type x w32 mac) (background light) (class color)) | 1829 | (((class color) (min-colors 88) (background light)) |
| 1830 | :weight light | 1830 | :weight light |
| 1831 | :box (:line-width -1 :color "grey75" :style nil) | 1831 | :box (:line-width -1 :color "grey75" :style nil) |
| 1832 | :foreground "grey20" :background "grey90") | 1832 | :foreground "grey20" :background "grey90") |
| 1833 | (((type x w32 mac) (background dark) (class color)) | 1833 | (((class color) (min-colors 88) (background dark) ) |
| 1834 | :weight light | 1834 | :weight light |
| 1835 | :box (:line-width -1 :color "grey40" :style nil) | 1835 | :box (:line-width -1 :color "grey40" :style nil) |
| 1836 | :foreground "grey80" :background "grey30")) | 1836 | :foreground "grey80" :background "grey30")) |
diff --git a/lisp/ffap.el b/lisp/ffap.el index ab9d223256f..c36ed7ff81f 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el | |||
| @@ -962,7 +962,7 @@ If t, `ffap-tex-init' will initialize this when needed.") | |||
| 962 | ;; * no commas (good for latex) | 962 | ;; * no commas (good for latex) |
| 963 | (file "--:$+<>@-Z_a-z~*?" "<@" "@>;.,!:") | 963 | (file "--:$+<>@-Z_a-z~*?" "<@" "@>;.,!:") |
| 964 | ;; An url, or maybe a email/news message-id: | 964 | ;; An url, or maybe a email/news message-id: |
| 965 | (url "--:=&?$+@-Z_a-z~#,%;" "^A-Za-z0-9" ":;.,!?") | 965 | (url "--:=&?$+@-Z_a-z~#,%;*" "^A-Za-z0-9" ":;.,!?") |
| 966 | ;; Find a string that does *not* contain a colon: | 966 | ;; Find a string that does *not* contain a colon: |
| 967 | (nocolon "--9$+<>@-Z_a-z~" "<@" "@>;.,!?") | 967 | (nocolon "--9$+<>@-Z_a-z~" "<@" "@>;.,!?") |
| 968 | ;; A machine: | 968 | ;; A machine: |
diff --git a/lisp/files.el b/lisp/files.el index 0c7a6fff51b..12f7e390f81 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -1200,7 +1200,8 @@ name to this list as a string." | |||
| 1200 | "Return the buffer visiting file FILENAME (a string). | 1200 | "Return the buffer visiting file FILENAME (a string). |
| 1201 | This is like `get-file-buffer', except that it checks for any buffer | 1201 | This is like `get-file-buffer', except that it checks for any buffer |
| 1202 | visiting the same file, possibly under a different name. | 1202 | visiting the same file, possibly under a different name. |
| 1203 | If PREDICATE is non-nil, only a buffer satisfying it can be returned. | 1203 | If PREDICATE is non-nil, only buffers satisfying it are eligible, |
| 1204 | and others are ignored. | ||
| 1204 | If there is no such live buffer, return nil." | 1205 | If there is no such live buffer, return nil." |
| 1205 | (let ((predicate (or predicate #'identity)) | 1206 | (let ((predicate (or predicate #'identity)) |
| 1206 | (truename (abbreviate-file-name (file-truename filename)))) | 1207 | (truename (abbreviate-file-name (file-truename filename)))) |
| @@ -3363,6 +3364,10 @@ This requires the external program `diff' to be in your `exec-path'." | |||
| 3363 | "ACTION-ALIST argument used in call to `map-y-or-n-p'.") | 3364 | "ACTION-ALIST argument used in call to `map-y-or-n-p'.") |
| 3364 | (put 'save-some-buffers-action-alist 'risky-local-variable t) | 3365 | (put 'save-some-buffers-action-alist 'risky-local-variable t) |
| 3365 | 3366 | ||
| 3367 | (defvar buffer-save-without-query nil | ||
| 3368 | "Non-nil means `save-some-buffers' should save this buffer without asking.") | ||
| 3369 | (make-variable-buffer-local 'buffer-save-without-query) | ||
| 3370 | |||
| 3366 | (defun save-some-buffers (&optional arg pred) | 3371 | (defun save-some-buffers (&optional arg pred) |
| 3367 | "Save some modified file-visiting buffers. Asks user about each one. | 3372 | "Save some modified file-visiting buffers. Asks user about each one. |
| 3368 | You can answer `y' to save, `n' not to save, `C-r' to look at the | 3373 | You can answer `y' to save, `n' not to save, `C-r' to look at the |
| @@ -3380,8 +3385,18 @@ See `save-some-buffers-action-alist' if you want to | |||
| 3380 | change the additional actions you can take on files." | 3385 | change the additional actions you can take on files." |
| 3381 | (interactive "P") | 3386 | (interactive "P") |
| 3382 | (save-window-excursion | 3387 | (save-window-excursion |
| 3383 | (let* ((queried nil) | 3388 | (let* (queried some-automatic |
| 3384 | (files-done | 3389 | files-done abbrevs-done) |
| 3390 | (dolist (buffer (buffer-list)) | ||
| 3391 | ;; First save any buffers that we're supposed to save unconditionally. | ||
| 3392 | ;; That way the following code won't ask about them. | ||
| 3393 | (with-current-buffer buffer | ||
| 3394 | (when (and buffer-save-without-query (buffer-modified-p)) | ||
| 3395 | (setq some-automatic t) | ||
| 3396 | (save-buffer)))) | ||
| 3397 | ;; Ask about those buffers that merit it, | ||
| 3398 | ;; and record the number thus saved. | ||
| 3399 | (setq files-done | ||
| 3385 | (map-y-or-n-p | 3400 | (map-y-or-n-p |
| 3386 | (function | 3401 | (function |
| 3387 | (lambda (buffer) | 3402 | (lambda (buffer) |
| @@ -3410,19 +3425,22 @@ change the additional actions you can take on files." | |||
| 3410 | (buffer-list) | 3425 | (buffer-list) |
| 3411 | '("buffer" "buffers" "save") | 3426 | '("buffer" "buffers" "save") |
| 3412 | save-some-buffers-action-alist)) | 3427 | save-some-buffers-action-alist)) |
| 3413 | (abbrevs-done | 3428 | ;; Maybe to save abbrevs, and record whether |
| 3414 | (and save-abbrevs abbrevs-changed | 3429 | ;; we either saved them or asked to. |
| 3415 | (progn | 3430 | (and save-abbrevs abbrevs-changed |
| 3416 | (if (or arg | 3431 | (progn |
| 3417 | (eq save-abbrevs 'silently) | 3432 | (if (or arg |
| 3418 | (y-or-n-p (format "Save abbrevs in %s? " | 3433 | (eq save-abbrevs 'silently) |
| 3419 | abbrev-file-name))) | 3434 | (y-or-n-p (format "Save abbrevs in %s? " |
| 3420 | (write-abbrev-file nil)) | 3435 | abbrev-file-name))) |
| 3421 | ;; Don't keep bothering user if he says no. | 3436 | (write-abbrev-file nil)) |
| 3422 | (setq abbrevs-changed nil) | 3437 | ;; Don't keep bothering user if he says no. |
| 3423 | t)))) | 3438 | (setq abbrevs-changed nil) |
| 3439 | (setq abbrevs-done t))) | ||
| 3424 | (or queried (> files-done 0) abbrevs-done | 3440 | (or queried (> files-done 0) abbrevs-done |
| 3425 | (message "(No files need saving)"))))) | 3441 | (message (if some-automatic |
| 3442 | "(Some special files were saved without asking)" | ||
| 3443 | "(No files need saving)")))))) | ||
| 3426 | 3444 | ||
| 3427 | (defun not-modified (&optional arg) | 3445 | (defun not-modified (&optional arg) |
| 3428 | "Mark current buffer as unmodified, not needing to be saved. | 3446 | "Mark current buffer as unmodified, not needing to be saved. |
| @@ -4309,6 +4327,8 @@ program specified by `directory-free-space-program' if that is non-nil." | |||
| 4309 | (buffer-substring (point) end))))))))) | 4327 | (buffer-substring (point) end))))))))) |
| 4310 | 4328 | ||
| 4311 | 4329 | ||
| 4330 | (defvar insert-directory-ls-version 'unknown) | ||
| 4331 | |||
| 4312 | ;; insert-directory | 4332 | ;; insert-directory |
| 4313 | ;; - must insert _exactly_one_line_ describing FILE if WILDCARD and | 4333 | ;; - must insert _exactly_one_line_ describing FILE if WILDCARD and |
| 4314 | ;; FULL-DIRECTORY-P is nil. | 4334 | ;; FULL-DIRECTORY-P is nil. |
| @@ -4418,6 +4438,56 @@ normally equivalent short `-D' option is just passed on to | |||
| 4418 | (concat (file-name-as-directory file) ".") | 4438 | (concat (file-name-as-directory file) ".") |
| 4419 | file)))))))) | 4439 | file)))))))) |
| 4420 | 4440 | ||
| 4441 | ;; If we got "//DIRED//" in the output, it means we got a real | ||
| 4442 | ;; directory listing, even if `ls' returned nonzero. | ||
| 4443 | ;; So ignore any errors. | ||
| 4444 | (when (if (stringp switches) | ||
| 4445 | (string-match "--dired\\>" switches) | ||
| 4446 | (member "--dired" switches)) | ||
| 4447 | (save-excursion | ||
| 4448 | (forward-line -2) | ||
| 4449 | (when (looking-at "//SUBDIRED//") | ||
| 4450 | (forward-line -1)) | ||
| 4451 | (if (looking-at "//DIRED//") | ||
| 4452 | (setq result 0)))) | ||
| 4453 | |||
| 4454 | (when (and (not (eq 0 result)) | ||
| 4455 | (eq insert-directory-ls-version 'unknown)) | ||
| 4456 | ;; The first time ls returns an error, | ||
| 4457 | ;; find the version numbers of ls, | ||
| 4458 | ;; and set insert-directory-ls-version | ||
| 4459 | ;; to > if it is more than 5.2.1, < if it is less, nil if it | ||
| 4460 | ;; is equal or if the info cannot be obtained. | ||
| 4461 | ;; (That can mean it isn't GNU ls.) | ||
| 4462 | (let ((version-out | ||
| 4463 | (with-temp-buffer | ||
| 4464 | (call-process "ls" nil t nil "--version") | ||
| 4465 | (buffer-string)))) | ||
| 4466 | (if (string-match "ls (.*utils) \\([0-9.]*\\)$" version-out) | ||
| 4467 | (let* ((version (match-string 1 version-out)) | ||
| 4468 | (split (split-string version "[.]")) | ||
| 4469 | (numbers (mapcar 'string-to-int split)) | ||
| 4470 | (min '(5 2 1)) | ||
| 4471 | comparison) | ||
| 4472 | (while (and (not comparison) (or numbers min)) | ||
| 4473 | (cond ((null min) | ||
| 4474 | (setq comparison '>)) | ||
| 4475 | ((null numbers) | ||
| 4476 | (setq comparison '<)) | ||
| 4477 | ((> (car numbers) (car min)) | ||
| 4478 | (setq comparison '>)) | ||
| 4479 | ((< (car numbers) (car min)) | ||
| 4480 | (setq comparison '<)) | ||
| 4481 | (t | ||
| 4482 | (setq numbers (cdr numbers) | ||
| 4483 | min (cdr min))))) | ||
| 4484 | (setq insert-directory-ls-version (or comparison '=))) | ||
| 4485 | (setq insert-directory-ls-version nil)))) | ||
| 4486 | |||
| 4487 | ;; For GNU ls versions 5.2.2 and up, ignore minor errors. | ||
| 4488 | (when (and (eq 1 result) (eq insert-directory-ls-version '>)) | ||
| 4489 | (setq result 0)) | ||
| 4490 | |||
| 4421 | ;; If `insert-directory-program' failed, signal an error. | 4491 | ;; If `insert-directory-program' failed, signal an error. |
| 4422 | (unless (eq 0 result) | 4492 | (unless (eq 0 result) |
| 4423 | ;; Delete the error message it may have output. | 4493 | ;; Delete the error message it may have output. |
| @@ -4444,23 +4514,39 @@ normally equivalent short `-D' option is just passed on to | |||
| 4444 | (when (looking-at "//SUBDIRED//") | 4514 | (when (looking-at "//SUBDIRED//") |
| 4445 | (delete-region (point) (progn (forward-line 1) (point))) | 4515 | (delete-region (point) (progn (forward-line 1) (point))) |
| 4446 | (forward-line -1)) | 4516 | (forward-line -1)) |
| 4447 | (if (looking-at "//DIRED//") | 4517 | (when (looking-at "//DIRED//") |
| 4448 | (let ((end (line-end-position))) | 4518 | (let ((end (line-end-position)) |
| 4449 | (forward-word 1) | 4519 | (linebeg (point)) |
| 4450 | (forward-char 3) | 4520 | error-lines) |
| 4451 | (while (< (point) end) | 4521 | ;; Find all the lines that are error messages, |
| 4452 | (let ((start (+ beg (read (current-buffer)))) | 4522 | ;; and record the bounds of each one. |
| 4453 | (end (+ beg (read (current-buffer))))) | 4523 | (goto-char (point-min)) |
| 4454 | (if (memq (char-after end) '(?\n ?\ )) | 4524 | (while (< (point) linebeg) |
| 4455 | ;; End is followed by \n or by " -> ". | 4525 | (or (eql (following-char) ?\s) |
| 4456 | (put-text-property start end 'dired-filename t) | 4526 | (push (list (point) (line-end-position)) error-lines)) |
| 4457 | ;; It seems that we can't trust ls's output as to | 4527 | (forward-line 1)) |
| 4458 | ;; byte positions of filenames. | 4528 | (setq error-lines (nreverse error-lines)) |
| 4459 | (put-text-property beg (point) 'dired-filename nil) | 4529 | ;; Now read the numeric positions of file names. |
| 4460 | (end-of-line)))) | 4530 | (goto-char linebeg) |
| 4461 | (goto-char end) | 4531 | (forward-word 1) |
| 4462 | (beginning-of-line) | 4532 | (forward-char 3) |
| 4463 | (delete-region (point) (progn (forward-line 2) (point)))) | 4533 | (while (< (point) end) |
| 4534 | (let ((start (insert-directory-adj-pos | ||
| 4535 | (+ beg (read (current-buffer))) | ||
| 4536 | error-lines)) | ||
| 4537 | (end (insert-directory-adj-pos | ||
| 4538 | (+ beg (read (current-buffer))) | ||
| 4539 | error-lines))) | ||
| 4540 | (if (memq (char-after end) '(?\n ?\ )) | ||
| 4541 | ;; End is followed by \n or by " -> ". | ||
| 4542 | (put-text-property start end 'dired-filename t) | ||
| 4543 | ;; It seems that we can't trust ls's output as to | ||
| 4544 | ;; byte positions of filenames. | ||
| 4545 | (put-text-property beg (point) 'dired-filename nil) | ||
| 4546 | (end-of-line)))) | ||
| 4547 | (goto-char end) | ||
| 4548 | (beginning-of-line) | ||
| 4549 | (delete-region (point) (progn (forward-line 2) (point)))) | ||
| 4464 | (forward-line 1) | 4550 | (forward-line 1) |
| 4465 | (if (looking-at "//DIRED-OPTIONS//") | 4551 | (if (looking-at "//DIRED-OPTIONS//") |
| 4466 | (delete-region (point) (progn (forward-line 1) (point))) | 4552 | (delete-region (point) (progn (forward-line 1) (point))) |
| @@ -4512,6 +4598,18 @@ normally equivalent short `-D' option is just passed on to | |||
| 4512 | (end-of-line) | 4598 | (end-of-line) |
| 4513 | (insert " available " available))))))))))) | 4599 | (insert " available " available))))))))))) |
| 4514 | 4600 | ||
| 4601 | (defun insert-directory-adj-pos (pos error-lines) | ||
| 4602 | "Convert `ls --dired' file name position value POS to a buffer position. | ||
| 4603 | File name position values returned in ls --dired output | ||
| 4604 | count only stdout; they don't count the error messages sent to stderr. | ||
| 4605 | So this function converts to them to real buffer positions. | ||
| 4606 | ERROR-LINES is a list of buffer positions of error message lines, | ||
| 4607 | of the form (START END)." | ||
| 4608 | (while (and error-lines (< (caar error-lines) pos)) | ||
| 4609 | (setq pos (+ pos (- (nth 1 (car error-lines)) (nth 0 (car error-lines))))) | ||
| 4610 | (pop error-lines)) | ||
| 4611 | pos) | ||
| 4612 | |||
| 4515 | (defun insert-directory-safely (file switches | 4613 | (defun insert-directory-safely (file switches |
| 4516 | &optional wildcard full-directory-p) | 4614 | &optional wildcard full-directory-p) |
| 4517 | "Insert directory listing for FILE, formatted according to SWITCHES. | 4615 | "Insert directory listing for FILE, formatted according to SWITCHES. |
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index bb7b8337f4c..fd541fed5aa 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -4,6 +4,35 @@ | |||
| 4 | 4 | ||
| 5 | * gnus-sum.el (gnus-summary-mode-map): Likewise. | 5 | * gnus-sum.el (gnus-summary-mode-map): Likewise. |
| 6 | 6 | ||
| 7 | 2004-12-22 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 8 | |||
| 9 | * gnus-spec.el (gnus-spec-tab): Make a Lisp form which works | ||
| 10 | correctly even if there are wide characters. | ||
| 11 | |||
| 12 | 2004-12-21 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 13 | |||
| 14 | * rfc2231.el (rfc2231-parse-string): Decode encoded value after | ||
| 15 | concatenating segments rather than before concatenating them. | ||
| 16 | Suggested by ARISAWA Akihiro <ari@mbf.ocn.ne.jp>. | ||
| 17 | |||
| 18 | 2004-12-17 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 19 | |||
| 20 | * mm-util.el (mm-xemacs-find-mime-charset): New macro. | ||
| 21 | |||
| 22 | 2004-12-17 Aidan Kehoe <kehoea@parhasard.net> | ||
| 23 | |||
| 24 | * mm-util.el (mm-xemacs-find-mime-charset-1): New function used to | ||
| 25 | unify Latin characters in XEmacs. | ||
| 26 | (mm-find-mime-charset-region): Use it. | ||
| 27 | |||
| 28 | 2004-12-17 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 29 | |||
| 30 | * gnus-util.el (gnus-delete-directory): New function. | ||
| 31 | |||
| 32 | * gnus-agent.el (gnus-agent-delete-group): Use it. | ||
| 33 | |||
| 34 | * gnus-cache.el (gnus-cache-delete-group): Use it. | ||
| 35 | |||
| 7 | 2004-12-08 Stefan Monnier <monnier@iro.umontreal.ca> | 36 | 2004-12-08 Stefan Monnier <monnier@iro.umontreal.ca> |
| 8 | 37 | ||
| 9 | * gnus-art.el (gnus-narrow-to-page): Don't hardcode point-min. | 38 | * gnus-art.el (gnus-narrow-to-page): Don't hardcode point-min. |
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 23fcbbde5df..aca9e4ec218 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el | |||
| @@ -891,7 +891,7 @@ next enabled. Depends upon the caller to determine whether group deletion is sup | |||
| 891 | (path (directory-file-name | 891 | (path (directory-file-name |
| 892 | (let (gnus-command-method command-method) | 892 | (let (gnus-command-method command-method) |
| 893 | (gnus-agent-group-pathname group))))) | 893 | (gnus-agent-group-pathname group))))) |
| 894 | (gnus-delete-file path) | 894 | (gnus-delete-directory path) |
| 895 | 895 | ||
| 896 | (let* ((real-group (gnus-group-real-name group))) | 896 | (let* ((real-group (gnus-group-real-name group))) |
| 897 | (gnus-agent-save-group-info command-method real-group nil) | 897 | (gnus-agent-save-group-info command-method real-group nil) |
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el index f0a5aa318fd..8f2b491f5a4 100644 --- a/lisp/gnus/gnus-cache.el +++ b/lisp/gnus/gnus-cache.el | |||
| @@ -754,7 +754,7 @@ next enabled. Depends upon the caller to determine whether group renaming is sup | |||
| 754 | disabled, as the old cache files would corrupt gnus when the cache was | 754 | disabled, as the old cache files would corrupt gnus when the cache was |
| 755 | next enabled. Depends upon the caller to determine whether group deletion is supported." | 755 | next enabled. Depends upon the caller to determine whether group deletion is supported." |
| 756 | (let ((dir (gnus-cache-file-name group ""))) | 756 | (let ((dir (gnus-cache-file-name group ""))) |
| 757 | (gnus-delete-file dir)) | 757 | (gnus-delete-directory dir)) |
| 758 | 758 | ||
| 759 | (let ((no-save gnus-cache-active-hashtb)) | 759 | (let ((no-save gnus-cache-active-hashtb)) |
| 760 | (unless gnus-cache-active-hashtb | 760 | (unless gnus-cache-active-hashtb |
diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el index 1177df4731a..9eeedf40cae 100644 --- a/lisp/gnus/gnus-spec.el +++ b/lisp/gnus/gnus-spec.el | |||
| @@ -275,21 +275,15 @@ Return a list of updated types." | |||
| 275 | 275 | ||
| 276 | (defun gnus-spec-tab (column) | 276 | (defun gnus-spec-tab (column) |
| 277 | (if (> column 0) | 277 | (if (> column 0) |
| 278 | `(insert (make-string (max (- ,column (current-column)) 0) ? )) | 278 | `(insert-char ? (max (- ,column (current-column)) 0)) |
| 279 | (let ((column (abs column))) | 279 | (let ((column (abs column))) |
| 280 | (if gnus-use-correct-string-widths | 280 | `(if (> (current-column) ,column) |
| 281 | `(progn | 281 | (let ((end (point))) |
| 282 | (if (> (current-column) ,column) | 282 | (if (= (move-to-column ,column) ,column) |
| 283 | (while (progn | 283 | (delete-region (point) end) |
| 284 | (delete-backward-char 1) | 284 | (delete-region (1- (point)) end) |
| 285 | (> (current-column) ,column)))) | 285 | (insert " "))) |
| 286 | (insert (make-string (max (- ,column (current-column)) 0) ? ))) | 286 | (insert-char ? (max (- ,column (current-column)) 0)))))) |
| 287 | `(progn | ||
| 288 | (if (> (current-column) ,column) | ||
| 289 | (delete-region (point) | ||
| 290 | (- (point) (- (current-column) ,column))) | ||
| 291 | (insert (make-string (max (- ,column (current-column)) 0) | ||
| 292 | ? )))))))) | ||
| 293 | 287 | ||
| 294 | (defun gnus-correct-length (string) | 288 | (defun gnus-correct-length (string) |
| 295 | "Return the correct width of STRING." | 289 | "Return the correct width of STRING." |
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index d9952fd8cdc..91e087f05d5 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el | |||
| @@ -708,6 +708,23 @@ Bind `print-quoted' and `print-readably' to t, and `print-length' and | |||
| 708 | (when (file-exists-p file) | 708 | (when (file-exists-p file) |
| 709 | (delete-file file))) | 709 | (delete-file file))) |
| 710 | 710 | ||
| 711 | (defun gnus-delete-directory (directory) | ||
| 712 | "Delete files in DIRECTORY. Subdirectories remain. | ||
| 713 | If there's no subdirectory, delete DIRECTORY as well." | ||
| 714 | (when (file-directory-p directory) | ||
| 715 | (let ((files (directory-files | ||
| 716 | directory t "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")) | ||
| 717 | file dir) | ||
| 718 | (while files | ||
| 719 | (setq file (pop files)) | ||
| 720 | (if (eq t (car (file-attributes file))) | ||
| 721 | ;; `file' is a subdirectory. | ||
| 722 | (setq dir t) | ||
| 723 | ;; `file' is a file or a symlink. | ||
| 724 | (delete-file file))) | ||
| 725 | (unless dir | ||
| 726 | (delete-directory directory))))) | ||
| 727 | |||
| 711 | (defun gnus-strip-whitespace (string) | 728 | (defun gnus-strip-whitespace (string) |
| 712 | "Return STRING stripped of all whitespace." | 729 | "Return STRING stripped of all whitespace." |
| 713 | (while (string-match "[\r\n\t ]+" string) | 730 | (while (string-match "[\r\n\t ]+" string) |
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el index 382133a027e..c0ccaa316ba 100644 --- a/lisp/gnus/mm-util.el +++ b/lisp/gnus/mm-util.el | |||
| @@ -576,6 +576,83 @@ This affects whether coding conversion should be attempted generally." | |||
| 576 | (length (memq (coding-system-base b) priorities))) | 576 | (length (memq (coding-system-base b) priorities))) |
| 577 | t)))) | 577 | t)))) |
| 578 | 578 | ||
| 579 | (eval-when-compile | ||
| 580 | (autoload 'latin-unity-massage-name "latin-unity") | ||
| 581 | (autoload 'latin-unity-maybe-remap "latin-unity") | ||
| 582 | (autoload 'latin-unity-representations-feasible-region "latin-unity") | ||
| 583 | (autoload 'latin-unity-representations-present-region "latin-unity") | ||
| 584 | (defvar latin-unity-coding-systems) | ||
| 585 | (defvar latin-unity-ucs-list)) | ||
| 586 | |||
| 587 | (defun mm-xemacs-find-mime-charset-1 (begin end) | ||
| 588 | "Determine which MIME charset to use to send region as message. | ||
| 589 | This uses the XEmacs-specific latin-unity package to better handle the | ||
| 590 | case where identical characters from diverse ISO-8859-? character sets | ||
| 591 | can be encoded using a single one of the corresponding coding systems. | ||
| 592 | |||
| 593 | It treats `mm-coding-system-priorities' as the list of preferred | ||
| 594 | coding systems; a useful example setting for this list in Western | ||
| 595 | Europe would be '(iso-8859-1 iso-8859-15 utf-8), which would default | ||
| 596 | to the very standard Latin 1 coding system, and only move to coding | ||
| 597 | systems that are less supported as is necessary to encode the | ||
| 598 | characters that exist in the buffer. | ||
| 599 | |||
| 600 | Latin Unity doesn't know about those non-ASCII Roman characters that | ||
| 601 | are available in various East Asian character sets. As such, its | ||
| 602 | behavior if you have a JIS 0212 LATIN SMALL LETTER A WITH ACUTE in a | ||
| 603 | buffer and it can otherwise be encoded as Latin 1, won't be ideal. | ||
| 604 | But this is very much a corner case, so don't worry about it." | ||
| 605 | (let ((systems mm-coding-system-priorities) csets psets curset) | ||
| 606 | |||
| 607 | ;; Load the Latin Unity library, if available. | ||
| 608 | (when (and (not (featurep 'latin-unity)) (locate-library "latin-unity")) | ||
| 609 | (require 'latin-unity)) | ||
| 610 | |||
| 611 | ;; Now, can we use it? | ||
| 612 | (if (featurep 'latin-unity) | ||
| 613 | (progn | ||
| 614 | (setq csets (latin-unity-representations-feasible-region begin end) | ||
| 615 | psets (latin-unity-representations-present-region begin end)) | ||
| 616 | |||
| 617 | (catch 'done | ||
| 618 | |||
| 619 | ;; Pass back the first coding system in the preferred list | ||
| 620 | ;; that can encode the whole region. | ||
| 621 | (dolist (curset systems) | ||
| 622 | (setq curset (latin-unity-massage-name 'buffer-default curset)) | ||
| 623 | |||
| 624 | ;; If the coding system is a universal coding system, then | ||
| 625 | ;; it can certainly encode all the characters in the region. | ||
| 626 | (if (memq curset latin-unity-ucs-list) | ||
| 627 | (throw 'done (list curset))) | ||
| 628 | |||
| 629 | ;; If a coding system isn't universal, and isn't in | ||
| 630 | ;; the list that latin unity knows about, we can't | ||
| 631 | ;; decide whether to use it here. Leave that until later | ||
| 632 | ;; in `mm-find-mime-charset-region' function, whence we | ||
| 633 | ;; have been called. | ||
| 634 | (unless (memq curset latin-unity-coding-systems) | ||
| 635 | (throw 'done nil)) | ||
| 636 | |||
| 637 | ;; Right, we know about this coding system, and it may | ||
| 638 | ;; conceivably be able to encode all the characters in | ||
| 639 | ;; the region. | ||
| 640 | (if (latin-unity-maybe-remap begin end curset csets psets t) | ||
| 641 | (throw 'done (list curset)))) | ||
| 642 | |||
| 643 | ;; Can't encode using anything from the | ||
| 644 | ;; `mm-coding-system-priorities' list. | ||
| 645 | ;; Leave `mm-find-mime-charset' to do most of the work. | ||
| 646 | nil)) | ||
| 647 | |||
| 648 | ;; Right, latin unity isn't available; let `mm-find-charset-region' | ||
| 649 | ;; take its default action, which equally applies to GNU Emacs. | ||
| 650 | nil))) | ||
| 651 | |||
| 652 | (defmacro mm-xemacs-find-mime-charset (begin end) | ||
| 653 | (when (featurep 'xemacs) | ||
| 654 | `(mm-xemacs-find-mime-charset-1 ,begin ,end))) | ||
| 655 | |||
| 579 | (defun mm-find-mime-charset-region (b e &optional hack-charsets) | 656 | (defun mm-find-mime-charset-region (b e &optional hack-charsets) |
| 580 | "Return the MIME charsets needed to encode the region between B and E. | 657 | "Return the MIME charsets needed to encode the region between B and E. |
| 581 | nil means ASCII, a single-element list represents an appropriate MIME | 658 | nil means ASCII, a single-element list represents an appropriate MIME |
| @@ -617,8 +694,12 @@ charset, and a longer list means no appropriate charset." | |||
| 617 | (setq systems nil | 694 | (setq systems nil |
| 618 | charsets (list cs)))))) | 695 | charsets (list cs)))))) |
| 619 | charsets)) | 696 | charsets)) |
| 620 | ;; Otherwise we're not multibyte, we're XEmacs, or a single | 697 | ;; If we're XEmacs, and some coding system is appropriate, |
| 621 | ;; coding system won't cover it. | 698 | ;; mm-xemacs-find-mime-charset will return an appropriate list. |
| 699 | ;; Otherwise, we'll get nil, and the next setq will get invoked. | ||
| 700 | (setq charsets (mm-xemacs-find-mime-charset b e)) | ||
| 701 | |||
| 702 | ;; We're not multibyte, or a single coding system won't cover it. | ||
| 622 | (setq charsets | 703 | (setq charsets |
| 623 | (mm-delete-duplicates | 704 | (mm-delete-duplicates |
| 624 | (mapcar 'mm-mime-charset | 705 | (mapcar 'mm-mime-charset |
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el index b08fe215196..8a20e19e8ad 100644 --- a/lisp/gnus/rfc2231.el +++ b/lisp/gnus/rfc2231.el | |||
| @@ -88,7 +88,6 @@ The list will be on the form | |||
| 88 | (point) (progn (forward-sexp 1) (point)))))) | 88 | (point) (progn (forward-sexp 1) (point)))))) |
| 89 | (error "Invalid header: %s" string)) | 89 | (error "Invalid header: %s" string)) |
| 90 | (setq c (char-after)) | 90 | (setq c (char-after)) |
| 91 | (setq encoded nil) | ||
| 92 | (when (eq c ?*) | 91 | (when (eq c ?*) |
| 93 | (forward-char 1) | 92 | (forward-char 1) |
| 94 | (setq c (char-after)) | 93 | (setq c (char-after)) |
| @@ -126,16 +125,22 @@ The list will be on the form | |||
| 126 | (point) (progn (forward-sexp) (point))))) | 125 | (point) (progn (forward-sexp) (point))))) |
| 127 | (t | 126 | (t |
| 128 | (error "Invalid header: %s" string))) | 127 | (error "Invalid header: %s" string))) |
| 129 | (when encoded | ||
| 130 | (setq value (rfc2231-decode-encoded-string value))) | ||
| 131 | (if number | 128 | (if number |
| 132 | (setq prev-attribute attribute | 129 | (setq prev-attribute attribute |
| 133 | prev-value (concat prev-value value)) | 130 | prev-value (concat prev-value value)) |
| 134 | (push (cons attribute value) parameters)))) | 131 | (push (cons attribute |
| 132 | (if encoded | ||
| 133 | (rfc2231-decode-encoded-string value) | ||
| 134 | value)) | ||
| 135 | parameters)))) | ||
| 135 | 136 | ||
| 136 | ;; Take care of any final continuations. | 137 | ;; Take care of any final continuations. |
| 137 | (when prev-attribute | 138 | (when prev-attribute |
| 138 | (push (cons prev-attribute prev-value) parameters)) | 139 | (push (cons prev-attribute |
| 140 | (if encoded | ||
| 141 | (rfc2231-decode-encoded-string prev-value) | ||
| 142 | prev-value)) | ||
| 143 | parameters)) | ||
| 139 | 144 | ||
| 140 | (when type | 145 | (when type |
| 141 | `(,type ,@(nreverse parameters))))))) | 146 | `(,type ,@(nreverse parameters))))))) |
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index f799fbd9be7..522c1e2c19d 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el | |||
| @@ -355,7 +355,7 @@ face (according to `face-differs-from-default-p')." | |||
| 355 | (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) | 355 | (if (re-search-backward "alias for `\\([^`']+\\)'" nil t) |
| 356 | (help-xref-button 1 'help-function def))))) | 356 | (help-xref-button 1 'help-function def))))) |
| 357 | (or file-name | 357 | (or file-name |
| 358 | (setq file-name (symbol-file function))) | 358 | (setq file-name (symbol-file function 'defun))) |
| 359 | (when (equal file-name "loaddefs.el") | 359 | (when (equal file-name "loaddefs.el") |
| 360 | ;; Find the real def site of the preloaded function. | 360 | ;; Find the real def site of the preloaded function. |
| 361 | ;; This is necessary only for defaliases. | 361 | ;; This is necessary only for defaliases. |
| @@ -614,7 +614,7 @@ it is displayed along with the global value." | |||
| 614 | ;; Make a hyperlink to the library if appropriate. (Don't | 614 | ;; Make a hyperlink to the library if appropriate. (Don't |
| 615 | ;; change the format of the buffer's initial line in case | 615 | ;; change the format of the buffer's initial line in case |
| 616 | ;; anything expects the current format.) | 616 | ;; anything expects the current format.) |
| 617 | (let ((file-name (symbol-file (cons 'defvar variable)))) | 617 | (let ((file-name (symbol-file variable 'defvar))) |
| 618 | (when (equal file-name "loaddefs.el") | 618 | (when (equal file-name "loaddefs.el") |
| 619 | ;; Find the real def site of the preloaded variable. | 619 | ;; Find the real def site of the preloaded variable. |
| 620 | (let ((location | 620 | (let ((location |
diff --git a/lisp/hexl.el b/lisp/hexl.el index f5b83c0afde..af996940f86 100644 --- a/lisp/hexl.el +++ b/lisp/hexl.el | |||
| @@ -111,11 +111,19 @@ Quoting cannot be used, so the arguments cannot themselves contain spaces." | |||
| 111 | (defvar hexl-mode-old-isearch-search-fun-function) | 111 | (defvar hexl-mode-old-isearch-search-fun-function) |
| 112 | (defvar hexl-mode-old-require-final-newline) | 112 | (defvar hexl-mode-old-require-final-newline) |
| 113 | (defvar hexl-mode-old-syntax-table) | 113 | (defvar hexl-mode-old-syntax-table) |
| 114 | (defvar hexl-mode-old-font-lock-keywords) | ||
| 114 | 115 | ||
| 115 | (defvar hexl-ascii-overlay nil | 116 | (defvar hexl-ascii-overlay nil |
| 116 | "Overlay used to highlight ASCII element corresponding to current point.") | 117 | "Overlay used to highlight ASCII element corresponding to current point.") |
| 117 | (make-variable-buffer-local 'hexl-ascii-overlay) | 118 | (make-variable-buffer-local 'hexl-ascii-overlay) |
| 118 | 119 | ||
| 120 | (defvar hexl-font-lock-keywords | ||
| 121 | '(("^\\([0-9a-f]+:\\).\\{40\\} \\(.+$\\)" | ||
| 122 | ;; "^\\([0-9a-f]+:\\).+ \\(.+$\\)" | ||
| 123 | (1 'hexl-address-area t t) | ||
| 124 | (2 'hexl-ascii-area t t))) | ||
| 125 | "Font lock keywords used in `hexl-mode'.") | ||
| 126 | |||
| 119 | ;; routines | 127 | ;; routines |
| 120 | 128 | ||
| 121 | (put 'hexl-mode 'mode-class 'special) | 129 | (put 'hexl-mode 'mode-class 'special) |
| @@ -265,6 +273,11 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode. | |||
| 265 | (make-local-variable 'require-final-newline) | 273 | (make-local-variable 'require-final-newline) |
| 266 | (setq require-final-newline nil) | 274 | (setq require-final-newline nil) |
| 267 | 275 | ||
| 276 | (make-local-variable 'hexl-mode-old-font-lock-keywords) | ||
| 277 | (setq hexl-mode-old-font-lock-keywords font-lock-defaults) | ||
| 278 | (make-local-variable 'font-lock-defaults) | ||
| 279 | (setq font-lock-defaults '(hexl-font-lock-keywords t)) | ||
| 280 | |||
| 268 | ;; Add hooks to rehexlify or dehexlify on various events. | 281 | ;; Add hooks to rehexlify or dehexlify on various events. |
| 269 | (add-hook 'after-revert-hook 'hexl-after-revert-hook nil t) | 282 | (add-hook 'after-revert-hook 'hexl-after-revert-hook nil t) |
| 270 | 283 | ||
| @@ -376,6 +389,7 @@ With arg, don't unhexlify buffer." | |||
| 376 | (setq isearch-search-fun-function hexl-mode-old-isearch-search-fun-function) | 389 | (setq isearch-search-fun-function hexl-mode-old-isearch-search-fun-function) |
| 377 | (use-local-map hexl-mode-old-local-map) | 390 | (use-local-map hexl-mode-old-local-map) |
| 378 | (set-syntax-table hexl-mode-old-syntax-table) | 391 | (set-syntax-table hexl-mode-old-syntax-table) |
| 392 | (setq font-lock-defaults hexl-mode-old-font-lock-keywords) | ||
| 379 | (setq major-mode hexl-mode-old-major-mode) | 393 | (setq major-mode hexl-mode-old-major-mode) |
| 380 | (force-mode-line-update)) | 394 | (force-mode-line-update)) |
| 381 | 395 | ||
| @@ -684,15 +698,6 @@ This discards the buffer's undo information." | |||
| 684 | (apply 'call-process-region (point-min) (point-max) | 698 | (apply 'call-process-region (point-min) (point-max) |
| 685 | (expand-file-name hexl-program exec-directory) | 699 | (expand-file-name hexl-program exec-directory) |
| 686 | t t nil (split-string hexl-options)) | 700 | t t nil (split-string hexl-options)) |
| 687 | (save-excursion | ||
| 688 | (goto-char (point-min)) | ||
| 689 | (while (re-search-forward "^[0-9a-f]+:" nil t) | ||
| 690 | (put-text-property (match-beginning 0) (match-end 0) | ||
| 691 | 'font-lock-face 'hexl-address-area)) | ||
| 692 | (goto-char (point-min)) | ||
| 693 | (while (re-search-forward " \\(.+$\\)" nil t) | ||
| 694 | (put-text-property (match-beginning 1) (match-end 1) | ||
| 695 | 'font-lock-face 'hexl-ascii-area))) | ||
| 696 | (if (> (point) (hexl-address-to-marker hexl-max-address)) | 701 | (if (> (point) (hexl-address-to-marker hexl-max-address)) |
| 697 | (hexl-goto-address hexl-max-address)))) | 702 | (hexl-goto-address hexl-max-address)))) |
| 698 | 703 | ||
diff --git a/lisp/international/mule.el b/lisp/international/mule.el index bec20a66df5..144bd0360ca 100644 --- a/lisp/international/mule.el +++ b/lisp/international/mule.el | |||
| @@ -1878,13 +1878,27 @@ or a function symbol which, when called, returns such a cons cell." | |||
| 1878 | (defun decode-coding-inserted-region (from to filename | 1878 | (defun decode-coding-inserted-region (from to filename |
| 1879 | &optional visit beg end replace) | 1879 | &optional visit beg end replace) |
| 1880 | "Decode the region between FROM and TO as if it is read from file FILENAME. | 1880 | "Decode the region between FROM and TO as if it is read from file FILENAME. |
| 1881 | The idea is that the text between FROM and TO was just inserted somehow. | ||
| 1881 | Optional arguments VISIT, BEG, END, and REPLACE are the same as those | 1882 | Optional arguments VISIT, BEG, END, and REPLACE are the same as those |
| 1882 | of the function `insert-file-contents'." | 1883 | of the function `insert-file-contents'. |
| 1884 | Part of the job of this function is setting `buffer-undo-list' appropriately." | ||
| 1883 | (save-excursion | 1885 | (save-excursion |
| 1884 | (save-restriction | 1886 | (save-restriction |
| 1885 | (narrow-to-region from to) | 1887 | (let ((coding coding-system-for-read) |
| 1886 | (goto-char (point-min)) | 1888 | undo-list-saved) |
| 1887 | (let ((coding coding-system-for-read)) | 1889 | (if visit |
| 1890 | ;; Temporarily turn off undo recording, if we're decoding the | ||
| 1891 | ;; text of a visited file. | ||
| 1892 | (setq buffer-undo-list t) | ||
| 1893 | ;; Otherwise, if we can recognize the undo elt for the insertion, | ||
| 1894 | ;; remove it and get ready to replace it later. | ||
| 1895 | ;; In the mean time, turn off undo recording. | ||
| 1896 | (let ((last (car buffer-undo-list))) | ||
| 1897 | (if (and (consp last) (eql (car last) from) (eql (cdr last) to)) | ||
| 1898 | (setq undo-list-saved (cdr buffer-undo-list) | ||
| 1899 | buffer-undo-list t)))) | ||
| 1900 | (narrow-to-region from to) | ||
| 1901 | (goto-char (point-min)) | ||
| 1888 | (or coding | 1902 | (or coding |
| 1889 | (setq coding (funcall set-auto-coding-function | 1903 | (setq coding (funcall set-auto-coding-function |
| 1890 | filename (- (point-max) (point-min))))) | 1904 | filename (- (point-max) (point-min))))) |
| @@ -1899,7 +1913,16 @@ of the function `insert-file-contents'." | |||
| 1899 | (setq coding nil)) | 1913 | (setq coding nil)) |
| 1900 | (if coding | 1914 | (if coding |
| 1901 | (decode-coding-region (point-min) (point-max) coding) | 1915 | (decode-coding-region (point-min) (point-max) coding) |
| 1902 | (setq last-coding-system-used coding)))))) | 1916 | (setq last-coding-system-used coding)) |
| 1917 | ;; If we're decoding the text of a visited file, | ||
| 1918 | ;; the undo list should start out empty. | ||
| 1919 | (if visit | ||
| 1920 | (setq buffer-undo-list nil) | ||
| 1921 | ;; If we decided to replace the undo entry for the insertion, | ||
| 1922 | ;; do so now. | ||
| 1923 | (if undo-list-saved | ||
| 1924 | (setq buffer-undo-list | ||
| 1925 | (cons (cons from (point-max)) undo-list-saved)))))))) | ||
| 1903 | 1926 | ||
| 1904 | (defun make-translation-table (&rest args) | 1927 | (defun make-translation-table (&rest args) |
| 1905 | "Make a translation table from arguments. | 1928 | "Make a translation table from arguments. |
diff --git a/lisp/international/utf-8.el b/lisp/international/utf-8.el index ed658eb3ddf..2fa096300d2 100644 --- a/lisp/international/utf-8.el +++ b/lisp/international/utf-8.el | |||
| @@ -305,26 +305,30 @@ use either \\[customize] or the function | |||
| 305 | ;; Load the files explicitly, to avoid having to keep | 305 | ;; Load the files explicitly, to avoid having to keep |
| 306 | ;; around the large tables they contain (as well as the | 306 | ;; around the large tables they contain (as well as the |
| 307 | ;; ones which get built). | 307 | ;; ones which get built). |
| 308 | (cond ((string= "Korean" current-language-environment) | 308 | ;; Here we bind coding-system-for-read to nil so that coding tags |
| 309 | (load "subst-jis") | 309 | ;; in the files are respected even if the files are not yet |
| 310 | (load "subst-big5") | 310 | ;; byte-compiled |
| 311 | (load "subst-gb2312") | 311 | (let ((coding-system-for-read nil)) |
| 312 | (load "subst-ksc")) | 312 | (cond ((string= "Korean" current-language-environment) |
| 313 | ((string= "Chinese-BIG5" current-language-environment) | 313 | (load "subst-jis") |
| 314 | (load "subst-jis") | 314 | (load "subst-big5") |
| 315 | (load "subst-ksc") | 315 | (load "subst-gb2312") |
| 316 | (load "subst-gb2312") | 316 | (load "subst-ksc")) |
| 317 | (load "subst-big5")) | 317 | ((string= "Chinese-BIG5" current-language-environment) |
| 318 | ((string= "Chinese-GB" current-language-environment) | 318 | (load "subst-jis") |
| 319 | (load "subst-jis") | 319 | (load "subst-ksc") |
| 320 | (load "subst-ksc") | 320 | (load "subst-gb2312") |
| 321 | (load "subst-big5") | 321 | (load "subst-big5")) |
| 322 | (load "subst-gb2312")) | 322 | ((string= "Chinese-GB" current-language-environment) |
| 323 | (t | 323 | (load "subst-jis") |
| 324 | (load "subst-ksc") | 324 | (load "subst-ksc") |
| 325 | (load "subst-gb2312") | 325 | (load "subst-big5") |
| 326 | (load "subst-big5") | 326 | (load "subst-gb2312")) |
| 327 | (load "subst-jis"))) ; jis covers as much as big5, gb2312 | 327 | (t |
| 328 | (load "subst-ksc") | ||
| 329 | (load "subst-gb2312") | ||
| 330 | (load "subst-big5") | ||
| 331 | (load "subst-jis")))) ; jis covers as much as big5, gb2312 | ||
| 328 | 332 | ||
| 329 | (when redefined | 333 | (when redefined |
| 330 | (define-translation-hash-table 'utf-subst-table-for-decode | 334 | (define-translation-hash-table 'utf-subst-table-for-decode |
diff --git a/lisp/loadup.el b/lisp/loadup.el index bb00fe8fbbb..b5102b4b553 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -46,7 +46,8 @@ | |||
| 46 | (message "Using load-path %s" load-path) | 46 | (message "Using load-path %s" load-path) |
| 47 | 47 | ||
| 48 | ;; We don't want to have any undo records in the dumped Emacs. | 48 | ;; We don't want to have any undo records in the dumped Emacs. |
| 49 | (buffer-disable-undo "*scratch*") | 49 | (set-buffer "*scratch*") |
| 50 | (setq buffer-undo-list t) | ||
| 50 | 51 | ||
| 51 | (load "emacs-lisp/byte-run") | 52 | (load "emacs-lisp/byte-run") |
| 52 | (load "emacs-lisp/backquote") | 53 | (load "emacs-lisp/backquote") |
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index a7524cc8246..b913a73ab7f 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el | |||
| @@ -3435,6 +3435,8 @@ typically for purposes of moderating a list." | |||
| 3435 | (if (not from) (setq from user-mail-address)) | 3435 | (if (not from) (setq from user-mail-address)) |
| 3436 | (let ((tembuf (generate-new-buffer " sendmail temp")) | 3436 | (let ((tembuf (generate-new-buffer " sendmail temp")) |
| 3437 | (case-fold-search nil) | 3437 | (case-fold-search nil) |
| 3438 | (mail-personal-alias-file | ||
| 3439 | (or mail-alias-file mail-personal-alias-file)) | ||
| 3438 | (mailbuf rmail-buffer)) | 3440 | (mailbuf rmail-buffer)) |
| 3439 | (unwind-protect | 3441 | (unwind-protect |
| 3440 | (with-current-buffer tembuf | 3442 | (with-current-buffer tembuf |
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index d356979ea26..7e6d4746e8d 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el | |||
| @@ -523,7 +523,7 @@ This is relative to `smtpmail-queue-dir'.") | |||
| 523 | (when (and cred mech) | 523 | (when (and cred mech) |
| 524 | (cond | 524 | (cond |
| 525 | ((eq mech 'cram-md5) | 525 | ((eq mech 'cram-md5) |
| 526 | (smtpmail-send-command process (format "AUTH %s" mech)) | 526 | (smtpmail-send-command process (upcase (format "AUTH %s" mech))) |
| 527 | (if (or (null (car (setq ret (smtpmail-read-response process)))) | 527 | (if (or (null (car (setq ret (smtpmail-read-response process)))) |
| 528 | (not (integerp (car ret))) | 528 | (not (integerp (car ret))) |
| 529 | (>= (car ret) 400)) | 529 | (>= (car ret) 400)) |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 91e2e4ae5c6..63e0f6c9d91 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -754,7 +754,8 @@ remains active. Otherwise, it remains until the next input event. | |||
| 754 | 754 | ||
| 755 | If the click is in the echo area, display the `*Messages*' buffer." | 755 | If the click is in the echo area, display the `*Messages*' buffer." |
| 756 | (interactive "e") | 756 | (interactive "e") |
| 757 | (let ((w (posn-window (event-start start-event)))) | 757 | (let ((w (posn-window (event-start start-event))) |
| 758 | (mouse-autoselect-window nil)) | ||
| 758 | (if (not (or (not (window-minibuffer-p w)) | 759 | (if (not (or (not (window-minibuffer-p w)) |
| 759 | (minibuffer-window-active-p w))) | 760 | (minibuffer-window-active-p w))) |
| 760 | (save-excursion | 761 | (save-excursion |
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el index 428da8cbe8a..95a13b620a2 100644 --- a/lisp/net/goto-addr.el +++ b/lisp/net/goto-addr.el | |||
| @@ -100,7 +100,7 @@ A value of t means there is no limit--fontify regardless of the size." | |||
| 100 | 100 | ||
| 101 | (defvar goto-address-mail-regexp | 101 | (defvar goto-address-mail-regexp |
| 102 | ;; Actually pretty much any char could appear in the username part. -stef | 102 | ;; Actually pretty much any char could appear in the username part. -stef |
| 103 | "[-a-zA-Z0-9._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+" | 103 | "[-a-zA-Z0-9=._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+" |
| 104 | "A regular expression probably matching an e-mail address.") | 104 | "A regular expression probably matching an e-mail address.") |
| 105 | 105 | ||
| 106 | (defvar goto-address-url-regexp | 106 | (defvar goto-address-url-regexp |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 9c7e8fe1560..601eb03946e 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1463,8 +1463,8 @@ Use this command in a compilation log buffer. Sets the mark at point there." | |||
| 1463 | ;; If the current buffer is a compilation buffer, return it. | 1463 | ;; If the current buffer is a compilation buffer, return it. |
| 1464 | ;; Otherwise, look for a compilation buffer and signal an error | 1464 | ;; Otherwise, look for a compilation buffer and signal an error |
| 1465 | ;; if there are none. | 1465 | ;; if there are none. |
| 1466 | (defun compilation-find-buffer (&optional other-buffer) | 1466 | (defun compilation-find-buffer (&optional avoid-current) |
| 1467 | (next-error-find-buffer other-buffer 'compilation-buffer-internal-p)) | 1467 | (next-error-find-buffer avoid-current 'compilation-buffer-internal-p)) |
| 1468 | 1468 | ||
| 1469 | ;;;###autoload | 1469 | ;;;###autoload |
| 1470 | (defun compilation-next-error-function (n &optional reset) | 1470 | (defun compilation-next-error-function (n &optional reset) |
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index accdad515f2..00bd1af4da9 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el | |||
| @@ -6026,7 +6026,8 @@ Currently it is tuned to C and Perl syntax." | |||
| 6026 | (interactive) | 6026 | (interactive) |
| 6027 | (let (found-bad (p (point))) | 6027 | (let (found-bad (p (point))) |
| 6028 | (setq last-nonmenu-event 13) ; To disable popup | 6028 | (setq last-nonmenu-event 13) ; To disable popup |
| 6029 | (beginning-of-buffer) | 6029 | (with-no-warnings ; It is useful to push the mark here. |
| 6030 | (beginning-of-buffer)) | ||
| 6030 | (map-y-or-n-p "Insert space here? " | 6031 | (map-y-or-n-p "Insert space here? " |
| 6031 | (lambda (arg) (insert " ")) | 6032 | (lambda (arg) (insert " ")) |
| 6032 | 'cperl-next-bad-style | 6033 | 'cperl-next-bad-style |
| @@ -7183,13 +7184,9 @@ Delay of auto-help controlled by `cperl-lazy-help-time'." | |||
| 7183 | ;;; Plug for wrong font-lock: | 7184 | ;;; Plug for wrong font-lock: |
| 7184 | 7185 | ||
| 7185 | (defun cperl-font-lock-unfontify-region-function (beg end) | 7186 | (defun cperl-font-lock-unfontify-region-function (beg end) |
| 7186 | (let* ((modified (buffer-modified-p)) (buffer-undo-list t) | 7187 | ;; Simplified now that font-lock-unfontify-region uses save-buffer-state. |
| 7187 | (inhibit-read-only t) (inhibit-point-motion-hooks t) | 7188 | (let (before-change-functions after-change-functions) |
| 7188 | before-change-functions after-change-functions | 7189 | (remove-text-properties beg end '(face nil)))) |
| 7189 | deactivate-mark buffer-file-name buffer-file-truename) | ||
| 7190 | (remove-text-properties beg end '(face nil)) | ||
| 7191 | (when (and (not modified) (buffer-modified-p)) | ||
| 7192 | (set-buffer-modified-p nil)))) | ||
| 7193 | 7190 | ||
| 7194 | (defvar cperl-d-l nil) | 7191 | (defvar cperl-d-l nil) |
| 7195 | (defun cperl-fontify-syntaxically (end) | 7192 | (defun cperl-fontify-syntaxically (end) |
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index 7013c3856e3..07fcda385ef 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Thien-Thi Nguyen <ttn@gnu.org> | 5 | ;; Author: Thien-Thi Nguyen <ttn@gnu.org> |
| 6 | ;; Dan Nicolaescu <dann@ics.uci.edu> | 6 | ;; Dan Nicolaescu <dann@ics.uci.edu> |
| 7 | ;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines | 7 | ;; Keywords: C C++ java lisp tools editing comments blocks hiding outlines |
| 8 | ;; Maintainer-Version: 5.31 | 8 | ;; Maintainer-Version: 5.58.2.3 |
| 9 | ;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning | 9 | ;; Time-of-Day-Author-Most-Likely-to-be-Recalcitrant: early morning |
| 10 | 10 | ||
| 11 | ;; This file is part of GNU Emacs. | 11 | ;; This file is part of GNU Emacs. |
| @@ -58,7 +58,7 @@ | |||
| 58 | ;; | 58 | ;; |
| 59 | ;; (load-library "hideshow") | 59 | ;; (load-library "hideshow") |
| 60 | ;; (add-hook 'X-mode-hook ; other modes similarly | 60 | ;; (add-hook 'X-mode-hook ; other modes similarly |
| 61 | ;; '(lambda () (hs-minor-mode 1))) | 61 | ;; (lambda () (hs-minor-mode 1))) |
| 62 | ;; | 62 | ;; |
| 63 | ;; where X = {emacs-lisp,c,c++,perl,...}. You can also manually toggle | 63 | ;; where X = {emacs-lisp,c,c++,perl,...}. You can also manually toggle |
| 64 | ;; hideshow minor mode by typing `M-x hs-minor-mode'. After hideshow is | 64 | ;; hideshow minor mode by typing `M-x hs-minor-mode'. After hideshow is |
| @@ -133,14 +133,24 @@ | |||
| 133 | ;; variable `hs-special-modes-alist'. Packages that use hideshow should | 133 | ;; variable `hs-special-modes-alist'. Packages that use hideshow should |
| 134 | ;; do something like: | 134 | ;; do something like: |
| 135 | ;; | 135 | ;; |
| 136 | ;; (let ((my-mode-hs-info '(my-mode "{{" "}}" ...))) | 136 | ;; (add-to-list 'hs-special-modes-alist '(my-mode "{{" "}}" ...)) |
| 137 | ;; (if (not (member my-mode-hs-info hs-special-modes-alist)) | ||
| 138 | ;; (setq hs-special-modes-alist | ||
| 139 | ;; (cons my-mode-hs-info hs-special-modes-alist)))) | ||
| 140 | ;; | 137 | ;; |
| 141 | ;; If you have an entry that works particularly well, consider | 138 | ;; If you have an entry that works particularly well, consider |
| 142 | ;; submitting it for inclusion in hideshow.el. See docstring for | 139 | ;; submitting it for inclusion in hideshow.el. See docstring for |
| 143 | ;; `hs-special-modes-alist' for more info on the entry format. | 140 | ;; `hs-special-modes-alist' for more info on the entry format. |
| 141 | ;; | ||
| 142 | ;; See also variable `hs-set-up-overlay' for per-block customization of | ||
| 143 | ;; appearance or other effects associated with overlays. For example: | ||
| 144 | ;; | ||
| 145 | ;; (setq hs-set-up-overlay | ||
| 146 | ;; (defun my-display-code-line-counts (ov) | ||
| 147 | ;; (when (eq 'code (overlay-get ov 'hs)) | ||
| 148 | ;; (overlay-put ov 'display | ||
| 149 | ;; (propertize | ||
| 150 | ;; (format " ... <%d>" | ||
| 151 | ;; (count-lines (overlay-start ov) | ||
| 152 | ;; (overlay-end ov))) | ||
| 153 | ;; 'face 'font-lock-type-face))))) | ||
| 144 | 154 | ||
| 145 | ;; * Bugs | 155 | ;; * Bugs |
| 146 | ;; | 156 | ;; |
| @@ -180,9 +190,9 @@ | |||
| 180 | ;; In the case of `vc-diff', here is a less invasive workaround: | 190 | ;; In the case of `vc-diff', here is a less invasive workaround: |
| 181 | ;; | 191 | ;; |
| 182 | ;; (add-hook 'vc-before-checkin-hook | 192 | ;; (add-hook 'vc-before-checkin-hook |
| 183 | ;; '(lambda () | 193 | ;; (lambda () |
| 184 | ;; (goto-char (point-min)) | 194 | ;; (goto-char (point-min)) |
| 185 | ;; (hs-show-block))) | 195 | ;; (hs-show-block))) |
| 186 | ;; | 196 | ;; |
| 187 | ;; Unfortunately, these workarounds do not restore hideshow state. | 197 | ;; Unfortunately, these workarounds do not restore hideshow state. |
| 188 | ;; If someone figures out a better way, please let me know. | 198 | ;; If someone figures out a better way, please let me know. |
| @@ -223,6 +233,7 @@ | |||
| 223 | ;;; Code: | 233 | ;;; Code: |
| 224 | 234 | ||
| 225 | (require 'easymenu) | 235 | (require 'easymenu) |
| 236 | (eval-when-compile (require 'cl)) | ||
| 226 | 237 | ||
| 227 | ;;--------------------------------------------------------------------------- | 238 | ;;--------------------------------------------------------------------------- |
| 228 | ;; user-configurable variables | 239 | ;; user-configurable variables |
| @@ -265,8 +276,7 @@ This has effect iff `search-invisible' is set to `open'." | |||
| 265 | '((c-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) | 276 | '((c-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) |
| 266 | (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) | 277 | (c++-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) |
| 267 | (bibtex-mode ("^@\\S(*\\(\\s(\\)" 1)) | 278 | (bibtex-mode ("^@\\S(*\\(\\s(\\)" 1)) |
| 268 | (java-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning) | 279 | (java-mode "{" "}" "/[*/]" nil hs-c-like-adjust-block-beginning)) |
| 269 | ) | ||
| 270 | "*Alist for initializing the hideshow variables for different modes. | 280 | "*Alist for initializing the hideshow variables for different modes. |
| 271 | Each element has the form | 281 | Each element has the form |
| 272 | (MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC). | 282 | (MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC). |
| @@ -307,6 +317,24 @@ a block), `hs-hide-all', `hs-hide-block' and `hs-hide-level'.") | |||
| 307 | These commands include the toggling commands (when the result is to show | 317 | These commands include the toggling commands (when the result is to show |
| 308 | a block), `hs-show-all' and `hs-show-block'..") | 318 | a block), `hs-show-all' and `hs-show-block'..") |
| 309 | 319 | ||
| 320 | (defvar hs-set-up-overlay nil | ||
| 321 | "*Function called with one arg, OV, a newly initialized overlay. | ||
| 322 | Hideshow puts a unique overlay on each range of text to be hidden | ||
| 323 | in the buffer. Here is a simple example of how to use this variable: | ||
| 324 | |||
| 325 | (defun display-code-line-counts (ov) | ||
| 326 | (when (eq 'code (overlay-get ov 'hs)) | ||
| 327 | (overlay-put ov 'display | ||
| 328 | (format \"... / %d\" | ||
| 329 | (count-lines (overlay-start ov) | ||
| 330 | (overlay-end ov)))))) | ||
| 331 | |||
| 332 | (setq hs-set-up-overlay 'display-code-line-counts) | ||
| 333 | |||
| 334 | This example shows how to get information from the overlay as well | ||
| 335 | as how to set its `display' property. See `hs-make-overlay' and | ||
| 336 | info node `(elisp)Overlays'.") | ||
| 337 | |||
| 310 | ;;--------------------------------------------------------------------------- | 338 | ;;--------------------------------------------------------------------------- |
| 311 | ;; internal variables | 339 | ;; internal variables |
| 312 | 340 | ||
| @@ -378,28 +406,6 @@ Note that `mode-line-format' is buffer-local.") | |||
| 378 | ;;--------------------------------------------------------------------------- | 406 | ;;--------------------------------------------------------------------------- |
| 379 | ;; system dependency | 407 | ;; system dependency |
| 380 | 408 | ||
| 381 | ; ;; xemacs compatibility | ||
| 382 | ; (when (string-match "xemacs\\|lucid" emacs-version) | ||
| 383 | ; ;; use pre-packaged compatiblity layer | ||
| 384 | ; (require 'overlay)) | ||
| 385 | ; | ||
| 386 | ; ;; xemacs and emacs-19 compatibility | ||
| 387 | ; (when (or (not (fboundp 'add-to-invisibility-spec)) | ||
| 388 | ; (not (fboundp 'remove-from-invisibility-spec))) | ||
| 389 | ; ;; `buffer-invisibility-spec' mutators snarfed from Emacs 20.3 lisp/subr.el | ||
| 390 | ; (defun add-to-invisibility-spec (arg) | ||
| 391 | ; (cond | ||
| 392 | ; ((or (null buffer-invisibility-spec) (eq buffer-invisibility-spec t)) | ||
| 393 | ; (setq buffer-invisibility-spec (list arg))) | ||
| 394 | ; (t | ||
| 395 | ; (setq buffer-invisibility-spec | ||
| 396 | ; (cons arg buffer-invisibility-spec))))) | ||
| 397 | ; (defun remove-from-invisibility-spec (arg) | ||
| 398 | ; (when buffer-invisibility-spec | ||
| 399 | ; (setq buffer-invisibility-spec | ||
| 400 | ; (delete arg buffer-invisibility-spec))))) | ||
| 401 | |||
| 402 | ;; hs-match-data | ||
| 403 | (defalias 'hs-match-data 'match-data) | 409 | (defalias 'hs-match-data 'match-data) |
| 404 | 410 | ||
| 405 | ;;--------------------------------------------------------------------------- | 411 | ;;--------------------------------------------------------------------------- |
| @@ -409,12 +415,38 @@ Note that `mode-line-format' is buffer-local.") | |||
| 409 | "Delete hideshow overlays in region defined by FROM and TO." | 415 | "Delete hideshow overlays in region defined by FROM and TO." |
| 410 | (when (< to from) | 416 | (when (< to from) |
| 411 | (setq from (prog1 to (setq to from)))) | 417 | (setq from (prog1 to (setq to from)))) |
| 412 | (let ((ovs (overlays-in from to))) | 418 | (dolist (ov (overlays-in from to)) |
| 413 | (while ovs | 419 | (when (overlay-get ov 'hs) |
| 414 | (let ((ov (car ovs))) | 420 | (delete-overlay ov)))) |
| 415 | (when (overlay-get ov 'hs) | 421 | |
| 416 | (delete-overlay ov))) | 422 | (defun hs-make-overlay (b e kind &optional b-offset e-offset) |
| 417 | (setq ovs (cdr ovs))))) | 423 | "Return a new overlay in region defined by B and E with type KIND. |
| 424 | KIND is either `code' or `comment'. Optional fourth arg B-OFFSET | ||
| 425 | when added to B specifies the actual buffer position where the block | ||
| 426 | begins. Likewise for optional fifth arg E-OFFSET. If unspecified | ||
| 427 | they are taken to be 0 (zero). The following properties are set | ||
| 428 | in the overlay: 'invisible 'hs 'hs-b-offset 'hs-e-offset. Also, | ||
| 429 | depending on variable `hs-isearch-open', the following properties may | ||
| 430 | be present: 'isearch-open-invisible 'isearch-open-invisible-temporary. | ||
| 431 | If variable `hs-set-up-overlay' is non-nil it should specify a function | ||
| 432 | to call with the newly initialized overlay." | ||
| 433 | (unless b-offset (setq b-offset 0)) | ||
| 434 | (unless e-offset (setq e-offset 0)) | ||
| 435 | (let ((ov (make-overlay b e)) | ||
| 436 | (io (if (eq 'block hs-isearch-open) | ||
| 437 | ;; backward compatibility -- `block'<=>`code' | ||
| 438 | 'code | ||
| 439 | hs-isearch-open))) | ||
| 440 | (overlay-put ov 'invisible 'hs) | ||
| 441 | (overlay-put ov 'hs kind) | ||
| 442 | (overlay-put ov 'hs-b-offset b-offset) | ||
| 443 | (overlay-put ov 'hs-e-offset e-offset) | ||
| 444 | (when (or (eq io t) (eq io kind)) | ||
| 445 | (overlay-put ov 'isearch-open-invisible 'hs-isearch-show) | ||
| 446 | (overlay-put ov 'isearch-open-invisible-temporary | ||
| 447 | 'hs-isearch-show-temporary)) | ||
| 448 | (when hs-set-up-overlay (funcall hs-set-up-overlay ov)) | ||
| 449 | ov)) | ||
| 418 | 450 | ||
| 419 | (defun hs-isearch-show (ov) | 451 | (defun hs-isearch-show (ov) |
| 420 | "Delete overlay OV, and set `hs-headline' to nil. | 452 | "Delete overlay OV, and set `hs-headline' to nil. |
| @@ -433,43 +465,28 @@ OV is shown. | |||
| 433 | This function is meant to be used as the `isearch-open-invisible-temporary' | 465 | This function is meant to be used as the `isearch-open-invisible-temporary' |
| 434 | property of an overlay." | 466 | property of an overlay." |
| 435 | (setq hs-headline | 467 | (setq hs-headline |
| 436 | (if hide-p | 468 | (if hide-p |
| 437 | nil | 469 | nil |
| 438 | (or hs-headline | 470 | (or hs-headline |
| 439 | (let ((start (overlay-start ov))) | 471 | (let ((start (overlay-start ov))) |
| 440 | (buffer-substring | 472 | (buffer-substring |
| 441 | (save-excursion (goto-char start) | 473 | (save-excursion (goto-char start) |
| 442 | (beginning-of-line) | 474 | (beginning-of-line) |
| 443 | (skip-chars-forward " \t") | 475 | (skip-chars-forward " \t") |
| 444 | (point)) | 476 | (point)) |
| 445 | start))))) | 477 | start))))) |
| 446 | (force-mode-line-update) | 478 | (force-mode-line-update) |
| 479 | ;; handle `display' property specially | ||
| 480 | (let (value) | ||
| 481 | (if hide-p | ||
| 482 | (when (setq value (overlay-get ov 'hs-isearch-display)) | ||
| 483 | (overlay-put ov 'display value) | ||
| 484 | (overlay-put ov 'hs-isearch-display nil)) | ||
| 485 | (when (setq value (overlay-get ov 'display)) | ||
| 486 | (overlay-put ov 'hs-isearch-display value) | ||
| 487 | (overlay-put ov 'display nil)))) | ||
| 447 | (overlay-put ov 'invisible (and hide-p 'hs))) | 488 | (overlay-put ov 'invisible (and hide-p 'hs))) |
| 448 | 489 | ||
| 449 | (defun hs-flag-region (from to flag) | ||
| 450 | "Hide or show lines from FROM to TO, according to FLAG. | ||
| 451 | If FLAG is nil then text is shown, while if FLAG is non-nil the text is | ||
| 452 | hidden. FLAG must be one of the symbols `code' or `comment', depending | ||
| 453 | on what kind of block is to be hidden." | ||
| 454 | (save-excursion | ||
| 455 | ;; first clear it all out | ||
| 456 | (hs-discard-overlays from to) | ||
| 457 | ;; now create overlays if needed | ||
| 458 | (when flag | ||
| 459 | (let ((overlay (make-overlay from to))) | ||
| 460 | (overlay-put overlay 'invisible 'hs) | ||
| 461 | (overlay-put overlay 'hs flag) | ||
| 462 | (when (or (eq hs-isearch-open t) | ||
| 463 | (eq hs-isearch-open flag) | ||
| 464 | ;; deprecated backward compatibility -- `block'<=>`code' | ||
| 465 | (and (eq 'block hs-isearch-open) | ||
| 466 | (eq 'code flag))) | ||
| 467 | (overlay-put overlay 'isearch-open-invisible 'hs-isearch-show) | ||
| 468 | (overlay-put overlay | ||
| 469 | 'isearch-open-invisible-temporary | ||
| 470 | 'hs-isearch-show-temporary)) | ||
| 471 | overlay)))) | ||
| 472 | |||
| 473 | (defun hs-forward-sexp (match-data arg) | 490 | (defun hs-forward-sexp (match-data arg) |
| 474 | "Adjust point based on MATCH-DATA and call `hs-forward-sexp-func' w/ ARG. | 491 | "Adjust point based on MATCH-DATA and call `hs-forward-sexp-func' w/ ARG. |
| 475 | Original match data is restored upon return." | 492 | Original match data is restored upon return." |
| @@ -481,9 +498,10 @@ Original match data is restored upon return." | |||
| 481 | (defun hs-hide-comment-region (beg end &optional repos-end) | 498 | (defun hs-hide-comment-region (beg end &optional repos-end) |
| 482 | "Hide a region from BEG to END, marking it as a comment. | 499 | "Hide a region from BEG to END, marking it as a comment. |
| 483 | Optional arg REPOS-END means reposition at end." | 500 | Optional arg REPOS-END means reposition at end." |
| 484 | (hs-flag-region (progn (goto-char beg) (end-of-line) (point)) | 501 | (let ((beg-eol (progn (goto-char beg) (end-of-line) (point))) |
| 485 | (progn (goto-char end) (end-of-line) (point)) | 502 | (end-eol (progn (goto-char end) (end-of-line) (point)))) |
| 486 | 'comment) | 503 | (hs-discard-overlays beg-eol end-eol) |
| 504 | (hs-make-overlay beg-eol end-eol 'comment beg end)) | ||
| 487 | (goto-char (if repos-end end beg))) | 505 | (goto-char (if repos-end end beg))) |
| 488 | 506 | ||
| 489 | (defun hs-hide-block-at-point (&optional end comment-reg) | 507 | (defun hs-hide-block-at-point (&optional end comment-reg) |
| @@ -516,17 +534,16 @@ and then further adjusted to be at the end of the line." | |||
| 516 | (end-of-line) | 534 | (end-of-line) |
| 517 | (point)))) | 535 | (point)))) |
| 518 | (when (and (< p (point)) (> (count-lines p q) 1)) | 536 | (when (and (< p (point)) (> (count-lines p q) 1)) |
| 519 | (overlay-put (hs-flag-region p q 'code) | 537 | (hs-discard-overlays p q) |
| 520 | 'hs-ofs | 538 | (hs-make-overlay p q 'code (- pure-p p))) |
| 521 | (- pure-p p))) | ||
| 522 | (goto-char (if end q (min p pure-p))))))) | 539 | (goto-char (if end q (min p pure-p))))))) |
| 523 | 540 | ||
| 524 | (defun hs-safety-is-job-n () | 541 | (defun hs-safety-is-job-n () |
| 525 | "Warn if `buffer-invisibility-spec' does not contain symbol `hs'." | 542 | "Warn if `buffer-invisibility-spec' does not contain symbol `hs'." |
| 526 | (unless (and (listp buffer-invisibility-spec) | 543 | (unless (and (listp buffer-invisibility-spec) |
| 527 | (assq 'hs buffer-invisibility-spec)) | 544 | (assq 'hs buffer-invisibility-spec)) |
| 528 | (message "Warning: `buffer-invisibility-spec' does not contain hs!!") | 545 | (message "Warning: `buffer-invisibility-spec' does not contain hs!!") |
| 529 | (sit-for 2))) | 546 | (sit-for 2))) |
| 530 | 547 | ||
| 531 | (defun hs-inside-comment-p () | 548 | (defun hs-inside-comment-p () |
| 532 | "Return non-nil if point is inside a comment, otherwise nil. | 549 | "Return non-nil if point is inside a comment, otherwise nil. |
| @@ -543,10 +560,15 @@ as cdr." | |||
| 543 | (let ((q (point))) | 560 | (let ((q (point))) |
| 544 | (when (or (looking-at hs-c-start-regexp) | 561 | (when (or (looking-at hs-c-start-regexp) |
| 545 | (re-search-backward hs-c-start-regexp (point-min) t)) | 562 | (re-search-backward hs-c-start-regexp (point-min) t)) |
| 563 | ;; first get to the beginning of this comment... | ||
| 564 | (while (and (not (bobp)) | ||
| 565 | (= (point) (progn (forward-comment -1) (point)))) | ||
| 566 | (forward-char -1)) | ||
| 567 | ;; ...then extend backwards | ||
| 546 | (forward-comment (- (buffer-size))) | 568 | (forward-comment (- (buffer-size))) |
| 547 | (skip-chars-forward " \t\n\f") | 569 | (skip-chars-forward " \t\n\f") |
| 548 | (let ((p (point)) | 570 | (let ((p (point)) |
| 549 | (not-hidable nil)) | 571 | (hidable t)) |
| 550 | (beginning-of-line) | 572 | (beginning-of-line) |
| 551 | (unless (looking-at (concat "[ \t]*" hs-c-start-regexp)) | 573 | (unless (looking-at (concat "[ \t]*" hs-c-start-regexp)) |
| 552 | ;; we are in this situation: (example) | 574 | ;; we are in this situation: (example) |
| @@ -565,19 +587,19 @@ as cdr." | |||
| 565 | (while (and (< (point) q) | 587 | (while (and (< (point) q) |
| 566 | (> (point) p) | 588 | (> (point) p) |
| 567 | (not (looking-at hs-c-start-regexp))) | 589 | (not (looking-at hs-c-start-regexp))) |
| 568 | (setq p (point));; use this to avoid an infinite cycle | 590 | (setq p (point)) ;; use this to avoid an infinite cycle |
| 569 | (forward-comment 1) | 591 | (forward-comment 1) |
| 570 | (skip-chars-forward " \t\n\f")) | 592 | (skip-chars-forward " \t\n\f")) |
| 571 | (when (or (not (looking-at hs-c-start-regexp)) | 593 | (when (or (not (looking-at hs-c-start-regexp)) |
| 572 | (> (point) q)) | 594 | (> (point) q)) |
| 573 | ;; we cannot hide this comment block | 595 | ;; we cannot hide this comment block |
| 574 | (setq not-hidable t))) | 596 | (setq hidable nil))) |
| 575 | ;; goto the end of the comment | 597 | ;; goto the end of the comment |
| 576 | (forward-comment (buffer-size)) | 598 | (forward-comment (buffer-size)) |
| 577 | (skip-chars-backward " \t\n\f") | 599 | (skip-chars-backward " \t\n\f") |
| 578 | (end-of-line) | 600 | (end-of-line) |
| 579 | (when (>= (point) q) | 601 | (when (>= (point) q) |
| 580 | (list (if not-hidable nil p) (point)))))))) | 602 | (list (and hidable p) (point)))))))) |
| 581 | 603 | ||
| 582 | (defun hs-grok-mode-type () | 604 | (defun hs-grok-mode-type () |
| 583 | "Set up hideshow variables for new buffers. | 605 | "Set up hideshow variables for new buffers. |
| @@ -635,7 +657,7 @@ Return point, or nil if original point was not in a block." | |||
| 635 | (setq minp (1+ (point))) | 657 | (setq minp (1+ (point))) |
| 636 | (funcall hs-forward-sexp-func 1) | 658 | (funcall hs-forward-sexp-func 1) |
| 637 | (setq maxp (1- (point)))) | 659 | (setq maxp (1- (point)))) |
| 638 | (hs-flag-region minp maxp nil) ; eliminate weirdness | 660 | (hs-discard-overlays minp maxp) ; eliminate weirdness |
| 639 | (goto-char minp) | 661 | (goto-char minp) |
| 640 | (while (progn | 662 | (while (progn |
| 641 | (forward-comment (buffer-size)) | 663 | (forward-comment (buffer-size)) |
| @@ -645,7 +667,7 @@ Return point, or nil if original point was not in a block." | |||
| 645 | (hs-hide-level-recursive (1- arg) minp maxp) | 667 | (hs-hide-level-recursive (1- arg) minp maxp) |
| 646 | (goto-char (match-beginning hs-block-start-mdata-select)) | 668 | (goto-char (match-beginning hs-block-start-mdata-select)) |
| 647 | (hs-hide-block-at-point t))) | 669 | (hs-hide-block-at-point t))) |
| 648 | (hs-safety-is-job-n) | 670 | (hs-safety-is-job-n) |
| 649 | (goto-char maxp)) | 671 | (goto-char maxp)) |
| 650 | 672 | ||
| 651 | (defmacro hs-life-goes-on (&rest body) | 673 | (defmacro hs-life-goes-on (&rest body) |
| @@ -675,8 +697,8 @@ and `case-fold-search' are both t." | |||
| 675 | (let ((overlays (overlays-at (point))) | 697 | (let ((overlays (overlays-at (point))) |
| 676 | (found nil)) | 698 | (found nil)) |
| 677 | (while (and (not found) (overlayp (car overlays))) | 699 | (while (and (not found) (overlayp (car overlays))) |
| 678 | (setq found (overlay-get (car overlays) 'hs) | 700 | (setq found (overlay-get (car overlays) 'hs) |
| 679 | overlays (cdr overlays))) | 701 | overlays (cdr overlays))) |
| 680 | found))) | 702 | found))) |
| 681 | 703 | ||
| 682 | (defun hs-c-like-adjust-block-beginning (initial) | 704 | (defun hs-c-like-adjust-block-beginning (initial) |
| @@ -701,7 +723,7 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." | |||
| 701 | (hs-life-goes-on | 723 | (hs-life-goes-on |
| 702 | (message "Hiding all blocks ...") | 724 | (message "Hiding all blocks ...") |
| 703 | (save-excursion | 725 | (save-excursion |
| 704 | (hs-flag-region (point-min) (point-max) nil) ; eliminate weirdness | 726 | (hs-discard-overlays (point-min) (point-max)) ; eliminate weirdness |
| 705 | (goto-char (point-min)) | 727 | (goto-char (point-min)) |
| 706 | (let ((count 0) | 728 | (let ((count 0) |
| 707 | (re (concat "\\(" | 729 | (re (concat "\\(" |
| @@ -724,7 +746,7 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." | |||
| 724 | (funcall hs-hide-all-non-comment-function) | 746 | (funcall hs-hide-all-non-comment-function) |
| 725 | (hs-hide-block-at-point t))) | 747 | (hs-hide-block-at-point t))) |
| 726 | ;; found a comment, probably | 748 | ;; found a comment, probably |
| 727 | (let ((c-reg (hs-inside-comment-p))) ; blech! | 749 | (let ((c-reg (hs-inside-comment-p))) ; blech! |
| 728 | (when (and c-reg (car c-reg)) | 750 | (when (and c-reg (car c-reg)) |
| 729 | (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1) | 751 | (if (> (count-lines (car c-reg) (nth 1 c-reg)) 1) |
| 730 | (hs-hide-block-at-point t c-reg) | 752 | (hs-hide-block-at-point t c-reg) |
| @@ -740,7 +762,7 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments." | |||
| 740 | (interactive) | 762 | (interactive) |
| 741 | (hs-life-goes-on | 763 | (hs-life-goes-on |
| 742 | (message "Showing all blocks ...") | 764 | (message "Showing all blocks ...") |
| 743 | (hs-flag-region (point-min) (point-max) nil) | 765 | (hs-discard-overlays (point-min) (point-max)) |
| 744 | (message "Showing all blocks ... done") | 766 | (message "Showing all blocks ... done") |
| 745 | (run-hooks 'hs-show-hook))) | 767 | (run-hooks 'hs-show-hook))) |
| 746 | 768 | ||
| @@ -772,18 +794,15 @@ See documentation for functions `hs-hide-block' and `run-hooks'." | |||
| 772 | (or | 794 | (or |
| 773 | ;; first see if we have something at the end of the line | 795 | ;; first see if we have something at the end of the line |
| 774 | (catch 'eol-begins-hidden-region-p | 796 | (catch 'eol-begins-hidden-region-p |
| 775 | (let ((here (point)) | 797 | (let ((here (point))) |
| 776 | (ovs (save-excursion (end-of-line) (overlays-at (point))))) | 798 | (dolist (ov (save-excursion (end-of-line) (overlays-at (point)))) |
| 777 | (while ovs | 799 | (when (overlay-get ov 'hs) |
| 778 | (let ((ov (car ovs))) | 800 | (goto-char |
| 779 | (when (overlay-get ov 'hs) | 801 | (cond (end (overlay-end ov)) |
| 780 | (goto-char | 802 | ((eq 'comment (overlay-get ov 'hs)) here) |
| 781 | (cond (end (overlay-end ov)) | 803 | (t (+ (overlay-start ov) (overlay-get ov 'hs-b-offset))))) |
| 782 | ((eq 'comment (overlay-get ov 'hs)) here) | 804 | (delete-overlay ov) |
| 783 | (t (+ (overlay-start ov) (overlay-get ov 'hs-ofs))))) | 805 | (throw 'eol-begins-hidden-region-p t))) |
| 784 | (delete-overlay ov) | ||
| 785 | (throw 'eol-begins-hidden-region-p t))) | ||
| 786 | (setq ovs (cdr ovs))) | ||
| 787 | nil)) | 806 | nil)) |
| 788 | ;; not immediately obvious, look for a suitable block | 807 | ;; not immediately obvious, look for a suitable block |
| 789 | (let ((c-reg (hs-inside-comment-p)) | 808 | (let ((c-reg (hs-inside-comment-p)) |
| @@ -797,7 +816,7 @@ See documentation for functions `hs-hide-block' and `run-hooks'." | |||
| 797 | (setq p (point) | 816 | (setq p (point) |
| 798 | q (progn (hs-forward-sexp (hs-match-data t) 1) (point))))) | 817 | q (progn (hs-forward-sexp (hs-match-data t) 1) (point))))) |
| 799 | (when (and p q) | 818 | (when (and p q) |
| 800 | (hs-flag-region p q nil) | 819 | (hs-discard-overlays p q) |
| 801 | (goto-char (if end q (1+ p))))) | 820 | (goto-char (if end q (1+ p))))) |
| 802 | (hs-safety-is-job-n) | 821 | (hs-safety-is-job-n) |
| 803 | (run-hooks 'hs-show-hook)))) | 822 | (run-hooks 'hs-show-hook)))) |
| @@ -870,9 +889,9 @@ Key bindings: | |||
| 870 | 889 | ||
| 871 | (interactive "P") | 890 | (interactive "P") |
| 872 | (setq hs-headline nil | 891 | (setq hs-headline nil |
| 873 | hs-minor-mode (if (null arg) | 892 | hs-minor-mode (if (null arg) |
| 874 | (not hs-minor-mode) | 893 | (not hs-minor-mode) |
| 875 | (> (prefix-numeric-value arg) 0))) | 894 | (> (prefix-numeric-value arg) 0))) |
| 876 | (if hs-minor-mode | 895 | (if hs-minor-mode |
| 877 | (progn | 896 | (progn |
| 878 | (hs-grok-mode-type) | 897 | (hs-grok-mode-type) |
| @@ -912,27 +931,19 @@ Key bindings: | |||
| 912 | ))))) | 931 | ))))) |
| 913 | 932 | ||
| 914 | ;; some housekeeping | 933 | ;; some housekeeping |
| 915 | (or (assq 'hs-minor-mode minor-mode-map-alist) | 934 | (add-to-list 'minor-mode-map-alist (cons 'hs-minor-mode hs-minor-mode-map)) |
| 916 | (setq minor-mode-map-alist | 935 | (add-to-list 'minor-mode-alist '(hs-minor-mode " hs") t) |
| 917 | (cons (cons 'hs-minor-mode hs-minor-mode-map) | ||
| 918 | minor-mode-map-alist))) | ||
| 919 | (or (assq 'hs-minor-mode minor-mode-alist) | ||
| 920 | (setq minor-mode-alist (append minor-mode-alist | ||
| 921 | (list '(hs-minor-mode " hs"))))) | ||
| 922 | 936 | ||
| 923 | ;; make some variables permanently buffer-local | 937 | ;; make some variables permanently buffer-local |
| 924 | (let ((vars '(hs-minor-mode | 938 | (dolist (var '(hs-minor-mode |
| 925 | hs-c-start-regexp | 939 | hs-c-start-regexp |
| 926 | hs-block-start-regexp | 940 | hs-block-start-regexp |
| 927 | hs-block-start-mdata-select | 941 | hs-block-start-mdata-select |
| 928 | hs-block-end-regexp | 942 | hs-block-end-regexp |
| 929 | hs-forward-sexp-func | 943 | hs-forward-sexp-func |
| 930 | hs-adjust-block-beginning))) | 944 | hs-adjust-block-beginning)) |
| 931 | (while vars | 945 | (make-variable-buffer-local var) |
| 932 | (let ((var (car vars))) | 946 | (put var 'permanent-local t)) |
| 933 | (make-variable-buffer-local var) | ||
| 934 | (put var 'permanent-local t)) | ||
| 935 | (setq vars (cdr vars)))) | ||
| 936 | 947 | ||
| 937 | ;;--------------------------------------------------------------------------- | 948 | ;;--------------------------------------------------------------------------- |
| 938 | ;; that's it | 949 | ;; that's it |
diff --git a/lisp/simple.el b/lisp/simple.el index 7465e33c8e9..c9094808c9b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -124,70 +124,87 @@ to navigate in it.") | |||
| 124 | (make-variable-buffer-local 'next-error-function) | 124 | (make-variable-buffer-local 'next-error-function) |
| 125 | 125 | ||
| 126 | (defsubst next-error-buffer-p (buffer | 126 | (defsubst next-error-buffer-p (buffer |
| 127 | &optional | 127 | &optional avoid-current |
| 128 | extra-test-inclusive | 128 | extra-test-inclusive |
| 129 | extra-test-exclusive) | 129 | extra-test-exclusive) |
| 130 | "Test if BUFFER is a next-error capable buffer. | 130 | "Test if BUFFER is a next-error capable buffer. |
| 131 | EXTRA-TEST-INCLUSIVE is called to allow extra buffers. | 131 | |
| 132 | EXTRA-TEST-EXCLUSIVE is called to disallow buffers." | 132 | If AVOID-CURRENT is non-nil, treat the current buffer |
| 133 | (with-current-buffer buffer | 133 | as an absolute last resort only. |
| 134 | (or (and extra-test-inclusive (funcall extra-test-inclusive)) | 134 | |
| 135 | (and (if extra-test-exclusive (funcall extra-test-exclusive) t) | 135 | The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffer |
| 136 | next-error-function)))) | 136 | that normally would not qualify. If it returns t, the buffer |
| 137 | 137 | in question is treated as usable. | |
| 138 | (defun next-error-find-buffer (&optional other-buffer | 138 | |
| 139 | The function EXTRA-TEST-EXCLUSIVE, if non-nil is called in each buffer | ||
| 140 | that would normally be considered usable. if it returns nil, | ||
| 141 | that buffer is rejected." | ||
| 142 | (and (buffer-name buffer) ;First make sure it's live. | ||
| 143 | (not (and avoid-current (eq buffer (current-buffer)))) | ||
| 144 | (with-current-buffer buffer | ||
| 145 | (if next-error-function ; This is the normal test. | ||
| 146 | ;; Optionally reject some buffers. | ||
| 147 | (if extra-test-exclusive | ||
| 148 | (funcall extra-test-exclusive) | ||
| 149 | t) | ||
| 150 | ;; Optionally accept some other buffers. | ||
| 151 | (and extra-test-inclusive | ||
| 152 | (funcall extra-test-inclusive)))))) | ||
| 153 | |||
| 154 | (defun next-error-find-buffer (&optional avoid-current | ||
| 139 | extra-test-inclusive | 155 | extra-test-inclusive |
| 140 | extra-test-exclusive) | 156 | extra-test-exclusive) |
| 141 | "Return a next-error capable buffer. | 157 | "Return a next-error capable buffer. |
| 142 | OTHER-BUFFER will disallow the current buffer. | 158 | If AVOID-CURRENT is non-nil, treat the current buffer |
| 143 | EXTRA-TEST-INCLUSIVE is called to allow extra buffers. | 159 | as an absolute last resort only. |
| 144 | EXTRA-TEST-EXCLUSIVE is called to disallow buffers." | 160 | |
| 161 | The function EXTRA-TEST-INCLUSIVE, if non-nil, is called in each buffers | ||
| 162 | that normally would not qualify. If it returns t, the buffer | ||
| 163 | in question is treated as usable. | ||
| 164 | |||
| 165 | The function EXTRA-TEST-EXCLUSIVE, if non-nil is called in each buffer | ||
| 166 | that would normally be considered usable. If it returns nil, | ||
| 167 | that buffer is rejected." | ||
| 145 | (or | 168 | (or |
| 146 | ;; 1. If one window on the selected frame displays such buffer, return it. | 169 | ;; 1. If one window on the selected frame displays such buffer, return it. |
| 147 | (let ((window-buffers | 170 | (let ((window-buffers |
| 148 | (delete-dups | 171 | (delete-dups |
| 149 | (delq nil (mapcar (lambda (w) | 172 | (delq nil (mapcar (lambda (w) |
| 150 | (if (next-error-buffer-p | 173 | (if (next-error-buffer-p |
| 151 | (window-buffer w) | 174 | (window-buffer w) |
| 175 | avoid-current | ||
| 152 | extra-test-inclusive extra-test-exclusive) | 176 | extra-test-inclusive extra-test-exclusive) |
| 153 | (window-buffer w))) | 177 | (window-buffer w))) |
| 154 | (window-list)))))) | 178 | (window-list)))))) |
| 155 | (if other-buffer | ||
| 156 | (setq window-buffers (delq (current-buffer) window-buffers))) | ||
| 157 | (if (eq (length window-buffers) 1) | 179 | (if (eq (length window-buffers) 1) |
| 158 | (car window-buffers))) | 180 | (car window-buffers))) |
| 159 | ;; 2. If next-error-last-buffer is set to a live buffer, use that. | 181 | ;; 2. If next-error-last-buffer is an acceptable buffer, use that. |
| 160 | (if (and next-error-last-buffer | 182 | (if (and next-error-last-buffer |
| 161 | (buffer-name next-error-last-buffer) | 183 | (next-error-buffer-p next-error-last-buffer avoid-current |
| 162 | (next-error-buffer-p next-error-last-buffer | ||
| 163 | extra-test-inclusive extra-test-exclusive) | ||
| 164 | (or (not other-buffer) | ||
| 165 | (not (eq next-error-last-buffer (current-buffer))))) | ||
| 166 | next-error-last-buffer) | ||
| 167 | ;; 3. If the current buffer is a next-error capable buffer, return it. | ||
| 168 | (if (and (not other-buffer) | ||
| 169 | (next-error-buffer-p (current-buffer) | ||
| 170 | extra-test-inclusive extra-test-exclusive)) | 184 | extra-test-inclusive extra-test-exclusive)) |
| 185 | next-error-last-buffer) | ||
| 186 | ;; 3. If the current buffer is acceptable, choose it. | ||
| 187 | (if (next-error-buffer-p (current-buffer) avoid-current | ||
| 188 | extra-test-inclusive extra-test-exclusive) | ||
| 171 | (current-buffer)) | 189 | (current-buffer)) |
| 172 | ;; 4. Look for a next-error capable buffer in a buffer list. | 190 | ;; 4. Look for any acceptable buffer. |
| 173 | (let ((buffers (buffer-list))) | 191 | (let ((buffers (buffer-list))) |
| 174 | (while (and buffers | 192 | (while (and buffers |
| 175 | (or (not (next-error-buffer-p | 193 | (not (next-error-buffer-p |
| 176 | (car buffers) | 194 | (car buffers) avoid-current |
| 177 | extra-test-inclusive extra-test-exclusive)) | 195 | extra-test-inclusive extra-test-exclusive))) |
| 178 | (and other-buffer (eq (car buffers) (current-buffer))))) | ||
| 179 | (setq buffers (cdr buffers))) | 196 | (setq buffers (cdr buffers))) |
| 180 | (if buffers | 197 | (car buffers)) |
| 181 | (car buffers) | 198 | ;; 5. Use the current buffer as a last resort if it qualifies, |
| 182 | (or (and other-buffer | 199 | ;; even despite AVOID-CURRENT. |
| 183 | (next-error-buffer-p (current-buffer) | 200 | (and avoid-current |
| 184 | extra-test-inclusive extra-test-exclusive) | 201 | (next-error-buffer-p (current-buffer) nil |
| 185 | ;; The current buffer is a next-error capable buffer. | 202 | extra-test-inclusive extra-test-exclusive) |
| 186 | (progn | 203 | (progn |
| 187 | (if other-buffer | 204 | (message "This is the only next-error capable buffer") |
| 188 | (message "This is the only next-error capable buffer")) | 205 | (current-buffer))) |
| 189 | (current-buffer))) | 206 | ;; 6. Give up. |
| 190 | (error "No next-error capable buffer found")))))) | 207 | (error "No next-error capable buffer found"))) |
| 191 | 208 | ||
| 192 | (defun next-error (&optional arg reset) | 209 | (defun next-error (&optional arg reset) |
| 193 | "Visit next next-error message and corresponding source code. | 210 | "Visit next next-error message and corresponding source code. |
| @@ -1113,11 +1130,13 @@ makes the search case-sensitive." | |||
| 1113 | nil | 1130 | nil |
| 1114 | minibuffer-local-map | 1131 | minibuffer-local-map |
| 1115 | nil | 1132 | nil |
| 1116 | 'minibuffer-history-search-history))) | 1133 | 'minibuffer-history-search-history |
| 1134 | (car minibuffer-history-search-history)))) | ||
| 1117 | ;; Use the last regexp specified, by default, if input is empty. | 1135 | ;; Use the last regexp specified, by default, if input is empty. |
| 1118 | (list (if (string= regexp "") | 1136 | (list (if (string= regexp "") |
| 1119 | (setcar minibuffer-history-search-history | 1137 | (if minibuffer-history-search-history |
| 1120 | (nth 1 minibuffer-history-search-history)) | 1138 | (car minibuffer-history-search-history) |
| 1139 | (error "No previous history search regexp")) | ||
| 1121 | regexp) | 1140 | regexp) |
| 1122 | (prefix-numeric-value current-prefix-arg)))) | 1141 | (prefix-numeric-value current-prefix-arg)))) |
| 1123 | (previous-matching-history-element regexp (- n))) | 1142 | (previous-matching-history-element regexp (- n))) |
| @@ -1215,6 +1234,10 @@ Return 0 if current buffer is not a mini-buffer." | |||
| 1215 | (defvar undo-no-redo nil | 1234 | (defvar undo-no-redo nil |
| 1216 | "If t, `undo' doesn't go through redo entries.") | 1235 | "If t, `undo' doesn't go through redo entries.") |
| 1217 | 1236 | ||
| 1237 | (defvar undo-list-saved nil | ||
| 1238 | "The value of `buffer-undo-list' saved by the last undo command.") | ||
| 1239 | (make-variable-buffer-local 'undo-list-saved) | ||
| 1240 | |||
| 1218 | (defun undo (&optional arg) | 1241 | (defun undo (&optional arg) |
| 1219 | "Undo some previous changes. | 1242 | "Undo some previous changes. |
| 1220 | Repeat this command to undo more changes. | 1243 | Repeat this command to undo more changes. |
| @@ -1237,7 +1260,13 @@ as an argument limits undo to changes within the current region." | |||
| 1237 | ;; So set `this-command' to something other than `undo'. | 1260 | ;; So set `this-command' to something other than `undo'. |
| 1238 | (setq this-command 'undo-start) | 1261 | (setq this-command 'undo-start) |
| 1239 | 1262 | ||
| 1240 | (unless (eq last-command 'undo) | 1263 | (unless (and (eq last-command 'undo) |
| 1264 | ;; If something (a timer or filter?) changed the buffer | ||
| 1265 | ;; since the previous command, don't continue the undo seq. | ||
| 1266 | (let ((list buffer-undo-list)) | ||
| 1267 | (while (eq (car list) nil) | ||
| 1268 | (setq list (cdr list))) | ||
| 1269 | (eq undo-list-saved list))) | ||
| 1241 | (setq undo-in-region | 1270 | (setq undo-in-region |
| 1242 | (if transient-mark-mode mark-active (and arg (not (numberp arg))))) | 1271 | (if transient-mark-mode mark-active (and arg (not (numberp arg))))) |
| 1243 | (if undo-in-region | 1272 | (if undo-in-region |
| @@ -1289,10 +1318,20 @@ as an argument limits undo to changes within the current region." | |||
| 1289 | (setq tail (cdr tail))) | 1318 | (setq tail (cdr tail))) |
| 1290 | (setq tail nil))) | 1319 | (setq tail nil))) |
| 1291 | (setq prev tail tail (cdr tail)))) | 1320 | (setq prev tail tail (cdr tail)))) |
| 1292 | 1321 | ;; Record what the current undo list says, | |
| 1322 | ;; so the next command can tell if the buffer was modified in between. | ||
| 1323 | (setq undo-list-saved buffer-undo-list) | ||
| 1293 | (and modified (not (buffer-modified-p)) | 1324 | (and modified (not (buffer-modified-p)) |
| 1294 | (delete-auto-save-file-if-necessary recent-save)))) | 1325 | (delete-auto-save-file-if-necessary recent-save)))) |
| 1295 | 1326 | ||
| 1327 | (defun buffer-disable-undo (&optional buffer) | ||
| 1328 | "Make BUFFER stop keeping undo information. | ||
| 1329 | No argument or nil as argument means do this for the current buffer." | ||
| 1330 | (interactive) | ||
| 1331 | (with-current-buffer (get-buffer buffer) | ||
| 1332 | (setq buffer-undo-list t | ||
| 1333 | undo-list-saved nil))) | ||
| 1334 | |||
| 1296 | (defun undo-only (&optional arg) | 1335 | (defun undo-only (&optional arg) |
| 1297 | "Undo some previous changes. | 1336 | "Undo some previous changes. |
| 1298 | Repeat this command to undo more changes. | 1337 | Repeat this command to undo more changes. |
| @@ -1491,8 +1530,9 @@ is not *inside* the region START...END." | |||
| 1491 | ;; so it had better not do a lot of consing. | 1530 | ;; so it had better not do a lot of consing. |
| 1492 | (setq undo-outer-limit-function 'undo-outer-limit-truncate) | 1531 | (setq undo-outer-limit-function 'undo-outer-limit-truncate) |
| 1493 | (defun undo-outer-limit-truncate (size) | 1532 | (defun undo-outer-limit-truncate (size) |
| 1494 | (if (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? " | 1533 | (if (let (use-dialog-box) |
| 1495 | (buffer-name) size)) | 1534 | (yes-or-no-p (format "Buffer %s undo info is %d bytes long; discard it? " |
| 1535 | (buffer-name) size))) | ||
| 1496 | (progn (setq buffer-undo-list nil) t) | 1536 | (progn (setq buffer-undo-list nil) t) |
| 1497 | nil)) | 1537 | nil)) |
| 1498 | 1538 | ||
diff --git a/lisp/subr.el b/lisp/subr.el index edc303bee8d..e7901f28852 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -823,7 +823,7 @@ is converted into a string by expressing it in decimal." | |||
| 823 | (defalias 'unfocus-frame 'ignore "") | 823 | (defalias 'unfocus-frame 'ignore "") |
| 824 | 824 | ||
| 825 | 825 | ||
| 826 | ;;;; Obsolescence declarations for variables. | 826 | ;;;; Obsolescence declarations for variables, and aliases. |
| 827 | 827 | ||
| 828 | (make-obsolete-variable 'directory-sep-char "do not use it." "21.1") | 828 | (make-obsolete-variable 'directory-sep-char "do not use it." "21.1") |
| 829 | (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." "21.1") | 829 | (make-obsolete-variable 'mode-line-inverse-video "use the appropriate faces instead." "21.1") |
| @@ -840,6 +840,8 @@ is converted into a string by expressing it in decimal." | |||
| 840 | (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "21.4") | 840 | (make-obsolete-variable 'x-lost-selection-hooks 'x-lost-selection-functions "21.4") |
| 841 | (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) | 841 | (defvaralias 'x-sent-selection-hooks 'x-sent-selection-functions) |
| 842 | (make-obsolete-variable 'x-sent-selection-hooks 'x-sent-selection-functions "21.4") | 842 | (make-obsolete-variable 'x-sent-selection-hooks 'x-sent-selection-functions "21.4") |
| 843 | |||
| 844 | (defvaralias 'messages-buffer-max-lines 'message-log-max) | ||
| 843 | 845 | ||
| 844 | ;;;; Alternate names for functions - these are not being phased out. | 846 | ;;;; Alternate names for functions - these are not being phased out. |
| 845 | 847 | ||
| @@ -1012,19 +1014,33 @@ other hooks, such as major mode hooks, can do the job." | |||
| 1012 | ;;; nil nil t) | 1014 | ;;; nil nil t) |
| 1013 | ;;; (setq symbol-file-load-history-loaded t))) | 1015 | ;;; (setq symbol-file-load-history-loaded t))) |
| 1014 | 1016 | ||
| 1015 | (defun symbol-file (function) | 1017 | (defun symbol-file (symbol &optional type) |
| 1016 | "Return the input source from which FUNCTION was loaded. | 1018 | "Return the input source in which SYMBOL was defined. |
| 1017 | The value is normally a string that was passed to `load': | 1019 | The value is normally a string that was passed to `load': |
| 1018 | either an absolute file name, or a library name | 1020 | either an absolute file name, or a library name |
| 1019 | \(with no directory name and no `.el' or `.elc' at the end). | 1021 | \(with no directory name and no `.el' or `.elc' at the end). |
| 1020 | It can also be nil, if the definition is not associated with any file." | 1022 | It can also be nil, if the definition is not associated with any file. |
| 1021 | (if (and (symbolp function) (fboundp function) | 1023 | |
| 1022 | (eq 'autoload (car-safe (symbol-function function)))) | 1024 | If TYPE is nil, then any kind of definition is acceptable. |
| 1023 | (nth 1 (symbol-function function)) | 1025 | If type is `defun' or `defvar', that specifies function |
| 1026 | definition only or variable definition only." | ||
| 1027 | (if (and (or (null type) (eq type 'defun)) | ||
| 1028 | (symbolp symbol) (fboundp symbol) | ||
| 1029 | (eq 'autoload (car-safe (symbol-function symbol)))) | ||
| 1030 | (nth 1 (symbol-function symbol)) | ||
| 1024 | (let ((files load-history) | 1031 | (let ((files load-history) |
| 1025 | file) | 1032 | file) |
| 1026 | (while files | 1033 | (while files |
| 1027 | (if (member function (cdr (car files))) | 1034 | (if (if type |
| 1035 | (if (eq type 'defvar) | ||
| 1036 | ;; Variables are present just as their names. | ||
| 1037 | (member symbol (cdr (car files))) | ||
| 1038 | ;; Other types are represented as (TYPE . NAME). | ||
| 1039 | (member (cons type symbol) (cdr (car files)))) | ||
| 1040 | ;; We accept all types, so look for variable def | ||
| 1041 | ;; and then for any other kind. | ||
| 1042 | (or (member symbol (cdr (car files))) | ||
| 1043 | (rassq symbol (cdr (car files))))) | ||
| 1028 | (setq file (car (car files)) files nil)) | 1044 | (setq file (car (car files)) files nil)) |
| 1029 | (setq files (cdr files))) | 1045 | (setq files (cdr files))) |
| 1030 | file))) | 1046 | file))) |
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el index 2b5c4d2a994..8cfce66c214 100644 --- a/lisp/term/mac-win.el +++ b/lisp/term/mac-win.el | |||
| @@ -1,8 +1,9 @@ | |||
| 1 | ;;; mac-win.el --- support for "Macintosh windows" | 1 | ;;; mac-win.el --- parse switches controlling interface with Mac window system |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Andrew Choi <akochoi@mac.com> | 5 | ;; Author: Andrew Choi <akochoi@mac.com> |
| 6 | ;; Keywords: terminals | ||
| 6 | 7 | ||
| 7 | ;; This file is part of GNU Emacs. | 8 | ;; This file is part of GNU Emacs. |
| 8 | 9 | ||
| @@ -23,634 +24,212 @@ | |||
| 23 | 24 | ||
| 24 | ;;; Commentary: | 25 | ;;; Commentary: |
| 25 | 26 | ||
| 26 | ;;; Code: | 27 | ;; Mac-win.el: this file is loaded from ../lisp/startup.el when it recognizes |
| 28 | ;; that Mac windows are to be used. Command line switches are parsed and those | ||
| 29 | ;; pertaining to Mac are processed and removed from the command line. The | ||
| 30 | ;; Mac display is opened and hooks are set for popping up the initial window. | ||
| 27 | 31 | ||
| 28 | ;; --------------------------------------------------------------------------- | 32 | ;; startup.el will then examine startup files, and eventually call the hooks |
| 29 | ;; We want to delay setting frame parameters until the faces are setup | 33 | ;; which create the first window(s). |
| 30 | 34 | ||
| 31 | ;; Mac can't handle ~ prefix in file names | 35 | ;;; Code: |
| 32 | ;(setq auto-save-list-file-prefix ".saves-") | 36 | |
| 37 | ;; These are the standard X switches from the Xt Initialize.c file of | ||
| 38 | ;; Release 4. | ||
| 33 | 39 | ||
| 34 | (setq frame-creation-function 'x-create-frame-with-faces) | 40 | ;; Command line Resource Manager string |
| 35 | 41 | ||
| 36 | ;; for debugging | 42 | ;; +rv *reverseVideo |
| 37 | ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) | 43 | ;; +synchronous *synchronous |
| 44 | ;; -background *background | ||
| 45 | ;; -bd *borderColor | ||
| 46 | ;; -bg *background | ||
| 47 | ;; -bordercolor *borderColor | ||
| 48 | ;; -borderwidth .borderWidth | ||
| 49 | ;; -bw .borderWidth | ||
| 50 | ;; -display .display | ||
| 51 | ;; -fg *foreground | ||
| 52 | ;; -fn *font | ||
| 53 | ;; -font *font | ||
| 54 | ;; -foreground *foreground | ||
| 55 | ;; -geometry .geometry | ||
| 56 | ;; -i .iconType | ||
| 57 | ;; -itype .iconType | ||
| 58 | ;; -iconic .iconic | ||
| 59 | ;; -name .name | ||
| 60 | ;; -reverse *reverseVideo | ||
| 61 | ;; -rv *reverseVideo | ||
| 62 | ;; -selectionTimeout .selectionTimeout | ||
| 63 | ;; -synchronous *synchronous | ||
| 64 | ;; -xrm | ||
| 38 | 65 | ||
| 39 | ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) | 66 | ;; An alist of X options and the function which handles them. See |
| 67 | ;; ../startup.el. | ||
| 40 | 68 | ||
| 41 | (global-set-key | 69 | (if (not (eq window-system 'mac)) |
| 42 | [vertical-scroll-bar down-mouse-1] | 70 | (error "%s: Loading mac-win.el but not compiled for Mac" (invocation-name))) |
| 43 | 'mac-handle-scroll-bar-event) | ||
| 44 | |||
| 45 | (global-unset-key [vertical-scroll-bar drag-mouse-1]) | ||
| 46 | (global-unset-key [vertical-scroll-bar mouse-1]) | ||
| 47 | 71 | ||
| 72 | (require 'frame) | ||
| 73 | (require 'mouse) | ||
| 48 | (require 'scroll-bar) | 74 | (require 'scroll-bar) |
| 75 | (require 'faces) | ||
| 76 | ;;(require 'select) | ||
| 77 | (require 'menu-bar) | ||
| 78 | (require 'fontset) | ||
| 79 | ;;(require 'x-dnd) | ||
| 49 | 80 | ||
| 50 | (defun mac-handle-scroll-bar-event (event) | 81 | (defvar x-invocation-args) |
| 51 | "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling." | ||
| 52 | (interactive "e") | ||
| 53 | (let* ((position (event-start event)) | ||
| 54 | (window (nth 0 position)) | ||
| 55 | (bar-part (nth 4 position))) | ||
| 56 | (select-window window) | ||
| 57 | (cond | ||
| 58 | ((eq bar-part 'up) | ||
| 59 | (goto-char (window-start window)) | ||
| 60 | (mac-scroll-down-line)) | ||
| 61 | ((eq bar-part 'above-handle) | ||
| 62 | (mac-scroll-down)) | ||
| 63 | ((eq bar-part 'handle) | ||
| 64 | (scroll-bar-drag event)) | ||
| 65 | ((eq bar-part 'below-handle) | ||
| 66 | (mac-scroll-up)) | ||
| 67 | ((eq bar-part 'down) | ||
| 68 | (goto-char (window-start window)) | ||
| 69 | (mac-scroll-up-line))))) | ||
| 70 | 82 | ||
| 71 | (defun mac-scroll-ignore-events () | 83 | (defvar x-command-line-resources nil) |
| 72 | ;; Ignore confusing non-mouse events | ||
| 73 | (while (not (memq (car-safe (read-event)) | ||
| 74 | '(mouse-1 double-mouse-1 triple-mouse-1))) nil)) | ||
| 75 | 84 | ||
| 76 | (defun mac-scroll-down () | 85 | ;; Handler for switches of the form "-switch value" or "-switch". |
| 77 | (track-mouse | 86 | (defun x-handle-switch (switch) |
| 78 | (mac-scroll-ignore-events) | 87 | (let ((aelt (assoc switch command-line-x-option-alist))) |
| 79 | (scroll-down))) | 88 | (if aelt |
| 89 | (let ((param (nth 3 aelt)) | ||
| 90 | (value (nth 4 aelt))) | ||
| 91 | (if value | ||
| 92 | (setq default-frame-alist | ||
| 93 | (cons (cons param value) | ||
| 94 | default-frame-alist)) | ||
| 95 | (setq default-frame-alist | ||
| 96 | (cons (cons param | ||
| 97 | (car x-invocation-args)) | ||
| 98 | default-frame-alist) | ||
| 99 | x-invocation-args (cdr x-invocation-args))))))) | ||
| 80 | 100 | ||
| 81 | (defun mac-scroll-down-line () | 101 | ;; Handler for switches of the form "-switch n" |
| 82 | (track-mouse | 102 | (defun x-handle-numeric-switch (switch) |
| 83 | (mac-scroll-ignore-events) | 103 | (let ((aelt (assoc switch command-line-x-option-alist))) |
| 84 | (scroll-down 1))) | 104 | (if aelt |
| 105 | (let ((param (nth 3 aelt))) | ||
| 106 | (setq default-frame-alist | ||
| 107 | (cons (cons param | ||
| 108 | (string-to-int (car x-invocation-args))) | ||
| 109 | default-frame-alist) | ||
| 110 | x-invocation-args | ||
| 111 | (cdr x-invocation-args)))))) | ||
| 85 | 112 | ||
| 86 | (defun mac-scroll-up () | 113 | ;; Handle options that apply to initial frame only |
| 87 | (track-mouse | 114 | (defun x-handle-initial-switch (switch) |
| 88 | (mac-scroll-ignore-events) | 115 | (let ((aelt (assoc switch command-line-x-option-alist))) |
| 89 | (scroll-up))) | 116 | (if aelt |
| 117 | (let ((param (nth 3 aelt)) | ||
| 118 | (value (nth 4 aelt))) | ||
| 119 | (if value | ||
| 120 | (setq initial-frame-alist | ||
| 121 | (cons (cons param value) | ||
| 122 | initial-frame-alist)) | ||
| 123 | (setq initial-frame-alist | ||
| 124 | (cons (cons param | ||
| 125 | (car x-invocation-args)) | ||
| 126 | initial-frame-alist) | ||
| 127 | x-invocation-args (cdr x-invocation-args))))))) | ||
| 90 | 128 | ||
| 91 | (defun mac-scroll-up-line () | 129 | ;; Make -iconic apply only to the initial frame! |
| 92 | (track-mouse | 130 | (defun x-handle-iconic (switch) |
| 93 | (mac-scroll-ignore-events) | 131 | (setq initial-frame-alist |
| 94 | (scroll-up 1))) | 132 | (cons '(visibility . icon) initial-frame-alist))) |
| 95 | 133 | ||
| 96 | (defun xw-defined-colors (&optional frame) | 134 | ;; Handle the -xrm option. |
| 97 | "Internal function called by `defined-colors', which see." | 135 | (defun x-handle-xrm-switch (switch) |
| 98 | (or frame (setq frame (selected-frame))) | 136 | (unless (consp x-invocation-args) |
| 99 | (let ((all-colors x-colors) | 137 | (error "%s: missing argument to `%s' option" (invocation-name) switch)) |
| 100 | (this-color nil) | 138 | (setq x-command-line-resources |
| 101 | (defined-colors nil)) | 139 | (if (null x-command-line-resources) |
| 102 | (while all-colors | 140 | (car x-invocation-args) |
| 103 | (setq this-color (car all-colors) | 141 | (concat x-command-line-resources "\n" (car x-invocation-args)))) |
| 104 | all-colors (cdr all-colors)) | 142 | (setq x-invocation-args (cdr x-invocation-args))) |
| 105 | (and (color-supported-p this-color frame t) | ||
| 106 | (setq defined-colors (cons this-color defined-colors)))) | ||
| 107 | defined-colors)) | ||
| 108 | 143 | ||
| 109 | ;; Don't have this yet. | 144 | ;; Handle the geometry option |
| 110 | (fset 'x-get-resource 'ignore) | 145 | (defun x-handle-geometry (switch) |
| 146 | (let* ((geo (x-parse-geometry (car x-invocation-args))) | ||
| 147 | (left (assq 'left geo)) | ||
| 148 | (top (assq 'top geo)) | ||
| 149 | (height (assq 'height geo)) | ||
| 150 | (width (assq 'width geo))) | ||
| 151 | (if (or height width) | ||
| 152 | (setq default-frame-alist | ||
| 153 | (append default-frame-alist | ||
| 154 | '((user-size . t)) | ||
| 155 | (if height (list height)) | ||
| 156 | (if width (list width))) | ||
| 157 | initial-frame-alist | ||
| 158 | (append initial-frame-alist | ||
| 159 | '((user-size . t)) | ||
| 160 | (if height (list height)) | ||
| 161 | (if width (list width))))) | ||
| 162 | (if (or left top) | ||
| 163 | (setq initial-frame-alist | ||
| 164 | (append initial-frame-alist | ||
| 165 | '((user-position . t)) | ||
| 166 | (if left (list left)) | ||
| 167 | (if top (list top))))) | ||
| 168 | (setq x-invocation-args (cdr x-invocation-args)))) | ||
| 111 | 169 | ||
| 112 | (unless (eq system-type 'darwin) | 170 | ;; Handle the -name option. Set the variable x-resource-name |
| 113 | ;; This variable specifies the Unix program to call (as a process) to | 171 | ;; to the option's operand; set the name of |
| 114 | ;; deteremine the amount of free space on a file system (defaults to | 172 | ;; the initial frame, too. |
| 115 | ;; df). If it is not set to nil, ls-lisp will not work correctly | 173 | (defun x-handle-name-switch (switch) |
| 116 | ;; unless an external application df is implemented on the Mac. | 174 | (or (consp x-invocation-args) |
| 117 | (setq directory-free-space-program nil) | 175 | (error "%s: missing argument to `%s' option" (invocation-name) switch)) |
| 176 | (setq x-resource-name (car x-invocation-args) | ||
| 177 | x-invocation-args (cdr x-invocation-args)) | ||
| 178 | (setq initial-frame-alist (cons (cons 'name x-resource-name) | ||
| 179 | initial-frame-alist))) | ||
| 118 | 180 | ||
| 119 | ;; Set this so that Emacs calls subprocesses with "sh" as shell to | 181 | (defvar x-display-name nil |
| 120 | ;; expand filenames Note no subprocess for the shell is actually | 182 | "The display name specifying server and frame.") |
| 121 | ;; started (see run_mac_command in sysdep.c). | ||
| 122 | (setq shell-file-name "sh")) | ||
| 123 | 183 | ||
| 124 | ;; X Window emulation in macterm.c is not complete enough to start a | 184 | (defun x-handle-display (switch) |
| 125 | ;; frame without a minibuffer properly. Call this to tell ediff | 185 | (setq x-display-name (car x-invocation-args) |
| 126 | ;; library to use a single frame. | 186 | x-invocation-args (cdr x-invocation-args))) |
| 127 | ; (ediff-toggle-multiframe) | ||
| 128 | |||
| 129 | ;; Setup to use the Mac clipboard. The functions mac-cut-function and | ||
| 130 | ;; mac-paste-function are defined in mac.c. | ||
| 131 | (set-selection-coding-system 'compound-text-mac) | ||
| 132 | |||
| 133 | (setq interprogram-cut-function | ||
| 134 | '(lambda (str push) | ||
| 135 | (mac-cut-function | ||
| 136 | (encode-coding-string str selection-coding-system t) push))) | ||
| 137 | |||
| 138 | (setq interprogram-paste-function | ||
| 139 | '(lambda () | ||
| 140 | (let ((clipboard (mac-paste-function))) | ||
| 141 | (if clipboard | ||
| 142 | (decode-coding-string clipboard selection-coding-system t))))) | ||
| 143 | |||
| 144 | ;; Don't show the frame name; that's redundant. | ||
| 145 | (setq-default mode-line-frame-identification " ") | ||
| 146 | |||
| 147 | (defun mac-drag-n-drop (event) | ||
| 148 | "Edit the files listed in the drag-n-drop event.\n\ | ||
| 149 | Switch to a buffer editing the last file dropped." | ||
| 150 | (interactive "e") | ||
| 151 | (save-excursion | ||
| 152 | ;; Make sure the drop target has positive co-ords | ||
| 153 | ;; before setting the selected frame - otherwise it | ||
| 154 | ;; won't work. <skx@tardis.ed.ac.uk> | ||
| 155 | (let* ((window (posn-window (event-start event))) | ||
| 156 | (coords (posn-x-y (event-start event))) | ||
| 157 | (x (car coords)) | ||
| 158 | (y (cdr coords))) | ||
| 159 | (if (and (> x 0) (> y 0)) | ||
| 160 | (set-frame-selected-window nil window)) | ||
| 161 | (mapcar | ||
| 162 | '(lambda (file) | ||
| 163 | (find-file | ||
| 164 | (decode-coding-string | ||
| 165 | file | ||
| 166 | (or file-name-coding-system | ||
| 167 | default-file-name-coding-system)))) | ||
| 168 | (car (cdr (cdr event))))) | ||
| 169 | (raise-frame) | ||
| 170 | (recenter))) | ||
| 171 | |||
| 172 | (global-set-key [drag-n-drop] 'mac-drag-n-drop) | ||
| 173 | |||
| 174 | ;; By checking whether the variable mac-ready-for-drag-n-drop has been | ||
| 175 | ;; defined, the event loop in macterm.c can be informed that it can | ||
| 176 | ;; now receive Finder drag and drop events. Files dropped onto the | ||
| 177 | ;; Emacs application icon can only be processed when the initial frame | ||
| 178 | ;; has been created: this is where the files should be opened. | ||
| 179 | (add-hook 'after-init-hook | ||
| 180 | '(lambda () | ||
| 181 | (defvar mac-ready-for-drag-n-drop t))) | ||
| 182 | |||
| 183 | ; Define constant values to be set to mac-keyboard-text-encoding | ||
| 184 | (defconst kTextEncodingMacRoman 0) | ||
| 185 | (defconst kTextEncodingISOLatin1 513 "0x201") | ||
| 186 | (defconst kTextEncodingISOLatin2 514 "0x202") | ||
| 187 | |||
| 188 | |||
| 189 | (define-ccl-program ccl-encode-mac-roman-font | ||
| 190 | `(0 | ||
| 191 | (if (r0 != ,(charset-id 'ascii)) | ||
| 192 | (if (r0 <= ?\x8f) | ||
| 193 | (translate-character mac-roman-encoder r0 r1) | ||
| 194 | ((r1 <<= 7) | ||
| 195 | (r1 |= r2) | ||
| 196 | (translate-character mac-roman-encoder r0 r1))))) | ||
| 197 | "CCL program for Mac Roman font") | ||
| 198 | |||
| 199 | (let | ||
| 200 | ((encoding-vector (make-vector 256 nil)) | ||
| 201 | (i 0) | ||
| 202 | (vec ;; mac-centraleurroman (128..255) -> UCS mapping | ||
| 203 | [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS | ||
| 204 | #x0100 ;; 129:LATIN CAPITAL LETTER A WITH MACRON | ||
| 205 | #x0101 ;; 130:LATIN SMALL LETTER A WITH MACRON | ||
| 206 | #x00C9 ;; 131:LATIN CAPITAL LETTER E WITH ACUTE | ||
| 207 | #x0104 ;; 132:LATIN CAPITAL LETTER A WITH OGONEK | ||
| 208 | #x00D6 ;; 133:LATIN CAPITAL LETTER O WITH DIAERESIS | ||
| 209 | #x00DC ;; 134:LATIN CAPITAL LETTER U WITH DIAERESIS | ||
| 210 | #x00E1 ;; 135:LATIN SMALL LETTER A WITH ACUTE | ||
| 211 | #x0105 ;; 136:LATIN SMALL LETTER A WITH OGONEK | ||
| 212 | #x010C ;; 137:LATIN CAPITAL LETTER C WITH CARON | ||
| 213 | #x00E4 ;; 138:LATIN SMALL LETTER A WITH DIAERESIS | ||
| 214 | #x010D ;; 139:LATIN SMALL LETTER C WITH CARON | ||
| 215 | #x0106 ;; 140:LATIN CAPITAL LETTER C WITH ACUTE | ||
| 216 | #x0107 ;; 141:LATIN SMALL LETTER C WITH ACUTE | ||
| 217 | #x00E9 ;; 142:LATIN SMALL LETTER E WITH ACUTE | ||
| 218 | #x0179 ;; 143:LATIN CAPITAL LETTER Z WITH ACUTE | ||
| 219 | #x017A ;; 144:LATIN SMALL LETTER Z WITH ACUTE | ||
| 220 | #x010E ;; 145:LATIN CAPITAL LETTER D WITH CARON | ||
| 221 | #x00ED ;; 146:LATIN SMALL LETTER I WITH ACUTE | ||
| 222 | #x010F ;; 147:LATIN SMALL LETTER D WITH CARON | ||
| 223 | #x0112 ;; 148:LATIN CAPITAL LETTER E WITH MACRON | ||
| 224 | #x0113 ;; 149:LATIN SMALL LETTER E WITH MACRON | ||
| 225 | #x0116 ;; 150:LATIN CAPITAL LETTER E WITH DOT ABOVE | ||
| 226 | #x00F3 ;; 151:LATIN SMALL LETTER O WITH ACUTE | ||
| 227 | #x0117 ;; 152:LATIN SMALL LETTER E WITH DOT ABOVE | ||
| 228 | #x00F4 ;; 153:LATIN SMALL LETTER O WITH CIRCUMFLEX | ||
| 229 | #x00F6 ;; 154:LATIN SMALL LETTER O WITH DIAERESIS | ||
| 230 | #x00F5 ;; 155:LATIN SMALL LETTER O WITH TILDE | ||
| 231 | #x00FA ;; 156:LATIN SMALL LETTER U WITH ACUTE | ||
| 232 | #x011A ;; 157:LATIN CAPITAL LETTER E WITH CARON | ||
| 233 | #x011B ;; 158:LATIN SMALL LETTER E WITH CARON | ||
| 234 | #x00FC ;; 159:LATIN SMALL LETTER U WITH DIAERESIS | ||
| 235 | #x2020 ;; 160:DAGGER | ||
| 236 | #x00B0 ;; 161:DEGREE SIGN | ||
| 237 | #x0118 ;; 162:LATIN CAPITAL LETTER E WITH OGONEK | ||
| 238 | #x00A3 ;; 163:POUND SIGN | ||
| 239 | #x00A7 ;; 164:SECTION SIGN | ||
| 240 | #x2022 ;; 165:BULLET | ||
| 241 | #x00B6 ;; 166:PILCROW SIGN | ||
| 242 | #x00DF ;; 167:LATIN SMALL LETTER SHARP S | ||
| 243 | #x00AE ;; 168:REGISTERED SIGN | ||
| 244 | #x00A9 ;; 169:COPYRIGHT SIGN | ||
| 245 | #x2122 ;; 170:TRADE MARK SIGN | ||
| 246 | #x0119 ;; 171:LATIN SMALL LETTER E WITH OGONEK | ||
| 247 | #x00A8 ;; 172:DIAERESIS | ||
| 248 | #x2260 ;; 173:NOT EQUAL TO | ||
| 249 | #x0123 ;; 174:LATIN SMALL LETTER G WITH CEDILLA | ||
| 250 | #x012E ;; 175:LATIN CAPITAL LETTER I WITH OGONEK | ||
| 251 | #x012F ;; 176:LATIN SMALL LETTER I WITH OGONEK | ||
| 252 | #x012A ;; 177:LATIN CAPITAL LETTER I WITH MACRON | ||
| 253 | #x2264 ;; 178:LESS-THAN OR EQUAL TO | ||
| 254 | #x2265 ;; 179:GREATER-THAN OR EQUAL TO | ||
| 255 | #x012B ;; 180:LATIN SMALL LETTER I WITH MACRON | ||
| 256 | #x0136 ;; 181:LATIN CAPITAL LETTER K WITH CEDILLA | ||
| 257 | #x2202 ;; 182:PARTIAL DIFFERENTIAL | ||
| 258 | #x2211 ;; 183:N-ARY SUMMATION | ||
| 259 | #x0142 ;; 184:LATIN SMALL LETTER L WITH STROKE | ||
| 260 | #x013B ;; 185:LATIN CAPITAL LETTER L WITH CEDILLA | ||
| 261 | #x013C ;; 186:LATIN SMALL LETTER L WITH CEDILLA | ||
| 262 | #x013D ;; 187:LATIN CAPITAL LETTER L WITH CARON | ||
| 263 | #x013E ;; 188:LATIN SMALL LETTER L WITH CARON | ||
| 264 | #x0139 ;; 189:LATIN CAPITAL LETTER L WITH ACUTE | ||
| 265 | #x013A ;; 190:LATIN SMALL LETTER L WITH ACUTE | ||
| 266 | #x0145 ;; 191:LATIN CAPITAL LETTER N WITH CEDILLA | ||
| 267 | #x0146 ;; 192:LATIN SMALL LETTER N WITH CEDILLA | ||
| 268 | #x0143 ;; 193:LATIN CAPITAL LETTER N WITH ACUTE | ||
| 269 | #x00AC ;; 194:NOT SIGN | ||
| 270 | #x221A ;; 195:SQUARE ROOT | ||
| 271 | #x0144 ;; 196:LATIN SMALL LETTER N WITH ACUTE | ||
| 272 | #x0147 ;; 197:LATIN CAPITAL LETTER N WITH CARON | ||
| 273 | #x2206 ;; 198:INCREMENT | ||
| 274 | #x00AB ;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 275 | #x00BB ;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 276 | #x2026 ;; 201:HORIZONTAL ELLIPSIS | ||
| 277 | #x00A0 ;; 202:NO-BREAK SPACE | ||
| 278 | #x0148 ;; 203:LATIN SMALL LETTER N WITH CARON | ||
| 279 | #x0150 ;; 204:LATIN CAPITAL LETTER O WITH DOUBLE ACUTE | ||
| 280 | #x00D5 ;; 205:LATIN CAPITAL LETTER O WITH TILDE | ||
| 281 | #x0151 ;; 206:LATIN SMALL LETTER O WITH DOUBLE ACUTE | ||
| 282 | #x014C ;; 207:LATIN CAPITAL LETTER O WITH MACRON | ||
| 283 | #x2013 ;; 208:EN DASH | ||
| 284 | #x2014 ;; 209:EM DASH | ||
| 285 | #x201C ;; 210:LEFT DOUBLE QUOTATION MARK | ||
| 286 | #x201D ;; 211:RIGHT DOUBLE QUOTATION MARK | ||
| 287 | #x2018 ;; 212:LEFT SINGLE QUOTATION MARK | ||
| 288 | #x2019 ;; 213:RIGHT SINGLE QUOTATION MARK | ||
| 289 | #x00F7 ;; 214:DIVISION SIGN | ||
| 290 | #x25CA ;; 215:LOZENGE | ||
| 291 | #x014D ;; 216:LATIN SMALL LETTER O WITH MACRON | ||
| 292 | #x0154 ;; 217:LATIN CAPITAL LETTER R WITH ACUTE | ||
| 293 | #x0155 ;; 218:LATIN SMALL LETTER R WITH ACUTE | ||
| 294 | #x0158 ;; 219:LATIN CAPITAL LETTER R WITH CARON | ||
| 295 | #x2039 ;; 220:SINGLE LEFT-POINTING ANGLE QUOTATION MARK | ||
| 296 | #x203A ;; 221:SINGLE RIGHT-POINTING ANGLE QUOTATION MARK | ||
| 297 | #x0159 ;; 222:LATIN SMALL LETTER R WITH CARON | ||
| 298 | #x0156 ;; 223:LATIN CAPITAL LETTER R WITH CEDILLA | ||
| 299 | #x0157 ;; 224:LATIN SMALL LETTER R WITH CEDILLA | ||
| 300 | #x0160 ;; 225:LATIN CAPITAL LETTER S WITH CARON | ||
| 301 | #x201A ;; 226:SINGLE LOW-9 QUOTATION MARK | ||
| 302 | #x201E ;; 227:DOUBLE LOW-9 QUOTATION MARK | ||
| 303 | #x0161 ;; 228:LATIN SMALL LETTER S WITH CARON | ||
| 304 | #x015A ;; 229:LATIN CAPITAL LETTER S WITH ACUTE | ||
| 305 | #x015B ;; 230:LATIN SMALL LETTER S WITH ACUTE | ||
| 306 | #x00C1 ;; 231:LATIN CAPITAL LETTER A WITH ACUTE | ||
| 307 | #x0164 ;; 232:LATIN CAPITAL LETTER T WITH CARON | ||
| 308 | #x0165 ;; 233:LATIN SMALL LETTER T WITH CARON | ||
| 309 | #x00CD ;; 234:LATIN CAPITAL LETTER I WITH ACUTE | ||
| 310 | #x017D ;; 235:LATIN CAPITAL LETTER Z WITH CARON | ||
| 311 | #x017E ;; 236:LATIN SMALL LETTER Z WITH CARON | ||
| 312 | #x016A ;; 237:LATIN CAPITAL LETTER U WITH MACRON | ||
| 313 | #x00D3 ;; 238:LATIN CAPITAL LETTER O WITH ACUTE | ||
| 314 | #x00D4 ;; 239:LATIN CAPITAL LETTER O WITH CIRCUMFLEX | ||
| 315 | #x016B ;; 240:LATIN SMALL LETTER U WITH MACRON | ||
| 316 | #x016E ;; 241:LATIN CAPITAL LETTER U WITH RING ABOVE | ||
| 317 | #x00DA ;; 242:LATIN CAPITAL LETTER U WITH ACUTE | ||
| 318 | #x016F ;; 243:LATIN SMALL LETTER U WITH RING ABOVE | ||
| 319 | #x0170 ;; 244:LATIN CAPITAL LETTER U WITH DOUBLE ACUTE | ||
| 320 | #x0171 ;; 245:LATIN SMALL LETTER U WITH DOUBLE ACUTE | ||
| 321 | #x0172 ;; 246:LATIN CAPITAL LETTER U WITH OGONEK | ||
| 322 | #x0173 ;; 247:LATIN SMALL LETTER U WITH OGONEK | ||
| 323 | #x00DD ;; 248:LATIN CAPITAL LETTER Y WITH ACUTE | ||
| 324 | #x00FD ;; 249:LATIN SMALL LETTER Y WITH ACUTE | ||
| 325 | #x0137 ;; 250:LATIN SMALL LETTER K WITH CEDILLA | ||
| 326 | #x017B ;; 251:LATIN CAPITAL LETTER Z WITH DOT ABOVE | ||
| 327 | #x0141 ;; 252:LATIN CAPITAL LETTER L WITH STROKE | ||
| 328 | #x017C ;; 253:LATIN SMALL LETTER Z WITH DOT ABOVE | ||
| 329 | #x0122 ;; 254:LATIN CAPITAL LETTER G WITH CEDILLA | ||
| 330 | #x02C7 ;; 255:CARON | ||
| 331 | ]) | ||
| 332 | translation-table) | ||
| 333 | (while (< i 128) | ||
| 334 | (aset encoding-vector i i) | ||
| 335 | (setq i (1+ i))) | ||
| 336 | (while (< i 256) | ||
| 337 | (aset encoding-vector i | ||
| 338 | (decode-char 'ucs (aref vec (- i 128)))) | ||
| 339 | (setq i (1+ i))) | ||
| 340 | (setq translation-table | ||
| 341 | (make-translation-table-from-vector encoding-vector)) | ||
| 342 | ;; (define-translation-table 'mac-centraleurroman-decoder translation-table) | ||
| 343 | (define-translation-table 'mac-centraleurroman-encoder | ||
| 344 | (char-table-extra-slot translation-table 0))) | ||
| 345 | |||
| 346 | (let | ||
| 347 | ((encoding-vector (make-vector 256 nil)) | ||
| 348 | (i 0) | ||
| 349 | (vec ;; mac-cyrillic (128..255) -> UCS mapping | ||
| 350 | [ #x0410 ;; 128:CYRILLIC CAPITAL LETTER A | ||
| 351 | #x0411 ;; 129:CYRILLIC CAPITAL LETTER BE | ||
| 352 | #x0412 ;; 130:CYRILLIC CAPITAL LETTER VE | ||
| 353 | #x0413 ;; 131:CYRILLIC CAPITAL LETTER GHE | ||
| 354 | #x0414 ;; 132:CYRILLIC CAPITAL LETTER DE | ||
| 355 | #x0415 ;; 133:CYRILLIC CAPITAL LETTER IE | ||
| 356 | #x0416 ;; 134:CYRILLIC CAPITAL LETTER ZHE | ||
| 357 | #x0417 ;; 135:CYRILLIC CAPITAL LETTER ZE | ||
| 358 | #x0418 ;; 136:CYRILLIC CAPITAL LETTER I | ||
| 359 | #x0419 ;; 137:CYRILLIC CAPITAL LETTER SHORT I | ||
| 360 | #x041A ;; 138:CYRILLIC CAPITAL LETTER KA | ||
| 361 | #x041B ;; 139:CYRILLIC CAPITAL LETTER EL | ||
| 362 | #x041C ;; 140:CYRILLIC CAPITAL LETTER EM | ||
| 363 | #x041D ;; 141:CYRILLIC CAPITAL LETTER EN | ||
| 364 | #x041E ;; 142:CYRILLIC CAPITAL LETTER O | ||
| 365 | #x041F ;; 143:CYRILLIC CAPITAL LETTER PE | ||
| 366 | #x0420 ;; 144:CYRILLIC CAPITAL LETTER ER | ||
| 367 | #x0421 ;; 145:CYRILLIC CAPITAL LETTER ES | ||
| 368 | #x0422 ;; 146:CYRILLIC CAPITAL LETTER TE | ||
| 369 | #x0423 ;; 147:CYRILLIC CAPITAL LETTER U | ||
| 370 | #x0424 ;; 148:CYRILLIC CAPITAL LETTER EF | ||
| 371 | #x0425 ;; 149:CYRILLIC CAPITAL LETTER HA | ||
| 372 | #x0426 ;; 150:CYRILLIC CAPITAL LETTER TSE | ||
| 373 | #x0427 ;; 151:CYRILLIC CAPITAL LETTER CHE | ||
| 374 | #x0428 ;; 152:CYRILLIC CAPITAL LETTER SHA | ||
| 375 | #x0429 ;; 153:CYRILLIC CAPITAL LETTER SHCHA | ||
| 376 | #x042A ;; 154:CYRILLIC CAPITAL LETTER HARD SIGN | ||
| 377 | #x042B ;; 155:CYRILLIC CAPITAL LETTER YERU | ||
| 378 | #x042C ;; 156:CYRILLIC CAPITAL LETTER SOFT SIGN | ||
| 379 | #x042D ;; 157:CYRILLIC CAPITAL LETTER E | ||
| 380 | #x042E ;; 158:CYRILLIC CAPITAL LETTER YU | ||
| 381 | #x042F ;; 159:CYRILLIC CAPITAL LETTER YA | ||
| 382 | #x2020 ;; 160:DAGGER | ||
| 383 | #x00B0 ;; 161:DEGREE SIGN | ||
| 384 | #x0490 ;; 162:CYRILLIC CAPITAL LETTER GHE WITH UPTURN | ||
| 385 | #x00A3 ;; 163:POUND SIGN | ||
| 386 | #x00A7 ;; 164:SECTION SIGN | ||
| 387 | #x2022 ;; 165:BULLET | ||
| 388 | #x00B6 ;; 166:PILCROW SIGN | ||
| 389 | #x0406 ;; 167:CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I | ||
| 390 | #x00AE ;; 168:REGISTERED SIGN | ||
| 391 | #x00A9 ;; 169:COPYRIGHT SIGN | ||
| 392 | #x2122 ;; 170:TRADE MARK SIGN | ||
| 393 | #x0402 ;; 171:CYRILLIC CAPITAL LETTER DJE | ||
| 394 | #x0452 ;; 172:CYRILLIC SMALL LETTER DJE | ||
| 395 | #x2260 ;; 173:NOT EQUAL TO | ||
| 396 | #x0403 ;; 174:CYRILLIC CAPITAL LETTER GJE | ||
| 397 | #x0453 ;; 175:CYRILLIC SMALL LETTER GJE | ||
| 398 | #x221E ;; 176:INFINITY | ||
| 399 | #x00B1 ;; 177:PLUS-MINUS SIGN | ||
| 400 | #x2264 ;; 178:LESS-THAN OR EQUAL TO | ||
| 401 | #x2265 ;; 179:GREATER-THAN OR EQUAL TO | ||
| 402 | #x0456 ;; 180:CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I | ||
| 403 | #x00B5 ;; 181:MICRO SIGN | ||
| 404 | #x0491 ;; 182:CYRILLIC SMALL LETTER GHE WITH UPTURN | ||
| 405 | #x0408 ;; 183:CYRILLIC CAPITAL LETTER JE | ||
| 406 | #x0404 ;; 184:CYRILLIC CAPITAL LETTER UKRAINIAN IE | ||
| 407 | #x0454 ;; 185:CYRILLIC SMALL LETTER UKRAINIAN IE | ||
| 408 | #x0407 ;; 186:CYRILLIC CAPITAL LETTER YI | ||
| 409 | #x0457 ;; 187:CYRILLIC SMALL LETTER YI | ||
| 410 | #x0409 ;; 188:CYRILLIC CAPITAL LETTER LJE | ||
| 411 | #x0459 ;; 189:CYRILLIC SMALL LETTER LJE | ||
| 412 | #x040A ;; 190:CYRILLIC CAPITAL LETTER NJE | ||
| 413 | #x045A ;; 191:CYRILLIC SMALL LETTER NJE | ||
| 414 | #x0458 ;; 192:CYRILLIC SMALL LETTER JE | ||
| 415 | #x0405 ;; 193:CYRILLIC CAPITAL LETTER DZE | ||
| 416 | #x00AC ;; 194:NOT SIGN | ||
| 417 | #x221A ;; 195:SQUARE ROOT | ||
| 418 | #x0192 ;; 196:LATIN SMALL LETTER F WITH HOOK | ||
| 419 | #x2248 ;; 197:ALMOST EQUAL TO | ||
| 420 | #x2206 ;; 198:INCREMENT | ||
| 421 | #x00AB ;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 422 | #x00BB ;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 423 | #x2026 ;; 201:HORIZONTAL ELLIPSIS | ||
| 424 | #x00A0 ;; 202:NO-BREAK SPACE | ||
| 425 | #x040B ;; 203:CYRILLIC CAPITAL LETTER TSHE | ||
| 426 | #x045B ;; 204:CYRILLIC SMALL LETTER TSHE | ||
| 427 | #x040C ;; 205:CYRILLIC CAPITAL LETTER KJE | ||
| 428 | #x045C ;; 206:CYRILLIC SMALL LETTER KJE | ||
| 429 | #x0455 ;; 207:CYRILLIC SMALL LETTER DZE | ||
| 430 | #x2013 ;; 208:EN DASH | ||
| 431 | #x2014 ;; 209:EM DASH | ||
| 432 | #x201C ;; 210:LEFT DOUBLE QUOTATION MARK | ||
| 433 | #x201D ;; 211:RIGHT DOUBLE QUOTATION MARK | ||
| 434 | #x2018 ;; 212:LEFT SINGLE QUOTATION MARK | ||
| 435 | #x2019 ;; 213:RIGHT SINGLE QUOTATION MARK | ||
| 436 | #x00F7 ;; 214:DIVISION SIGN | ||
| 437 | #x201E ;; 215:DOUBLE LOW-9 QUOTATION MARK | ||
| 438 | #x040E ;; 216:CYRILLIC CAPITAL LETTER SHORT U | ||
| 439 | #x045E ;; 217:CYRILLIC SMALL LETTER SHORT U | ||
| 440 | #x040F ;; 218:CYRILLIC CAPITAL LETTER DZHE | ||
| 441 | #x045F ;; 219:CYRILLIC SMALL LETTER DZHE | ||
| 442 | #x2116 ;; 220:NUMERO SIGN | ||
| 443 | #x0401 ;; 221:CYRILLIC CAPITAL LETTER IO | ||
| 444 | #x0451 ;; 222:CYRILLIC SMALL LETTER IO | ||
| 445 | #x044F ;; 223:CYRILLIC SMALL LETTER YA | ||
| 446 | #x0430 ;; 224:CYRILLIC SMALL LETTER A | ||
| 447 | #x0431 ;; 225:CYRILLIC SMALL LETTER BE | ||
| 448 | #x0432 ;; 226:CYRILLIC SMALL LETTER VE | ||
| 449 | #x0433 ;; 227:CYRILLIC SMALL LETTER GHE | ||
| 450 | #x0434 ;; 228:CYRILLIC SMALL LETTER DE | ||
| 451 | #x0435 ;; 229:CYRILLIC SMALL LETTER IE | ||
| 452 | #x0436 ;; 230:CYRILLIC SMALL LETTER ZHE | ||
| 453 | #x0437 ;; 231:CYRILLIC SMALL LETTER ZE | ||
| 454 | #x0438 ;; 232:CYRILLIC SMALL LETTER I | ||
| 455 | #x0439 ;; 233:CYRILLIC SMALL LETTER SHORT I | ||
| 456 | #x043A ;; 234:CYRILLIC SMALL LETTER KA | ||
| 457 | #x043B ;; 235:CYRILLIC SMALL LETTER EL | ||
| 458 | #x043C ;; 236:CYRILLIC SMALL LETTER EM | ||
| 459 | #x043D ;; 237:CYRILLIC SMALL LETTER EN | ||
| 460 | #x043E ;; 238:CYRILLIC SMALL LETTER O | ||
| 461 | #x043F ;; 239:CYRILLIC SMALL LETTER PE | ||
| 462 | #x0440 ;; 240:CYRILLIC SMALL LETTER ER | ||
| 463 | #x0441 ;; 241:CYRILLIC SMALL LETTER ES | ||
| 464 | #x0442 ;; 242:CYRILLIC SMALL LETTER TE | ||
| 465 | #x0443 ;; 243:CYRILLIC SMALL LETTER U | ||
| 466 | #x0444 ;; 244:CYRILLIC SMALL LETTER EF | ||
| 467 | #x0445 ;; 245:CYRILLIC SMALL LETTER HA | ||
| 468 | #x0446 ;; 246:CYRILLIC SMALL LETTER TSE | ||
| 469 | #x0447 ;; 247:CYRILLIC SMALL LETTER CHE | ||
| 470 | #x0448 ;; 248:CYRILLIC SMALL LETTER SHA | ||
| 471 | #x0449 ;; 249:CYRILLIC SMALL LETTER SHCHA | ||
| 472 | #x044A ;; 250:CYRILLIC SMALL LETTER HARD SIGN | ||
| 473 | #x044B ;; 251:CYRILLIC SMALL LETTER YERU | ||
| 474 | #x044C ;; 252:CYRILLIC SMALL LETTER SOFT SIGN | ||
| 475 | #x044D ;; 253:CYRILLIC SMALL LETTER E | ||
| 476 | #x044E ;; 254:CYRILLIC SMALL LETTER YU | ||
| 477 | #x20AC ;; 255:EURO SIGN | ||
| 478 | ]) | ||
| 479 | translation-table) | ||
| 480 | (while (< i 128) | ||
| 481 | (aset encoding-vector i i) | ||
| 482 | (setq i (1+ i))) | ||
| 483 | (while (< i 256) | ||
| 484 | (aset encoding-vector i | ||
| 485 | (decode-char 'ucs (aref vec (- i 128)))) | ||
| 486 | (setq i (1+ i))) | ||
| 487 | (setq translation-table | ||
| 488 | (make-translation-table-from-vector encoding-vector)) | ||
| 489 | ;; (define-translation-table 'mac-cyrillic-decoder translation-table) | ||
| 490 | (define-translation-table 'mac-cyrillic-encoder | ||
| 491 | (char-table-extra-slot translation-table 0))) | ||
| 492 | |||
| 493 | (defvar mac-font-encoder-list | ||
| 494 | '(("mac-roman" mac-roman-encoder | ||
| 495 | ccl-encode-mac-roman-font "%s") | ||
| 496 | ("mac-centraleurroman" mac-centraleurroman-encoder | ||
| 497 | ccl-encode-mac-centraleurroman-font "%s ce") | ||
| 498 | ("mac-cyrillic" mac-cyrillic-encoder | ||
| 499 | ccl-encode-mac-cyrillic-font "%s cy"))) | ||
| 500 | |||
| 501 | (let ((encoder-list | ||
| 502 | (mapcar (lambda (lst) (nth 1 lst)) mac-font-encoder-list)) | ||
| 503 | (charset-list | ||
| 504 | '(latin-iso8859-2 | ||
| 505 | latin-iso8859-3 latin-iso8859-4 | ||
| 506 | cyrillic-iso8859-5 greek-iso8859-7 hebrew-iso8859-8 | ||
| 507 | latin-iso8859-9 latin-iso8859-14 latin-iso8859-15))) | ||
| 508 | (dolist (encoder encoder-list) | ||
| 509 | (let ((table (get encoder 'translation-table))) | ||
| 510 | (dolist (charset charset-list) | ||
| 511 | (dotimes (i 96) | ||
| 512 | (let* ((c (make-char charset (+ i 32))) | ||
| 513 | (mu (aref ucs-mule-to-mule-unicode c)) | ||
| 514 | (mac-encoded (and mu (aref table mu)))) | ||
| 515 | (if mac-encoded | ||
| 516 | (aset table c mac-encoded)))))))) | ||
| 517 | |||
| 518 | (define-ccl-program ccl-encode-mac-centraleurroman-font | ||
| 519 | `(0 | ||
| 520 | (if (r0 != ,(charset-id 'ascii)) | ||
| 521 | (if (r0 <= ?\x8f) | ||
| 522 | (translate-character mac-centraleurroman-encoder r0 r1) | ||
| 523 | ((r1 <<= 7) | ||
| 524 | (r1 |= r2) | ||
| 525 | (translate-character mac-centraleurroman-encoder r0 r1))))) | ||
| 526 | "CCL program for Mac Central European Roman font") | ||
| 527 | |||
| 528 | (define-ccl-program ccl-encode-mac-cyrillic-font | ||
| 529 | `(0 | ||
| 530 | (if (r0 != ,(charset-id 'ascii)) | ||
| 531 | (if (r0 <= ?\x8f) | ||
| 532 | (translate-character mac-cyrillic-encoder r0 r1) | ||
| 533 | ((r1 <<= 7) | ||
| 534 | (r1 |= r2) | ||
| 535 | (translate-character mac-cyrillic-encoder r0 r1))))) | ||
| 536 | "CCL program for Mac Cyrillic font") | ||
| 537 | |||
| 538 | |||
| 539 | (setq font-ccl-encoder-alist | ||
| 540 | (nconc | ||
| 541 | (mapcar (lambda (lst) (cons (nth 0 lst) (nth 2 lst))) | ||
| 542 | mac-font-encoder-list) | ||
| 543 | font-ccl-encoder-alist)) | ||
| 544 | |||
| 545 | (defun fontset-add-mac-fonts (fontset &optional base-family) | ||
| 546 | (if base-family | ||
| 547 | (setq base-family (downcase base-family)) | ||
| 548 | (let ((ascii-font | ||
| 549 | (downcase (x-resolve-font-name | ||
| 550 | (fontset-font fontset (charset-id 'ascii)))))) | ||
| 551 | (setq base-family (aref (x-decompose-font-name ascii-font) | ||
| 552 | xlfd-regexp-family-subnum)))) | ||
| 553 | ;; (if (not (string-match "^fontset-" fontset)) | ||
| 554 | ;; (setq fontset | ||
| 555 | ;; (concat "fontset-" (aref (x-decompose-font-name fontset) | ||
| 556 | ;; xlfd-regexp-encoding-subnum)))) | ||
| 557 | (dolist | ||
| 558 | (font-encoder | ||
| 559 | (nreverse | ||
| 560 | (mapcar (lambda (lst) | ||
| 561 | (cons (cons (format (nth 3 lst) base-family) (nth 0 lst)) | ||
| 562 | (nth 1 lst))) | ||
| 563 | mac-font-encoder-list))) | ||
| 564 | (let ((font (car font-encoder)) | ||
| 565 | (encoder (cdr font-encoder))) | ||
| 566 | (map-char-table | ||
| 567 | (lambda (key val) | ||
| 568 | (or (null val) | ||
| 569 | (generic-char-p key) | ||
| 570 | (memq (char-charset key) | ||
| 571 | '(ascii eight-bit-control eight-bit-graphic)) | ||
| 572 | (set-fontset-font fontset key font))) | ||
| 573 | (get encoder 'translation-table))))) | ||
| 574 | |||
| 575 | (defun create-fontset-from-mac-roman-font (font &optional resolved-font | ||
| 576 | fontset-name) | ||
| 577 | "Create a fontset from a Mac roman font FONT. | ||
| 578 | |||
| 579 | Optional 1st arg RESOLVED-FONT is a resolved name of FONT. If | ||
| 580 | omitted, `x-resolve-font-name' is called to get the resolved name. At | ||
| 581 | this time, if FONT is not available, error is signaled. | ||
| 582 | |||
| 583 | Optional 2nd arg FONTSET-NAME is a string to be used in | ||
| 584 | `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted, | ||
| 585 | an appropriate name is generated automatically. | ||
| 586 | |||
| 587 | It returns a name of the created fontset." | ||
| 588 | (let ((fontset | ||
| 589 | (create-fontset-from-ascii-font font resolved-font fontset-name))) | ||
| 590 | (fontset-add-mac-fonts fontset) | ||
| 591 | fontset)) | ||
| 592 | |||
| 593 | ;; Create a fontset that uses mac-roman font. With this fontset, | ||
| 594 | ;; characters decoded from mac-roman encoding (ascii, latin-iso8859-1, | ||
| 595 | ;; and mule-unicode-xxxx-yyyy) are displayed by a mac-roman font. | ||
| 596 | |||
| 597 | (if (fboundp 'new-fontset) | ||
| 598 | (progn | ||
| 599 | (require 'fontset) | ||
| 600 | (setup-default-fontset) | ||
| 601 | (create-fontset-from-fontset-spec | ||
| 602 | "-etl-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-mac, | ||
| 603 | ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman") | ||
| 604 | (fontset-add-mac-fonts "fontset-mac"))) | ||
| 605 | |||
| 606 | (if (eq system-type 'darwin) | ||
| 607 | ;; On Darwin filenames are encoded in UTF-8 | ||
| 608 | (setq file-name-coding-system 'utf-8) | ||
| 609 | ;; To display filenames in Chinese or Japanese, replace mac-roman with | ||
| 610 | ;; big5 or sjis | ||
| 611 | (setq file-name-coding-system 'mac-roman)) | ||
| 612 | |||
| 613 | ;; If Emacs is started from the Finder, change the default directory | ||
| 614 | ;; to the user's home directory. | ||
| 615 | (if (string= default-directory "/") | ||
| 616 | (cd "~")) | ||
| 617 | |||
| 618 | ;; Tell Emacs to use pipes instead of pty's for processes because the | ||
| 619 | ;; latter sometimes lose characters. Pty support is compiled in since | ||
| 620 | ;; ange-ftp will not work without it. | ||
| 621 | (setq process-connection-type nil) | ||
| 622 | |||
| 623 | ;; Assume that fonts are always scalable on the Mac. This sometimes | ||
| 624 | ;; results in characters with jagged edges. However, without it, | ||
| 625 | ;; fonts with both truetype and bitmap representations but no italic | ||
| 626 | ;; or bold bitmap versions will not display these variants correctly. | ||
| 627 | (setq scalable-fonts-allowed t) | ||
| 628 | |||
| 629 | ;; Make suspend-emacs [C-z] collapse the current frame | ||
| 630 | (substitute-key-definition 'suspend-emacs 'iconify-frame | ||
| 631 | global-map) | ||
| 632 | |||
| 633 | ;; Support mouse-wheel scrolling | ||
| 634 | (mouse-wheel-mode 1) | ||
| 635 | |||
| 636 | ;; (prefer-coding-system 'mac-roman) | ||
| 637 | |||
| 638 | ;; Map certain keypad keys into ASCII characters that people usually expect | ||
| 639 | (define-key function-key-map [return] [?\C-m]) | ||
| 640 | (define-key function-key-map [M-return] [?\M-\C-m]) | ||
| 641 | (define-key function-key-map [tab] [?\t]) | ||
| 642 | (define-key function-key-map [M-tab] [?\M-\t]) | ||
| 643 | (define-key function-key-map [backspace] [127]) | ||
| 644 | (define-key function-key-map [M-backspace] [?\M-\d]) | ||
| 645 | (define-key function-key-map [escape] [?\e]) | ||
| 646 | (define-key function-key-map [M-escape] [?\M-\e]) | ||
| 647 | |||
| 648 | ;; Tell read-char how to convert special chars to ASCII | ||
| 649 | (put 'return 'ascii-character 13) | ||
| 650 | (put 'tab 'ascii-character ?\t) | ||
| 651 | (put 'backspace 'ascii-character 127) | ||
| 652 | (put 'escape 'ascii-character ?\e) | ||
| 653 | 187 | ||
| 188 | (defun x-handle-args (args) | ||
| 189 | "Process the X-related command line options in ARGS. | ||
| 190 | This is done before the user's startup file is loaded. They are copied to | ||
| 191 | `x-invocation-args', from which the X-related things are extracted, first | ||
| 192 | the switch (e.g., \"-fg\") in the following code, and possible values | ||
| 193 | \(e.g., \"black\") in the option handler code (e.g., x-handle-switch). | ||
| 194 | This function returns ARGS minus the arguments that have been processed." | ||
| 195 | ;; We use ARGS to accumulate the args that we don't handle here, to return. | ||
| 196 | (setq x-invocation-args args | ||
| 197 | args nil) | ||
| 198 | (while (and x-invocation-args | ||
| 199 | (not (equal (car x-invocation-args) "--"))) | ||
| 200 | (let* ((this-switch (car x-invocation-args)) | ||
| 201 | (orig-this-switch this-switch) | ||
| 202 | completion argval aelt handler) | ||
| 203 | (setq x-invocation-args (cdr x-invocation-args)) | ||
| 204 | ;; Check for long options with attached arguments | ||
| 205 | ;; and separate out the attached option argument into argval. | ||
| 206 | (if (string-match "^--[^=]*=" this-switch) | ||
| 207 | (setq argval (substring this-switch (match-end 0)) | ||
| 208 | this-switch (substring this-switch 0 (1- (match-end 0))))) | ||
| 209 | ;; Complete names of long options. | ||
| 210 | (if (string-match "^--" this-switch) | ||
| 211 | (progn | ||
| 212 | (setq completion (try-completion this-switch command-line-x-option-alist)) | ||
| 213 | (if (eq completion t) | ||
| 214 | ;; Exact match for long option. | ||
| 215 | nil | ||
| 216 | (if (stringp completion) | ||
| 217 | (let ((elt (assoc completion command-line-x-option-alist))) | ||
| 218 | ;; Check for abbreviated long option. | ||
| 219 | (or elt | ||
| 220 | (error "Option `%s' is ambiguous" this-switch)) | ||
| 221 | (setq this-switch completion)))))) | ||
| 222 | (setq aelt (assoc this-switch command-line-x-option-alist)) | ||
| 223 | (if aelt (setq handler (nth 2 aelt))) | ||
| 224 | (if handler | ||
| 225 | (if argval | ||
| 226 | (let ((x-invocation-args | ||
| 227 | (cons argval x-invocation-args))) | ||
| 228 | (funcall handler this-switch)) | ||
| 229 | (funcall handler this-switch)) | ||
| 230 | (setq args (cons orig-this-switch args))))) | ||
| 231 | (nconc (nreverse args) x-invocation-args)) | ||
| 232 | |||
| 654 | ;; | 233 | ;; |
| 655 | ;; Available colors | 234 | ;; Available colors |
| 656 | ;; | 235 | ;; |
| @@ -1407,8 +986,723 @@ ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman") | |||
| 1407 | "GhostWhite" | 986 | "GhostWhite" |
| 1408 | "ghost white" | 987 | "ghost white" |
| 1409 | "snow") | 988 | "snow") |
| 1410 | "The list of X colors from the `rgb.txt' file. | 989 | "The list of X colors from the `rgb.txt' file. |
| 1411 | XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") | 990 | XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp") |
| 1412 | 991 | ||
| 992 | (defun xw-defined-colors (&optional frame) | ||
| 993 | "Internal function called by `defined-colors', which see." | ||
| 994 | (or frame (setq frame (selected-frame))) | ||
| 995 | (let ((all-colors x-colors) | ||
| 996 | (this-color nil) | ||
| 997 | (defined-colors nil)) | ||
| 998 | (while all-colors | ||
| 999 | (setq this-color (car all-colors) | ||
| 1000 | all-colors (cdr all-colors)) | ||
| 1001 | (and (color-supported-p this-color frame t) | ||
| 1002 | (setq defined-colors (cons this-color defined-colors)))) | ||
| 1003 | defined-colors)) | ||
| 1004 | |||
| 1005 | ;;;; Function keys | ||
| 1006 | |||
| 1007 | (substitute-key-definition 'suspend-emacs 'iconify-or-deiconify-frame | ||
| 1008 | global-map) | ||
| 1009 | |||
| 1010 | ;; Map certain keypad keys into ASCII characters | ||
| 1011 | ;; that people usually expect. | ||
| 1012 | (define-key function-key-map [return] [?\C-m]) | ||
| 1013 | (define-key function-key-map [M-return] [?\M-\C-m]) | ||
| 1014 | (define-key function-key-map [tab] [?\t]) | ||
| 1015 | (define-key function-key-map [M-tab] [?\M-\t]) | ||
| 1016 | (define-key function-key-map [backspace] [127]) | ||
| 1017 | (define-key function-key-map [M-backspace] [?\M-\d]) | ||
| 1018 | (define-key function-key-map [escape] [?\e]) | ||
| 1019 | (define-key function-key-map [M-escape] [?\M-\e]) | ||
| 1020 | |||
| 1021 | ;; These tell read-char how to convert | ||
| 1022 | ;; these special chars to ASCII. | ||
| 1023 | (put 'return 'ascii-character 13) | ||
| 1024 | (put 'tab 'ascii-character ?\t) | ||
| 1025 | (put 'backspace 'ascii-character 127) | ||
| 1026 | (put 'escape 'ascii-character ?\e) | ||
| 1027 | |||
| 1028 | |||
| 1029 | ;;;; Keysyms | ||
| 1030 | |||
| 1031 | ;; Define constant values to be set to mac-keyboard-text-encoding | ||
| 1032 | (defconst kTextEncodingMacRoman 0) | ||
| 1033 | (defconst kTextEncodingISOLatin1 513 "0x201") | ||
| 1034 | (defconst kTextEncodingISOLatin2 514 "0x202") | ||
| 1035 | |||
| 1036 | |||
| 1037 | ;;;; Selections and cut buffers | ||
| 1038 | |||
| 1039 | ;; Setup to use the Mac clipboard. The functions mac-cut-function and | ||
| 1040 | ;; mac-paste-function are defined in mac.c. | ||
| 1041 | (set-selection-coding-system 'compound-text-mac) | ||
| 1042 | |||
| 1043 | (setq interprogram-cut-function | ||
| 1044 | '(lambda (str push) | ||
| 1045 | (mac-cut-function | ||
| 1046 | (encode-coding-string str selection-coding-system t) push))) | ||
| 1047 | |||
| 1048 | (setq interprogram-paste-function | ||
| 1049 | '(lambda () | ||
| 1050 | (let ((clipboard (mac-paste-function))) | ||
| 1051 | (if clipboard | ||
| 1052 | (decode-coding-string clipboard selection-coding-system t))))) | ||
| 1053 | |||
| 1054 | |||
| 1055 | ;;; Do the actual Windows setup here; the above code just defines | ||
| 1056 | ;;; functions and variables that we use now. | ||
| 1057 | |||
| 1058 | (setq command-line-args (x-handle-args command-line-args)) | ||
| 1059 | |||
| 1060 | ;;; Make sure we have a valid resource name. | ||
| 1061 | (or (stringp x-resource-name) | ||
| 1062 | (let (i) | ||
| 1063 | (setq x-resource-name (invocation-name)) | ||
| 1064 | |||
| 1065 | ;; Change any . or * characters in x-resource-name to hyphens, | ||
| 1066 | ;; so as not to choke when we use it in X resource queries. | ||
| 1067 | (while (setq i (string-match "[.*]" x-resource-name)) | ||
| 1068 | (aset x-resource-name i ?-)))) | ||
| 1069 | |||
| 1070 | (if (x-display-list) | ||
| 1071 | ;; On Mac OS 8/9, Most coding systems used in code conversion for | ||
| 1072 | ;; font names are not ready at the time when the terminal frame is | ||
| 1073 | ;; created. So we reconstruct font name table for the initial | ||
| 1074 | ;; frame. | ||
| 1075 | (mac-clear-font-name-table) | ||
| 1076 | (x-open-connection "Mac" | ||
| 1077 | x-command-line-resources | ||
| 1078 | ;; Exit Emacs with fatal error if this fails. | ||
| 1079 | t)) | ||
| 1080 | |||
| 1081 | (setq frame-creation-function 'x-create-frame-with-faces) | ||
| 1082 | |||
| 1083 | (define-ccl-program ccl-encode-mac-roman-font | ||
| 1084 | `(0 | ||
| 1085 | (if (r0 != ,(charset-id 'ascii)) | ||
| 1086 | (if (r0 <= ?\x8f) | ||
| 1087 | (translate-character mac-roman-encoder r0 r1) | ||
| 1088 | ((r1 <<= 7) | ||
| 1089 | (r1 |= r2) | ||
| 1090 | (translate-character mac-roman-encoder r0 r1))))) | ||
| 1091 | "CCL program for Mac Roman font") | ||
| 1092 | |||
| 1093 | (let | ||
| 1094 | ((encoding-vector (make-vector 256 nil)) | ||
| 1095 | (i 0) | ||
| 1096 | (vec ;; mac-centraleurroman (128..255) -> UCS mapping | ||
| 1097 | [ #x00C4 ;; 128:LATIN CAPITAL LETTER A WITH DIAERESIS | ||
| 1098 | #x0100 ;; 129:LATIN CAPITAL LETTER A WITH MACRON | ||
| 1099 | #x0101 ;; 130:LATIN SMALL LETTER A WITH MACRON | ||
| 1100 | #x00C9 ;; 131:LATIN CAPITAL LETTER E WITH ACUTE | ||
| 1101 | #x0104 ;; 132:LATIN CAPITAL LETTER A WITH OGONEK | ||
| 1102 | #x00D6 ;; 133:LATIN CAPITAL LETTER O WITH DIAERESIS | ||
| 1103 | #x00DC ;; 134:LATIN CAPITAL LETTER U WITH DIAERESIS | ||
| 1104 | #x00E1 ;; 135:LATIN SMALL LETTER A WITH ACUTE | ||
| 1105 | #x0105 ;; 136:LATIN SMALL LETTER A WITH OGONEK | ||
| 1106 | #x010C ;; 137:LATIN CAPITAL LETTER C WITH CARON | ||
| 1107 | #x00E4 ;; 138:LATIN SMALL LETTER A WITH DIAERESIS | ||
| 1108 | #x010D ;; 139:LATIN SMALL LETTER C WITH CARON | ||
| 1109 | #x0106 ;; 140:LATIN CAPITAL LETTER C WITH ACUTE | ||
| 1110 | #x0107 ;; 141:LATIN SMALL LETTER C WITH ACUTE | ||
| 1111 | #x00E9 ;; 142:LATIN SMALL LETTER E WITH ACUTE | ||
| 1112 | #x0179 ;; 143:LATIN CAPITAL LETTER Z WITH ACUTE | ||
| 1113 | #x017A ;; 144:LATIN SMALL LETTER Z WITH ACUTE | ||
| 1114 | #x010E ;; 145:LATIN CAPITAL LETTER D WITH CARON | ||
| 1115 | #x00ED ;; 146:LATIN SMALL LETTER I WITH ACUTE | ||
| 1116 | #x010F ;; 147:LATIN SMALL LETTER D WITH CARON | ||
| 1117 | #x0112 ;; 148:LATIN CAPITAL LETTER E WITH MACRON | ||
| 1118 | #x0113 ;; 149:LATIN SMALL LETTER E WITH MACRON | ||
| 1119 | #x0116 ;; 150:LATIN CAPITAL LETTER E WITH DOT ABOVE | ||
| 1120 | #x00F3 ;; 151:LATIN SMALL LETTER O WITH ACUTE | ||
| 1121 | #x0117 ;; 152:LATIN SMALL LETTER E WITH DOT ABOVE | ||
| 1122 | #x00F4 ;; 153:LATIN SMALL LETTER O WITH CIRCUMFLEX | ||
| 1123 | #x00F6 ;; 154:LATIN SMALL LETTER O WITH DIAERESIS | ||
| 1124 | #x00F5 ;; 155:LATIN SMALL LETTER O WITH TILDE | ||
| 1125 | #x00FA ;; 156:LATIN SMALL LETTER U WITH ACUTE | ||
| 1126 | #x011A ;; 157:LATIN CAPITAL LETTER E WITH CARON | ||
| 1127 | #x011B ;; 158:LATIN SMALL LETTER E WITH CARON | ||
| 1128 | #x00FC ;; 159:LATIN SMALL LETTER U WITH DIAERESIS | ||
| 1129 | #x2020 ;; 160:DAGGER | ||
| 1130 | #x00B0 ;; 161:DEGREE SIGN | ||
| 1131 | #x0118 ;; 162:LATIN CAPITAL LETTER E WITH OGONEK | ||
| 1132 | #x00A3 ;; 163:POUND SIGN | ||
| 1133 | #x00A7 ;; 164:SECTION SIGN | ||
| 1134 | #x2022 ;; 165:BULLET | ||
| 1135 | #x00B6 ;; 166:PILCROW SIGN | ||
| 1136 | #x00DF ;; 167:LATIN SMALL LETTER SHARP S | ||
| 1137 | #x00AE ;; 168:REGISTERED SIGN | ||
| 1138 | #x00A9 ;; 169:COPYRIGHT SIGN | ||
| 1139 | #x2122 ;; 170:TRADE MARK SIGN | ||
| 1140 | #x0119 ;; 171:LATIN SMALL LETTER E WITH OGONEK | ||
| 1141 | #x00A8 ;; 172:DIAERESIS | ||
| 1142 | #x2260 ;; 173:NOT EQUAL TO | ||
| 1143 | #x0123 ;; 174:LATIN SMALL LETTER G WITH CEDILLA | ||
| 1144 | #x012E ;; 175:LATIN CAPITAL LETTER I WITH OGONEK | ||
| 1145 | #x012F ;; 176:LATIN SMALL LETTER I WITH OGONEK | ||
| 1146 | #x012A ;; 177:LATIN CAPITAL LETTER I WITH MACRON | ||
| 1147 | #x2264 ;; 178:LESS-THAN OR EQUAL TO | ||
| 1148 | #x2265 ;; 179:GREATER-THAN OR EQUAL TO | ||
| 1149 | #x012B ;; 180:LATIN SMALL LETTER I WITH MACRON | ||
| 1150 | #x0136 ;; 181:LATIN CAPITAL LETTER K WITH CEDILLA | ||
| 1151 | #x2202 ;; 182:PARTIAL DIFFERENTIAL | ||
| 1152 | #x2211 ;; 183:N-ARY SUMMATION | ||
| 1153 | #x0142 ;; 184:LATIN SMALL LETTER L WITH STROKE | ||
| 1154 | #x013B ;; 185:LATIN CAPITAL LETTER L WITH CEDILLA | ||
| 1155 | #x013C ;; 186:LATIN SMALL LETTER L WITH CEDILLA | ||
| 1156 | #x013D ;; 187:LATIN CAPITAL LETTER L WITH CARON | ||
| 1157 | #x013E ;; 188:LATIN SMALL LETTER L WITH CARON | ||
| 1158 | #x0139 ;; 189:LATIN CAPITAL LETTER L WITH ACUTE | ||
| 1159 | #x013A ;; 190:LATIN SMALL LETTER L WITH ACUTE | ||
| 1160 | #x0145 ;; 191:LATIN CAPITAL LETTER N WITH CEDILLA | ||
| 1161 | #x0146 ;; 192:LATIN SMALL LETTER N WITH CEDILLA | ||
| 1162 | #x0143 ;; 193:LATIN CAPITAL LETTER N WITH ACUTE | ||
| 1163 | #x00AC ;; 194:NOT SIGN | ||
| 1164 | #x221A ;; 195:SQUARE ROOT | ||
| 1165 | #x0144 ;; 196:LATIN SMALL LETTER N WITH ACUTE | ||
| 1166 | #x0147 ;; 197:LATIN CAPITAL LETTER N WITH CARON | ||
| 1167 | #x2206 ;; 198:INCREMENT | ||
| 1168 | #x00AB ;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 1169 | #x00BB ;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 1170 | #x2026 ;; 201:HORIZONTAL ELLIPSIS | ||
| 1171 | #x00A0 ;; 202:NO-BREAK SPACE | ||
| 1172 | #x0148 ;; 203:LATIN SMALL LETTER N WITH CARON | ||
| 1173 | #x0150 ;; 204:LATIN CAPITAL LETTER O WITH DOUBLE ACUTE | ||
| 1174 | #x00D5 ;; 205:LATIN CAPITAL LETTER O WITH TILDE | ||
| 1175 | #x0151 ;; 206:LATIN SMALL LETTER O WITH DOUBLE ACUTE | ||
| 1176 | #x014C ;; 207:LATIN CAPITAL LETTER O WITH MACRON | ||
| 1177 | #x2013 ;; 208:EN DASH | ||
| 1178 | #x2014 ;; 209:EM DASH | ||
| 1179 | #x201C ;; 210:LEFT DOUBLE QUOTATION MARK | ||
| 1180 | #x201D ;; 211:RIGHT DOUBLE QUOTATION MARK | ||
| 1181 | #x2018 ;; 212:LEFT SINGLE QUOTATION MARK | ||
| 1182 | #x2019 ;; 213:RIGHT SINGLE QUOTATION MARK | ||
| 1183 | #x00F7 ;; 214:DIVISION SIGN | ||
| 1184 | #x25CA ;; 215:LOZENGE | ||
| 1185 | #x014D ;; 216:LATIN SMALL LETTER O WITH MACRON | ||
| 1186 | #x0154 ;; 217:LATIN CAPITAL LETTER R WITH ACUTE | ||
| 1187 | #x0155 ;; 218:LATIN SMALL LETTER R WITH ACUTE | ||
| 1188 | #x0158 ;; 219:LATIN CAPITAL LETTER R WITH CARON | ||
| 1189 | #x2039 ;; 220:SINGLE LEFT-POINTING ANGLE QUOTATION MARK | ||
| 1190 | #x203A ;; 221:SINGLE RIGHT-POINTING ANGLE QUOTATION MARK | ||
| 1191 | #x0159 ;; 222:LATIN SMALL LETTER R WITH CARON | ||
| 1192 | #x0156 ;; 223:LATIN CAPITAL LETTER R WITH CEDILLA | ||
| 1193 | #x0157 ;; 224:LATIN SMALL LETTER R WITH CEDILLA | ||
| 1194 | #x0160 ;; 225:LATIN CAPITAL LETTER S WITH CARON | ||
| 1195 | #x201A ;; 226:SINGLE LOW-9 QUOTATION MARK | ||
| 1196 | #x201E ;; 227:DOUBLE LOW-9 QUOTATION MARK | ||
| 1197 | #x0161 ;; 228:LATIN SMALL LETTER S WITH CARON | ||
| 1198 | #x015A ;; 229:LATIN CAPITAL LETTER S WITH ACUTE | ||
| 1199 | #x015B ;; 230:LATIN SMALL LETTER S WITH ACUTE | ||
| 1200 | #x00C1 ;; 231:LATIN CAPITAL LETTER A WITH ACUTE | ||
| 1201 | #x0164 ;; 232:LATIN CAPITAL LETTER T WITH CARON | ||
| 1202 | #x0165 ;; 233:LATIN SMALL LETTER T WITH CARON | ||
| 1203 | #x00CD ;; 234:LATIN CAPITAL LETTER I WITH ACUTE | ||
| 1204 | #x017D ;; 235:LATIN CAPITAL LETTER Z WITH CARON | ||
| 1205 | #x017E ;; 236:LATIN SMALL LETTER Z WITH CARON | ||
| 1206 | #x016A ;; 237:LATIN CAPITAL LETTER U WITH MACRON | ||
| 1207 | #x00D3 ;; 238:LATIN CAPITAL LETTER O WITH ACUTE | ||
| 1208 | #x00D4 ;; 239:LATIN CAPITAL LETTER O WITH CIRCUMFLEX | ||
| 1209 | #x016B ;; 240:LATIN SMALL LETTER U WITH MACRON | ||
| 1210 | #x016E ;; 241:LATIN CAPITAL LETTER U WITH RING ABOVE | ||
| 1211 | #x00DA ;; 242:LATIN CAPITAL LETTER U WITH ACUTE | ||
| 1212 | #x016F ;; 243:LATIN SMALL LETTER U WITH RING ABOVE | ||
| 1213 | #x0170 ;; 244:LATIN CAPITAL LETTER U WITH DOUBLE ACUTE | ||
| 1214 | #x0171 ;; 245:LATIN SMALL LETTER U WITH DOUBLE ACUTE | ||
| 1215 | #x0172 ;; 246:LATIN CAPITAL LETTER U WITH OGONEK | ||
| 1216 | #x0173 ;; 247:LATIN SMALL LETTER U WITH OGONEK | ||
| 1217 | #x00DD ;; 248:LATIN CAPITAL LETTER Y WITH ACUTE | ||
| 1218 | #x00FD ;; 249:LATIN SMALL LETTER Y WITH ACUTE | ||
| 1219 | #x0137 ;; 250:LATIN SMALL LETTER K WITH CEDILLA | ||
| 1220 | #x017B ;; 251:LATIN CAPITAL LETTER Z WITH DOT ABOVE | ||
| 1221 | #x0141 ;; 252:LATIN CAPITAL LETTER L WITH STROKE | ||
| 1222 | #x017C ;; 253:LATIN SMALL LETTER Z WITH DOT ABOVE | ||
| 1223 | #x0122 ;; 254:LATIN CAPITAL LETTER G WITH CEDILLA | ||
| 1224 | #x02C7 ;; 255:CARON | ||
| 1225 | ]) | ||
| 1226 | translation-table) | ||
| 1227 | (while (< i 128) | ||
| 1228 | (aset encoding-vector i i) | ||
| 1229 | (setq i (1+ i))) | ||
| 1230 | (while (< i 256) | ||
| 1231 | (aset encoding-vector i | ||
| 1232 | (decode-char 'ucs (aref vec (- i 128)))) | ||
| 1233 | (setq i (1+ i))) | ||
| 1234 | (setq translation-table | ||
| 1235 | (make-translation-table-from-vector encoding-vector)) | ||
| 1236 | ;; (define-translation-table 'mac-centraleurroman-decoder translation-table) | ||
| 1237 | (define-translation-table 'mac-centraleurroman-encoder | ||
| 1238 | (char-table-extra-slot translation-table 0))) | ||
| 1239 | |||
| 1240 | (let | ||
| 1241 | ((encoding-vector (make-vector 256 nil)) | ||
| 1242 | (i 0) | ||
| 1243 | (vec ;; mac-cyrillic (128..255) -> UCS mapping | ||
| 1244 | [ #x0410 ;; 128:CYRILLIC CAPITAL LETTER A | ||
| 1245 | #x0411 ;; 129:CYRILLIC CAPITAL LETTER BE | ||
| 1246 | #x0412 ;; 130:CYRILLIC CAPITAL LETTER VE | ||
| 1247 | #x0413 ;; 131:CYRILLIC CAPITAL LETTER GHE | ||
| 1248 | #x0414 ;; 132:CYRILLIC CAPITAL LETTER DE | ||
| 1249 | #x0415 ;; 133:CYRILLIC CAPITAL LETTER IE | ||
| 1250 | #x0416 ;; 134:CYRILLIC CAPITAL LETTER ZHE | ||
| 1251 | #x0417 ;; 135:CYRILLIC CAPITAL LETTER ZE | ||
| 1252 | #x0418 ;; 136:CYRILLIC CAPITAL LETTER I | ||
| 1253 | #x0419 ;; 137:CYRILLIC CAPITAL LETTER SHORT I | ||
| 1254 | #x041A ;; 138:CYRILLIC CAPITAL LETTER KA | ||
| 1255 | #x041B ;; 139:CYRILLIC CAPITAL LETTER EL | ||
| 1256 | #x041C ;; 140:CYRILLIC CAPITAL LETTER EM | ||
| 1257 | #x041D ;; 141:CYRILLIC CAPITAL LETTER EN | ||
| 1258 | #x041E ;; 142:CYRILLIC CAPITAL LETTER O | ||
| 1259 | #x041F ;; 143:CYRILLIC CAPITAL LETTER PE | ||
| 1260 | #x0420 ;; 144:CYRILLIC CAPITAL LETTER ER | ||
| 1261 | #x0421 ;; 145:CYRILLIC CAPITAL LETTER ES | ||
| 1262 | #x0422 ;; 146:CYRILLIC CAPITAL LETTER TE | ||
| 1263 | #x0423 ;; 147:CYRILLIC CAPITAL LETTER U | ||
| 1264 | #x0424 ;; 148:CYRILLIC CAPITAL LETTER EF | ||
| 1265 | #x0425 ;; 149:CYRILLIC CAPITAL LETTER HA | ||
| 1266 | #x0426 ;; 150:CYRILLIC CAPITAL LETTER TSE | ||
| 1267 | #x0427 ;; 151:CYRILLIC CAPITAL LETTER CHE | ||
| 1268 | #x0428 ;; 152:CYRILLIC CAPITAL LETTER SHA | ||
| 1269 | #x0429 ;; 153:CYRILLIC CAPITAL LETTER SHCHA | ||
| 1270 | #x042A ;; 154:CYRILLIC CAPITAL LETTER HARD SIGN | ||
| 1271 | #x042B ;; 155:CYRILLIC CAPITAL LETTER YERU | ||
| 1272 | #x042C ;; 156:CYRILLIC CAPITAL LETTER SOFT SIGN | ||
| 1273 | #x042D ;; 157:CYRILLIC CAPITAL LETTER E | ||
| 1274 | #x042E ;; 158:CYRILLIC CAPITAL LETTER YU | ||
| 1275 | #x042F ;; 159:CYRILLIC CAPITAL LETTER YA | ||
| 1276 | #x2020 ;; 160:DAGGER | ||
| 1277 | #x00B0 ;; 161:DEGREE SIGN | ||
| 1278 | #x0490 ;; 162:CYRILLIC CAPITAL LETTER GHE WITH UPTURN | ||
| 1279 | #x00A3 ;; 163:POUND SIGN | ||
| 1280 | #x00A7 ;; 164:SECTION SIGN | ||
| 1281 | #x2022 ;; 165:BULLET | ||
| 1282 | #x00B6 ;; 166:PILCROW SIGN | ||
| 1283 | #x0406 ;; 167:CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I | ||
| 1284 | #x00AE ;; 168:REGISTERED SIGN | ||
| 1285 | #x00A9 ;; 169:COPYRIGHT SIGN | ||
| 1286 | #x2122 ;; 170:TRADE MARK SIGN | ||
| 1287 | #x0402 ;; 171:CYRILLIC CAPITAL LETTER DJE | ||
| 1288 | #x0452 ;; 172:CYRILLIC SMALL LETTER DJE | ||
| 1289 | #x2260 ;; 173:NOT EQUAL TO | ||
| 1290 | #x0403 ;; 174:CYRILLIC CAPITAL LETTER GJE | ||
| 1291 | #x0453 ;; 175:CYRILLIC SMALL LETTER GJE | ||
| 1292 | #x221E ;; 176:INFINITY | ||
| 1293 | #x00B1 ;; 177:PLUS-MINUS SIGN | ||
| 1294 | #x2264 ;; 178:LESS-THAN OR EQUAL TO | ||
| 1295 | #x2265 ;; 179:GREATER-THAN OR EQUAL TO | ||
| 1296 | #x0456 ;; 180:CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I | ||
| 1297 | #x00B5 ;; 181:MICRO SIGN | ||
| 1298 | #x0491 ;; 182:CYRILLIC SMALL LETTER GHE WITH UPTURN | ||
| 1299 | #x0408 ;; 183:CYRILLIC CAPITAL LETTER JE | ||
| 1300 | #x0404 ;; 184:CYRILLIC CAPITAL LETTER UKRAINIAN IE | ||
| 1301 | #x0454 ;; 185:CYRILLIC SMALL LETTER UKRAINIAN IE | ||
| 1302 | #x0407 ;; 186:CYRILLIC CAPITAL LETTER YI | ||
| 1303 | #x0457 ;; 187:CYRILLIC SMALL LETTER YI | ||
| 1304 | #x0409 ;; 188:CYRILLIC CAPITAL LETTER LJE | ||
| 1305 | #x0459 ;; 189:CYRILLIC SMALL LETTER LJE | ||
| 1306 | #x040A ;; 190:CYRILLIC CAPITAL LETTER NJE | ||
| 1307 | #x045A ;; 191:CYRILLIC SMALL LETTER NJE | ||
| 1308 | #x0458 ;; 192:CYRILLIC SMALL LETTER JE | ||
| 1309 | #x0405 ;; 193:CYRILLIC CAPITAL LETTER DZE | ||
| 1310 | #x00AC ;; 194:NOT SIGN | ||
| 1311 | #x221A ;; 195:SQUARE ROOT | ||
| 1312 | #x0192 ;; 196:LATIN SMALL LETTER F WITH HOOK | ||
| 1313 | #x2248 ;; 197:ALMOST EQUAL TO | ||
| 1314 | #x2206 ;; 198:INCREMENT | ||
| 1315 | #x00AB ;; 199:LEFT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 1316 | #x00BB ;; 200:RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK | ||
| 1317 | #x2026 ;; 201:HORIZONTAL ELLIPSIS | ||
| 1318 | #x00A0 ;; 202:NO-BREAK SPACE | ||
| 1319 | #x040B ;; 203:CYRILLIC CAPITAL LETTER TSHE | ||
| 1320 | #x045B ;; 204:CYRILLIC SMALL LETTER TSHE | ||
| 1321 | #x040C ;; 205:CYRILLIC CAPITAL LETTER KJE | ||
| 1322 | #x045C ;; 206:CYRILLIC SMALL LETTER KJE | ||
| 1323 | #x0455 ;; 207:CYRILLIC SMALL LETTER DZE | ||
| 1324 | #x2013 ;; 208:EN DASH | ||
| 1325 | #x2014 ;; 209:EM DASH | ||
| 1326 | #x201C ;; 210:LEFT DOUBLE QUOTATION MARK | ||
| 1327 | #x201D ;; 211:RIGHT DOUBLE QUOTATION MARK | ||
| 1328 | #x2018 ;; 212:LEFT SINGLE QUOTATION MARK | ||
| 1329 | #x2019 ;; 213:RIGHT SINGLE QUOTATION MARK | ||
| 1330 | #x00F7 ;; 214:DIVISION SIGN | ||
| 1331 | #x201E ;; 215:DOUBLE LOW-9 QUOTATION MARK | ||
| 1332 | #x040E ;; 216:CYRILLIC CAPITAL LETTER SHORT U | ||
| 1333 | #x045E ;; 217:CYRILLIC SMALL LETTER SHORT U | ||
| 1334 | #x040F ;; 218:CYRILLIC CAPITAL LETTER DZHE | ||
| 1335 | #x045F ;; 219:CYRILLIC SMALL LETTER DZHE | ||
| 1336 | #x2116 ;; 220:NUMERO SIGN | ||
| 1337 | #x0401 ;; 221:CYRILLIC CAPITAL LETTER IO | ||
| 1338 | #x0451 ;; 222:CYRILLIC SMALL LETTER IO | ||
| 1339 | #x044F ;; 223:CYRILLIC SMALL LETTER YA | ||
| 1340 | #x0430 ;; 224:CYRILLIC SMALL LETTER A | ||
| 1341 | #x0431 ;; 225:CYRILLIC SMALL LETTER BE | ||
| 1342 | #x0432 ;; 226:CYRILLIC SMALL LETTER VE | ||
| 1343 | #x0433 ;; 227:CYRILLIC SMALL LETTER GHE | ||
| 1344 | #x0434 ;; 228:CYRILLIC SMALL LETTER DE | ||
| 1345 | #x0435 ;; 229:CYRILLIC SMALL LETTER IE | ||
| 1346 | #x0436 ;; 230:CYRILLIC SMALL LETTER ZHE | ||
| 1347 | #x0437 ;; 231:CYRILLIC SMALL LETTER ZE | ||
| 1348 | #x0438 ;; 232:CYRILLIC SMALL LETTER I | ||
| 1349 | #x0439 ;; 233:CYRILLIC SMALL LETTER SHORT I | ||
| 1350 | #x043A ;; 234:CYRILLIC SMALL LETTER KA | ||
| 1351 | #x043B ;; 235:CYRILLIC SMALL LETTER EL | ||
| 1352 | #x043C ;; 236:CYRILLIC SMALL LETTER EM | ||
| 1353 | #x043D ;; 237:CYRILLIC SMALL LETTER EN | ||
| 1354 | #x043E ;; 238:CYRILLIC SMALL LETTER O | ||
| 1355 | #x043F ;; 239:CYRILLIC SMALL LETTER PE | ||
| 1356 | #x0440 ;; 240:CYRILLIC SMALL LETTER ER | ||
| 1357 | #x0441 ;; 241:CYRILLIC SMALL LETTER ES | ||
| 1358 | #x0442 ;; 242:CYRILLIC SMALL LETTER TE | ||
| 1359 | #x0443 ;; 243:CYRILLIC SMALL LETTER U | ||
| 1360 | #x0444 ;; 244:CYRILLIC SMALL LETTER EF | ||
| 1361 | #x0445 ;; 245:CYRILLIC SMALL LETTER HA | ||
| 1362 | #x0446 ;; 246:CYRILLIC SMALL LETTER TSE | ||
| 1363 | #x0447 ;; 247:CYRILLIC SMALL LETTER CHE | ||
| 1364 | #x0448 ;; 248:CYRILLIC SMALL LETTER SHA | ||
| 1365 | #x0449 ;; 249:CYRILLIC SMALL LETTER SHCHA | ||
| 1366 | #x044A ;; 250:CYRILLIC SMALL LETTER HARD SIGN | ||
| 1367 | #x044B ;; 251:CYRILLIC SMALL LETTER YERU | ||
| 1368 | #x044C ;; 252:CYRILLIC SMALL LETTER SOFT SIGN | ||
| 1369 | #x044D ;; 253:CYRILLIC SMALL LETTER E | ||
| 1370 | #x044E ;; 254:CYRILLIC SMALL LETTER YU | ||
| 1371 | #x20AC ;; 255:EURO SIGN | ||
| 1372 | ]) | ||
| 1373 | translation-table) | ||
| 1374 | (while (< i 128) | ||
| 1375 | (aset encoding-vector i i) | ||
| 1376 | (setq i (1+ i))) | ||
| 1377 | (while (< i 256) | ||
| 1378 | (aset encoding-vector i | ||
| 1379 | (decode-char 'ucs (aref vec (- i 128)))) | ||
| 1380 | (setq i (1+ i))) | ||
| 1381 | (setq translation-table | ||
| 1382 | (make-translation-table-from-vector encoding-vector)) | ||
| 1383 | ;; (define-translation-table 'mac-cyrillic-decoder translation-table) | ||
| 1384 | (define-translation-table 'mac-cyrillic-encoder | ||
| 1385 | (char-table-extra-slot translation-table 0))) | ||
| 1386 | |||
| 1387 | (defvar mac-font-encoder-list | ||
| 1388 | '(("mac-roman" mac-roman-encoder | ||
| 1389 | ccl-encode-mac-roman-font "%s") | ||
| 1390 | ("mac-centraleurroman" mac-centraleurroman-encoder | ||
| 1391 | ccl-encode-mac-centraleurroman-font "%s ce") | ||
| 1392 | ("mac-cyrillic" mac-cyrillic-encoder | ||
| 1393 | ccl-encode-mac-cyrillic-font "%s cy"))) | ||
| 1394 | |||
| 1395 | (let ((encoder-list | ||
| 1396 | (mapcar (lambda (lst) (nth 1 lst)) mac-font-encoder-list)) | ||
| 1397 | (charset-list | ||
| 1398 | '(latin-iso8859-2 | ||
| 1399 | latin-iso8859-3 latin-iso8859-4 | ||
| 1400 | cyrillic-iso8859-5 greek-iso8859-7 hebrew-iso8859-8 | ||
| 1401 | latin-iso8859-9 latin-iso8859-14 latin-iso8859-15))) | ||
| 1402 | (dolist (encoder encoder-list) | ||
| 1403 | (let ((table (get encoder 'translation-table))) | ||
| 1404 | (dolist (charset charset-list) | ||
| 1405 | (dotimes (i 96) | ||
| 1406 | (let* ((c (make-char charset (+ i 32))) | ||
| 1407 | (mu (aref ucs-mule-to-mule-unicode c)) | ||
| 1408 | (mac-encoded (and mu (aref table mu)))) | ||
| 1409 | (if mac-encoded | ||
| 1410 | (aset table c mac-encoded)))))))) | ||
| 1411 | |||
| 1412 | (define-ccl-program ccl-encode-mac-centraleurroman-font | ||
| 1413 | `(0 | ||
| 1414 | (if (r0 != ,(charset-id 'ascii)) | ||
| 1415 | (if (r0 <= ?\x8f) | ||
| 1416 | (translate-character mac-centraleurroman-encoder r0 r1) | ||
| 1417 | ((r1 <<= 7) | ||
| 1418 | (r1 |= r2) | ||
| 1419 | (translate-character mac-centraleurroman-encoder r0 r1))))) | ||
| 1420 | "CCL program for Mac Central European Roman font") | ||
| 1421 | |||
| 1422 | (define-ccl-program ccl-encode-mac-cyrillic-font | ||
| 1423 | `(0 | ||
| 1424 | (if (r0 != ,(charset-id 'ascii)) | ||
| 1425 | (if (r0 <= ?\x8f) | ||
| 1426 | (translate-character mac-cyrillic-encoder r0 r1) | ||
| 1427 | ((r1 <<= 7) | ||
| 1428 | (r1 |= r2) | ||
| 1429 | (translate-character mac-cyrillic-encoder r0 r1))))) | ||
| 1430 | "CCL program for Mac Cyrillic font") | ||
| 1431 | |||
| 1432 | |||
| 1433 | (setq font-ccl-encoder-alist | ||
| 1434 | (nconc | ||
| 1435 | (mapcar (lambda (lst) (cons (nth 0 lst) (nth 2 lst))) | ||
| 1436 | mac-font-encoder-list) | ||
| 1437 | font-ccl-encoder-alist)) | ||
| 1438 | |||
| 1439 | (defun fontset-add-mac-fonts (fontset &optional base-family) | ||
| 1440 | (if base-family | ||
| 1441 | (setq base-family (downcase base-family)) | ||
| 1442 | (let ((ascii-font | ||
| 1443 | (downcase (x-resolve-font-name | ||
| 1444 | (fontset-font fontset (charset-id 'ascii)))))) | ||
| 1445 | (setq base-family (aref (x-decompose-font-name ascii-font) | ||
| 1446 | xlfd-regexp-family-subnum)))) | ||
| 1447 | ;; (if (not (string-match "^fontset-" fontset)) | ||
| 1448 | ;; (setq fontset | ||
| 1449 | ;; (concat "fontset-" (aref (x-decompose-font-name fontset) | ||
| 1450 | ;; xlfd-regexp-encoding-subnum)))) | ||
| 1451 | (dolist | ||
| 1452 | (font-encoder | ||
| 1453 | (nreverse | ||
| 1454 | (mapcar (lambda (lst) | ||
| 1455 | (cons (cons (format (nth 3 lst) base-family) (nth 0 lst)) | ||
| 1456 | (nth 1 lst))) | ||
| 1457 | mac-font-encoder-list))) | ||
| 1458 | (let ((font (car font-encoder)) | ||
| 1459 | (encoder (cdr font-encoder))) | ||
| 1460 | (map-char-table | ||
| 1461 | (lambda (key val) | ||
| 1462 | (or (null val) | ||
| 1463 | (generic-char-p key) | ||
| 1464 | (memq (char-charset key) | ||
| 1465 | '(ascii eight-bit-control eight-bit-graphic)) | ||
| 1466 | (set-fontset-font fontset key font))) | ||
| 1467 | (get encoder 'translation-table))))) | ||
| 1468 | |||
| 1469 | (defun create-fontset-from-mac-roman-font (font &optional resolved-font | ||
| 1470 | fontset-name) | ||
| 1471 | "Create a fontset from a Mac roman font FONT. | ||
| 1472 | |||
| 1473 | Optional 1st arg RESOLVED-FONT is a resolved name of FONT. If | ||
| 1474 | omitted, `x-resolve-font-name' is called to get the resolved name. At | ||
| 1475 | this time, if FONT is not available, error is signaled. | ||
| 1476 | |||
| 1477 | Optional 2nd arg FONTSET-NAME is a string to be used in | ||
| 1478 | `<CHARSET_ENCODING>' fields of a new fontset name. If it is omitted, | ||
| 1479 | an appropriate name is generated automatically. | ||
| 1480 | |||
| 1481 | It returns a name of the created fontset." | ||
| 1482 | (let ((fontset | ||
| 1483 | (create-fontset-from-ascii-font font resolved-font fontset-name))) | ||
| 1484 | (fontset-add-mac-fonts fontset) | ||
| 1485 | fontset)) | ||
| 1486 | |||
| 1487 | ;; Setup the default fontset. | ||
| 1488 | (setup-default-fontset) | ||
| 1489 | |||
| 1490 | ;; Create a fontset that uses mac-roman font. With this fontset, | ||
| 1491 | ;; characters decoded from mac-roman encoding (ascii, latin-iso8859-1, | ||
| 1492 | ;; and mule-unicode-xxxx-yyyy) are displayed by a mac-roman font. | ||
| 1493 | (create-fontset-from-fontset-spec | ||
| 1494 | "-etl-fixed-medium-r-normal-*-16-*-*-*-*-*-fontset-mac, | ||
| 1495 | ascii:-*-Monaco-*-*-*-*-12-*-*-*-*-*-mac-roman") | ||
| 1496 | (fontset-add-mac-fonts "fontset-mac") | ||
| 1497 | |||
| 1498 | ;; Create fontset specified in X resources "Fontset-N" (N is 0, 1, ...). | ||
| 1499 | (create-fontset-from-x-resource) | ||
| 1500 | |||
| 1501 | ;; Try to create a fontset from a font specification which comes | ||
| 1502 | ;; from initial-frame-alist, default-frame-alist, or X resource. | ||
| 1503 | ;; A font specification in command line argument (i.e. -fn XXXX) | ||
| 1504 | ;; should be already in default-frame-alist as a `font' | ||
| 1505 | ;; parameter. However, any font specifications in site-start | ||
| 1506 | ;; library, user's init file (.emacs), and default.el are not | ||
| 1507 | ;; yet handled here. | ||
| 1508 | |||
| 1509 | (let ((font (or (cdr (assq 'font initial-frame-alist)) | ||
| 1510 | (cdr (assq 'font default-frame-alist)) | ||
| 1511 | (x-get-resource "font" "Font"))) | ||
| 1512 | xlfd-fields resolved-name) | ||
| 1513 | (if (and font | ||
| 1514 | (not (query-fontset font)) | ||
| 1515 | (setq resolved-name (x-resolve-font-name font)) | ||
| 1516 | (setq xlfd-fields (x-decompose-font-name font))) | ||
| 1517 | (if (string= "fontset" (aref xlfd-fields xlfd-regexp-registry-subnum)) | ||
| 1518 | (new-fontset font (x-complement-fontset-spec xlfd-fields nil)) | ||
| 1519 | ;; Create a fontset from FONT. The fontset name is | ||
| 1520 | ;; generated from FONT. | ||
| 1521 | (create-fontset-from-ascii-font font resolved-name "startup")))) | ||
| 1522 | |||
| 1523 | ;; Apply a geometry resource to the initial frame. Put it at the end | ||
| 1524 | ;; of the alist, so that anything specified on the command line takes | ||
| 1525 | ;; precedence. | ||
| 1526 | (let* ((res-geometry (x-get-resource "geometry" "Geometry")) | ||
| 1527 | parsed) | ||
| 1528 | (if res-geometry | ||
| 1529 | (progn | ||
| 1530 | (setq parsed (x-parse-geometry res-geometry)) | ||
| 1531 | ;; If the resource specifies a position, | ||
| 1532 | ;; call the position and size "user-specified". | ||
| 1533 | (if (or (assq 'top parsed) (assq 'left parsed)) | ||
| 1534 | (setq parsed (cons '(user-position . t) | ||
| 1535 | (cons '(user-size . t) parsed)))) | ||
| 1536 | ;; All geometry parms apply to the initial frame. | ||
| 1537 | (setq initial-frame-alist (append initial-frame-alist parsed)) | ||
| 1538 | ;; The size parms apply to all frames. | ||
| 1539 | (if (assq 'height parsed) | ||
| 1540 | (setq default-frame-alist | ||
| 1541 | (cons (cons 'height (cdr (assq 'height parsed))) | ||
| 1542 | default-frame-alist))) | ||
| 1543 | (if (assq 'width parsed) | ||
| 1544 | (setq default-frame-alist | ||
| 1545 | (cons (cons 'width (cdr (assq 'width parsed))) | ||
| 1546 | default-frame-alist)))))) | ||
| 1547 | |||
| 1548 | ;; Check the reverseVideo resource. | ||
| 1549 | (let ((case-fold-search t)) | ||
| 1550 | (let ((rv (x-get-resource "reverseVideo" "ReverseVideo"))) | ||
| 1551 | (if (and rv | ||
| 1552 | (string-match "^\\(true\\|yes\\|on\\)$" rv)) | ||
| 1553 | (setq default-frame-alist | ||
| 1554 | (cons '(reverse . t) default-frame-alist))))) | ||
| 1555 | |||
| 1556 | (defun x-win-suspend-error () | ||
| 1557 | (error "Suspending an Emacs running under Mac makes no sense")) | ||
| 1558 | (add-hook 'suspend-hook 'x-win-suspend-error) | ||
| 1559 | |||
| 1560 | ;; Don't show the frame name; that's redundant. | ||
| 1561 | (setq-default mode-line-frame-identification " ") | ||
| 1562 | |||
| 1563 | ;; Turn on support for mouse wheels. | ||
| 1564 | (mouse-wheel-mode 1) | ||
| 1565 | |||
| 1566 | (defun mac-drag-n-drop (event) | ||
| 1567 | "Edit the files listed in the drag-n-drop event.\n\ | ||
| 1568 | Switch to a buffer editing the last file dropped." | ||
| 1569 | (interactive "e") | ||
| 1570 | (save-excursion | ||
| 1571 | ;; Make sure the drop target has positive co-ords | ||
| 1572 | ;; before setting the selected frame - otherwise it | ||
| 1573 | ;; won't work. <skx@tardis.ed.ac.uk> | ||
| 1574 | (let* ((window (posn-window (event-start event))) | ||
| 1575 | (coords (posn-x-y (event-start event))) | ||
| 1576 | (x (car coords)) | ||
| 1577 | (y (cdr coords))) | ||
| 1578 | (if (and (> x 0) (> y 0)) | ||
| 1579 | (set-frame-selected-window nil window)) | ||
| 1580 | (mapcar | ||
| 1581 | '(lambda (file) | ||
| 1582 | (find-file | ||
| 1583 | (decode-coding-string | ||
| 1584 | file | ||
| 1585 | (or file-name-coding-system | ||
| 1586 | default-file-name-coding-system)))) | ||
| 1587 | (car (cdr (cdr event))))) | ||
| 1588 | (raise-frame) | ||
| 1589 | (recenter))) | ||
| 1590 | |||
| 1591 | (global-set-key [drag-n-drop] 'mac-drag-n-drop) | ||
| 1592 | |||
| 1593 | ;; By checking whether the variable mac-ready-for-drag-n-drop has been | ||
| 1594 | ;; defined, the event loop in macterm.c can be informed that it can | ||
| 1595 | ;; now receive Finder drag and drop events. Files dropped onto the | ||
| 1596 | ;; Emacs application icon can only be processed when the initial frame | ||
| 1597 | ;; has been created: this is where the files should be opened. | ||
| 1598 | (add-hook 'after-init-hook | ||
| 1599 | '(lambda () | ||
| 1600 | (defvar mac-ready-for-drag-n-drop t))) | ||
| 1601 | |||
| 1602 | ;;;; Scroll bars | ||
| 1603 | |||
| 1604 | ;; for debugging | ||
| 1605 | ;; (defun mac-handle-scroll-bar-event (event) (interactive "e") (princ event)) | ||
| 1606 | |||
| 1607 | ;;(global-set-key [vertical-scroll-bar mouse-1] 'mac-handle-scroll-bar-event) | ||
| 1608 | |||
| 1609 | (global-set-key | ||
| 1610 | [vertical-scroll-bar down-mouse-1] | ||
| 1611 | 'mac-handle-scroll-bar-event) | ||
| 1612 | |||
| 1613 | (global-unset-key [vertical-scroll-bar drag-mouse-1]) | ||
| 1614 | (global-unset-key [vertical-scroll-bar mouse-1]) | ||
| 1615 | |||
| 1616 | (defun mac-handle-scroll-bar-event (event) | ||
| 1617 | "Handle scroll bar EVENT to emulate Mac Toolbox style scrolling." | ||
| 1618 | (interactive "e") | ||
| 1619 | (let* ((position (event-start event)) | ||
| 1620 | (window (nth 0 position)) | ||
| 1621 | (bar-part (nth 4 position))) | ||
| 1622 | (select-window window) | ||
| 1623 | (cond | ||
| 1624 | ((eq bar-part 'up) | ||
| 1625 | (goto-char (window-start window)) | ||
| 1626 | (mac-scroll-down-line)) | ||
| 1627 | ((eq bar-part 'above-handle) | ||
| 1628 | (mac-scroll-down)) | ||
| 1629 | ((eq bar-part 'handle) | ||
| 1630 | (scroll-bar-drag event)) | ||
| 1631 | ((eq bar-part 'below-handle) | ||
| 1632 | (mac-scroll-up)) | ||
| 1633 | ((eq bar-part 'down) | ||
| 1634 | (goto-char (window-start window)) | ||
| 1635 | (mac-scroll-up-line))))) | ||
| 1636 | |||
| 1637 | (defun mac-scroll-ignore-events () | ||
| 1638 | ;; Ignore confusing non-mouse events | ||
| 1639 | (while (not (memq (car-safe (read-event)) | ||
| 1640 | '(mouse-1 double-mouse-1 triple-mouse-1))) nil)) | ||
| 1641 | |||
| 1642 | (defun mac-scroll-down () | ||
| 1643 | (track-mouse | ||
| 1644 | (mac-scroll-ignore-events) | ||
| 1645 | (scroll-down))) | ||
| 1646 | |||
| 1647 | (defun mac-scroll-down-line () | ||
| 1648 | (track-mouse | ||
| 1649 | (mac-scroll-ignore-events) | ||
| 1650 | (scroll-down 1))) | ||
| 1651 | |||
| 1652 | (defun mac-scroll-up () | ||
| 1653 | (track-mouse | ||
| 1654 | (mac-scroll-ignore-events) | ||
| 1655 | (scroll-up))) | ||
| 1656 | |||
| 1657 | (defun mac-scroll-up-line () | ||
| 1658 | (track-mouse | ||
| 1659 | (mac-scroll-ignore-events) | ||
| 1660 | (scroll-up 1))) | ||
| 1661 | |||
| 1662 | |||
| 1663 | ;;;; Others | ||
| 1664 | |||
| 1665 | (unless (eq system-type 'darwin) | ||
| 1666 | ;; This variable specifies the Unix program to call (as a process) to | ||
| 1667 | ;; deteremine the amount of free space on a file system (defaults to | ||
| 1668 | ;; df). If it is not set to nil, ls-lisp will not work correctly | ||
| 1669 | ;; unless an external application df is implemented on the Mac. | ||
| 1670 | (setq directory-free-space-program nil) | ||
| 1671 | |||
| 1672 | ;; Set this so that Emacs calls subprocesses with "sh" as shell to | ||
| 1673 | ;; expand filenames Note no subprocess for the shell is actually | ||
| 1674 | ;; started (see run_mac_command in sysdep.c). | ||
| 1675 | (setq shell-file-name "sh")) | ||
| 1676 | |||
| 1677 | ;; X Window emulation in macterm.c is not complete enough to start a | ||
| 1678 | ;; frame without a minibuffer properly. Call this to tell ediff | ||
| 1679 | ;; library to use a single frame. | ||
| 1680 | ; (ediff-toggle-multiframe) | ||
| 1681 | |||
| 1682 | (if (eq system-type 'darwin) | ||
| 1683 | ;; On Darwin filenames are encoded in UTF-8 | ||
| 1684 | (setq file-name-coding-system 'utf-8) | ||
| 1685 | ;; To display filenames in Chinese or Japanese, replace mac-roman with | ||
| 1686 | ;; big5 or sjis | ||
| 1687 | (setq file-name-coding-system 'mac-roman)) | ||
| 1688 | |||
| 1689 | ;; If Emacs is started from the Finder, change the default directory | ||
| 1690 | ;; to the user's home directory. | ||
| 1691 | (if (string= default-directory "/") | ||
| 1692 | (cd "~")) | ||
| 1693 | |||
| 1694 | ;; Tell Emacs to use pipes instead of pty's for processes because the | ||
| 1695 | ;; latter sometimes lose characters. Pty support is compiled in since | ||
| 1696 | ;; ange-ftp will not work without it. | ||
| 1697 | (setq process-connection-type nil) | ||
| 1698 | |||
| 1699 | ;; Assume that fonts are always scalable on the Mac. This sometimes | ||
| 1700 | ;; results in characters with jagged edges. However, without it, | ||
| 1701 | ;; fonts with both truetype and bitmap representations but no italic | ||
| 1702 | ;; or bold bitmap versions will not display these variants correctly. | ||
| 1703 | (setq scalable-fonts-allowed t) | ||
| 1704 | |||
| 1705 | ;; (prefer-coding-system 'mac-roman) | ||
| 1706 | |||
| 1413 | ;;; arch-tag: 71dfcd14-cde8-4d66-b05c-85ec94fb23a6 | 1707 | ;;; arch-tag: 71dfcd14-cde8-4d66-b05c-85ec94fb23a6 |
| 1414 | ;;; mac-win.el ends here | 1708 | ;;; mac-win.el ends here |
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el index cc382b70528..470f4d4a1bd 100644 --- a/lisp/textmodes/texinfmt.el +++ b/lisp/textmodes/texinfmt.el | |||
| @@ -378,6 +378,7 @@ if large. You can use Info-split to do this manually." | |||
| 378 | (find-file outfile) | 378 | (find-file outfile) |
| 379 | (texinfo-mode) | 379 | (texinfo-mode) |
| 380 | (erase-buffer) | 380 | (erase-buffer) |
| 381 | (buffer-disable-undo) | ||
| 381 | 382 | ||
| 382 | (message "Formatting Info file: %s" outfile) | 383 | (message "Formatting Info file: %s" outfile) |
| 383 | (setq texinfo-format-filename | 384 | (setq texinfo-format-filename |
diff --git a/lisp/type-break.el b/lisp/type-break.el index ec96ab09fe2..b51a74ea37e 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el | |||
| @@ -399,10 +399,6 @@ problems." | |||
| 399 | (type-break-keystroke-reset) | 399 | (type-break-keystroke-reset) |
| 400 | (type-break-mode-line-countdown-or-break nil) | 400 | (type-break-mode-line-countdown-or-break nil) |
| 401 | 401 | ||
| 402 | (if (boundp 'save-some-buffers-always) | ||
| 403 | (add-to-list 'save-some-buffers-always | ||
| 404 | (expand-file-name type-break-file-name))) | ||
| 405 | |||
| 406 | (setq type-break-time-last-break (type-break-get-previous-time)) | 402 | (setq type-break-time-last-break (type-break-get-previous-time)) |
| 407 | 403 | ||
| 408 | ;; schedule according to break time from session file | 404 | ;; schedule according to break time from session file |
| @@ -437,13 +433,10 @@ problems." | |||
| 437 | (do-auto-save) | 433 | (do-auto-save) |
| 438 | (with-current-buffer (find-file-noselect type-break-file-name | 434 | (with-current-buffer (find-file-noselect type-break-file-name |
| 439 | 'nowarn) | 435 | 'nowarn) |
| 440 | (set-buffer-modified-p nil) | 436 | (setq buffer-save-without-query t) |
| 437 | (set-buffer-modified-p nil) | ||
| 441 | (unlock-buffer) | 438 | (unlock-buffer) |
| 442 | (kill-this-buffer)) | 439 | (kill-this-buffer)) |
| 443 | (if (boundp 'save-some-buffers-always) | ||
| 444 | (setq save-some-buffers-always | ||
| 445 | (remove (expand-file-name type-break-file-name) | ||
| 446 | save-some-buffers-always))) | ||
| 447 | (and (interactive-p) | 440 | (and (interactive-p) |
| 448 | (message "Type Break mode is disabled"))))) | 441 | (message "Type Break mode is disabled"))))) |
| 449 | type-break-mode) | 442 | type-break-mode) |
| @@ -515,16 +508,18 @@ variable of the same name." | |||
| 515 | (defun type-break-file-keystroke-count () | 508 | (defun type-break-file-keystroke-count () |
| 516 | "File keystroke count in `type-break-file-name', unless the file is locked." | 509 | "File keystroke count in `type-break-file-name', unless the file is locked." |
| 517 | (if (not (stringp (file-locked-p type-break-file-name))) | 510 | (if (not (stringp (file-locked-p type-break-file-name))) |
| 518 | (with-current-buffer (find-file-noselect type-break-file-name | 511 | ;; Prevent deactivation of the mark in some other buffer. |
| 519 | 'nowarn) | 512 | (let (deactivate-mark) |
| 520 | (save-excursion | 513 | (with-current-buffer (find-file-noselect type-break-file-name |
| 521 | (let ((inhibit-read-only t)) | 514 | 'nowarn) |
| 522 | (goto-char (point-min)) | 515 | (save-excursion |
| 523 | (forward-line) | 516 | (let ((inhibit-read-only t)) |
| 524 | (delete-region (point) (save-excursion (end-of-line) (point))) | 517 | (goto-char (point-min)) |
| 525 | (insert (format "%s" type-break-keystroke-count)) | 518 | (forward-line) |
| 526 | ;; file saving is left to auto-save | 519 | (delete-region (point) (save-excursion (end-of-line) (point))) |
| 527 | ))))) | 520 | (insert (format "%s" type-break-keystroke-count)) |
| 521 | ;; file saving is left to auto-save | ||
| 522 | )))))) | ||
| 528 | 523 | ||
| 529 | (defun timep (time) | 524 | (defun timep (time) |
| 530 | "If TIME is in the format returned by `current-time' then | 525 | "If TIME is in the format returned by `current-time' then |
diff --git a/lisp/uniquify.el b/lisp/uniquify.el index f106297476c..b2da7971167 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el | |||
| @@ -188,7 +188,6 @@ If `uniquify-min-dir-content' > 0, always pulls that many | |||
| 188 | file name elements. | 188 | file name elements. |
| 189 | Arguments BASE, DIRNAME, and NEWBUF specify the new buffer that causes | 189 | Arguments BASE, DIRNAME, and NEWBUF specify the new buffer that causes |
| 190 | this rationaliztion." | 190 | this rationaliztion." |
| 191 | (interactive) | ||
| 192 | (if (null dirname) | 191 | (if (null dirname) |
| 193 | (with-current-buffer newbuf (setq uniquify-managed nil)) | 192 | (with-current-buffer newbuf (setq uniquify-managed nil)) |
| 194 | (setq dirname (expand-file-name (directory-file-name dirname))) | 193 | (setq dirname (expand-file-name (directory-file-name dirname))) |
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el index c782e4262b8..5e67255eac9 100644 --- a/lisp/wid-edit.el +++ b/lisp/wid-edit.el | |||
| @@ -3059,7 +3059,7 @@ It will read a directory name from the minibuffer when invoked." | |||
| 3059 | (defvar widget-function-prompt-value-history nil | 3059 | (defvar widget-function-prompt-value-history nil |
| 3060 | "History of input to `widget-function-prompt-value'.") | 3060 | "History of input to `widget-function-prompt-value'.") |
| 3061 | 3061 | ||
| 3062 | (define-widget 'function 'sexp | 3062 | (define-widget 'function 'restricted-sexp |
| 3063 | "A Lisp function." | 3063 | "A Lisp function." |
| 3064 | :complete-function (lambda () | 3064 | :complete-function (lambda () |
| 3065 | (interactive) | 3065 | (interactive) |
diff --git a/lispref/ChangeLog b/lispref/ChangeLog index 247309624de..8ebb1b239b9 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2004-12-27 Richard M. Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * Makefile.in (MAKEINFO): Specify --force. | ||
| 4 | |||
| 5 | * buffers.texi (Killing Buffers): Add buffer-save-without-query. | ||
| 6 | |||
| 7 | * modes.texi (Emulating Mode Line): Document format's BUFFER arg. | ||
| 8 | |||
| 9 | * display.texi (Line Height): Further clarify. | ||
| 10 | |||
| 11 | * elisp.texi (Top): Update Loading submenu. | ||
| 12 | |||
| 13 | * loading.texi (Where Defined): New node. | ||
| 14 | (Unloading): load-history moved to Where Defined. | ||
| 15 | |||
| 1 | 2004-12-21 Richard M. Stallman <rms@gnu.org> | 16 | 2004-12-21 Richard M. Stallman <rms@gnu.org> |
| 2 | 17 | ||
| 3 | * commands.texi (Event Input Misc): Add while-no-input. | 18 | * commands.texi (Event Input Misc): Add while-no-input. |
diff --git a/lispref/Makefile.in b/lispref/Makefile.in index c0e3b54c952..770ffd5769a 100644 --- a/lispref/Makefile.in +++ b/lispref/Makefile.in | |||
| @@ -31,7 +31,7 @@ infodir = $(srcdir)/../info | |||
| 31 | TEXI2DVI = texi2dvi | 31 | TEXI2DVI = texi2dvi |
| 32 | SHELL = /bin/sh | 32 | SHELL = /bin/sh |
| 33 | INSTALL_INFO = install-info | 33 | INSTALL_INFO = install-info |
| 34 | MAKEINFO = makeinfo | 34 | MAKEINFO = makeinfo --force |
| 35 | 35 | ||
| 36 | # The name of the manual: | 36 | # The name of the manual: |
| 37 | VERSION=2.9 | 37 | VERSION=2.9 |
diff --git a/lispref/buffers.texi b/lispref/buffers.texi index d39a0746fe1..42131766ec7 100644 --- a/lispref/buffers.texi +++ b/lispref/buffers.texi | |||
| @@ -1041,6 +1041,13 @@ save that buffer, just as they offer to save file-visiting buffers. | |||
| 1041 | for any reason. @xref{Buffer-Local Variables}. | 1041 | for any reason. @xref{Buffer-Local Variables}. |
| 1042 | @end defvar | 1042 | @end defvar |
| 1043 | 1043 | ||
| 1044 | @defvar buffer-save-without-query | ||
| 1045 | This variable, if non-@code{nil} in a particular buffer, tells | ||
| 1046 | @code{save-buffers-kill-emacs} and @code{save-some-buffers} to save | ||
| 1047 | this buffer (if it's modified) without asking the user. The variable | ||
| 1048 | automatically becomes buffer-local when set for any reason. | ||
| 1049 | @end defvar | ||
| 1050 | |||
| 1044 | @defun buffer-live-p object | 1051 | @defun buffer-live-p object |
| 1045 | This function returns @code{t} if @var{object} is a buffer which has | 1052 | This function returns @code{t} if @var{object} is a buffer which has |
| 1046 | not been killed, @code{nil} otherwise. | 1053 | not been killed, @code{nil} otherwise. |
diff --git a/lispref/display.texi b/lispref/display.texi index 04d478b9b2a..95cce29d0c1 100644 --- a/lispref/display.texi +++ b/lispref/display.texi | |||
| @@ -1533,23 +1533,26 @@ or by adding additional vertical space below one or all lines. | |||
| 1533 | A newline can have a @code{line-height} text or overlay property | 1533 | A newline can have a @code{line-height} text or overlay property |
| 1534 | that controls the total height of the display line ending in that | 1534 | that controls the total height of the display line ending in that |
| 1535 | newline. If the property value is zero, the displayed height of the | 1535 | newline. If the property value is zero, the displayed height of the |
| 1536 | line is exactly what its contents need; no line-spacing is added. | 1536 | line is exactly what its contents demand; no line-spacing is added. |
| 1537 | This case is useful for tiling small images or image slices without | 1537 | This case is useful for tiling small images or image slices without |
| 1538 | adding blank areas between the images. | 1538 | adding blank areas between the images. |
| 1539 | 1539 | ||
| 1540 | If the property value is not zero, it specifies a desired height, | 1540 | If the property value is not zero, it is a height spec. A height |
| 1541 | @var{line-height}. There are several ways it can do this: | 1541 | spec stands for a numeric height value; this heigh spec specifies the |
| 1542 | actual line height, @var{line-height}. There are several ways to | ||
| 1543 | write a height spec; here's how each of them translates into a numeric | ||
| 1544 | height: | ||
| 1542 | 1545 | ||
| 1543 | @table @code | 1546 | @table @code |
| 1544 | @item @var{integer} | 1547 | @item @var{integer} |
| 1545 | If the property is a positive integer, @var{line-height} is that integer. | 1548 | If the height spec is a positive integer, the height value is that integer. |
| 1546 | @item @var{float} | 1549 | @item @var{float} |
| 1547 | If the property is a float, @var{float}, @var{line-height} is @var{float} | 1550 | If the height spec is a float, @var{float}, the numeric height value |
| 1548 | times the frame's default line height. | 1551 | is @var{float} times the frame's default line height. |
| 1549 | @item (@var{ratio} . @var{face}) | 1552 | @item (@var{ratio} . @var{face}) |
| 1550 | If the property is a cons of the format shown, @var{line-height} is | 1553 | If the height spec is a cons of the format shown, the numeric height |
| 1551 | @var{ratio} times the height of face @var{face}. @var{ratio} can be | 1554 | is @var{ratio} times the height of face @var{face}. @var{ratio} can |
| 1552 | any type of number. If @var{face} is @code{t}, it refers to the | 1555 | be any type of number. If @var{face} is @code{t}, it refers to the |
| 1553 | current face. | 1556 | current face. |
| 1554 | @end table | 1557 | @end table |
| 1555 | 1558 | ||
| @@ -1561,6 +1564,8 @@ the line to achieve the total height @var{line-height}. Otherwise, | |||
| 1561 | 1564 | ||
| 1562 | If you don't specify the @code{line-height} propery, the line's | 1565 | If you don't specify the @code{line-height} propery, the line's |
| 1563 | height consists of the contents' height plus the line spacing. | 1566 | height consists of the contents' height plus the line spacing. |
| 1567 | There are several ways to specify the line spacing for different | ||
| 1568 | parts of Emacs text. | ||
| 1564 | 1569 | ||
| 1565 | @vindex default-line-spacing | 1570 | @vindex default-line-spacing |
| 1566 | You can specify the line spacing for all lines in a frame with the | 1571 | You can specify the line spacing for all lines in a frame with the |
| @@ -1584,24 +1589,23 @@ property that controls the height of the display line ending with that | |||
| 1584 | newline. The property value overrides the default frame line spacing | 1589 | newline. The property value overrides the default frame line spacing |
| 1585 | and the buffer local @code{line-spacing} variable. | 1590 | and the buffer local @code{line-spacing} variable. |
| 1586 | 1591 | ||
| 1587 | One way or another, these mechanisms specify a line spacing for each | 1592 | One way or another, these mechanisms specify a Lisp value for the |
| 1588 | line. Let's call the value @var{line-spacing}. | 1593 | spacing of each line. The value is a height spec, and it translates |
| 1589 | 1594 | into a Lisp value as described above. However, in this case the | |
| 1590 | If the @var{line-spacing} value is a positive integer, it specifies | 1595 | numeric height value specifies the line spacing, rather than the line |
| 1591 | the number of pixels of additional vertical space. This space appears | 1596 | height. |
| 1592 | below the display line contents. | ||
| 1593 | |||
| 1594 | If the @var{line-spacing} value is a floating point number or cons, | ||
| 1595 | the additional vertical space is @var{line-spacing} times the frame | ||
| 1596 | default line height. | ||
| 1597 | 1597 | ||
| 1598 | @ignore @c I think we may want to delete this, so don't document it -- rms. | 1598 | There is one exception, however: if the @var{line-spacing} value is |
| 1599 | If the @var{line-spacing} value is a cons @code{(total . @var{spacing})} | 1599 | a cons @code{(total . @var{spacing})}, then @var{spacing} itself is |
| 1600 | where @var{spacing} is any of the forms described above, the value of | 1600 | treated as a heigh spec, and specifies the total displayed height of |
| 1601 | @var{spacing} specifies the total displayed height of the line, | 1601 | the line, so the line spacing equals the specified amount minus the |
| 1602 | regardless of the height of the characters in it. This is equivalent | 1602 | line height. This differs from using the @code{line-height} property |
| 1603 | to using the @code{line-height} property. | 1603 | because it adds space at the bottom of the line instead of the top. |
| 1604 | @end ignore | 1604 | |
| 1605 | If you specify both @code{line-spacing} using @code{total} and | ||
| 1606 | @code{line-height}, they are not redundant. First @code{line-height} | ||
| 1607 | goes to work, adding space above the line contents. Then | ||
| 1608 | @code{line-spacing} goes to work, adding space below the contents. | ||
| 1605 | 1609 | ||
| 1606 | @node Faces | 1610 | @node Faces |
| 1607 | @section Faces | 1611 | @section Faces |
diff --git a/lispref/elisp.texi b/lispref/elisp.texi index c8672f4d9ce..666659d15b3 100644 --- a/lispref/elisp.texi +++ b/lispref/elisp.texi | |||
| @@ -420,9 +420,15 @@ Macros | |||
| 420 | Loading | 420 | Loading |
| 421 | 421 | ||
| 422 | * How Programs Do Loading:: The @code{load} function and others. | 422 | * How Programs Do Loading:: The @code{load} function and others. |
| 423 | * Library Search:: Finding a library to load. | ||
| 424 | * Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files. | ||
| 423 | * Autoload:: Setting up a function to autoload. | 425 | * Autoload:: Setting up a function to autoload. |
| 424 | * Named Features:: Loading a library if it isn't already loaded. | ||
| 425 | * Repeated Loading:: Precautions about loading a file twice. | 426 | * Repeated Loading:: Precautions about loading a file twice. |
| 427 | * Named Features:: Loading a library if it isn't already loaded. | ||
| 428 | * Where Defined:: Finding which file defined a certain symbol. | ||
| 429 | * Unloading:: to ``unload'' a library that was loaded. | ||
| 430 | * Hooks for Loading:: Providing code to be run when | ||
| 431 | particular libraries are loaded. | ||
| 426 | 432 | ||
| 427 | Byte Compilation | 433 | Byte Compilation |
| 428 | 434 | ||
diff --git a/lispref/loading.texi b/lispref/loading.texi index 1b90ef5f2dd..221376f017a 100644 --- a/lispref/loading.texi +++ b/lispref/loading.texi | |||
| @@ -36,15 +36,16 @@ Similarly, a ``Lisp library directory'' is a directory of files | |||
| 36 | containing Lisp code. | 36 | containing Lisp code. |
| 37 | 37 | ||
| 38 | @menu | 38 | @menu |
| 39 | * How Programs Do Loading:: The @code{load} function and others. | 39 | * How Programs Do Loading:: The @code{load} function and others. |
| 40 | * Library Search:: Finding a library to load. | 40 | * Library Search:: Finding a library to load. |
| 41 | * Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files. | 41 | * Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files. |
| 42 | * Autoload:: Setting up a function to autoload. | 42 | * Autoload:: Setting up a function to autoload. |
| 43 | * Repeated Loading:: Precautions about loading a file twice. | 43 | * Repeated Loading:: Precautions about loading a file twice. |
| 44 | * Named Features:: Loading a library if it isn't already loaded. | 44 | * Named Features:: Loading a library if it isn't already loaded. |
| 45 | * Unloading:: How to ``unload'' a library that was loaded. | 45 | * Where Defined:: Finding which file defined a certain symbol. |
| 46 | * Hooks for Loading:: Providing code to be run when | 46 | * Unloading:: to ``unload'' a library that was loaded. |
| 47 | particular libraries are loaded. | 47 | * Hooks for Loading:: Providing code to be run when |
| 48 | particular libraries are loaded. | ||
| 48 | @end menu | 49 | @end menu |
| 49 | 50 | ||
| 50 | @node How Programs Do Loading | 51 | @node How Programs Do Loading |
| @@ -714,6 +715,60 @@ with a call to @code{provide}. The order of the elements in the | |||
| 714 | @code{features} list is not significant. | 715 | @code{features} list is not significant. |
| 715 | @end defvar | 716 | @end defvar |
| 716 | 717 | ||
| 718 | @node Where Defined | ||
| 719 | @section Which File Defined a Certain Symbol | ||
| 720 | |||
| 721 | @defun symbol-file symbol &optional type | ||
| 722 | This function returns the name of the file that defined @var{symbol}. | ||
| 723 | If @var{type} is @code{nil}, then any kind of definition is | ||
| 724 | acceptable. If @var{type} is @code{defun} or @code{defvar}, that | ||
| 725 | specifies function definition only or variable definition only. | ||
| 726 | |||
| 727 | The value is the file name as it was specified to @code{load}: | ||
| 728 | either an absolute file name, or a library name | ||
| 729 | (with no directory name and no @samp{.el} or @samp{.elc} at the end). | ||
| 730 | It can also be @code{nil}, if the definition is not associated with any file. | ||
| 731 | @end defun | ||
| 732 | |||
| 733 | The basis for @code{symbol-file} is the data in the variable | ||
| 734 | @code{load-history}. | ||
| 735 | |||
| 736 | @defvar load-history | ||
| 737 | This variable's value is an alist connecting library names with the | ||
| 738 | names of functions and variables they define, the features they provide, | ||
| 739 | and the features they require. | ||
| 740 | |||
| 741 | Each element is a list and describes one library. The @sc{car} of the | ||
| 742 | list is the name of the library, as a string. The rest of the list | ||
| 743 | elements have these forms: | ||
| 744 | |||
| 745 | @table @code | ||
| 746 | @item @var{var} | ||
| 747 | The symbol @var{var} was defined as a variable. | ||
| 748 | @item (defun . @var{fun}) | ||
| 749 | The @var{fun} was defined by this library. | ||
| 750 | @item (t . @var{fun}) | ||
| 751 | The function @var{fun} was previously an autoload before this library | ||
| 752 | redefined it as a function. The following element is always the | ||
| 753 | symbol @var{fun}, which signifies that the library defined @var{fun} | ||
| 754 | as a function. | ||
| 755 | @item (autoload . @var{fun}) | ||
| 756 | The function @var{fun} was defined as an autoload. | ||
| 757 | @item (require . @var{feature}) | ||
| 758 | The feature @var{feature} was required. | ||
| 759 | @item (provide . @var{feature}) | ||
| 760 | The feature @var{feature} was provided. | ||
| 761 | @end table | ||
| 762 | |||
| 763 | The value of @code{load-history} may have one element whose @sc{car} is | ||
| 764 | @code{nil}. This element describes definitions made with | ||
| 765 | @code{eval-buffer} on a buffer that is not visiting a file. | ||
| 766 | @end defvar | ||
| 767 | |||
| 768 | The command @code{eval-region} updates @code{load-history}, but does so | ||
| 769 | by adding the symbols defined to the element for the file being visited, | ||
| 770 | rather than replacing that element. @xref{Eval}. | ||
| 771 | |||
| 717 | @node Unloading | 772 | @node Unloading |
| 718 | @section Unloading | 773 | @section Unloading |
| 719 | @cindex unloading | 774 | @cindex unloading |
| @@ -760,42 +815,6 @@ ignored and you can unload any library. | |||
| 760 | The @code{unload-feature} function is written in Lisp; its actions are | 815 | The @code{unload-feature} function is written in Lisp; its actions are |
| 761 | based on the variable @code{load-history}. | 816 | based on the variable @code{load-history}. |
| 762 | 817 | ||
| 763 | @defvar load-history | ||
| 764 | This variable's value is an alist connecting library names with the | ||
| 765 | names of functions and variables they define, the features they provide, | ||
| 766 | and the features they require. | ||
| 767 | |||
| 768 | Each element is a list and describes one library. The @sc{car} of the | ||
| 769 | list is the name of the library, as a string. The rest of the list | ||
| 770 | elements have these forms: | ||
| 771 | |||
| 772 | @table @code | ||
| 773 | @item @var{fun} | ||
| 774 | The function @var{fun} was defined by this library. | ||
| 775 | @item (t . @var{fun}) | ||
| 776 | The function @var{fun} was previously an autoload before this library | ||
| 777 | redefined it as a function. The following element is always the | ||
| 778 | symbol @var{fun}, which signifies that the library defined @var{fun} | ||
| 779 | as a function. | ||
| 780 | @item (autoload . @var{fun}) | ||
| 781 | The function @var{fun} was defined as an autoload. | ||
| 782 | @item (defvar . @var{var}) | ||
| 783 | The symbol @var{var} was defined as a variable. | ||
| 784 | @item (require . @var{feature}) | ||
| 785 | The feature @var{feature} was required. | ||
| 786 | @item (provide . @var{feature}) | ||
| 787 | The feature @var{feature} was provided. | ||
| 788 | @end table | ||
| 789 | |||
| 790 | The value of @code{load-history} may have one element whose @sc{car} is | ||
| 791 | @code{nil}. This element describes definitions made with | ||
| 792 | @code{eval-buffer} on a buffer that is not visiting a file. | ||
| 793 | @end defvar | ||
| 794 | |||
| 795 | The command @code{eval-region} updates @code{load-history}, but does so | ||
| 796 | by adding the symbols defined to the element for the file being visited, | ||
| 797 | rather than replacing that element. @xref{Eval}. | ||
| 798 | |||
| 799 | @defvar unload-feature-special-hooks | 818 | @defvar unload-feature-special-hooks |
| 800 | This variable holds a list of hooks to be scanned before unloading a | 819 | This variable holds a list of hooks to be scanned before unloading a |
| 801 | library, to remove functions defined in the library. | 820 | library, to remove functions defined in the library. |
diff --git a/lispref/modes.texi b/lispref/modes.texi index 01958873d33..2abb8a9c0d9 100644 --- a/lispref/modes.texi +++ b/lispref/modes.texi | |||
| @@ -1736,7 +1736,7 @@ It is normally @code{nil}, so that ordinary buffers have no header line. | |||
| 1736 | the text that would appear in a mode line or header line | 1736 | the text that would appear in a mode line or header line |
| 1737 | based on certain mode-line specification. | 1737 | based on certain mode-line specification. |
| 1738 | 1738 | ||
| 1739 | @defun format-mode-line &optional format window no-props | 1739 | @defun format-mode-line &optional format window no-props buffer |
| 1740 | This function formats a line of text according to @var{format} as if | 1740 | This function formats a line of text according to @var{format} as if |
| 1741 | it were generating the mode line for @var{window}, but instead of | 1741 | it were generating the mode line for @var{window}, but instead of |
| 1742 | displaying the text in the mode line or the header line, it returns | 1742 | displaying the text in the mode line or the header line, it returns |
| @@ -1752,6 +1752,8 @@ The argument @var{window} defaults to the selected window. | |||
| 1752 | The value string normally has text properties that correspond to the | 1752 | The value string normally has text properties that correspond to the |
| 1753 | faces, keymaps, etc., that the mode line would have. If | 1753 | faces, keymaps, etc., that the mode line would have. If |
| 1754 | @var{no-props} is non-@code{nil}, the value has no text properties. | 1754 | @var{no-props} is non-@code{nil}, the value has no text properties. |
| 1755 | If @var{buffer} is non-@code{nil}, all the information used is taken | ||
| 1756 | from @var{buffer}; by default,it comes from @var{window}'s buffer. | ||
| 1755 | @end defun | 1757 | @end defun |
| 1756 | 1758 | ||
| 1757 | @node Imenu | 1759 | @node Imenu |
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index eb2dd13432a..487c842f6f2 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xlwmenu.c (xlwMenuActionsList): Install MenuGadgetEscape as an | ||
| 4 | action procedure for compatibility with Lesstif/Motif. | ||
| 5 | |||
| 6 | * Makefile.in (mostlyclean): Don't remove *~ on clean. | ||
| 7 | |||
| 8 | 2004-12-26 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 9 | |||
| 10 | * lwlib-Xaw.c: Put <KeyPress>Escape in dialogOverride so dialogs only | ||
| 11 | pops down on Escape, not any keypress. | ||
| 12 | |||
| 1 | 2004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 13 | 2004-11-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 14 | ||
| 3 | * xlwmenu.c (find_first_selectable, find_next_selectable) | 15 | * xlwmenu.c (find_first_selectable, find_next_selectable) |
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in index 11368819f4a..dd2bb6537e9 100644 --- a/lwlib/Makefile.in +++ b/lwlib/Makefile.in | |||
| @@ -57,7 +57,7 @@ lwlib-Xm.o: lwlib-Xm.c lwlib-Xm.h lwlib.h lwlib-int.h lwlib-utils.h | |||
| 57 | xlwmenu.o: xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h | 57 | xlwmenu.o: xlwmenu.c xlwmenu.h lwlib.h xlwmenuP.h |
| 58 | 58 | ||
| 59 | mostlyclean: | 59 | mostlyclean: |
| 60 | $(RM) *.o core errs ,* *~ *.a .emacs_* make.log MakeOut \#* | 60 | $(RM) *.o core errs ,* *.a .emacs_* make.log MakeOut \#* |
| 61 | 61 | ||
| 62 | clean: mostlyclean | 62 | clean: mostlyclean |
| 63 | distclean: clean | 63 | distclean: clean |
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c index 867193c7cc8..b0f3f6abce8 100644 --- a/lwlib/lwlib-Xaw.c +++ b/lwlib/lwlib-Xaw.c | |||
| @@ -279,7 +279,7 @@ static char overrideTrans[] = | |||
| 279 | "<Message>WM_PROTOCOLS: lwlib_delete_dialog()"; | 279 | "<Message>WM_PROTOCOLS: lwlib_delete_dialog()"; |
| 280 | /* Dialogs pop down on any key press */ | 280 | /* Dialogs pop down on any key press */ |
| 281 | static char dialogOverride[] = | 281 | static char dialogOverride[] = |
| 282 | "<KeyPress>: lwlib_delete_dialog()"; | 282 | "<KeyPress>Escape: lwlib_delete_dialog()"; |
| 283 | static void wm_delete_window(); | 283 | static void wm_delete_window(); |
| 284 | static XtActionsRec xaw_actions [] = { | 284 | static XtActionsRec xaw_actions [] = { |
| 285 | {"lwlib_delete_dialog", wm_delete_window} | 285 | {"lwlib_delete_dialog", wm_delete_window} |
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index d4eeeaa3eb4..43ae8ee2ea0 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c | |||
| @@ -211,6 +211,7 @@ xlwMenuActionsList [] = | |||
| 211 | {"right", Right}, | 211 | {"right", Right}, |
| 212 | {"select", Select}, | 212 | {"select", Select}, |
| 213 | {"key", Key}, | 213 | {"key", Key}, |
| 214 | {"MenuGadgetEscape", Key}, /* Compatibility with Lesstif/Motif. */ | ||
| 214 | {"nothing", Nothing}, | 215 | {"nothing", Nothing}, |
| 215 | }; | 216 | }; |
| 216 | 217 | ||
diff --git a/mac/ChangeLog b/mac/ChangeLog index 7283b3e2aed..a12d8bc4673 100644 --- a/mac/ChangeLog +++ b/mac/ChangeLog | |||
| @@ -1,3 +1,24 @@ | |||
| 1 | 2004-12-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * makefile.MPW: Add dependencies for fringe.c.x, image.c.x, and | ||
| 4 | lastfile.c.x. | ||
| 5 | (PPCCOptions): Add -alloca. | ||
| 6 | (EmacsObjects): Remove alloca.c.x. Add fringe.c.x, image.c.x, and | ||
| 7 | lastfile.c.x. | ||
| 8 | (Emacs MPW): Add QuickTimeLib. | ||
| 9 | (EmacsSource): Remove alloca.c. Add fringe.c, image.c, and | ||
| 10 | lastfile.c. | ||
| 11 | (LispSource): Fix pathnames for byte-run.elc, float-sup.elc, and | ||
| 12 | map-ynp.elc. | ||
| 13 | * inc/config.h (USE_LSB_TAG) [__MRC__]: Define. | ||
| 14 | (UNEXEC_SRC): Close comment. | ||
| 15 | * inc/epaths.h (PATH_BITMAPS, PATH_GAME): New defines. | ||
| 16 | * inc/m-mac.h (HAVE_ALLOCA) [__MRC__]: Define. | ||
| 17 | (C_ALLOCA) [__MRC__]: Don't define. | ||
| 18 | * inc/s-mac.h (X_OK): New define. | ||
| 19 | (DECL_ALIGN) [USE_LSB_TAG && __MRC__]: New macro. | ||
| 20 | (GC_MARK_STACK): Define to GC_MAKE_GCPROS_NOOPS. | ||
| 21 | |||
| 1 | 2004-05-29 Steven Tamm <steventamm@mac.com> | 22 | 2004-05-29 Steven Tamm <steventamm@mac.com> |
| 2 | 23 | ||
| 3 | * INSTALL: Fixing typos | 24 | * INSTALL: Fixing typos |
diff --git a/mac/inc/config.h b/mac/inc/config.h index b7257f35f35..859ef017bc6 100644 --- a/mac/inc/config.h +++ b/mac/inc/config.h | |||
| @@ -261,7 +261,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 261 | 261 | ||
| 262 | /* #undef CRAY_STACKSEG_END */ | 262 | /* #undef CRAY_STACKSEG_END */ |
| 263 | 263 | ||
| 264 | /* #undef UNEXEC_SRC unexelf.c | 264 | /* #undef UNEXEC_SRC */ |
| 265 | 265 | ||
| 266 | /* #undef HAVE_LIBXBSD */ | 266 | /* #undef HAVE_LIBXBSD */ |
| 267 | /* #undef HAVE_XRMSETDATABASE */ | 267 | /* #undef HAVE_XRMSETDATABASE */ |
| @@ -367,6 +367,13 @@ Boston, MA 02111-1307, USA. */ | |||
| 367 | /* #undef _XOPEN_SOURCE */ | 367 | /* #undef _XOPEN_SOURCE */ |
| 368 | 368 | ||
| 369 | #ifdef __MRC__ | 369 | #ifdef __MRC__ |
| 370 | /* Use low-bits for tags. If ENABLE_CHECKING is turned on together | ||
| 371 | with USE_LSB_TAG, optimization flags should be explicitly turned | ||
| 372 | off. */ | ||
| 373 | #define USE_LSB_TAG | ||
| 374 | #endif | ||
| 375 | |||
| 376 | #ifdef __MRC__ | ||
| 370 | #define EMACS_CONFIGURATION "macos-mpw" | 377 | #define EMACS_CONFIGURATION "macos-mpw" |
| 371 | #else /* Assume CodeWarrior */ | 378 | #else /* Assume CodeWarrior */ |
| 372 | #define EMACS_CONFIGURATION "macos-cw" | 379 | #define EMACS_CONFIGURATION "macos-cw" |
diff --git a/mac/inc/epaths.h b/mac/inc/epaths.h index 8c9bbd2f8ba..96027388e3f 100644 --- a/mac/inc/epaths.h +++ b/mac/inc/epaths.h | |||
| @@ -46,7 +46,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 46 | 46 | ||
| 47 | /* Where Emacs should look for X bitmap files. | 47 | /* Where Emacs should look for X bitmap files. |
| 48 | The lisp variable x-bitmap-file-path is set based on this value. */ | 48 | The lisp variable x-bitmap-file-path is set based on this value. */ |
| 49 | /* #define PATH_BITMAPS "/usr/include/X11/bitmaps" */ | 49 | #define PATH_BITMAPS "" |
| 50 | 50 | ||
| 51 | /* Where Emacs should look for its docstring file. The lisp variable | 51 | /* Where Emacs should look for its docstring file. The lisp variable |
| 52 | doc-directory is set to this value. */ | 52 | doc-directory is set to this value. */ |
| @@ -57,6 +57,9 @@ Boston, MA 02111-1307, USA. */ | |||
| 57 | macro, and is then used to set the Info-default-directory-list. */ | 57 | macro, and is then used to set the Info-default-directory-list. */ |
| 58 | #define PATH_INFO "~emacs/info" | 58 | #define PATH_INFO "~emacs/info" |
| 59 | 59 | ||
| 60 | /* Where Emacs should store game score files. */ | ||
| 61 | #define PATH_GAME "~emacs/games" | ||
| 62 | |||
| 60 | /* Where Emacs should look for the application default file. */ | 63 | /* Where Emacs should look for the application default file. */ |
| 61 | /* #define PATH_X_DEFAULTS "/usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:/usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S" */ | 64 | /* #define PATH_X_DEFAULTS "/usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:/usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S" */ |
| 62 | 65 | ||
diff --git a/mac/inc/m-mac.h b/mac/inc/m-mac.h index f3f6f084b34..bb4011af4a6 100644 --- a/mac/inc/m-mac.h +++ b/mac/inc/m-mac.h | |||
| @@ -87,8 +87,11 @@ Boston, MA 02111-1307, USA. */ | |||
| 87 | Define neither one if an assembler-language alloca | 87 | Define neither one if an assembler-language alloca |
| 88 | in the file alloca.s should be used. */ | 88 | in the file alloca.s should be used. */ |
| 89 | 89 | ||
| 90 | #ifdef __MRC__ | ||
| 91 | #define HAVE_ALLOCA | ||
| 92 | #else | ||
| 90 | #define C_ALLOCA | 93 | #define C_ALLOCA |
| 91 | /* #define HAVE_ALLOCA */ | 94 | #endif |
| 92 | 95 | ||
| 93 | /* Define NO_REMAP if memory segmentation makes it not work well | 96 | /* Define NO_REMAP if memory segmentation makes it not work well |
| 94 | to change the boundary between the text section and data section | 97 | to change the boundary between the text section and data section |
diff --git a/mac/inc/s-mac.h b/mac/inc/s-mac.h index c187944ae6b..2905692aac0 100644 --- a/mac/inc/s-mac.h +++ b/mac/inc/s-mac.h | |||
| @@ -255,6 +255,10 @@ void read_input_waiting (); | |||
| 255 | #include <unistd.h> | 255 | #include <unistd.h> |
| 256 | #endif | 256 | #endif |
| 257 | 257 | ||
| 258 | #ifndef X_OK | ||
| 259 | #define X_OK 01 | ||
| 260 | #endif | ||
| 261 | |||
| 258 | #undef unlink | 262 | #undef unlink |
| 259 | #define unlink sys_unlink | 263 | #define unlink sys_unlink |
| 260 | #undef read | 264 | #undef read |
| @@ -319,5 +323,15 @@ extern double atof (const char *); | |||
| 319 | 323 | ||
| 320 | #define SYMS_SYSTEM syms_of_mac() | 324 | #define SYMS_SYSTEM syms_of_mac() |
| 321 | 325 | ||
| 326 | #ifdef USE_LSB_TAG | ||
| 327 | #ifdef __MRC__ | ||
| 328 | #define DECL_ALIGN(type, var) type var | ||
| 329 | #endif | ||
| 330 | #endif | ||
| 331 | |||
| 332 | /* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the | ||
| 333 | stack. */ | ||
| 334 | #define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS | ||
| 335 | |||
| 322 | /* arch-tag: 6a941c4b-a419-4d25-80ac-9335053e58b2 | 336 | /* arch-tag: 6a941c4b-a419-4d25-80ac-9335053e58b2 |
| 323 | (do not change this comment) */ | 337 | (do not change this comment) */ |
diff --git a/mac/makefile.MPW b/mac/makefile.MPW index a398f63a925..870052996b7 100644 --- a/mac/makefile.MPW +++ b/mac/makefile.MPW | |||
| @@ -44,7 +44,7 @@ OptOption = # -opt speed # alternatively set to -opt off or -opt size | |||
| 44 | 44 | ||
| 45 | # The -noMapCR options and the two -d's must not be removed. | 45 | # The -noMapCR options and the two -d's must not be removed. |
| 46 | 46 | ||
| 47 | PPCCOptions = {SymOption} {OptOption} -noMapCR -enum int ¶ | 47 | PPCCOptions = {SymOption} {OptOption} -noMapCR -enum int -alloca ¶ |
| 48 | -typecheck relaxed -w off ¶ | 48 | -typecheck relaxed -w off ¶ |
| 49 | -includes unix -i {Includes},{Src} ¶ | 49 | -includes unix -i {Includes},{Src} ¶ |
| 50 | -d emacs=1 -d HAVE_CONFIG_H -d MAC_OS -d MAC_OS8 | 50 | -d emacs=1 -d HAVE_CONFIG_H -d MAC_OS -d MAC_OS8 |
| @@ -63,7 +63,6 @@ BLOCKINPUT_H_GROUP = "{Src}blockinput.h" "{Src}atimer.h" "{Src}systime.h" ¶ | |||
| 63 | EmacsObjects = ¶ | 63 | EmacsObjects = ¶ |
| 64 | "{Src}abbrev.c.x" ¶ | 64 | "{Src}abbrev.c.x" ¶ |
| 65 | "{Src}alloc.c.x" ¶ | 65 | "{Src}alloc.c.x" ¶ |
| 66 | "{Src}alloca.c.x" ¶ | ||
| 67 | "{Src}atimer.c.x" ¶ | 66 | "{Src}atimer.c.x" ¶ |
| 68 | "{Src}buffer.c.x" ¶ | 67 | "{Src}buffer.c.x" ¶ |
| 69 | "{Src}bytecode.c.x" ¶ | 68 | "{Src}bytecode.c.x" ¶ |
| @@ -92,7 +91,9 @@ EmacsObjects = ¶ | |||
| 92 | "{Src}fns.c.x" ¶ | 91 | "{Src}fns.c.x" ¶ |
| 93 | "{Src}fontset.c.x" ¶ | 92 | "{Src}fontset.c.x" ¶ |
| 94 | "{Src}frame.c.x" ¶ | 93 | "{Src}frame.c.x" ¶ |
| 94 | "{Src}fringe.c.x" ¶ | ||
| 95 | "{Src}getloadavg.c.x" ¶ | 95 | "{Src}getloadavg.c.x" ¶ |
| 96 | "{Src}image.c.x" ¶ | ||
| 96 | "{Src}indent.c.x" ¶ | 97 | "{Src}indent.c.x" ¶ |
| 97 | "{Src}insdel.c.x" ¶ | 98 | "{Src}insdel.c.x" ¶ |
| 98 | "{Src}intervals.c.x" ¶ | 99 | "{Src}intervals.c.x" ¶ |
| @@ -120,7 +121,8 @@ EmacsObjects = ¶ | |||
| 120 | "{Src}undo.c.x" ¶ | 121 | "{Src}undo.c.x" ¶ |
| 121 | "{Src}window.c.x" ¶ | 122 | "{Src}window.c.x" ¶ |
| 122 | "{Src}xdisp.c.x" ¶ | 123 | "{Src}xdisp.c.x" ¶ |
| 123 | "{Src}xfaces.c.x" | 124 | "{Src}xfaces.c.x" ¶ |
| 125 | "{Src}lastfile.c.x" | ||
| 124 | 126 | ||
| 125 | # The list of object files generated from new source files of the Macintosh port. | 127 | # The list of object files generated from new source files of the Macintosh port. |
| 126 | 128 | ||
| @@ -142,6 +144,7 @@ Emacs ÄÄ {Makefile} {DocTarget}DOC {EmacsObjects} {MacObjects} | |||
| 142 | "{SharedLibraries}AppleScriptLib" ¶ | 144 | "{SharedLibraries}AppleScriptLib" ¶ |
| 143 | "{SharedLibraries}TextEncodingConverter" ¶ | 145 | "{SharedLibraries}TextEncodingConverter" ¶ |
| 144 | "{SharedLibraries}AppearanceLib" ¶ | 146 | "{SharedLibraries}AppearanceLib" ¶ |
| 147 | "{SharedLibraries}QuickTimeLib" ¶ | ||
| 145 | "{PPCLibraries}StdCRuntime.o" ¶ | 148 | "{PPCLibraries}StdCRuntime.o" ¶ |
| 146 | "{PPCLibraries}PPCCRuntime.o" ¶ | 149 | "{PPCLibraries}PPCCRuntime.o" ¶ |
| 147 | "{PPCLibraries}PPCToolLibs.o" ¶ | 150 | "{PPCLibraries}PPCToolLibs.o" ¶ |
| @@ -495,10 +498,33 @@ Emacs ÄÄ {Makefile} "{Source}"Emacs.maclf.r "{Source}"EmacsMPW.maclf.r | |||
| 495 | "{Src}commands.h" ¶ | 498 | "{Src}commands.h" ¶ |
| 496 | "{Src}keyboard.h" | 499 | "{Src}keyboard.h" |
| 497 | 500 | ||
| 501 | {Src}fringe.c.x Ä ¶ | ||
| 502 | {CONFIG_H_GROUP} ¶ | ||
| 503 | "{Src}lisp.h" ¶ | ||
| 504 | "{Src}frame.h" ¶ | ||
| 505 | {WINDOW_H_GROUP} ¶ | ||
| 506 | "{Src}buffer.h" ¶ | ||
| 507 | {BLOCKINPUT_H_GROUP} | ||
| 508 | |||
| 498 | {Src}getloadavg.c.x Ä ¶ | 509 | {Src}getloadavg.c.x Ä ¶ |
| 499 | {CONFIG_H_GROUP} ¶ | 510 | {CONFIG_H_GROUP} ¶ |
| 500 | "{Includes}sys:types.h" | 511 | "{Includes}sys:types.h" |
| 501 | 512 | ||
| 513 | {Src}image.c.x Ä ¶ | ||
| 514 | {CONFIG_H_GROUP} ¶ | ||
| 515 | "{Src}lisp.h" ¶ | ||
| 516 | "{Src}frame.h" ¶ | ||
| 517 | {WINDOW_H_GROUP} ¶ | ||
| 518 | {DISPEXTERN_H_GROUP} ¶ | ||
| 519 | {BLOCKINPUT_H_GROUP} ¶ | ||
| 520 | "{Includes}epaths.h" ¶ | ||
| 521 | "{Src}macterm.h" ¶ | ||
| 522 | "{Src}macgui.h" ¶ | ||
| 523 | "{Src}frame.h" ¶ | ||
| 524 | "{Includes}sys:stat.h" ¶ | ||
| 525 | "{Includes}alloca.h" ¶ | ||
| 526 | "{Includes}sys:param.h" | ||
| 527 | |||
| 502 | {Src}indent.c.x Ä ¶ | 528 | {Src}indent.c.x Ä ¶ |
| 503 | {CONFIG_H_GROUP} ¶ | 529 | {CONFIG_H_GROUP} ¶ |
| 504 | "{Src}lisp.h" ¶ | 530 | "{Src}lisp.h" ¶ |
| @@ -574,6 +600,9 @@ Emacs ÄÄ {Makefile} "{Source}"Emacs.maclf.r "{Source}"EmacsMPW.maclf.r | |||
| 574 | "{Src}puresize.h" ¶ | 600 | "{Src}puresize.h" ¶ |
| 575 | {INTERVALS_H_GROUP} | 601 | {INTERVALS_H_GROUP} |
| 576 | 602 | ||
| 603 | {Src}lastfile.c.x Ä ¶ | ||
| 604 | {CONFIG_H_GROUP} | ||
| 605 | |||
| 577 | {Src}lread.c.x Ä ¶ | 606 | {Src}lread.c.x Ä ¶ |
| 578 | {CONFIG_H_GROUP} ¶ | 607 | {CONFIG_H_GROUP} ¶ |
| 579 | "{Includes}sys:types.h" ¶ | 608 | "{Includes}sys:types.h" ¶ |
| @@ -935,7 +964,6 @@ DistClean Ä Clean | |||
| 935 | EmacsSource = ¶ | 964 | EmacsSource = ¶ |
| 936 | "{Src}abbrev.c" ¶ | 965 | "{Src}abbrev.c" ¶ |
| 937 | "{Src}alloc.c" ¶ | 966 | "{Src}alloc.c" ¶ |
| 938 | "{Src}alloca.c" ¶ | ||
| 939 | "{Src}atimer.c" ¶ | 967 | "{Src}atimer.c" ¶ |
| 940 | "{Src}buffer.c" ¶ | 968 | "{Src}buffer.c" ¶ |
| 941 | "{Src}bytecode.c" ¶ | 969 | "{Src}bytecode.c" ¶ |
| @@ -964,12 +992,15 @@ EmacsSource = ¶ | |||
| 964 | "{Src}fns.c" ¶ | 992 | "{Src}fns.c" ¶ |
| 965 | "{Src}fontset.c" ¶ | 993 | "{Src}fontset.c" ¶ |
| 966 | "{Src}frame.c" ¶ | 994 | "{Src}frame.c" ¶ |
| 995 | "{Src}fringe.c" ¶ | ||
| 967 | "{Src}getloadavg.c" ¶ | 996 | "{Src}getloadavg.c" ¶ |
| 997 | "{Src}image.c" ¶ | ||
| 968 | "{Src}indent.c" ¶ | 998 | "{Src}indent.c" ¶ |
| 969 | "{Src}insdel.c" ¶ | 999 | "{Src}insdel.c" ¶ |
| 970 | "{Src}intervals.c" ¶ | 1000 | "{Src}intervals.c" ¶ |
| 971 | "{Src}keyboard.c" ¶ | 1001 | "{Src}keyboard.c" ¶ |
| 972 | "{Src}keymap.c" ¶ | 1002 | "{Src}keymap.c" ¶ |
| 1003 | "{Src}lastfile.c" ¶ | ||
| 973 | "{Src}lread.c" ¶ | 1004 | "{Src}lread.c" ¶ |
| 974 | "{Src}macros.c" ¶ | 1005 | "{Src}macros.c" ¶ |
| 975 | "{Src}marker.c" ¶ | 1006 | "{Src}marker.c" ¶ |
| @@ -1018,7 +1049,7 @@ LispSource = ¶ | |||
| 1018 | {Lisp}abbrev.elc ¶ | 1049 | {Lisp}abbrev.elc ¶ |
| 1019 | {Lisp}buff-menu.elc ¶ | 1050 | {Lisp}buff-menu.elc ¶ |
| 1020 | {Lisp}server.elc ¶ | 1051 | {Lisp}server.elc ¶ |
| 1021 | {Lisp}byte-run.elc ¶ | 1052 | {Lisp}emacs-lisp:byte-run.elc ¶ |
| 1022 | {Lisp}cus-start.el ¶ | 1053 | {Lisp}cus-start.el ¶ |
| 1023 | {Lisp}custom.elc ¶ | 1054 | {Lisp}custom.elc ¶ |
| 1024 | {Lisp}emacs-lisp:lisp-mode.elc ¶ | 1055 | {Lisp}emacs-lisp:lisp-mode.elc ¶ |
| @@ -1026,7 +1057,7 @@ LispSource = ¶ | |||
| 1026 | {Lisp}facemenu.elc ¶ | 1057 | {Lisp}facemenu.elc ¶ |
| 1027 | {Lisp}faces.elc ¶ | 1058 | {Lisp}faces.elc ¶ |
| 1028 | {Lisp}files.elc ¶ | 1059 | {Lisp}files.elc ¶ |
| 1029 | {Lisp}float-sup.elc ¶ | 1060 | {Lisp}emacs-lisp:float-sup.elc ¶ |
| 1030 | {Lisp}format.elc ¶ | 1061 | {Lisp}format.elc ¶ |
| 1031 | {Lisp}frame.elc ¶ | 1062 | {Lisp}frame.elc ¶ |
| 1032 | {Lisp}help.elc ¶ | 1063 | {Lisp}help.elc ¶ |
| @@ -1035,7 +1066,7 @@ LispSource = ¶ | |||
| 1035 | {Lisp}loadup.el ¶ | 1066 | {Lisp}loadup.el ¶ |
| 1036 | {Lisp}loaddefs.el ¶ | 1067 | {Lisp}loaddefs.el ¶ |
| 1037 | {Lisp}bindings.elc ¶ | 1068 | {Lisp}bindings.elc ¶ |
| 1038 | {Lisp}map-ynp.elc ¶ | 1069 | {Lisp}emacs-lisp:map-ynp.elc ¶ |
| 1039 | {Lisp}international:mule.elc ¶ | 1070 | {Lisp}international:mule.elc ¶ |
| 1040 | {Lisp}international:mule-conf.el ¶ | 1071 | {Lisp}international:mule-conf.el ¶ |
| 1041 | {Lisp}international:mule-cmds.elc ¶ | 1072 | {Lisp}international:mule-cmds.elc ¶ |
diff --git a/man/ChangeLog b/man/ChangeLog index 3b6507e6b78..f12807c77d5 100644 --- a/man/ChangeLog +++ b/man/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * frames.texi (Dialog Boxes): Mention Gtk+ 2.6 also, as that version is | ||
| 4 | out now. | ||
| 5 | |||
| 6 | 2004-12-27 Richard M. Stallman <rms@gnu.org> | ||
| 7 | |||
| 8 | * Makefile.in (MAKEINFO): Specify --force. | ||
| 9 | |||
| 10 | * basic.texi (Moving Point): C-e now runs move-end-of-line. | ||
| 11 | (Undo): Doc undo-outer-limit. | ||
| 12 | |||
| 13 | 2004-12-11 Richard M. Stallman <rms@gnu.org> | ||
| 14 | |||
| 15 | * Makefile.in (MAKEINFO): Add --force. | ||
| 16 | |||
| 1 | 2004-12-20 Jay Belanger <belanger@truman.edu> | 17 | 2004-12-20 Jay Belanger <belanger@truman.edu> |
| 2 | 18 | ||
| 3 | * calc.texi (Types Tutorial): Emphasized that you can't divide by | 19 | * calc.texi (Types Tutorial): Emphasized that you can't divide by |
| @@ -23,6 +39,7 @@ | |||
| 23 | the standard "The GNU Emacs Manual" in fifth argument of @xref's. | 39 | the standard "The GNU Emacs Manual" in fifth argument of @xref's. |
| 24 | (Dealing with HTTP documents): @inforef->@xref. | 40 | (Dealing with HTTP documents): @inforef->@xref. |
| 25 | 41 | ||
| 42 | >>>>>>> 1.412 | ||
| 26 | 2004-12-15 Juri Linkov <juri@jurta.org> | 43 | 2004-12-15 Juri Linkov <juri@jurta.org> |
| 27 | 44 | ||
| 28 | * mark.texi (Transient Mark, Mark Ring): M-< and other | 45 | * mark.texi (Transient Mark, Mark Ring): M-< and other |
| @@ -39,6 +56,7 @@ | |||
| 39 | 56 | ||
| 40 | * calc.texi: Fix some TeX definitions. | 57 | * calc.texi: Fix some TeX definitions. |
| 41 | 58 | ||
| 59 | >>>>>>> 1.407 | ||
| 42 | 2004-12-12 Juri Linkov <juri@jurta.org> | 60 | 2004-12-12 Juri Linkov <juri@jurta.org> |
| 43 | 61 | ||
| 44 | * misc.texi (FFAP): Add C-x C-r, C-x C-v, C-x C-d, | 62 | * misc.texi (FFAP): Add C-x C-r, C-x C-v, C-x C-d, |
| @@ -52,6 +70,7 @@ | |||
| 52 | * mark.texi (Marking Objects): Marking commands also extend the | 70 | * mark.texi (Marking Objects): Marking commands also extend the |
| 53 | region when mark is active in Transient Mark mode. | 71 | region when mark is active in Transient Mark mode. |
| 54 | 72 | ||
| 73 | >>>>>>> 1.403 | ||
| 55 | 2004-12-09 Luc Teirlinck <teirllm@auburn.edu> | 74 | 2004-12-09 Luc Teirlinck <teirllm@auburn.edu> |
| 56 | 75 | ||
| 57 | * reftex.texi (Imprint): Remove erroneous @value's. | 76 | * reftex.texi (Imprint): Remove erroneous @value's. |
diff --git a/man/Makefile.in b/man/Makefile.in index b9b309855c9..03c664190f5 100644 --- a/man/Makefile.in +++ b/man/Makefile.in | |||
| @@ -31,7 +31,8 @@ VPATH=@srcdir@ | |||
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | # The makeinfo program is part of the Texinfo distribution. | 33 | # The makeinfo program is part of the Texinfo distribution. |
| 34 | MAKEINFO = makeinfo | 34 | # Use --force so that it generates output even if there are errors. |
| 35 | MAKEINFO = makeinfo --force | ||
| 35 | INFO_TARGETS = ../info/emacs ../info/emacs-xtra ../info/ccmode ../info/cl \ | 36 | INFO_TARGETS = ../info/emacs ../info/emacs-xtra ../info/ccmode ../info/cl \ |
| 36 | ../info/dired-x ../info/ediff ../info/forms ../info/gnus \ | 37 | ../info/dired-x ../info/ediff ../info/forms ../info/gnus \ |
| 37 | ../info/message ../info/sieve ../info/pgg ../info/emacs-mime \ | 38 | ../info/message ../info/sieve ../info/pgg ../info/emacs-mime \ |
diff --git a/man/basic.texi b/man/basic.texi index 3ec6e47c5bb..c04d8cf914c 100644 --- a/man/basic.texi +++ b/man/basic.texi | |||
| @@ -171,7 +171,7 @@ them). Others do more sophisticated things. | |||
| 171 | @kindex UP | 171 | @kindex UP |
| 172 | @kindex DOWN | 172 | @kindex DOWN |
| 173 | @findex beginning-of-line | 173 | @findex beginning-of-line |
| 174 | @findex end-of-line | 174 | @findex move-end-of-line |
| 175 | @findex forward-char | 175 | @findex forward-char |
| 176 | @findex backward-char | 176 | @findex backward-char |
| 177 | @findex next-line | 177 | @findex next-line |
| @@ -185,7 +185,7 @@ them). Others do more sophisticated things. | |||
| 185 | @item C-a | 185 | @item C-a |
| 186 | Move to the beginning of the line (@code{beginning-of-line}). | 186 | Move to the beginning of the line (@code{beginning-of-line}). |
| 187 | @item C-e | 187 | @item C-e |
| 188 | Move to the end of the line (@code{end-of-line}). | 188 | Move to the end of the line (@code{move-end-of-line}). |
| 189 | @item C-f | 189 | @item C-f |
| 190 | Move forward one character (@code{forward-char}). The right-arrow key | 190 | Move forward one character (@code{forward-char}). The right-arrow key |
| 191 | does the same thing. | 191 | does the same thing. |
| @@ -380,24 +380,32 @@ mark ring (@pxref{Mark Ring}). | |||
| 380 | 380 | ||
| 381 | @vindex undo-limit | 381 | @vindex undo-limit |
| 382 | @vindex undo-strong-limit | 382 | @vindex undo-strong-limit |
| 383 | @vindex undo-outer-limit | ||
| 383 | @cindex undo limit | 384 | @cindex undo limit |
| 384 | When the undo information for a buffer becomes too large, Emacs | 385 | When the undo information for a buffer becomes too large, Emacs |
| 385 | discards the oldest undo information from time to time (during garbage | 386 | discards the oldest undo information from time to time (during garbage |
| 386 | collection). You can specify how much undo information to keep by | 387 | collection). You can specify how much undo information to keep by |
| 387 | setting two variables: @code{undo-limit} and @code{undo-strong-limit}. | 388 | setting three variables: @code{undo-limit}, @code{undo-strong-limit}, |
| 388 | Their values are expressed in units of bytes of space. | 389 | and @code{undo-outer-limit}. Their values are expressed in units of |
| 390 | bytes of space. | ||
| 389 | 391 | ||
| 390 | The variable @code{undo-limit} sets a soft limit: Emacs keeps undo | 392 | The variable @code{undo-limit} sets a soft limit: Emacs keeps undo |
| 391 | data for enough commands to reach this size, and perhaps exceed it, but | 393 | data for enough commands to reach this size, and perhaps exceed it, |
| 392 | does not keep data for any earlier commands beyond that. Its default | 394 | but does not keep data for any earlier commands beyond that. Its |
| 393 | value is 20000. The variable @code{undo-strong-limit} sets a stricter | 395 | default value is 20000. The variable @code{undo-strong-limit} sets a |
| 394 | limit: the command which pushes the size past this amount is itself | 396 | stricter limit: a previous command (not the most recent one) which |
| 395 | forgotten. Its default value is 30000. | 397 | pushes the size past this amount is itself forgotten. The default |
| 396 | 398 | value of @code{undo-strong-limit} is 30000. | |
| 397 | Regardless of the values of those variables, the most recent change is | 399 | |
| 398 | never discarded, so there is no danger that garbage collection occurring | 400 | Regardless of the values of those variables, the most recent change |
| 399 | right after an unintentional large change might prevent you from undoing | 401 | is never discarded unless it gets bigger than @code{undo-outer-limit} |
| 400 | it. | 402 | (normally 300,000). At that point, Emacs asks whether to discard the |
| 403 | undo information even for the current command. (You also have the | ||
| 404 | option of quitting.) So there is normally no danger that garbage | ||
| 405 | collection occurring right after an unintentional large change might | ||
| 406 | prevent you from undoing it. But if you didn't expect the command | ||
| 407 | to create such large undo data, you can get rid of it and prevent | ||
| 408 | Emacs from running out of memory. | ||
| 401 | 409 | ||
| 402 | The reason the @code{undo} command has two keys, @kbd{C-x u} and | 410 | The reason the @code{undo} command has two keys, @kbd{C-x u} and |
| 403 | @kbd{C-_}, set up to run it is that it is worthy of a single-character | 411 | @kbd{C-_}, set up to run it is that it is worthy of a single-character |
diff --git a/man/calc.texi b/man/calc.texi index 8260ed10350..c4affa649f3 100644 --- a/man/calc.texi +++ b/man/calc.texi | |||
| @@ -11712,21 +11712,23 @@ calculator, and a variable in a programming language. (In fact, a Calc | |||
| 11712 | variable is really just an Emacs Lisp variable that contains a Calc number | 11712 | variable is really just an Emacs Lisp variable that contains a Calc number |
| 11713 | or formula.) A variable's name is normally composed of letters and digits. | 11713 | or formula.) A variable's name is normally composed of letters and digits. |
| 11714 | Calc also allows apostrophes and @code{#} signs in variable names. | 11714 | Calc also allows apostrophes and @code{#} signs in variable names. |
| 11715 | The Calc variable @code{foo} corresponds to the Emacs Lisp variable | 11715 | (The Calc variable @code{foo} corresponds to the Emacs Lisp variable |
| 11716 | @code{var-foo}. Commands like @kbd{s s} (@code{calc-store}) that operate | 11716 | @code{var-foo}, but unless you access the variable from within Emacs |
| 11717 | on variables can be made to use any arbitrary Lisp variable simply by | 11717 | Lisp, you don't need to worry about it.) |
| 11718 | backspacing over the @samp{var-} prefix in the minibuffer. | ||
| 11719 | 11718 | ||
| 11720 | In a command that takes a variable name, you can either type the full | 11719 | In a command that takes a variable name, you can either type the full |
| 11721 | name of a variable, or type a single digit to use one of the special | 11720 | name of a variable, or type a single digit to use one of the special |
| 11722 | convenience variables @code{var-q0} through @code{var-q9}. For example, | 11721 | convenience variables @code{q0} through @code{q9}. For example, |
| 11723 | @kbd{3 s s 2} stores the number 3 in variable @code{var-q2}, and | 11722 | @kbd{3 s s 2} stores the number 3 in variable @code{q2}, and |
| 11724 | @w{@kbd{3 s s foo @key{RET}}} stores that number in variable | 11723 | @w{@kbd{3 s s foo @key{RET}}} stores that number in variable |
| 11725 | @code{var-foo}. | 11724 | @code{foo}. |
| 11726 | 11725 | ||
| 11727 | To push a variable itself (as opposed to the variable's value) on the | 11726 | To push a variable itself (as opposed to the variable's value) on the |
| 11728 | stack, enter its name as an algebraic expression using the apostrophe | 11727 | stack, enter its name as an algebraic expression using the apostrophe |
| 11729 | (@key{'}) key. Variable names in algebraic formulas implicitly have | 11728 | (@key{'}) key. |
| 11729 | |||
| 11730 | xxx | ||
| 11731 | Variable names in algebraic formulas implicitly have | ||
| 11730 | @samp{var-} prefixed to their names. The @samp{#} character in variable | 11732 | @samp{var-} prefixed to their names. The @samp{#} character in variable |
| 11731 | names used in algebraic formulas corresponds to a dash @samp{-} in the | 11733 | names used in algebraic formulas corresponds to a dash @samp{-} in the |
| 11732 | Lisp variable name. If the name contains any dashes, the prefix @samp{var-} | 11734 | Lisp variable name. If the name contains any dashes, the prefix @samp{var-} |
| @@ -14139,7 +14141,7 @@ mode is the same as @samp{a_i} in Normal mode. Assignments | |||
| 14139 | turn into the @code{assign} function, which Calc normally displays | 14141 | turn into the @code{assign} function, which Calc normally displays |
| 14140 | using the @samp{:=} symbol. | 14142 | using the @samp{:=} symbol. |
| 14141 | 14143 | ||
| 14142 | The variables @code{var-pi} and @code{var-e} would be displayed @samp{pi} | 14144 | The variables @code{pi} and @code{e} would be displayed @samp{pi} |
| 14143 | and @samp{e} in Normal mode, but in C mode they are displayed as | 14145 | and @samp{e} in Normal mode, but in C mode they are displayed as |
| 14144 | @samp{M_PI} and @samp{M_E}, corresponding to the names of constants | 14146 | @samp{M_PI} and @samp{M_E}, corresponding to the names of constants |
| 14145 | typically provided in the @file{<math.h>} header. Functions whose | 14147 | typically provided in the @file{<math.h>} header. Functions whose |
| @@ -17220,7 +17222,9 @@ the corresponding generalized time zone (like @code{PGT}). | |||
| 17220 | 17222 | ||
| 17221 | If your system does not have a suitable @samp{date} command, you | 17223 | If your system does not have a suitable @samp{date} command, you |
| 17222 | may wish to put a @samp{(setq var-TimeZone ...)} in your Emacs | 17224 | may wish to put a @samp{(setq var-TimeZone ...)} in your Emacs |
| 17223 | initialization file to set the time zone. The easiest way to do | 17225 | initialization file to set the time zone. (Since you are interacting |
| 17226 | with the variable @code{TimeZone} directly from Emacs Lisp, the | ||
| 17227 | @code{var-} prefix needs to be present.) The easiest way to do | ||
| 17224 | this is to edit the @code{TimeZone} variable using Calc's @kbd{s T} | 17228 | this is to edit the @code{TimeZone} variable using Calc's @kbd{s T} |
| 17225 | command, then use the @kbd{s p} (@code{calc-permanent-variable}) | 17229 | command, then use the @kbd{s p} (@code{calc-permanent-variable}) |
| 17226 | command to save the value of @code{TimeZone} permanently. | 17230 | command to save the value of @code{TimeZone} permanently. |
| @@ -27847,14 +27851,8 @@ to variables use the @kbd{s} prefix key. | |||
| 27847 | The @kbd{s s} (@code{calc-store}) command stores the value at the top of | 27851 | The @kbd{s s} (@code{calc-store}) command stores the value at the top of |
| 27848 | the stack into a specified variable. It prompts you to enter the | 27852 | the stack into a specified variable. It prompts you to enter the |
| 27849 | name of the variable. If you press a single digit, the value is stored | 27853 | name of the variable. If you press a single digit, the value is stored |
| 27850 | immediately in one of the ``quick'' variables @code{var-q0} through | 27854 | immediately in one of the ``quick'' variables @code{q0} through |
| 27851 | @code{var-q9}. Or you can enter any variable name. The prefix @samp{var-} | 27855 | @code{q9}. Or you can enter any variable name. |
| 27852 | is supplied for you; when a name appears in a formula (as in @samp{a+q2}) | ||
| 27853 | the prefix @samp{var-} is also supplied there, so normally you can simply | ||
| 27854 | forget about @samp{var-} everywhere. Its only purpose is to enable you to | ||
| 27855 | use Calc variables without fear of accidentally clobbering some variable in | ||
| 27856 | another Emacs package. If you really want to store in an arbitrary Lisp | ||
| 27857 | variable, just backspace over the @samp{var-}. | ||
| 27858 | 27856 | ||
| 27859 | @kindex s t | 27857 | @kindex s t |
| 27860 | @pindex calc-store-into | 27858 | @pindex calc-store-into |
| @@ -28038,10 +28036,10 @@ you change the value of one of these variables, or of one of the other | |||
| 28038 | special variables @code{inf}, @code{uinf}, and @code{nan} (which are | 28036 | special variables @code{inf}, @code{uinf}, and @code{nan} (which are |
| 28039 | normally void). | 28037 | normally void). |
| 28040 | 28038 | ||
| 28041 | Note that @code{var-pi} doesn't actually have 3.14159265359 stored | 28039 | Note that @code{pi} doesn't actually have 3.14159265359 stored |
| 28042 | in it, but rather a special magic value that evaluates to @cpi{} | 28040 | in it, but rather a special magic value that evaluates to @cpi{} |
| 28043 | at the current precision. Likewise @code{var-e}, @code{var-i}, and | 28041 | at the current precision. Likewise @code{e}, @code{i}, and |
| 28044 | @code{var-phi} evaluate according to the current precision or polar mode. | 28042 | @code{phi} evaluate according to the current precision or polar mode. |
| 28045 | If you recall a value from @code{pi} and store it back, this magic | 28043 | If you recall a value from @code{pi} and store it back, this magic |
| 28046 | property will be lost. | 28044 | property will be lost. |
| 28047 | 28045 | ||
| @@ -28052,9 +28050,9 @@ value of one variable to another. It differs from a simple @kbd{s r} | |||
| 28052 | followed by an @kbd{s t} in two important ways. First, the value never | 28050 | followed by an @kbd{s t} in two important ways. First, the value never |
| 28053 | goes on the stack and thus is never rounded, evaluated, or simplified | 28051 | goes on the stack and thus is never rounded, evaluated, or simplified |
| 28054 | in any way; it is not even rounded down to the current precision. | 28052 | in any way; it is not even rounded down to the current precision. |
| 28055 | Second, the ``magic'' contents of a variable like @code{var-e} can | 28053 | Second, the ``magic'' contents of a variable like @code{e} can |
| 28056 | be copied into another variable with this command, perhaps because | 28054 | be copied into another variable with this command, perhaps because |
| 28057 | you need to unstore @code{var-e} right now but you wish to put it | 28055 | you need to unstore @code{e} right now but you wish to put it |
| 28058 | back when you're done. The @kbd{s c} command is the only way to | 28056 | back when you're done. The @kbd{s c} command is the only way to |
| 28059 | manipulate these magic values intact. | 28057 | manipulate these magic values intact. |
| 28060 | 28058 | ||
| @@ -28216,7 +28214,7 @@ by hand. (@xref{General Mode Commands}, for a way to tell Calc to | |||
| 28216 | use a different file instead of @file{.emacs}.) | 28214 | use a different file instead of @file{.emacs}.) |
| 28217 | 28215 | ||
| 28218 | If you do not specify the name of a variable to save (i.e., | 28216 | If you do not specify the name of a variable to save (i.e., |
| 28219 | @kbd{s p @key{RET}}), all @samp{var-} variables with defined values | 28217 | @kbd{s p @key{RET}}), all Calc variables with defined values |
| 28220 | are saved except for the special constants @code{pi}, @code{e}, | 28218 | are saved except for the special constants @code{pi}, @code{e}, |
| 28221 | @code{i}, @code{phi}, and @code{gamma}; the variables @code{TimeZone} | 28219 | @code{i}, @code{phi}, and @code{gamma}; the variables @code{TimeZone} |
| 28222 | and @code{PlotRejects}; | 28220 | and @code{PlotRejects}; |
| @@ -28228,8 +28226,9 @@ explicitly naming them in an @kbd{s p} command.) | |||
| 28228 | @kindex s i | 28226 | @kindex s i |
| 28229 | @pindex calc-insert-variables | 28227 | @pindex calc-insert-variables |
| 28230 | The @kbd{s i} (@code{calc-insert-variables}) command writes | 28228 | The @kbd{s i} (@code{calc-insert-variables}) command writes |
| 28231 | the values of all @samp{var-} variables into a specified buffer. | 28229 | the values of all Calc variables into a specified buffer. |
| 28232 | The variables are written in the form of Lisp @code{setq} commands | 28230 | The variables are written with the prefix @code{var-} in the form of |
| 28231 | Lisp @code{setq} commands | ||
| 28233 | which store the values in string form. You can place these commands | 28232 | which store the values in string form. You can place these commands |
| 28234 | in your @file{.emacs} buffer if you wish, though in this case it | 28233 | in your @file{.emacs} buffer if you wish, though in this case it |
| 28235 | would be easier to use @kbd{s p @key{RET}}. (Note that @kbd{s i} | 28234 | would be easier to use @kbd{s p @key{RET}}. (Note that @kbd{s i} |
diff --git a/man/frames.texi b/man/frames.texi index e9716c76a1f..45133d746a3 100644 --- a/man/frames.texi +++ b/man/frames.texi | |||
| @@ -913,7 +913,7 @@ of dialogs. This option has no effect if you have suppressed all dialog | |||
| 913 | boxes with the option @code{use-dialog-box}. | 913 | boxes with the option @code{use-dialog-box}. |
| 914 | 914 | ||
| 915 | @vindex x-use-old-gtk-file-dialog | 915 | @vindex x-use-old-gtk-file-dialog |
| 916 | For Gtk+ version 2.4, you can make Emacs use the old file dialog | 916 | For Gtk+ version 2.4 and 2.6, you can make Emacs use the old file dialog |
| 917 | by setting the variable @code{x-use-old-gtk-file-dialog} to a non-@code{nil} | 917 | by setting the variable @code{x-use-old-gtk-file-dialog} to a non-@code{nil} |
| 918 | value. If Emacs is built with a Gtk+ version that has only one file dialog, | 918 | value. If Emacs is built with a Gtk+ version that has only one file dialog, |
| 919 | the setting of this variable has no effect. | 919 | the setting of this variable has no effect. |
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c index 363b225a355..2f81299cbb6 100644 --- a/oldXMenu/Activate.c +++ b/oldXMenu/Activate.c | |||
| @@ -81,6 +81,7 @@ | |||
| 81 | 81 | ||
| 82 | #include <config.h> | 82 | #include <config.h> |
| 83 | #include "XMenuInt.h" | 83 | #include "XMenuInt.h" |
| 84 | #include <X11/keysym.h> | ||
| 84 | 85 | ||
| 85 | /* For debug, set this to 0 to not grab the keyboard on menu popup */ | 86 | /* For debug, set this to 0 to not grab the keyboard on menu popup */ |
| 86 | int x_menu_grab_keyboard = 1; | 87 | int x_menu_grab_keyboard = 1; |
| @@ -131,6 +132,7 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data, | |||
| 131 | Window root, child; | 132 | Window root, child; |
| 132 | int root_x, root_y, win_x, win_y; | 133 | int root_x, root_y, win_x, win_y; |
| 133 | unsigned int mask; | 134 | unsigned int mask; |
| 135 | KeySym keysym; | ||
| 134 | 136 | ||
| 135 | /* | 137 | /* |
| 136 | * Define and allocate a foreign event queue to hold events | 138 | * Define and allocate a foreign event queue to hold events |
| @@ -458,6 +460,18 @@ XMenuActivate(display, menu, p_num, s_num, x_pos, y_pos, event_mask, data, | |||
| 458 | } | 460 | } |
| 459 | selection = True; | 461 | selection = True; |
| 460 | break; | 462 | break; |
| 463 | case KeyPress: | ||
| 464 | case KeyRelease: | ||
| 465 | keysym = XLookupKeysym (&event.xkey, 0); | ||
| 466 | |||
| 467 | /* Pop down on C-g and Escape. */ | ||
| 468 | if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0) | ||
| 469 | || keysym == XK_Escape) /* Any escape, ignore modifiers. */ | ||
| 470 | { | ||
| 471 | ret_val = XM_NO_SELECT; | ||
| 472 | selection = True; | ||
| 473 | } | ||
| 474 | break; | ||
| 461 | default: | 475 | default: |
| 462 | /* | 476 | /* |
| 463 | * If AEQ mode is enabled then queue the event. | 477 | * If AEQ mode is enabled then queue the event. |
diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog index ab86c364736..31a786cc23a 100644 --- a/oldXMenu/ChangeLog +++ b/oldXMenu/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * Activate.c (XMenuActivate): Return XM_NO_SELECT if Escape or C-g | ||
| 4 | was pressed. | ||
| 5 | |||
| 1 | 2004-11-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 6 | 2004-11-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 7 | ||
| 3 | * XMenu.h (XMenuActivateSetWaitFunction): New function. | 8 | * XMenu.h (XMenuActivateSetWaitFunction): New function. |
diff --git a/src/ChangeLog b/src/ChangeLog index 8d09c5bfd2f..26ea457a2fe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,203 @@ | |||
| 1 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * xmenu.c (popup_get_selection): Only pop down dialogs | ||
| 4 | on C-g and Escape. | ||
| 5 | (popup_get_selection): Remove parameter down_on_keypress. | ||
| 6 | (create_and_show_popup_menu, create_and_show_dialog): Remove | ||
| 7 | parameter down_on_keypress to popup_get_selection. | ||
| 8 | |||
| 9 | 2004-12-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 10 | |||
| 11 | * dispextern.h: Change HAVE_CARBON to MAC_OS. | ||
| 12 | (struct glyph_string): Likewise. | ||
| 13 | * emacs.c (main) [MAC_OS8]: Call mac_term_init instead of | ||
| 14 | mac_initialize. | ||
| 15 | * fileio.c (Fnext_read_file_uses_dialog_p, Fread_file_name): | ||
| 16 | Change TARGET_API_MAC_CARBON to HAVE_CARBON. | ||
| 17 | * fns.c (vector): Change MAC_OSX to MAC_OS. | ||
| 18 | * frame.c (x_set_frame_parameters, x_report_frame_params) | ||
| 19 | (x_set_fullscreen): Remove #ifndef HAVE_CARBON. | ||
| 20 | (x_set_border_width, Vdefault_frame_scroll_bars): Change | ||
| 21 | HAVE_CARBON to MAC_OS. | ||
| 22 | * image.c [MAC_OS]: Include sys/stat.h. | ||
| 23 | [MAC_OS && !MAC_OSX]: Include sys/param.h, ImageCompression.h, and | ||
| 24 | QuickTimeComponents.h. | ||
| 25 | * mac.c [!MAC_OSX] (mac_wait_next_event): Add extern. | ||
| 26 | [!MAC_OSX] (select): Use mac_wait_next_event. | ||
| 27 | [!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to | ||
| 28 | Vexec_suffixes. | ||
| 29 | [!MAC_OSX] (select, run_mac_command): Change `#ifdef | ||
| 30 | TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. | ||
| 31 | (mac_clear_font_name_table): Add extern. | ||
| 32 | (Fmac_clear_font_name_table): New defun. | ||
| 33 | (syms_of_mac): Defsubr it. | ||
| 34 | [MAC_OSX] (SELECT_POLLING_PERIOD_USEC): New define. | ||
| 35 | [MAC_OSX] (select_and_poll_event): New function. | ||
| 36 | [MAC_OSX] (sys_select): Use it. | ||
| 37 | [MAC_OSX && SELECT_USE_CFSOCKET] (socket_callback): New function. | ||
| 38 | [MAC_OSX && SELECT_USE_CFSOCKET] | ||
| 39 | (SELECT_TIMEOUT_THRESHOLD_RUNLOOP, EVENT_CLASS_SOCK): New defines. | ||
| 40 | [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Use CFSocket and | ||
| 41 | RunLoop for simultaneously monitoring two kinds of inputs, window | ||
| 42 | events and process outputs, without periodically polling. | ||
| 43 | * macfns.c (mac_initialized): Remove extern. | ||
| 44 | (stricmp): Put in #if 0. All callers changed to use xstricmp in | ||
| 45 | xfaces.c. | ||
| 46 | (strnicmp): Decrement `n' at the end of each loop, not the | ||
| 47 | beginning. | ||
| 48 | (check_mac): Use the term "Mac native windows" instead of "Mac | ||
| 49 | OS". | ||
| 50 | (check_x_display_info, x_display_info_for_name): Sync with xfns.c. | ||
| 51 | (mac_get_rdb_resource): New function (from w32reg.c). | ||
| 52 | (x_get_string_resource): Use it. | ||
| 53 | (install_window_handler): Add extern. | ||
| 54 | (mac_window): New function. | ||
| 55 | (Fx_create_frame): Use it instead of make_mac_frame. Set | ||
| 56 | parameter for Qfullscreen. Call x_wm_set_size_hint. | ||
| 57 | (Fx_open_connection, Fx_close_connection): New defuns. | ||
| 58 | (syms_of_macfns): Defsubr them. | ||
| 59 | (x_create_tip_frame) [TARGET_API_MAC_CARBON]: Add | ||
| 60 | kWindowNoUpdatesAttribute to the window attribute. | ||
| 61 | (x_create_tip_frame) [!TARGET_API_MAC_CARBON]: Use NewCWindow. | ||
| 62 | (x_create_tip_frame): Don't call ShowWindow. | ||
| 63 | (Fx_show_tip): Call ShowWindow. | ||
| 64 | (Fx_file_dialog): Change `#ifdef TARGET_API_MAC_CARBON' to `#if | ||
| 65 | TARGET_API_MAC_CARBON'. | ||
| 66 | (mac_frame_parm_handlers): Set handlers for Qfullscreen. | ||
| 67 | (syms_of_macfns) [MAC_OSX]: Initialize mac_in_use to 0. | ||
| 68 | * macgui.h [!MAC_OSX]: Don't include Controls.h. Include | ||
| 69 | Windows.h. | ||
| 70 | (Window): Typedef to WindowPtr and move outside `#if | ||
| 71 | TARGET_API_MAC_CARBON'. | ||
| 72 | (XSizeHints): New struct. | ||
| 73 | * macterm.c (x_update_begin, x_update_end) | ||
| 74 | [TARGET_API_MAC_CARBON]: Disable screen updates during update of a | ||
| 75 | frame. | ||
| 76 | (x_draw_glyph_string_background, x_draw_glyph_string_foreground) | ||
| 77 | [MAC_OS8]: Use XDrawImageString/XDrawImageString16. | ||
| 78 | (construct_mouse_click): Put in #if 0. | ||
| 79 | (x_check_fullscreen, x_check_fullscreen_move): Remove decls. | ||
| 80 | (x_scroll_bar_create, x_scroll_bar_handle_click): Change `#ifdef | ||
| 81 | TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. | ||
| 82 | (activate_scroll_bars, deactivate_scroll_bars) | ||
| 83 | [!TARGET_API_MAC_CARBON]: Use ActivateControl/DeactivateControl. | ||
| 84 | (x_make_frame_visible) [TARGET_API_MAC_CARBON]: Reposition window | ||
| 85 | if the position is neither user-specified nor program-specified. | ||
| 86 | (x_free_frame_resources): Free size_hints. | ||
| 87 | (x_wm_set_size_hint): Allocate size_hints if needed. Set | ||
| 88 | size_hints. | ||
| 89 | (mac_clear_font_name_table): New function. | ||
| 90 | (mac_do_list_fonts): Initialize font_name_table if needed. | ||
| 91 | (x_list_fonts): Don't initialize font_name_table. Add BLOCK_INPUT | ||
| 92 | around mac_do_list_fonts. | ||
| 93 | (mac_unload_font): New function. | ||
| 94 | (x_load_font): Add BLOCK_INPUT around XLoadQueryFont. | ||
| 95 | (init_mac_drag_n_drop, mac_do_receive_drag): Enclose declarations | ||
| 96 | and definitions with #if TARGET_API_MAC_CARBON. | ||
| 97 | [USE_CARBON_EVENTS] (mac_handle_window_event): Add decl. | ||
| 98 | (install_window_handler): Add decl. | ||
| 99 | (do_window_update): Add BeginUpdate/EndUpdate for the tooltip | ||
| 100 | window. Use UpdateControls. Get the rectangle that should be | ||
| 101 | updated and restrict the target of expose_frame to it. | ||
| 102 | (do_grow_window): Set minimum height/width according to | ||
| 103 | size_hints. | ||
| 104 | (do_grow_window) [TARGET_API_MAC_CARBON]: Use ResizeWindow. | ||
| 105 | (do_zoom_window): Don't use x_set_window_size. | ||
| 106 | [USE_CARBON_EVENTS] (mac_handle_window_event): New function. | ||
| 107 | (install_window_handler): New function. | ||
| 108 | [!USE_CARBON_EVENTS] (mouse_region): New variable. | ||
| 109 | [!USE_CARBON_EVENTS] (mac_wait_next_event): New function. | ||
| 110 | (XTread_socket) [USE_CARBON_EVENTS]: Move call to | ||
| 111 | GetEventDispatcherTarget inside BLOCK_INPUT. | ||
| 112 | (XTread_socket) [!USE_CARBON_EVENTS]: Use mac_wait_next_event. | ||
| 113 | Update mouse_region when mouse is moved. | ||
| 114 | (make_mac_frame): Remove. | ||
| 115 | (make_mac_terminal_frame): Put in #ifdef MAC_OS8. Initialize | ||
| 116 | mouse pointer shapes. Change values of f->left_pos and | ||
| 117 | f->top_pos. Don't use make_mac_frame. Use NewCWindow. Don't | ||
| 118 | call ShowWindow. | ||
| 119 | (mac_initialize_display_info) [MAC_OSX]: Create mac_id_name from | ||
| 120 | Vinvocation_name and Vsystem_name. | ||
| 121 | (mac_make_rdb): New function (from w32term.c). | ||
| 122 | (mac_term_init): Use it. Add BLOCK_INPUT. Error if display has | ||
| 123 | already been opened. Don't pass argument to | ||
| 124 | mac_initialize_display_info. Don't set dpyinfo->height/width. | ||
| 125 | Add entries to x_display_list and x_display_name_list. | ||
| 126 | (x_delete_display): New function. | ||
| 127 | (mac_initialize): Don't call mac_initialize_display_info. | ||
| 128 | (syms_of_macterm) [!MAC_OSX]: Don't call Fprovide. | ||
| 129 | * macterm.h (check_mac): Add extern. | ||
| 130 | (struct mac_output): New member size_hints. | ||
| 131 | (FRAME_SIZE_HINTS): New macro. | ||
| 132 | (mac_unload_font): Add extern. | ||
| 133 | * xdisp.c (expose_window, expose_frame): Remove kludges for Mac. | ||
| 134 | * xfaces.c (clear_font_table) [MAC_OS]: call mac_unload_font. | ||
| 135 | |||
| 136 | 2004-12-27 Richard M. Stallman <rms@gnu.org> | ||
| 137 | |||
| 138 | * buffer.c (Fbuffer_disable_undo): Deleted (moved to simple.el). | ||
| 139 | (syms_of_buffer): Don't defsubr it. | ||
| 140 | |||
| 141 | * process.c (list_processes_1): Set undo_list instead | ||
| 142 | of calling Fbuffer_disable_undo. | ||
| 143 | |||
| 144 | * xdisp.c (single_display_spec_string_p): Renamed from | ||
| 145 | single_display_prop_string_p. | ||
| 146 | (single_display_spec_intangible_p): Renamed from | ||
| 147 | single_display_prop_intangible_p. | ||
| 148 | (handle_single_display_spec): Renamed from handle_single_display_prop. | ||
| 149 | Rewritten to be easier to understand. | ||
| 150 | |||
| 151 | * Change in load-history format. Functions now get (defun . NAME), | ||
| 152 | and variables get just NAME. | ||
| 153 | |||
| 154 | * data.c (Fdefalias): Use (defun . FN_NAME) in LOADHIST_ATTACH. | ||
| 155 | |||
| 156 | * eval.c (Fdefun, Fdefmacro): Use (defun . FN_NAME) in LOADHIST_ATTACH. | ||
| 157 | (Fdefvaralias, Fdefvar, Fdefconst): Use just SYM in LOADHIST_ATTACH. | ||
| 158 | (Qdefvar): Var deleted. | ||
| 159 | (syms_of_eval): Don't initialze it. | ||
| 160 | |||
| 161 | * lread.c (syms_of_lread) <load-history>: Doc fix. | ||
| 162 | |||
| 163 | 2004-12-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 164 | |||
| 165 | * xmenu.c (popup_get_selection): Pop down on C-g. | ||
| 166 | (set_frame_menubar): Install translations for Lucid/Motif/Lesstif that | ||
| 167 | pops down menu on C-g. | ||
| 168 | (xdialog_show): If dialog popped down and no button in the dialog was | ||
| 169 | pushed, call Fsignal to quit. | ||
| 170 | (xmenu_show): In no toolkit version, if menu returns NO_SELECT call | ||
| 171 | Fsignal to quit. | ||
| 172 | |||
| 173 | * xfns.c (Fx_file_dialog): Motif/Lesstif version: Pop down on C-g. | ||
| 174 | |||
| 175 | * gtkutil.c (xg_initialize): Install bindings for C-g so that | ||
| 176 | dialogs and menus pop down. | ||
| 177 | |||
| 178 | 2004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 179 | |||
| 180 | * gtkutil.c (update_frame_tool_bar): Make the value of | ||
| 181 | tool-bar-button-margin control margins of images in tool bar. | ||
| 182 | |||
| 183 | * alloc.c (check_depth): New variable. | ||
| 184 | (overrun_check_malloc, overrun_check_realloc): Only add | ||
| 185 | overhead and write check pattern if check_depth is 1 (to handle | ||
| 186 | recursive calls). Increase/decrease check_depth in entry/exit. | ||
| 187 | (overrun_check_free): Only check for overhead if check_depth is 1. | ||
| 188 | Increase/decrease check_depth in entry/exit. | ||
| 189 | |||
| 190 | 2004-12-23 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 191 | |||
| 192 | * keyboard.c (input_available_signal): Call SIGNAL_THREAD_CHECK | ||
| 193 | before touching input_available_clear_time, to avoid accessing it | ||
| 194 | from multiple threads. | ||
| 195 | |||
| 196 | 2004-12-23 Jason Rumney <jasonr@gnu.org> | ||
| 197 | |||
| 198 | * image.c (__WIN32__) [HAVE_NTGUI]: Define for correct behaviour | ||
| 199 | of JPEG library. | ||
| 200 | |||
| 1 | 2004-12-22 Richard M. Stallman <rms@gnu.org> | 201 | 2004-12-22 Richard M. Stallman <rms@gnu.org> |
| 2 | 202 | ||
| 3 | * emacs.c (main): If batch mode, set Vundo_outer_limit to nil. | 203 | * emacs.c (main): If batch mode, set Vundo_outer_limit to nil. |
diff --git a/src/alloc.c b/src/alloc.c index 7a6a1344d6c..eabbf5192f4 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -602,6 +602,27 @@ static char xmalloc_overrun_check_trailer[XMALLOC_OVERRUN_CHECK_SIZE] = | |||
| 602 | ((unsigned)(ptr[-4]) << 24)) | 602 | ((unsigned)(ptr[-4]) << 24)) |
| 603 | 603 | ||
| 604 | 604 | ||
| 605 | /* The call depth in overrun_check functions. For example, this might happen: | ||
| 606 | xmalloc() | ||
| 607 | overrun_check_malloc() | ||
| 608 | -> malloc -> (via hook)_-> emacs_blocked_malloc | ||
| 609 | -> overrun_check_malloc | ||
| 610 | call malloc (hooks are NULL, so real malloc is called). | ||
| 611 | malloc returns 10000. | ||
| 612 | add overhead, return 10016. | ||
| 613 | <- (back in overrun_check_malloc) | ||
| 614 | add overhead again, return 10032 | ||
| 615 | xmalloc returns 10032. | ||
| 616 | |||
| 617 | (time passes). | ||
| 618 | |||
| 619 | xfree(10032) | ||
| 620 | overrun_check_free(10032) | ||
| 621 | decrease overhed | ||
| 622 | free(10016) <- crash, because 10000 is the original pointer. */ | ||
| 623 | |||
| 624 | static int check_depth; | ||
| 625 | |||
| 605 | /* Like malloc, but wraps allocated block with header and trailer. */ | 626 | /* Like malloc, but wraps allocated block with header and trailer. */ |
| 606 | 627 | ||
| 607 | POINTER_TYPE * | 628 | POINTER_TYPE * |
| @@ -609,15 +630,17 @@ overrun_check_malloc (size) | |||
| 609 | size_t size; | 630 | size_t size; |
| 610 | { | 631 | { |
| 611 | register unsigned char *val; | 632 | register unsigned char *val; |
| 633 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; | ||
| 612 | 634 | ||
| 613 | val = (unsigned char *) malloc (size + XMALLOC_OVERRUN_CHECK_SIZE*2); | 635 | val = (unsigned char *) malloc (size + overhead); |
| 614 | if (val) | 636 | if (val && check_depth == 1) |
| 615 | { | 637 | { |
| 616 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 638 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); |
| 617 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 639 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 618 | XMALLOC_PUT_SIZE(val, size); | 640 | XMALLOC_PUT_SIZE(val, size); |
| 619 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 641 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); |
| 620 | } | 642 | } |
| 643 | --check_depth; | ||
| 621 | return (POINTER_TYPE *)val; | 644 | return (POINTER_TYPE *)val; |
| 622 | } | 645 | } |
| 623 | 646 | ||
| @@ -631,8 +654,10 @@ overrun_check_realloc (block, size) | |||
| 631 | size_t size; | 654 | size_t size; |
| 632 | { | 655 | { |
| 633 | register unsigned char *val = (unsigned char *)block; | 656 | register unsigned char *val = (unsigned char *)block; |
| 657 | size_t overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_SIZE*2 : 0; | ||
| 634 | 658 | ||
| 635 | if (val | 659 | if (val |
| 660 | && check_depth == 1 | ||
| 636 | && bcmp (xmalloc_overrun_check_header, | 661 | && bcmp (xmalloc_overrun_check_header, |
| 637 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 662 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 638 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 663 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| @@ -647,15 +672,16 @@ overrun_check_realloc (block, size) | |||
| 647 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 672 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); |
| 648 | } | 673 | } |
| 649 | 674 | ||
| 650 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + XMALLOC_OVERRUN_CHECK_SIZE*2); | 675 | val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead); |
| 651 | 676 | ||
| 652 | if (val) | 677 | if (val && check_depth == 1) |
| 653 | { | 678 | { |
| 654 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); | 679 | bcopy (xmalloc_overrun_check_header, val, XMALLOC_OVERRUN_CHECK_SIZE - 4); |
| 655 | val += XMALLOC_OVERRUN_CHECK_SIZE; | 680 | val += XMALLOC_OVERRUN_CHECK_SIZE; |
| 656 | XMALLOC_PUT_SIZE(val, size); | 681 | XMALLOC_PUT_SIZE(val, size); |
| 657 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); | 682 | bcopy (xmalloc_overrun_check_trailer, val + size, XMALLOC_OVERRUN_CHECK_SIZE); |
| 658 | } | 683 | } |
| 684 | --check_depth; | ||
| 659 | return (POINTER_TYPE *)val; | 685 | return (POINTER_TYPE *)val; |
| 660 | } | 686 | } |
| 661 | 687 | ||
| @@ -667,7 +693,9 @@ overrun_check_free (block) | |||
| 667 | { | 693 | { |
| 668 | unsigned char *val = (unsigned char *)block; | 694 | unsigned char *val = (unsigned char *)block; |
| 669 | 695 | ||
| 696 | ++check_depth; | ||
| 670 | if (val | 697 | if (val |
| 698 | && check_depth == 1 | ||
| 671 | && bcmp (xmalloc_overrun_check_header, | 699 | && bcmp (xmalloc_overrun_check_header, |
| 672 | val - XMALLOC_OVERRUN_CHECK_SIZE, | 700 | val - XMALLOC_OVERRUN_CHECK_SIZE, |
| 673 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) | 701 | XMALLOC_OVERRUN_CHECK_SIZE - 4) == 0) |
| @@ -683,6 +711,7 @@ overrun_check_free (block) | |||
| 683 | } | 711 | } |
| 684 | 712 | ||
| 685 | free (val); | 713 | free (val); |
| 714 | --check_depth; | ||
| 686 | } | 715 | } |
| 687 | 716 | ||
| 688 | #undef malloc | 717 | #undef malloc |
diff --git a/src/buffer.c b/src/buffer.c index 2d931272467..38678dc5a49 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1251,29 +1251,6 @@ If BUFFER is omitted or nil, some interesting buffer is returned. */) | |||
| 1251 | return buf; | 1251 | return buf; |
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | DEFUN ("buffer-disable-undo", Fbuffer_disable_undo, Sbuffer_disable_undo, | ||
| 1255 | 0, 1, "", | ||
| 1256 | doc: /* Make BUFFER stop keeping undo information. | ||
| 1257 | No argument or nil as argument means do this for the current buffer. */) | ||
| 1258 | (buffer) | ||
| 1259 | register Lisp_Object buffer; | ||
| 1260 | { | ||
| 1261 | Lisp_Object real_buffer; | ||
| 1262 | |||
| 1263 | if (NILP (buffer)) | ||
| 1264 | XSETBUFFER (real_buffer, current_buffer); | ||
| 1265 | else | ||
| 1266 | { | ||
| 1267 | real_buffer = Fget_buffer (buffer); | ||
| 1268 | if (NILP (real_buffer)) | ||
| 1269 | nsberror (buffer); | ||
| 1270 | } | ||
| 1271 | |||
| 1272 | XBUFFER (real_buffer)->undo_list = Qt; | ||
| 1273 | |||
| 1274 | return Qnil; | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, | 1254 | DEFUN ("buffer-enable-undo", Fbuffer_enable_undo, Sbuffer_enable_undo, |
| 1278 | 0, 1, "", | 1255 | 0, 1, "", |
| 1279 | doc: /* Start keeping undo information for buffer BUFFER. | 1256 | doc: /* Start keeping undo information for buffer BUFFER. |
| @@ -5671,9 +5648,10 @@ A value of nil means to use the scroll bar width from the window's frame. */); | |||
| 5671 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, | 5648 | DEFVAR_PER_BUFFER ("vertical-scroll-bar", ¤t_buffer->vertical_scroll_bar_type, |
| 5672 | Qnil, | 5649 | Qnil, |
| 5673 | doc: /* *Position of this buffer's vertical scroll bar. | 5650 | doc: /* *Position of this buffer's vertical scroll bar. |
| 5674 | A value of left or right means to place the vertical scroll bar at that side | 5651 | The value takes effect whenever you display this buffer in a window. |
| 5675 | of the window; a value of nil means that this window has no vertical scroll bar. | 5652 | A value of `left' or `right' means put the vertical scroll bar at that side |
| 5676 | A value of t means to use the vertical scroll bar type from the window's frame. */); | 5653 | of the window; a value of nil means don't show any vertical scroll bars. |
| 5654 | A value of t (the default) means do whatever the window's frame specifies. */); | ||
| 5677 | 5655 | ||
| 5678 | DEFVAR_PER_BUFFER ("indicate-empty-lines", | 5656 | DEFVAR_PER_BUFFER ("indicate-empty-lines", |
| 5679 | ¤t_buffer->indicate_empty_lines, Qnil, | 5657 | ¤t_buffer->indicate_empty_lines, Qnil, |
| @@ -5951,7 +5929,6 @@ to the default frame line height. */); | |||
| 5951 | defsubr (&Sbuffer_modified_tick); | 5929 | defsubr (&Sbuffer_modified_tick); |
| 5952 | defsubr (&Srename_buffer); | 5930 | defsubr (&Srename_buffer); |
| 5953 | defsubr (&Sother_buffer); | 5931 | defsubr (&Sother_buffer); |
| 5954 | defsubr (&Sbuffer_disable_undo); | ||
| 5955 | defsubr (&Sbuffer_enable_undo); | 5932 | defsubr (&Sbuffer_enable_undo); |
| 5956 | defsubr (&Skill_buffer); | 5933 | defsubr (&Skill_buffer); |
| 5957 | defsubr (&Sset_buffer_major_mode); | 5934 | defsubr (&Sset_buffer_major_mode); |
diff --git a/src/coding.c b/src/coding.c index 3ddd7ea957d..ce78af7d8d3 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5877,7 +5877,6 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 5877 | REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) | 5877 | REQUIRE + LEN_BYTE = LEN_BYTE * (NEW / ORIG) |
| 5878 | REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG | 5878 | REQUIRE = LEN_BYTE * (NEW - ORIG) / ORIG |
| 5879 | Here, we are sure that NEW >= ORIG. */ | 5879 | Here, we are sure that NEW >= ORIG. */ |
| 5880 | float ratio; | ||
| 5881 | 5880 | ||
| 5882 | if (coding->produced <= coding->consumed) | 5881 | if (coding->produced <= coding->consumed) |
| 5883 | { | 5882 | { |
| @@ -5887,7 +5886,8 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 5887 | } | 5886 | } |
| 5888 | else | 5887 | else |
| 5889 | { | 5888 | { |
| 5890 | ratio = (coding->produced - coding->consumed) / coding->consumed; | 5889 | float ratio = coding->produced - coding->consumed; |
| 5890 | ratio /= coding->consumed; | ||
| 5891 | require = len_byte * ratio; | 5891 | require = len_byte * ratio; |
| 5892 | } | 5892 | } |
| 5893 | first = 0; | 5893 | first = 0; |
diff --git a/src/data.c b/src/data.c index 811619b58b3..be1e4d33bbb 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -723,7 +723,7 @@ determined by DEFINITION. */) | |||
| 723 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) | 723 | && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) |
| 724 | LOADHIST_ATTACH (Fcons (Qt, symbol)); | 724 | LOADHIST_ATTACH (Fcons (Qt, symbol)); |
| 725 | definition = Ffset (symbol, definition); | 725 | definition = Ffset (symbol, definition); |
| 726 | LOADHIST_ATTACH (symbol); | 726 | LOADHIST_ATTACH (Fcons (Qdefun, symbol)); |
| 727 | if (!NILP (docstring)) | 727 | if (!NILP (docstring)) |
| 728 | Fput (symbol, Qfunction_documentation, docstring); | 728 | Fput (symbol, Qfunction_documentation, docstring); |
| 729 | return definition; | 729 | return definition; |
diff --git a/src/dispextern.h b/src/dispextern.h index d3d70b28cf8..b7dcfb799d0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -62,7 +62,7 @@ typedef XImage *XImagePtr; | |||
| 62 | typedef HDC XImagePtr_or_DC; | 62 | typedef HDC XImagePtr_or_DC; |
| 63 | #endif | 63 | #endif |
| 64 | 64 | ||
| 65 | #ifdef HAVE_CARBON | 65 | #ifdef MAC_OS |
| 66 | #include "macgui.h" | 66 | #include "macgui.h" |
| 67 | typedef struct mac_display_info Display_Info; | 67 | typedef struct mac_display_info Display_Info; |
| 68 | /* Mac equivalent of XImage. */ | 68 | /* Mac equivalent of XImage. */ |
| @@ -1166,7 +1166,7 @@ struct glyph_string | |||
| 1166 | unsigned for_overlaps_p : 1; | 1166 | unsigned for_overlaps_p : 1; |
| 1167 | 1167 | ||
| 1168 | /* The GC to use for drawing this glyph string. */ | 1168 | /* The GC to use for drawing this glyph string. */ |
| 1169 | #if defined(HAVE_X_WINDOWS) || defined(HAVE_CARBON) | 1169 | #if defined(HAVE_X_WINDOWS) || defined(MAC_OS) |
| 1170 | GC gc; | 1170 | GC gc; |
| 1171 | #endif | 1171 | #endif |
| 1172 | #if defined(HAVE_NTGUI) | 1172 | #if defined(HAVE_NTGUI) |
diff --git a/src/emacs.c b/src/emacs.c index b16ea78b9b8..cbe386d3296 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1307,7 +1307,7 @@ main (argc, argv | |||
| 1307 | creates a full-fledge output_mac type frame. This does not | 1307 | creates a full-fledge output_mac type frame. This does not |
| 1308 | work correctly before syms_of_textprop, syms_of_macfns, | 1308 | work correctly before syms_of_textprop, syms_of_macfns, |
| 1309 | syms_of_ccl, syms_of_fontset, syms_of_xterm, syms_of_search, | 1309 | syms_of_ccl, syms_of_fontset, syms_of_xterm, syms_of_search, |
| 1310 | syms_of_frame, mac_initialize, and init_keyboard have already | 1310 | syms_of_frame, mac_term_init, and init_keyboard have already |
| 1311 | been called. */ | 1311 | been called. */ |
| 1312 | syms_of_textprop (); | 1312 | syms_of_textprop (); |
| 1313 | syms_of_macfns (); | 1313 | syms_of_macfns (); |
| @@ -1319,7 +1319,7 @@ main (argc, argv | |||
| 1319 | syms_of_search (); | 1319 | syms_of_search (); |
| 1320 | syms_of_frame (); | 1320 | syms_of_frame (); |
| 1321 | 1321 | ||
| 1322 | mac_initialize (); | 1322 | mac_term_init (build_string ("Mac"), NULL, NULL); |
| 1323 | init_keyboard (); | 1323 | init_keyboard (); |
| 1324 | #endif | 1324 | #endif |
| 1325 | 1325 | ||
diff --git a/src/eval.c b/src/eval.c index df528e3da80..9c27caa29ca 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -88,7 +88,7 @@ struct catchtag *catchlist; | |||
| 88 | int gcpro_level; | 88 | int gcpro_level; |
| 89 | #endif | 89 | #endif |
| 90 | 90 | ||
| 91 | Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun, Qdefvar; | 91 | Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun; |
| 92 | Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; | 92 | Lisp_Object Qinhibit_quit, Vinhibit_quit, Vquit_flag; |
| 93 | Lisp_Object Qand_rest, Qand_optional; | 93 | Lisp_Object Qand_rest, Qand_optional; |
| 94 | Lisp_Object Qdebug_on_error; | 94 | Lisp_Object Qdebug_on_error; |
| @@ -647,7 +647,7 @@ usage: (defun NAME ARGLIST [DOCSTRING] BODY...) */) | |||
| 647 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) | 647 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) |
| 648 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); | 648 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); |
| 649 | Ffset (fn_name, defn); | 649 | Ffset (fn_name, defn); |
| 650 | LOADHIST_ATTACH (fn_name); | 650 | LOADHIST_ATTACH (Fcons (Qdefun, fn_name)); |
| 651 | return fn_name; | 651 | return fn_name; |
| 652 | } | 652 | } |
| 653 | 653 | ||
| @@ -716,7 +716,7 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */) | |||
| 716 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) | 716 | && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload)) |
| 717 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); | 717 | LOADHIST_ATTACH (Fcons (Qt, fn_name)); |
| 718 | Ffset (fn_name, defn); | 718 | Ffset (fn_name, defn); |
| 719 | LOADHIST_ATTACH (fn_name); | 719 | LOADHIST_ATTACH (Fcons (Qdefun, fn_name)); |
| 720 | return fn_name; | 720 | return fn_name; |
| 721 | } | 721 | } |
| 722 | 722 | ||
| @@ -742,7 +742,7 @@ The return value is ALIASED. */) | |||
| 742 | sym->indirect_variable = 1; | 742 | sym->indirect_variable = 1; |
| 743 | sym->value = aliased; | 743 | sym->value = aliased; |
| 744 | sym->constant = SYMBOL_CONSTANT_P (aliased); | 744 | sym->constant = SYMBOL_CONSTANT_P (aliased); |
| 745 | LOADHIST_ATTACH (Fcons (Qdefvar, symbol)); | 745 | LOADHIST_ATTACH (symbol); |
| 746 | if (!NILP (docstring)) | 746 | if (!NILP (docstring)) |
| 747 | Fput (symbol, Qvariable_documentation, docstring); | 747 | Fput (symbol, Qvariable_documentation, docstring); |
| 748 | 748 | ||
| @@ -810,7 +810,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 810 | tem = Fpurecopy (tem); | 810 | tem = Fpurecopy (tem); |
| 811 | Fput (sym, Qvariable_documentation, tem); | 811 | Fput (sym, Qvariable_documentation, tem); |
| 812 | } | 812 | } |
| 813 | LOADHIST_ATTACH (Fcons (Qdefvar, sym)); | 813 | LOADHIST_ATTACH (sym); |
| 814 | } | 814 | } |
| 815 | else | 815 | else |
| 816 | /* Simple (defvar <var>) should not count as a definition at all. | 816 | /* Simple (defvar <var>) should not count as a definition at all. |
| @@ -853,7 +853,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | |||
| 853 | tem = Fpurecopy (tem); | 853 | tem = Fpurecopy (tem); |
| 854 | Fput (sym, Qvariable_documentation, tem); | 854 | Fput (sym, Qvariable_documentation, tem); |
| 855 | } | 855 | } |
| 856 | LOADHIST_ATTACH (Fcons (Qdefvar, sym)); | 856 | LOADHIST_ATTACH (sym); |
| 857 | return sym; | 857 | return sym; |
| 858 | } | 858 | } |
| 859 | 859 | ||
| @@ -3376,9 +3376,6 @@ before making `inhibit-quit' nil. */); | |||
| 3376 | Qdefun = intern ("defun"); | 3376 | Qdefun = intern ("defun"); |
| 3377 | staticpro (&Qdefun); | 3377 | staticpro (&Qdefun); |
| 3378 | 3378 | ||
| 3379 | Qdefvar = intern ("defvar"); | ||
| 3380 | staticpro (&Qdefvar); | ||
| 3381 | |||
| 3382 | Qand_rest = intern ("&rest"); | 3379 | Qand_rest = intern ("&rest"); |
| 3383 | staticpro (&Qand_rest); | 3380 | staticpro (&Qand_rest); |
| 3384 | 3381 | ||
diff --git a/src/fileio.c b/src/fileio.c index 195cff2bc8c..f038bca2865 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -6190,7 +6190,7 @@ The return value is only relevant for a call to `read-file-name' that happens | |||
| 6190 | before any other event (mouse or keypress) is handeled. */) | 6190 | before any other event (mouse or keypress) is handeled. */) |
| 6191 | () | 6191 | () |
| 6192 | { | 6192 | { |
| 6193 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) | 6193 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (HAVE_CARBON) |
| 6194 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) | 6194 | if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
| 6195 | && use_dialog_box | 6195 | && use_dialog_box |
| 6196 | && use_file_dialog | 6196 | && use_file_dialog |
| @@ -6331,7 +6331,7 @@ and `read-file-name-function'. */) | |||
| 6331 | 6331 | ||
| 6332 | GCPRO2 (insdef, default_filename); | 6332 | GCPRO2 (insdef, default_filename); |
| 6333 | 6333 | ||
| 6334 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) | 6334 | #if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (HAVE_CARBON) |
| 6335 | if (! NILP (Fnext_read_file_uses_dialog_p ())) | 6335 | if (! NILP (Fnext_read_file_uses_dialog_p ())) |
| 6336 | { | 6336 | { |
| 6337 | /* If DIR contains a file name, split it. */ | 6337 | /* If DIR contains a file name, split it. */ |
| @@ -26,8 +26,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 26 | #endif | 26 | #endif |
| 27 | #include <time.h> | 27 | #include <time.h> |
| 28 | 28 | ||
| 29 | #ifndef MAC_OSX | 29 | #ifndef MAC_OS |
| 30 | /* On Mac OS X, defining this conflicts with precompiled headers. */ | 30 | /* On Mac OS, defining this conflicts with precompiled headers. */ |
| 31 | 31 | ||
| 32 | /* Note on some machines this defines `vector' as a typedef, | 32 | /* Note on some machines this defines `vector' as a typedef, |
| 33 | so make sure we don't use that name in this file. */ | 33 | so make sure we don't use that name in this file. */ |
diff --git a/src/frame.c b/src/frame.c index 660b9db4316..06ffc04f2d1 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -3052,8 +3052,6 @@ x_set_frame_parameters (f, alist) | |||
| 3052 | XSETINT (icon_top, 0); | 3052 | XSETINT (icon_top, 0); |
| 3053 | } | 3053 | } |
| 3054 | 3054 | ||
| 3055 | #ifndef HAVE_CARBON | ||
| 3056 | /* MAC_TODO: fullscreen */ | ||
| 3057 | if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) | 3055 | if (FRAME_VISIBLE_P (f) && fullscreen_is_being_set) |
| 3058 | { | 3056 | { |
| 3059 | /* If the frame is visible already and the fullscreen parameter is | 3057 | /* If the frame is visible already and the fullscreen parameter is |
| @@ -3069,7 +3067,6 @@ x_set_frame_parameters (f, alist) | |||
| 3069 | if (new_top != f->top_pos || new_left != f->left_pos) | 3067 | if (new_top != f->top_pos || new_left != f->left_pos) |
| 3070 | x_set_offset (f, new_left, new_top, 1); | 3068 | x_set_offset (f, new_left, new_top, 1); |
| 3071 | } | 3069 | } |
| 3072 | #endif | ||
| 3073 | 3070 | ||
| 3074 | /* Don't set these parameters unless they've been explicitly | 3071 | /* Don't set these parameters unless they've been explicitly |
| 3075 | specified. The window might be mapped or resized while we're in | 3072 | specified. The window might be mapped or resized while we're in |
| @@ -3230,14 +3227,11 @@ x_report_frame_params (f, alistptr) | |||
| 3230 | store_in_alist (alistptr, Qdisplay, | 3227 | store_in_alist (alistptr, Qdisplay, |
| 3231 | XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); | 3228 | XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); |
| 3232 | 3229 | ||
| 3233 | #ifndef HAVE_CARBON | ||
| 3234 | /* A Mac Window is identified by a struct, not an integer. */ | ||
| 3235 | if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) | 3230 | if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) |
| 3236 | tem = Qnil; | 3231 | tem = Qnil; |
| 3237 | else | 3232 | else |
| 3238 | XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); | 3233 | XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); |
| 3239 | store_in_alist (alistptr, Qparent_id, tem); | 3234 | store_in_alist (alistptr, Qparent_id, tem); |
| 3240 | #endif | ||
| 3241 | } | 3235 | } |
| 3242 | 3236 | ||
| 3243 | 3237 | ||
| @@ -3249,7 +3243,6 @@ x_set_fullscreen (f, new_value, old_value) | |||
| 3249 | struct frame *f; | 3243 | struct frame *f; |
| 3250 | Lisp_Object new_value, old_value; | 3244 | Lisp_Object new_value, old_value; |
| 3251 | { | 3245 | { |
| 3252 | #ifndef HAVE_CARBON | ||
| 3253 | if (NILP (new_value)) | 3246 | if (NILP (new_value)) |
| 3254 | f->want_fullscreen = FULLSCREEN_NONE; | 3247 | f->want_fullscreen = FULLSCREEN_NONE; |
| 3255 | else if (EQ (new_value, Qfullboth)) | 3248 | else if (EQ (new_value, Qfullboth)) |
| @@ -3258,7 +3251,6 @@ x_set_fullscreen (f, new_value, old_value) | |||
| 3258 | f->want_fullscreen = FULLSCREEN_WIDTH; | 3251 | f->want_fullscreen = FULLSCREEN_WIDTH; |
| 3259 | else if (EQ (new_value, Qfullheight)) | 3252 | else if (EQ (new_value, Qfullheight)) |
| 3260 | f->want_fullscreen = FULLSCREEN_HEIGHT; | 3253 | f->want_fullscreen = FULLSCREEN_HEIGHT; |
| 3261 | #endif | ||
| 3262 | } | 3254 | } |
| 3263 | 3255 | ||
| 3264 | 3256 | ||
| @@ -3378,7 +3370,7 @@ x_set_border_width (f, arg, oldval) | |||
| 3378 | if (XINT (arg) == f->border_width) | 3370 | if (XINT (arg) == f->border_width) |
| 3379 | return; | 3371 | return; |
| 3380 | 3372 | ||
| 3381 | #ifndef HAVE_CARBON | 3373 | #ifndef MAC_OS |
| 3382 | if (FRAME_X_WINDOW (f) != 0) | 3374 | if (FRAME_X_WINDOW (f) != 0) |
| 3383 | error ("Cannot change the border width of a window"); | 3375 | error ("Cannot change the border width of a window"); |
| 3384 | #endif /* MAC_TODO */ | 3376 | #endif /* MAC_TODO */ |
| @@ -4300,7 +4292,7 @@ Setting this variable does not affect existing frames, only new ones. */); | |||
| 4300 | DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars, | 4292 | DEFVAR_LISP ("default-frame-scroll-bars", &Vdefault_frame_scroll_bars, |
| 4301 | doc: /* Default position of scroll bars on this window-system. */); | 4293 | doc: /* Default position of scroll bars on this window-system. */); |
| 4302 | #ifdef HAVE_WINDOW_SYSTEM | 4294 | #ifdef HAVE_WINDOW_SYSTEM |
| 4303 | #if defined(HAVE_NTGUI) || defined(HAVE_CARBON) | 4295 | #if defined(HAVE_NTGUI) || defined(MAC_OS) |
| 4304 | /* MS-Windows has scroll bars on the right by default. */ | 4296 | /* MS-Windows has scroll bars on the right by default. */ |
| 4305 | Vdefault_frame_scroll_bars = Qright; | 4297 | Vdefault_frame_scroll_bars = Qright; |
| 4306 | #else | 4298 | #else |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 317f7824267..22919230a65 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -3356,12 +3356,37 @@ update_frame_tool_bar (f) | |||
| 3356 | GList *icon_list; | 3356 | GList *icon_list; |
| 3357 | GList *iter; | 3357 | GList *iter; |
| 3358 | struct x_output *x = f->output_data.x; | 3358 | struct x_output *x = f->output_data.x; |
| 3359 | int hmargin, vmargin; | ||
| 3359 | 3360 | ||
| 3360 | if (! FRAME_GTK_WIDGET (f)) | 3361 | if (! FRAME_GTK_WIDGET (f)) |
| 3361 | return; | 3362 | return; |
| 3362 | 3363 | ||
| 3363 | BLOCK_INPUT; | 3364 | BLOCK_INPUT; |
| 3364 | 3365 | ||
| 3366 | if (INTEGERP (Vtool_bar_button_margin) | ||
| 3367 | && XINT (Vtool_bar_button_margin) > 0) | ||
| 3368 | { | ||
| 3369 | hmargin = XFASTINT (Vtool_bar_button_margin); | ||
| 3370 | vmargin = XFASTINT (Vtool_bar_button_margin); | ||
| 3371 | } | ||
| 3372 | else if (CONSP (Vtool_bar_button_margin)) | ||
| 3373 | { | ||
| 3374 | if (INTEGERP (XCAR (Vtool_bar_button_margin)) | ||
| 3375 | && XINT (XCAR (Vtool_bar_button_margin)) > 0) | ||
| 3376 | hmargin = XFASTINT (XCAR (Vtool_bar_button_margin)); | ||
| 3377 | |||
| 3378 | if (INTEGERP (XCDR (Vtool_bar_button_margin)) | ||
| 3379 | && XINT (XCDR (Vtool_bar_button_margin)) > 0) | ||
| 3380 | vmargin = XFASTINT (XCDR (Vtool_bar_button_margin)); | ||
| 3381 | } | ||
| 3382 | |||
| 3383 | /* The natural size (i.e. when GTK uses 0 as margin) looks best, | ||
| 3384 | so take DEFAULT_TOOL_BAR_BUTTON_MARGIN to mean "default for GTK", | ||
| 3385 | i.e. zero. This means that margins less than | ||
| 3386 | DEFAULT_TOOL_BAR_BUTTON_MARGIN has no effect. */ | ||
| 3387 | hmargin = max (0, hmargin - DEFAULT_TOOL_BAR_BUTTON_MARGIN); | ||
| 3388 | vmargin = max (0, vmargin - DEFAULT_TOOL_BAR_BUTTON_MARGIN); | ||
| 3389 | |||
| 3365 | if (! x->toolbar_widget) | 3390 | if (! x->toolbar_widget) |
| 3366 | xg_create_tool_bar (f); | 3391 | xg_create_tool_bar (f); |
| 3367 | 3392 | ||
| @@ -3425,6 +3450,8 @@ update_frame_tool_bar (f) | |||
| 3425 | { | 3450 | { |
| 3426 | GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); | 3451 | GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); |
| 3427 | 3452 | ||
| 3453 | gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); | ||
| 3454 | |||
| 3428 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), | 3455 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), |
| 3429 | 0, 0, 0, | 3456 | 0, 0, 0, |
| 3430 | w, | 3457 | w, |
| @@ -3480,6 +3507,8 @@ update_frame_tool_bar (f) | |||
| 3480 | XG_TOOL_BAR_IMAGE_DATA); | 3507 | XG_TOOL_BAR_IMAGE_DATA); |
| 3481 | g_list_free (chlist); | 3508 | g_list_free (chlist); |
| 3482 | 3509 | ||
| 3510 | gtk_misc_set_padding (GTK_MISC (wimage), hmargin, vmargin); | ||
| 3511 | |||
| 3483 | if (old_img != img->pixmap) | 3512 | if (old_img != img->pixmap) |
| 3484 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); | 3513 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); |
| 3485 | 3514 | ||
| @@ -3549,6 +3578,8 @@ free_frame_tool_bar (f) | |||
| 3549 | void | 3578 | void |
| 3550 | xg_initialize () | 3579 | xg_initialize () |
| 3551 | { | 3580 | { |
| 3581 | GtkBindingSet *binding_set; | ||
| 3582 | |||
| 3552 | xg_ignore_gtk_scrollbar = 0; | 3583 | xg_ignore_gtk_scrollbar = 0; |
| 3553 | xg_detached_menus = 0; | 3584 | xg_detached_menus = 0; |
| 3554 | xg_menu_cb_list.prev = xg_menu_cb_list.next = | 3585 | xg_menu_cb_list.prev = xg_menu_cb_list.next = |
| @@ -3571,6 +3602,17 @@ xg_initialize () | |||
| 3571 | "gtk-key-theme-name", | 3602 | "gtk-key-theme-name", |
| 3572 | "Emacs", | 3603 | "Emacs", |
| 3573 | EMACS_CLASS); | 3604 | EMACS_CLASS); |
| 3605 | |||
| 3606 | /* Make dialogs close on C-g. Since file dialog inherits from | ||
| 3607 | dialog, this works for them also. */ | ||
| 3608 | binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_DIALOG)); | ||
| 3609 | gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, | ||
| 3610 | "close", 0); | ||
| 3611 | |||
| 3612 | /* Make menus close on C-g. */ | ||
| 3613 | binding_set = gtk_binding_set_by_class (gtk_type_class (GTK_TYPE_MENU_SHELL)); | ||
| 3614 | gtk_binding_entry_add_signal (binding_set, GDK_g, GDK_CONTROL_MASK, | ||
| 3615 | "cancel", 0); | ||
| 3574 | } | 3616 | } |
| 3575 | 3617 | ||
| 3576 | #endif /* USE_GTK */ | 3618 | #endif /* USE_GTK */ |
diff --git a/src/image.c b/src/image.c index 18ffc2db3a4..9c2f6962b6e 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -83,16 +83,19 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 83 | 83 | ||
| 84 | #ifdef MAC_OS | 84 | #ifdef MAC_OS |
| 85 | #include "macterm.h" | 85 | #include "macterm.h" |
| 86 | #include <sys/stat.h> | ||
| 86 | #ifndef MAC_OSX | 87 | #ifndef MAC_OSX |
| 87 | #include <alloca.h> | 88 | #include <alloca.h> |
| 89 | #include <sys/param.h> | ||
| 88 | #endif | 90 | #endif |
| 89 | #ifdef MAC_OSX | 91 | #ifdef MAC_OSX |
| 90 | #include <sys/stat.h> | ||
| 91 | #include <QuickTime/QuickTime.h> | 92 | #include <QuickTime/QuickTime.h> |
| 92 | #else /* not MAC_OSX */ | 93 | #else /* not MAC_OSX */ |
| 93 | #include <Windows.h> | 94 | #include <Windows.h> |
| 94 | #include <Gestalt.h> | 95 | #include <Gestalt.h> |
| 95 | #include <TextUtils.h> | 96 | #include <TextUtils.h> |
| 97 | #include <ImageCompression.h> | ||
| 98 | #include <QuickTimeComponents.h> | ||
| 96 | #endif /* not MAC_OSX */ | 99 | #endif /* not MAC_OSX */ |
| 97 | 100 | ||
| 98 | /* MAC_TODO : Color tables on Mac. */ | 101 | /* MAC_TODO : Color tables on Mac. */ |
| @@ -6269,6 +6272,12 @@ jpeg_image_p (object) | |||
| 6269 | #undef HAVE_STDLIB_H | 6272 | #undef HAVE_STDLIB_H |
| 6270 | #endif /* HAVE_STLIB_H */ | 6273 | #endif /* HAVE_STLIB_H */ |
| 6271 | 6274 | ||
| 6275 | #if defined (HAVE_NTGUI) && !defined (__WIN32__) | ||
| 6276 | /* jpeglib.h will define boolean differently depending on __WIN32__, | ||
| 6277 | so make sure it is defined. */ | ||
| 6278 | #define __WIN32__ 1 | ||
| 6279 | #endif | ||
| 6280 | |||
| 6272 | #include <jpeglib.h> | 6281 | #include <jpeglib.h> |
| 6273 | #include <jerror.h> | 6282 | #include <jerror.h> |
| 6274 | #include <setjmp.h> | 6283 | #include <setjmp.h> |
diff --git a/src/keyboard.c b/src/keyboard.c index 122a8e6b025..5c2fbf29cae 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6910,14 +6910,16 @@ input_available_signal (signo) | |||
| 6910 | sigisheld (SIGIO); | 6910 | sigisheld (SIGIO); |
| 6911 | #endif | 6911 | #endif |
| 6912 | 6912 | ||
| 6913 | if (input_available_clear_time) | ||
| 6914 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | ||
| 6915 | |||
| 6916 | #ifdef SYNC_INPUT | 6913 | #ifdef SYNC_INPUT |
| 6917 | interrupt_input_pending = 1; | 6914 | interrupt_input_pending = 1; |
| 6918 | #else | 6915 | #else |
| 6919 | |||
| 6920 | SIGNAL_THREAD_CHECK (signo); | 6916 | SIGNAL_THREAD_CHECK (signo); |
| 6917 | #endif | ||
| 6918 | |||
| 6919 | if (input_available_clear_time) | ||
| 6920 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | ||
| 6921 | |||
| 6922 | #ifndef SYNC_INPUT | ||
| 6921 | handle_async_input (); | 6923 | handle_async_input (); |
| 6922 | #endif | 6924 | #endif |
| 6923 | 6925 | ||
diff --git a/src/lisp.h b/src/lisp.h index 59ce03435f5..b3220f43f34 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1671,8 +1671,16 @@ extern void defvar_kboard P_ ((char *, int)); | |||
| 1671 | #define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname) | 1671 | #define DEFVAR_LISP_NOPRO(lname, vname, doc) defvar_lisp_nopro (lname, vname) |
| 1672 | #define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) | 1672 | #define DEFVAR_BOOL(lname, vname, doc) defvar_bool (lname, vname) |
| 1673 | #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) | 1673 | #define DEFVAR_INT(lname, vname, doc) defvar_int (lname, vname) |
| 1674 | |||
| 1675 | /* TYPE is nil for a general Lisp variable. | ||
| 1676 | An integer specifies a type; then only LIsp values | ||
| 1677 | with that type code are allowed (except that nil is allowed too). | ||
| 1678 | LNAME is the LIsp-level variable name. | ||
| 1679 | VNAME is the name of the buffer slot. | ||
| 1680 | DOC is a dummy where you write the doc string as a comment. */ | ||
| 1674 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ | 1681 | #define DEFVAR_PER_BUFFER(lname, vname, type, doc) \ |
| 1675 | defvar_per_buffer (lname, vname, type, 0) | 1682 | defvar_per_buffer (lname, vname, type, 0) |
| 1683 | |||
| 1676 | #define DEFVAR_KBOARD(lname, vname, doc) \ | 1684 | #define DEFVAR_KBOARD(lname, vname, doc) \ |
| 1677 | defvar_kboard (lname, \ | 1685 | defvar_kboard (lname, \ |
| 1678 | (int)((char *)(¤t_kboard->vname) \ | 1686 | (int)((char *)(¤t_kboard->vname) \ |
diff --git a/src/lread.c b/src/lread.c index 895c063d04a..42531149286 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3847,10 +3847,10 @@ when the corresponding call to `provide' is made. */); | |||
| 3847 | Each alist element is a list that starts with a file name, | 3847 | Each alist element is a list that starts with a file name, |
| 3848 | except for one element (optional) that starts with nil and describes | 3848 | except for one element (optional) that starts with nil and describes |
| 3849 | definitions evaluated from buffers not visiting files. | 3849 | definitions evaluated from buffers not visiting files. |
| 3850 | The remaining elements of each list are symbols defined as functions, | 3850 | The remaining elements of each list are symbols defined as variables |
| 3851 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', | 3851 | and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', |
| 3852 | `(defvar . VARIABLE), `(autoload . SYMBOL)', and `(t . SYMBOL)'. | 3852 | `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. |
| 3853 | An element `(t . SYMBOL)' precedes an entry that is just SYMBOL, | 3853 | An element `(t . SYMBOL)' precedes an entry `(defun . FUNCTION)', |
| 3854 | and means that SYMBOL was an autoload before this file redefined it | 3854 | and means that SYMBOL was an autoload before this file redefined it |
| 3855 | as a function. */); | 3855 | as a function. */); |
| 3856 | Vload_history = Qnil; | 3856 | Vload_history = Qnil; |
| @@ -845,6 +845,8 @@ check_alarm () | |||
| 845 | } | 845 | } |
| 846 | 846 | ||
| 847 | 847 | ||
| 848 | extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean); | ||
| 849 | |||
| 848 | int | 850 | int |
| 849 | select (n, rfds, wfds, efds, timeout) | 851 | select (n, rfds, wfds, efds, timeout) |
| 850 | int n; | 852 | int n; |
| @@ -853,49 +855,24 @@ select (n, rfds, wfds, efds, timeout) | |||
| 853 | SELECT_TYPE *efds; | 855 | SELECT_TYPE *efds; |
| 854 | struct timeval *timeout; | 856 | struct timeval *timeout; |
| 855 | { | 857 | { |
| 856 | #ifdef TARGET_API_MAC_CARBON | 858 | #if TARGET_API_MAC_CARBON |
| 857 | return 1; | 859 | return 1; |
| 858 | #else /* not TARGET_API_MAC_CARBON */ | 860 | #else /* not TARGET_API_MAC_CARBON */ |
| 859 | EMACS_TIME end_time, now; | ||
| 860 | EventRecord e; | 861 | EventRecord e; |
| 862 | UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + | ||
| 863 | ((EMACS_USECS (*timeout) * 60) / 1000000); | ||
| 861 | 864 | ||
| 862 | /* Can only handle wait for keyboard input. */ | 865 | /* Can only handle wait for keyboard input. */ |
| 863 | if (n > 1 || wfds || efds) | 866 | if (n > 1 || wfds || efds) |
| 864 | return -1; | 867 | return -1; |
| 865 | 868 | ||
| 866 | EMACS_GET_TIME (end_time); | 869 | /* Also return true if an event other than a keyDown has occurred. |
| 867 | EMACS_ADD_TIME (end_time, end_time, *timeout); | 870 | This causes kbd_buffer_get_event in keyboard.c to call |
| 868 | 871 | read_avail_input which in turn calls XTread_socket to poll for | |
| 869 | do | 872 | these events. Otherwise these never get processed except but a |
| 870 | { | 873 | very slow poll timer. */ |
| 871 | /* Also return true if an event other than a keyDown has | 874 | if (FD_ISSET (0, rfds) && mac_wait_next_event (&e, sleep_time, false)) |
| 872 | occurred. This causes kbd_buffer_get_event in keyboard.c to | 875 | return 1; |
| 873 | call read_avail_input which in turn calls XTread_socket to | ||
| 874 | poll for these events. Otherwise these never get processed | ||
| 875 | except but a very slow poll timer. */ | ||
| 876 | if (FD_ISSET (0, rfds) && EventAvail (everyEvent, &e)) | ||
| 877 | return 1; | ||
| 878 | |||
| 879 | /* Also check movement of the mouse. */ | ||
| 880 | { | ||
| 881 | Point mouse_pos; | ||
| 882 | static Point old_mouse_pos = {-1, -1}; | ||
| 883 | |||
| 884 | GetMouse (&mouse_pos); | ||
| 885 | if (!EqualPt (mouse_pos, old_mouse_pos)) | ||
| 886 | { | ||
| 887 | old_mouse_pos = mouse_pos; | ||
| 888 | return 1; | ||
| 889 | } | ||
| 890 | } | ||
| 891 | |||
| 892 | WaitNextEvent (0, &e, 1UL, NULL); /* Accept no event; wait 1 | ||
| 893 | tic. by T.I. */ | ||
| 894 | |||
| 895 | EMACS_GET_TIME (now); | ||
| 896 | EMACS_SUB_TIME (now, end_time, now); | ||
| 897 | } | ||
| 898 | while (!EMACS_TIME_NEG_P (now)); | ||
| 899 | 876 | ||
| 900 | return 0; | 877 | return 0; |
| 901 | #endif /* not TARGET_API_MAC_CARBON */ | 878 | #endif /* not TARGET_API_MAC_CARBON */ |
| @@ -1996,7 +1973,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 1996 | const char *workdir; | 1973 | const char *workdir; |
| 1997 | const char *infn, *outfn, *errfn; | 1974 | const char *infn, *outfn, *errfn; |
| 1998 | { | 1975 | { |
| 1999 | #ifdef TARGET_API_MAC_CARBON | 1976 | #if TARGET_API_MAC_CARBON |
| 2000 | return -1; | 1977 | return -1; |
| 2001 | #else /* not TARGET_API_MAC_CARBON */ | 1978 | #else /* not TARGET_API_MAC_CARBON */ |
| 2002 | char macappname[MAXPATHLEN+1], macworkdir[MAXPATHLEN+1]; | 1979 | char macappname[MAXPATHLEN+1], macworkdir[MAXPATHLEN+1]; |
| @@ -2081,7 +2058,7 @@ run_mac_command (argv, workdir, infn, outfn, errfn) | |||
| 2081 | strcat (t, newargv[0]); | 2058 | strcat (t, newargv[0]); |
| 2082 | #endif /* 0 */ | 2059 | #endif /* 0 */ |
| 2083 | Lisp_Object path; | 2060 | Lisp_Object path; |
| 2084 | openp (Vexec_path, build_string (newargv[0]), EXEC_SUFFIXES, &path, | 2061 | openp (Vexec_path, build_string (newargv[0]), Vexec_suffixes, &path, |
| 2085 | make_number (X_OK)); | 2062 | make_number (X_OK)); |
| 2086 | 2063 | ||
| 2087 | if (NILP (path)) | 2064 | if (NILP (path)) |
| @@ -2793,17 +2770,98 @@ and t is the same as `SECONDARY'. */) | |||
| 2793 | return Qnil; | 2770 | return Qnil; |
| 2794 | } | 2771 | } |
| 2795 | 2772 | ||
| 2773 | extern void mac_clear_font_name_table P_ ((void)); | ||
| 2774 | |||
| 2775 | DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0, | ||
| 2776 | doc: /* Clear the font name table. */) | ||
| 2777 | () | ||
| 2778 | { | ||
| 2779 | check_mac (); | ||
| 2780 | mac_clear_font_name_table (); | ||
| 2781 | return Qnil; | ||
| 2782 | } | ||
| 2783 | |||
| 2796 | #ifdef MAC_OSX | 2784 | #ifdef MAC_OSX |
| 2797 | #undef select | 2785 | #undef select |
| 2798 | 2786 | ||
| 2799 | extern int inhibit_window_system; | 2787 | extern int inhibit_window_system; |
| 2800 | extern int noninteractive; | 2788 | extern int noninteractive; |
| 2801 | 2789 | ||
| 2802 | /* When Emacs is started from the Finder, SELECT always immediately | 2790 | /* Unlike in X11, window events in Carbon do not come from sockets. |
| 2803 | returns as if input is present when file descriptor 0 is polled for | 2791 | So we cannot simply use `select' to monitor two kinds of inputs: |
| 2804 | input. Strangely, when Emacs is run as a GUI application from the | 2792 | window events and process outputs. We emulate such functionality |
| 2805 | command line, it blocks in the same situation. This `wrapper' of | 2793 | by regarding fd 0 as the window event channel and simultaneously |
| 2806 | the system call SELECT corrects this discrepancy. */ | 2794 | monitoring both kinds of input channels. It is implemented by |
| 2795 | dividing into some cases: | ||
| 2796 | 1. The window event channel is not involved. | ||
| 2797 | -> Use `select'. | ||
| 2798 | 2. Sockets are not involved. | ||
| 2799 | -> Use ReceiveNextEvent. | ||
| 2800 | 3. [If SELECT_USE_CFSOCKET is defined] | ||
| 2801 | Only the window event channel and socket read channels are | ||
| 2802 | involved, and timeout is not too short (greater than | ||
| 2803 | SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). | ||
| 2804 | -> Create CFSocket for each socket and add it into the current | ||
| 2805 | event RunLoop so that an `ready-to-read' event can be posted | ||
| 2806 | to the event queue that is also used for window events. Then | ||
| 2807 | ReceiveNextEvent can wait for both kinds of inputs. | ||
| 2808 | 4. Otherwise. | ||
| 2809 | -> Periodically poll the window input channel while repeatedly | ||
| 2810 | executing `select' with a short timeout | ||
| 2811 | (SELECT_POLLING_PERIOD_USEC microseconds). */ | ||
| 2812 | |||
| 2813 | #define SELECT_POLLING_PERIOD_USEC 20000 | ||
| 2814 | #ifdef SELECT_USE_CFSOCKET | ||
| 2815 | #define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2 | ||
| 2816 | #define EVENT_CLASS_SOCK 'Sock' | ||
| 2817 | |||
| 2818 | static void | ||
| 2819 | socket_callback (s, type, address, data, info) | ||
| 2820 | CFSocketRef s; | ||
| 2821 | CFSocketCallBackType type; | ||
| 2822 | CFDataRef address; | ||
| 2823 | const void *data; | ||
| 2824 | void *info; | ||
| 2825 | { | ||
| 2826 | EventRef event; | ||
| 2827 | |||
| 2828 | CreateEvent (NULL, EVENT_CLASS_SOCK, 0, 0, kEventAttributeNone, &event); | ||
| 2829 | PostEventToQueue (GetCurrentEventQueue (), event, kEventPriorityStandard); | ||
| 2830 | ReleaseEvent (event); | ||
| 2831 | } | ||
| 2832 | #endif /* SELECT_USE_CFSOCKET */ | ||
| 2833 | |||
| 2834 | static int | ||
| 2835 | select_and_poll_event (n, rfds, wfds, efds, timeout) | ||
| 2836 | int n; | ||
| 2837 | SELECT_TYPE *rfds; | ||
| 2838 | SELECT_TYPE *wfds; | ||
| 2839 | SELECT_TYPE *efds; | ||
| 2840 | struct timeval *timeout; | ||
| 2841 | { | ||
| 2842 | int r; | ||
| 2843 | OSErr err; | ||
| 2844 | |||
| 2845 | r = select (n, rfds, wfds, efds, timeout); | ||
| 2846 | if (r != -1) | ||
| 2847 | { | ||
| 2848 | BLOCK_INPUT; | ||
| 2849 | err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, | ||
| 2850 | kEventLeaveInQueue, NULL); | ||
| 2851 | UNBLOCK_INPUT; | ||
| 2852 | if (err == noErr) | ||
| 2853 | { | ||
| 2854 | FD_SET (0, rfds); | ||
| 2855 | r++; | ||
| 2856 | } | ||
| 2857 | } | ||
| 2858 | return r; | ||
| 2859 | } | ||
| 2860 | |||
| 2861 | #ifndef MAC_OS_X_VERSION_10_2 | ||
| 2862 | #undef SELECT_INVALIDATE_CFSOCKET | ||
| 2863 | #endif | ||
| 2864 | |||
| 2807 | int | 2865 | int |
| 2808 | sys_select (n, rfds, wfds, efds, timeout) | 2866 | sys_select (n, rfds, wfds, efds, timeout) |
| 2809 | int n; | 2867 | int n; |
| @@ -2813,91 +2871,182 @@ sys_select (n, rfds, wfds, efds, timeout) | |||
| 2813 | struct timeval *timeout; | 2871 | struct timeval *timeout; |
| 2814 | { | 2872 | { |
| 2815 | OSErr err; | 2873 | OSErr err; |
| 2816 | EMACS_TIME end_time, now, remaining_time; | 2874 | int i, r; |
| 2817 | 2875 | EMACS_TIME select_timeout; | |
| 2876 | |||
| 2818 | if (inhibit_window_system || noninteractive | 2877 | if (inhibit_window_system || noninteractive |
| 2819 | || rfds == NULL || !FD_ISSET (0, rfds)) | 2878 | || rfds == NULL || !FD_ISSET (0, rfds)) |
| 2820 | return select (n, rfds, wfds, efds, timeout); | 2879 | return select (n, rfds, wfds, efds, timeout); |
| 2821 | 2880 | ||
| 2881 | FD_CLR (0, rfds); | ||
| 2882 | |||
| 2822 | if (wfds == NULL && efds == NULL) | 2883 | if (wfds == NULL && efds == NULL) |
| 2823 | { | 2884 | { |
| 2824 | int i; | 2885 | int nsocks = 0; |
| 2886 | SELECT_TYPE orfds = *rfds; | ||
| 2887 | |||
| 2888 | EventTimeout timeout_sec = | ||
| 2889 | (timeout | ||
| 2890 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 2891 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 2892 | : kEventDurationForever); | ||
| 2825 | 2893 | ||
| 2826 | for (i = 1; i < n; i++) | 2894 | for (i = 1; i < n; i++) |
| 2827 | if (FD_ISSET (i, rfds)) | 2895 | if (FD_ISSET (i, rfds)) |
| 2828 | break; | 2896 | nsocks++; |
| 2829 | if (i == n) | ||
| 2830 | { | ||
| 2831 | EventTimeout timeout_sec = | ||
| 2832 | (timeout | ||
| 2833 | ? (EMACS_SECS (*timeout) * kEventDurationSecond | ||
| 2834 | + EMACS_USECS (*timeout) * kEventDurationMicrosecond) | ||
| 2835 | : kEventDurationForever); | ||
| 2836 | 2897 | ||
| 2898 | if (nsocks == 0) | ||
| 2899 | { | ||
| 2837 | BLOCK_INPUT; | 2900 | BLOCK_INPUT; |
| 2838 | err = ReceiveNextEvent (0, NULL, timeout_sec, | 2901 | err = ReceiveNextEvent (0, NULL, timeout_sec, |
| 2839 | kEventLeaveInQueue, NULL); | 2902 | kEventLeaveInQueue, NULL); |
| 2840 | UNBLOCK_INPUT; | 2903 | UNBLOCK_INPUT; |
| 2841 | if (err == noErr) | 2904 | if (err == noErr) |
| 2842 | { | 2905 | { |
| 2843 | FD_ZERO (rfds); | ||
| 2844 | FD_SET (0, rfds); | 2906 | FD_SET (0, rfds); |
| 2845 | return 1; | 2907 | return 1; |
| 2846 | } | 2908 | } |
| 2847 | else | 2909 | else |
| 2848 | return 0; | 2910 | return 0; |
| 2849 | } | 2911 | } |
| 2850 | } | ||
| 2851 | 2912 | ||
| 2852 | if (timeout) | 2913 | /* Avoid initial overhead of RunLoop setup for the case that |
| 2853 | { | 2914 | some input is already available. */ |
| 2854 | remaining_time = *timeout; | 2915 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); |
| 2855 | EMACS_GET_TIME (now); | 2916 | r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); |
| 2856 | EMACS_ADD_TIME (end_time, now, remaining_time); | 2917 | if (r != 0 || timeout_sec == 0.0) |
| 2857 | } | 2918 | return r; |
| 2858 | FD_CLR (0, rfds); | ||
| 2859 | do | ||
| 2860 | { | ||
| 2861 | EMACS_TIME select_timeout; | ||
| 2862 | SELECT_TYPE orfds = *rfds; | ||
| 2863 | int r; | ||
| 2864 | 2919 | ||
| 2865 | EMACS_SET_SECS_USECS (select_timeout, 0, 20000); | 2920 | *rfds = orfds; |
| 2866 | 2921 | ||
| 2867 | if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) | 2922 | #ifdef SELECT_USE_CFSOCKET |
| 2868 | select_timeout = remaining_time; | 2923 | if (timeout_sec > 0 && timeout_sec <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) |
| 2924 | goto poll_periodically; | ||
| 2869 | 2925 | ||
| 2870 | r = select (n, &orfds, wfds, efds, &select_timeout); | 2926 | { |
| 2871 | BLOCK_INPUT; | 2927 | CFRunLoopRef runloop = |
| 2872 | err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, | 2928 | (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); |
| 2873 | kEventLeaveInQueue, NULL); | 2929 | EventTypeSpec specs[] = {{EVENT_CLASS_SOCK, 0}}; |
| 2874 | UNBLOCK_INPUT; | 2930 | #ifdef SELECT_INVALIDATE_CFSOCKET |
| 2875 | if (r > 0) | 2931 | CFSocketRef *shead, *s; |
| 2876 | { | 2932 | #else |
| 2877 | *rfds = orfds; | 2933 | CFRunLoopSourceRef *shead, *s; |
| 2878 | if (err == noErr) | 2934 | #endif |
| 2935 | |||
| 2936 | BLOCK_INPUT; | ||
| 2937 | |||
| 2938 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2939 | shead = xmalloc (sizeof (CFSocketRef) * nsocks); | ||
| 2940 | #else | ||
| 2941 | shead = xmalloc (sizeof (CFRunLoopSourceRef) * nsocks); | ||
| 2942 | #endif | ||
| 2943 | s = shead; | ||
| 2944 | for (i = 1; i < n; i++) | ||
| 2945 | if (FD_ISSET (i, rfds)) | ||
| 2879 | { | 2946 | { |
| 2880 | FD_SET (0, rfds); | 2947 | CFSocketRef socket = |
| 2881 | r++; | 2948 | CFSocketCreateWithNative (NULL, i, kCFSocketReadCallBack, |
| 2949 | socket_callback, NULL); | ||
| 2950 | CFRunLoopSourceRef source = | ||
| 2951 | CFSocketCreateRunLoopSource (NULL, socket, 0); | ||
| 2952 | |||
| 2953 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2954 | CFSocketSetSocketFlags (socket, 0); | ||
| 2955 | #endif | ||
| 2956 | CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode); | ||
| 2957 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2958 | CFRelease (source); | ||
| 2959 | *s = socket; | ||
| 2960 | #else | ||
| 2961 | CFRelease (socket); | ||
| 2962 | *s = source; | ||
| 2963 | #endif | ||
| 2964 | s++; | ||
| 2882 | } | 2965 | } |
| 2883 | return r; | ||
| 2884 | } | ||
| 2885 | else if (err == noErr) | ||
| 2886 | { | ||
| 2887 | FD_ZERO (rfds); | ||
| 2888 | FD_SET (0, rfds); | ||
| 2889 | return 1; | ||
| 2890 | } | ||
| 2891 | 2966 | ||
| 2892 | if (timeout) | 2967 | err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); |
| 2893 | { | 2968 | |
| 2894 | EMACS_GET_TIME (now); | 2969 | do |
| 2895 | EMACS_SUB_TIME (remaining_time, end_time, now); | 2970 | { |
| 2896 | } | 2971 | --s; |
| 2972 | #ifdef SELECT_INVALIDATE_CFSOCKET | ||
| 2973 | CFSocketInvalidate (*s); | ||
| 2974 | #else | ||
| 2975 | CFRunLoopRemoveSource (runloop, *s, kCFRunLoopDefaultMode); | ||
| 2976 | #endif | ||
| 2977 | CFRelease (*s); | ||
| 2978 | } | ||
| 2979 | while (s != shead); | ||
| 2980 | |||
| 2981 | xfree (shead); | ||
| 2982 | |||
| 2983 | if (err) | ||
| 2984 | { | ||
| 2985 | FD_ZERO (rfds); | ||
| 2986 | r = 0; | ||
| 2987 | } | ||
| 2988 | else | ||
| 2989 | { | ||
| 2990 | FlushEventsMatchingListFromQueue (GetCurrentEventQueue (), | ||
| 2991 | GetEventTypeCount (specs), | ||
| 2992 | specs); | ||
| 2993 | EMACS_SET_SECS_USECS (select_timeout, 0, 0); | ||
| 2994 | r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); | ||
| 2995 | } | ||
| 2996 | |||
| 2997 | UNBLOCK_INPUT; | ||
| 2998 | |||
| 2999 | return r; | ||
| 3000 | } | ||
| 3001 | #endif /* SELECT_USE_CFSOCKET */ | ||
| 2897 | } | 3002 | } |
| 2898 | while (!timeout || EMACS_TIME_LT (now, end_time)); | ||
| 2899 | 3003 | ||
| 2900 | return 0; | 3004 | poll_periodically: |
| 3005 | { | ||
| 3006 | EMACS_TIME end_time, now, remaining_time; | ||
| 3007 | SELECT_TYPE orfds = *rfds, owfds, oefds; | ||
| 3008 | |||
| 3009 | if (wfds) | ||
| 3010 | owfds = *wfds; | ||
| 3011 | if (efds) | ||
| 3012 | oefds = *efds; | ||
| 3013 | if (timeout) | ||
| 3014 | { | ||
| 3015 | remaining_time = *timeout; | ||
| 3016 | EMACS_GET_TIME (now); | ||
| 3017 | EMACS_ADD_TIME (end_time, now, remaining_time); | ||
| 3018 | } | ||
| 3019 | |||
| 3020 | do | ||
| 3021 | { | ||
| 3022 | EMACS_SET_SECS_USECS (select_timeout, 0, SELECT_POLLING_PERIOD_USEC); | ||
| 3023 | if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) | ||
| 3024 | select_timeout = remaining_time; | ||
| 3025 | r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); | ||
| 3026 | if (r != 0) | ||
| 3027 | return r; | ||
| 3028 | |||
| 3029 | *rfds = orfds; | ||
| 3030 | if (wfds) | ||
| 3031 | *wfds = owfds; | ||
| 3032 | if (efds) | ||
| 3033 | *efds = oefds; | ||
| 3034 | |||
| 3035 | if (timeout) | ||
| 3036 | { | ||
| 3037 | EMACS_GET_TIME (now); | ||
| 3038 | EMACS_SUB_TIME (remaining_time, end_time, now); | ||
| 3039 | } | ||
| 3040 | } | ||
| 3041 | while (!timeout || EMACS_TIME_LT (now, end_time)); | ||
| 3042 | |||
| 3043 | FD_ZERO (rfds); | ||
| 3044 | if (wfds) | ||
| 3045 | FD_ZERO (wfds); | ||
| 3046 | if (efds) | ||
| 3047 | FD_ZERO (efds); | ||
| 3048 | return 0; | ||
| 3049 | } | ||
| 2901 | } | 3050 | } |
| 2902 | 3051 | ||
| 2903 | /* Set up environment variables so that Emacs can correctly find its | 3052 | /* Set up environment variables so that Emacs can correctly find its |
| @@ -3043,6 +3192,7 @@ syms_of_mac () | |||
| 3043 | defsubr (&Smac_paste_function); | 3192 | defsubr (&Smac_paste_function); |
| 3044 | defsubr (&Smac_cut_function); | 3193 | defsubr (&Smac_cut_function); |
| 3045 | defsubr (&Sx_selection_exists_p); | 3194 | defsubr (&Sx_selection_exists_p); |
| 3195 | defsubr (&Smac_clear_font_name_table); | ||
| 3046 | 3196 | ||
| 3047 | defsubr (&Sdo_applescript); | 3197 | defsubr (&Sdo_applescript); |
| 3048 | defsubr (&Smac_file_name_to_posix); | 3198 | defsubr (&Smac_file_name_to_posix); |
diff --git a/src/macfns.c b/src/macfns.c index fdfe7a52416..dfbc5dacd5e 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -158,9 +158,7 @@ Lisp_Object Qshift; | |||
| 158 | 158 | ||
| 159 | extern Lisp_Object Vwindow_system_version; | 159 | extern Lisp_Object Vwindow_system_version; |
| 160 | 160 | ||
| 161 | extern int mac_initialized; | 161 | #if 0 /* Use xstricmp instead. */ |
| 162 | |||
| 163 | |||
| 164 | /* compare two strings ignoring case */ | 162 | /* compare two strings ignoring case */ |
| 165 | 163 | ||
| 166 | static int | 164 | static int |
| @@ -171,13 +169,14 @@ stricmp (const char *s, const char *t) | |||
| 171 | return 0; | 169 | return 0; |
| 172 | return tolower (*s) - tolower (*t); | 170 | return tolower (*s) - tolower (*t); |
| 173 | } | 171 | } |
| 172 | #endif | ||
| 174 | 173 | ||
| 175 | /* compare two strings up to n characters, ignoring case */ | 174 | /* compare two strings up to n characters, ignoring case */ |
| 176 | 175 | ||
| 177 | static int | 176 | static int |
| 178 | strnicmp (const char *s, const char *t, unsigned int n) | 177 | strnicmp (const char *s, const char *t, unsigned int n) |
| 179 | { | 178 | { |
| 180 | for ( ; n-- > 0 && tolower (*s) == tolower (*t); s++, t++) | 179 | for ( ; n > 0 && tolower (*s) == tolower (*t); n--, s++, t++) |
| 181 | if (*s == '\0') | 180 | if (*s == '\0') |
| 182 | return 0; | 181 | return 0; |
| 183 | return n == 0 ? 0 : tolower (*s) - tolower (*t); | 182 | return n == 0 ? 0 : tolower (*s) - tolower (*t); |
| @@ -190,7 +189,7 @@ void | |||
| 190 | check_mac () | 189 | check_mac () |
| 191 | { | 190 | { |
| 192 | if (! mac_in_use) | 191 | if (! mac_in_use) |
| 193 | error ("Mac OS not in use or not initialized"); | 192 | error ("Mac native windows not in use or not initialized"); |
| 194 | } | 193 | } |
| 195 | 194 | ||
| 196 | /* Nonzero if we can use mouse menus. | 195 | /* Nonzero if we can use mouse menus. |
| @@ -228,33 +227,28 @@ struct mac_display_info * | |||
| 228 | check_x_display_info (frame) | 227 | check_x_display_info (frame) |
| 229 | Lisp_Object frame; | 228 | Lisp_Object frame; |
| 230 | { | 229 | { |
| 231 | if (!mac_initialized) | 230 | struct mac_display_info *dpyinfo = NULL; |
| 232 | { | ||
| 233 | mac_initialize (); | ||
| 234 | mac_initialized = 1; | ||
| 235 | } | ||
| 236 | 231 | ||
| 237 | if (NILP (frame)) | 232 | if (NILP (frame)) |
| 238 | { | 233 | { |
| 239 | struct frame *sf = XFRAME (selected_frame); | 234 | struct frame *sf = XFRAME (selected_frame); |
| 240 | 235 | ||
| 241 | if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf)) | 236 | if (FRAME_MAC_P (sf) && FRAME_LIVE_P (sf)) |
| 242 | return FRAME_MAC_DISPLAY_INFO (sf); | 237 | dpyinfo = FRAME_MAC_DISPLAY_INFO (sf); |
| 238 | else if (x_display_list != 0) | ||
| 239 | dpyinfo = x_display_list; | ||
| 243 | else | 240 | else |
| 244 | return &one_mac_display_info; | 241 | error ("Mac native windows are not in use or not initialized"); |
| 245 | } | 242 | } |
| 246 | else if (STRINGP (frame)) | 243 | else if (STRINGP (frame)) |
| 247 | return x_display_info_for_name (frame); | 244 | dpyinfo = x_display_info_for_name (frame); |
| 248 | else | 245 | else |
| 249 | { | 246 | { |
| 250 | FRAME_PTR f; | 247 | FRAME_PTR f = check_x_frame (frame); |
| 251 | 248 | dpyinfo = FRAME_MAC_DISPLAY_INFO (f); | |
| 252 | CHECK_LIVE_FRAME (frame); | ||
| 253 | f = XFRAME (frame); | ||
| 254 | if (! FRAME_MAC_P (f)) | ||
| 255 | error ("non-mac frame used"); | ||
| 256 | return FRAME_MAC_DISPLAY_INFO (f); | ||
| 257 | } | 249 | } |
| 250 | |||
| 251 | return dpyinfo; | ||
| 258 | } | 252 | } |
| 259 | 253 | ||
| 260 | /* Return the Emacs frame-object corresponding to a mac window. | 254 | /* Return the Emacs frame-object corresponding to a mac window. |
| @@ -1109,7 +1103,7 @@ mac_color_map_lookup (colorname) | |||
| 1109 | BLOCK_INPUT; | 1103 | BLOCK_INPUT; |
| 1110 | 1104 | ||
| 1111 | for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++) | 1105 | for (i = 0; i < sizeof (mac_color_map) / sizeof (mac_color_map[0]); i++) |
| 1112 | if (stricmp (colorname, mac_color_map[i].name) == 0) | 1106 | if (xstricmp (colorname, mac_color_map[i].name) == 0) |
| 1113 | { | 1107 | { |
| 1114 | ret = make_number (mac_color_map[i].color); | 1108 | ret = make_number (mac_color_map[i].color); |
| 1115 | break; | 1109 | break; |
| @@ -2059,13 +2053,49 @@ x_set_scroll_bar_default_width (f) | |||
| 2059 | 2053 | ||
| 2060 | /* Subroutines of creating a frame. */ | 2054 | /* Subroutines of creating a frame. */ |
| 2061 | 2055 | ||
| 2056 | static char * | ||
| 2057 | mac_get_rdb_resource (rdb, resource) | ||
| 2058 | char *rdb; | ||
| 2059 | char *resource; | ||
| 2060 | { | ||
| 2061 | char *value = rdb; | ||
| 2062 | int len = strlen (resource); | ||
| 2063 | |||
| 2064 | while (*value) | ||
| 2065 | { | ||
| 2066 | if ((strncmp (value, resource, len) == 0) && (value[len] == ':')) | ||
| 2067 | return xstrdup (&value[len + 1]); | ||
| 2068 | |||
| 2069 | value = strchr (value, '\0') + 1; | ||
| 2070 | } | ||
| 2071 | |||
| 2072 | return NULL; | ||
| 2073 | } | ||
| 2074 | |||
| 2075 | /* Retrieve the string resource specified by NAME with CLASS from | ||
| 2076 | database RDB. */ | ||
| 2077 | |||
| 2062 | char * | 2078 | char * |
| 2063 | x_get_string_resource (rdb, name, class) | 2079 | x_get_string_resource (rdb, name, class) |
| 2064 | XrmDatabase rdb; | 2080 | XrmDatabase rdb; |
| 2065 | char *name, *class; | 2081 | char *name, *class; |
| 2066 | { | 2082 | { |
| 2067 | /* MAC_TODO: implement resource strings */ | 2083 | if (rdb) |
| 2084 | { | ||
| 2085 | char *resource; | ||
| 2086 | |||
| 2087 | if (resource = mac_get_rdb_resource (rdb, name)) | ||
| 2088 | return resource; | ||
| 2089 | if (resource = mac_get_rdb_resource (rdb, class)) | ||
| 2090 | return resource; | ||
| 2091 | } | ||
| 2092 | |||
| 2093 | /* MAC_TODO: implement resource strings. (Maybe Property Lists?) */ | ||
| 2094 | #if 0 | ||
| 2095 | return mac_get_string_resource (name, class); | ||
| 2096 | #else | ||
| 2068 | return (char *)0; | 2097 | return (char *)0; |
| 2098 | #endif | ||
| 2069 | } | 2099 | } |
| 2070 | 2100 | ||
| 2071 | /* Return the value of parameter PARAM. | 2101 | /* Return the value of parameter PARAM. |
| @@ -2229,36 +2259,38 @@ XParseGeometry (string, x, y, width, height) | |||
| 2229 | } | 2259 | } |
| 2230 | 2260 | ||
| 2231 | 2261 | ||
| 2232 | #if 0 /* MAC_TODO */ | ||
| 2233 | /* Create and set up the Mac window for frame F. */ | 2262 | /* Create and set up the Mac window for frame F. */ |
| 2234 | 2263 | ||
| 2264 | extern install_window_handler (WindowPtr); | ||
| 2265 | |||
| 2235 | static void | 2266 | static void |
| 2236 | mac_window (f, window_prompting, minibuffer_only) | 2267 | mac_window (f) |
| 2237 | struct frame *f; | 2268 | struct frame *f; |
| 2238 | long window_prompting; | ||
| 2239 | int minibuffer_only; | ||
| 2240 | { | 2269 | { |
| 2241 | Rect r; | 2270 | Rect r; |
| 2242 | 2271 | ||
| 2243 | BLOCK_INPUT; | 2272 | BLOCK_INPUT; |
| 2244 | 2273 | ||
| 2245 | /* Use the resource name as the top-level window name | ||
| 2246 | for looking up resources. Make a non-Lisp copy | ||
| 2247 | for the window manager, so GC relocation won't bother it. | ||
| 2248 | |||
| 2249 | Elsewhere we specify the window name for the window manager. */ | ||
| 2250 | |||
| 2251 | { | ||
| 2252 | char *str = (char *) SDATA (Vx_resource_name); | ||
| 2253 | f->namebuf = (char *) xmalloc (strlen (str) + 1); | ||
| 2254 | strcpy (f->namebuf, str); | ||
| 2255 | } | ||
| 2256 | |||
| 2257 | SetRect (&r, f->left_pos, f->top_pos, | 2274 | SetRect (&r, f->left_pos, f->top_pos, |
| 2258 | f->left_pos + FRAME_PIXEL_WIDTH (f), | 2275 | f->left_pos + FRAME_PIXEL_WIDTH (f), |
| 2259 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); | 2276 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); |
| 2277 | #if TARGET_API_MAC_CARBON | ||
| 2278 | CreateNewWindow (kDocumentWindowClass, | ||
| 2279 | kWindowStandardDocumentAttributes | ||
| 2280 | /* | kWindowToolbarButtonAttribute */, | ||
| 2281 | &r, &FRAME_MAC_WINDOW (f)); | ||
| 2282 | if (FRAME_MAC_WINDOW (f)) | ||
| 2283 | { | ||
| 2284 | SetWRefCon (FRAME_MAC_WINDOW (f), (long) f->output_data.mac); | ||
| 2285 | install_window_handler (FRAME_MAC_WINDOW (f)); | ||
| 2286 | } | ||
| 2287 | #else | ||
| 2260 | FRAME_MAC_WINDOW (f) | 2288 | FRAME_MAC_WINDOW (f) |
| 2261 | = NewCWindow (NULL, &r, "\p", 1, zoomDocProc, (WindowPtr) -1, 1, (long) f->output_data.mac); | 2289 | = NewCWindow (NULL, &r, "\p", false, zoomDocProc, |
| 2290 | (WindowPtr) -1, 1, (long) f->output_data.mac); | ||
| 2291 | #endif | ||
| 2292 | /* so that update events can find this mac_output struct */ | ||
| 2293 | f->output_data.mac->mFP = f; /* point back to emacs frame */ | ||
| 2262 | 2294 | ||
| 2263 | validate_x_resource_name (); | 2295 | validate_x_resource_name (); |
| 2264 | 2296 | ||
| @@ -2276,17 +2308,11 @@ mac_window (f, window_prompting, minibuffer_only) | |||
| 2276 | x_set_name (f, name, explicit); | 2308 | x_set_name (f, name, explicit); |
| 2277 | } | 2309 | } |
| 2278 | 2310 | ||
| 2279 | ShowWindow (FRAME_MAC_WINDOW (f)); | ||
| 2280 | |||
| 2281 | UNBLOCK_INPUT; | 2311 | UNBLOCK_INPUT; |
| 2282 | 2312 | ||
| 2283 | if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 2284 | initialize_frame_menubar (f); | ||
| 2285 | |||
| 2286 | if (FRAME_MAC_WINDOW (f) == 0) | 2313 | if (FRAME_MAC_WINDOW (f) == 0) |
| 2287 | error ("Unable to create window"); | 2314 | error ("Unable to create window"); |
| 2288 | } | 2315 | } |
| 2289 | #endif /* MAC_TODO */ | ||
| 2290 | 2316 | ||
| 2291 | /* Handle the icon stuff for this window. Perhaps later we might | 2317 | /* Handle the icon stuff for this window. Perhaps later we might |
| 2292 | want an x_set_icon_position which can be called interactively as | 2318 | want an x_set_icon_position which can be called interactively as |
| @@ -2703,6 +2729,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2703 | "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); | 2729 | "bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL); |
| 2704 | x_default_parameter (f, parms, Qtitle, Qnil, | 2730 | x_default_parameter (f, parms, Qtitle, Qnil, |
| 2705 | "title", "Title", RES_TYPE_STRING); | 2731 | "title", "Title", RES_TYPE_STRING); |
| 2732 | x_default_parameter (f, parms, Qfullscreen, Qnil, | ||
| 2733 | "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); | ||
| 2706 | 2734 | ||
| 2707 | f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; | 2735 | f->output_data.mac->parent_desc = FRAME_MAC_DISPLAY_INFO (f)->root_window; |
| 2708 | 2736 | ||
| @@ -2728,8 +2756,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2728 | tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); | 2756 | tem = mac_get_arg (parms, Qunsplittable, 0, 0, RES_TYPE_BOOLEAN); |
| 2729 | f->no_split = minibuffer_only || EQ (tem, Qt); | 2757 | f->no_split = minibuffer_only || EQ (tem, Qt); |
| 2730 | 2758 | ||
| 2731 | /* mac_window (f, window_prompting, minibuffer_only); */ | 2759 | mac_window (f); |
| 2732 | make_mac_frame (f); | ||
| 2733 | 2760 | ||
| 2734 | x_icon (f, parms); | 2761 | x_icon (f, parms); |
| 2735 | x_make_gc (f); | 2762 | x_make_gc (f); |
| @@ -2763,14 +2790,12 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2763 | FRAME_LINES (f) = 0; | 2790 | FRAME_LINES (f) = 0; |
| 2764 | change_frame_size (f, height, width, 1, 0, 0); | 2791 | change_frame_size (f, height, width, 1, 0, 0); |
| 2765 | 2792 | ||
| 2766 | #if 0 /* MAC_TODO: when we have window manager hints */ | ||
| 2767 | /* Tell the server what size and position, etc, we want, and how | 2793 | /* Tell the server what size and position, etc, we want, and how |
| 2768 | badly we want them. This should be done after we have the menu | 2794 | badly we want them. This should be done after we have the menu |
| 2769 | bar so that its size can be taken into account. */ | 2795 | bar so that its size can be taken into account. */ |
| 2770 | BLOCK_INPUT; | 2796 | BLOCK_INPUT; |
| 2771 | x_wm_set_size_hint (f, window_prompting, 0); | 2797 | x_wm_set_size_hint (f, window_prompting, 0); |
| 2772 | UNBLOCK_INPUT; | 2798 | UNBLOCK_INPUT; |
| 2773 | #endif | ||
| 2774 | 2799 | ||
| 2775 | /* Make the window appear on the frame and enable display, unless | 2800 | /* Make the window appear on the frame and enable display, unless |
| 2776 | the caller says not to. However, with explicit parent, Emacs | 2801 | the caller says not to. However, with explicit parent, Emacs |
| @@ -3144,6 +3169,9 @@ x_display_info_for_name (name) | |||
| 3144 | 3169 | ||
| 3145 | CHECK_STRING (name); | 3170 | CHECK_STRING (name); |
| 3146 | 3171 | ||
| 3172 | if (! EQ (Vwindow_system, intern ("mac"))) | ||
| 3173 | error ("Not using Mac native windows"); | ||
| 3174 | |||
| 3147 | for (dpyinfo = &one_mac_display_info, names = x_display_name_list; | 3175 | for (dpyinfo = &one_mac_display_info, names = x_display_name_list; |
| 3148 | dpyinfo; | 3176 | dpyinfo; |
| 3149 | dpyinfo = dpyinfo->next, names = XCDR (names)) | 3177 | dpyinfo = dpyinfo->next, names = XCDR (names)) |
| @@ -3171,7 +3199,6 @@ x_display_info_for_name (name) | |||
| 3171 | return dpyinfo; | 3199 | return dpyinfo; |
| 3172 | } | 3200 | } |
| 3173 | 3201 | ||
| 3174 | #if 0 /* MAC_TODO: implement network support */ | ||
| 3175 | DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, | 3202 | DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection, |
| 3176 | 1, 3, 0, | 3203 | 1, 3, 0, |
| 3177 | doc: /* Open a connection to a server. | 3204 | doc: /* Open a connection to a server. |
| @@ -3190,7 +3217,7 @@ terminate Emacs if we can't open the connection. */) | |||
| 3190 | CHECK_STRING (xrm_string); | 3217 | CHECK_STRING (xrm_string); |
| 3191 | 3218 | ||
| 3192 | if (! EQ (Vwindow_system, intern ("mac"))) | 3219 | if (! EQ (Vwindow_system, intern ("mac"))) |
| 3193 | error ("Not using Mac OS"); | 3220 | error ("Not using Mac native windows"); |
| 3194 | 3221 | ||
| 3195 | if (! NILP (xrm_string)) | 3222 | if (! NILP (xrm_string)) |
| 3196 | xrm_option = (unsigned char *) SDATA (xrm_string); | 3223 | xrm_option = (unsigned char *) SDATA (xrm_string); |
| @@ -3238,11 +3265,9 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 3238 | for (i = 0; i < dpyinfo->n_fonts; i++) | 3265 | for (i = 0; i < dpyinfo->n_fonts; i++) |
| 3239 | if (dpyinfo->font_table[i].name) | 3266 | if (dpyinfo->font_table[i].name) |
| 3240 | { | 3267 | { |
| 3241 | if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) | 3268 | mac_unload_font (dpyinfo, dpyinfo->font_table[i].font); |
| 3242 | xfree (dpyinfo->font_table[i].full_name); | ||
| 3243 | xfree (dpyinfo->font_table[i].name); | ||
| 3244 | x_unload_font (dpyinfo, dpyinfo->font_table[i].font); | ||
| 3245 | } | 3269 | } |
| 3270 | |||
| 3246 | x_destroy_all_bitmaps (dpyinfo); | 3271 | x_destroy_all_bitmaps (dpyinfo); |
| 3247 | 3272 | ||
| 3248 | x_delete_display (dpyinfo); | 3273 | x_delete_display (dpyinfo); |
| @@ -3250,7 +3275,6 @@ If DISPLAY is nil, that stands for the selected frame's display. */) | |||
| 3250 | 3275 | ||
| 3251 | return Qnil; | 3276 | return Qnil; |
| 3252 | } | 3277 | } |
| 3253 | #endif /* 0 */ | ||
| 3254 | 3278 | ||
| 3255 | DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, | 3279 | DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, |
| 3256 | doc: /* Return the list of display names that Emacs has connections to. */) | 3280 | doc: /* Return the list of display names that Emacs has connections to. */) |
| @@ -3813,18 +3837,23 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 3813 | 3837 | ||
| 3814 | BLOCK_INPUT; | 3838 | BLOCK_INPUT; |
| 3815 | SetRect (&r, 0, 0, 1, 1); | 3839 | SetRect (&r, 0, 0, 1, 1); |
| 3840 | #if TARGET_API_MAC_CARBON | ||
| 3816 | if (CreateNewWindow (kHelpWindowClass, | 3841 | if (CreateNewWindow (kHelpWindowClass, |
| 3817 | #ifdef MAC_OS_X_VERSION_10_2 | 3842 | #ifdef MAC_OS_X_VERSION_10_2 |
| 3818 | kWindowIgnoreClicksAttribute | | 3843 | kWindowIgnoreClicksAttribute | |
| 3819 | #endif | 3844 | #endif |
| 3845 | kWindowNoUpdatesAttribute | | ||
| 3820 | kWindowNoActivatesAttribute, | 3846 | kWindowNoActivatesAttribute, |
| 3821 | &r, &tip_window) == noErr) | 3847 | &r, &tip_window) == noErr) |
| 3848 | #else | ||
| 3849 | if (tip_window = NewCWindow (NULL, &r, "\p", false, plainDBox, | ||
| 3850 | NULL, false, 0L)) | ||
| 3851 | #endif | ||
| 3822 | { | 3852 | { |
| 3823 | FRAME_MAC_WINDOW (f) = tip_window; | 3853 | FRAME_MAC_WINDOW (f) = tip_window; |
| 3824 | SetWRefCon (tip_window, (long) f->output_data.mac); | 3854 | SetWRefCon (tip_window, (long) f->output_data.mac); |
| 3825 | /* so that update events can find this mac_output struct */ | 3855 | /* so that update events can find this mac_output struct */ |
| 3826 | f->output_data.mac->mFP = f; | 3856 | f->output_data.mac->mFP = f; |
| 3827 | ShowWindow (tip_window); | ||
| 3828 | } | 3857 | } |
| 3829 | UNBLOCK_INPUT; | 3858 | UNBLOCK_INPUT; |
| 3830 | } | 3859 | } |
| @@ -4140,6 +4169,7 @@ Text larger than the specified size is clipped. */) | |||
| 4140 | BLOCK_INPUT; | 4169 | BLOCK_INPUT; |
| 4141 | MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false); | 4170 | MoveWindow (FRAME_MAC_WINDOW (f), root_x, root_y, false); |
| 4142 | SizeWindow (FRAME_MAC_WINDOW (f), width, height, true); | 4171 | SizeWindow (FRAME_MAC_WINDOW (f), width, height, true); |
| 4172 | ShowWindow (FRAME_MAC_WINDOW (f)); | ||
| 4143 | BringToFront (FRAME_MAC_WINDOW (f)); | 4173 | BringToFront (FRAME_MAC_WINDOW (f)); |
| 4144 | UNBLOCK_INPUT; | 4174 | UNBLOCK_INPUT; |
| 4145 | 4175 | ||
| @@ -4198,7 +4228,7 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 4198 | 4228 | ||
| 4199 | 4229 | ||
| 4200 | 4230 | ||
| 4201 | #ifdef TARGET_API_MAC_CARBON | 4231 | #if TARGET_API_MAC_CARBON |
| 4202 | /*********************************************************************** | 4232 | /*********************************************************************** |
| 4203 | File selection dialog | 4233 | File selection dialog |
| 4204 | ***********************************************************************/ | 4234 | ***********************************************************************/ |
| @@ -4405,14 +4435,19 @@ frame_parm_handler mac_frame_parm_handlers[] = | |||
| 4405 | x_set_fringe_width, | 4435 | x_set_fringe_width, |
| 4406 | x_set_fringe_width, | 4436 | x_set_fringe_width, |
| 4407 | 0, /* x_set_wait_for_wm, */ | 4437 | 0, /* x_set_wait_for_wm, */ |
| 4408 | 0, /* MAC_TODO: x_set_fullscreen, */ | 4438 | x_set_fullscreen, |
| 4409 | }; | 4439 | }; |
| 4410 | 4440 | ||
| 4411 | void | 4441 | void |
| 4412 | syms_of_macfns () | 4442 | syms_of_macfns () |
| 4413 | { | 4443 | { |
| 4414 | /* Certainly running on Mac. */ | 4444 | #ifdef MAC_OSX |
| 4445 | /* This is zero if not using Mac native windows. */ | ||
| 4446 | mac_in_use = 0; | ||
| 4447 | #else | ||
| 4448 | /* Certainly running on Mac native windows. */ | ||
| 4415 | mac_in_use = 1; | 4449 | mac_in_use = 1; |
| 4450 | #endif | ||
| 4416 | 4451 | ||
| 4417 | /* The section below is built by the lisp expression at the top of the file, | 4452 | /* The section below is built by the lisp expression at the top of the file, |
| 4418 | just above where these variables are declared. */ | 4453 | just above where these variables are declared. */ |
| @@ -4536,10 +4571,8 @@ Chinese, Japanese, and Korean. */); | |||
| 4536 | defsubr (&Sx_display_backing_store); | 4571 | defsubr (&Sx_display_backing_store); |
| 4537 | defsubr (&Sx_display_save_under); | 4572 | defsubr (&Sx_display_save_under); |
| 4538 | defsubr (&Sx_create_frame); | 4573 | defsubr (&Sx_create_frame); |
| 4539 | #if 0 /* MAC_TODO: implement network support */ | ||
| 4540 | defsubr (&Sx_open_connection); | 4574 | defsubr (&Sx_open_connection); |
| 4541 | defsubr (&Sx_close_connection); | 4575 | defsubr (&Sx_close_connection); |
| 4542 | #endif | ||
| 4543 | defsubr (&Sx_display_list); | 4576 | defsubr (&Sx_display_list); |
| 4544 | defsubr (&Sx_synchronize); | 4577 | defsubr (&Sx_synchronize); |
| 4545 | 4578 | ||
diff --git a/src/macgui.h b/src/macgui.h index e5ea665ac15..1e1447dfaa8 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -62,18 +62,17 @@ typedef unsigned long Time; | |||
| 62 | #else | 62 | #else |
| 63 | #include <QuickDraw.h> /* for WindowPtr */ | 63 | #include <QuickDraw.h> /* for WindowPtr */ |
| 64 | #include <QDOffscreen.h> /* for GWorldPtr */ | 64 | #include <QDOffscreen.h> /* for GWorldPtr */ |
| 65 | #include <Controls.h> /* for ControlHandle in xdisp.c */ | 65 | #include <Windows.h> |
| 66 | #include <Gestalt.h> | 66 | #include <Gestalt.h> |
| 67 | #endif | 67 | #endif |
| 68 | 68 | ||
| 69 | typedef WindowPtr Window; | ||
| 69 | typedef GWorldPtr Pixmap; | 70 | typedef GWorldPtr Pixmap; |
| 70 | 71 | ||
| 71 | #if TARGET_API_MAC_CARBON | 72 | #if TARGET_API_MAC_CARBON |
| 72 | typedef struct OpaqueWindowPtr *Window; | ||
| 73 | #define Cursor ThemeCursor | 73 | #define Cursor ThemeCursor |
| 74 | #define No_Cursor (-1) | 74 | #define No_Cursor (-1) |
| 75 | #else | 75 | #else |
| 76 | typedef WindowPtr Window; | ||
| 77 | #define SetPortWindowPort(w) SetPort(w) | 76 | #define SetPortWindowPort(w) SetPort(w) |
| 78 | #define Cursor CursHandle | 77 | #define Cursor CursHandle |
| 79 | #define No_Cursor (0) | 78 | #define No_Cursor (0) |
| @@ -198,6 +197,29 @@ XCreateGC (void *, Window, unsigned long, XGCValues *); | |||
| 198 | #define XNegative 0x0010 | 197 | #define XNegative 0x0010 |
| 199 | #define YNegative 0x0020 | 198 | #define YNegative 0x0020 |
| 200 | 199 | ||
| 200 | typedef struct { | ||
| 201 | long flags; /* marks which fields in this structure are defined */ | ||
| 202 | #if 0 | ||
| 203 | int x, y; /* obsolete for new window mgrs, but clients */ | ||
| 204 | int width, height; /* should set so old wm's don't mess up */ | ||
| 205 | #endif | ||
| 206 | int min_width, min_height; | ||
| 207 | #if 0 | ||
| 208 | int max_width, max_height; | ||
| 209 | #endif | ||
| 210 | int width_inc, height_inc; | ||
| 211 | #if 0 | ||
| 212 | struct { | ||
| 213 | int x; /* numerator */ | ||
| 214 | int y; /* denominator */ | ||
| 215 | } min_aspect, max_aspect; | ||
| 216 | #endif | ||
| 217 | int base_width, base_height; /* added by ICCCM version 1 */ | ||
| 218 | #if 0 | ||
| 219 | int win_gravity; /* added by ICCCM version 1 */ | ||
| 220 | #endif | ||
| 221 | } XSizeHints; | ||
| 222 | |||
| 201 | #define USPosition (1L << 0) /* user specified x, y */ | 223 | #define USPosition (1L << 0) /* user specified x, y */ |
| 202 | #define USSize (1L << 1) /* user specified width, height */ | 224 | #define USSize (1L << 1) /* user specified width, height */ |
| 203 | 225 | ||
diff --git a/src/macterm.c b/src/macterm.c index da3dcb15ee8..382400d1d85 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -1178,7 +1178,17 @@ static void | |||
| 1178 | x_update_begin (f) | 1178 | x_update_begin (f) |
| 1179 | struct frame *f; | 1179 | struct frame *f; |
| 1180 | { | 1180 | { |
| 1181 | /* Nothing to do. */ | 1181 | #if TARGET_API_MAC_CARBON |
| 1182 | /* During update of a frame, availability of input events is | ||
| 1183 | periodically checked with ReceiveNextEvent if | ||
| 1184 | redisplay-dont-pause is nil. That normally flushes window buffer | ||
| 1185 | changes for every check, and thus screen update looks waving even | ||
| 1186 | if no input is available. So we disable screen updates during | ||
| 1187 | update of a frame. */ | ||
| 1188 | BLOCK_INPUT; | ||
| 1189 | DisableScreenUpdates (); | ||
| 1190 | UNBLOCK_INPUT; | ||
| 1191 | #endif | ||
| 1182 | } | 1192 | } |
| 1183 | 1193 | ||
| 1184 | 1194 | ||
| @@ -1263,7 +1273,7 @@ mac_draw_vertical_window_border (w, x, y0, y1) | |||
| 1263 | make sure that the mouse-highlight is properly redrawn. | 1273 | make sure that the mouse-highlight is properly redrawn. |
| 1264 | 1274 | ||
| 1265 | W may be a menu bar pseudo-window in case we don't have X toolkit | 1275 | W may be a menu bar pseudo-window in case we don't have X toolkit |
| 1266 | support. Such windows don't have a cursor, so don't display it | 1276 | support. Such windows don't have a cursor, so don't display it |
| 1267 | here. */ | 1277 | here. */ |
| 1268 | 1278 | ||
| 1269 | static void | 1279 | static void |
| @@ -1327,6 +1337,9 @@ x_update_end (f) | |||
| 1327 | 1337 | ||
| 1328 | mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | 1338 | mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); |
| 1329 | 1339 | ||
| 1340 | #if TARGET_API_MAC_CARBON | ||
| 1341 | EnableScreenUpdates (); | ||
| 1342 | #endif | ||
| 1330 | XFlush (FRAME_MAC_DISPLAY (f)); | 1343 | XFlush (FRAME_MAC_DISPLAY (f)); |
| 1331 | UNBLOCK_INPUT; | 1344 | UNBLOCK_INPUT; |
| 1332 | } | 1345 | } |
| @@ -1983,7 +1996,7 @@ x_draw_glyph_string_background (s, force_p) | |||
| 1983 | } | 1996 | } |
| 1984 | else | 1997 | else |
| 1985 | #endif | 1998 | #endif |
| 1986 | #if 0 /* defined(MAC_OS8)*/ | 1999 | #ifdef MAC_OS8 |
| 1987 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width | 2000 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
| 1988 | || s->font_not_found_p | 2001 | || s->font_not_found_p |
| 1989 | || s->extends_to_end_of_line_p | 2002 | || s->extends_to_end_of_line_p |
| @@ -2041,7 +2054,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2041 | for (i = 0; i < s->nchars; ++i) | 2054 | for (i = 0; i < s->nchars; ++i) |
| 2042 | char1b[i] = s->char2b[i].byte2; | 2055 | char1b[i] = s->char2b[i].byte2; |
| 2043 | 2056 | ||
| 2044 | #if 0 /* defined(MAC_OS8) */ | 2057 | #ifdef MAC_OS8 |
| 2045 | /* Draw text with XDrawString if background has already been | 2058 | /* Draw text with XDrawString if background has already been |
| 2046 | filled. Otherwise, use XDrawImageString. (Note that | 2059 | filled. Otherwise, use XDrawImageString. (Note that |
| 2047 | XDrawImageString is usually faster than XDrawString.) Always | 2060 | XDrawImageString is usually faster than XDrawString.) Always |
| @@ -2059,7 +2072,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2059 | XDrawString (s->display, s->window, s->gc, x, | 2072 | XDrawString (s->display, s->window, s->gc, x, |
| 2060 | s->ybase - boff, char1b, s->nchars); | 2073 | s->ybase - boff, char1b, s->nchars); |
| 2061 | } | 2074 | } |
| 2062 | #if 0 /* defined(MAC_OS8)*/ | 2075 | #ifdef MAC_OS8 |
| 2063 | else | 2076 | else |
| 2064 | { | 2077 | { |
| 2065 | if (s->two_byte_p) | 2078 | if (s->two_byte_p) |
| @@ -3652,6 +3665,7 @@ x_get_keysym_name (keysym) | |||
| 3652 | 3665 | ||
| 3653 | 3666 | ||
| 3654 | 3667 | ||
| 3668 | #if 0 | ||
| 3655 | /* Mouse clicks and mouse movement. Rah. */ | 3669 | /* Mouse clicks and mouse movement. Rah. */ |
| 3656 | 3670 | ||
| 3657 | /* Prepare a mouse-event in *RESULT for placement in the input queue. | 3671 | /* Prepare a mouse-event in *RESULT for placement in the input queue. |
| @@ -3685,6 +3699,7 @@ construct_mouse_click (result, event, f) | |||
| 3685 | result->arg = Qnil; | 3699 | result->arg = Qnil; |
| 3686 | return Qnil; | 3700 | return Qnil; |
| 3687 | } | 3701 | } |
| 3702 | #endif | ||
| 3688 | 3703 | ||
| 3689 | 3704 | ||
| 3690 | /* Function to report a mouse movement to the mainstream Emacs code. | 3705 | /* Function to report a mouse movement to the mainstream Emacs code. |
| @@ -3754,8 +3769,6 @@ int disable_mouse_highlight; | |||
| 3754 | 3769 | ||
| 3755 | static struct scroll_bar *x_window_to_scroll_bar (); | 3770 | static struct scroll_bar *x_window_to_scroll_bar (); |
| 3756 | static void x_scroll_bar_report_motion (); | 3771 | static void x_scroll_bar_report_motion (); |
| 3757 | static void x_check_fullscreen P_ ((struct frame *)); | ||
| 3758 | static void x_check_fullscreen_move P_ ((struct frame *)); | ||
| 3759 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); | 3772 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); |
| 3760 | 3773 | ||
| 3761 | 3774 | ||
| @@ -4017,7 +4030,7 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4017 | r.right = left + width; | 4030 | r.right = left + width; |
| 4018 | r.bottom = disp_top + disp_height; | 4031 | r.bottom = disp_top + disp_height; |
| 4019 | 4032 | ||
| 4020 | #ifdef TARGET_API_MAC_CARBON | 4033 | #if TARGET_API_MAC_CARBON |
| 4021 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, | 4034 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, |
| 4022 | kControlScrollBarProc, 0L); | 4035 | kControlScrollBarProc, 0L); |
| 4023 | #else | 4036 | #else |
| @@ -4395,7 +4408,7 @@ activate_scroll_bars (frame) | |||
| 4395 | while (! NILP (bar)) | 4408 | while (! NILP (bar)) |
| 4396 | { | 4409 | { |
| 4397 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); | 4410 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); |
| 4398 | #ifdef TARGET_API_MAC_CARBON | 4411 | #if 1 /* TARGET_API_MAC_CARBON */ |
| 4399 | ActivateControl (ch); | 4412 | ActivateControl (ch); |
| 4400 | #else | 4413 | #else |
| 4401 | SetControlMaximum (ch, | 4414 | SetControlMaximum (ch, |
| @@ -4419,10 +4432,10 @@ deactivate_scroll_bars (frame) | |||
| 4419 | while (! NILP (bar)) | 4432 | while (! NILP (bar)) |
| 4420 | { | 4433 | { |
| 4421 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); | 4434 | ch = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (bar)); |
| 4422 | #ifdef TARGET_API_MAC_CARBON | 4435 | #if 1 /* TARGET_API_MAC_CARBON */ |
| 4423 | DeactivateControl (ch); | 4436 | DeactivateControl (ch); |
| 4424 | #else | 4437 | #else |
| 4425 | SetControlMaximum (ch, XINT (-1)); | 4438 | SetControlMaximum (ch, -1); |
| 4426 | #endif | 4439 | #endif |
| 4427 | bar = XSCROLL_BAR (bar)->next; | 4440 | bar = XSCROLL_BAR (bar)->next; |
| 4428 | } | 4441 | } |
| @@ -4466,7 +4479,7 @@ x_scroll_bar_handle_click (bar, part_code, er, bufp) | |||
| 4466 | case kControlPageDownPart: | 4479 | case kControlPageDownPart: |
| 4467 | bufp->part = scroll_bar_below_handle; | 4480 | bufp->part = scroll_bar_below_handle; |
| 4468 | break; | 4481 | break; |
| 4469 | #ifdef TARGET_API_MAC_CARBON | 4482 | #if TARGET_API_MAC_CARBON |
| 4470 | default: | 4483 | default: |
| 4471 | #else | 4484 | #else |
| 4472 | case kControlIndicatorPart: | 4485 | case kControlIndicatorPart: |
| @@ -4974,13 +4987,16 @@ x_new_font (f, fontname) | |||
| 4974 | XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc, | 4987 | XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc, |
| 4975 | FRAME_FONT (f)); | 4988 | FRAME_FONT (f)); |
| 4976 | 4989 | ||
| 4990 | /* Don't change the size of a tip frame; there's no point in | ||
| 4991 | doing it because it's done in Fx_show_tip, and it leads to | ||
| 4992 | problems because the tip frame has no widget. */ | ||
| 4977 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) | 4993 | if (NILP (tip_frame) || XFRAME (tip_frame) != f) |
| 4978 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); | 4994 | x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); |
| 4979 | } | 4995 | } |
| 4980 | 4996 | ||
| 4981 | return build_string (fontp->full_name); | 4997 | return build_string (fontp->full_name); |
| 4982 | } | 4998 | } |
| 4983 | 4999 | ||
| 4984 | /* Give frame F the fontset named FONTSETNAME as its default font, and | 5000 | /* Give frame F the fontset named FONTSETNAME as its default font, and |
| 4985 | return the full name of that fontset. FONTSETNAME may be a wildcard | 5001 | return the full name of that fontset. FONTSETNAME may be a wildcard |
| 4986 | pattern; in that case, we choose some fontset that fits the pattern. | 5002 | pattern; in that case, we choose some fontset that fits the pattern. |
| @@ -5369,6 +5385,25 @@ x_make_frame_visible (f) | |||
| 5369 | 5385 | ||
| 5370 | f->output_data.mac->asked_for_visible = 1; | 5386 | f->output_data.mac->asked_for_visible = 1; |
| 5371 | 5387 | ||
| 5388 | #if TARGET_API_MAC_CARBON | ||
| 5389 | if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) | ||
| 5390 | { | ||
| 5391 | struct frame *sf = SELECTED_FRAME (); | ||
| 5392 | if (!FRAME_MAC_P (sf)) | ||
| 5393 | RepositionWindow (FRAME_MAC_WINDOW (f), NULL, | ||
| 5394 | kWindowCenterOnMainScreen); | ||
| 5395 | else | ||
| 5396 | RepositionWindow (FRAME_MAC_WINDOW (f), | ||
| 5397 | FRAME_MAC_WINDOW (sf), | ||
| 5398 | #ifdef MAC_OS_X_VERSION_10_2 | ||
| 5399 | kWindowCascadeStartAtParentWindowScreen | ||
| 5400 | #else | ||
| 5401 | kWindowCascadeOnParentWindowScreen | ||
| 5402 | #endif | ||
| 5403 | ); | ||
| 5404 | x_real_positions (f, &f->left_pos, &f->top_pos); | ||
| 5405 | } | ||
| 5406 | #endif | ||
| 5372 | ShowWindow (FRAME_MAC_WINDOW (f)); | 5407 | ShowWindow (FRAME_MAC_WINDOW (f)); |
| 5373 | } | 5408 | } |
| 5374 | 5409 | ||
| @@ -5496,6 +5531,9 @@ x_free_frame_resources (f) | |||
| 5496 | 5531 | ||
| 5497 | x_free_gcs (f); | 5532 | x_free_gcs (f); |
| 5498 | 5533 | ||
| 5534 | if (FRAME_SIZE_HINTS (f)) | ||
| 5535 | xfree (FRAME_SIZE_HINTS (f)); | ||
| 5536 | |||
| 5499 | xfree (f->output_data.mac); | 5537 | xfree (f->output_data.mac); |
| 5500 | f->output_data.mac = NULL; | 5538 | f->output_data.mac = NULL; |
| 5501 | 5539 | ||
| @@ -5548,143 +5586,39 @@ x_wm_set_size_hint (f, flags, user_position) | |||
| 5548 | long flags; | 5586 | long flags; |
| 5549 | int user_position; | 5587 | int user_position; |
| 5550 | { | 5588 | { |
| 5551 | #if 0 /* MAC_TODO: connect this to the Appearance Manager */ | 5589 | int base_width, base_height, width_inc, height_inc; |
| 5552 | XSizeHints size_hints; | 5590 | int min_rows = 0, min_cols = 0; |
| 5553 | 5591 | XSizeHints *size_hints; | |
| 5554 | #ifdef USE_X_TOOLKIT | ||
| 5555 | Arg al[2]; | ||
| 5556 | int ac = 0; | ||
| 5557 | Dimension widget_width, widget_height; | ||
| 5558 | Window window = XtWindow (f->output_data.x->widget); | ||
| 5559 | #else /* not USE_X_TOOLKIT */ | ||
| 5560 | Window window = FRAME_X_WINDOW (f); | ||
| 5561 | #endif /* not USE_X_TOOLKIT */ | ||
| 5562 | |||
| 5563 | /* Setting PMaxSize caused various problems. */ | ||
| 5564 | size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; | ||
| 5565 | |||
| 5566 | size_hints.x = f->left_pos; | ||
| 5567 | size_hints.y = f->top_pos; | ||
| 5568 | |||
| 5569 | #ifdef USE_X_TOOLKIT | ||
| 5570 | XtSetArg (al[ac], XtNwidth, &widget_width); ac++; | ||
| 5571 | XtSetArg (al[ac], XtNheight, &widget_height); ac++; | ||
| 5572 | XtGetValues (f->output_data.x->widget, al, ac); | ||
| 5573 | size_hints.height = widget_height; | ||
| 5574 | size_hints.width = widget_width; | ||
| 5575 | #else /* not USE_X_TOOLKIT */ | ||
| 5576 | size_hints.height = FRAME_PIXEL_HEIGHT (f); | ||
| 5577 | size_hints.width = FRAME_PIXEL_WIDTH (f); | ||
| 5578 | #endif /* not USE_X_TOOLKIT */ | ||
| 5579 | |||
| 5580 | size_hints.width_inc = FRAME_COLUMN_WIDTH (f); | ||
| 5581 | size_hints.height_inc = FRAME_LINE_HEIGHT (f); | ||
| 5582 | size_hints.max_width | ||
| 5583 | = FRAME_X_DISPLAY_INFO (f)->width - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); | ||
| 5584 | size_hints.max_height | ||
| 5585 | = FRAME_X_DISPLAY_INFO (f)->height - FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); | ||
| 5586 | |||
| 5587 | /* Calculate the base and minimum sizes. | ||
| 5588 | |||
| 5589 | (When we use the X toolkit, we don't do it here. | ||
| 5590 | Instead we copy the values that the widgets are using, below.) */ | ||
| 5591 | #ifndef USE_X_TOOLKIT | ||
| 5592 | { | ||
| 5593 | int base_width, base_height; | ||
| 5594 | int min_rows = 0, min_cols = 0; | ||
| 5595 | |||
| 5596 | base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); | ||
| 5597 | base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); | ||
| 5598 | 5592 | ||
| 5599 | check_frame_size (f, &min_rows, &min_cols); | 5593 | base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0); |
| 5594 | base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0); | ||
| 5595 | width_inc = FRAME_COLUMN_WIDTH (f); | ||
| 5596 | height_inc = FRAME_LINE_HEIGHT (f); | ||
| 5600 | 5597 | ||
| 5601 | /* The window manager uses the base width hints to calculate the | 5598 | check_frame_size (f, &min_rows, &min_cols); |
| 5602 | current number of rows and columns in the frame while | ||
| 5603 | resizing; min_width and min_height aren't useful for this | ||
| 5604 | purpose, since they might not give the dimensions for a | ||
| 5605 | zero-row, zero-column frame. | ||
| 5606 | 5599 | ||
| 5607 | We use the base_width and base_height members if we have | 5600 | size_hints = FRAME_SIZE_HINTS (f); |
| 5608 | them; otherwise, we set the min_width and min_height members | 5601 | if (size_hints == NULL) |
| 5609 | to the size for a zero x zero frame. */ | ||
| 5610 | |||
| 5611 | #ifdef HAVE_X11R4 | ||
| 5612 | size_hints.flags |= PBaseSize; | ||
| 5613 | size_hints.base_width = base_width; | ||
| 5614 | size_hints.base_height = base_height; | ||
| 5615 | size_hints.min_width = base_width + min_cols * size_hints.width_inc; | ||
| 5616 | size_hints.min_height = base_height + min_rows * size_hints.height_inc; | ||
| 5617 | #else | ||
| 5618 | size_hints.min_width = base_width; | ||
| 5619 | size_hints.min_height = base_height; | ||
| 5620 | #endif | ||
| 5621 | } | ||
| 5622 | |||
| 5623 | /* If we don't need the old flags, we don't need the old hint at all. */ | ||
| 5624 | if (flags) | ||
| 5625 | { | 5602 | { |
| 5626 | size_hints.flags |= flags; | 5603 | size_hints = FRAME_SIZE_HINTS (f) = xmalloc (sizeof (XSizeHints)); |
| 5627 | goto no_read; | 5604 | bzero (size_hints, sizeof (XSizeHints)); |
| 5628 | } | 5605 | } |
| 5629 | #endif /* not USE_X_TOOLKIT */ | ||
| 5630 | |||
| 5631 | { | ||
| 5632 | XSizeHints hints; /* Sometimes I hate X Windows... */ | ||
| 5633 | long supplied_return; | ||
| 5634 | int value; | ||
| 5635 | |||
| 5636 | #ifdef HAVE_X11R4 | ||
| 5637 | value = XGetWMNormalHints (FRAME_X_DISPLAY (f), window, &hints, | ||
| 5638 | &supplied_return); | ||
| 5639 | #else | ||
| 5640 | value = XGetNormalHints (FRAME_X_DISPLAY (f), window, &hints); | ||
| 5641 | #endif | ||
| 5642 | |||
| 5643 | #ifdef USE_X_TOOLKIT | ||
| 5644 | size_hints.base_height = hints.base_height; | ||
| 5645 | size_hints.base_width = hints.base_width; | ||
| 5646 | size_hints.min_height = hints.min_height; | ||
| 5647 | size_hints.min_width = hints.min_width; | ||
| 5648 | #endif | ||
| 5649 | |||
| 5650 | if (flags) | ||
| 5651 | size_hints.flags |= flags; | ||
| 5652 | else | ||
| 5653 | { | ||
| 5654 | if (value == 0) | ||
| 5655 | hints.flags = 0; | ||
| 5656 | if (hints.flags & PSize) | ||
| 5657 | size_hints.flags |= PSize; | ||
| 5658 | if (hints.flags & PPosition) | ||
| 5659 | size_hints.flags |= PPosition; | ||
| 5660 | if (hints.flags & USPosition) | ||
| 5661 | size_hints.flags |= USPosition; | ||
| 5662 | if (hints.flags & USSize) | ||
| 5663 | size_hints.flags |= USSize; | ||
| 5664 | } | ||
| 5665 | } | ||
| 5666 | |||
| 5667 | #ifndef USE_X_TOOLKIT | ||
| 5668 | no_read: | ||
| 5669 | #endif | ||
| 5670 | 5606 | ||
| 5671 | #ifdef PWinGravity | 5607 | size_hints->flags |= PResizeInc | PMinSize | PBaseSize ; |
| 5672 | size_hints.win_gravity = f->win_gravity; | 5608 | size_hints->width_inc = width_inc; |
| 5673 | size_hints.flags |= PWinGravity; | 5609 | size_hints->height_inc = height_inc; |
| 5610 | size_hints->min_width = base_width + min_cols * width_inc; | ||
| 5611 | size_hints->min_height = base_height + min_rows * height_inc; | ||
| 5612 | size_hints->base_width = base_width; | ||
| 5613 | size_hints->base_height = base_height; | ||
| 5674 | 5614 | ||
| 5675 | if (user_position) | 5615 | if (flags) |
| 5616 | size_hints->flags = flags; | ||
| 5617 | else if (user_position) | ||
| 5676 | { | 5618 | { |
| 5677 | size_hints.flags &= ~ PPosition; | 5619 | size_hints->flags &= ~ PPosition; |
| 5678 | size_hints.flags |= USPosition; | 5620 | size_hints->flags |= USPosition; |
| 5679 | } | 5621 | } |
| 5680 | #endif /* PWinGravity */ | ||
| 5681 | |||
| 5682 | #ifdef HAVE_X11R4 | ||
| 5683 | XSetWMNormalHints (FRAME_X_DISPLAY (f), window, &size_hints); | ||
| 5684 | #else | ||
| 5685 | XSetNormalHints (FRAME_X_DISPLAY (f), window, &size_hints); | ||
| 5686 | #endif | ||
| 5687 | #endif /* MAC_TODO */ | ||
| 5688 | } | 5622 | } |
| 5689 | 5623 | ||
| 5690 | #if 0 /* MAC_TODO: hide application instead of iconify? */ | 5624 | #if 0 /* MAC_TODO: hide application instead of iconify? */ |
| @@ -6120,7 +6054,7 @@ init_font_name_table () | |||
| 6120 | break; | 6054 | break; |
| 6121 | sc = GetTextEncodingBase (encoding); | 6055 | sc = GetTextEncodingBase (encoding); |
| 6122 | decode_mac_font_name (name, sizeof (name), sc); | 6056 | decode_mac_font_name (name, sizeof (name), sc); |
| 6123 | 6057 | ||
| 6124 | /* Point the instance iterator at the current font family. */ | 6058 | /* Point the instance iterator at the current font family. */ |
| 6125 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) | 6059 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) |
| 6126 | break; | 6060 | break; |
| @@ -6259,6 +6193,19 @@ init_font_name_table () | |||
| 6259 | } | 6193 | } |
| 6260 | 6194 | ||
| 6261 | 6195 | ||
| 6196 | void | ||
| 6197 | mac_clear_font_name_table () | ||
| 6198 | { | ||
| 6199 | int i; | ||
| 6200 | |||
| 6201 | for (i = 0; i < font_name_count; i++) | ||
| 6202 | xfree (font_name_table[i]); | ||
| 6203 | xfree (font_name_table); | ||
| 6204 | font_name_table = NULL; | ||
| 6205 | font_name_table_size = font_name_count = 0; | ||
| 6206 | } | ||
| 6207 | |||
| 6208 | |||
| 6262 | enum xlfd_scalable_field_index | 6209 | enum xlfd_scalable_field_index |
| 6263 | { | 6210 | { |
| 6264 | XLFD_SCL_PIXEL_SIZE, | 6211 | XLFD_SCL_PIXEL_SIZE, |
| @@ -6311,6 +6258,9 @@ mac_do_list_fonts (pattern, maxnames) | |||
| 6311 | char *longest_start, *cur_start, *nonspecial; | 6258 | char *longest_start, *cur_start, *nonspecial; |
| 6312 | int longest_len, cur_len, exact; | 6259 | int longest_len, cur_len, exact; |
| 6313 | 6260 | ||
| 6261 | if (font_name_table == NULL) /* Initialize when first used. */ | ||
| 6262 | init_font_name_table (); | ||
| 6263 | |||
| 6314 | for (i = 0; i < XLFD_SCL_LAST; i++) | 6264 | for (i = 0; i < XLFD_SCL_LAST; i++) |
| 6315 | scl_val[i] = -1; | 6265 | scl_val[i] = -1; |
| 6316 | 6266 | ||
| @@ -6471,9 +6421,6 @@ x_list_fonts (struct frame *f, | |||
| 6471 | Lisp_Object newlist = Qnil, tem, key; | 6421 | Lisp_Object newlist = Qnil, tem, key; |
| 6472 | struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL; | 6422 | struct mac_display_info *dpyinfo = f ? FRAME_MAC_DISPLAY_INFO (f) : NULL; |
| 6473 | 6423 | ||
| 6474 | if (font_name_table == NULL) /* Initialize when first used. */ | ||
| 6475 | init_font_name_table (); | ||
| 6476 | |||
| 6477 | if (dpyinfo) | 6424 | if (dpyinfo) |
| 6478 | { | 6425 | { |
| 6479 | tem = XCDR (dpyinfo->name_list_element); | 6426 | tem = XCDR (dpyinfo->name_list_element); |
| @@ -6487,7 +6434,9 @@ x_list_fonts (struct frame *f, | |||
| 6487 | } | 6434 | } |
| 6488 | } | 6435 | } |
| 6489 | 6436 | ||
| 6437 | BLOCK_INPUT; | ||
| 6490 | newlist = mac_do_list_fonts (SDATA (pattern), maxnames); | 6438 | newlist = mac_do_list_fonts (SDATA (pattern), maxnames); |
| 6439 | UNBLOCK_INPUT; | ||
| 6491 | 6440 | ||
| 6492 | /* MAC_TODO: add code for matching outline fonts here */ | 6441 | /* MAC_TODO: add code for matching outline fonts here */ |
| 6493 | 6442 | ||
| @@ -6791,6 +6740,18 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6791 | } | 6740 | } |
| 6792 | 6741 | ||
| 6793 | 6742 | ||
| 6743 | void | ||
| 6744 | mac_unload_font (dpyinfo, font) | ||
| 6745 | struct mac_display_info *dpyinfo; | ||
| 6746 | XFontStruct *font; | ||
| 6747 | { | ||
| 6748 | xfree (font->fontname); | ||
| 6749 | if (font->per_char) | ||
| 6750 | xfree (font->per_char); | ||
| 6751 | xfree (font); | ||
| 6752 | } | ||
| 6753 | |||
| 6754 | |||
| 6794 | /* Load font named FONTNAME of the size SIZE for frame F, and return a | 6755 | /* Load font named FONTNAME of the size SIZE for frame F, and return a |
| 6795 | pointer to the structure font_info while allocating it dynamically. | 6756 | pointer to the structure font_info while allocating it dynamically. |
| 6796 | If SIZE is 0, load any size of font. | 6757 | If SIZE is 0, load any size of font. |
| @@ -6841,7 +6802,9 @@ x_load_font (f, fontname, size) | |||
| 6841 | if (size > 0 && !NILP (font_names)) | 6802 | if (size > 0 && !NILP (font_names)) |
| 6842 | fontname = (char *) SDATA (XCAR (font_names)); | 6803 | fontname = (char *) SDATA (XCAR (font_names)); |
| 6843 | 6804 | ||
| 6805 | BLOCK_INPUT; | ||
| 6844 | font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); | 6806 | font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); |
| 6807 | UNBLOCK_INPUT; | ||
| 6845 | if (!font) | 6808 | if (!font) |
| 6846 | return NULL; | 6809 | return NULL; |
| 6847 | 6810 | ||
| @@ -7121,15 +7084,21 @@ do_ae_print_documents (const AppleEvent *, AppleEvent *, long); | |||
| 7121 | static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long); | 7084 | static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long); |
| 7122 | static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long); | 7085 | static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long); |
| 7123 | 7086 | ||
| 7087 | #if TARGET_API_MAC_CARBON | ||
| 7124 | /* Drag and Drop */ | 7088 | /* Drag and Drop */ |
| 7125 | static OSErr init_mac_drag_n_drop (); | 7089 | static OSErr init_mac_drag_n_drop (); |
| 7126 | static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); | 7090 | static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); |
| 7091 | #endif | ||
| 7127 | 7092 | ||
| 7128 | #if USE_CARBON_EVENTS | 7093 | #if USE_CARBON_EVENTS |
| 7129 | /* Preliminary Support for the OSX Services Menu */ | 7094 | /* Preliminary Support for the OSX Services Menu */ |
| 7130 | static OSStatus mac_handle_service_event (EventHandlerCallRef,EventRef,void*); | 7095 | static OSStatus mac_handle_service_event (EventHandlerCallRef,EventRef,void*); |
| 7131 | static void init_service_handler (); | 7096 | static void init_service_handler (); |
| 7097 | /* Window Event Handler */ | ||
| 7098 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, | ||
| 7099 | EventRef, void *); | ||
| 7132 | #endif | 7100 | #endif |
| 7101 | void install_window_handler (WindowPtr); | ||
| 7133 | 7102 | ||
| 7134 | extern void init_emacs_passwd_dir (); | 7103 | extern void init_emacs_passwd_dir (); |
| 7135 | extern int emacs_main (int, char **, char **); | 7104 | extern int emacs_main (int, char **, char **); |
| @@ -7336,12 +7305,11 @@ do_window_update (WindowPtr win) | |||
| 7336 | { | 7305 | { |
| 7337 | struct frame *f = mac_window_to_frame (win); | 7306 | struct frame *f = mac_window_to_frame (win); |
| 7338 | 7307 | ||
| 7339 | if (win == tip_window) | 7308 | BeginUpdate (win); |
| 7340 | /* The tooltip has been drawn already. Avoid the | ||
| 7341 | SET_FRAME_GARBAGED below. */ | ||
| 7342 | return; | ||
| 7343 | 7309 | ||
| 7344 | if (f) | 7310 | /* The tooltip has been drawn already. Avoid the SET_FRAME_GARBAGED |
| 7311 | below. */ | ||
| 7312 | if (win != tip_window) | ||
| 7345 | { | 7313 | { |
| 7346 | if (f->async_visible == 0) | 7314 | if (f->async_visible == 0) |
| 7347 | { | 7315 | { |
| @@ -7358,17 +7326,30 @@ do_window_update (WindowPtr win) | |||
| 7358 | } | 7326 | } |
| 7359 | else | 7327 | else |
| 7360 | { | 7328 | { |
| 7361 | BeginUpdate (win); | 7329 | Rect r; |
| 7330 | |||
| 7362 | handling_window_update = 1; | 7331 | handling_window_update = 1; |
| 7363 | 7332 | ||
| 7364 | XClearWindow (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f)); | 7333 | #if TARGET_API_MAC_CARBON |
| 7334 | { | ||
| 7335 | RgnHandle region = NewRgn (); | ||
| 7365 | 7336 | ||
| 7366 | expose_frame (f, 0, 0, 0, 0); | 7337 | GetPortVisibleRegion (GetWindowPort (win), region); |
| 7338 | UpdateControls (win, region); | ||
| 7339 | GetRegionBounds (region, &r); | ||
| 7340 | DisposeRgn (region); | ||
| 7341 | } | ||
| 7342 | #else | ||
| 7343 | UpdateControls (win, win->visRgn); | ||
| 7344 | r = (*win->visRgn)->rgnBBox; | ||
| 7345 | #endif | ||
| 7346 | expose_frame (f, r.left, r.top, r.right - r.left, r.bottom - r.top); | ||
| 7367 | 7347 | ||
| 7368 | handling_window_update = 0; | 7348 | handling_window_update = 0; |
| 7369 | EndUpdate (win); | ||
| 7370 | } | 7349 | } |
| 7371 | } | 7350 | } |
| 7351 | |||
| 7352 | EndUpdate (win); | ||
| 7372 | } | 7353 | } |
| 7373 | 7354 | ||
| 7374 | static int | 7355 | static int |
| @@ -7530,20 +7511,43 @@ do_menu_choice (SInt32 menu_choice) | |||
| 7530 | static void | 7511 | static void |
| 7531 | do_grow_window (WindowPtr w, EventRecord *e) | 7512 | do_grow_window (WindowPtr w, EventRecord *e) |
| 7532 | { | 7513 | { |
| 7533 | long grow_size; | ||
| 7534 | Rect limit_rect; | 7514 | Rect limit_rect; |
| 7535 | int rows, columns; | 7515 | int rows, columns, width, height; |
| 7536 | struct frame *f = mac_window_to_frame (w); | 7516 | struct frame *f = mac_window_to_frame (w); |
| 7517 | XSizeHints *size_hints = FRAME_SIZE_HINTS (f); | ||
| 7518 | int min_width = MIN_DOC_SIZE, min_height = MIN_DOC_SIZE; | ||
| 7519 | #if TARGET_API_MAC_CARBON | ||
| 7520 | Rect new_rect; | ||
| 7521 | #else | ||
| 7522 | long grow_size; | ||
| 7523 | #endif | ||
| 7537 | 7524 | ||
| 7538 | SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE); | 7525 | if (size_hints->flags & PMinSize) |
| 7526 | { | ||
| 7527 | min_width = size_hints->min_width; | ||
| 7528 | min_height = size_hints->min_height; | ||
| 7529 | } | ||
| 7530 | SetRect (&limit_rect, min_width, min_height, MAX_DOC_SIZE, MAX_DOC_SIZE); | ||
| 7539 | 7531 | ||
| 7532 | #if TARGET_API_MAC_CARBON | ||
| 7533 | if (!ResizeWindow (w, e->where, &limit_rect, &new_rect)) | ||
| 7534 | return; | ||
| 7535 | height = new_rect.bottom - new_rect.top; | ||
| 7536 | width = new_rect.right - new_rect.left; | ||
| 7537 | #else | ||
| 7540 | grow_size = GrowWindow (w, e->where, &limit_rect); | 7538 | grow_size = GrowWindow (w, e->where, &limit_rect); |
| 7541 | |||
| 7542 | /* see if it really changed size */ | 7539 | /* see if it really changed size */ |
| 7543 | if (grow_size != 0) | 7540 | if (grow_size == 0) |
| 7541 | return; | ||
| 7542 | height = HiWord (grow_size); | ||
| 7543 | width = LoWord (grow_size); | ||
| 7544 | #endif | ||
| 7545 | |||
| 7546 | if (width != FRAME_PIXEL_WIDTH (f) | ||
| 7547 | || height != FRAME_PIXEL_HEIGHT (f)) | ||
| 7544 | { | 7548 | { |
| 7545 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, HiWord (grow_size)); | 7549 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); |
| 7546 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, LoWord (grow_size)); | 7550 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); |
| 7547 | 7551 | ||
| 7548 | x_set_window_size (f, 0, columns, rows); | 7552 | x_set_window_size (f, 0, columns, rows); |
| 7549 | } | 7553 | } |
| @@ -7561,7 +7565,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 7561 | GrafPtr save_port; | 7565 | GrafPtr save_port; |
| 7562 | Rect zoom_rect, port_rect; | 7566 | Rect zoom_rect, port_rect; |
| 7563 | Point top_left; | 7567 | Point top_left; |
| 7564 | int w_title_height, columns, rows; | 7568 | int w_title_height, columns, rows, width, height; |
| 7565 | struct frame *f = mac_window_to_frame (w); | 7569 | struct frame *f = mac_window_to_frame (w); |
| 7566 | 7570 | ||
| 7567 | #if TARGET_API_MAC_CARBON | 7571 | #if TARGET_API_MAC_CARBON |
| @@ -7636,12 +7640,26 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 7636 | #else | 7640 | #else |
| 7637 | port_rect = w->portRect; | 7641 | port_rect = w->portRect; |
| 7638 | #endif | 7642 | #endif |
| 7639 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top); | 7643 | height = port_rect.bottom - port_rect.top; |
| 7640 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left); | 7644 | width = port_rect.right - port_rect.left; |
| 7641 | x_set_window_size (f, 0, columns, rows); | 7645 | |
| 7646 | if (width != FRAME_PIXEL_WIDTH (f) | ||
| 7647 | || height != FRAME_PIXEL_HEIGHT (f)) | ||
| 7648 | { | ||
| 7649 | rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); | ||
| 7650 | columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); | ||
| 7651 | |||
| 7652 | change_frame_size (f, rows, columns, 0, 1, 0); | ||
| 7653 | SET_FRAME_GARBAGED (f); | ||
| 7654 | cancel_mouse_face (f); | ||
| 7655 | |||
| 7656 | FRAME_PIXEL_WIDTH (f) = width; | ||
| 7657 | FRAME_PIXEL_HEIGHT (f) = height; | ||
| 7658 | } | ||
| 7642 | x_real_positions (f, &f->left_pos, &f->top_pos); | 7659 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 7643 | } | 7660 | } |
| 7644 | 7661 | ||
| 7662 | #if TARGET_API_MAC_CARBON | ||
| 7645 | /* Initialize Drag And Drop to allow files to be dropped onto emacs frames */ | 7663 | /* Initialize Drag And Drop to allow files to be dropped onto emacs frames */ |
| 7646 | static OSErr | 7664 | static OSErr |
| 7647 | init_mac_drag_n_drop () | 7665 | init_mac_drag_n_drop () |
| @@ -7649,6 +7667,7 @@ init_mac_drag_n_drop () | |||
| 7649 | OSErr result = InstallReceiveHandler (mac_do_receive_drag, 0L, NULL); | 7667 | OSErr result = InstallReceiveHandler (mac_do_receive_drag, 0L, NULL); |
| 7650 | return result; | 7668 | return result; |
| 7651 | } | 7669 | } |
| 7670 | #endif | ||
| 7652 | 7671 | ||
| 7653 | /* Intialize AppleEvent dispatcher table for the required events. */ | 7672 | /* Intialize AppleEvent dispatcher table for the required events. */ |
| 7654 | void | 7673 | void |
| @@ -7819,7 +7838,93 @@ mac_handle_service_event (EventHandlerCallRef callRef, | |||
| 7819 | } | 7838 | } |
| 7820 | return err; | 7839 | return err; |
| 7821 | } | 7840 | } |
| 7841 | |||
| 7842 | |||
| 7843 | static pascal OSStatus | ||
| 7844 | mac_handle_window_event (next_handler, event, data) | ||
| 7845 | EventHandlerCallRef next_handler; | ||
| 7846 | EventRef event; | ||
| 7847 | void *data; | ||
| 7848 | { | ||
| 7849 | extern Lisp_Object Qcontrol; | ||
| 7850 | |||
| 7851 | WindowPtr wp; | ||
| 7852 | OSStatus result; | ||
| 7853 | UInt32 attributes; | ||
| 7854 | XSizeHints *size_hints; | ||
| 7855 | |||
| 7856 | GetEventParameter (event, kEventParamDirectObject, typeWindowRef, | ||
| 7857 | NULL, sizeof (WindowPtr), NULL, &wp); | ||
| 7858 | |||
| 7859 | switch (GetEventKind (event)) | ||
| 7860 | { | ||
| 7861 | case kEventWindowBoundsChanging: | ||
| 7862 | result = CallNextEventHandler (next_handler, event); | ||
| 7863 | if (result != eventNotHandledErr) | ||
| 7864 | return result; | ||
| 7865 | |||
| 7866 | GetEventParameter (event, kEventParamAttributes, typeUInt32, | ||
| 7867 | NULL, sizeof (UInt32), NULL, &attributes); | ||
| 7868 | size_hints = FRAME_SIZE_HINTS (mac_window_to_frame (wp)); | ||
| 7869 | if ((attributes & kWindowBoundsChangeUserResize) | ||
| 7870 | && ((size_hints->flags & (PResizeInc | PBaseSize | PMinSize)) | ||
| 7871 | == (PResizeInc | PBaseSize | PMinSize))) | ||
| 7872 | { | ||
| 7873 | Rect bounds; | ||
| 7874 | int width, height; | ||
| 7875 | |||
| 7876 | GetEventParameter (event, kEventParamCurrentBounds, | ||
| 7877 | typeQDRectangle, | ||
| 7878 | NULL, sizeof (Rect), NULL, &bounds); | ||
| 7879 | width = bounds.right - bounds.left; | ||
| 7880 | height = bounds.bottom - bounds.top; | ||
| 7881 | |||
| 7882 | if (width < size_hints->min_width) | ||
| 7883 | width = size_hints->min_width; | ||
| 7884 | else | ||
| 7885 | width = size_hints->base_width | ||
| 7886 | + (int) ((width - size_hints->base_width) | ||
| 7887 | / (float) size_hints->width_inc + .5) | ||
| 7888 | * size_hints->width_inc; | ||
| 7889 | |||
| 7890 | if (height < size_hints->min_height) | ||
| 7891 | height = size_hints->min_height; | ||
| 7892 | else | ||
| 7893 | height = size_hints->base_height | ||
| 7894 | + (int) ((height - size_hints->base_height) | ||
| 7895 | / (float) size_hints->height_inc + .5) | ||
| 7896 | * size_hints->height_inc; | ||
| 7897 | |||
| 7898 | bounds.right = bounds.left + width; | ||
| 7899 | bounds.bottom = bounds.top + height; | ||
| 7900 | SetEventParameter (event, kEventParamCurrentBounds, | ||
| 7901 | typeQDRectangle, sizeof (Rect), &bounds); | ||
| 7902 | return noErr; | ||
| 7903 | } | ||
| 7904 | break; | ||
| 7905 | } | ||
| 7906 | |||
| 7907 | return eventNotHandledErr; | ||
| 7908 | } | ||
| 7909 | #endif /* USE_CARBON_EVENTS */ | ||
| 7910 | |||
| 7911 | |||
| 7912 | void | ||
| 7913 | install_window_handler (window) | ||
| 7914 | WindowPtr window; | ||
| 7915 | { | ||
| 7916 | #if USE_CARBON_EVENTS | ||
| 7917 | EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowBoundsChanging}}; | ||
| 7918 | static EventHandlerUPP handle_window_event_UPP = NULL; | ||
| 7919 | |||
| 7920 | if (handle_window_event_UPP == NULL) | ||
| 7921 | handle_window_event_UPP = NewEventHandlerUPP (mac_handle_window_event); | ||
| 7922 | |||
| 7923 | InstallWindowEventHandler (window, handle_window_event_UPP, | ||
| 7924 | GetEventTypeCount (specs), specs, NULL, NULL); | ||
| 7822 | #endif | 7925 | #endif |
| 7926 | } | ||
| 7927 | |||
| 7823 | 7928 | ||
| 7824 | /* Open Application Apple Event */ | 7929 | /* Open Application Apple Event */ |
| 7825 | static pascal OSErr | 7930 | static pascal OSErr |
| @@ -7915,6 +8020,7 @@ descriptor_error_exit: | |||
| 7915 | } | 8020 | } |
| 7916 | 8021 | ||
| 7917 | 8022 | ||
| 8023 | #if TARGET_API_MAC_CARBON | ||
| 7918 | static pascal OSErr | 8024 | static pascal OSErr |
| 7919 | mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | 8025 | mac_do_receive_drag (WindowPtr window, void *handlerRefCon, |
| 7920 | DragReference theDrag) | 8026 | DragReference theDrag) |
| @@ -7991,6 +8097,7 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 7991 | } | 8097 | } |
| 7992 | } | 8098 | } |
| 7993 | } | 8099 | } |
| 8100 | #endif | ||
| 7994 | 8101 | ||
| 7995 | 8102 | ||
| 7996 | /* Print Document Apple Event */ | 8103 | /* Print Document Apple Event */ |
| @@ -8140,6 +8247,45 @@ keycode_to_xkeysym (int keyCode, int *xKeySym) | |||
| 8140 | return *xKeySym != 0; | 8247 | return *xKeySym != 0; |
| 8141 | } | 8248 | } |
| 8142 | 8249 | ||
| 8250 | #if !USE_CARBON_EVENTS | ||
| 8251 | static RgnHandle mouse_region = NULL; | ||
| 8252 | |||
| 8253 | Boolean | ||
| 8254 | mac_wait_next_event (er, sleep_time, dequeue) | ||
| 8255 | EventRecord *er; | ||
| 8256 | UInt32 sleep_time; | ||
| 8257 | Boolean dequeue; | ||
| 8258 | { | ||
| 8259 | static EventRecord er_buf = {nullEvent}; | ||
| 8260 | UInt32 target_tick, current_tick; | ||
| 8261 | EventMask event_mask; | ||
| 8262 | |||
| 8263 | if (mouse_region == NULL) | ||
| 8264 | mouse_region = NewRgn (); | ||
| 8265 | |||
| 8266 | event_mask = everyEvent; | ||
| 8267 | if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) | ||
| 8268 | event_mask -= highLevelEventMask; | ||
| 8269 | |||
| 8270 | current_tick = TickCount (); | ||
| 8271 | target_tick = current_tick + sleep_time; | ||
| 8272 | |||
| 8273 | if (er_buf.what == nullEvent) | ||
| 8274 | while (!WaitNextEvent (event_mask, &er_buf, | ||
| 8275 | target_tick - current_tick, mouse_region)) | ||
| 8276 | { | ||
| 8277 | current_tick = TickCount (); | ||
| 8278 | if (target_tick <= current_tick) | ||
| 8279 | return false; | ||
| 8280 | } | ||
| 8281 | |||
| 8282 | *er = er_buf; | ||
| 8283 | if (dequeue) | ||
| 8284 | er_buf.what = nullEvent; | ||
| 8285 | return true; | ||
| 8286 | } | ||
| 8287 | #endif /* not USE_CARBON_EVENTS */ | ||
| 8288 | |||
| 8143 | /* Emacs calls this whenever it wants to read an input event from the | 8289 | /* Emacs calls this whenever it wants to read an input event from the |
| 8144 | user. */ | 8290 | user. */ |
| 8145 | int | 8291 | int |
| @@ -8151,9 +8297,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8151 | int count = 0; | 8297 | int count = 0; |
| 8152 | #if USE_CARBON_EVENTS | 8298 | #if USE_CARBON_EVENTS |
| 8153 | EventRef eventRef; | 8299 | EventRef eventRef; |
| 8154 | EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget (); | 8300 | EventTargetRef toolbox_dispatcher; |
| 8155 | #else | ||
| 8156 | EventMask event_mask; | ||
| 8157 | #endif | 8301 | #endif |
| 8158 | EventRecord er; | 8302 | EventRecord er; |
| 8159 | struct mac_display_info *dpyinfo = &one_mac_display_info; | 8303 | struct mac_display_info *dpyinfo = &one_mac_display_info; |
| @@ -8184,16 +8328,14 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8184 | if (terminate_flag) | 8328 | if (terminate_flag) |
| 8185 | Fkill_emacs (make_number (1)); | 8329 | Fkill_emacs (make_number (1)); |
| 8186 | 8330 | ||
| 8187 | #if !USE_CARBON_EVENTS | 8331 | #if USE_CARBON_EVENTS |
| 8188 | event_mask = everyEvent; | 8332 | toolbox_dispatcher = GetEventDispatcherTarget (); |
| 8189 | if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) | ||
| 8190 | event_mask -= highLevelEventMask; | ||
| 8191 | 8333 | ||
| 8192 | while (WaitNextEvent (event_mask, &er, 0L, NULL)) | ||
| 8193 | #else /* USE_CARBON_EVENTS */ | ||
| 8194 | while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait, | 8334 | while (!ReceiveNextEvent (0, NULL, kEventDurationNoWait, |
| 8195 | kEventRemoveFromQueue, &eventRef)) | 8335 | kEventRemoveFromQueue, &eventRef)) |
| 8196 | #endif /* USE_CARBON_EVENTS */ | 8336 | #else /* !USE_CARBON_EVENTS */ |
| 8337 | while (mac_wait_next_event (&er, 0, true)) | ||
| 8338 | #endif /* !USE_CARBON_EVENTS */ | ||
| 8197 | { | 8339 | { |
| 8198 | int do_help = 0; | 8340 | int do_help = 0; |
| 8199 | struct frame *f; | 8341 | struct frame *f; |
| @@ -8260,6 +8402,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8260 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | 8402 | SendEventToEventTarget (eventRef, toolbox_dispatcher); |
| 8261 | 8403 | ||
| 8262 | break; | 8404 | break; |
| 8405 | |||
| 8263 | default: | 8406 | default: |
| 8264 | /* Send the event to the appropriate receiver. */ | 8407 | /* Send the event to the appropriate receiver. */ |
| 8265 | SendEventToEventTarget (eventRef, toolbox_dispatcher); | 8408 | SendEventToEventTarget (eventRef, toolbox_dispatcher); |
| @@ -8497,6 +8640,10 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8497 | break; | 8640 | break; |
| 8498 | 8641 | ||
| 8499 | case mouseMovedMessage: | 8642 | case mouseMovedMessage: |
| 8643 | #if !USE_CARBON_EVENTS | ||
| 8644 | SetRectRgn (mouse_region, er.where.h, er.where.v, | ||
| 8645 | er.where.h + 1, er.where.v + 1); | ||
| 8646 | #endif | ||
| 8500 | previous_help_echo_string = help_echo_string; | 8647 | previous_help_echo_string = help_echo_string; |
| 8501 | help_echo_string = help_echo_object = help_echo_window = Qnil; | 8648 | help_echo_string = help_echo_object = help_echo_window = Qnil; |
| 8502 | help_echo_pos = -1; | 8649 | help_echo_pos = -1; |
| @@ -8697,21 +8844,21 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8697 | unsigned char ch = inev.code; | 8844 | unsigned char ch = inev.code; |
| 8698 | ByteCount actual_input_length, actual_output_length; | 8845 | ByteCount actual_input_length, actual_output_length; |
| 8699 | unsigned char outbuf[32]; | 8846 | unsigned char outbuf[32]; |
| 8700 | 8847 | ||
| 8701 | convert_status = TECConvertText (converter, &ch, 1, | 8848 | convert_status = TECConvertText (converter, &ch, 1, |
| 8702 | &actual_input_length, | 8849 | &actual_input_length, |
| 8703 | outbuf, 1, | 8850 | outbuf, 1, |
| 8704 | &actual_output_length); | 8851 | &actual_output_length); |
| 8705 | if (convert_status == noErr | 8852 | if (convert_status == noErr |
| 8706 | && actual_input_length == 1 | 8853 | && actual_input_length == 1 |
| 8707 | && actual_output_length == 1) | 8854 | && actual_output_length == 1) |
| 8708 | inev.code = *outbuf; | 8855 | inev.code = *outbuf; |
| 8709 | 8856 | ||
| 8710 | /* Reset internal states of the converter object. | 8857 | /* Reset internal states of the converter object. |
| 8711 | If it fails, create another one. */ | 8858 | If it fails, create another one. */ |
| 8712 | convert_status = TECFlushText (converter, outbuf, | 8859 | convert_status = TECFlushText (converter, outbuf, |
| 8713 | sizeof (outbuf), | 8860 | sizeof (outbuf), |
| 8714 | &actual_output_length); | 8861 | &actual_output_length); |
| 8715 | if (convert_status != noErr) | 8862 | if (convert_status != noErr) |
| 8716 | { | 8863 | { |
| 8717 | TECDisposeConverter (converter); | 8864 | TECDisposeConverter (converter); |
| @@ -8719,7 +8866,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8719 | kTextEncodingMacRoman, | 8866 | kTextEncodingMacRoman, |
| 8720 | mac_keyboard_text_encoding); | 8867 | mac_keyboard_text_encoding); |
| 8721 | } | 8868 | } |
| 8722 | } | 8869 | } |
| 8723 | } | 8870 | } |
| 8724 | 8871 | ||
| 8725 | #if USE_CARBON_EVENTS | 8872 | #if USE_CARBON_EVENTS |
| @@ -8864,59 +9011,12 @@ __convert_from_newlines (unsigned char * p, size_t * n) | |||
| 8864 | } | 9011 | } |
| 8865 | #endif | 9012 | #endif |
| 8866 | 9013 | ||
| 8867 | 9014 | #ifdef MAC_OS8 | |
| 8868 | /* Initialize the struct pointed to by MW to represent a new COLS x | ||
| 8869 | ROWS Macintosh window, using font with name FONTNAME and size | ||
| 8870 | FONTSIZE. */ | ||
| 8871 | void | ||
| 8872 | make_mac_frame (FRAME_PTR fp) | ||
| 8873 | { | ||
| 8874 | mac_output *mwp; | ||
| 8875 | #if TARGET_API_MAC_CARBON | ||
| 8876 | static int making_terminal_window = 0; | ||
| 8877 | #else | ||
| 8878 | static int making_terminal_window = 1; | ||
| 8879 | #endif | ||
| 8880 | |||
| 8881 | mwp = fp->output_data.mac; | ||
| 8882 | |||
| 8883 | BLOCK_INPUT; | ||
| 8884 | if (making_terminal_window) | ||
| 8885 | { | ||
| 8886 | if (!(mwp->mWP = GetNewCWindow (TERM_WINDOW_RESOURCE, NULL, | ||
| 8887 | (WindowPtr) -1))) | ||
| 8888 | abort (); | ||
| 8889 | making_terminal_window = 0; | ||
| 8890 | } | ||
| 8891 | else | ||
| 8892 | { | ||
| 8893 | #if TARGET_API_MAC_CARBON | ||
| 8894 | Rect r; | ||
| 8895 | |||
| 8896 | SetRect (&r, 0, 0, 1, 1); | ||
| 8897 | if (CreateNewWindow (kDocumentWindowClass, | ||
| 8898 | kWindowStandardDocumentAttributes | ||
| 8899 | /* | kWindowToolbarButtonAttribute */, | ||
| 8900 | &r, &mwp->mWP) != noErr) | ||
| 8901 | #else | ||
| 8902 | if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1))) | ||
| 8903 | #endif | ||
| 8904 | abort (); | ||
| 8905 | } | ||
| 8906 | |||
| 8907 | SetWRefCon (mwp->mWP, (long) mwp); | ||
| 8908 | /* so that update events can find this mac_output struct */ | ||
| 8909 | mwp->mFP = fp; /* point back to emacs frame */ | ||
| 8910 | |||
| 8911 | SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false); | ||
| 8912 | UNBLOCK_INPUT; | ||
| 8913 | } | ||
| 8914 | |||
| 8915 | |||
| 8916 | void | 9015 | void |
| 8917 | make_mac_terminal_frame (struct frame *f) | 9016 | make_mac_terminal_frame (struct frame *f) |
| 8918 | { | 9017 | { |
| 8919 | Lisp_Object frame; | 9018 | Lisp_Object frame; |
| 9019 | Rect r; | ||
| 8920 | 9020 | ||
| 8921 | XSETFRAME (frame, f); | 9021 | XSETFRAME (frame, f); |
| 8922 | 9022 | ||
| @@ -8940,10 +9040,17 @@ make_mac_terminal_frame (struct frame *f) | |||
| 8940 | f->output_data.mac->mouse_pixel = 0xff00ff; | 9040 | f->output_data.mac->mouse_pixel = 0xff00ff; |
| 8941 | f->output_data.mac->cursor_foreground_pixel = 0x0000ff; | 9041 | f->output_data.mac->cursor_foreground_pixel = 0x0000ff; |
| 8942 | 9042 | ||
| 9043 | f->output_data.mac->text_cursor = GetCursor (iBeamCursor); | ||
| 9044 | f->output_data.mac->nontext_cursor = &arrow_cursor; | ||
| 9045 | f->output_data.mac->modeline_cursor = &arrow_cursor; | ||
| 9046 | f->output_data.mac->hand_cursor = &arrow_cursor; | ||
| 9047 | f->output_data.mac->hourglass_cursor = GetCursor (watchCursor); | ||
| 9048 | f->output_data.mac->horizontal_drag_cursor = &arrow_cursor; | ||
| 9049 | |||
| 8943 | FRAME_FONTSET (f) = -1; | 9050 | FRAME_FONTSET (f) = -1; |
| 8944 | f->output_data.mac->explicit_parent = 0; | 9051 | f->output_data.mac->explicit_parent = 0; |
| 8945 | f->left_pos = 4; | 9052 | f->left_pos = 8; |
| 8946 | f->top_pos = 4; | 9053 | f->top_pos = 32; |
| 8947 | f->border_width = 0; | 9054 | f->border_width = 0; |
| 8948 | 9055 | ||
| 8949 | f->internal_border_width = 0; | 9056 | f->internal_border_width = 0; |
| @@ -8954,7 +9061,20 @@ make_mac_terminal_frame (struct frame *f) | |||
| 8954 | f->new_text_cols = 0; | 9061 | f->new_text_cols = 0; |
| 8955 | f->new_text_lines = 0; | 9062 | f->new_text_lines = 0; |
| 8956 | 9063 | ||
| 8957 | make_mac_frame (f); | 9064 | SetRect (&r, f->left_pos, f->top_pos, |
| 9065 | f->left_pos + FRAME_PIXEL_WIDTH (f), | ||
| 9066 | f->top_pos + FRAME_PIXEL_HEIGHT (f)); | ||
| 9067 | |||
| 9068 | BLOCK_INPUT; | ||
| 9069 | |||
| 9070 | if (!(FRAME_MAC_WINDOW (f) = | ||
| 9071 | NewCWindow (NULL, &r, "\p", true, dBoxProc, | ||
| 9072 | (WindowPtr) -1, 1, (long) f->output_data.mac))) | ||
| 9073 | abort (); | ||
| 9074 | /* so that update events can find this mac_output struct */ | ||
| 9075 | f->output_data.mac->mFP = f; /* point back to emacs frame */ | ||
| 9076 | |||
| 9077 | UNBLOCK_INPUT; | ||
| 8958 | 9078 | ||
| 8959 | x_make_gc (f); | 9079 | x_make_gc (f); |
| 8960 | 9080 | ||
| @@ -8970,9 +9090,8 @@ make_mac_terminal_frame (struct frame *f) | |||
| 8970 | Fmodify_frame_parameters (frame, | 9090 | Fmodify_frame_parameters (frame, |
| 8971 | Fcons (Fcons (Qbackground_color, | 9091 | Fcons (Fcons (Qbackground_color, |
| 8972 | build_string ("white")), Qnil)); | 9092 | build_string ("white")), Qnil)); |
| 8973 | |||
| 8974 | ShowWindow (f->output_data.mac->mWP); | ||
| 8975 | } | 9093 | } |
| 9094 | #endif | ||
| 8976 | 9095 | ||
| 8977 | 9096 | ||
| 8978 | /*********************************************************************** | 9097 | /*********************************************************************** |
| @@ -8989,12 +9108,7 @@ mac_initialize_display_info () | |||
| 8989 | 9108 | ||
| 8990 | bzero (dpyinfo, sizeof (*dpyinfo)); | 9109 | bzero (dpyinfo, sizeof (*dpyinfo)); |
| 8991 | 9110 | ||
| 8992 | /* Put it on x_display_name_list. */ | 9111 | #ifdef MAC_OSX |
| 8993 | x_display_name_list = Fcons (Fcons (build_string ("Mac"), Qnil), | ||
| 8994 | x_display_name_list); | ||
| 8995 | dpyinfo->name_list_element = XCAR (x_display_name_list); | ||
| 8996 | |||
| 8997 | #if 0 | ||
| 8998 | dpyinfo->mac_id_name | 9112 | dpyinfo->mac_id_name |
| 8999 | = (char *) xmalloc (SCHARS (Vinvocation_name) | 9113 | = (char *) xmalloc (SCHARS (Vinvocation_name) |
| 9000 | + SCHARS (Vsystem_name) | 9114 | + SCHARS (Vsystem_name) |
| @@ -9049,6 +9163,61 @@ mac_initialize_display_info () | |||
| 9049 | dpyinfo->mouse_face_hidden = 0; | 9163 | dpyinfo->mouse_face_hidden = 0; |
| 9050 | } | 9164 | } |
| 9051 | 9165 | ||
| 9166 | /* Create an xrdb-style database of resources to supercede registry settings. | ||
| 9167 | The database is just a concatenation of C strings, finished by an additional | ||
| 9168 | \0. The string are submitted to some basic normalization, so | ||
| 9169 | |||
| 9170 | [ *]option[ *]:[ *]value... | ||
| 9171 | |||
| 9172 | becomes | ||
| 9173 | |||
| 9174 | option:value... | ||
| 9175 | |||
| 9176 | but any whitespace following value is not removed. */ | ||
| 9177 | |||
| 9178 | static char * | ||
| 9179 | mac_make_rdb (xrm_option) | ||
| 9180 | char *xrm_option; | ||
| 9181 | { | ||
| 9182 | char *buffer = xmalloc (strlen (xrm_option) + 2); | ||
| 9183 | char *current = buffer; | ||
| 9184 | char ch; | ||
| 9185 | int in_option = 1; | ||
| 9186 | int before_value = 0; | ||
| 9187 | |||
| 9188 | do { | ||
| 9189 | ch = *xrm_option++; | ||
| 9190 | |||
| 9191 | if (ch == '\n') | ||
| 9192 | { | ||
| 9193 | *current++ = '\0'; | ||
| 9194 | in_option = 1; | ||
| 9195 | before_value = 0; | ||
| 9196 | } | ||
| 9197 | else if (ch != ' ') | ||
| 9198 | { | ||
| 9199 | *current++ = ch; | ||
| 9200 | if (in_option && (ch == ':')) | ||
| 9201 | { | ||
| 9202 | in_option = 0; | ||
| 9203 | before_value = 1; | ||
| 9204 | } | ||
| 9205 | else if (before_value) | ||
| 9206 | { | ||
| 9207 | before_value = 0; | ||
| 9208 | } | ||
| 9209 | } | ||
| 9210 | else if (!(in_option || before_value)) | ||
| 9211 | { | ||
| 9212 | *current++ = ch; | ||
| 9213 | } | ||
| 9214 | } while (ch); | ||
| 9215 | |||
| 9216 | *current = '\0'; | ||
| 9217 | |||
| 9218 | return buffer; | ||
| 9219 | } | ||
| 9220 | |||
| 9052 | struct mac_display_info * | 9221 | struct mac_display_info * |
| 9053 | mac_term_init (display_name, xrm_option, resource_name) | 9222 | mac_term_init (display_name, xrm_option, resource_name) |
| 9054 | Lisp_Object display_name; | 9223 | Lisp_Object display_name; |
| @@ -9056,7 +9225,8 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 9056 | char *resource_name; | 9225 | char *resource_name; |
| 9057 | { | 9226 | { |
| 9058 | struct mac_display_info *dpyinfo; | 9227 | struct mac_display_info *dpyinfo; |
| 9059 | GDHandle main_device_handle; | 9228 | |
| 9229 | BLOCK_INPUT; | ||
| 9060 | 9230 | ||
| 9061 | if (!mac_initialized) | 9231 | if (!mac_initialized) |
| 9062 | { | 9232 | { |
| @@ -9064,17 +9234,90 @@ mac_term_init (display_name, xrm_option, resource_name) | |||
| 9064 | mac_initialized = 1; | 9234 | mac_initialized = 1; |
| 9065 | } | 9235 | } |
| 9066 | 9236 | ||
| 9067 | mac_initialize_display_info (display_name); | 9237 | if (x_display_list) |
| 9238 | error ("Sorry, this version can only handle one display"); | ||
| 9239 | |||
| 9240 | mac_initialize_display_info (); | ||
| 9068 | 9241 | ||
| 9069 | dpyinfo = &one_mac_display_info; | 9242 | dpyinfo = &one_mac_display_info; |
| 9070 | 9243 | ||
| 9071 | main_device_handle = LMGetMainDevice(); | 9244 | dpyinfo->xrdb = xrm_option ? mac_make_rdb (xrm_option) : NULL; |
| 9072 | 9245 | ||
| 9073 | dpyinfo->height = (**main_device_handle).gdRect.bottom; | 9246 | /* Put this display on the chain. */ |
| 9074 | dpyinfo->width = (**main_device_handle).gdRect.right; | 9247 | dpyinfo->next = x_display_list; |
| 9248 | x_display_list = dpyinfo; | ||
| 9249 | |||
| 9250 | /* Put it on x_display_name_list. */ | ||
| 9251 | x_display_name_list = Fcons (Fcons (display_name, Qnil), | ||
| 9252 | x_display_name_list); | ||
| 9253 | dpyinfo->name_list_element = XCAR (x_display_name_list); | ||
| 9254 | |||
| 9255 | UNBLOCK_INPUT; | ||
| 9075 | 9256 | ||
| 9076 | return dpyinfo; | 9257 | return dpyinfo; |
| 9077 | } | 9258 | } |
| 9259 | /* Get rid of display DPYINFO, assuming all frames are already gone. */ | ||
| 9260 | |||
| 9261 | void | ||
| 9262 | x_delete_display (dpyinfo) | ||
| 9263 | struct mac_display_info *dpyinfo; | ||
| 9264 | { | ||
| 9265 | int i; | ||
| 9266 | |||
| 9267 | /* Discard this display from x_display_name_list and x_display_list. | ||
| 9268 | We can't use Fdelq because that can quit. */ | ||
| 9269 | if (! NILP (x_display_name_list) | ||
| 9270 | && EQ (XCAR (x_display_name_list), dpyinfo->name_list_element)) | ||
| 9271 | x_display_name_list = XCDR (x_display_name_list); | ||
| 9272 | else | ||
| 9273 | { | ||
| 9274 | Lisp_Object tail; | ||
| 9275 | |||
| 9276 | tail = x_display_name_list; | ||
| 9277 | while (CONSP (tail) && CONSP (XCDR (tail))) | ||
| 9278 | { | ||
| 9279 | if (EQ (XCAR (XCDR (tail)), dpyinfo->name_list_element)) | ||
| 9280 | { | ||
| 9281 | XSETCDR (tail, XCDR (XCDR (tail))); | ||
| 9282 | break; | ||
| 9283 | } | ||
| 9284 | tail = XCDR (tail); | ||
| 9285 | } | ||
| 9286 | } | ||
| 9287 | |||
| 9288 | if (x_display_list == dpyinfo) | ||
| 9289 | x_display_list = dpyinfo->next; | ||
| 9290 | else | ||
| 9291 | { | ||
| 9292 | struct x_display_info *tail; | ||
| 9293 | |||
| 9294 | for (tail = x_display_list; tail; tail = tail->next) | ||
| 9295 | if (tail->next == dpyinfo) | ||
| 9296 | tail->next = tail->next->next; | ||
| 9297 | } | ||
| 9298 | |||
| 9299 | /* Free the font names in the font table. */ | ||
| 9300 | for (i = 0; i < dpyinfo->n_fonts; i++) | ||
| 9301 | if (dpyinfo->font_table[i].name) | ||
| 9302 | { | ||
| 9303 | if (dpyinfo->font_table[i].name != dpyinfo->font_table[i].full_name) | ||
| 9304 | xfree (dpyinfo->font_table[i].full_name); | ||
| 9305 | xfree (dpyinfo->font_table[i].name); | ||
| 9306 | } | ||
| 9307 | |||
| 9308 | if (dpyinfo->font_table->font_encoder) | ||
| 9309 | xfree (dpyinfo->font_table->font_encoder); | ||
| 9310 | |||
| 9311 | xfree (dpyinfo->font_table); | ||
| 9312 | xfree (dpyinfo->mac_id_name); | ||
| 9313 | |||
| 9314 | if (x_display_list == 0) | ||
| 9315 | { | ||
| 9316 | mac_clear_font_name_table (); | ||
| 9317 | bzero (dpyinfo, sizeof (*dpyinfo)); | ||
| 9318 | } | ||
| 9319 | } | ||
| 9320 | |||
| 9078 | 9321 | ||
| 9079 | #ifdef MAC_OSX | 9322 | #ifdef MAC_OSX |
| 9080 | void | 9323 | void |
| @@ -9334,7 +9577,6 @@ mac_initialize () | |||
| 9334 | #endif | 9577 | #endif |
| 9335 | 9578 | ||
| 9336 | BLOCK_INPUT; | 9579 | BLOCK_INPUT; |
| 9337 | mac_initialize_display_info (); | ||
| 9338 | 9580 | ||
| 9339 | #if TARGET_API_MAC_CARBON | 9581 | #if TARGET_API_MAC_CARBON |
| 9340 | init_required_apple_events (); | 9582 | init_required_apple_events (); |
| @@ -9372,7 +9614,9 @@ syms_of_macterm () | |||
| 9372 | Qsuper = intern ("super"); | 9614 | Qsuper = intern ("super"); |
| 9373 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); | 9615 | Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
| 9374 | 9616 | ||
| 9617 | #ifdef MAC_OSX | ||
| 9375 | Fprovide (intern ("mac-carbon"), Qnil); | 9618 | Fprovide (intern ("mac-carbon"), Qnil); |
| 9619 | #endif | ||
| 9376 | 9620 | ||
| 9377 | staticpro (&Qreverse); | 9621 | staticpro (&Qreverse); |
| 9378 | Qreverse = intern ("reverse"); | 9622 | Qreverse = intern ("reverse"); |
diff --git a/src/macterm.h b/src/macterm.h index 308a9200395..7c7d55c3790 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -218,6 +218,9 @@ struct mac_display_info | |||
| 218 | struct image_cache *image_cache; | 218 | struct image_cache *image_cache; |
| 219 | }; | 219 | }; |
| 220 | 220 | ||
| 221 | /* This checks to make sure we have a display. */ | ||
| 222 | extern void check_mac P_ ((void)); | ||
| 223 | |||
| 221 | #define x_display_info mac_display_info | 224 | #define x_display_info mac_display_info |
| 222 | 225 | ||
| 223 | /* This is a chain of structures for all the X displays currently in use. */ | 226 | /* This is a chain of structures for all the X displays currently in use. */ |
| @@ -388,6 +391,9 @@ struct mac_output { | |||
| 388 | /* The background for which the above relief GCs were set up. | 391 | /* The background for which the above relief GCs were set up. |
| 389 | They are changed only when a different background is involved. */ | 392 | They are changed only when a different background is involved. */ |
| 390 | unsigned long relief_background; | 393 | unsigned long relief_background; |
| 394 | |||
| 395 | /* Hints for the size and the position of a window. */ | ||
| 396 | XSizeHints *size_hints; | ||
| 391 | }; | 397 | }; |
| 392 | 398 | ||
| 393 | typedef struct mac_output mac_output; | 399 | typedef struct mac_output mac_output; |
| @@ -404,6 +410,8 @@ typedef struct mac_output mac_output; | |||
| 404 | 410 | ||
| 405 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.mac->baseline_offset) | 411 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.mac->baseline_offset) |
| 406 | 412 | ||
| 413 | #define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints) | ||
| 414 | |||
| 407 | /* This gives the w32_display_info structure for the display F is on. */ | 415 | /* This gives the w32_display_info structure for the display F is on. */ |
| 408 | #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) | 416 | #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) |
| 409 | #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) | 417 | #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) |
| @@ -593,6 +601,7 @@ extern void XFreePixmap P_ ((Display *, Pixmap)); | |||
| 593 | extern void XSetForeground P_ ((Display *, GC, unsigned long)); | 601 | extern void XSetForeground P_ ((Display *, GC, unsigned long)); |
| 594 | extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, | 602 | extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, |
| 595 | int, int)); | 603 | int, int)); |
| 604 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); | ||
| 596 | 605 | ||
| 597 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 | 606 | #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 |
| 598 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 | 607 | #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 |
diff --git a/src/process.c b/src/process.c index 646b9aed6a8..c17b32eb3c5 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1290,7 +1290,7 @@ list_processes_1 (query_only) | |||
| 1290 | XSETFASTINT (minspace, 1); | 1290 | XSETFASTINT (minspace, 1); |
| 1291 | 1291 | ||
| 1292 | set_buffer_internal (XBUFFER (Vstandard_output)); | 1292 | set_buffer_internal (XBUFFER (Vstandard_output)); |
| 1293 | Fbuffer_disable_undo (Vstandard_output); | 1293 | current_buffer->undo_list = Qt; |
| 1294 | 1294 | ||
| 1295 | current_buffer->truncate_lines = Qt; | 1295 | current_buffer->truncate_lines = Qt; |
| 1296 | 1296 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index b0a8f953c9c..7cb9c0c92eb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -810,7 +810,7 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; | |||
| 810 | 810 | ||
| 811 | static void setup_for_ellipsis P_ ((struct it *, int)); | 811 | static void setup_for_ellipsis P_ ((struct it *, int)); |
| 812 | static void mark_window_display_accurate_1 P_ ((struct window *, int)); | 812 | static void mark_window_display_accurate_1 P_ ((struct window *, int)); |
| 813 | static int single_display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); | 813 | static int single_display_spec_string_p P_ ((Lisp_Object, Lisp_Object)); |
| 814 | static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); | 814 | static int display_prop_string_p P_ ((Lisp_Object, Lisp_Object)); |
| 815 | static int cursor_row_p P_ ((struct window *, struct glyph_row *)); | 815 | static int cursor_row_p P_ ((struct window *, struct glyph_row *)); |
| 816 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); | 816 | static int redisplay_mode_lines P_ ((Lisp_Object, int)); |
| @@ -832,7 +832,7 @@ static int store_frame_title P_ ((const unsigned char *, int, int)); | |||
| 832 | static void x_consider_frame_title P_ ((Lisp_Object)); | 832 | static void x_consider_frame_title P_ ((Lisp_Object)); |
| 833 | static void handle_stop P_ ((struct it *)); | 833 | static void handle_stop P_ ((struct it *)); |
| 834 | static int tool_bar_lines_needed P_ ((struct frame *)); | 834 | static int tool_bar_lines_needed P_ ((struct frame *)); |
| 835 | static int single_display_prop_intangible_p P_ ((Lisp_Object)); | 835 | static int single_display_spec_intangible_p P_ ((Lisp_Object)); |
| 836 | static void ensure_echo_area_buffers P_ ((void)); | 836 | static void ensure_echo_area_buffers P_ ((void)); |
| 837 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); | 837 | static Lisp_Object unwind_with_echo_area_buffer P_ ((Lisp_Object)); |
| 838 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); | 838 | static Lisp_Object with_echo_area_buffer_unwind_data P_ ((struct window *)); |
| @@ -926,7 +926,7 @@ static void compute_string_pos P_ ((struct text_pos *, struct text_pos, | |||
| 926 | Lisp_Object)); | 926 | Lisp_Object)); |
| 927 | static int face_before_or_after_it_pos P_ ((struct it *, int)); | 927 | static int face_before_or_after_it_pos P_ ((struct it *, int)); |
| 928 | static int next_overlay_change P_ ((int)); | 928 | static int next_overlay_change P_ ((int)); |
| 929 | static int handle_single_display_prop P_ ((struct it *, Lisp_Object, | 929 | static int handle_single_display_spec P_ ((struct it *, Lisp_Object, |
| 930 | Lisp_Object, struct text_pos *, | 930 | Lisp_Object, struct text_pos *, |
| 931 | int)); | 931 | int)); |
| 932 | static int underlying_face_id P_ ((struct it *)); | 932 | static int underlying_face_id P_ ((struct it *)); |
| @@ -3275,7 +3275,10 @@ setup_for_ellipsis (it, len) | |||
| 3275 | ***********************************************************************/ | 3275 | ***********************************************************************/ |
| 3276 | 3276 | ||
| 3277 | /* Set up iterator IT from `display' property at its current position. | 3277 | /* Set up iterator IT from `display' property at its current position. |
| 3278 | Called from handle_stop. */ | 3278 | Called from handle_stop. |
| 3279 | We return HANDLED_RETURN if some part of the display property | ||
| 3280 | overrides the display of the buffer text itself. | ||
| 3281 | Otherwise we return HANDLED_NORMALLY. */ | ||
| 3279 | 3282 | ||
| 3280 | static enum prop_handled | 3283 | static enum prop_handled |
| 3281 | handle_display_prop (it) | 3284 | handle_display_prop (it) |
| @@ -3283,6 +3286,7 @@ handle_display_prop (it) | |||
| 3283 | { | 3286 | { |
| 3284 | Lisp_Object prop, object; | 3287 | Lisp_Object prop, object; |
| 3285 | struct text_pos *position; | 3288 | struct text_pos *position; |
| 3289 | /* Nonzero if some property replaces the display of the text itself. */ | ||
| 3286 | int display_replaced_p = 0; | 3290 | int display_replaced_p = 0; |
| 3287 | 3291 | ||
| 3288 | if (STRINGP (it->string)) | 3292 | if (STRINGP (it->string)) |
| @@ -3330,7 +3334,7 @@ handle_display_prop (it) | |||
| 3330 | { | 3334 | { |
| 3331 | for (; CONSP (prop); prop = XCDR (prop)) | 3335 | for (; CONSP (prop); prop = XCDR (prop)) |
| 3332 | { | 3336 | { |
| 3333 | if (handle_single_display_prop (it, XCAR (prop), object, | 3337 | if (handle_single_display_spec (it, XCAR (prop), object, |
| 3334 | position, display_replaced_p)) | 3338 | position, display_replaced_p)) |
| 3335 | display_replaced_p = 1; | 3339 | display_replaced_p = 1; |
| 3336 | } | 3340 | } |
| @@ -3339,13 +3343,13 @@ handle_display_prop (it) | |||
| 3339 | { | 3343 | { |
| 3340 | int i; | 3344 | int i; |
| 3341 | for (i = 0; i < ASIZE (prop); ++i) | 3345 | for (i = 0; i < ASIZE (prop); ++i) |
| 3342 | if (handle_single_display_prop (it, AREF (prop, i), object, | 3346 | if (handle_single_display_spec (it, AREF (prop, i), object, |
| 3343 | position, display_replaced_p)) | 3347 | position, display_replaced_p)) |
| 3344 | display_replaced_p = 1; | 3348 | display_replaced_p = 1; |
| 3345 | } | 3349 | } |
| 3346 | else | 3350 | else |
| 3347 | { | 3351 | { |
| 3348 | if (handle_single_display_prop (it, prop, object, position, 0)) | 3352 | if (handle_single_display_spec (it, prop, object, position, 0)) |
| 3349 | display_replaced_p = 1; | 3353 | display_replaced_p = 1; |
| 3350 | } | 3354 | } |
| 3351 | 3355 | ||
| @@ -3377,42 +3381,44 @@ display_prop_end (it, object, start_pos) | |||
| 3377 | } | 3381 | } |
| 3378 | 3382 | ||
| 3379 | 3383 | ||
| 3380 | /* Set up IT from a single `display' sub-property value PROP. OBJECT | 3384 | /* Set up IT from a single `display' specification PROP. OBJECT |
| 3381 | is the object in which the `display' property was found. *POSITION | 3385 | is the object in which the `display' property was found. *POSITION |
| 3382 | is the position at which it was found. DISPLAY_REPLACED_P non-zero | 3386 | is the position at which it was found. DISPLAY_REPLACED_P non-zero |
| 3383 | means that we previously saw a display sub-property which already | 3387 | means that we previously saw a display specification which already |
| 3384 | replaced text display with something else, for example an image; | 3388 | replaced text display with something else, for example an image; |
| 3385 | ignore such properties after the first one has been processed. | 3389 | we ignore such properties after the first one has been processed. |
| 3386 | 3390 | ||
| 3387 | If PROP is a `space' or `image' sub-property, set *POSITION to the | 3391 | If PROP is a `space' or `image' specification, and in some other |
| 3388 | end position of the `display' property. | 3392 | cases too, set *POSITION to the position where the `display' |
| 3393 | property ends. | ||
| 3389 | 3394 | ||
| 3390 | Value is non-zero if something was found which replaces the display | 3395 | Value is non-zero if something was found which replaces the display |
| 3391 | of buffer or string text. */ | 3396 | of buffer or string text. */ |
| 3392 | 3397 | ||
| 3393 | static int | 3398 | static int |
| 3394 | handle_single_display_prop (it, prop, object, position, | 3399 | handle_single_display_spec (it, spec, object, position, |
| 3395 | display_replaced_before_p) | 3400 | display_replaced_before_p) |
| 3396 | struct it *it; | 3401 | struct it *it; |
| 3397 | Lisp_Object prop; | 3402 | Lisp_Object spec; |
| 3398 | Lisp_Object object; | 3403 | Lisp_Object object; |
| 3399 | struct text_pos *position; | 3404 | struct text_pos *position; |
| 3400 | int display_replaced_before_p; | 3405 | int display_replaced_before_p; |
| 3401 | { | 3406 | { |
| 3402 | Lisp_Object value; | ||
| 3403 | int replaces_text_display_p = 0; | ||
| 3404 | Lisp_Object form; | 3407 | Lisp_Object form; |
| 3408 | Lisp_Object location, value; | ||
| 3409 | struct text_pos start_pos; | ||
| 3410 | int valid_p; | ||
| 3405 | 3411 | ||
| 3406 | /* If PROP is a list of the form `(when FORM . VALUE)', FORM is | 3412 | /* If SPEC is a list of the form `(when FORM . VALUE)', evaluate FORM. |
| 3407 | evaluated. If the result is nil, VALUE is ignored. */ | 3413 | If the result is non-nil, use VALUE instead of SPEC. */ |
| 3408 | form = Qt; | 3414 | form = Qt; |
| 3409 | if (CONSP (prop) && EQ (XCAR (prop), Qwhen)) | 3415 | if (CONSP (spec) && EQ (XCAR (spec), Qwhen)) |
| 3410 | { | 3416 | { |
| 3411 | prop = XCDR (prop); | 3417 | spec = XCDR (spec); |
| 3412 | if (!CONSP (prop)) | 3418 | if (!CONSP (spec)) |
| 3413 | return 0; | 3419 | return 0; |
| 3414 | form = XCAR (prop); | 3420 | form = XCAR (spec); |
| 3415 | prop = XCDR (prop); | 3421 | spec = XCDR (spec); |
| 3416 | } | 3422 | } |
| 3417 | 3423 | ||
| 3418 | if (!NILP (form) && !EQ (form, Qt)) | 3424 | if (!NILP (form) && !EQ (form, Qt)) |
| @@ -3438,15 +3444,15 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3438 | if (NILP (form)) | 3444 | if (NILP (form)) |
| 3439 | return 0; | 3445 | return 0; |
| 3440 | 3446 | ||
| 3441 | if (CONSP (prop) | 3447 | /* Handle `(height HEIGHT)' specifications. */ |
| 3442 | && EQ (XCAR (prop), Qheight) | 3448 | if (CONSP (spec) |
| 3443 | && CONSP (XCDR (prop))) | 3449 | && EQ (XCAR (spec), Qheight) |
| 3450 | && CONSP (XCDR (spec))) | ||
| 3444 | { | 3451 | { |
| 3445 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3452 | if (!FRAME_WINDOW_P (it->f)) |
| 3446 | return 0; | 3453 | return 0; |
| 3447 | 3454 | ||
| 3448 | /* `(height HEIGHT)'. */ | 3455 | it->font_height = XCAR (XCDR (spec)); |
| 3449 | it->font_height = XCAR (XCDR (prop)); | ||
| 3450 | if (!NILP (it->font_height)) | 3456 | if (!NILP (it->font_height)) |
| 3451 | { | 3457 | { |
| 3452 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 3458 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| @@ -3487,7 +3493,6 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3487 | { | 3493 | { |
| 3488 | /* Evaluate IT->font_height with `height' bound to the | 3494 | /* Evaluate IT->font_height with `height' bound to the |
| 3489 | current specified height to get the new height. */ | 3495 | current specified height to get the new height. */ |
| 3490 | Lisp_Object value; | ||
| 3491 | int count = SPECPDL_INDEX (); | 3496 | int count = SPECPDL_INDEX (); |
| 3492 | 3497 | ||
| 3493 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); | 3498 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); |
| @@ -3501,29 +3506,35 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3501 | if (new_height > 0) | 3506 | if (new_height > 0) |
| 3502 | it->face_id = face_with_height (it->f, it->face_id, new_height); | 3507 | it->face_id = face_with_height (it->f, it->face_id, new_height); |
| 3503 | } | 3508 | } |
| 3509 | |||
| 3510 | return 0; | ||
| 3504 | } | 3511 | } |
| 3505 | else if (CONSP (prop) | 3512 | |
| 3506 | && EQ (XCAR (prop), Qspace_width) | 3513 | /* Handle `(space_width WIDTH)'. */ |
| 3507 | && CONSP (XCDR (prop))) | 3514 | if (CONSP (spec) |
| 3515 | && EQ (XCAR (spec), Qspace_width) | ||
| 3516 | && CONSP (XCDR (spec))) | ||
| 3508 | { | 3517 | { |
| 3509 | /* `(space_width WIDTH)'. */ | 3518 | if (!FRAME_WINDOW_P (it->f)) |
| 3510 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | ||
| 3511 | return 0; | 3519 | return 0; |
| 3512 | 3520 | ||
| 3513 | value = XCAR (XCDR (prop)); | 3521 | value = XCAR (XCDR (spec)); |
| 3514 | if (NUMBERP (value) && XFLOATINT (value) > 0) | 3522 | if (NUMBERP (value) && XFLOATINT (value) > 0) |
| 3515 | it->space_width = value; | 3523 | it->space_width = value; |
| 3524 | |||
| 3525 | return 0; | ||
| 3516 | } | 3526 | } |
| 3517 | else if (CONSP (prop) | 3527 | |
| 3518 | && EQ (XCAR (prop), Qslice)) | 3528 | /* Handle `(slice X Y WIDTH HEIGHT)'. */ |
| 3529 | if (CONSP (spec) | ||
| 3530 | && EQ (XCAR (spec), Qslice)) | ||
| 3519 | { | 3531 | { |
| 3520 | /* `(slice X Y WIDTH HEIGHT)'. */ | ||
| 3521 | Lisp_Object tem; | 3532 | Lisp_Object tem; |
| 3522 | 3533 | ||
| 3523 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | 3534 | if (!FRAME_WINDOW_P (it->f)) |
| 3524 | return 0; | 3535 | return 0; |
| 3525 | 3536 | ||
| 3526 | if (tem = XCDR (prop), CONSP (tem)) | 3537 | if (tem = XCDR (spec), CONSP (tem)) |
| 3527 | { | 3538 | { |
| 3528 | it->slice.x = XCAR (tem); | 3539 | it->slice.x = XCAR (tem); |
| 3529 | if (tem = XCDR (tem), CONSP (tem)) | 3540 | if (tem = XCDR (tem), CONSP (tem)) |
| @@ -3537,17 +3548,20 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3537 | } | 3548 | } |
| 3538 | } | 3549 | } |
| 3539 | } | 3550 | } |
| 3551 | |||
| 3552 | return 0; | ||
| 3540 | } | 3553 | } |
| 3541 | else if (CONSP (prop) | 3554 | |
| 3542 | && EQ (XCAR (prop), Qraise) | 3555 | /* Handle `(raise FACTOR)'. */ |
| 3543 | && CONSP (XCDR (prop))) | 3556 | if (CONSP (spec) |
| 3557 | && EQ (XCAR (spec), Qraise) | ||
| 3558 | && CONSP (XCDR (spec))) | ||
| 3544 | { | 3559 | { |
| 3545 | /* `(raise FACTOR)'. */ | ||
| 3546 | if (!FRAME_WINDOW_P (it->f)) | 3560 | if (!FRAME_WINDOW_P (it->f)) |
| 3547 | return 0; | 3561 | return 0; |
| 3548 | 3562 | ||
| 3549 | #ifdef HAVE_WINDOW_SYSTEM | 3563 | #ifdef HAVE_WINDOW_SYSTEM |
| 3550 | value = XCAR (XCDR (prop)); | 3564 | value = XCAR (XCDR (spec)); |
| 3551 | if (NUMBERP (value)) | 3565 | if (NUMBERP (value)) |
| 3552 | { | 3566 | { |
| 3553 | struct face *face = FACE_FROM_ID (it->f, it->face_id); | 3567 | struct face *face = FACE_FROM_ID (it->f, it->face_id); |
| @@ -3555,188 +3569,194 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3555 | * (FONT_HEIGHT (face->font))); | 3569 | * (FONT_HEIGHT (face->font))); |
| 3556 | } | 3570 | } |
| 3557 | #endif /* HAVE_WINDOW_SYSTEM */ | 3571 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3572 | |||
| 3573 | return 0; | ||
| 3558 | } | 3574 | } |
| 3559 | else if (!it->string_from_display_prop_p) | ||
| 3560 | { | ||
| 3561 | /* `((margin left-margin) VALUE)' or `((margin right-margin) | ||
| 3562 | VALUE) or `((margin nil) VALUE)' or VALUE. */ | ||
| 3563 | Lisp_Object location, value; | ||
| 3564 | struct text_pos start_pos; | ||
| 3565 | int valid_p; | ||
| 3566 | 3575 | ||
| 3567 | /* Characters having this form of property are not displayed, so | 3576 | /* Don't handle the other kinds of display specifications |
| 3568 | we have to find the end of the property. */ | 3577 | inside a string that we got from a `display' property. */ |
| 3569 | start_pos = *position; | 3578 | if (it->string_from_display_prop_p) |
| 3570 | *position = display_prop_end (it, object, start_pos); | 3579 | return 0; |
| 3571 | value = Qnil; | ||
| 3572 | 3580 | ||
| 3573 | /* Let's stop at the new position and assume that all | 3581 | /* Characters having this form of property are not displayed, so |
| 3574 | text properties change there. */ | 3582 | we have to find the end of the property. */ |
| 3575 | it->stop_charpos = position->charpos; | 3583 | start_pos = *position; |
| 3584 | *position = display_prop_end (it, object, start_pos); | ||
| 3585 | value = Qnil; | ||
| 3576 | 3586 | ||
| 3577 | if (CONSP (prop) | 3587 | /* Stop the scan at that end position--we assume that all |
| 3578 | && (EQ (XCAR (prop), Qleft_fringe) | 3588 | text properties change there. */ |
| 3579 | || EQ (XCAR (prop), Qright_fringe)) | 3589 | it->stop_charpos = position->charpos; |
| 3580 | && CONSP (XCDR (prop))) | ||
| 3581 | { | ||
| 3582 | int face_id = DEFAULT_FACE_ID; | ||
| 3583 | int fringe_bitmap; | ||
| 3584 | 3590 | ||
| 3585 | /* Save current settings of IT so that we can restore them | 3591 | /* Handle `(left-fringe BITMAP [FACE])' |
| 3586 | when we are finished with the glyph property value. */ | 3592 | and `(right-fringe BITMAP [FACE])'. */ |
| 3593 | if (CONSP (spec) | ||
| 3594 | && (EQ (XCAR (spec), Qleft_fringe) | ||
| 3595 | || EQ (XCAR (spec), Qright_fringe)) | ||
| 3596 | && CONSP (XCDR (spec))) | ||
| 3597 | { | ||
| 3598 | int face_id = DEFAULT_FACE_ID; | ||
| 3599 | int fringe_bitmap; | ||
| 3587 | 3600 | ||
| 3588 | /* `(left-fringe BITMAP FACE)'. */ | 3601 | if (!FRAME_WINDOW_P (it->f)) |
| 3589 | if (!FRAME_WINDOW_P (it->f)) | 3602 | /* If we return here, POSITION has been advanced |
| 3590 | return 0; | 3603 | across the text with this property. */ |
| 3604 | return 0; | ||
| 3591 | 3605 | ||
| 3592 | #ifdef HAVE_WINDOW_SYSTEM | 3606 | #ifdef HAVE_WINDOW_SYSTEM |
| 3593 | value = XCAR (XCDR (prop)); | 3607 | value = XCAR (XCDR (spec)); |
| 3594 | if (!SYMBOLP (value) | 3608 | if (!SYMBOLP (value) |
| 3595 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) | 3609 | || !(fringe_bitmap = lookup_fringe_bitmap (value))) |
| 3596 | return 0; | 3610 | /* If we return here, POSITION has been advanced |
| 3611 | across the text with this property. */ | ||
| 3612 | return 0; | ||
| 3597 | 3613 | ||
| 3598 | if (CONSP (XCDR (XCDR (prop)))) | 3614 | if (CONSP (XCDR (XCDR (spec)))) |
| 3599 | { | 3615 | { |
| 3600 | Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | 3616 | Lisp_Object face_name = XCAR (XCDR (XCDR (spec))); |
| 3601 | int face_id2 = lookup_named_face (it->f, face_name, 'A', 0); | 3617 | int face_id2 = lookup_named_face (it->f, face_name, 'A', 0); |
| 3602 | if (face_id2 >= 0) | 3618 | if (face_id2 >= 0) |
| 3603 | face_id = face_id2; | 3619 | face_id = face_id2; |
| 3604 | } | 3620 | } |
| 3605 | 3621 | ||
| 3606 | push_it (it); | 3622 | /* Save current settings of IT so that we can restore them |
| 3623 | when we are finished with the glyph property value. */ | ||
| 3607 | 3624 | ||
| 3608 | it->area = TEXT_AREA; | 3625 | push_it (it); |
| 3609 | it->what = IT_IMAGE; | ||
| 3610 | it->image_id = -1; /* no image */ | ||
| 3611 | it->position = start_pos; | ||
| 3612 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3613 | it->method = next_element_from_image; | ||
| 3614 | it->face_id = face_id; | ||
| 3615 | 3626 | ||
| 3616 | /* Say that we haven't consumed the characters with | 3627 | it->area = TEXT_AREA; |
| 3617 | `display' property yet. The call to pop_it in | 3628 | it->what = IT_IMAGE; |
| 3618 | set_iterator_to_next will clean this up. */ | 3629 | it->image_id = -1; /* no image */ |
| 3619 | *position = start_pos; | 3630 | it->position = start_pos; |
| 3631 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3632 | it->method = next_element_from_image; | ||
| 3633 | it->face_id = face_id; | ||
| 3620 | 3634 | ||
| 3621 | if (EQ (XCAR (prop), Qleft_fringe)) | 3635 | /* Say that we haven't consumed the characters with |
| 3622 | { | 3636 | `display' property yet. The call to pop_it in |
| 3623 | it->left_user_fringe_bitmap = fringe_bitmap; | 3637 | set_iterator_to_next will clean this up. */ |
| 3624 | it->left_user_fringe_face_id = face_id; | 3638 | *position = start_pos; |
| 3625 | } | ||
| 3626 | else | ||
| 3627 | { | ||
| 3628 | it->right_user_fringe_bitmap = fringe_bitmap; | ||
| 3629 | it->right_user_fringe_face_id = face_id; | ||
| 3630 | } | ||
| 3631 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3632 | return 1; | ||
| 3633 | } | ||
| 3634 | 3639 | ||
| 3635 | location = Qunbound; | 3640 | if (EQ (XCAR (spec), Qleft_fringe)) |
| 3636 | if (CONSP (prop) && CONSP (XCAR (prop))) | ||
| 3637 | { | 3641 | { |
| 3638 | Lisp_Object tem; | 3642 | it->left_user_fringe_bitmap = fringe_bitmap; |
| 3643 | it->left_user_fringe_face_id = face_id; | ||
| 3644 | } | ||
| 3645 | else | ||
| 3646 | { | ||
| 3647 | it->right_user_fringe_bitmap = fringe_bitmap; | ||
| 3648 | it->right_user_fringe_face_id = face_id; | ||
| 3649 | } | ||
| 3650 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3651 | return 1; | ||
| 3652 | } | ||
| 3639 | 3653 | ||
| 3640 | value = XCDR (prop); | 3654 | /* Prepare to handle `((margin left-margin) ...)', |
| 3641 | if (CONSP (value)) | 3655 | `((margin right-margin) ...)' and `((margin nil) ...)' |
| 3642 | value = XCAR (value); | 3656 | prefixes for display specifications. */ |
| 3657 | location = Qunbound; | ||
| 3658 | if (CONSP (spec) && CONSP (XCAR (spec))) | ||
| 3659 | { | ||
| 3660 | Lisp_Object tem; | ||
| 3643 | 3661 | ||
| 3644 | tem = XCAR (prop); | 3662 | value = XCDR (spec); |
| 3645 | if (EQ (XCAR (tem), Qmargin) | 3663 | if (CONSP (value)) |
| 3646 | && (tem = XCDR (tem), | 3664 | value = XCAR (value); |
| 3647 | tem = CONSP (tem) ? XCAR (tem) : Qnil, | ||
| 3648 | (NILP (tem) | ||
| 3649 | || EQ (tem, Qleft_margin) | ||
| 3650 | || EQ (tem, Qright_margin)))) | ||
| 3651 | location = tem; | ||
| 3652 | } | ||
| 3653 | 3665 | ||
| 3654 | if (EQ (location, Qunbound)) | 3666 | tem = XCAR (spec); |
| 3655 | { | 3667 | if (EQ (XCAR (tem), Qmargin) |
| 3656 | location = Qnil; | 3668 | && (tem = XCDR (tem), |
| 3657 | value = prop; | 3669 | tem = CONSP (tem) ? XCAR (tem) : Qnil, |
| 3658 | } | 3670 | (NILP (tem) |
| 3671 | || EQ (tem, Qleft_margin) | ||
| 3672 | || EQ (tem, Qright_margin)))) | ||
| 3673 | location = tem; | ||
| 3674 | } | ||
| 3675 | |||
| 3676 | if (EQ (location, Qunbound)) | ||
| 3677 | { | ||
| 3678 | location = Qnil; | ||
| 3679 | value = spec; | ||
| 3680 | } | ||
| 3681 | |||
| 3682 | /* After this point, VALUE is the property after any | ||
| 3683 | margin prefix has been stripped. It must be a string, | ||
| 3684 | an image specification, or `(space ...)'. | ||
| 3659 | 3685 | ||
| 3660 | valid_p = (STRINGP (value) | 3686 | LOCATION specifies where to display: `left-margin', |
| 3687 | `right-margin' or nil. */ | ||
| 3688 | |||
| 3689 | valid_p = (STRINGP (value) | ||
| 3661 | #ifdef HAVE_WINDOW_SYSTEM | 3690 | #ifdef HAVE_WINDOW_SYSTEM |
| 3662 | || (FRAME_WINDOW_P (it->f) && valid_image_p (value)) | 3691 | || (FRAME_WINDOW_P (it->f) && valid_image_p (value)) |
| 3663 | #endif /* not HAVE_WINDOW_SYSTEM */ | 3692 | #endif /* not HAVE_WINDOW_SYSTEM */ |
| 3664 | || (CONSP (value) && EQ (XCAR (value), Qspace))); | 3693 | || (CONSP (value) && EQ (XCAR (value), Qspace))); |
| 3665 | |||
| 3666 | if ((EQ (location, Qleft_margin) | ||
| 3667 | || EQ (location, Qright_margin) | ||
| 3668 | || NILP (location)) | ||
| 3669 | && valid_p | ||
| 3670 | && !display_replaced_before_p) | ||
| 3671 | { | ||
| 3672 | replaces_text_display_p = 1; | ||
| 3673 | 3694 | ||
| 3674 | /* Save current settings of IT so that we can restore them | 3695 | if (valid_p && !display_replaced_before_p) |
| 3675 | when we are finished with the glyph property value. */ | 3696 | { |
| 3676 | push_it (it); | 3697 | /* Save current settings of IT so that we can restore them |
| 3698 | when we are finished with the glyph property value. */ | ||
| 3699 | push_it (it); | ||
| 3700 | if (NILP (location)) | ||
| 3701 | it->area = TEXT_AREA; | ||
| 3702 | else if (EQ (location, Qleft_margin)) | ||
| 3703 | it->area = LEFT_MARGIN_AREA; | ||
| 3704 | else | ||
| 3705 | it->area = RIGHT_MARGIN_AREA; | ||
| 3677 | 3706 | ||
| 3678 | if (NILP (location)) | 3707 | if (STRINGP (value)) |
| 3679 | it->area = TEXT_AREA; | 3708 | { |
| 3680 | else if (EQ (location, Qleft_margin)) | 3709 | it->string = value; |
| 3681 | it->area = LEFT_MARGIN_AREA; | 3710 | it->multibyte_p = STRING_MULTIBYTE (it->string); |
| 3682 | else | 3711 | it->current.overlay_string_index = -1; |
| 3683 | it->area = RIGHT_MARGIN_AREA; | 3712 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; |
| 3713 | it->end_charpos = it->string_nchars = SCHARS (it->string); | ||
| 3714 | it->method = next_element_from_string; | ||
| 3715 | it->stop_charpos = 0; | ||
| 3716 | it->string_from_display_prop_p = 1; | ||
| 3717 | /* Say that we haven't consumed the characters with | ||
| 3718 | `display' property yet. The call to pop_it in | ||
| 3719 | set_iterator_to_next will clean this up. */ | ||
| 3720 | *position = start_pos; | ||
| 3721 | } | ||
| 3722 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | ||
| 3723 | { | ||
| 3724 | it->method = next_element_from_stretch; | ||
| 3725 | it->object = value; | ||
| 3726 | it->current.pos = it->position = start_pos; | ||
| 3684 | 3727 | ||
| 3685 | if (STRINGP (value)) | ||
| 3686 | { | ||
| 3687 | it->string = value; | ||
| 3688 | it->multibyte_p = STRING_MULTIBYTE (it->string); | ||
| 3689 | it->current.overlay_string_index = -1; | ||
| 3690 | IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | ||
| 3691 | it->end_charpos = it->string_nchars = SCHARS (it->string); | ||
| 3692 | it->method = next_element_from_string; | ||
| 3693 | it->stop_charpos = 0; | ||
| 3694 | it->string_from_display_prop_p = 1; | ||
| 3695 | /* Say that we haven't consumed the characters with | ||
| 3696 | `display' property yet. The call to pop_it in | ||
| 3697 | set_iterator_to_next will clean this up. */ | ||
| 3698 | *position = start_pos; | ||
| 3699 | } | ||
| 3700 | else if (CONSP (value) && EQ (XCAR (value), Qspace)) | ||
| 3701 | { | ||
| 3702 | it->method = next_element_from_stretch; | ||
| 3703 | it->object = value; | ||
| 3704 | it->current.pos = it->position = start_pos; | ||
| 3705 | } | ||
| 3706 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3707 | else | ||
| 3708 | { | ||
| 3709 | if (FRAME_WINDOW_P (it->f)) | ||
| 3710 | { | ||
| 3711 | it->what = IT_IMAGE; | ||
| 3712 | it->image_id = lookup_image (it->f, value); | ||
| 3713 | it->position = start_pos; | ||
| 3714 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3715 | it->method = next_element_from_image; | ||
| 3716 | } | ||
| 3717 | |||
| 3718 | /* Say that we haven't consumed the characters with | ||
| 3719 | `display' property yet. The call to pop_it in | ||
| 3720 | set_iterator_to_next will clean this up. */ | ||
| 3721 | *position = start_pos; | ||
| 3722 | } | ||
| 3723 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3724 | } | 3728 | } |
| 3729 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3725 | else | 3730 | else |
| 3726 | /* Invalid property or property not supported. Restore | 3731 | { |
| 3727 | the position to what it was before. */ | 3732 | it->what = IT_IMAGE; |
| 3728 | *position = start_pos; | 3733 | it->image_id = lookup_image (it->f, value); |
| 3734 | it->position = start_pos; | ||
| 3735 | it->object = NILP (object) ? it->w->buffer : object; | ||
| 3736 | it->method = next_element_from_image; | ||
| 3737 | |||
| 3738 | /* Say that we haven't consumed the characters with | ||
| 3739 | `display' property yet. The call to pop_it in | ||
| 3740 | set_iterator_to_next will clean this up. */ | ||
| 3741 | *position = start_pos; | ||
| 3742 | } | ||
| 3743 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3744 | |||
| 3745 | return 1; | ||
| 3729 | } | 3746 | } |
| 3730 | 3747 | ||
| 3731 | return replaces_text_display_p; | 3748 | /* Invalid property or property not supported. Restore |
| 3749 | POSITION to what it was before. */ | ||
| 3750 | *position = start_pos; | ||
| 3751 | return 0; | ||
| 3732 | } | 3752 | } |
| 3733 | 3753 | ||
| 3734 | 3754 | ||
| 3735 | /* Check if PROP is a display sub-property value whose text should be | 3755 | /* Check if SPEC is a display sub-property value whose text should be |
| 3736 | treated as intangible. */ | 3756 | treated as intangible. */ |
| 3737 | 3757 | ||
| 3738 | static int | 3758 | static int |
| 3739 | single_display_prop_intangible_p (prop) | 3759 | single_display_spec_intangible_p (prop) |
| 3740 | Lisp_Object prop; | 3760 | Lisp_Object prop; |
| 3741 | { | 3761 | { |
| 3742 | /* Skip over `when FORM'. */ | 3762 | /* Skip over `when FORM'. */ |
| @@ -3789,7 +3809,7 @@ display_prop_intangible_p (prop) | |||
| 3789 | /* A list of sub-properties. */ | 3809 | /* A list of sub-properties. */ |
| 3790 | while (CONSP (prop)) | 3810 | while (CONSP (prop)) |
| 3791 | { | 3811 | { |
| 3792 | if (single_display_prop_intangible_p (XCAR (prop))) | 3812 | if (single_display_spec_intangible_p (XCAR (prop))) |
| 3793 | return 1; | 3813 | return 1; |
| 3794 | prop = XCDR (prop); | 3814 | prop = XCDR (prop); |
| 3795 | } | 3815 | } |
| @@ -3799,11 +3819,11 @@ display_prop_intangible_p (prop) | |||
| 3799 | /* A vector of sub-properties. */ | 3819 | /* A vector of sub-properties. */ |
| 3800 | int i; | 3820 | int i; |
| 3801 | for (i = 0; i < ASIZE (prop); ++i) | 3821 | for (i = 0; i < ASIZE (prop); ++i) |
| 3802 | if (single_display_prop_intangible_p (AREF (prop, i))) | 3822 | if (single_display_spec_intangible_p (AREF (prop, i))) |
| 3803 | return 1; | 3823 | return 1; |
| 3804 | } | 3824 | } |
| 3805 | else | 3825 | else |
| 3806 | return single_display_prop_intangible_p (prop); | 3826 | return single_display_spec_intangible_p (prop); |
| 3807 | 3827 | ||
| 3808 | return 0; | 3828 | return 0; |
| 3809 | } | 3829 | } |
| @@ -3812,7 +3832,7 @@ display_prop_intangible_p (prop) | |||
| 3812 | /* Return 1 if PROP is a display sub-property value containing STRING. */ | 3832 | /* Return 1 if PROP is a display sub-property value containing STRING. */ |
| 3813 | 3833 | ||
| 3814 | static int | 3834 | static int |
| 3815 | single_display_prop_string_p (prop, string) | 3835 | single_display_spec_string_p (prop, string) |
| 3816 | Lisp_Object prop, string; | 3836 | Lisp_Object prop, string; |
| 3817 | { | 3837 | { |
| 3818 | if (EQ (string, prop)) | 3838 | if (EQ (string, prop)) |
| @@ -3857,7 +3877,7 @@ display_prop_string_p (prop, string) | |||
| 3857 | /* A list of sub-properties. */ | 3877 | /* A list of sub-properties. */ |
| 3858 | while (CONSP (prop)) | 3878 | while (CONSP (prop)) |
| 3859 | { | 3879 | { |
| 3860 | if (single_display_prop_string_p (XCAR (prop), string)) | 3880 | if (single_display_spec_string_p (XCAR (prop), string)) |
| 3861 | return 1; | 3881 | return 1; |
| 3862 | prop = XCDR (prop); | 3882 | prop = XCDR (prop); |
| 3863 | } | 3883 | } |
| @@ -3867,11 +3887,11 @@ display_prop_string_p (prop, string) | |||
| 3867 | /* A vector of sub-properties. */ | 3887 | /* A vector of sub-properties. */ |
| 3868 | int i; | 3888 | int i; |
| 3869 | for (i = 0; i < ASIZE (prop); ++i) | 3889 | for (i = 0; i < ASIZE (prop); ++i) |
| 3870 | if (single_display_prop_string_p (AREF (prop, i), string)) | 3890 | if (single_display_spec_string_p (AREF (prop, i), string)) |
| 3871 | return 1; | 3891 | return 1; |
| 3872 | } | 3892 | } |
| 3873 | else | 3893 | else |
| 3874 | return single_display_prop_string_p (prop, string); | 3894 | return single_display_spec_string_p (prop, string); |
| 3875 | 3895 | ||
| 3876 | return 0; | 3896 | return 0; |
| 3877 | } | 3897 | } |
| @@ -6624,7 +6644,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte) | |||
| 6624 | } | 6644 | } |
| 6625 | return 0; | 6645 | return 0; |
| 6626 | } | 6646 | } |
| 6627 | 6647 | ||
| 6628 | 6648 | ||
| 6629 | /* Display an echo area message M with a specified length of NBYTES | 6649 | /* Display an echo area message M with a specified length of NBYTES |
| 6630 | bytes. The string may include null characters. If M is 0, clear | 6650 | bytes. The string may include null characters. If M is 0, clear |
| @@ -21890,20 +21910,6 @@ expose_window (w, fr) | |||
| 21890 | } | 21910 | } |
| 21891 | } | 21911 | } |
| 21892 | 21912 | ||
| 21893 | #ifdef HAVE_CARBON | ||
| 21894 | /* Display scroll bar for this window. */ | ||
| 21895 | if (!NILP (w->vertical_scroll_bar)) | ||
| 21896 | { | ||
| 21897 | /* ++KFS: | ||
| 21898 | If this doesn't work here (maybe some header files are missing), | ||
| 21899 | make a function in macterm.c and call it to do the job! */ | ||
| 21900 | ControlHandle ch | ||
| 21901 | = SCROLL_BAR_CONTROL_HANDLE (XSCROLL_BAR (w->vertical_scroll_bar)); | ||
| 21902 | |||
| 21903 | Draw1Control (ch); | ||
| 21904 | } | ||
| 21905 | #endif | ||
| 21906 | |||
| 21907 | return mouse_face_overwritten_p; | 21913 | return mouse_face_overwritten_p; |
| 21908 | } | 21914 | } |
| 21909 | 21915 | ||
| @@ -21962,16 +21968,6 @@ expose_frame (f, x, y, w, h) | |||
| 21962 | return; | 21968 | return; |
| 21963 | } | 21969 | } |
| 21964 | 21970 | ||
| 21965 | #ifdef HAVE_CARBON | ||
| 21966 | /* MAC_TODO: this is a kludge, but if scroll bars are not activated | ||
| 21967 | or deactivated here, for unknown reasons, activated scroll bars | ||
| 21968 | are shown in deactivated frames in some instances. */ | ||
| 21969 | if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) | ||
| 21970 | activate_scroll_bars (f); | ||
| 21971 | else | ||
| 21972 | deactivate_scroll_bars (f); | ||
| 21973 | #endif | ||
| 21974 | |||
| 21975 | /* If basic faces haven't been realized yet, there is no point in | 21971 | /* If basic faces haven't been realized yet, there is no point in |
| 21976 | trying to redraw anything. This can happen when we get an expose | 21972 | trying to redraw anything. This can happen when we get an expose |
| 21977 | event while Emacs is starting, e.g. by moving another window. */ | 21973 | event while Emacs is starting, e.g. by moving another window. */ |
diff --git a/src/xfaces.c b/src/xfaces.c index eb5f617b4a1..a1b6b4bc775 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1075,6 +1075,9 @@ clear_font_table (dpyinfo) | |||
| 1075 | #ifdef WINDOWSNT | 1075 | #ifdef WINDOWSNT |
| 1076 | w32_unload_font (dpyinfo, font_info->font); | 1076 | w32_unload_font (dpyinfo, font_info->font); |
| 1077 | #endif | 1077 | #endif |
| 1078 | #ifdef MAC_OS | ||
| 1079 | mac_unload_font (dpyinfo, font_info->font); | ||
| 1080 | #endif | ||
| 1078 | UNBLOCK_INPUT; | 1081 | UNBLOCK_INPUT; |
| 1079 | 1082 | ||
| 1080 | /* Mark font table slot free. */ | 1083 | /* Mark font table slot free. */ |
diff --git a/src/xfns.c b/src/xfns.c index 2fe08e0a458..6a99dbf8e5b 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5278,6 +5278,16 @@ or directory must exist. ONLY-DIR-P is ignored." */) | |||
| 5278 | XEvent event; | 5278 | XEvent event; |
| 5279 | x_menu_wait_for_event (0); | 5279 | x_menu_wait_for_event (0); |
| 5280 | XtAppNextEvent (Xt_app_con, &event); | 5280 | XtAppNextEvent (Xt_app_con, &event); |
| 5281 | if (event.type == KeyPress | ||
| 5282 | && FRAME_X_DISPLAY (f) == event.xkey.display) | ||
| 5283 | { | ||
| 5284 | KeySym keysym = XLookupKeysym (&event.xkey, 0); | ||
| 5285 | |||
| 5286 | /* Pop down on C-g. */ | ||
| 5287 | if (keysym == XK_g && (event.xkey.state & ControlMask) != 0) | ||
| 5288 | XtUnmanageChild (dialog); | ||
| 5289 | } | ||
| 5290 | |||
| 5281 | (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f)); | 5291 | (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f)); |
| 5282 | } | 5292 | } |
| 5283 | 5293 | ||
diff --git a/src/xmenu.c b/src/xmenu.c index 45b0742df0e..774f404fd42 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -116,7 +116,7 @@ extern XtAppContext Xt_app_con; | |||
| 116 | 116 | ||
| 117 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); | 117 | static Lisp_Object xdialog_show P_ ((FRAME_PTR, int, Lisp_Object, char **)); |
| 118 | static void popup_get_selection P_ ((XEvent *, struct x_display_info *, | 118 | static void popup_get_selection P_ ((XEvent *, struct x_display_info *, |
| 119 | LWLIB_ID, int, int)); | 119 | LWLIB_ID, int)); |
| 120 | 120 | ||
| 121 | /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ | 121 | /* Define HAVE_BOXES if menus can handle radio and toggle buttons. */ |
| 122 | 122 | ||
| @@ -1186,24 +1186,21 @@ x_menu_wait_for_event (void *data) | |||
| 1186 | popped down (deactivated). This is used for x-popup-menu | 1186 | popped down (deactivated). This is used for x-popup-menu |
| 1187 | and x-popup-dialog; it is not used for the menu bar. | 1187 | and x-popup-dialog; it is not used for the menu bar. |
| 1188 | 1188 | ||
| 1189 | If DOWN_ON_KEYPRESS is nonzero, pop down if a key is pressed. | ||
| 1190 | |||
| 1191 | NOTE: All calls to popup_get_selection should be protected | 1189 | NOTE: All calls to popup_get_selection should be protected |
| 1192 | with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ | 1190 | with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ |
| 1193 | 1191 | ||
| 1194 | static void | 1192 | static void |
| 1195 | popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) | 1193 | popup_get_selection (initial_event, dpyinfo, id, do_timers) |
| 1196 | XEvent *initial_event; | 1194 | XEvent *initial_event; |
| 1197 | struct x_display_info *dpyinfo; | 1195 | struct x_display_info *dpyinfo; |
| 1198 | LWLIB_ID id; | 1196 | LWLIB_ID id; |
| 1199 | int do_timers; | 1197 | int do_timers; |
| 1200 | int down_on_keypress; | ||
| 1201 | { | 1198 | { |
| 1202 | XEvent event; | 1199 | XEvent event; |
| 1203 | 1200 | ||
| 1204 | while (popup_activated_flag) | 1201 | while (popup_activated_flag) |
| 1205 | { | 1202 | { |
| 1206 | if (initial_event) | 1203 | if (initial_event) |
| 1207 | { | 1204 | { |
| 1208 | event = *initial_event; | 1205 | event = *initial_event; |
| 1209 | initial_event = 0; | 1206 | initial_event = 0; |
| @@ -1232,20 +1229,15 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) | |||
| 1232 | event.xbutton.state = 0; | 1229 | event.xbutton.state = 0; |
| 1233 | #endif | 1230 | #endif |
| 1234 | } | 1231 | } |
| 1235 | /* If the user presses a key that doesn't go to the menu, | 1232 | /* Pop down on C-g and Escape. */ |
| 1236 | deactivate the menu. | ||
| 1237 | The user is likely to do that if we get wedged. | ||
| 1238 | All toolkits now pop down menus on ESC. | ||
| 1239 | For dialogs however, the focus may not be on the dialog, so | ||
| 1240 | in that case, we pop down. */ | ||
| 1241 | else if (event.type == KeyPress | 1233 | else if (event.type == KeyPress |
| 1242 | && down_on_keypress | ||
| 1243 | && dpyinfo->display == event.xbutton.display) | 1234 | && dpyinfo->display == event.xbutton.display) |
| 1244 | { | 1235 | { |
| 1245 | KeySym keysym = XLookupKeysym (&event.xkey, 0); | 1236 | KeySym keysym = XLookupKeysym (&event.xkey, 0); |
| 1246 | if (!IsModifierKey (keysym) | 1237 | |
| 1247 | && x_any_window_to_frame (dpyinfo, event.xany.window) != NULL) | 1238 | if ((keysym == XK_g && (event.xkey.state & ControlMask) != 0) |
| 1248 | popup_activated_flag = 0; | 1239 | || keysym == XK_Escape) /* Any escape, ignore modifiers. */ |
| 1240 | popup_activated_flag = 0; | ||
| 1249 | } | 1241 | } |
| 1250 | 1242 | ||
| 1251 | x_dispatch_event (&event, event.xany.display); | 1243 | x_dispatch_event (&event, event.xany.display); |
| @@ -2226,6 +2218,9 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 2226 | } | 2218 | } |
| 2227 | else | 2219 | else |
| 2228 | { | 2220 | { |
| 2221 | char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()"; | ||
| 2222 | XtTranslations override = XtParseTranslationTable (menuOverride); | ||
| 2223 | |||
| 2229 | menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, | 2224 | menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, |
| 2230 | f->output_data.x->column_widget, | 2225 | f->output_data.x->column_widget, |
| 2231 | 0, | 2226 | 0, |
| @@ -2234,6 +2229,9 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 2234 | popup_deactivate_callback, | 2229 | popup_deactivate_callback, |
| 2235 | menu_highlight_callback); | 2230 | menu_highlight_callback); |
| 2236 | f->output_data.x->menubar_widget = menubar_widget; | 2231 | f->output_data.x->menubar_widget = menubar_widget; |
| 2232 | |||
| 2233 | /* Make menu pop down on C-g. */ | ||
| 2234 | XtOverrideTranslations (menubar_widget, override); | ||
| 2237 | } | 2235 | } |
| 2238 | 2236 | ||
| 2239 | { | 2237 | { |
| @@ -2597,7 +2595,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2597 | make_number (menu_id & ~(-1 << (fact))))); | 2595 | make_number (menu_id & ~(-1 << (fact))))); |
| 2598 | 2596 | ||
| 2599 | /* Process events that apply to the menu. */ | 2597 | /* Process events that apply to the menu. */ |
| 2600 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1, 0); | 2598 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1); |
| 2601 | 2599 | ||
| 2602 | unbind_to (specpdl_count, Qnil); | 2600 | unbind_to (specpdl_count, Qnil); |
| 2603 | } | 2601 | } |
| @@ -2975,7 +2973,7 @@ create_and_show_dialog (f, first_wv) | |||
| 2975 | make_number (dialog_id & ~(-1 << (fact))))); | 2973 | make_number (dialog_id & ~(-1 << (fact))))); |
| 2976 | 2974 | ||
| 2977 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), | 2975 | popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), |
| 2978 | dialog_id, 1, 1); | 2976 | dialog_id, 1); |
| 2979 | 2977 | ||
| 2980 | unbind_to (count, Qnil); | 2978 | unbind_to (count, Qnil); |
| 2981 | } | 2979 | } |
| @@ -3155,6 +3153,9 @@ xdialog_show (f, keymaps, title, error) | |||
| 3155 | } | 3153 | } |
| 3156 | } | 3154 | } |
| 3157 | } | 3155 | } |
| 3156 | else | ||
| 3157 | /* Make "Cancel" equivalent to C-g. */ | ||
| 3158 | Fsignal (Qquit, Qnil); | ||
| 3158 | 3159 | ||
| 3159 | return Qnil; | 3160 | return Qnil; |
| 3160 | } | 3161 | } |
| @@ -3500,7 +3501,13 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) | |||
| 3500 | case XM_FAILURE: | 3501 | case XM_FAILURE: |
| 3501 | *error = "Can't activate menu"; | 3502 | *error = "Can't activate menu"; |
| 3502 | case XM_IA_SELECT: | 3503 | case XM_IA_SELECT: |
| 3504 | entry = Qnil; | ||
| 3505 | break; | ||
| 3503 | case XM_NO_SELECT: | 3506 | case XM_NO_SELECT: |
| 3507 | /* Make "Cancel" equivalent to C-g unless this menu was popped up by | ||
| 3508 | a mouse press. */ | ||
| 3509 | if (! for_click) | ||
| 3510 | Fsignal (Qquit, Qnil); | ||
| 3504 | entry = Qnil; | 3511 | entry = Qnil; |
| 3505 | break; | 3512 | break; |
| 3506 | } | 3513 | } |