diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-10-14 17:36:28 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-10-14 17:36:28 +0000 |
commit | 12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a (patch) | |
tree | 1775f9fd1c92defd8b61304a08ec00da95bc4539 /src | |
parent | 3f87f67ee215ffeecbd2f53bd7f342cdf03f47df (diff) | |
parent | f763da8d0808af7c80d72bc586bf4fcf50b37ddd (diff) | |
download | emacs-12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a.tar.gz emacs-12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a.tar.bz2 emacs-12b6af5c7ed2cfdb9783312bf890cf1e6c80c67a.zip |
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-413
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-414
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-415
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-416
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-417
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-418
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-419
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-420
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-421
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-422
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-423
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-424
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-425
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-426
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-427
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-428
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-429
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-430
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-431
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-432
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-433
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-434
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-435
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-436
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-437
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-438
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-439
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-440
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-441
lisp/url/url-methods.el: Fix format error when http_proxy is empty string
* emacs@sv.gnu.org/emacs--devo--0--patch-442
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-443
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-444
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-445
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-446
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-447
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-448
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-449
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-450
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-451
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-452
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-453
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-454
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-455
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-456
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-457
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-458
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-459
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-460
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-461
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-462
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-463
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-464
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-465
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-466
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-467
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-468
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-469
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-470
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-471
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-472
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-473
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-128
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-129
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-130
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-131
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-132
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-133
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-134
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-135
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-136
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-137
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-138
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-139
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-140
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-141
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-142
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-143
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-144
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-145
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-146
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-147
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-148
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-149
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-582
Diffstat (limited to 'src')
-rw-r--r-- | src/COPYING | 25 | ||||
-rw-r--r-- | src/ChangeLog | 781 | ||||
-rw-r--r-- | src/Makefile.in | 49 | ||||
-rw-r--r-- | src/buffer.c | 29 | ||||
-rw-r--r-- | src/buffer.h | 10 | ||||
-rw-r--r-- | src/callint.c | 6 | ||||
-rw-r--r-- | src/casefiddle.c | 2 | ||||
-rw-r--r-- | src/casetab.c | 3 | ||||
-rw-r--r-- | src/charset.h | 22 | ||||
-rw-r--r-- | src/coding.c | 6 | ||||
-rw-r--r-- | src/dispextern.h | 5 | ||||
-rw-r--r-- | src/dispnew.c | 18 | ||||
-rw-r--r-- | src/editfns.c | 31 | ||||
-rw-r--r-- | src/emacs.c | 3 | ||||
-rw-r--r-- | src/eval.c | 15 | ||||
-rw-r--r-- | src/fns.c | 49 | ||||
-rw-r--r-- | src/frame.c | 14 | ||||
-rw-r--r-- | src/gmalloc.c | 64 | ||||
-rw-r--r-- | src/gtkutil.c | 126 | ||||
-rw-r--r-- | src/image.c | 2 | ||||
-rw-r--r-- | src/indent.c | 37 | ||||
-rw-r--r-- | src/insdel.c | 19 | ||||
-rw-r--r-- | src/keyboard.c | 54 | ||||
-rw-r--r-- | src/keymap.c | 204 | ||||
-rw-r--r-- | src/keymap.h | 4 | ||||
-rw-r--r-- | src/lisp.h | 5 | ||||
-rw-r--r-- | src/m/ibms390x.h | 6 | ||||
-rw-r--r-- | src/mac.c | 463 | ||||
-rw-r--r-- | src/macfns.c | 3 | ||||
-rw-r--r-- | src/macmenu.c | 72 | ||||
-rw-r--r-- | src/macterm.c | 497 | ||||
-rw-r--r-- | src/macterm.h | 10 | ||||
-rw-r--r-- | src/makefile.w32-in | 4 | ||||
-rw-r--r-- | src/marker.c | 3 | ||||
-rw-r--r-- | src/md5.c | 8 | ||||
-rw-r--r-- | src/md5.h | 8 | ||||
-rw-r--r-- | src/minibuf.c | 36 | ||||
-rw-r--r-- | src/msdos.c | 2 | ||||
-rw-r--r-- | src/print.c | 54 | ||||
-rw-r--r-- | src/process.c | 28 | ||||
-rw-r--r-- | src/process.h | 4 | ||||
-rw-r--r-- | src/regex.c | 63 | ||||
-rw-r--r-- | src/regex.h | 12 | ||||
-rw-r--r-- | src/s/gnu-linux.h | 6 | ||||
-rw-r--r-- | src/search.c | 50 | ||||
-rw-r--r-- | src/strftime.c | 8 | ||||
-rw-r--r-- | src/syntax.c | 5 | ||||
-rw-r--r-- | src/textprop.c | 79 | ||||
-rw-r--r-- | src/w32.c | 24 | ||||
-rw-r--r-- | src/w32fns.c | 68 | ||||
-rw-r--r-- | src/w32menu.c | 9 | ||||
-rw-r--r-- | src/w32proc.c | 68 | ||||
-rw-r--r-- | src/w32term.c | 2 | ||||
-rw-r--r-- | src/window.c | 247 | ||||
-rw-r--r-- | src/xdisp.c | 199 | ||||
-rw-r--r-- | src/xfns.c | 20 | ||||
-rw-r--r-- | src/xmenu.c | 29 | ||||
-rw-r--r-- | src/xterm.c | 78 | ||||
-rw-r--r-- | src/xterm.h | 1 |
59 files changed, 2785 insertions, 964 deletions
diff --git a/src/COPYING b/src/COPYING index 3912109b5cd..d511905c164 100644 --- a/src/COPYING +++ b/src/COPYING @@ -1,8 +1,8 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/src/ChangeLog b/src/ChangeLog index c7a065c091e..f86c4c6a21c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,672 @@ +2006-10-13 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (decode_mode_spec): Ignore %c and %l constructs in frame + title. + +2006-10-12 Chong Yidong <cyd@stupidchicken.com> + + * keymap.c (Fkey_binding): Check Lisp_Object types before doing + XCAR and XINT. + +2006-10-12 Romain Francoise <romain@orebokech.com> + + * image.c (xbm_read_bitmap_data): Delete extra semicolon. + +2006-10-10 Stefan Monnier <monnier@iro.umontreal.ca> + + * eval.c: Include xterm.h for x_fully_uncatch_errors and friends. + + * dispextern.h: Declare x_create_bitmap_from_xpm_data. + + * xterm.c (x_check_expected_move): Remove unused var `count'. + + * xmenu.c (syms_of_xmenu): Use Ffset rather than Fdefalias, since + Fdefalias is not declared in any *.h file. + +2006-10-09 Chong Yidong <cyd@stupidchicken.com> + + * dispnew.c (sit_for): Sit forever if TIMEOUT is t. + + * keyboard.c (command_loop_1): Handle non-number values of + `minibuffer-message-timeout'. + (Fexecute_extended_command): Fix typo. + + * minibuf.c (temp_echo_area_glyphs): Sit for + `minibuffer-message-timeout' seconds. + +2006-10-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c (mac_draw_image_string, mac_draw_image_string_16): + Add argument OVERSTRIKE_P. + (mac_draw_string_common, mac_draw_image_string_cg): Likewise. + Support overstrike. + (mac_draw_string, mac_draw_string_16): Remove functions. + (x_draw_glyph_string_foreground): Use overstrike when needed. + (x_draw_composite_glyph_string_foreground): Likewise. + Use mac_draw_image_string_16 instead of mac_draw_string_16. + (mac_load_query_font): Rename from XLoadQueryFont. Take argument F + instead of DPY. All uses changed. Don't save/restore font. + +2006-10-07 Ralf Angeli <angeli@caeruleus.net> + + * w32fns.c (w32_createwindow): Honour left and top positions if + supplied explicitly. + +2006-10-06 Kim F. Storm <storm@cua.dk> + + * xdisp.c (pos_visible_p): Fix value when EOB is visible. + +2006-10-05 Chong Yidong <cyd@stupidchicken.com> + + * frame.c (Qinhibit_face_set_after_frame_default): New var. + (syms_of_frame): Initialize it. + (x_set_frame_parameters): Avoid resetting :font attributes to the + new-frame defaults. + +2006-10-03 Stefan Monnier <monnier@iro.umontreal.ca> + + * lisp.h (clear_regexp_cache): Declare. + + * search.c (compile_pattern): Only check `cp->syntax_table' if needed. + (compile_pattern_1): Remember `used_syntax' in `cp->syntax_table'. + (clear_regexp_cache): Only flush those regexps which depend on + a syntax-table. + + * regex.c (regex_compile): Set the new `used_syntax' bit. + + * regex.h: Remove file local variables. + (struct re_pattern_buffer): New field `used_syntax'. + +2006-10-03 Kim F. Storm <storm@cua.dk> + + * process.c (list_processes_1): Run sentinels before removing dead + processes. Also remove `closed' network connections. + +2006-10-01 Stefan Monnier <monnier@iro.umontreal.ca> + + * xdisp.c (handle_fontified_prop): Don't fontify at EOB. + +2006-09-30 Eli Zaretskii <eliz@gnu.org> + + * config.in Regenerated. + +2006-09-29 Juri Linkov <juri@jurta.org> + + * buffer.c (syms_of_buffer): Reorder coding systems in the + docstring of %z to the real order displayed in the modeline. + +2006-09-28 Stefan Monnier <monnier@iro.umontreal.ca> + + * keymap.c (Fdefine_key): Yet another int/Lisp_Object mixup (YAILOM). + +2006-09-26 Chong Yidong <cyd@stupidchicken.com> + + * indent.c (Fvertical_motion): Do move back if the Lisp string + being displayed contains newlines. + +2006-09-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c (mac_compute_glyph_string_overhangs, XLoadQueryFont) + [USE_CG_DRAWING]: Call mac_prepare_for_quickdraw before QDTextBounds. + +2006-09-26 Kenichi Handa <handa@m17n.org> + + * keymap.c (Fsingle_key_description): For an invalid char, return + "Invalid char code NNNNN". + +2006-09-25 Chong Yidong <cyd@stupidchicken.com> + + * callint.c (Fcall_interactively): Doc fix. + +2006-09-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c (x_underline_at_descent_line): New variable. + (syms_of_macterm): DEFVAR_BOOL it. + (x_draw_glyph_string): Use it. + (XLoadQueryFont): Calculate min_bounds.descent and max_bounds.descent. + +2006-09-25 Kenichi Handa <handa@m17n.org> + + * keymap.c (Fsingle_key_description): Return unique names for + generic characters. + +2006-09-24 Richard Stallman <rms@gnu.org> + + * search.c (compile_pattern_1): Don't BLOCK_INPUT. + +2006-09-24 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in ($(BLD)/fns.$(O), $(BLD)/w32proc.$(O)): + Depend on nt/inc/langinfo.h and nt/inc/nl_types.h. + + * w32proc.c (nl_langinfo): New function. + + * w32fns.c (w32-pass-alt-to-system, w32-alt-is-meta) + (w32-pass-lwindow-to-system, w32-enable-num-lock) + (w32-enable-caps-lock, w32-scroll-lock-modifier) + (w32-lwindow-modifier, w32-rwindow-modifier) + (w32-apps-modifier, w32-mouse-button-tolerance): Doc fix. + +2006-09-23 Juanma Barranquero <lekktu@gmail.com> + + * minibuf.c (Finternal_complete_buffer, Fread_minibuffer) + (Fdisplay_completion_list): Fix typos in docstrings. + +2006-09-23 Romain Francoise <romain@orebokech.com> + + * s/gnu-linux.h (MAIL_USE_FLOCK): Check for HAVE_LIBLOCKFILE too. + +2006-09-23 Kenichi Handa <handa@m17n.org> + + * keymap.c (Fmap_keymap): Docstring mentions about generic character. + +2006-09-22 Stefan Monnier <monnier@iro.umontreal.ca> + + * regex.c (analyse_first): For eight-bit-control chars, mark both the + char's value and its leading byte in the fastmap. + (re_search_2): When fast-scanning without translation, be careful to + check that we only match the leading byte of a multibyte char. + + * charset.h (PREV_CHAR_BOUNDARY): Make it work from within a char's + byte sequence. + (AT_CHAR_BOUNDARY): New macro. + +2006-09-22 Kenichi Handa <handa@m17n.org> + + * fns.c (optimize_sub_char_table): Don't optimize a sub-char-table + whose default value is non-nil. + +2006-09-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_get_file_with_chooser): Only show C-l help for + Gtk+ versions < 2.10. + + * xfns.c (syms_of_xfns): Fix typo in help text for + x-gtk-file-dialog-help-text. + +2006-09-21 Kim F. Storm <storm@cua.dk> + + * fns.c (Fmemq): Refill doc string. + (Fmemql): New defun, like memq but using eql. + (syms_of_fns): Defsubr it. + +2006-09-20 Kim F. Storm <storm@cua.dk> + + * xdisp.c (pos_visible_p): CHARPOS < 0 means return info for + last visible glyph in window. + + * window.c (Fset_window_hscroll, Fwindow_line_height): + Doc fix. Use "off-window" instead of "off-screen". + (Fpos_visible_in_window_p): Likewise. + If POS is t, return info for last visible glyph in window. + +2006-09-19 Chong Yidong <cyd@stupidchicken.com> + + * search.c (struct regexp_cache): New entry syntax_table. + (compile_pattern_1): Set it. + (syms_of_search): Initialize it. + (compile_pattern): Require the syntax_table entry of the cache + element to match the current syntax table entry. + +2006-09-19 Stefan Monnier <monnier@iro.umontreal.ca> + + * window.c (Fwindow_end): Fix recent change. + +2006-09-19 Kim F. Storm <storm@cua.dk> + + * window.c (Fset_window_hscroll, Fpos_visible_in_window_p): + Doc fix. Use "off-screen" instead of "invisible". + (Fwindow_line_height): Make line numbers 0-based. Make line arg + optional; if nil, use current cursor row. Handle text terminals + properly. Return nil if non-interactive or pseudo-window. + +2006-09-19 Stefan Monnier <monnier@iro.umontreal.ca> + + * keymap.c: Include alloca.h if available. + (Fkey_binding): Only use AREF after checking it's a vector. + Remove unused var `window'. + +2006-09-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * emacs.c (shut_down_emacs) [!subprocesses]: Don't set + inhibit_sentinels. + + * mac.c [!MAC_OSX] (select): Fix argument name. + + * macmenu.c (enum mac_menu_kind, min_menu_id): New enumerator and + menu ID for Apple menu. + (menubar_selection_callback): Remove function. + (find_and_call_menu_selection): New function from xmenu.c. + (x_activate_menubar): Use it. + (set_frame_menubar): Don't use f->output_data.mac->menubar_active. + + * macterm.c (menubar_selection_callback): Remove extern. + (M_APPLE): Change to 234. + (do_apple_menu) [!TARGET_API_MAC_CARBON]: Make non-static. + (do_menu_choice): Remove function. + + * macterm.h (struct mac_output): Remove member menubar_active. + (do_menu_choice): Remove extern. + (do_apple_menu) [!TARGET_API_MAC_CARBON]: Add extern. + +2006-09-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * xfns.c (syms_of_xfns): Rename x_gtk_show_chooser_help_text to + x_gtk_file_dialog_help_text. + + * gtkutil.c (xg_uses_old_file_dialog): Rename x-use-old-gtk-file-dialog + to x-gtk-use-old-file-dialog. + (xg_get_file_with_chooser): Rename x_gtk_show_chooser_help_text to + x_gtk_file_dialog_help_text. + + * xfns.c (syms_of_xfns): Ditto. + +2006-09-18 Kim F. Storm <storm@cua.dk> + + * window.c (Fwindow_line_visibility): Remove. + (Fwindow_line_height): New defun replacing it. + (syms_of_window): Defsubr it. + +2006-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c (SELECT_USE_CFSOCKET) [MAC_OSX]: Set default to 1. + [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Fix pointer type. + +2006-09-17 Jay Belanger <belanger@truman.edu> + + * gmalloc.c: + * md5.c: + * md5.h: + * strftime.c: Replace "GNU Library General Public License" by "GNU + General Public License" throughout. + +2006-09-17 Kim F. Storm <storm@cua.dk> + + * dispnew.c (update_text_area): Undo 2000-07-18 change. + Always redrawing whole row if line has mouse-face in it causes + excessive flickering of the mode line. + +2006-09-17 Chong Yidong <cyd@stupidchicken.com> + + * search.c (clear_regexp_cache): New function. + + * syntax.c (Fmodify_syntax_entry): Clear regexp cache. + +2006-09-16 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_get_file_with_chooser): + Check x-gtk-show-chooser-help-text before adding the help text. + + * xfns.c (syms_of_xfns): New variable: x-gtk-show-chooser-help-text. + + * gtkutil.c (get_utf8_string): Try harder to convert to UTF8. Gtk+ + will simply crash if we fail. + +2006-09-16 Richard Stallman <rms@gnu.org> + + * regex.c (re_compile_pattern): Set gl_state.current_syntax_table. + +2006-09-15 Kim F. Storm <storm@cua.dk> + + * window.c (Fwindow_line_visibility): New defun for line-move-partial. + (syms_of_window): Defsubr it. + (Fwindow_end): Use window's buffer rather than current buffer. + +2006-09-15 Jay Belanger <belanger@truman.edu> + + * COPYING: Replace "Library Public License" by "Lesser Public + License" throughout. + +2006-09-15 David Kastrup <dak@gnu.org> + + * Makefile.in (keymap.o): Add "keymap.h" and "window.h" dependencies. + + * keymap.c: include "window.h". + (Fcommand_remapping): New optional POSITION argument. + (Fkey_binding): New optional POSITION argument. Completely rework + handling of mouse clicks to get the same order of keymaps as + `read-key-sequence' and heed POSITION. Also temporarily switch + buffers to location of mouse click and back. + + * keyboard.c (command_loop_1): Adjust call of `Fcommand_remapping' + for additional argument. + (parse_menu_item): Adjust call of `Fkey_binding' for additional + argument. + (read_key_sequence): If there are both `local-map' and `keymap' + text properties at some buffer position, heed both. + + * keymap.h: Declare additional optional arguments of + `Fcommand_remapping' and `Fkey_binding'. + +2006-09-15 Juanma Barranquero <lekktu@gmail.com> + + * indent.c (Fcurrent_column, Findent_to): Fix typos in docstring. + +2006-09-14 Andreas Schwab <schwab@suse.de> + + * print.c: Whitespace fixup. + +2006-09-14 Kim F. Storm <storm@cua.dk> + + * xdisp.c (produce_image_glyph): Automatically crop wide images at + right window edge so we can draw the cursor on the same row to + avoid confusing redisplay by placing the cursor outside the visible + window area. + +2006-09-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * xterm.c (x_initialize): Don't install Xt event timer here. + (x_timeout_atimer_activated_flag): New var. + (x_activate_timeout_atimer): New function to install Xt timer. + (x_send_scroll_bar_event, x_process_timeouts): Use it. + + * xmenu.c (x_menu_set_in_use, popup_activate_callback) + (create_and_show_popup_menu, create_and_show_dialog): Use it. + + * xterm.h (x_activate_timeout_atimer): Add prototype. + +2006-09-13 Richard Stallman <rms@gnu.org> + + * print.c (print_string): When printcharfun is t, + copy string contents and call strout on the copy. + + * keyboard.c (read_char): If end_time specified, don't put the + event into this_command_keys. + (read_key_sequence): If Voverriding_terminal_local_map is specified, + don't check Voverriding_local_map at all. + +2006-09-12 Stefan Monnier <monnier@iro.umontreal.ca> + + * textprop.c (Fnext_property_change, Fnext_single_property_change) + (Fprevious_property_change, Fprevious_single_property_change): + Avoid changing limit, so we can correctly catch the case where the + property is constant up to limit. + +2006-09-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: + * macterm.c (XTread_socket) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: + Undo 2006-09-08 change. + +2006-09-11 Chong Yidong <cyd@stupidchicken.com> + + * keymap.c (Fkey_binding): Use string position for string objects. + +2006-09-11 Kim F. Storm <storm@cua.dk> + + * keymap.c (Fkey_binding): Fix last change. + + * editfns.c (Fmessage): Recommend using (message "%s" ...). + +2006-09-10 Chong Yidong <cyd@stupidchicken.com> + + * keymap.c (Fkey_binding): Check for local keymap for mouse click + events. + +2006-09-10 Kim F. Storm <storm@cua.dk> + + * keyboard.c (Finput_pending_p): Check Vunread_input_method_events + and Vunread_post_input_method_events. + + * dispnew.c (Fredisplay): Document return value. + +2006-09-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * xfns.c (Fx_close_connection): Call xg_display_close when USE_GTK. + + * gtkutil.c (xg_display_close): Always change default display if needed, + check for < Gtk+ version 2.10 before calling gdk_display_close. + +2006-09-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c [MAC_OSX] (sys_select): Check argument `nfds' more rigidly. + Make variable `ofds' static. Remove variable `maxfd'. + + * macfns.c (Fx_file_dialog): Remove unused variable `f'. + Call check_mac. + + * macmenu.c (Vmenu_updating_frame, syms_of_macmenu): + * w32menu.c (Vmenu_updating_frame, syms_of_w32menu): + Apply 2006-09-08 change for xmenu.c. + + * xfns.c (Fx_file_dialog): Call check_x. + +2006-09-10 Kim F. Storm <storm@cua.dk> + + * xdisp.c (get_window_cursor_type): Use hollow cursor on + non-transparent images. + +2006-09-09 Eli Zaretskii <eliz@gnu.org> + + * editfns.c (Fsystem_name): Mention "host" in the doc string. + (syms_of_editfns) <system-name>: Likewise. + +2006-08-27 Martin Rudalics <rudalics@gmx.at> + + * xdisp.c (mouse_autoselect_window): Remove. + (Vmouse_autoselect_window): New variable. DEFVAR_LISP it. + + * dispextern.h (mouse_autoselect_window): Remove extern. + (Vmouse_autoselect_window): Add extern. + + * macterm.c (XTread_socket): Test Vmouse_autoselect_window + instead of mouse_autoselect_window. + + * msdos.c (dos_rawgetc): Likewise. + + * w32term.c (w32_read_socket): Likewise. + + * xterm.c (handle_one_xevent): Likewise. + +2006-09-08 Richard Stallman <rms@gnu.org> + + * xdisp.c (Vmenu_updating_frame): Define here. + (syms_of_xdisp): DEFVAR it here. + (update_menu_bar): Always return hooks_run. + Set Vmenu_updating_frame. + + * xdisp.c (redisplay_internal): Test Vinhibit_redisplay + before calculating SELECTED_FRAME. + + * xmenu.c (Vmenu_updating_frame): Don't define here. + (syms_of_xmenu): Don't DEFVAR it here. + + * xterm.c (x_error_quitter): For BadName error, just return. + + * eval.c (find_handler_clause): Give up on debugger if INPUT_BLOCKED_P. + + * casetab.c (init_casetab_once): Call set_case_table. + + * emacs.c (shut_down_emacs): Set inhibit_sentinels. + + * process.c (inhibit_sentinels): New variable. + (exec_sentinel): Test inhibit_sentinels. + (init_process): Initialize it. + + * process.h (inhibit_sentinels): Add decl. + + * search.c (looking_at_1, string_match_1, search_command): + Make syntax table's canon table point to eqv table. + +2006-09-08 Andreas Schwab <schwab@suse.de> + + * print.c (strout): Fix whitespace. + +2006-09-08 Kim F. Storm <storm@cua.dk> + + * xterm.c (x_draw_glyph_string): Fix 2006-08-24 change. + +2006-09-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c [!MAC_OSX]: Don't include keyboard.h. + [!MAC_OSX] (select): Try detect_input_pending before ReceiveNextEvent + in the same BLOCK_INPUT block, in case that some input has already + been read asynchronously. Pretend to be interrupted by a signal + if some input is available. + [MAC_OSX] (select_and_poll_event, sys_select): Likewise. + (SELECT_POLLING_PERIOD_USEC) [SELECT_USE_CFSOCKET]: Change to 100000. + Now used for ReceiveNextEvent timeout instead of select timeout. + (EVENT_CLASS_SOCK) [SELECT_USE_CFSOCKET]: Remove macro. + [SELECT_USE_CFSOCKET] (socket_callback): Add non-blocking connect + support. Quit event loop. + [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Add non-blocking + connect support. Reuse previously allocated CFRunLoopSource. + (Fmac_process_hi_command) [TARGET_API_MAC_CARBON]: New function. + (syms_of_mac) [TARGET_API_MAC_CARBON]: Defsubr it. + + * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: + Specify kWindowAsyncDragAttribute. + + * macterm.c (mac_handle_origin_change, mac_handle_size_change) + (mac_get_ideal_size): New functions. + (x_set_offset, x_set_window_size, x_make_frame_visible) + (do_zoom_window, mac_handle_window_event, XTread_socket): Use them. + (install_window_handler, mac_handle_window_event) + [USE_CARBON_EVENTS]: Handle kEventWindowGetIdealSize and + kEventWindowBoundsChanged. + (XTread_socket) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Don't call + DragWindow. + +2006-09-07 Andreas Schwab <schwab@suse.de> + + * m/ibms390x.h (START_FILES, LIB_STANDARD): Override to + use lib64 instead of lib. + +2006-09-06 Stefan Monnier <monnier@iro.umontreal.ca> + + * Makefile.in: Avoid double quotes when possible. + +2006-09-06 Kenichi Handa <handa@m17n.org> + + * editfns.c (Fformat_time_string): Use make_unibyte_string to make + a Lisp string from the result of emacs_memftimeu call. + +2006-09-06 Kim F. Storm <storm@cua.dk> + + * xdisp.c (pos_visible_p): Remove exact_mode_line_heights_p arg; + so calculate heights even when pos-visible-in-window-p is called + with partially = t. Don't overshoot last_visible_y in move_it_to. + Return row height and row number in new rowh and vpos args. + (cursor_row_fully_visible_p): First line is always "fully visible". + (try_window): Don't clear matrix if vscrolled. + + * lisp.h (pos_visible_p): Update prototype. + + * window.c (Fpos_visible_in_window_p): Adapt to new pos_visible_p. + Return row height and row number for partially visible rows. + Modify return value to a 2 element list for fully visible rows and + 6 for partially visible row. + (window_scroll_pixel_based): Use pos_visible_p directly instead of + Fpos_visible_in_window_p. Fix auto vscrolling for partially + visible lines. Only vscroll backwards if already vscrolled + forwards. Unconditionally vscroll forwards if PT is first (and + only) line. Set new window start instead of scrolling at + start/end of tall line. + +2006-09-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c (install_window_handler, mac_handle_window_event) + [USE_CARBON_EVENTS]: Handle kEventWindowClose. + [USE_MAC_TSM] (mac_handle_text_input_event): Set modifiers for + ASCII keystroke event. + +2006-09-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_get_file_with_chooser): Don't mention specific keys in + the file chooser message. Only call gtk_file_chooser_set_current_name + when action is SAVE. + +2006-09-04 Andreas Schwab <schwab@suse.de> + + * Makefile.in: Double all single and back quotes in C-style + comments to help fontifier. + +2006-09-03 Jason Rumney <jasonr@gnu.org> + + * w32.c (shutdown_handler): New function to exit cleanly on shutdown. + (globals_of_w32): Register it as a signal handler. + +2006-09-02 Juri Linkov <juri@jurta.org> + + * marker.c (Fmarker_position): Doc fix. + +2006-09-03 Eli Zaretskii <eliz@gnu.org> + + * window.c (syms_of_window) <split-height-threshold>: + <window-min-height, window-min-width>: Doc fix. + +2006-09-02 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_get_file_with_chooser): Change file chooser message + for writing files. Call gtk_file_chooser_set_current_name to keep + default filename. + + * minibuf.c (Finternal_complete_buffer): Move after DEFUN:s it calls + +2006-09-02 Jindrich Makovicka <makovick@gmail.com> (tiny change) + + * fns.c (concat) [__GNUC__]: Declare with + `__attribute__((noinline))'. + + * eval.c (apply1, call2) [__GNUC__]: Declare with + `__attribute__((noinline))'. + +2006-09-02 Stuart D. Herring <herring@lanl.gov> + + * minibuf.c (Finternal_complete_buffer): New function. + (syms_of_minibuf): Defsubr it. + (Fread_buffer): Use it, instead of Vbuffer_alist. + +2006-09-01 Martin Rudalics <rudalics@gmx.at> + + * buffer.h (struct buffer_text): New field chars_modiff. + (CHARS_MODIFF, BUF_CHARS_MODIFF): New macros. + * buffer.c (Fbuffer_chars_modified_tick): New function returning + value of BUF_CHARS_MODIFF. + (syms_of_buffer): Defsubr it. + (Fget_buffer_create): Initialize BUF_CHARS_MODIFF. + * insdel.c (modify_region): New argument preserve_chars_modiff. + Set CHARS_MODIFF to MODIFF provided preserve_chars_modiff is zero. + (insert_1_both, insert_from_string_1, insert_from_buffer_1) + (adjust_after_replace, adjust_after_replace_noundo) + (replace_range, replace_range_2, del_range_2): Reset CHARS_MODIFF. + * lisp.h (modify_region): Add fourth argument in extern. + * casefiddle.c (casify_region): Call modify_region with fourth + argument zero to assert that CHARS_MODIFF is updated. + * editfns.c (Fsubst_char_in_region, Ftranslate_region_internal) + (Ftranspose_regions): Likewise. + * textprop.c (Fadd_text_properties, Fset_text_properties) + (Fremove_text_properties, Fremove_list_of_text_properties): + Call modify_region with fourth argument 1 to avoid that + CHARS_MODIFF is updated. + +2006-08-31 Richard Stallman <rms@gnu.org> + + * editfns.c (Fformat): Don't sign-extend for %o or %x. + +2006-08-29 Chong Yidong <cyd@stupidchicken.com> + + * indent.c (Fvertical_motion): Don't move back if we were + displaying a Lisp string, either. + +2006-08-28 Kim F. Storm <storm@cua.dk> + + * xdisp.c (get_window_cursor_type) [!HAVE_WINDOW_SYSTEM]: + Don't attempt to replace cursor on image glyphs. + +2006-08-28 Kenichi Handa <handa@m17n.org> + + * coding.c (Fdetect_coding_region, Fdetect_coding_string): Fix + docstring about ISO-2022 control characters. + +2006-08-28 Kim F. Storm <storm@cua.dk> + + * xdisp.c (get_window_cursor_type): Replace BOX cursor on images + with a hollow box cursor if image is larger than 32x32 (or the default + frame font if that is bigger). Replace any other cursor on images + with hollow box cursor, as redisplay doesn't support bar and hbar + cursors on images. + 2006-08-27 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * alloc.c (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Undo previous @@ -18,11 +687,11 @@ * mac.c (create_apple_event_from_event_ref, select) (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator) (Fmac_set_file_type, cfstring_create_normalized) - (mac_get_system_locale, select_and_poll_event, sys_select): Use - OSStatus instead of OSErr. + (mac_get_system_locale, select_and_poll_event, sys_select): + Use OSStatus instead of OSErr. - * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): Don't - use FRAME_FILE_NAME. Use (FS)UpdateAlias. + * macfns.c [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): + Don't use FRAME_FILE_NAME. Use (FS)UpdateAlias. (Fx_create_frame): Apply 2006-07-03 for xfns.c. * macselect.c (get_scrap_from_symbol, clear_scrap, put_scrap_string) @@ -60,6 +729,10 @@ (Frename_file, Fadd_name_to_file, Fmake_symbolic_link): Simplify; remove NO_ARG_ARRAY stuff, use list2. +2006-08-25 Richard Stallman <rms@gnu.org> + + * buffer.c (Fswitch_to_buffer): Fix previous change. + 2006-08-25 Kim F. Storm <storm@cua.dk> * keyboard.c (Fcurrent_idle_time): Simplify. @@ -187,7 +860,6 @@ * xterm.c (x_term_init): Initialize dpyinfo->x_dnd_atoms* - 2006-08-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> * keyboard.c: Define in_sighandler. @@ -381,7 +1053,7 @@ (FletX, Flet, grow_specpdl): Use signal_error. (Feval, Ffuncall, funcall_lambda): Use xsignal1, xsignal2. - * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop. + * alloc.c (buffer_memory_full, memory_full): Use xsignal. Remove loop. (list1): New function. * lisp.h (list1): Add EXFUN. @@ -888,7 +1560,7 @@ (x_set_offset, x_check_fullscreen): Extensive changes to make frame positioning deterministic under X. - * xterm.h (x_output): Added members left_before_move and + * xterm.h (x_output): Add members left_before_move and top_before_move. Removed members expected_left and expected_top. 2006-06-16 Kim F. Storm <storm@cua.dk> @@ -1423,13 +2095,13 @@ 2006-05-18 Kim F. Storm <storm@cua.dk> - * xdisp.c (display_tool_bar_line): Restore entire tool-bar geometry when - backtracking in case last image doesn't fit on line. + * xdisp.c (display_tool_bar_line): Restore entire tool-bar + geometry when backtracking in case last image doesn't fit on line. 2006-05-18 MIYOSHI Masanori <miyoshi@meadowy.org> (tiny change) - * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by more than - height of one frame default line. + * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by + more than height of one frame default line. 2006-05-17 Richard Stallman <rms@gnu.org> @@ -2229,10 +2901,11 @@ * term.c: Define aliases for append_glyph and produce_stretch_glyph when `static' is defined to avoid name clash with those in xdisp.c. - * process.c (Faccept_process_output): Fix to comply with lisp reference. - Change arg "timeout" to "seconds" and allow both integer and float value. - Change arg "timeout-msec" to "millisec" and interpret" as milliseconds - rather than microseconds. Fix doc string accordingly. + * process.c (Faccept_process_output): Fix to comply with lisp + reference. Change arg "timeout" to "seconds" and allow both + integer and float value. Change arg "timeout-msec" to "millisec" + and interpret" as milliseconds rather than microseconds. Fix doc + string accordingly. 2006-03-21 Ken Raeburn <raeburn@raeburn.org> @@ -4442,7 +5115,8 @@ * xdisp.c (pos_visible_p): Convert w->hscroll to pixels before use. (remember_mouse_glyph): Clear RECT if mouse is over an image glyph. - * keyboard.c (make_lispy_position): Adjust wx for left margin if ON_TEXT. + * keyboard.c (make_lispy_position): Adjust wx for left margin if + ON_TEXT. (Fposn_at_x_y): Fix calculation of x coordinate. (Fposn_at_point): Return nil if point is hscrolled out of view. @@ -9936,7 +10610,6 @@ * xterm.c (xim_destroy_callback): Ditto. - 2004-10-20 B. Anyos <banyos@freemail.hu> (tiny change) * w32term.c (x_draw_glyph_string): Use overline_color for overlines. @@ -10940,7 +11613,8 @@ * search.c (match_limit, Fmatch_data, Fset_match_data): YAILOM. - * fontset.c (Fset_fontset_font): Remove unused vars `family' and `registry'. + * fontset.c (Fset_fontset_font): Remove unused vars `family' and + `registry'. * Makefile.in (${etc}DOC): Fix file name of make-docfile. @@ -13914,11 +14588,11 @@ pointer types. (Qrelative_width, Qalign_to): Remove unused variables. (Vvoid_text_area_pointer): Replace Vshow_text_cursor_in_void. - (QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for - image maps. - (x_y_to_hpos_vpos): Return glyph relative coordinates through - new dx and dy args. - Remove buffer_only_p arg (always 0). Simplify code accordingly. + (QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for image + maps. + (x_y_to_hpos_vpos): Return glyph relative coordinates through new + dx and dy args. Remove buffer_only_p arg (always 0). Simplify + code accordingly. (get_glyph_string_clip_rect): Draw cursor using glyph's rather than row's ascent and height, to get sensible height on tall rows. (build_desired_tool_bar_string): Remove Qimage extern. @@ -13931,14 +14605,16 @@ rectangular, circular, or polygon-shaped image hot-spot, (find_hot_spot): New function to search for image hot-spot. (Flookup_image_map): New defun to search for image hot-spot. - (define_frame_cursor1): New aux function to determine frame pointer. - (note_mode_line_or_margin_highlight, note_mouse_highlight): - Handle `pointer' text property and :pointer image property to - control frame pointer shape. Detect image hot-spots for pointer - and help_echo properties. Use define_frame_cursor1. - (note_mouse_highlight): Use Vvoid_text_area_pointer. - (syms_of_xdisp): Defsubr new defun. Intern and staticpro new variables. - DEFVAR_LISP Vvoid_text_area_pointer instead of Vshow_text_cursor_in_void. + (define_frame_cursor1): New aux function to determine frame + pointer. + (note_mode_line_or_margin_highlight, note_mouse_highlight): Handle + `pointer' text property and :pointer image property to control + frame pointer shape. Detect image hot-spots for pointer and + help_echo properties. Use define_frame_cursor1. + (note_mouse_highlight): Use Vvoid_text_area_pointer. + (syms_of_xdisp): Defsubr new defun. Intern and staticpro new + variables. DEFVAR_LISP Vvoid_text_area_pointer instead of + Vshow_text_cursor_in_void. * xfaces.c (cache_face): Abort if c->size exceeds MAX_FACE_ID. @@ -14422,8 +15098,8 @@ * alloc.c (lisp_align_malloc): If BASE is 0, call memory_full. * window.c (Fset_window_margins): Allow only integers as args. - (syms_of_window) <special-display-buffer-names, special-display-regexps>: - Doc fixes. + (syms_of_window) <special-display-buffer-names, + special-display-regexps>: Doc fixes. 2003-10-13 Lute Kamstra <lute@gnu.org> @@ -18423,6 +19099,14 @@ * Makefile.in (fns.o): Depend on coding.h. +2003-01-06 Dave Love <fx@gnu.org> + + * fns.c: Include coding.h. Use POINTER_TYPE*, not void*. + (Vlocale_coding_system): Declare. + (Qcodeset, Qdays, Qmonths, Qpaper): New. + (Flanginfo): New. + (syms_of_fns): Initialize new stuff. + 2003-01-07 Markus Rost <rost@math.ohio-state.edu> * minibuf.c (Fread_variable): Doc fix. @@ -22226,15 +22910,15 @@ * process.c (Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily) (QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery, QCstop) - (QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature): - New variables. + (QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature): New + variables. (NETCONN1_P): New macro. (DATAGRAM_SOCKETS): New conditional symbol. (datagram_address): New array. (DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros. (status_message): Use concat3. - (Fprocess_status): Add `listen' status to doc string. Return `stop' - for a stopped network process. + (Fprocess_status): Add `listen' status to doc string. Return + `stop' for a stopped network process. (Fset_process_buffer): Update contact plist for network process. (Fset_process_filter): Ditto. Don't enable input for stopped network processes. Server must listen, even if filter is t. @@ -22244,26 +22928,29 @@ (Fprocess_contact): Added KEY argument. Handle datagrams. (list_processes_1): Optionally show only processes with the query on exit flag set. Dynamically adjust column widths. Omit tty - column if not needed. Report stopped network processes. - Identify server and datagram network processes. + column if not needed. Report stopped network processes. Identify + server and datagram network processes. (Flist_processes): New optional arg `query-only'. (conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size) (conv_lisp_to_sockaddr, set_socket_options) - (network_process_featurep, unwind_request_sigio): New helper functions. + (network_process_featurep, unwind_request_sigio): New helper + functions. (Fprocess_datagram_address, Fset_process_datagram_address): (Fset_network_process_options): New lisp functions. (Fopen_network_stream): Removed. Now defined in simple.el. - (Fmake_network_process): New lisp function. Code is based on previous - Fopen_network_stream, but heavily reworked with new property list based - argument list, support for datagrams, server processes, and local - sockets in addition to old client-only functionality. + (Fmake_network_process): New lisp function. Code is based on + previous Fopen_network_stream, but heavily reworked with new + property list based argument list, support for datagrams, server + processes, and local sockets in addition to old client-only + functionality. (server_accept_connection): New function. (wait_reading_process_input): Use it to handle incoming connects. Do not enable input on a new connection if process is stopped. - (read_process_output): Handle datagram sockets. Use 2k buffer for them. + (read_process_output): Handle datagram sockets. Use 2k buffer for + them. (send_process): Handle datagram sockets. - (Fstop_process, Fcontinue_process): Apply to network processes. A stopped - network process is indicated by setting command field to t . + (Fstop_process, Fcontinue_process): Apply to network processes. A + stopped network process is indicated by setting command field to t. (Fprocess_send_eof): No-op if datagram connection. (Fstatus_notify): Don't read input for a stream server socket or a stopped network process. diff --git a/src/Makefile.in b/src/Makefile.in index cb9db5614a1..71eaeadb6ba 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -74,13 +74,13 @@ SHELL=/bin/sh #define NOT_C_CODE #include "config.h" -/* We won't really call alloca; - don't let the file name alloca.c get messed up. */ +/* We will not really call alloca; + do not let the file name alloca.c get messed up. */ #ifdef alloca #undef alloca #endif -/* Don't let the file name mktime.c get messed up. */ +/* Do not let the file name mktime.c get messed up. */ #ifdef mktime #undef mktime #endif @@ -95,7 +95,7 @@ SHELL=/bin/sh #endif /* On some machines #define register is done in config; - don't let it interfere with this file. */ + do not let it interfere with this file. */ #undef register /* On some systems we may not be able to use the system make command. */ @@ -115,7 +115,7 @@ CC = C_COMPILER #endif #endif -/* Some machines don't find the standard C libraries in the usual place. */ +/* Some machines do not find the standard C libraries in the usual place. */ #ifndef ORDINARY_LINK #ifndef LIB_STANDARD #define LIB_STANDARD -lc @@ -247,7 +247,7 @@ STARTFILES = START_FILES #endif /* not ORDINARY_LINK */ -/* cc switches needed to make `asm' keyword work. +/* cc switches needed to make ``asm'' keyword work. Nothing special needed on most machines. */ #ifndef C_SWITCH_ASM #define C_SWITCH_ASM @@ -276,7 +276,7 @@ TOOLKIT_DEFINES = for use in Emacs. -DHAVE_CONFIG_H is needed for some other files to take advantage of - the information in `config.h'. */ + the information in ``config.h''. */ /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM since it may have -I options that should override those two. */ @@ -336,7 +336,7 @@ LIBXMENU= -lXMenu #else /* not HAVE_MENUS */ -/* Otherwise, don't worry about the menu library at all. */ +/* Otherwise, do not worry about the menu library at all. */ LIBXMENU= #endif /* not HAVE_MENUS */ @@ -380,7 +380,7 @@ LIBXTR6 = -lSM -lICE #ifdef LIBXT_STATIC /* We assume the config files have defined STATIC_OPTION since that might depend on the operating system. - (Don't forget you need different definitions with and without __GNUC__.) */ + (Do not forget you need different definitions with and without __GNUC__.) */ LIBXT= STATIC_OPTION $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext DYNAMIC_OPTION #else /* not LIBXT_STATIC */ LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext @@ -468,9 +468,9 @@ CFLAGS_SOUND= @CFLAGS_SOUND@ /* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure places that are difficult to figure out at make time. Fortunately, these same versions allow you to pass arbitrary flags on to the - linker, so there's no reason not to use it as a linker. + linker, so there is no reason not to use it as a linker. - Well, it's not quite perfect. The `-nostdlib' keeps GCC from + Well, it is not quite perfect. The "-nostdlib" keeps GCC from searching for libraries in its internal directories, so we have to ask GCC explicitly where to find libgcc.a. */ @@ -487,9 +487,9 @@ GNULIB_VAR = LIB_GCC #ifndef LINKER_WAS_SPECIFIED /* GCC passes any argument prefixed with -Xlinker directly to the - linker. See prefix-args.c for an explanation of why we don't do - this with the shell's `for' construct. - Note that some people don't have '.' in their paths, so we must + linker. See prefix-args.c for an explanation of why we do not do + this with the shell''s ``for'' construct. + Note that some people do not have '.' in their paths, so we must use ./prefix-args. */ #define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags` #else @@ -530,12 +530,12 @@ LD=ld #endif /* not ORDINARY_LINK */ /* Flags to pass to LD only for temacs. */ -/* Don't split this line with a backslash. That can cause trouble with +/* Do not split this line with a backslash. That can cause trouble with some cpps. */ TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE /* A macro which other sections of Makefile can redefine to munge the - flags before they're passed to LD. This is helpful if you have + flags before they are passed to LD. This is helpful if you have redefined LD to something odd, like "gcc". (The YMF prefix is a holdover from the old name "ymakefile".) */ @@ -705,8 +705,8 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj) $(LIBO #define TOOLTIP_SUPPORT #endif -/* List of Lisp files loaded into the dumped Emacs. It's arranged - like this because it's easier to generate it semi-mechanically from +/* List of Lisp files loaded into the dumped Emacs. It is arranged + like this because it is easier to generate it semi-mechanically from loadup.el this way. Note that this list should not include lisp files which might not @@ -913,7 +913,7 @@ shortlisp= \ We must unconditionally put them in the DOC file. We use ../lisp/ to start the file names to reduce the size of the argument list for make-docfile - for the sake of systems which can\'t handle large ones. */ + for the sake of systems which can''t handle large ones. */ SOME_MACHINE_LISP = ${dotdot}/lisp/mouse.elc \ ${dotdot}/lisp/select.elc ${dotdot}/lisp/scroll-bar.elc \ ${dotdot}/lisp/vmsproc.elc ${dotdot}/lisp/vms-patch.elc \ @@ -993,13 +993,13 @@ temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} $ -o temacs ${STARTFILES} ${obj} ${otherobj} \ OBJECTS_MACHINE ${LIBES} -/* We don't use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE - often contain options that have to do with using Emacs's crt0, +/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE + often contain options that have to do with using Emacs''s crt0, which are only good with temacs. */ prefix-args${EXEEXT}: prefix-args.c $(config_h) $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args -/* Don't lose if this was not defined. */ +/* Do not lose if this was not defined. */ #ifndef OLDXMENU_OPTIONS #define OLDXMENU_OPTIONS #endif @@ -1062,7 +1062,7 @@ really-oldXMenu: #endif /* not USE_X_TOOLKIT */ #else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */ -/* We don\'t really need this, but satisfy the dependency. */ +/* We don''t really need this, but satisfy the dependency. */ stamp-oldxmenu: touch stamp-oldxmenu #endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */ @@ -1152,7 +1152,8 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h \ systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \ atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h) keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ - atimer.h systime.h puresize.h charset.h intervals.h $(config_h) + atimer.h systime.h puresize.h charset.h intervals.h keymap.h window.h \ + $(config_h) lastfile.o: lastfile.c $(config_h) macros.o: macros.c window.h buffer.h commands.h macros.h keyboard.h \ dispextern.h $(config_h) diff --git a/src/buffer.c b/src/buffer.c index 6a11569c85a..f2f15a54743 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -387,6 +387,7 @@ The value is never nil. */) BUF_ZV_BYTE (b) = BEG_BYTE; BUF_Z_BYTE (b) = BEG_BYTE; BUF_MODIFF (b) = 1; + BUF_CHARS_MODIFF (b) = 1; BUF_OVERLAY_MODIFF (b) = 1; BUF_SAVE_MODIFF (b) = 1; BUF_INTERVALS (b) = 0; @@ -1161,6 +1162,31 @@ No argument or nil as argument means use current buffer as BUFFER. */) return make_number (BUF_MODIFF (buf)); } + +DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick, + Sbuffer_chars_modified_tick, 0, 1, 0, + doc: /* Return BUFFER's character-change tick counter. +Each buffer has a character-change tick counter, which is set to the +value of the buffer's tick counter \(see `buffer-modified-tick'), each +time text in that buffer is inserted or deleted. By comparing the +values returned by two individual calls of `buffer-chars-modified-tick', +you can tell whether a character change occurred in that buffer in +between these calls. No argument or nil as argument means use current +buffer as BUFFER. */) + (buffer) + register Lisp_Object buffer; +{ + register struct buffer *buf; + if (NILP (buffer)) + buf = current_buffer; + else + { + CHECK_BUFFER (buffer); + buf = XBUFFER (buffer); + } + + return make_number (BUF_CHARS_MODIFF (buf)); +} DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2, "sRename buffer (to new name): \nP", @@ -5495,7 +5521,7 @@ A string is printed verbatim in the mode line except for %-constructs: or print Bottom or All. %n -- print Narrow if appropriate. %t -- visited file is text or binary (if OS supports this distinction). - %z -- print mnemonics of buffer, terminal, and keyboard coding systems. + %z -- print mnemonics of keyboard, terminal, and buffer coding systems. %Z -- like %z, but including the end-of-line format. %e -- print error message about full memory. %[ -- print one [ for each recursive editing level. %] similar. @@ -6074,6 +6100,7 @@ The function `kill-all-local-variables' runs this before doing anything else. * defsubr (&Sbuffer_modified_p); defsubr (&Sset_buffer_modified_p); defsubr (&Sbuffer_modified_tick); + defsubr (&Sbuffer_chars_modified_tick); defsubr (&Srename_buffer); defsubr (&Sother_buffer); defsubr (&Sbuffer_enable_undo); diff --git a/src/buffer.h b/src/buffer.h index efe0252453a..a5f8a6a4070 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -82,6 +82,9 @@ Boston, MA 02110-1301, USA. */ /* Modification count. */ #define MODIFF (current_buffer->text->modiff) +/* Character modification count. */ +#define CHARS_MODIFF (current_buffer->text->chars_modiff) + /* Overlay modification count. */ #define OVERLAY_MODIFF (current_buffer->text->overlay_modiff) @@ -147,6 +150,9 @@ Boston, MA 02110-1301, USA. */ /* Modification count. */ #define BUF_MODIFF(buf) ((buf)->text->modiff) +/* Character modification count. */ +#define BUF_CHARS_MODIFF(buf) ((buf)->text->chars_modiff) + /* Modification count as of last visit or save. */ #define BUF_SAVE_MODIFF(buf) ((buf)->text->save_modiff) @@ -406,6 +412,10 @@ struct buffer_text for this buffer. It is incremented for each such event, and never otherwise changed. */ + int chars_modiff; /* This is modified with character change + events for this buffer. It is set to + modiff for each such event, and never + otherwise changed. */ int save_modiff; /* Previous value of modiff, as of last time buffer visited or saved a file. */ diff --git a/src/callint.c b/src/callint.c index e48168db164..5c54cdcaf48 100644 --- a/src/callint.c +++ b/src/callint.c @@ -257,9 +257,11 @@ See `interactive'. Optional second arg RECORD-FLAG non-nil means unconditionally put this command in the command-history. Otherwise, this is done only if an arg is read using the minibuffer. + Optional third arg KEYS, if given, specifies the sequence of events to -supply if the command inquires which events were used to invoke it. -If KEYS is omitted or nil, the return value of `this-command-keys' is used. */) +supply, as a vector, if the command inquires which events were used to +invoke it. If KEYS is omitted or nil, the return value of +`this-command-keys-vector' is used. */) (function, record_flag, keys) Lisp_Object function, record_flag, keys; { diff --git a/src/casefiddle.c b/src/casefiddle.c index 0ad884310ed..cb7c953a3e4 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -187,7 +187,7 @@ casify_region (flag, b, e) validate_region (&b, &e); start = XFASTINT (b); end = XFASTINT (e); - modify_region (current_buffer, start, end); + modify_region (current_buffer, start, end, 0); record_change (start, end - start); start_byte = CHAR_TO_BYTE (start); end_byte = CHAR_TO_BYTE (end); diff --git a/src/casetab.c b/src/casetab.c index 5483f5663fa..8c46ab11c60 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -262,6 +262,9 @@ init_casetab_once () : i))); XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up); + + /* Fill in what isn't filled in. */ + set_case_table (down, 1); } void diff --git a/src/charset.h b/src/charset.h index b7ab4cb8b53..b25a2ffa85a 100644 --- a/src/charset.h +++ b/src/charset.h @@ -658,22 +658,34 @@ else } while (0) -/* If P is after LIMIT, advance P to the previous character boundary. - It assumes that P is already at a character boundary of the sane - mulitbyte form whose beginning address is LIMIT. */ +/* If P is after LIMIT, advance P to the previous character boundary. */ #define PREV_CHAR_BOUNDARY(p, limit) \ do { \ if ((p) > (limit)) \ { \ const unsigned char *p0 = (p); \ + const unsigned char *p_limit = max (limit, p0 - MAX_MULTIBYTE_LENGTH);\ do { \ p0--; \ - } while (p0 >= limit && ! CHAR_HEAD_P (*p0)); \ - (p) = (BYTES_BY_CHAR_HEAD (*p0) == (p) - p0) ? p0 : (p) - 1; \ + } while (p0 >= p_limit && ! CHAR_HEAD_P (*p0)); \ + /* If BBCH(*p0) > p-p0, it means we were not on a boundary. */ \ + (p) = (BYTES_BY_CHAR_HEAD (*p0) >= (p) - p0) ? p0 : (p) - 1; \ } \ } while (0) +#define AT_CHAR_BOUNDARY_P(result, p, limit) \ + do { \ + if (CHAR_HEAD_P (*(p)) || (p) <= limit) \ + /* Optimization for the common case. */ \ + (result) = 1; \ + else \ + { \ + const unsigned char *p_aux = (p)+1; \ + PREV_CHAR_BOUNDARY (p_aux, limit); \ + (result) = (p_aux == (p)); \ + } \ +} while (0) #ifdef emacs diff --git a/src/coding.c b/src/coding.c index 53f37c580de..24c6ef0b6b1 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6654,7 +6654,8 @@ sequence containing the bytes in the region between START and END when the coding system `undecided' is specified. The list is ordered by priority decided in the current language environment. -If only ASCII characters are found, it returns a list of single element +If only ASCII characters are found (except for such ISO-2022 control +characters ISO-2022 as ESC), it returns a list of single element `undecided' or its subsidiary coding system according to a detected end-of-line format. @@ -6701,7 +6702,8 @@ sequence containing the bytes in STRING when the coding system `undecided' is specified. The list is ordered by priority decided in the current language environment. -If only ASCII characters are found, it returns a list of single element +If only ASCII characters are found (except for such ISO-2022 control +characters ISO-2022 as ESC), it returns a list of single element `undecided' or its subsidiary coding system according to a detected end-of-line format. diff --git a/src/dispextern.h b/src/dispextern.h index 52e549ebc0f..1198838c17d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2679,7 +2679,7 @@ extern Lisp_Object help_echo_object, previous_help_echo_string; extern int help_echo_pos; extern struct frame *last_mouse_frame; extern int last_tool_bar_item; -extern int mouse_autoselect_window; +extern Lisp_Object Vmouse_autoselect_window; extern int unibyte_display_via_language_environment; extern void reseat_at_previous_visible_line_start P_ ((struct it *)); @@ -2773,6 +2773,9 @@ extern void x_reference_bitmap P_ ((struct frame *, int)); extern int x_create_bitmap_from_data P_ ((struct frame *, char *, unsigned int, unsigned int)); extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object)); +#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) +extern int x_create_bitmap_from_xpm_data P_ ((struct frame *f, char **bits)); +#endif #ifndef x_destroy_bitmap extern void x_destroy_bitmap P_ ((struct frame *, int)); #endif diff --git a/src/dispnew.c b/src/dispnew.c index 1d977898f60..394c550fa73 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -4409,7 +4409,12 @@ update_text_area (w, vpos) || desired_row->phys_height != current_row->phys_height || desired_row->visible_height != current_row->visible_height || current_row->overlapped_p +#if 0 + /* This causes excessive flickering when mouse is moved across + the mode line. Luckily everything seems to work just fine + without doing this. KFS 2006-09-17. */ || current_row->mouse_face_p +#endif || current_row->x != desired_row->x) { rif->cursor_to (vpos, 0, desired_row->y, desired_row->x); @@ -6529,7 +6534,8 @@ Emacs was built without floating point support. /* This is just like wait_reading_process_output, except that it does redisplay. - TIMEOUT is number of seconds to wait (float or integer). + TIMEOUT is number of seconds to wait (float or integer), + or t to wait forever. READING is 1 if reading input. If DO_DISPLAY is >0 display process output while waiting. If DO_DISPLAY is >1 perform an initial redisplay before waiting. @@ -6562,10 +6568,15 @@ sit_for (timeout, reading, do_display) sec = (int) seconds; usec = (int) ((seconds - sec) * 1000000); } + else if (EQ (timeout, Qt)) + { + sec = 0; + usec = 0; + } else wrong_type_argument (Qnumberp, timeout); - if (sec == 0 && usec == 0) + if (sec == 0 && usec == 0 && !EQ (timeout, Qt)) return Qt; #ifdef SIGIO @@ -6582,7 +6593,8 @@ sit_for (timeout, reading, do_display) DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0, doc: /* Perform redisplay if no input is available. If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil, -perform a full redisplay even if input is available. */) +perform a full redisplay even if input is available. +Return t if redisplay was performed, nil otherwise. */) (force) Lisp_Object force; { diff --git a/src/editfns.c b/src/editfns.c index c43528c4863..71b518acb74 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1390,7 +1390,7 @@ name, or nil if there is no such user. */) } DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, - doc: /* Return the name of the machine you are running on, as a string. */) + doc: /* Return the host name of the machine you are running on, as a string. */) () { return Vsystem_name; @@ -1694,7 +1694,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) SBYTES (format_string), tm, ut); if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0')) - return code_convert_string_norecord (make_string (buf, result), + return code_convert_string_norecord (make_unibyte_string (buf, result), Vlocale_coding_system, 0); /* If buffer was too small, make it bigger and try again. */ @@ -2781,7 +2781,7 @@ Both characters must have the same length of multi-byte form. */) else if (!changed) { changed = -1; - modify_region (current_buffer, pos, XINT (end)); + modify_region (current_buffer, pos, XINT (end), 0); if (! NILP (noundo)) { @@ -2897,7 +2897,7 @@ It returns the number of characters changed. */) pos = XINT (start); pos_byte = CHAR_TO_BYTE (pos); end_pos = XINT (end); - modify_region (current_buffer, pos, XINT (end)); + modify_region (current_buffer, pos, XINT (end), 0); cnt = 0; for (; pos < end_pos; ) @@ -3178,6 +3178,9 @@ The message also goes into the `*Messages*' buffer. The first argument is a format control string, and the rest are data to be formatted under control of the string. See `format' for details. +Note: Use (message "%s" VALUE) to print the value of expressions and +variables to avoid accidentally interpreting `%' as format specifiers. + If the first argument is nil or the empty string, the function clears any existing message; this lets the minibuffer contents show. See also `current-message'. @@ -3758,7 +3761,13 @@ usage: (format STRING &rest OBJECTS) */) this_format[format - this_format_start] = 0; if (INTEGERP (args[n])) - sprintf (p, this_format, XINT (args[n])); + { + if (format[-1] == 'd') + sprintf (p, this_format, XINT (args[n])); + /* Don't sign-extend for octal or hex printing. */ + else + sprintf (p, this_format, XUINT (args[n])); + } else sprintf (p, this_format, XFLOAT_DATA (args[n])); @@ -4162,7 +4171,7 @@ Transposing beyond buffer boundaries is an error. */) if (end1 == start2) /* adjacent regions */ { - modify_region (current_buffer, start1, end2); + modify_region (current_buffer, start1, end2, 0); record_change (start1, len1 + len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); @@ -4218,8 +4227,8 @@ Transposing beyond buffer boundaries is an error. */) { USE_SAFE_ALLOCA; - modify_region (current_buffer, start1, end1); - modify_region (current_buffer, start2, end2); + modify_region (current_buffer, start1, end1, 0); + modify_region (current_buffer, start2, end2, 0); record_change (start1, len1); record_change (start2, len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); @@ -4248,7 +4257,7 @@ Transposing beyond buffer boundaries is an error. */) { USE_SAFE_ALLOCA; - modify_region (current_buffer, start1, end2); + modify_region (current_buffer, start1, end2, 0); record_change (start1, (end2 - start1)); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); @@ -4279,7 +4288,7 @@ Transposing beyond buffer boundaries is an error. */) USE_SAFE_ALLOCA; record_change (start1, (end2 - start1)); - modify_region (current_buffer, start1, end2); + modify_region (current_buffer, start1, end2, 0); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); @@ -4364,7 +4373,7 @@ functions if all the text being accessed has this property. */); Vbuffer_access_fontified_property = Qnil; DEFVAR_LISP ("system-name", &Vsystem_name, - doc: /* The name of the machine Emacs is running on. */); + doc: /* The host name of the machine Emacs is running on. */); DEFVAR_LISP ("user-full-name", &Vuser_full_name, doc: /* The full name of the user logged in. */); diff --git a/src/emacs.c b/src/emacs.c index 530f008270c..26a0c4da859 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2138,6 +2138,9 @@ shut_down_emacs (sig, no_x, stuff) stuff_buffered_input (stuff); +#ifdef subprocesses + inhibit_sentinels = 1; +#endif kill_buffer_processes (Qnil); Fdo_auto_save (Qt, Qnil); diff --git a/src/eval.c b/src/eval.c index c8ad9004c44..3c9a0c03214 100644 --- a/src/eval.c +++ b/src/eval.c @@ -28,6 +28,10 @@ Boston, MA 02110-1301, USA. */ #include "dispextern.h" #include <setjmp.h> +#if HAVE_X_WINDOWS +#include "xterm.h" +#endif + /* This definition is duplicated in alloc.c and keyboard.c */ /* Putting it in lisp.h makes cc bomb out! */ @@ -199,6 +203,14 @@ extern Lisp_Object Qrisky_local_variable; static Lisp_Object funcall_lambda P_ ((Lisp_Object, int, Lisp_Object*)); static void unwind_to_catch P_ ((struct catchtag *, Lisp_Object)) NO_RETURN; + +#if __GNUC__ +/* "gcc -O3" enables automatic function inlining, which optimizes out + the arguments for the invocations of these functions, whereas they + expect these values on the stack. */ +Lisp_Object apply1 () __attribute__((noinline)); +Lisp_Object call2 () __attribute__((noinline)); +#endif void init_eval_once () @@ -1906,6 +1918,9 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) max_specpdl_size--; } if (! no_debugger + /* Don't try to run the debugger with interrupts blocked. + The editing loop would return anyway. */ + && ! INPUT_BLOCKED_P && (EQ (sig_symbol, Qquit) ? debug_on_quit : wants_debugger (Vdebug_on_error, conditions)) diff --git a/src/fns.c b/src/fns.c index 5fe429fcf8b..31774e71787 100644 --- a/src/fns.c +++ b/src/fns.c @@ -387,7 +387,12 @@ Symbols are also allowed; their print names are used instead. */) return i1 < SCHARS (s2) ? Qt : Qnil; } -static Lisp_Object concat (); +#if __GNUC__ +/* "gcc -O3" enables automatic function inlining, which optimizes out + the arguments for the invocations of this function, whereas it + expects these values on the stack. */ +static Lisp_Object concat () __attribute__((noinline)); +#endif /* ARGSUSED */ Lisp_Object @@ -1459,11 +1464,10 @@ The value is actually the tail of LIST whose car is ELT. */) } DEFUN ("memq", Fmemq, Smemq, 2, 2, 0, - doc: /* Return non-nil if ELT is an element of LIST. -Comparison done with `eq'. The value is actually the tail of LIST -whose car is ELT. */) +doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eq'. +The value is actually the tail of LIST whose car is ELT. */) (elt, list) - Lisp_Object elt, list; + register Lisp_Object elt, list; { while (1) { @@ -1486,6 +1490,30 @@ whose car is ELT. */) return list; } +DEFUN ("memql", Fmemql, Smemql, 2, 2, 0, +doc: /* Return non-nil if ELT is an element of LIST. Comparison done with `eql'. +The value is actually the tail of LIST whose car is ELT. */) + (elt, list) + register Lisp_Object elt; + Lisp_Object list; +{ + register Lisp_Object tail; + + if (!FLOATP (elt)) + return Fmemq (elt, list); + + for (tail = list; !NILP (tail); tail = XCDR (tail)) + { + register Lisp_Object tem; + CHECK_LIST_CONS (tail, list); + tem = XCAR (tail); + if (FLOATP (tem) && internal_equal (elt, tem, 0, 0)) + return tail; + QUIT; + } + return Qnil; +} + DEFUN ("assq", Fassq, Sassq, 2, 2, 0, doc: /* Return non-nil if KEY is `eq' to the car of an element of LIST. The value is actually the first element of LIST whose car is KEY. @@ -2749,7 +2777,8 @@ optimize_sub_char_table (table, chars) else from = 32, to = 128; - if (!SUB_CHAR_TABLE_P (*table)) + if (!SUB_CHAR_TABLE_P (*table) + || ! NILP (XCHAR_TABLE (*table)->defalt)) return; elt = XCHAR_TABLE (*table)->contents[from++]; for (; from < to; from++) @@ -2764,7 +2793,7 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, Lisp_Object table; { Lisp_Object elt; - int dim; + int dim, chars; int i, j; CHECK_CHAR_TABLE (table); @@ -2775,10 +2804,11 @@ DEFUN ("optimize-char-table", Foptimize_char_table, Soptimize_char_table, if (!SUB_CHAR_TABLE_P (elt)) continue; dim = CHARSET_DIMENSION (i - 128); + chars = CHARSET_CHARS (i - 128); if (dim == 2) for (j = 32; j < SUB_CHAR_TABLE_ORDINARY_SLOTS; j++) - optimize_sub_char_table (XCHAR_TABLE (elt)->contents + j, dim); - optimize_sub_char_table (XCHAR_TABLE (table)->contents + i, dim); + optimize_sub_char_table (XCHAR_TABLE (elt)->contents + j, chars); + optimize_sub_char_table (XCHAR_TABLE (table)->contents + i, chars); } return Qnil; } @@ -5831,6 +5861,7 @@ used if both `use-dialog-box' and this variable are non-nil. */); defsubr (&Selt); defsubr (&Smember); defsubr (&Smemq); + defsubr (&Smemql); defsubr (&Sassq); defsubr (&Sassoc); defsubr (&Srassq); diff --git a/src/frame.c b/src/frame.c index 021e9bf604f..d7c58fd8faa 100644 --- a/src/frame.c +++ b/src/frame.c @@ -115,6 +115,7 @@ Lisp_Object Qenvironment; Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; +Lisp_Object Qinhibit_face_set_after_frame_default; Lisp_Object Qface_set_after_frame_default; Lisp_Object Vterminal_frame; @@ -3036,12 +3037,20 @@ x_set_frame_parameters (f, alist) || EQ (prop, Qfullscreen)) { register Lisp_Object param_index, old_value; + int count = SPECPDL_INDEX (); old_value = get_frame_param (f, prop); fullscreen_is_being_set |= EQ (prop, Qfullscreen); if (NILP (Fequal (val, old_value))) { + /* For :font attributes, the frame_parm_handler + x_set_font calls `face-set-after-frame-default'. + Unless we bind inhibit-face-set-after-frame-default + here, this would reset the :font attribute that we + just applied to the default value for new faces. */ + specbind (Qinhibit_face_set_after_frame_default, Qt); + store_frame_param (f, prop, val); param_index = Fget (prop, Qx_frame_parameter); @@ -3050,6 +3059,7 @@ x_set_frame_parameters (f, alist) < sizeof (frame_parms)/sizeof (frame_parms[0])) && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); + unbind_to (count, Qnil); } } } @@ -4321,6 +4331,10 @@ syms_of_frame () Qface_set_after_frame_default = intern ("face-set-after-frame-default"); staticpro (&Qface_set_after_frame_default); + Qinhibit_face_set_after_frame_default + = intern ("inhibit-face-set-after-frame-default"); + staticpro (&Qinhibit_face_set_after_frame_default); + Qfullwidth = intern ("fullwidth"); staticpro (&Qfullwidth); Qfullheight = intern ("fullheight"); diff --git a/src/gmalloc.c b/src/gmalloc.c index 71df287a6b6..646fbbc4e4c 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -10,17 +10,17 @@ Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -329,17 +329,17 @@ extern __ptr_t r_re_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size)); Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -932,17 +932,17 @@ _realloc (ptr, size) Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -1251,17 +1251,17 @@ cfree (ptr) Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -1496,17 +1496,17 @@ realloc (ptr, size) /* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -1593,17 +1593,17 @@ __default_morecore (increment) /* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @@ -1693,17 +1693,17 @@ memalign (alignment, size) Copyright (C) 1991, 92, 93, 94, 96 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -1760,17 +1760,17 @@ valloc (size) Written May 1989 by Mike Haertel. This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as +modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Library General Public License for more details. +General Public License for more details. -You should have received a copy of the GNU Library General Public -License along with this library; see the file COPYING.LIB. If +You should have received a copy of the GNU General Public +License along with this library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/src/gtkutil.c b/src/gtkutil.c index 4329ce236de..18b3607fc6f 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -131,14 +131,8 @@ xg_display_close (Display *dpy) #ifdef HAVE_GTK_MULTIDISPLAY GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy); - /* GTK 2.2 has a bug that makes gdk_display_close crash (bug - http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way - we can continue running, but there will be memory leaks. */ - -#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 4 - /* If this is the default display, we must change it before calling - dispose, otherwise it will crash. */ + dispose, otherwise it will crash on some Gtk+ versions. */ if (gdk_display_get_default () == gdpy) { struct x_display_info *dpyinfo; @@ -160,10 +154,14 @@ xg_display_close (Display *dpy) gdpy_new); } - g_object_run_dispose (G_OBJECT (gdpy)); + /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug + http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way + we can continue running, but there will be memory leaks. */ +#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 10 + g_object_run_dispose (G_OBJECT (gdpy)); #else - /* I hope this will be fixed in GTK 2.4. It is what bug 85715 says. */ + /* This seems to be fixed in GTK 2.10. */ gdk_display_close (gdpy); #endif #endif /* HAVE_GTK_MULTIDISPLAY */ @@ -509,10 +507,66 @@ get_utf8_string (str) { char *utf8_str = str; + if (!str) return NULL; + /* If not UTF-8, try current locale. */ - if (str && !g_utf8_validate (str, -1, NULL)) + if (!g_utf8_validate (str, -1, NULL)) utf8_str = g_locale_to_utf8 (str, -1, 0, 0, 0); + if (!utf8_str) + { + /* Probably some control characters in str. Escape them. */ + size_t nr_bad = 0; + gsize bytes_read; + gsize bytes_written; + unsigned char *p = (unsigned char *)str; + char *cp, *up; + GError *error = NULL; + + while (! (cp = g_locale_to_utf8 (p, -1, &bytes_read, + &bytes_written, &error)) + && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) + { + ++nr_bad; + p += bytes_written+1; + g_error_free (error); + error = NULL; + } + + if (error) + { + g_error_free (error); + error = NULL; + } + if (cp) g_free (cp); + + up = utf8_str = xmalloc (strlen (str) + nr_bad * 4 + 1); + p = str; + + while (! (cp = g_locale_to_utf8 (p, -1, &bytes_read, + &bytes_written, &error)) + && error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE) + { + strncpy (up, p, bytes_written); + sprintf (up + bytes_written, "\\%03o", p[bytes_written]); + up[bytes_written+4] = '\0'; + up += bytes_written+4; + p += bytes_written+1; + g_error_free (error); + error = NULL; + } + + if (cp) + { + strcat (utf8_str, cp); + g_free (cp); + } + if (error) + { + g_error_free (error); + error = NULL; + } + } return utf8_str; } @@ -1158,8 +1212,8 @@ int xg_uses_old_file_dialog () { #ifdef HAVE_GTK_FILE_BOTH - extern int x_use_old_gtk_file_dialog; - return x_use_old_gtk_file_dialog; + extern int x_gtk_use_old_file_dialog; + return x_gtk_use_old_file_dialog; #else /* ! HAVE_GTK_FILE_BOTH */ #ifdef HAVE_GTK_FILE_SELECTION_NEW @@ -1296,6 +1350,8 @@ xg_get_file_with_chooser (f, prompt, default_filename, GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE); extern int x_gtk_show_hidden_files; + extern int x_gtk_file_dialog_help_text; + if (only_dir_p) action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; @@ -1323,16 +1379,24 @@ xg_get_file_with_chooser (f, prompt, default_filename, g_signal_connect (G_OBJECT (filewin), "notify", G_CALLBACK (xg_toggle_notify_cb), wtoggle); - message[0] = '\0'; - if (action != GTK_FILE_CHOOSER_ACTION_SAVE) - strcat (message, "\nType C-l to display a file name text entry box.\n"); - strcat (message, "\nIf you don't like this file selector, customize " - "use-file-dialog\nto turn it off, or type C-x C-f to visit files."); + if (x_gtk_file_dialog_help_text) + { + message[0] = '\0'; + /* Gtk+ 2.10 has the file name text entry box integrated in the dialog. + Show the C-l help text only for versions < 2.10. */ + if (gtk_check_version (2, 10, 0) && action != GTK_FILE_CHOOSER_ACTION_SAVE) + strcat (message, "\nType C-l to display a file name text entry box.\n"); + strcat (message, "\nIf you don't like this file selector, use the " + "corresponding\nkey binding or customize " + "use-file-dialog to turn it off."); + + wmessage = gtk_label_new (message); + gtk_widget_show (wmessage); + } - wmessage = gtk_label_new (message); - gtk_widget_show (wmessage); gtk_box_pack_start (GTK_BOX (wbox), wtoggle, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0); + if (x_gtk_file_dialog_help_text) + gtk_box_pack_start (GTK_BOX (wbox), wmessage, FALSE, FALSE, 0); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (filewin), wbox); if (default_filename) @@ -1340,6 +1404,7 @@ xg_get_file_with_chooser (f, prompt, default_filename, Lisp_Object file; struct gcpro gcpro1; GCPRO1 (file); + char *utf8_filename; file = build_string (default_filename); @@ -1347,14 +1412,23 @@ xg_get_file_with_chooser (f, prompt, default_filename, an absolute name starting with /. */ if (default_filename[0] != '/') file = Fexpand_file_name (file, Qnil); - - default_filename = SSDATA (file); - if (Ffile_directory_p (file)) + + utf8_filename = SSDATA (ENCODE_UTF_8 (file)); + if (! NILP (Ffile_directory_p (file))) gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (filewin), - default_filename); + utf8_filename); else - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), - default_filename); + { + gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (filewin), + utf8_filename); + if (action == GTK_FILE_CHOOSER_ACTION_SAVE) + { + char *cp = strrchr (utf8_filename, '/'); + if (cp) ++cp; + else cp = utf8_filename; + gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (filewin), cp); + } + } UNGCPRO; } diff --git a/src/image.c b/src/image.c index a3ae6ceb3ce..5b80fe5b692 100644 --- a/src/image.c +++ b/src/image.c @@ -3153,7 +3153,7 @@ xbm_read_bitmap_data (f, contents, end, width, height, data) expect_ident ("define"); expect (XBM_TK_IDENT); - if (LA1 == XBM_TK_NUMBER); + if (LA1 == XBM_TK_NUMBER) { char *p = strrchr (buffer, '_'); p = p ? p + 1 : buffer; diff --git a/src/indent.c b/src/indent.c index efc375e27f7..efe10bc3f78 100644 --- a/src/indent.c +++ b/src/indent.c @@ -337,8 +337,8 @@ DEFUN ("current-column", Fcurrent_column, Scurrent_column, 0, 0, 0, doc: /* Return the horizontal position of point. Beginning of line is column 0. This is calculated by adding together the widths of all the displayed representations of the character between the start of the previous line -and point. (eg control characters will have a width of 2 or 4, tabs -will have a variable width) +and point (eg. control characters will have a width of 2 or 4, tabs +will have a variable width). Ignores finite width of frame, which means that this function may return values greater than (frame-width). Whether the line is visible (if `selective-display' is t) has no effect; @@ -736,8 +736,8 @@ string_display_width (string, beg, end) DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", doc: /* Indent from point with tabs and spaces until COLUMN is reached. -Optional second argument MININUM says always do at least MININUM spaces -even if that goes past COLUMN; by default, MININUM is zero. */) +Optional second argument MINIMUM says always do at least MINIMUM spaces +even if that goes past COLUMN; by default, MINIMUM is zero. */) (column, minimum) Lisp_Object column, minimum; { @@ -2076,7 +2076,7 @@ whether or not it is currently displayed in some window. */) { int it_start; int oselective; - int start_on_image_or_stretch_p; + int it_overshoot_expected_p; SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); @@ -2088,8 +2088,26 @@ whether or not it is currently displayed in some window. */) while the end position is really at some X > 0, the same X that PT had. */ it_start = IT_CHARPOS (it); - start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE - || it.method == GET_FROM_STRETCH); + + /* We expect the call to move_it_to, further down, to overshoot + if the starting point is on an image, stretch glyph, or Lisp + string. We won't need to backtrack in this situation, except + for one corner case: when the Lisp string contains a + newline. */ + if (it.method == GET_FROM_STRING) + { + const char *s = SDATA (it.string); + const char *e = s + SBYTES (it.string); + + while (s < e && *s != '\n') + ++s; + + it_overshoot_expected_p = (s == e); + } + else + it_overshoot_expected_p = (it.method == GET_FROM_IMAGE + || it.method == GET_FROM_STRETCH); + reseat_at_previous_visible_line_start (&it); it.current_x = it.hpos = 0; /* Temporarily disable selective display so we don't move too far */ @@ -2100,10 +2118,9 @@ whether or not it is currently displayed in some window. */) /* Move back if we got too far. This may happen if truncate-lines is on and PT is beyond right margin. - It may also happen if it_start is on an image or a stretch - glyph -- in that case, don't go back. */ + Don't go back if the overshoot is expected (see above). */ if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 - && !start_on_image_or_stretch_p) + && !it_overshoot_expected_p) move_it_by_lines (&it, -1, 0); it.vpos = 0; diff --git a/src/insdel.c b/src/insdel.c index b97539c1cc2..bd6e30d9449 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1007,6 +1007,7 @@ insert_1_both (string, nchars, nbytes, inherit, prepare, before_markers) will add up to the right stuff in the undo list. */ record_insert (PT, nchars); MODIFF++; + CHARS_MODIFF = MODIFF; bcopy (string, GPT_ADDR, nbytes); @@ -1144,6 +1145,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes, record_insert (PT, nchars); MODIFF++; + CHARS_MODIFF = MODIFF; GAP_SIZE -= outgoing_nbytes; GPT += nchars; @@ -1295,6 +1297,7 @@ insert_from_buffer_1 (buf, from, nchars, inherit) record_insert (PT, nchars); MODIFF++; + CHARS_MODIFF = MODIFF; GAP_SIZE -= outgoing_nbytes; GPT += nchars; @@ -1403,6 +1406,7 @@ adjust_after_replace (from, from_byte, prev_text, len, len_byte) if (len == 0) evaporate_overlays (from); MODIFF++; + CHARS_MODIFF = MODIFF; } /* Like adjust_after_replace, but doesn't require PREV_TEXT. @@ -1453,6 +1457,7 @@ adjust_after_replace_noundo (from, from_byte, nchars_del, nbytes_del, len, len_b if (len == 0) evaporate_overlays (from); MODIFF++; + CHARS_MODIFF = MODIFF; } /* Record undo information, adjust markers and position keepers for an @@ -1645,6 +1650,7 @@ replace_range (from, to, new, prepare, inherit, markers) CHECK_MARKERS (); MODIFF++; + CHARS_MODIFF = MODIFF; UNGCPRO; signal_after_change (from, nchars_del, GPT - from); @@ -1769,6 +1775,7 @@ replace_range_2 (from, from_byte, to, to_byte, ins, inschars, insbytes, markers) CHECK_MARKERS (); MODIFF++; + CHARS_MODIFF = MODIFF; } /* Delete characters in current buffer @@ -1950,6 +1957,7 @@ del_range_2 (from, from_byte, to, to_byte, ret_string) if (! EQ (current_buffer->undo_list, Qt)) record_delete (from, deletion); MODIFF++; + CHARS_MODIFF = MODIFF; /* Relocate point as if it were a marker. */ if (from < PT) @@ -1990,12 +1998,15 @@ del_range_2 (from, from_byte, to, to_byte, ret_string) character positions START to END. This checks the read-only properties of the region, calls the necessary modification hooks, and warns the next redisplay that it should pay attention to that - area. */ + area. + + If PRESERVE_CHARS_MODIFF is non-zero, do not update CHARS_MODIFF. + Otherwise set CHARS_MODIFF to the new value of MODIFF. */ void -modify_region (buffer, start, end) +modify_region (buffer, start, end, preserve_chars_modiff) struct buffer *buffer; - int start, end; + int start, end, preserve_chars_modiff; { struct buffer *old_buffer = current_buffer; @@ -2009,6 +2020,8 @@ modify_region (buffer, start, end) if (MODIFF <= SAVE_MODIFF) record_first_change (); MODIFF++; + if (! preserve_chars_modiff) + CHARS_MODIFF = MODIFF; buffer->point_before_scroll = Qnil; diff --git a/src/keyboard.c b/src/keyboard.c index 681018bbab9..5d0e05f887d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1619,15 +1619,17 @@ command_loop_1 () if (minibuf_level && !NILP (echo_area_buffer[0]) - && EQ (minibuf_window, echo_area_window) - && NUMBERP (Vminibuffer_message_timeout)) + && EQ (minibuf_window, echo_area_window)) { /* Bind inhibit-quit to t so that C-g gets read in rather than quitting back to the minibuffer. */ int count = SPECPDL_INDEX (); specbind (Qinhibit_quit, Qt); - sit_for (Vminibuffer_message_timeout, 0, 2); + if (NUMBERP (Vminibuffer_message_timeout)) + sit_for (Vminibuffer_message_timeout, 0, 2); + else + sit_for (Qt, 0, 2); /* Clear the echo area. */ message2 (0, 0, 0); @@ -1747,7 +1749,7 @@ command_loop_1 () if (SYMBOLP (cmd)) { Lisp_Object cmd1; - if (cmd1 = Fcommand_remapping (cmd), !NILP (cmd1)) + if (cmd1 = Fcommand_remapping (cmd, Qnil), !NILP (cmd1)) cmd = cmd1; } @@ -3365,8 +3367,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) goto retry; } - if (! reread || this_command_key_count == 0 - || this_command_key_count_reset) + if ((! reread || this_command_key_count == 0 + || this_command_key_count_reset) + && !end_time) { /* Don't echo mouse motion events. */ @@ -7700,7 +7703,7 @@ parse_menu_item (item, notreal, inmenubar) Lisp_Object prefix; if (!NILP (tem)) - tem = Fkey_binding (tem, Qnil, Qnil); + tem = Fkey_binding (tem, Qnil, Qnil, Qnil); prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ); if (CONSP (prefix)) @@ -8954,17 +8957,25 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, the initial keymaps from the current buffer. */ nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map) - || !NILP (Voverriding_local_map)) + if (!NILP (current_kboard->Voverriding_terminal_local_map)) { - if (3 > nmaps_allocated) + if (2 > nmaps_allocated) { - submaps = (Lisp_Object *) alloca (3 * sizeof (submaps[0])); - defs = (Lisp_Object *) alloca (3 * sizeof (defs[0])); - nmaps_allocated = 3; + submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0])); + defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); + nmaps_allocated = 2; } if (!NILP (current_kboard->Voverriding_terminal_local_map)) submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + } + else if (!NILP (Voverriding_local_map)) + { + if (2 > nmaps_allocated) + { + submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0])); + defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); + nmaps_allocated = 2; + } if (!NILP (Voverriding_local_map)) submaps[nmaps++] = Voverriding_local_map; } @@ -9332,16 +9343,19 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, if (!EQ (map_here, orig_local_map)) { orig_local_map = map_here; - keybuf[t] = key; - mock_input = t + 1; - - goto replay_sequence; + ++localized_local_map; } + map_here = get_local_map (XINT (pos), current_buffer, Qkeymap); if (!EQ (map_here, orig_keymap)) { orig_keymap = map_here; + ++localized_local_map; + } + + if (localized_local_map > 1) + { keybuf[t] = key; mock_input = t + 1; @@ -10177,7 +10191,7 @@ give to the command you invoke, if it asks for an argument. */) if (NILP (echo_area_buffer[0])) waited = sit_for (make_number (0), 0, 2); else if (NUMBERP (Vsuggest_key_bindings)) - waited = sit_for (Vminibuffer_message_timeout, 0, 2); + waited = sit_for (Vsuggest_key_bindings, 0, 2); else waited = sit_for (make_number (2), 0, 2); @@ -10299,7 +10313,9 @@ Actually, the value is nil only if we can be sure that no input is available; if there is a doubt, the value is t. */) () { - if (!NILP (Vunread_command_events) || unread_command_char != -1) + if (!NILP (Vunread_command_events) || unread_command_char != -1 + || !NILP (Vunread_post_input_method_events) + || !NILP (Vunread_input_method_events)) return (Qt); get_input_pending (&input_pending, diff --git a/src/keymap.c b/src/keymap.c index 9e1f01e7a79..065631ccff5 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -23,6 +23,9 @@ Boston, MA 02110-1301, USA. */ #include <config.h> #include <stdio.h> +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif #include "lisp.h" #include "commands.h" #include "buffer.h" @@ -34,6 +37,7 @@ Boston, MA 02110-1301, USA. */ #include "puresize.h" #include "intervals.h" #include "keymap.h" +#include "window.h" /* The number of elements in keymap vectors. */ #define DENSE_TABLE_SIZE (0200) @@ -739,7 +743,10 @@ map_keymap_call (key, val, fun, dummy) DEFUN ("map-keymap", Fmap_keymap, Smap_keymap, 2, 3, 0, doc: /* Call FUNCTION once for each event binding in KEYMAP. FUNCTION is called with two arguments: the event that is bound, and -the definition it is bound to. +the definition it is bound to. If the event is an integer, it may be +a generic character (see Info node `(elisp)Splitting Characters'), and +that means that all actual character events belonging to that generic +character are bound to the definition. If KEYMAP has a parent, the parent's bindings are included as well. This works recursively: if the parent has itself a parent, then the @@ -1142,7 +1149,7 @@ binding KEY to DEF is added at the front of KEYMAP. */) meta_bit = VECTORP (key) ? meta_modifier : 0x80; - if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, make_number (0)))) + if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0))) { /* DEF is apparently an XEmacs-style keyboard macro. */ Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil); int i = ASIZE (def); @@ -1209,17 +1216,23 @@ binding KEY to DEF is added at the front of KEYMAP. */) /* This function may GC (it calls Fkey_binding). */ -DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 1, 0, +DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, doc: /* Return the remapping for command COMMAND in current keymaps. -Returns nil if COMMAND is not remapped (or not a symbol). */) - (command) - Lisp_Object command; +Returns nil if COMMAND is not remapped (or not a symbol). + +If the optional argument POSITION is non-nil, it specifies a mouse +position as returned by `event-start' and `event-end', and the +remapping occurs in the keymaps associated with it. It can also be a +number or marker, in which case the keymap properties at the specified +buffer position instead of point are used. */) + (command, position) + Lisp_Object command, position; { if (!SYMBOLP (command)) return Qnil; ASET (command_remapping_vector, 1, command); - return Fkey_binding (command_remapping_vector, Qnil, Qt); + return Fkey_binding (command_remapping_vector, Qnil, Qt, position); } /* Value is number if KEY is too long; nil if valid but has no definition. */ @@ -1545,7 +1558,7 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and /* GC is possible in this function if it autoloads a keymap. */ -DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 3, 0, +DEFUN ("key-binding", Fkey_binding, Skey_binding, 1, 4, 0, doc: /* Return the binding for command KEY in current keymaps. KEY is a string or vector, a sequence of keystrokes. The binding is probably a symbol with a function definition. @@ -1559,24 +1572,82 @@ recognize the default bindings, just as `read-key-sequence' does. Like the normal command loop, `key-binding' will remap the command resulting from looking up KEY by looking up the command in the current keymaps. However, if the optional third argument NO-REMAP -is non-nil, `key-binding' returns the unmapped command. */) - (key, accept_default, no_remap) - Lisp_Object key, accept_default, no_remap; +is non-nil, `key-binding' returns the unmapped command. + +If KEY is a key sequence initiated with the mouse, the used keymaps +will depend on the clicked mouse position with regard to the buffer +and possible local keymaps on strings. + +If the optional argument POSITION is non-nil, it specifies a mouse +position as returned by `event-start' and `event-end', and the lookup +occurs in the keymaps associated with it instead of KEY. It can also +be a number or marker, in which case the keymap properties at the +specified buffer position instead of point are used. + */) + (key, accept_default, no_remap, position) + Lisp_Object key, accept_default, no_remap, position; { Lisp_Object *maps, value; int nmaps, i; - struct gcpro gcpro1; + struct gcpro gcpro1, gcpro2; + int count = SPECPDL_INDEX (); - GCPRO1 (key); + GCPRO2 (key, position); - if (!NILP (current_kboard->Voverriding_terminal_local_map)) + if (NILP (position) && VECTORP (key)) + { + Lisp_Object event + /* mouse events may have a symbolic prefix indicating the + scrollbar or mode line */ + = AREF (key, SYMBOLP (AREF (key, 0)) && ASIZE (key) > 1 ? 1 : 0); + + /* We are not interested in locations without event data */ + + if (EVENT_HAS_PARAMETERS (event)) + { + Lisp_Object kind = EVENT_HEAD_KIND (EVENT_HEAD (event)); + if (CONSP (XCDR (event)) && EQ (kind, Qmouse_click)) + position = EVENT_START (event); + } + } + + /* Key sequences beginning with mouse clicks + are read using the keymaps of the buffer clicked on, not + the current buffer. So we may have to switch the buffer + here. */ + + if (CONSP (position)) + { + Lisp_Object window; + + window = POSN_WINDOW (position); + + if (WINDOWP (window) + && BUFFERP (XWINDOW (window)->buffer) + && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + { + /* Arrange to go back to the original buffer once we're done + processing the key sequence. We don't use + save_excursion_{save,restore} here, in analogy to + `read-key-sequence' to avoid saving point. Maybe this + would not be a problem here, but it is easier to keep + things the same. + */ + + record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); + + set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); + } + } + + if (! NILP (current_kboard->Voverriding_terminal_local_map)) { value = Flookup_key (current_kboard->Voverriding_terminal_local_map, key, accept_default); if (! NILP (value) && !INTEGERP (value)) goto done; } - else if (!NILP (Voverriding_local_map)) + else if (! NILP (Voverriding_local_map)) { value = Flookup_key (Voverriding_local_map, key, accept_default); if (! NILP (value) && !INTEGERP (value)) @@ -1584,12 +1655,71 @@ is non-nil, `key-binding' returns the unmapped command. */) } else { - Lisp_Object local; + Lisp_Object keymap, local_map; + EMACS_INT pt; - local = get_local_map (PT, current_buffer, Qkeymap); - if (! NILP (local)) + pt = INTEGERP (position) ? XINT (position) + : MARKERP (position) ? marker_position (position) + : PT; + + local_map = get_local_map (pt, current_buffer, Qlocal_map); + keymap = get_local_map (pt, current_buffer, Qkeymap); + + if (CONSP (position)) { - value = Flookup_key (local, key, accept_default); + Lisp_Object string; + + /* For a mouse click, get the local text-property keymap + of the place clicked on, rather than point. */ + + if (POSN_INBUFFER_P (position)) + { + Lisp_Object pos; + + pos = POSN_BUFFER_POSN (position); + if (INTEGERP (pos) + && XINT (pos) >= BEG && XINT (pos) <= Z) + { + local_map = get_local_map (XINT (pos), + current_buffer, Qlocal_map); + + keymap = get_local_map (XINT (pos), + current_buffer, Qkeymap); + } + } + + /* If on a mode line string with a local keymap, + or for a click on a string, i.e. overlay string or a + string displayed via the `display' property, + consider `local-map' and `keymap' properties of + that string. */ + + if (string = POSN_STRING (position), + (CONSP (string) && STRINGP (XCAR (string)))) + { + Lisp_Object pos, map; + + pos = XCDR (string); + string = XCAR (string); + if (INTEGERP (pos) + && XINT (pos) >= 0 + && XINT (pos) < SCHARS (string)) + { + map = Fget_text_property (pos, Qlocal_map, string); + if (!NILP (map)) + local_map = map; + + map = Fget_text_property (pos, Qkeymap, string); + if (!NILP (map)) + keymap = map; + } + } + + } + + if (! NILP (keymap)) + { + value = Flookup_key (keymap, key, accept_default); if (! NILP (value) && !INTEGERP (value)) goto done; } @@ -1606,10 +1736,9 @@ is non-nil, `key-binding' returns the unmapped command. */) goto done; } - local = get_local_map (PT, current_buffer, Qlocal_map); - if (! NILP (local)) + if (! NILP (local_map)) { - value = Flookup_key (local, key, accept_default); + value = Flookup_key (local_map, key, accept_default); if (! NILP (value) && !INTEGERP (value)) goto done; } @@ -1618,6 +1747,8 @@ is non-nil, `key-binding' returns the unmapped command. */) value = Flookup_key (current_global_map, key, accept_default); done: + unbind_to (count, Qnil); + UNGCPRO; if (NILP (value) || INTEGERP (value)) return Qnil; @@ -1628,7 +1759,7 @@ is non-nil, `key-binding' returns the unmapped command. */) if (NILP (no_remap) && SYMBOLP (value)) { Lisp_Object value1; - if (value1 = Fcommand_remapping (value), !NILP (value1)) + if (value1 = Fcommand_remapping (value, position), !NILP (value1)) value = value1; } @@ -2247,16 +2378,29 @@ around function keys and event symbols. */) else SPLIT_CHAR (without_bits, charset, c1, c2); - if (charset - && CHARSET_DEFINED_P (charset) - && ((c1 >= 0 && c1 < 32) - || (c2 >= 0 && c2 < 32))) + if (! CHAR_VALID_P (without_bits, 1)) + { + char buf[256]; + + sprintf (buf, "Invalid char code %d", XINT (key)); + return build_string (buf); + } + else if (charset + && ((c1 == 0 && c2 == -1) || c2 == 0)) { /* Handle a generic character. */ Lisp_Object name; - name = CHARSET_TABLE_INFO (charset, CHARSET_LONG_NAME_IDX); + char buf[256]; + + name = CHARSET_TABLE_INFO (charset, CHARSET_SHORT_NAME_IDX); CHECK_STRING (name); - return concat2 (build_string ("Character set "), name); + if (c1 == 0) + /* Only a charset is specified. */ + sprintf (buf, "Generic char %d: all of ", without_bits); + else + /* 1st code-point of 2-dimensional charset is specified. */ + sprintf (buf, "Generic char %d: row %d of ", without_bits, c1); + return concat2 (build_string (buf), name); } else { @@ -2429,7 +2573,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) if (NILP (no_remap) && SYMBOLP (definition)) { Lisp_Object tem; - if (tem = Fcommand_remapping (definition), !NILP (tem)) + if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem)) return Qnil; } diff --git a/src/keymap.h b/src/keymap.h index 3170877f497..271a2e64284 100644 --- a/src/keymap.h +++ b/src/keymap.h @@ -29,8 +29,8 @@ EXFUN (Fmake_sparse_keymap, 1); EXFUN (Fkeymap_prompt, 1); EXFUN (Fdefine_key, 3); EXFUN (Flookup_key, 3); -EXFUN (Fcommand_remapping, 1); -EXFUN (Fkey_binding, 3); +EXFUN (Fcommand_remapping, 2); +EXFUN (Fkey_binding, 4); EXFUN (Fkey_description, 2); EXFUN (Fsingle_key_description, 2); EXFUN (Fwhere_is_internal, 5); diff --git a/src/lisp.h b/src/lisp.h index 4bdb0e67947..f5d936089cf 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2471,7 +2471,7 @@ extern Lisp_Object del_range_1 P_ ((int, int, int, int)); extern void del_range_byte P_ ((int, int, int)); extern void del_range_both P_ ((int, int, int, int, int)); extern Lisp_Object del_range_2 P_ ((int, int, int, int, int)); -extern void modify_region P_ ((struct buffer *, int, int)); +extern void modify_region P_ ((struct buffer *, int, int, int)); extern void prepare_to_modify_buffer P_ ((int, int, int *)); extern void signal_before_change P_ ((int, int, int *)); extern void signal_after_change P_ ((int, int, int)); @@ -2538,7 +2538,7 @@ extern void syms_of_xdisp P_ ((void)); extern void init_xdisp P_ ((void)); extern Lisp_Object safe_eval P_ ((Lisp_Object)); extern int pos_visible_p P_ ((struct window *, int, int *, - int *, int *, int *, int)); + int *, int *, int *, int *, int *)); /* Defined in vm-limit.c. */ extern void memory_warnings P_ ((POINTER_TYPE *, void (*warnfun) ())); @@ -2920,6 +2920,7 @@ extern int find_next_newline P_ ((int, int)); extern int find_next_newline_no_quit P_ ((int, int)); extern int find_before_next_newline P_ ((int, int, int)); extern void syms_of_search P_ ((void)); +extern void clear_regexp_cache P_ ((void)); /* defined in minibuf.c */ diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 0d3acd34d97..716dd44c727 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -159,5 +159,11 @@ NOTE-END */ #define XPNTR(a) XUINT (a) +#undef START_FILES +#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o + +#undef LIB_STANDARD +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o + /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 (do not change this comment) */ diff --git a/src/mac.c b/src/mac.c index 67fd5e4f5e0..be6953a0d55 100644 --- a/src/mac.c +++ b/src/mac.c @@ -2413,75 +2413,69 @@ sys_fopen (const char *name, const char *mode) } -#include "keyboard.h" -extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean); +extern Boolean mac_wait_next_event P_ ((EventRecord *, UInt32, Boolean)); int -select (n, rfds, wfds, efds, timeout) - int n; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - struct timeval *timeout; +select (nfds, rfds, wfds, efds, timeout) + int nfds; + SELECT_TYPE *rfds, *wfds, *efds; + EMACS_TIME *timeout; { - OSStatus err; -#if TARGET_API_MAC_CARBON - EventTimeout timeout_sec = - (timeout - ? (EMACS_SECS (*timeout) * kEventDurationSecond - + EMACS_USECS (*timeout) * kEventDurationMicrosecond) - : kEventDurationForever); - - BLOCK_INPUT; - err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); - UNBLOCK_INPUT; -#else /* not TARGET_API_MAC_CARBON */ - EventRecord e; - UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + - ((EMACS_USECS (*timeout) * 60) / 1000000); + OSStatus err = noErr; /* Can only handle wait for keyboard input. */ - if (n > 1 || wfds || efds) + if (nfds > 1 || wfds || efds) return -1; - /* Also return true if an event other than a keyDown has occurred. - This causes kbd_buffer_get_event in keyboard.c to call - read_avail_input which in turn calls XTread_socket to poll for - these events. Otherwise these never get processed except but a - very slow poll timer. */ - if (mac_wait_next_event (&e, sleep_time, false)) - err = noErr; - else - err = -9875; /* eventLoopTimedOutErr */ + /* Try detect_input_pending before ReceiveNextEvent in the same + BLOCK_INPUT block, in case that some input has already been read + asynchronously. */ + BLOCK_INPUT; + if (!detect_input_pending ()) + { +#if TARGET_API_MAC_CARBON + EventTimeout timeoutval = + (timeout + ? (EMACS_SECS (*timeout) * kEventDurationSecond + + EMACS_USECS (*timeout) * kEventDurationMicrosecond) + : kEventDurationForever); + + if (timeoutval == 0.0) + err = eventLoopTimedOutErr; + else + err = ReceiveNextEvent (0, NULL, timeoutval, + kEventLeaveInQueue, NULL); +#else /* not TARGET_API_MAC_CARBON */ + EventRecord e; + UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + + ((EMACS_USECS (*timeout) * 60) / 1000000); + + if (sleep_time == 0) + err = -9875; /* eventLoopTimedOutErr */ + else + { + if (mac_wait_next_event (&e, sleep_time, false)) + err = noErr; + else + err = -9875; /* eventLoopTimedOutErr */ + } #endif /* not TARGET_API_MAC_CARBON */ + } + UNBLOCK_INPUT; - if (FD_ISSET (0, rfds)) - if (err == noErr) - return 1; - else - { - FD_ZERO (rfds); - return 0; - } + if (err == noErr) + { + /* Pretend that `select' is interrupted by a signal. */ + detect_input_pending (); + errno = EINTR; + return -1; + } else - if (err == noErr) - { - if (input_polling_used ()) - { - /* It could be confusing if a real alarm arrives while - processing the fake one. Turn it off and let the - handler reset it. */ - extern void poll_for_input_1 P_ ((void)); - int old_poll_suppress_count = poll_suppress_count; - poll_suppress_count = 1; - poll_for_input_1 (); - poll_suppress_count = old_poll_suppress_count; - } - errno = EINTR; - return -1; - } - else + { + if (rfds) + FD_ZERO (rfds); return 0; + } } @@ -4904,6 +4898,30 @@ On successful conversion, return the result string, else return nil. */) return result; } + +DEFUN ("mac-process-hi-command", Fmac_process_hi_command, Smac_process_hi_command, 1, 1, 0, + doc: /* Send a HI command whose ID is COMMAND-ID to the command chain. +COMMAND-ID must be a 4-character string. Some common command IDs are +defined in the Carbon Event Manager. */) + (command_id) + Lisp_Object command_id; +{ + OSStatus err; + HICommand command; + + bzero (&command, sizeof (HICommand)); + command.commandID = mac_get_code_from_arg (command_id, 0); + + BLOCK_INPUT; + err = ProcessHICommand (&command); + UNBLOCK_INPUT; + + if (err != noErr) + error ("HI command (command ID: '%s') not handled.", SDATA (command_id)); + + return Qnil; +} + #endif /* TARGET_API_MAC_CARBON */ @@ -4944,23 +4962,26 @@ extern int noninteractive; -> Use `select'. 2. Sockets are not involved. -> Use ReceiveNextEvent. - 3. [If SELECT_USE_CFSOCKET is defined] - Only the window event channel and socket read channels are + 3. [If SELECT_USE_CFSOCKET is set] + Only the window event channel and socket read/write channels are involved, and timeout is not too short (greater than SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). -> Create CFSocket for each socket and add it into the current - event RunLoop so that a `ready-to-read' event can be posted - to the event queue that is also used for window events. Then - ReceiveNextEvent can wait for both kinds of inputs. + event RunLoop so that the current event loop gets quit when + the socket becomes ready. Then ReceiveNextEvent can wait for + both kinds of inputs. 4. Otherwise. -> Periodically poll the window input channel while repeatedly executing `select' with a short timeout (SELECT_POLLING_PERIOD_USEC microseconds). */ -#define SELECT_POLLING_PERIOD_USEC 20000 -#ifdef SELECT_USE_CFSOCKET +#ifndef SELECT_USE_CFSOCKET +#define SELECT_USE_CFSOCKET 1 +#endif + +#define SELECT_POLLING_PERIOD_USEC 100000 +#if SELECT_USE_CFSOCKET #define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2 -#define EVENT_CLASS_SOCK 'Sock' static void socket_callback (s, type, address, data, info) @@ -4970,196 +4991,211 @@ socket_callback (s, type, address, data, info) const void *data; void *info; { - EventRef event; + int fd = CFSocketGetNative (s); + SELECT_TYPE *ofds = (SELECT_TYPE *)info; - CreateEvent (NULL, EVENT_CLASS_SOCK, 0, 0, kEventAttributeNone, &event); - PostEventToQueue (GetCurrentEventQueue (), event, kEventPriorityStandard); - ReleaseEvent (event); + if ((type == kCFSocketReadCallBack && FD_ISSET (fd, &ofds[0])) + || (type == kCFSocketConnectCallBack && FD_ISSET (fd, &ofds[1]))) + QuitEventLoop (GetCurrentEventLoop ()); } #endif /* SELECT_USE_CFSOCKET */ static int -select_and_poll_event (n, rfds, wfds, efds, timeout) - int n; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - struct timeval *timeout; +select_and_poll_event (nfds, rfds, wfds, efds, timeout) + int nfds; + SELECT_TYPE *rfds, *wfds, *efds; + EMACS_TIME *timeout; { - int r; - OSStatus err; + OSStatus err = noErr; + int r = 0; - r = select (n, rfds, wfds, efds, timeout); - if (r != -1) + /* Try detect_input_pending before ReceiveNextEvent in the same + BLOCK_INPUT block, in case that some input has already been read + asynchronously. */ + BLOCK_INPUT; + if (!detect_input_pending ()) { - BLOCK_INPUT; - err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, - kEventLeaveInQueue, NULL); - UNBLOCK_INPUT; - if (err == noErr) + EMACS_TIME select_timeout; + EventTimeout timeoutval = + (timeout + ? (EMACS_SECS (*timeout) * kEventDurationSecond + + EMACS_USECS (*timeout) * kEventDurationMicrosecond) + : kEventDurationForever); + + EMACS_SET_SECS_USECS (select_timeout, 0, 0); + r = select (nfds, rfds, wfds, efds, &select_timeout); + if (timeoutval == 0.0) + err = eventLoopTimedOutErr; + else if (r == 0) { - FD_SET (0, rfds); - r++; +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (NULL); +#endif + err = ReceiveNextEvent (0, NULL, timeoutval, + kEventLeaveInQueue, NULL); } } - return r; -} + UNBLOCK_INPUT; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1020 -#undef SELECT_INVALIDATE_CFSOCKET -#endif + if (r != 0) + return r; + else if (err == noErr) + { + /* Pretend that `select' is interrupted by a signal. */ + detect_input_pending (); + errno = EINTR; + return -1; + } + else + return 0; +} int -sys_select (n, rfds, wfds, efds, timeout) - int n; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - struct timeval *timeout; +sys_select (nfds, rfds, wfds, efds, timeout) + int nfds; + SELECT_TYPE *rfds, *wfds, *efds; + EMACS_TIME *timeout; { - OSStatus err; - int i, r; + OSStatus err = noErr; + int r; EMACS_TIME select_timeout; + static SELECT_TYPE ofds[3]; if (inhibit_window_system || noninteractive - || rfds == NULL || !FD_ISSET (0, rfds)) - return select (n, rfds, wfds, efds, timeout); + || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds)) + return select (nfds, rfds, wfds, efds, timeout); FD_CLR (0, rfds); + ofds[0] = *rfds; - if (wfds == NULL && efds == NULL) - { - int nsocks = 0; - SELECT_TYPE orfds = *rfds; + if (wfds) + ofds[1] = *wfds; + else + FD_ZERO (&ofds[1]); - EventTimeout timeout_sec = + if (efds) + ofds[2] = *efds; + else + { + EventTimeout timeoutval = (timeout ? (EMACS_SECS (*timeout) * kEventDurationSecond + EMACS_USECS (*timeout) * kEventDurationMicrosecond) : kEventDurationForever); - for (i = 1; i < n; i++) - if (FD_ISSET (i, rfds)) - nsocks++; - - if (nsocks == 0) + FD_SET (0, rfds); /* sentinel */ + do { - BLOCK_INPUT; - err = ReceiveNextEvent (0, NULL, timeout_sec, - kEventLeaveInQueue, NULL); - UNBLOCK_INPUT; - if (err == noErr) - { - FD_SET (0, rfds); - return 1; - } - else - return 0; + nfds--; } + while (!(FD_ISSET (nfds, rfds) || (wfds && FD_ISSET (nfds, wfds)))); + nfds++; + FD_CLR (0, rfds); + + if (nfds == 1) + return select_and_poll_event (nfds, rfds, wfds, efds, timeout); -#if USE_CG_DRAWING - mac_prepare_for_quickdraw (NULL); -#endif /* Avoid initial overhead of RunLoop setup for the case that some input is already available. */ EMACS_SET_SECS_USECS (select_timeout, 0, 0); - r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); - if (r != 0 || timeout_sec == 0.0) + r = select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout); + if (r != 0 || timeoutval == 0.0) return r; - *rfds = orfds; + *rfds = ofds[0]; + if (wfds) + *wfds = ofds[1]; -#ifdef SELECT_USE_CFSOCKET - if (timeout_sec > 0 && timeout_sec <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) +#if SELECT_USE_CFSOCKET + if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) goto poll_periodically; - { - CFRunLoopRef runloop = - (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); - EventTypeSpec specs[] = {{EVENT_CLASS_SOCK, 0}}; -#ifdef SELECT_INVALIDATE_CFSOCKET - CFSocketRef *shead, *s; -#else - CFRunLoopSourceRef *shead, *s; -#endif - - BLOCK_INPUT; - -#ifdef SELECT_INVALIDATE_CFSOCKET - shead = xmalloc (sizeof (CFSocketRef) * nsocks); -#else - shead = xmalloc (sizeof (CFRunLoopSourceRef) * nsocks); -#endif - s = shead; - for (i = 1; i < n; i++) - if (FD_ISSET (i, rfds)) - { - CFSocketRef socket = - CFSocketCreateWithNative (NULL, i, kCFSocketReadCallBack, - socket_callback, NULL); - CFRunLoopSourceRef source = - CFSocketCreateRunLoopSource (NULL, socket, 0); - -#ifdef SELECT_INVALIDATE_CFSOCKET - CFSocketSetSocketFlags (socket, 0); -#endif - CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode); -#ifdef SELECT_INVALIDATE_CFSOCKET - CFRelease (source); - *s = socket; -#else - CFRelease (socket); - *s = source; -#endif - s++; - } + /* Try detect_input_pending before ReceiveNextEvent in the same + BLOCK_INPUT block, in case that some input has already been + read asynchronously. */ + BLOCK_INPUT; + if (!detect_input_pending ()) + { + int minfd, fd; + CFRunLoopRef runloop = + (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); + static CFSocketContext context = {0, ofds, NULL, NULL, NULL}; + static CFMutableDictionaryRef sources; + + if (sources == NULL) + sources = + CFDictionaryCreateMutable (NULL, 0, NULL, + &kCFTypeDictionaryValueCallBacks); + + for (minfd = 1; ; minfd++) /* nfds-1 works as a sentinel. */ + if (FD_ISSET (minfd, rfds) || (wfds && FD_ISSET (minfd, wfds))) + break; - err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); + for (fd = minfd; fd < nfds; fd++) + if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) + { + void *key = (void *) fd; + CFRunLoopSourceRef source = + (CFRunLoopSourceRef) CFDictionaryGetValue (sources, key); + + if (source == NULL) + { + CFSocketRef socket = + CFSocketCreateWithNative (NULL, fd, + (kCFSocketReadCallBack + | kCFSocketConnectCallBack), + socket_callback, &context); + + if (socket == NULL) + continue; + source = CFSocketCreateRunLoopSource (NULL, socket, 0); + CFRelease (socket); + if (source == NULL) + continue; + CFDictionaryAddValue (sources, key, source); + CFRelease (source); + } + CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode); + } - do - { - --s; -#ifdef SELECT_INVALIDATE_CFSOCKET - CFSocketInvalidate (*s); -#else - CFRunLoopRemoveSource (runloop, *s, kCFRunLoopDefaultMode); +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (NULL); #endif - CFRelease (*s); - } - while (s != shead); - - xfree (shead); + err = ReceiveNextEvent (0, NULL, timeoutval, + kEventLeaveInQueue, NULL); - if (err) - { - FD_ZERO (rfds); - r = 0; - } - else - { - FlushEventsMatchingListFromQueue (GetCurrentEventQueue (), - GetEventTypeCount (specs), - specs); - EMACS_SET_SECS_USECS (select_timeout, 0, 0); - r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); - } + for (fd = minfd; fd < nfds; fd++) + if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) + { + void *key = (void *) fd; + CFRunLoopSourceRef source = + (CFRunLoopSourceRef) CFDictionaryGetValue (sources, key); - UNBLOCK_INPUT; + CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); + } + } + UNBLOCK_INPUT; - return r; - } + if (err == noErr || err == eventLoopQuitErr) + { + EMACS_SET_SECS_USECS (select_timeout, 0, 0); + return select_and_poll_event (nfds, rfds, wfds, efds, + &select_timeout); + } + else + { + FD_ZERO (rfds); + if (wfds) + FD_ZERO (wfds); + return 0; + } #endif /* SELECT_USE_CFSOCKET */ } poll_periodically: { EMACS_TIME end_time, now, remaining_time; - SELECT_TYPE orfds = *rfds, owfds, oefds; - if (wfds) - owfds = *wfds; - if (efds) - oefds = *efds; if (timeout) { remaining_time = *timeout; @@ -5172,15 +5208,15 @@ sys_select (n, rfds, wfds, efds, timeout) EMACS_SET_SECS_USECS (select_timeout, 0, SELECT_POLLING_PERIOD_USEC); if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) select_timeout = remaining_time; - r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); + r = select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout); if (r != 0) return r; - *rfds = orfds; + *rfds = ofds[0]; if (wfds) - *wfds = owfds; + *wfds = ofds[1]; if (efds) - *efds = oefds; + *efds = ofds[2]; if (timeout) { @@ -5190,12 +5226,8 @@ sys_select (n, rfds, wfds, efds, timeout) } while (!timeout || EMACS_TIME_LT (now, end_time)); - FD_ZERO (rfds); - if (wfds) - FD_ZERO (wfds); - if (efds) - FD_ZERO (efds); - return 0; + EMACS_SET_SECS_USECS (select_timeout, 0, 0); + return select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout); } } @@ -5387,6 +5419,7 @@ syms_of_mac () #if TARGET_API_MAC_CARBON defsubr (&Smac_get_preference); defsubr (&Smac_code_convert_string); + defsubr (&Smac_process_hi_command); #endif defsubr (&Smac_set_file_creator); diff --git a/src/macfns.c b/src/macfns.c index 2d004be9962..e18d6089df7 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -4342,13 +4342,14 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) (prompt, dir, default_filename, mustmatch, only_dir_p) Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; { - struct frame *f = SELECTED_FRAME (); Lisp_Object file = Qnil; int count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char filename[MAXPATHLEN]; static NavEventUPP mac_nav_event_callbackUPP = NULL; + check_mac (); + GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); CHECK_STRING (prompt); CHECK_STRING (dir); diff --git a/src/macmenu.c b/src/macmenu.c index e7d69d5657c..1a1525eafb7 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -64,7 +64,8 @@ Boston, MA 02110-1301, USA. */ enum mac_menu_kind { /* Menu ID range */ MAC_MENU_APPLE, /* 0 (Reserved by Apple) */ - MAC_MENU_MENU_BAR, /* 1 .. 234 */ + MAC_MENU_MENU_BAR, /* 1 .. 233 */ + MAC_MENU_M_APPLE, /* 234 (== M_APPLE) */ MAC_MENU_POPUP, /* 235 */ MAC_MENU_DRIVER, /* 236 .. 255 (Reserved) */ MAC_MENU_MENU_BAR_SUB, /* 256 .. 16383 */ @@ -72,7 +73,7 @@ enum mac_menu_kind { /* Menu ID range */ MAC_MENU_END /* 32768 */ }; -static const int min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768}; +static const int min_menu_id[] = {0, 1, 234, 235, 236, 256, 16384, 32768}; #define DIALOG_WINDOW_RESOURCE 130 @@ -158,10 +159,10 @@ typedef struct _widget_value #define FALSE 0 #endif /* no TRUE */ -Lisp_Object Vmenu_updating_frame; - Lisp_Object Qdebug_on_next_call; +extern Lisp_Object Vmenu_updating_frame; + extern Lisp_Object Qmenu_bar, Qmac_apple_event; extern Lisp_Object QCtoggle, QCradio; @@ -196,6 +197,8 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, static void list_of_panes P_ ((Lisp_Object)); static void list_of_items P_ ((Lisp_Object)); +static void find_and_call_menu_selection P_ ((FRAME_PTR, int, Lisp_Object, + void *)); static int fill_menu P_ ((MenuHandle, widget_value *, enum mac_menu_kind, int)); static void fill_menubar P_ ((widget_value *, int)); static void dispose_menus P_ ((enum mac_menu_kind, int)); @@ -1015,39 +1018,63 @@ x_activate_menubar (f) FRAME_PTR f; { SInt32 menu_choice; + SInt16 menu_id, menu_item; extern Point saved_menu_event_location; set_frame_menubar (f, 0, 1); BLOCK_INPUT; menu_choice = MenuSelect (saved_menu_event_location); - do_menu_choice (menu_choice); + menu_id = HiWord (menu_choice); + menu_item = LoWord (menu_choice); + +#if !TARGET_API_MAC_CARBON + if (menu_id == min_menu_id[MAC_MENU_M_APPLE]) + do_apple_menu (menu_item); + else +#endif + if (menu_id) + { + MenuHandle menu = GetMenuHandle (menu_id); + + if (menu) + { + UInt32 refcon; + + GetMenuItemRefCon (menu, menu_item, &refcon); + find_and_call_menu_selection (f, f->menu_bar_items_used, + f->menu_bar_vector, (void *) refcon); + } + } + + HiliteMenu (0); UNBLOCK_INPUT; } -/* This callback is called from the menu bar pulldown menu - when the user makes a selection. - Figure out what the user chose - and put the appropriate events into the keyboard buffer. */ +/* Find the menu selection and store it in the keyboard buffer. + F is the frame the menu is on. + MENU_BAR_ITEMS_USED is the length of VECTOR. + VECTOR is an array of menu events for the whole menu. */ -void -menubar_selection_callback (FRAME_PTR f, int client_data) +static void +find_and_call_menu_selection (f, menu_bar_items_used, vector, client_data) + FRAME_PTR f; + int menu_bar_items_used; + Lisp_Object vector; + void *client_data; { Lisp_Object prefix, entry; - Lisp_Object vector; Lisp_Object *subprefix_stack; int submenu_depth = 0; int i; - if (!f) - return; entry = Qnil; - subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object)); - vector = f->menu_bar_vector; + subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object)); prefix = Qnil; i = 0; - while (i < f->menu_bar_items_used) + + while (i < menu_bar_items_used) { if (EQ (XVECTOR (vector)->contents[i], Qnil)) { @@ -1105,13 +1132,11 @@ menubar_selection_callback (FRAME_PTR f, int client_data) buf.arg = entry; kbd_buffer_store_event (&buf); - f->output_data.mac->menubar_active = 0; return; } i += MENU_ITEMS_ITEM_LENGTH; } } - f->output_data.mac->menubar_active = 0; } /* Allocate a widget_value, blocking input. */ @@ -1508,10 +1533,6 @@ set_frame_menubar (f, first_time, deep_p) int *submenu_start, *submenu_end; int *submenu_top_level_items, *submenu_n_panes; - /* We must not change the menubar when actually in use. */ - if (f->output_data.mac->menubar_active) - return; - XSETFRAME (Vmenu_updating_frame, f); if (! menubar_widget) @@ -2630,11 +2651,6 @@ syms_of_macmenu () Qdebug_on_next_call = intern ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); - DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, - doc: /* Frame for which we are updating a menu. -The enable predicate for a menu command should check this variable. */); - Vmenu_updating_frame = Qnil; - defsubr (&Sx_popup_menu); #ifdef HAVE_MENUS defsubr (&Sx_popup_dialog); diff --git a/src/macterm.c b/src/macterm.c index 76efa80d606..6902ac72304 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -108,6 +108,10 @@ static Lisp_Object last_window; (Not yet supported.) */ int x_use_underline_position_properties; +/* Non-zero means to draw the underline at the same place as the descent line. */ + +int x_underline_at_descent_line; + /* This is a chain of structures for all the X displays currently in use. */ @@ -261,9 +265,6 @@ static int is_emacs_window P_ ((WindowPtr)); static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); static void XSetFont P_ ((Display *, GC, XFontStruct *)); -/* Defined in macmenu.h. */ -extern void menubar_selection_callback (FRAME_PTR, int); - #define GC_FORE_COLOR(gc) (&(gc)->fore_color) #define GC_BACK_COLOR(gc) (&(gc)->back_color) #define GC_FONT(gc) ((gc)->xgcv.font) @@ -890,12 +891,13 @@ mac_invert_rectangle (f, x, y, width, height) static void -mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) +mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, + overstrike_p, bytes_per_char) struct frame *f; GC gc; int x, y; char *buf; - int nchars, bg_width, bytes_per_char; + int nchars, bg_width, overstrike_p, bytes_per_char; { SetPortWindowPort (FRAME_MAC_WINDOW (f)); @@ -945,6 +947,13 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) ATSUDrawText (text_layout, kATSUFromTextBeginning, kATSUToTextEnd, kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); + if (overstrike_p) + { + MoveTo (x + 1, y); + ATSUDrawText (text_layout, + kATSUFromTextBeginning, kATSUToTextEnd, + kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); + } mac_end_clip (gc); #ifdef MAC_OSX } @@ -988,9 +997,15 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) sizeof (tags) / sizeof (tags[0]), tags, sizes, values); if (err == noErr) - ATSUDrawText (text_layout, - kATSUFromTextBeginning, kATSUToTextEnd, - Long2Fix (x), Long2Fix (port_height - y)); + { + ATSUDrawText (text_layout, + kATSUFromTextBeginning, kATSUToTextEnd, + Long2Fix (x), Long2Fix (port_height - y)); + if (overstrike_p) + ATSUDrawText (text_layout, + kATSUFromTextBeginning, kATSUToTextEnd, + Long2Fix (x + 1), Long2Fix (port_height - y)); + } #if USE_CG_DRAWING mac_end_cg_clip (f); context = NULL; @@ -1056,6 +1071,12 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) TextFace (GC_FONT (gc)->mac_fontface); MoveTo (x, y); DrawText (buf, 0, nchars * bytes_per_char); + if (overstrike_p) + { + TextMode (srcOr); + MoveTo (x + 1, y); + DrawText (buf, 0, nchars * bytes_per_char); + } if (bg_width) RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); mac_end_clip (gc); @@ -1068,59 +1089,33 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) } -/* Mac replacement for XDrawString. */ - -static void -mac_draw_string (f, gc, x, y, buf, nchars) - struct frame *f; - GC gc; - int x, y; - char *buf; - int nchars; -{ - mac_draw_string_common (f, gc, x, y, buf, nchars, 0, 1); -} - - -/* Mac replacement for XDrawString16. */ - -static void -mac_draw_string_16 (f, gc, x, y, buf, nchars) - struct frame *f; - GC gc; - int x, y; - XChar2b *buf; - int nchars; -{ - mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, 0, 2); -} - - /* Mac replacement for XDrawImageString. */ static void -mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width) +mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width, overstrike_p) struct frame *f; GC gc; int x, y; char *buf; - int nchars, bg_width; + int nchars, bg_width, overstrike_p; { - mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, 1); + mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, + overstrike_p, 1); } -/* Mac replacement for XDrawString16. */ +/* Mac replacement for XDrawImageString16. */ static void -mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width) +mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width, overstrike_p) struct frame *f; GC gc; int x, y; XChar2b *buf; - int nchars, bg_width; + int nchars, bg_width, overstrike_p; { - mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width, 2); + mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width, + overstrike_p, 2); } @@ -1294,12 +1289,12 @@ init_cg_text_anti_aliasing_threshold () } static int -mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width) +mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p) struct frame *f; GC gc; int x, y; XChar2b *buf; - int nchars, bg_width; + int nchars, bg_width, overstrike_p; { CGrafPtr port; float port_height, gx, gy; @@ -1361,10 +1356,17 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width) #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 CGContextSetTextPosition (context, gx, gy); CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); + if (overstrike_p) + { + CGContextSetTextPosition (context, gx + 1.0f, gy); + CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars); + } #else for (i = 0; i < nchars; i++) { CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1); + if (overstrike_p) + CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1); gx += advances[i].width; } #endif @@ -2633,6 +2635,11 @@ mac_compute_glyph_string_overhangs (s) Rect r; MacFontStruct *font = s->font; +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (s->f); +#endif + SetPortWindowPort (FRAME_MAC_WINDOW (s->f)); + TextFont (font->mac_fontnum); TextSize (font->mac_fontsize); TextFace (font->mac_fontface); @@ -2765,15 +2772,18 @@ x_draw_glyph_string_foreground (s) #if USE_CG_TEXT_DRAWING if (!s->two_byte_p && mac_draw_image_string_cg (s->f, s->gc, x, s->ybase - boff, - s->char2b, s->nchars, bg_width)) + s->char2b, s->nchars, bg_width, + s->face->overstrike)) ; else #endif mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff, - s->char2b, s->nchars, bg_width); + s->char2b, s->nchars, bg_width, + s->face->overstrike); else mac_draw_image_string (s->f, s->gc, x, s->ybase - boff, - char1b, s->nchars, bg_width); + char1b, s->nchars, bg_width, + s->face->overstrike); } } @@ -2809,10 +2819,10 @@ x_draw_composite_glyph_string_foreground (s) else { for (i = 0; i < s->nchars; i++, ++s->gidx) - mac_draw_string_16 (s->f, s->gc, - x + s->cmp->offsets[s->gidx * 2], - s->ybase - s->cmp->offsets[s->gidx * 2 + 1], - s->char2b + i, 1); + mac_draw_image_string_16 (s->f, s->gc, + x + s->cmp->offsets[s->gidx * 2], + s->ybase - s->cmp->offsets[s->gidx * 2 + 1], + s->char2b + i, 1, 0, s->face->overstrike); } } @@ -3674,18 +3684,45 @@ x_draw_glyph_string (s) /* Draw underline. */ if (s->face->underline_p) { - unsigned long h = 1; - unsigned long dy = s->height - h; + unsigned long tem, h; + int y; + +#if 0 + /* Get the underline thickness. Default is 1 pixel. */ + if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h)) +#endif + h = 1; + + y = s->y + s->height - h; + if (!x_underline_at_descent_line) + { + /* Get the underline position. This is the recommended + vertical offset in pixels from the baseline to the top of + the underline. This is a signed value according to the + specs, and its default is + + ROUND ((maximum descent) / 2), with + ROUND(x) = floor (x + 0.5) */ + +#if 0 + if (x_use_underline_position_properties + && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) + y = s->ybase + (long) tem; + else +#endif + if (s->face->font) + y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; + } if (s->face->underline_defaulted_p) - mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, + mac_fill_rectangle (s->f, s->gc, s->x, y, s->background_width, h); else { XGCValues xgcv; XGetGCValues (s->display, s->gc, GCForeground, &xgcv); XSetForeground (s->display, s->gc, s->face->underline_color); - mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy, + mac_fill_rectangle (s->f, s->gc, s->x, y, s->background_width, h); XSetForeground (s->display, s->gc, xgcv.foreground); } @@ -5805,6 +5842,57 @@ mac_get_window_bounds (f, inner, outer) #endif /* not TARGET_API_MAC_CARBON */ } +static void +mac_handle_origin_change (f) + struct frame *f; +{ + x_real_positions (f, &f->left_pos, &f->top_pos); +} + +static void +mac_handle_size_change (f, pixelwidth, pixelheight) + struct frame *f; + int pixelwidth, pixelheight; +{ + int cols, rows; + + cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); + + if (cols != FRAME_COLS (f) + || rows != FRAME_LINES (f) + || pixelwidth != FRAME_PIXEL_WIDTH (f) + || pixelheight != FRAME_PIXEL_HEIGHT (f)) + { + /* We pass 1 for DELAY since we can't run Lisp code inside of + a BLOCK_INPUT. */ + change_frame_size (f, rows, cols, 0, 1, 0); + FRAME_PIXEL_WIDTH (f) = pixelwidth; + FRAME_PIXEL_HEIGHT (f) = pixelheight; + SET_FRAME_GARBAGED (f); + + /* If cursor was outside the new size, mark it as off. */ + mark_window_cursors_off (XWINDOW (f->root_window)); + + /* Clear out any recollection of where the mouse highlighting + was, since it might be in a place that's outside the new + frame size. Actually checking whether it is outside is a + pain in the neck, so don't try--just let the highlighting be + done afresh with new size. */ + cancel_mouse_face (f); + +#if TARGET_API_MAC_CARBON + if (f->output_data.mac->hourglass_control) + { +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (f); +#endif + MoveControl (f->output_data.mac->hourglass_control, + pixelwidth - HOURGLASS_WIDTH, 0); + } +#endif + } +} /* Calculate the absolute position in frame F @@ -5885,7 +5973,10 @@ x_set_offset (f, xoff, yoff, change_gravity) ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, kWindowConstrainMoveRegardlessOfFit | kWindowConstrainAllowPartial, NULL, NULL); - x_real_positions (f, &f->left_pos, &f->top_pos); +#if USE_CARBON_EVENTS + if (!NILP (tip_frame) && XFRAME (tip_frame) == f) +#endif + mac_handle_origin_change (f); #else { Rect inner, outer, screen_rect, dummy; @@ -5959,50 +6050,11 @@ x_set_window_size (f, change_gravity, cols, rows) x_wm_set_size_hint (f, (long) 0, 0); SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); -#if TARGET_API_MAC_CARBON - if (f->output_data.mac->hourglass_control) - { -#if USE_CG_DRAWING - mac_prepare_for_quickdraw (f); -#endif - MoveControl (f->output_data.mac->hourglass_control, - pixelwidth - HOURGLASS_WIDTH, 0); - } -#endif - - /* Now, strictly speaking, we can't be sure that this is accurate, - but the window manager will get around to dealing with the size - change request eventually, and we'll hear how it went when the - ConfigureNotify event gets here. - - We could just not bother storing any of this information here, - and let the ConfigureNotify event set everything up, but that - might be kind of confusing to the Lisp code, since size changes - wouldn't be reported in the frame parameters until some random - point in the future when the ConfigureNotify event arrives. - - We pass 1 for DELAY since we can't run Lisp code inside of - a BLOCK_INPUT. */ - change_frame_size (f, rows, cols, 0, 1, 0); - FRAME_PIXEL_WIDTH (f) = pixelwidth; - FRAME_PIXEL_HEIGHT (f) = pixelheight; - - /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to - receive in the ConfigureNotify event; if we get what we asked - for, then the event won't cause the screen to become garbaged, so - we have to make sure to do it here. */ - SET_FRAME_GARBAGED (f); - - XFlush (FRAME_X_DISPLAY (f)); - - /* If cursor was outside the new size, mark it as off. */ - mark_window_cursors_off (XWINDOW (f->root_window)); - /* Clear out any recollection of where the mouse highlighting was, - since it might be in a place that's outside the new frame size. - Actually checking whether it is outside is a pain in the neck, - so don't try--just let the highlighting be done afresh with new size. */ - cancel_mouse_face (f); +#if USE_CARBON_EVENTS + if (!NILP (tip_frame) && f == XFRAME (tip_frame)) +#endif + mac_handle_size_change (f, pixelwidth, pixelheight); UNBLOCK_INPUT; } @@ -6213,7 +6265,10 @@ x_make_frame_visible (f) kWindowCascadeOnParentWindowScreen #endif ); - x_real_positions (f, &f->left_pos, &f->top_pos); +#if USE_CARBON_EVENTS + if (!NILP (tip_frame) && f == XFRAME (tip_frame)) +#endif + mac_handle_origin_change (f); } else #endif @@ -7731,14 +7786,16 @@ is_fully_specified_xlfd (char *p) } -/* XLoadQueryFont creates and returns an internal representation for a - font in a MacFontStruct struct. There is really no concept +/* mac_load_query_font creates and returns an internal representation + for a font in a MacFontStruct struct. There is really no concept corresponding to "loading" a font on the Mac. But we check its existence and find the font number and all other information for it and store them in the returned MacFontStruct. */ static MacFontStruct * -XLoadQueryFont (Display *dpy, char *fontname) +mac_load_query_font (f, fontname) + struct frame *f; + char *fontname; { int size; char *name; @@ -7949,23 +8006,13 @@ XLoadQueryFont (Display *dpy, char *fontname) else #endif { - GrafPtr port; - SInt16 old_fontnum, old_fontsize; - Style old_fontface; FontInfo the_fontinfo; int is_two_byte_font; - /* Save the current font number used. */ - GetPort (&port); -#if TARGET_API_MAC_CARBON - old_fontnum = GetPortTextFont (port); - old_fontsize = GetPortTextSize (port); - old_fontface = GetPortTextFace (port); -#else - old_fontnum = port->txFont; - old_fontsize = port->txSize; - old_fontface = port->txFace; +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (f); #endif + SetPortWindowPort (FRAME_MAC_WINDOW (f)); TextFont (fontnum); TextSize (size); @@ -8047,11 +8094,6 @@ XLoadQueryFont (Display *dpy, char *fontname) for (c = 0x21, pcm = space_bounds + 1; c <= 0xff; c++, pcm++) mac_query_char_extents (NULL, c, NULL, NULL, pcm, NULL); } - - /* Restore previous font number, size and face. */ - TextFont (old_fontnum); - TextSize (old_fontsize); - TextFace (old_fontface); } if (space_bounds) @@ -8070,6 +8112,8 @@ XLoadQueryFont (Display *dpy, char *fontname) pcm->width); font->min_bounds.ascent = min (font->min_bounds.ascent, pcm->ascent); + font->min_bounds.descent = min (font->min_bounds.descent, + pcm->descent); font->max_bounds.lbearing = max (font->max_bounds.lbearing, pcm->lbearing); @@ -8079,6 +8123,8 @@ XLoadQueryFont (Display *dpy, char *fontname) pcm->width); font->max_bounds.ascent = max (font->max_bounds.ascent, pcm->ascent); + font->max_bounds.descent = max (font->max_bounds.descent, + pcm->descent); } if ( #if USE_ATSUI @@ -8187,7 +8233,7 @@ x_load_font (f, fontname, size) fontname = (char *) SDATA (XCAR (font_names)); BLOCK_INPUT; - font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname); + font = mac_load_query_font (f, fontname); UNBLOCK_INPUT; if (!font) return NULL; @@ -8474,7 +8520,7 @@ mac_set_font_info_for_selection (f, face_id, c) #endif #endif /* ! TARGET_API_MAC_CARBON */ -#define M_APPLE 128 +#define M_APPLE 234 #define I_ABOUT 1 #define WINDOW_RESOURCE 128 @@ -9064,10 +9110,10 @@ mac_tsm_suspend () } #endif -static void +#if !TARGET_API_MAC_CARBON +void do_apple_menu (SInt16 menu_item) { -#if !TARGET_API_MAC_CARBON Str255 item_name; SInt16 da_driver_refnum; @@ -9078,43 +9124,8 @@ do_apple_menu (SInt16 menu_item) GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name); da_driver_refnum = OpenDeskAcc (item_name); } -#endif /* !TARGET_API_MAC_CARBON */ -} - -void -do_menu_choice (SInt32 menu_choice) -{ - SInt16 menu_id, menu_item; - - menu_id = HiWord (menu_choice); - menu_item = LoWord (menu_choice); - - switch (menu_id) - { - case 0: - break; - - case M_APPLE: - do_apple_menu (menu_item); - break; - - default: - { - struct frame *f = mac_focus_frame (&one_mac_display_info); - MenuHandle menu = GetMenuHandle (menu_id); - if (menu) - { - UInt32 refcon; - - GetMenuItemRefCon (menu, menu_item, &refcon); - menubar_selection_callback (f, refcon); - } - } - } - - HiliteMenu (0); } - +#endif /* !TARGET_API_MAC_CARBON */ /* Handle drags in size box. Based on code contributed by Ben Mesander and IM - Window Manager A. */ @@ -9165,6 +9176,32 @@ do_grow_window (WindowPtr w, EventRecord *e) } +#if TARGET_API_MAC_CARBON +static Point +mac_get_ideal_size (f) + struct frame *f; +{ + struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); + WindowPtr w = FRAME_MAC_WINDOW (f); + Point ideal_size; + Rect standard_rect; + int height, width, columns, rows; + + ideal_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); + ideal_size.v = dpyinfo->height; + IsWindowInStandardState (w, &ideal_size, &standard_rect); + /* Adjust the standard size according to character boundaries. */ + width = standard_rect.right - standard_rect.left; + height = standard_rect.bottom - standard_rect.top; + columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); + ideal_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns); + ideal_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); + + return ideal_size; +} +#endif + /* Handle clicks in zoom box. Calculation of "standard state" based on code in IM - Window Manager A and code contributed by Ben Mesander. The standard state of an Emacs window is 80-characters @@ -9174,39 +9211,28 @@ static void do_zoom_window (WindowPtr w, int zoom_in_or_out) { Rect zoom_rect, port_rect; - int columns, rows, width, height; + int width, height; struct frame *f = mac_window_to_frame (w); - struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); #if TARGET_API_MAC_CARBON - Point standard_size; + Point ideal_size = mac_get_ideal_size (f); - standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); - standard_size.v = dpyinfo->height; - - if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) + GetWindowBounds (w, kWindowContentRgn, &port_rect); + if (IsWindowInStandardState (w, &ideal_size, &zoom_rect) + && port_rect.left == zoom_rect.left + && port_rect.top == zoom_rect.top) zoom_in_or_out = inZoomIn; else - { - /* Adjust the standard size according to character boundaries. */ + zoom_in_or_out = inZoomOut; - columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left); - rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top); - standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns); - standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); - GetWindowBounds (w, kWindowContentRgn, &port_rect); - if (IsWindowInStandardState (w, &standard_size, &zoom_rect) - && port_rect.left == zoom_rect.left - && port_rect.top == zoom_rect.top) - zoom_in_or_out = inZoomIn; - else - zoom_in_or_out = inZoomOut; - } - - ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); +#ifdef MAC_OS8 + mac_clear_window (f); +#endif + ZoomWindowIdeal (w, zoom_in_or_out, &ideal_size); #else /* not TARGET_API_MAC_CARBON */ GrafPtr save_port; Point top_left; - int w_title_height; + int w_title_height, rows; + struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); GetPort (&save_port); @@ -9245,6 +9271,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) SetPort (save_port); #endif /* not TARGET_API_MAC_CARBON */ +#if !USE_CARBON_EVENTS /* retrieve window size and update application values */ #if TARGET_API_MAC_CARBON GetWindowPortBounds (w, &port_rect); @@ -9254,20 +9281,9 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) height = port_rect.bottom - port_rect.top; width = port_rect.right - port_rect.left; - if (width != FRAME_PIXEL_WIDTH (f) - || height != FRAME_PIXEL_HEIGHT (f)) - { - rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); - columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); - - change_frame_size (f, rows, columns, 0, 1, 0); - SET_FRAME_GARBAGED (f); - cancel_mouse_face (f); - - FRAME_PIXEL_WIDTH (f) = width; - FRAME_PIXEL_HEIGHT (f) = height; - } - x_real_positions (f, &f->left_pos, &f->top_pos); + mac_handle_size_change (f, width, height); + mac_handle_origin_change (f); +#endif } void @@ -9406,6 +9422,7 @@ mac_handle_window_event (next_handler, event, data) { WindowPtr wp; OSStatus result, err; + struct frame *f; UInt32 attributes; XSizeHints *size_hints; @@ -9414,6 +9431,7 @@ mac_handle_window_event (next_handler, event, data) if (err != noErr) return eventNotHandledErr; + f = mac_window_to_frame (wp); switch (GetEventKind (event)) { case kEventWindowUpdate: @@ -9424,6 +9442,21 @@ mac_handle_window_event (next_handler, event, data) do_window_update (wp); return noErr; + case kEventWindowGetIdealSize: + result = CallNextEventHandler (next_handler, event); + if (result != eventNotHandledErr) + return result; + + { + Point ideal_size = mac_get_ideal_size (f); + + err = SetEventParameter (event, kEventParamDimensions, + typeQDPoint, sizeof (Point), &ideal_size); + if (err == noErr) + return noErr; + } + break; + case kEventWindowBoundsChanging: result = CallNextEventHandler (next_handler, event); if (result != eventNotHandledErr) @@ -9434,7 +9467,7 @@ mac_handle_window_event (next_handler, event, data) if (err != noErr) break; - size_hints = FRAME_SIZE_HINTS (mac_window_to_frame (wp)); + size_hints = FRAME_SIZE_HINTS (f); if ((attributes & kWindowBoundsChangeUserResize) && ((size_hints->flags & (PResizeInc | PBaseSize | PMinSize)) == (PResizeInc | PBaseSize | PMinSize))) @@ -9475,17 +9508,58 @@ mac_handle_window_event (next_handler, event, data) } break; + case kEventWindowBoundsChanged: + err = GetEventParameter (event, kEventParamAttributes, typeUInt32, + NULL, sizeof (UInt32), NULL, &attributes); + if (err != noErr) + break; + + if (attributes & kWindowBoundsChangeSizeChanged) + { + Rect bounds; + + err = GetEventParameter (event, kEventParamCurrentBounds, + typeQDRectangle, NULL, sizeof (Rect), + NULL, &bounds); + if (err == noErr) + { + int width, height; + + width = bounds.right - bounds.left; + height = bounds.bottom - bounds.top; + mac_handle_size_change (f, width, height); + } + } + + if (attributes & kWindowBoundsChangeOriginChanged) + mac_handle_origin_change (f); + + return noErr; + case kEventWindowShown: case kEventWindowHidden: case kEventWindowExpanded: case kEventWindowCollapsed: result = CallNextEventHandler (next_handler, event); - mac_handle_visibility_change (mac_window_to_frame (wp)); + mac_handle_visibility_change (f); return noErr; break; + case kEventWindowClose: + result = CallNextEventHandler (next_handler, event); + { + struct input_event buf; + + EVENT_INIT (buf); + buf.kind = DELETE_WINDOW_EVENT; + XSETFRAME (buf.frame_or_window, f); + buf.arg = Qnil; + kbd_buffer_store_event (&buf); + } + return noErr; + #ifdef MAC_OSX case kEventWindowToolbarSwitchMode: result = CallNextEventHandler (next_handler, event); @@ -9775,6 +9849,8 @@ mac_handle_text_input_event (next_handler, event, data) read_socket_inev->kind = ASCII_KEYSTROKE_EVENT; read_socket_inev->code = code; read_socket_inev->modifiers = + mac_to_emacs_modifiers (modifiers); + read_socket_inev->modifiers |= (extra_keyboard_modifiers & (meta_modifier | alt_modifier | hyper_modifier | super_modifier)); @@ -9894,11 +9970,14 @@ install_window_handler (window) #if USE_CARBON_EVENTS EventTypeSpec specs_window[] = {{kEventClassWindow, kEventWindowUpdate}, + {kEventClassWindow, kEventWindowGetIdealSize}, {kEventClassWindow, kEventWindowBoundsChanging}, + {kEventClassWindow, kEventWindowBoundsChanged}, {kEventClassWindow, kEventWindowShown}, {kEventClassWindow, kEventWindowHidden}, {kEventClassWindow, kEventWindowExpanded}, {kEventClassWindow, kEventWindowCollapsed}, + {kEventClassWindow, kEventWindowClose}, #ifdef MAC_OSX {kEventClassWindow, kEventWindowToolbarSwitchMode}, #endif @@ -10457,12 +10536,14 @@ XTread_socket (sd, expected, hold_quit) DragWindow (window_ptr, er.where, &qd.screenBits.bounds); #endif /* not TARGET_API_MAC_CARBON */ /* Update the frame parameters. */ +#if !USE_CARBON_EVENTS { struct frame *f = mac_window_to_frame (window_ptr); if (f && !f->async_iconified) - x_real_positions (f, &f->left_pos, &f->top_pos); + mac_handle_origin_change (f); } +#endif break; case inGoAway: @@ -10561,7 +10642,7 @@ XTread_socket (sd, expected, hold_quit) else { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; @@ -11571,6 +11652,14 @@ to 4.1, set this to nil. NOTE: Not supported on Mac yet. */); x_use_underline_position_properties = 0; + DEFVAR_BOOL ("x-underline-at-descent-line", + &x_underline_at_descent_line, + doc: /* *Non-nil means to draw the underline at the same place as the descent line. +nil means to draw the underline according to the value of the variable +`x-use-underline-position-properties', which is usually at the baseline +level. The default value is nil. */); + x_underline_at_descent_line = 0; + DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, doc: /* If not nil, Emacs uses toolkit scroll bars. */); #ifdef USE_TOOLKIT_SCROLL_BARS diff --git a/src/macterm.h b/src/macterm.h index 659a13bbb17..e33f939940c 100644 --- a/src/macterm.h +++ b/src/macterm.h @@ -226,7 +226,8 @@ struct x_output }; /* The collection of data describing a window on the Mac. */ -struct mac_output { +struct mac_output +{ /* Placeholder for things accessed through output_data.x. Must appear first. */ struct x_output x_compatible; @@ -316,9 +317,6 @@ struct mac_output { /* Nonzero means tried already to make this frame visible. */ char asked_for_visible; - /* Nonzero means menubar is currently active. */ - char menubar_active; - /* Relief GCs, colors etc. */ struct relief { @@ -626,8 +624,10 @@ extern OSStatus mac_show_hide_font_panel P_ ((void)); extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); extern OSStatus install_window_handler P_ ((WindowPtr)); extern void remove_window_handler P_ ((WindowPtr)); -extern void do_menu_choice P_ ((SInt32)); extern OSStatus mac_post_mouse_moved_event P_ ((void)); +#if !TARGET_API_MAC_CARBON +extern void do_apple_menu P_ ((SInt16)); +#endif #if USE_CG_DRAWING extern void mac_prepare_for_quickdraw P_ ((struct frame *)); #endif diff --git a/src/makefile.w32-in b/src/makefile.w32-in index a94938a0b80..c2367ba30e4 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -678,6 +678,8 @@ $(BLD)/fns.$(O) : \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/src/config.h \ + $(EMACS_ROOT)/nt/inc/langinfo.h \ + $(EMACS_ROOT)/nt/inc/nl_types.h \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ $(SRC)/buffer.h \ @@ -993,6 +995,8 @@ $(BLD)/w32proc.$(O) : \ $(SRC)/w32proc.c \ $(SRC)/s/ms-w32.h \ $(SRC)/m/intel386.h \ + $(EMACS_ROOT)/nt/inc/langinfo.h \ + $(EMACS_ROOT)/nt/inc/nl_types.h \ $(SRC)/config.h \ $(SRC)/process.h \ $(SRC)/syssignal.h \ diff --git a/src/marker.c b/src/marker.c index 20b660ddadd..48685e7d27c 100644 --- a/src/marker.c +++ b/src/marker.c @@ -460,7 +460,8 @@ Returns nil if MARKER points into a dead buffer. */) } DEFUN ("marker-position", Fmarker_position, Smarker_position, 1, 1, 0, - doc: /* Return the position MARKER points at, as a character number. */) + doc: /* Return the position MARKER points at, as a character number. +Returns nil if MARKER points nowhere. */) (marker) Lisp_Object marker; { diff --git a/src/md5.c b/src/md5.c index d3c25b04d3e..0daf2c3ef7c 100644 --- a/src/md5.c +++ b/src/md5.c @@ -5,17 +5,17 @@ This file is part of the GNU Emacs. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, + You should have received a copy of the GNU General Public + License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/md5.h b/src/md5.h index 09bf02ff753..202b2749504 100644 --- a/src/md5.h +++ b/src/md5.h @@ -5,17 +5,17 @@ This file is part of GNU Emacs. The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, + You should have received a copy of the GNU General Public + License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/minibuf.c b/src/minibuf.c index e4296ad8cd2..8924668db52 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1027,7 +1027,7 @@ DEFUN ("read-minibuffer", Fread_minibuffer, Sread_minibuffer, 1, 2, 0, Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS is a string to insert in the minibuffer before reading. \(INITIAL-CONTENTS can also be a cons of a string and an integer. Such -arguments are used as in `read-from-minibuffer') */) +arguments are used as in `read-from-minibuffer'.) */) (prompt, initial_contents) Lisp_Object prompt, initial_contents; { @@ -1201,8 +1201,8 @@ The argument PROMPT should be a string ending with a colon and a space. */) prompt = Fformat (3, args); } - return Fcompleting_read (prompt, Vbuffer_alist, Qnil, - require_match, Qnil, Qbuffer_name_history, + return Fcompleting_read (prompt, intern ("internal-complete-buffer"), + Qnil, require_match, Qnil, Qbuffer_name_history, def, Qnil); } else @@ -1911,6 +1911,24 @@ the values STRING, PREDICATE and `lambda'. */) return Qt; } +DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0, + doc: /* Perform completion on buffer names. +If the argument FLAG is nil, invoke `try-completion', if it's t, invoke +`all-completions', otherwise invoke `test-completion'. + +The arguments STRING and PREDICATE are as in `try-completion', +`all-completions', and `test-completion'. */) + (string, predicate, flag) + Lisp_Object string, predicate, flag; +{ + if (NILP (flag)) + return Ftry_completion (string, Vbuffer_alist, predicate); + else if (EQ (flag, Qt)) + return Fall_completions (string, Vbuffer_alist, predicate, Qt); + else /* assume `lambda' */ + return Ftest_completion (string, Vbuffer_alist, predicate); +} + /* returns: * 0 no possible completion * 1 was already an exact and unique completion @@ -2399,7 +2417,7 @@ The optional second arg COMMON-SUBSTRING is a string. It is used to put faces, `completions-first-difference' and `completions-common-part' on the completion buffer. The `completions-common-part' face is put on the common substring -specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil +specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil and the current buffer is not the minibuffer, the faces are not put. Internally, COMMON-SUBSTRING is bound to `completion-common-substring' during running `completion-setup-hook'. */) @@ -2680,6 +2698,8 @@ If no minibuffer is active, return nil. */) that has no possible completions, and other quick, unobtrusive messages. */ +extern Lisp_Object Vminibuffer_message_timeout; + void temp_echo_area_glyphs (string) Lisp_Object string; @@ -2698,7 +2718,12 @@ temp_echo_area_glyphs (string) insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0); SET_PT_BOTH (opoint, opoint_byte); Vinhibit_quit = Qt; - sit_for (make_number (2), 0, 2); + + if (NUMBERP (Vminibuffer_message_timeout)) + sit_for (Vminibuffer_message_timeout, 0, 2); + else + sit_for (Qt, 0, 2); + del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1); SET_PT_BOTH (opoint, opoint_byte); if (!NILP (Vquit_flag)) @@ -2921,6 +2946,7 @@ properties. */); defsubr (&Sread_string); defsubr (&Sread_command); defsubr (&Sread_variable); + defsubr (&Sinternal_complete_buffer); defsubr (&Sread_buffer); defsubr (&Sread_no_blanks_input); defsubr (&Sminibuffer_depth); diff --git a/src/msdos.c b/src/msdos.c index b6f6a75ac60..8595c8f6ce9 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -3381,7 +3381,7 @@ dos_rawgetc () } /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { mouse_window = window_from_coordinates (SELECTED_FRAME(), mouse_last_x, diff --git a/src/print.c b/src/print.c index d5ff1be6b31..5d650813458 100644 --- a/src/print.c +++ b/src/print.c @@ -216,7 +216,7 @@ int print_output_debug_flag = 1; if (MARKERP (printcharfun)) \ { \ EMACS_INT marker_pos; \ - if (!(XMARKER (printcharfun)->buffer)) \ + if (! XMARKER (printcharfun)->buffer) \ error ("Marker does not point anywhere"); \ if (XMARKER (printcharfun)->buffer != current_buffer) \ set_buffer_internal (XMARKER (printcharfun)->buffer); \ @@ -289,7 +289,7 @@ int print_output_debug_flag = 1; SET_PT_BOTH (old_point + (old_point >= start_point \ ? PT - start_point : 0), \ old_point_byte + (old_point_byte >= start_point_byte \ - ? PT_BYTE - start_point_byte : 0)); \ + ? PT_BYTE - start_point_byte : 0)); \ if (old != current_buffer) \ set_buffer_internal (old); @@ -364,7 +364,10 @@ printchar (ch, fun) print_buffer. PRINTCHARFUN t means output to the echo area or to stdout if non-interactive. If neither nil nor t, call Lisp function PRINTCHARFUN for each character printed. MULTIBYTE - non-zero means PTR contains multibyte characters. */ + non-zero means PTR contains multibyte characters. + + In the case where PRINTCHARFUN is nil, it is safe for PTR to point + to data in a Lisp string. Otherwise that is not safe. */ static void strout (ptr, size, size_byte, printcharfun, multibyte) @@ -413,7 +416,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte) if (size == size_byte) { for (i = 0; i < size; ++i) - insert_char ((unsigned char )*ptr++); + insert_char ((unsigned char) *ptr++); } else { @@ -497,10 +500,29 @@ print_string (string, printcharfun) else chars = SBYTES (string); - /* strout is safe for output to a frame (echo area) or to print_buffer. */ - strout (SDATA (string), - chars, SBYTES (string), - printcharfun, STRING_MULTIBYTE (string)); + if (EQ (printcharfun, Qt)) + { + /* Output to echo area. */ + int nbytes = SBYTES (string); + char *buffer; + + /* Copy the string contents so that relocation of STRING by + GC does not cause trouble. */ + USE_SAFE_ALLOCA; + + SAFE_ALLOCA (buffer, char *, nbytes); + bcopy (SDATA (string), buffer, nbytes); + + strout (buffer, chars, SBYTES (string), + printcharfun, STRING_MULTIBYTE (string)); + + SAFE_FREE (); + } + else + /* No need to copy, since output to print_buffer can't GC. */ + strout (SDATA (string), + chars, SBYTES (string), + printcharfun, STRING_MULTIBYTE (string)); } else { @@ -934,7 +956,7 @@ debug_output_compilation_hack (x) print_output_debug_flag = x; } -#if defined(GNU_LINUX) +#if defined (GNU_LINUX) /* This functionality is not vitally important in general, so we rely on non-portable ability to use stderr as lvalue. */ @@ -954,7 +976,7 @@ append to existing target file. */) Lisp_Object file, append; { if (initial_stderr_stream != NULL) - fclose(stderr); + fclose (stderr); stderr = initial_stderr_stream; initial_stderr_stream = NULL; @@ -962,7 +984,7 @@ append to existing target file. */) { file = Fexpand_file_name (file, Qnil); initial_stderr_stream = stderr; - stderr = fopen(SDATA (file), NILP (append) ? "w" : "a"); + stderr = fopen (SDATA (file), NILP (append) ? "w" : "a"); if (stderr == NULL) { stderr = initial_stderr_stream; @@ -2030,7 +2052,7 @@ print_object (obj, printcharfun, escapeflag) /* Do you think this is necessary? */ if (XMARKER (obj)->insertion_type != 0) strout ("(moves after insertion) ", -1, -1, printcharfun, 0); - if (!(XMARKER (obj)->buffer)) + if (! XMARKER (obj)->buffer) strout ("in no buffer", -1, -1, printcharfun, 0); else { @@ -2044,7 +2066,7 @@ print_object (obj, printcharfun, escapeflag) case Lisp_Misc_Overlay: strout ("#<overlay ", -1, -1, printcharfun, 0); - if (!(XMARKER (OVERLAY_START (obj))->buffer)) + if (! XMARKER (OVERLAY_START (obj))->buffer) strout ("in no buffer", -1, -1, printcharfun, 0); else { @@ -2091,8 +2113,8 @@ print_object (obj, printcharfun, escapeflag) case Lisp_Misc_Kboard_Objfwd: strout ("#<kboard_objfwd to ", -1, -1, printcharfun, 0); - print_object (*(Lisp_Object *)((char *) current_kboard - + XKBOARD_OBJFWD (obj)->offset), + print_object (*(Lisp_Object *) ((char *) current_kboard + + XKBOARD_OBJFWD (obj)->offset), printcharfun, escapeflag); PRINTCHAR ('>'); break; @@ -2178,7 +2200,7 @@ print_interval (interval, printcharfun) print_object (make_number (interval->position), printcharfun, 1); PRINTCHAR (' '); print_object (make_number (interval->position + LENGTH (interval)), - printcharfun, 1); + printcharfun, 1); PRINTCHAR (' '); print_object (interval->plist, printcharfun, 1); } diff --git a/src/process.c b/src/process.c index f8ae50e8652..9062e6c3d6e 100644 --- a/src/process.c +++ b/src/process.c @@ -318,6 +318,12 @@ static int read_process_output P_ ((Lisp_Object, int)); #define POLL_FOR_INPUT #endif +static Lisp_Object get_process (); +static void exec_sentinel (); + +extern EMACS_TIME timer_check (); +extern int timers_run; + /* Mask of bits indicating the descriptors that we wait for input on. */ static SELECT_TYPE input_wait_mask; @@ -386,15 +392,13 @@ struct sockaddr_and_len { #define DATAGRAM_CONN_P(proc) (0) #endif -static Lisp_Object get_process (); -static void exec_sentinel (); - -extern EMACS_TIME timer_check (); -extern int timers_run; - /* Maximum number of bytes to send to a pty without an eof. */ static int pty_max_bytes; +/* Nonzero means don't run process sentinels. This is used + when exiting. */ +int inhibit_sentinels; + #ifdef HAVE_PTYS #ifdef HAVE_PTY_H #include <pty.h> @@ -1310,6 +1314,7 @@ list_processes_1 (query_only) register struct Lisp_Process *p; char tembuf[300]; int w_proc, w_buffer, w_tty; + int exited = 0; Lisp_Object i_status, i_buffer, i_tty, i_command; w_proc = 4; /* Proc */ @@ -1436,8 +1441,8 @@ list_processes_1 (query_only) } } - if (EQ (symbol, Qsignal) || EQ (symbol, Qexit)) - remove_process (proc); + if (EQ (symbol, Qsignal) || EQ (symbol, Qexit) || EQ (symbol, Qclosed)) + exited++; Findent_to (i_buffer, minspace); if (NILP (p->buffer)) @@ -1501,6 +1506,8 @@ list_processes_1 (query_only) insert_string ("\n"); } } + if (exited) + status_notify (NULL); return Qnil; } @@ -6564,6 +6571,9 @@ exec_sentinel (proc, reason) int outer_running_asynch_code = running_asynch_code; int waiting = waiting_for_user_input_p; + if (inhibit_sentinels) + return; + /* No need to gcpro these, because all we do with them later is test them for EQness, and none of them should be a string. */ odeactivate = Vdeactivate_mark; @@ -6885,6 +6895,8 @@ init_process () { register int i; + inhibit_sentinels = 0; + #ifdef SIGCHLD #ifndef CANNOT_DUMP if (! noninteractive || initialized) diff --git a/src/process.h b/src/process.h index b585515d6b1..fcf8d9b6c1f 100644 --- a/src/process.h +++ b/src/process.h @@ -161,5 +161,9 @@ extern int synch_process_retcode; #define NULL_DEVICE "/dev/null" #endif +/* Nonzero means don't run process sentinels. This is used + when exiting. */ +extern int inhibit_sentinels; + /* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72 (do not change this comment) */ diff --git a/src/regex.c b/src/regex.c index 846c87041b1..ae80ad0cee8 100644 --- a/src/regex.c +++ b/src/regex.c @@ -2530,6 +2530,7 @@ regex_compile (pattern, size, syntax, bufp) bufp->syntax = syntax; bufp->fastmap_accurate = 0; bufp->not_bol = bufp->not_eol = 0; + bufp->used_syntax = 0; /* Set `used' to zero, so that if we return an error, the pattern printer (for debugging) will think there's no pattern. We reset it @@ -2942,6 +2943,14 @@ regex_compile (pattern, size, syntax, bufp) SET_LIST_BIT (translated); } + /* In most cases the matching rule for char classes + only uses the syntax table for multibyte chars, + so that the content of the syntax-table it is not + hardcoded in the range_table. SPACE and WORD are + the two exceptions. */ + if ((1 << cc) & ((1 << RECC_SPACE) | (1 << RECC_WORD))) + bufp->used_syntax = 1; + /* Repeat the loop. */ continue; } @@ -3877,11 +3886,13 @@ analyse_first (p, pend, fastmap, multibyte) if (fastmap) { int c = RE_STRING_CHAR (p + 1, pend - p); - + /* When fast-scanning, the fastmap can be indexed either with + a char (smaller than 256) or with the first byte of + a char's byte sequence. So we have to conservatively add + both to the table. */ if (SINGLE_BYTE_CHAR_P (c)) fastmap[c] = 1; - else - fastmap[p[1]] = 1; + fastmap[p[1]] = 1; } break; @@ -3899,6 +3910,10 @@ analyse_first (p, pend, fastmap, multibyte) So any that are not listed in the charset are possible matches, even in multibyte buffers. */ if (!fastmap) break; + /* We don't need to mark LEADING_CODE_8_BIT_CONTROL specially + because it will automatically be set when needed by virtue of + being larger than the highest char of its charset (0xbf) but + smaller than (1<<BYTEWIDTH). */ for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) fastmap[j] = 1; @@ -3909,7 +3924,13 @@ analyse_first (p, pend, fastmap, multibyte) for (j = CHARSET_BITMAP_SIZE (&p[-1]) * BYTEWIDTH - 1, p++; j >= 0; j--) if (!!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) ^ not) - fastmap[j] = 1; + { + fastmap[j] = 1; +#ifdef emacs + if (j >= 0x80 && j < 0xa0) + fastmap[LEADING_CODE_8_BIT_CONTROL] = 1; +#endif + } if ((not && multibyte) /* Any character set can possibly contain a character @@ -4352,11 +4373,33 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) } } else - while (range > lim && !fastmap[*d]) + do { - d++; - range--; - } + re_char *d_start = d; + while (range > lim && !fastmap[*d]) + { + d++; + range--; + } +#ifdef emacs + if (multibyte && range > lim) + { + /* Check that we are at the beginning of a char. */ + int at_boundary; + AT_CHAR_BOUNDARY_P (at_boundary, d, d_start); + if (at_boundary) + break; + else + { /* We have matched an internal byte of a char + rather than the leading byte, so it's a false + positive: we should keep scanning. */ + d++; range--; + } + } + else +#endif + break; + } while (1); startpos += irange - range; } @@ -6197,6 +6240,10 @@ re_compile_pattern (pattern, length, bufp) { reg_errcode_t ret; +#ifdef emacs + gl_state.current_syntax_table = current_buffer->syntax_table; +#endif + /* GNU code is written to assume at least RE_NREGS registers will be set (and at least one extra will be -1). */ bufp->regs_allocated = REGS_UNALLOCATED; diff --git a/src/regex.h b/src/regex.h index c850c640b36..14817c35e90 100644 --- a/src/regex.h +++ b/src/regex.h @@ -392,6 +392,10 @@ struct re_pattern_buffer /* Similarly for an end-of-line anchor. */ unsigned not_eol : 1; + /* If true, the compilation of the pattern had to look up the syntax table, + so the compiled pattern is only valid for the current syntax table. */ + unsigned used_syntax : 1; + #ifdef emacs /* If true, multi-byte form in the `buffer' should be recognized as a multibyte character. */ @@ -614,13 +618,5 @@ extern void re_set_whitespace_regexp (const char *regexp); #endif /* regex.h */ -/* -Local variables: -make-backup-files: t -version-control: t -trim-versions-without-asking: nil -End: -*/ - /* arch-tag: bda6e3ec-3c02-4237-a55a-01ad2e120083 (do not change this comment) */ diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h index 817f1facdee..55d9a725293 100644 --- a/src/s/gnu-linux.h +++ b/src/s/gnu-linux.h @@ -142,8 +142,12 @@ Boston, MA 02110-1301, USA. */ movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and HAVE_MAILLOCK_H are defined, so the following appears to be the correct logic. -- fx */ +/* We must check for HAVE_LIBLOCKFILE too, as movemail does. + liblockfile is a Free Software replacement for libmail, used on + Debian systems and elsewhere. -rfr */ -#if !(defined (HAVE_LIBMAIL) && defined (HAVE_MAILLOCK_H)) +#if !((defined (HAVE_LIBMAIL) || defined (HAVE_LIBLOCKFILE)) && \ + defined (HAVE_MAILLOCK_H)) #define MAIL_USE_FLOCK #endif diff --git a/src/search.c b/src/search.c index 5d532a9d8dd..7c3151b76b8 100644 --- a/src/search.c +++ b/src/search.c @@ -42,6 +42,10 @@ struct regexp_cache { struct regexp_cache *next; Lisp_Object regexp, whitespace_regexp; + /* Syntax table for which the regexp applies. We need this because + of character classes. If this is t, then the compiled pattern is valid + for any syntax-table. */ + Lisp_Object syntax_table; struct re_pattern_buffer buf; char fastmap[0400]; /* Nonzero means regexp was compiled to do full POSIX backtracking. */ @@ -167,7 +171,11 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) cp->posix = posix; cp->buf.multibyte = multibyte; cp->whitespace_regexp = Vsearch_spaces_regexp; - BLOCK_INPUT; + /* rms: I think BLOCK_INPUT is not needed here any more, + because regex.c defines malloc to call xmalloc. + Using BLOCK_INPUT here means the debugger won't run if an error occurs. + So let's turn it off. */ + /* BLOCK_INPUT; */ old = re_set_syntax (RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); @@ -177,10 +185,14 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) val = (char *) re_compile_pattern ((char *)raw_pattern, raw_pattern_size, &cp->buf); + /* If the compiled pattern hard codes some of the contents of the + syntax-table, it can only be reused with *this* syntax table. */ + cp->syntax_table = cp->buf.used_syntax ? current_buffer->syntax_table : Qt; + re_set_whitespace_regexp (NULL); re_set_syntax (old); - UNBLOCK_INPUT; + /* UNBLOCK_INPUT; */ if (val) xsignal1 (Qinvalid_regexp, build_string (val)); @@ -204,6 +216,24 @@ shrink_regexp_cache () } } +/* Clear the regexp cache w.r.t. a particular syntax table, + because it was changed. + There is no danger of memory leak here because re_compile_pattern + automagically manages the memory in each re_pattern_buffer struct, + based on its `allocated' and `buffer' values. */ +void +clear_regexp_cache () +{ + int i; + + for (i = 0; i < REGEXP_CACHE_SIZE; ++i) + /* It's tempting to compare with the syntax-table we've actually changd, + but it's not sufficient because char-table inheritance mewans that + modifying one syntax-table can change others at the same time. */ + if (!EQ (searchbufs[i].syntax_table, Qt)) + searchbufs[i].regexp = Qnil; +} + /* Compile a regexp if necessary, but first check to see if there's one in the cache. PATTERN is the pattern to compile. @@ -240,6 +270,8 @@ compile_pattern (pattern, regp, translate, posix, multibyte) && EQ (cp->buf.translate, (! NILP (translate) ? translate : make_number (0))) && cp->posix == posix && cp->buf.multibyte == multibyte + && (EQ (cp->syntax_table, Qt) + || EQ (cp->syntax_table, current_buffer->syntax_table)) && !NILP (Fequal (cp->whitespace_regexp, Vsearch_spaces_regexp))) break; @@ -284,6 +316,10 @@ looking_at_1 (string, posix) if (running_asynch_code) save_search_regs (); + /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] + = current_buffer->case_eqv_table; + CHECK_STRING (string); bufp = compile_pattern (string, &search_regs, (!NILP (current_buffer->case_fold_search) @@ -391,6 +427,10 @@ string_match_1 (regexp, string, start, posix) pos_byte = string_char_to_byte (string, pos); } + /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] + = current_buffer->case_eqv_table; + bufp = compile_pattern (regexp, &search_regs, (!NILP (current_buffer->case_fold_search) ? current_buffer->case_canon_table : Qnil), @@ -930,6 +970,10 @@ search_command (string, bound, noerror, count, direction, RE, posix) lim_byte = CHAR_TO_BYTE (lim); } + /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] + = current_buffer->case_eqv_table; + np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, (!NILP (current_buffer->case_fold_search) ? current_buffer->case_canon_table @@ -3086,8 +3130,10 @@ syms_of_search () searchbufs[i].buf.fastmap = searchbufs[i].fastmap; searchbufs[i].regexp = Qnil; searchbufs[i].whitespace_regexp = Qnil; + searchbufs[i].syntax_table = Qnil; staticpro (&searchbufs[i].regexp); staticpro (&searchbufs[i].whitespace_regexp); + staticpro (&searchbufs[i].syntax_table); searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); } searchbuf_head = &searchbufs[0]; diff --git a/src/strftime.c b/src/strftime.c index f46b40f232a..123763d8845 100644 --- a/src/strftime.c +++ b/src/strftime.c @@ -7,17 +7,17 @@ This file is part of the GNU Emacs. This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License + modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, + You should have received a copy of the GNU General Public + License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ diff --git a/src/syntax.c b/src/syntax.c index eee9151f878..052191d5fef 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -1039,6 +1039,11 @@ usage: (modify-syntax-entry CHAR NEWENTRY &optional SYNTAX-TABLE) */) check_syntax_table (syntax_table); SET_RAW_SYNTAX_ENTRY (syntax_table, XINT (c), Fstring_to_syntax (newentry)); + + /* We clear the regexp cache, since character classes can now have + different values from those in the compiled regexps.*/ + clear_regexp_cache (); + return Qnil; } diff --git a/src/textprop.c b/src/textprop.c index fd70f039d22..a039c17ae64 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1001,17 +1001,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) && (NILP (limit) || next->position < XFASTINT (limit))) next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) - ? SCHARS (object) - : BUF_ZV (XBUFFER (object)))); - if (!(next->position < XFASTINT (limit))) + if (NULL_INTERVAL_P (next) + || (next->position + >= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) + ? SCHARS (object) + : BUF_ZV (XBUFFER (object)))))) return limit; - - XSETFASTINT (position, next->position); - return position; + else + return make_number (next->position); } /* Return 1 if there's a change in some property between BEG and END. */ @@ -1083,16 +1082,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) && (NILP (limit) || next->position < XFASTINT (limit))) next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) - ? SCHARS (object) - : BUF_ZV (XBUFFER (object)))); - if (!(next->position < XFASTINT (limit))) + if (NULL_INTERVAL_P (next) + || (next->position + >= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) + ? SCHARS (object) + : BUF_ZV (XBUFFER (object)))))) return limit; - - return make_number (next->position); + else + return make_number (next->position); } DEFUN ("previous-property-change", Fprevious_property_change, @@ -1132,14 +1131,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) && (NILP (limit) || (previous->position + LENGTH (previous) > XFASTINT (limit)))) previous = previous_interval (previous); - if (NULL_INTERVAL_P (previous)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); - if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) - return limit; - return make_number (previous->position + LENGTH (previous)); + if (NULL_INTERVAL_P (previous) + || (previous->position + LENGTH (previous) + <= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))))) + return limit; + else + return make_number (previous->position + LENGTH (previous)); } DEFUN ("previous-single-property-change", Fprevious_single_property_change, @@ -1184,14 +1184,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) && (NILP (limit) || (previous->position + LENGTH (previous) > XFASTINT (limit)))) previous = previous_interval (previous); - if (NULL_INTERVAL_P (previous)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); - if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) - return limit; - return make_number (previous->position + LENGTH (previous)); + if (NULL_INTERVAL_P (previous) + || (previous->position + LENGTH (previous) + <= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))))) + return limit; + else + return make_number (previous->position + LENGTH (previous)); } /* Callers note, this can GC when OBJECT is a buffer (or nil). */ @@ -1253,7 +1254,7 @@ Return t if any property value actually changed, nil otherwise. */) } if (BUFFERP (object)) - modify_region (XBUFFER (object), XINT (start), XINT (end)); + modify_region (XBUFFER (object), XINT (start), XINT (end), 1); /* We are at the beginning of interval I, with LEN chars to scan. */ for (;;) @@ -1393,7 +1394,7 @@ set_text_properties (start, end, properties, object, signal_after_change_p) } if (BUFFERP (object)) - modify_region (XBUFFER (object), XINT (start), XINT (end)); + modify_region (XBUFFER (object), XINT (start), XINT (end), 1); set_text_properties_1 (start, end, properties, object, i); @@ -1541,7 +1542,7 @@ Use set-text-properties if you want to remove all text properties. */) } if (BUFFERP (object)) - modify_region (XBUFFER (object), XINT (start), XINT (end)); + modify_region (XBUFFER (object), XINT (start), XINT (end), 1); /* We are at the beginning of an interval, with len to scan */ for (;;) @@ -1655,7 +1656,7 @@ Return t if any property was actually removed, nil otherwise. */) if (LENGTH (i) == len) { if (!modified && BUFFERP (object)) - modify_region (XBUFFER (object), XINT (start), XINT (end)); + modify_region (XBUFFER (object), XINT (start), XINT (end), 1); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), @@ -1668,7 +1669,7 @@ Return t if any property was actually removed, nil otherwise. */) i = split_interval_left (i, len); copy_properties (unchanged, i); if (!modified && BUFFERP (object)) - modify_region (XBUFFER (object), XINT (start), XINT (end)); + modify_region (XBUFFER (object), XINT (start), XINT (end), 1); remove_properties (Qnil, properties, i, object); if (BUFFERP (object)) signal_after_change (XINT (start), XINT (end) - XINT (start), @@ -1679,7 +1680,7 @@ Return t if any property was actually removed, nil otherwise. */) if (interval_has_some_properties_list (properties, i)) { if (!modified && BUFFERP (object)) - modify_region (XBUFFER (object), XINT (start), XINT (end)); + modify_region (XBUFFER (object), XINT (start), XINT (end), 1); remove_properties (Qnil, properties, i, object); modified = 1; } diff --git a/src/w32.c b/src/w32.c index 0da908ff932..cbc78f8a5d5 100644 --- a/src/w32.c +++ b/src/w32.c @@ -4113,6 +4113,25 @@ init_ntproc () } /* + shutdown_handler ensures that buffers' autosave files are + up to date when the user logs off, or the system shuts down. +*/ +BOOL WINAPI shutdown_handler(DWORD type) +{ + /* Ctrl-C and Ctrl-Break are already suppressed, so don't handle them. */ + if (type == CTRL_CLOSE_EVENT /* User closes console window. */ + || type == CTRL_LOGOFF_EVENT /* User logs off. */ + || type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */ + { + /* Shut down cleanly, making sure autosave files are up to date. */ + shut_down_emacs (0, 0, Qnil); + } + + /* Allow other handlers to handle this signal. */ + return FALSE; +} + +/* globals_of_w32 is used to initialize those global variables that must always be initialized on startup even when the global variable initialized is non zero (see the function main in emacs.c). @@ -4124,6 +4143,11 @@ void globals_of_w32 () g_b_init_get_token_information = 0; g_b_init_lookup_account_sid = 0; g_b_init_get_sid_identifier_authority = 0; + /* The following sets a handler for shutdown notifications for + console apps. This actually applies to Emacs in both console and + GUI modes, since we had to fool windows into thinking emacs is a + console application to get console mode to work. */ + SetConsoleCtrlHandler(shutdown_handler, TRUE); } /* end of nt.c */ diff --git a/src/w32fns.c b/src/w32fns.c index 8c6a60d47bf..f7e211649e0 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2108,7 +2108,12 @@ w32_createwindow (f) } } - if (EQ (left, Qunbound) && EQ (top, Qunbound)) + if (f->size_hint_flags & USPosition || f->size_hint_flags & PPosition) + { + XSETINT (left, f->left_pos); + XSETINT (top, f->top_pos); + } + else if (EQ (left, Qunbound) && EQ (top, Qunbound)) { /* When called with RES_TYPE_NUMBER, w32_get_arg will return zero for anything that is not a number and is not Qunbound. */ @@ -8609,14 +8614,15 @@ syms_of_w32fns () Vw32_color_map = Qnil; DEFVAR_LISP ("w32-pass-alt-to-system", &Vw32_pass_alt_to_system, - doc: /* Non-nil if alt key presses are passed on to Windows. -When non-nil, for example, alt pressed and released and then space will -open the System menu. When nil, Emacs silently swallows alt key events. */); + doc: /* Non-nil if Alt key presses are passed on to Windows. +When non-nil, for example, Alt pressed and released and then space will +open the System menu. When nil, Emacs processes the Alt key events, and +then silently swallows them. */); Vw32_pass_alt_to_system = Qnil; DEFVAR_LISP ("w32-alt-is-meta", &Vw32_alt_is_meta, - doc: /* Non-nil if the alt key is to be considered the same as the meta key. -When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. */); + doc: /* Non-nil if the Alt key is to be considered the same as the META key. +When nil, Emacs will translate the Alt key to the ALT modifier, not to META. */); Vw32_alt_is_meta = Qt; DEFVAR_INT ("w32-quit-key", &w32_quit_key, @@ -8625,14 +8631,32 @@ When nil, Emacs will translate the alt key to the Alt modifier, and not Meta. * DEFVAR_LISP ("w32-pass-lwindow-to-system", &Vw32_pass_lwindow_to_system, - doc: /* Non-nil if the left \"Windows\" key is passed on to Windows. -When non-nil, the Start menu is opened by tapping the key. */); + doc: /* If non-nil, the left \"Windows\" key is passed on to Windows. + +When non-nil, the Start menu is opened by tapping the key. +If you set this to nil, the left \"Windows\" key is processed by Emacs +according to the value of `w32-lwindow-modifier', which see. + +Note that some combinations of the left \"Windows\" key with other keys are +caught by Windows at low level, and so binding them in Emacs will have no +effect. For example, <lwindow>-r always pops up the Windows Run dialog, +<lwindow>-<Pause> pops up the "System Properties" dialog, etc. However, see +the doc string of `w32-phantom-key-code'. */); Vw32_pass_lwindow_to_system = Qt; DEFVAR_LISP ("w32-pass-rwindow-to-system", &Vw32_pass_rwindow_to_system, - doc: /* Non-nil if the right \"Windows\" key is passed on to Windows. -When non-nil, the Start menu is opened by tapping the key. */); + doc: /* If non-nil, the right \"Windows\" key is passed on to Windows. + +When non-nil, the Start menu is opened by tapping the key. +If you set this to nil, the right \"Windows\" key is processed by Emacs +according to the value of `w32-rwindow-modifier', which see. + +Note that some combinations of the right \"Windows\" key with other keys are +caught by Windows at low level, and so binding them in Emacs will have no +effect. For example, <rwindow>-r always pops up the Windows Run dialog, +<rwindow>-<Pause> pops up the "System Properties" dialog, etc. However, see +the doc string of `w32-phantom-key-code'. */); Vw32_pass_rwindow_to_system = Qt; DEFVAR_LISP ("w32-phantom-key-code", @@ -8649,29 +8673,29 @@ acting on \"Windows\" key events when `w32-pass-lwindow-to-system' or DEFVAR_LISP ("w32-enable-num-lock", &Vw32_enable_num_lock, - doc: /* Non-nil if Num Lock should act normally. -Set to nil to see Num Lock as the key `kp-numlock'. */); + doc: /* If non-nil, the Num Lock key acts normally. +Set to nil to handle Num Lock as the `kp-numlock' key. */); Vw32_enable_num_lock = Qt; DEFVAR_LISP ("w32-enable-caps-lock", &Vw32_enable_caps_lock, - doc: /* Non-nil if Caps Lock should act normally. -Set to nil to see Caps Lock as the key `capslock'. */); + doc: /* If non-nil, the Caps Lock key acts normally. +Set to nil to handle Caps Lock as the `capslock' key. */); Vw32_enable_caps_lock = Qt; DEFVAR_LISP ("w32-scroll-lock-modifier", &Vw32_scroll_lock_modifier, - doc: /* Modifier to use for the Scroll Lock on state. + doc: /* Modifier to use for the Scroll Lock ON state. The value can be hyper, super, meta, alt, control or shift for the -respective modifier, or nil to see Scroll Lock as the key `scroll'. -Any other value will cause the key to be ignored. */); +respective modifier, or nil to handle Scroll Lock as the `scroll' key. +Any other value will cause the Scroll Lock key to be ignored. */); Vw32_scroll_lock_modifier = Qt; DEFVAR_LISP ("w32-lwindow-modifier", &Vw32_lwindow_modifier, doc: /* Modifier to use for the left \"Windows\" key. The value can be hyper, super, meta, alt, control or shift for the -respective modifier, or nil to appear as the key `lwindow'. +respective modifier, or nil to appear as the `lwindow' key. Any other value will cause the key to be ignored. */); Vw32_lwindow_modifier = Qnil; @@ -8679,7 +8703,7 @@ Any other value will cause the key to be ignored. */); &Vw32_rwindow_modifier, doc: /* Modifier to use for the right \"Windows\" key. The value can be hyper, super, meta, alt, control or shift for the -respective modifier, or nil to appear as the key `rwindow'. +respective modifier, or nil to appear as the `rwindow' key. Any other value will cause the key to be ignored. */); Vw32_rwindow_modifier = Qnil; @@ -8687,7 +8711,7 @@ Any other value will cause the key to be ignored. */); &Vw32_apps_modifier, doc: /* Modifier to use for the \"Apps\" key. The value can be hyper, super, meta, alt, control or shift for the -respective modifier, or nil to appear as the key `apps'. +respective modifier, or nil to appear as the `apps' key. Any other value will cause the key to be ignored. */); Vw32_apps_modifier = Qnil; @@ -8703,7 +8727,7 @@ Any other value will cause the key to be ignored. */); &w32_mouse_button_tolerance, doc: /* Analogue of double click interval for faking middle mouse events. The value is the minimum time in milliseconds that must elapse between -left/right button down events before they are considered distinct events. +left and right button down events before they are considered distinct events. If both mouse buttons are depressed within this interval, a middle mouse button down event is generated instead. */); w32_mouse_button_tolerance = GetDoubleClickTime () / 2; @@ -8718,7 +8742,7 @@ reported as lisp events. */); DEFVAR_BOOL ("w32-pass-extra-mouse-buttons-to-system", &w32_pass_extra_mouse_buttons_to_system, - doc: /* Non-nil if the fourth and fifth mouse buttons are passed to Windows. + doc: /* If non-nil, the fourth and fifth mouse buttons are passed to Windows. Recent versions of Windows support mice with up to five buttons. Since most applications don't support these extra buttons, most mouse drivers will allow you to map them to functions at the system level. diff --git a/src/w32menu.c b/src/w32menu.c index 11af1d66b6f..3a4dc20fc15 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -149,10 +149,10 @@ GetMenuItemInfoA_Proc get_menu_item_info = NULL; SetMenuItemInfoA_Proc set_menu_item_info = NULL; AppendMenuW_Proc unicode_append_menu = NULL; -Lisp_Object Vmenu_updating_frame; - Lisp_Object Qdebug_on_next_call; +extern Lisp_Object Vmenu_updating_frame; + extern Lisp_Object Qmenu_bar; extern Lisp_Object QCtoggle, QCradio; @@ -2548,11 +2548,6 @@ void syms_of_w32menu () Qdebug_on_next_call = intern ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); - DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, - doc: /* Frame for which we are updating a menu. -The enable predicate for a menu command should check this variable. */); - Vmenu_updating_frame = Qnil; - defsubr (&Sx_popup_menu); #ifdef HAVE_MENUS defsubr (&Sx_popup_dialog); diff --git a/src/w32proc.c b/src/w32proc.c index d874d183b17..29491931015 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -49,6 +49,11 @@ Boston, MA 02110-1301, USA. extern BOOL WINAPI IsValidLocale(LCID, DWORD); #endif +#ifdef HAVE_LANGINFO_CODESET +#include <nl_types.h> +#include <langinfo.h> +#endif + #include "lisp.h" #include "w32.h" #include "w32heap.h" @@ -1817,6 +1822,69 @@ If successful, the return value is t, otherwise nil. */) return result; } +#ifdef HAVE_LANGINFO_CODESET +/* Emulation of nl_langinfo. Used in fns.c:Flocale_info. */ +char *nl_langinfo (nl_item item) +{ + /* Conversion of Posix item numbers to their Windows equivalents. */ + static const LCTYPE w32item[] = { + LOCALE_IDEFAULTANSICODEPAGE, + LOCALE_SDAYNAME1, LOCALE_SDAYNAME2, LOCALE_SDAYNAME3, + LOCALE_SDAYNAME4, LOCALE_SDAYNAME5, LOCALE_SDAYNAME6, LOCALE_SDAYNAME7, + LOCALE_SMONTHNAME1, LOCALE_SMONTHNAME2, LOCALE_SMONTHNAME3, + LOCALE_SMONTHNAME4, LOCALE_SMONTHNAME5, LOCALE_SMONTHNAME6, + LOCALE_SMONTHNAME7, LOCALE_SMONTHNAME8, LOCALE_SMONTHNAME9, + LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12 + }; + + static char *nl_langinfo_buf = NULL; + static int nl_langinfo_len = 0; + + if (nl_langinfo_len <= 0) + nl_langinfo_buf = xmalloc (nl_langinfo_len = 1); + + if (item < 0 || item >= _NL_NUM) + nl_langinfo_buf[0] = 0; + else + { + LCID cloc = GetThreadLocale (); + int need_len = GetLocaleInfo (cloc, w32item[item] | LOCALE_USE_CP_ACP, + NULL, 0); + + if (need_len <= 0) + nl_langinfo_buf[0] = 0; + else + { + if (item == CODESET) + { + need_len += 2; /* for the "cp" prefix */ + if (need_len < 8) /* for the case we call GetACP */ + need_len = 8; + } + if (nl_langinfo_len <= need_len) + nl_langinfo_buf = xrealloc (nl_langinfo_buf, + nl_langinfo_len = need_len); + if (!GetLocaleInfo (cloc, w32item[item] | LOCALE_USE_CP_ACP, + nl_langinfo_buf, nl_langinfo_len)) + nl_langinfo_buf[0] = 0; + else if (item == CODESET) + { + if (strcmp (nl_langinfo_buf, "0") == 0 /* CP_ACP */ + || strcmp (nl_langinfo_buf, "1") == 0) /* CP_OEMCP */ + sprintf (nl_langinfo_buf, "cp%u", GetACP ()); + else + { + memmove (nl_langinfo_buf + 2, nl_langinfo_buf, + strlen (nl_langinfo_buf) + 1); + nl_langinfo_buf[0] = 'c'; + nl_langinfo_buf[1] = 'p'; + } + } + } + } + return nl_langinfo_buf; +} +#endif /* HAVE_LANGINFO_CODESET */ DEFUN ("w32-get-locale-info", Fw32_get_locale_info, Sw32_get_locale_info, 1, 2, 0, diff --git a/src/w32term.c b/src/w32term.c index 2870955b94f..9a6142925fd 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4298,7 +4298,7 @@ w32_read_socket (sd, expected, hold_quit) if (f) { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; int x = LOWORD (msg.msg.lParam); diff --git a/src/window.c b/src/window.c index a3e7b93e878..0233c6bf79e 100644 --- a/src/window.c +++ b/src/window.c @@ -335,13 +335,16 @@ Return nil if that position is scrolled vertically out of view. If a character is only partially visible, nil is returned, unless the optional argument PARTIALLY is non-nil. If POS is only out of view because of horizontal scrolling, return non-nil. +If POS is t, it specifies the position of the last visible glyph in WINDOW. POS defaults to point in WINDOW; WINDOW defaults to the selected window. If POS is visible, return t if PARTIALLY is nil; if PARTIALLY is non-nil, -return value is a list (X Y PARTIAL) where X and Y are the pixel coordinates -relative to the top left corner of the window. PARTIAL is nil if the character -after POS is fully visible; otherwise it is a cons (RTOP . RBOT) where RTOP -and RBOT are the number of pixels invisible at the top and bottom of the row. */) +return value is a list of 2 or 6 elements (X Y [RTOP RBOT ROWH VPOS]), +where X and Y are the pixel coordinates relative to the top left corner +of the window. The remaining elements are omitted if the character after +POS is fully visible; otherwise, RTOP and RBOT are the number of pixels +off-window at the top and bottom of the row, ROWH is the height of the +display row, and VPOS is the row number (0-based) containing POS. */) (pos, window, partially) Lisp_Object pos, window, partially; { @@ -350,14 +353,16 @@ and RBOT are the number of pixels invisible at the top and bottom of the row. * register struct buffer *buf; struct text_pos top; Lisp_Object in_window = Qnil; - int rtop, rbot, fully_p = 1; + int rtop, rbot, rowh, vpos, fully_p = 1; int x, y; w = decode_window (window); buf = XBUFFER (w->buffer); SET_TEXT_POS_FROM_MARKER (top, w->start); - if (!NILP (pos)) + if (EQ (pos, Qt)) + posint = -1; + else if (!NILP (pos)) { CHECK_NUMBER_COERCE_MARKER (pos); posint = XINT (pos); @@ -369,24 +374,138 @@ and RBOT are the number of pixels invisible at the top and bottom of the row. * /* If position is above window start or outside buffer boundaries, or if window start is out of range, position is not visible. */ - if (posint >= CHARPOS (top) - && posint <= BUF_ZV (buf) + if ((EQ (pos, Qt) + || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf))) && CHARPOS (top) >= BUF_BEGV (buf) && CHARPOS (top) <= BUF_ZV (buf) - && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, NILP (partially)) + && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos) && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p))) in_window = Qt; if (!NILP (in_window) && !NILP (partially)) - in_window = Fcons (make_number (x), - Fcons (make_number (y), - Fcons ((fully_p ? Qnil - : Fcons (make_number (rtop), - make_number (rbot))), - Qnil))); + { + Lisp_Object part = Qnil; + if (!fully_p) + part = list4 (make_number (rtop), make_number (rbot), + make_number (rowh), make_number (vpos)); + in_window = Fcons (make_number (x), + Fcons (make_number (y), part)); + } + return in_window; } +DEFUN ("window-line-height", Fwindow_line_height, + Swindow_line_height, 0, 2, 0, + doc: /* Return height in pixels of text line LINE in window WINDOW. +If WINDOW is nil or omitted, use selected window. + +Return height of current line if LINE is omitted or nil. Return height of +header or mode line if LINE is `header-line' and `mode-line'. +Otherwise, LINE is a text line number starting from 0. A negative number +counts from the end of the window. + +Value is a list (HEIGHT VPOS YPOS OFFBOT), where HEIGHT is the height +in pixels of the visible part of the line, VPOS and YPOS are the +vertical position in lines and pixels of the line, relative to the top +of the first text line, and OFFBOT is the number of off-window pixels at +the bottom of the text line. If there are off-window pixels at the top +of the (first) text line, YPOS is negative. + +Return nil if window display is not up-to-date. In that case, use +`pos-visible-in-window-p' to obtain the information. */) + (line, window) + Lisp_Object line, window; +{ + register struct window *w; + register struct buffer *b; + struct glyph_row *row, *end_row; + int max_y, crop, i, n; + + w = decode_window (window); + + if (noninteractive + || w->pseudo_window_p) + return Qnil; + + CHECK_BUFFER (w->buffer); + b = XBUFFER (w->buffer); + + /* Fail if current matrix is not up-to-date. */ + if (NILP (w->window_end_valid) + || current_buffer->clip_changed + || current_buffer->prevent_redisplay_optimizations_p + || XFASTINT (w->last_modified) < BUF_MODIFF (b) + || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b)) + return Qnil; + + if (NILP (line)) + { + i = w->cursor.vpos; + if (i < 0 || i >= w->current_matrix->nrows + || (row = MATRIX_ROW (w->current_matrix, i), !row->enabled_p)) + return Qnil; + max_y = window_text_bottom_y (w); + goto found_row; + } + + if (EQ (line, Qheader_line)) + { + if (!WINDOW_WANTS_HEADER_LINE_P (w)) + return Qnil; + row = MATRIX_HEADER_LINE_ROW (w->current_matrix); + if (!row->enabled_p) + return Qnil; + return list4 (make_number (row->height), + make_number (0), make_number (0), + make_number (0)); + } + + if (EQ (line, Qmode_line)) + { + row = MATRIX_MODE_LINE_ROW (w->current_matrix); + if (!row->enabled_p) + return Qnil; + return list4 (make_number (row->height), + make_number (0), /* not accurate */ + make_number (WINDOW_HEADER_LINE_HEIGHT (w) + + window_text_bottom_y (w)), + make_number (0)); + } + + CHECK_NUMBER (line); + n = XINT (line); + + row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + end_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); + max_y = window_text_bottom_y (w); + i = 0; + + while ((n < 0 || i < n) + && row <= end_row && row->enabled_p + && row->y + row->height < max_y) + row++, i++; + + if (row > end_row || !row->enabled_p) + return Qnil; + + if (++n < 0) + { + if (-n > i) + return Qnil; + row += n; + i += n; + } + + found_row: + crop = max (0, (row->y + row->height) - max_y); + return list4 (make_number (row->height + min (0, row->y) - crop), + make_number (i), + make_number (row->y), + make_number (crop)); +} + + static struct window * decode_window (window) @@ -451,7 +570,7 @@ DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0, Return NCOL. NCOL should be zero or positive. Note that if `automatic-hscrolling' is non-nil, you cannot scroll the -window so that the location of point becomes invisible. */) +window so that the location of point moves off-window. */) (window, ncol) Lisp_Object window, ncol; { @@ -1048,9 +1167,11 @@ if it isn't already recorded. */) Lisp_Object value; struct window *w = decode_window (window); Lisp_Object buf; + struct buffer *b; buf = w->buffer; CHECK_BUFFER (buf); + b = XBUFFER (buf); #if 0 /* This change broke some things. We should make it later. */ /* If we don't know the end position, return nil. @@ -1063,12 +1184,20 @@ if it isn't already recorded. */) if (! NILP (update) && ! (! NILP (w->window_end_valid) - && XFASTINT (w->last_modified) >= MODIFF) + && XFASTINT (w->last_modified) >= BUF_MODIFF (b)) && !noninteractive) { struct text_pos startp; struct it it; - struct buffer *old_buffer = NULL, *b = XBUFFER (buf); + struct buffer *old_buffer = NULL; + + /* Cannot use Fvertical_motion because that function doesn't + cope with variable-height lines. */ + if (b != current_buffer) + { + old_buffer = current_buffer; + set_buffer_internal (b); + } /* In case W->start is out of the range, use something reasonable. This situation occurred when loading a file with @@ -1082,14 +1211,6 @@ if it isn't already recorded. */) else SET_TEXT_POS_FROM_MARKER (startp, w->start); - /* Cannot use Fvertical_motion because that function doesn't - cope with variable-height lines. */ - if (b != current_buffer) - { - old_buffer = current_buffer; - set_buffer_internal (b); - } - start_display (&it, w, startp); move_it_vertically (&it, window_box_height (w)); if (it.current_y < it.last_visible_y) @@ -1100,7 +1221,7 @@ if it isn't already recorded. */) set_buffer_internal (old_buffer); } else - XSETINT (value, BUF_Z (XBUFFER (buf)) - XFASTINT (w->window_end_pos)); + XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos)); return value; } @@ -4820,10 +4941,10 @@ window_scroll_pixel_based (window, n, whole, noerror) struct it it; struct window *w = XWINDOW (window); struct text_pos start; - Lisp_Object tem; int this_scroll_margin; /* True if we fiddled the window vscroll field without really scrolling. */ int vscrolled = 0; + int x, y, rtop, rbot, rowh, vpos; SET_TEXT_POS_FROM_MARKER (start, w->start); @@ -4831,8 +4952,8 @@ window_scroll_pixel_based (window, n, whole, noerror) the screen. Allow PT to be partially visible, otherwise something like (scroll-down 1) with PT in the line before the partially visible one would recenter. */ - tem = Fpos_visible_in_window_p (make_number (PT), window, Qt); - if (NILP (tem)) + + if (!pos_visible_p (w, PT, &x, &y, &rtop, &rbot, &rowh, &vpos)) { /* Move backward half the height of the window. Performance note: vmotion used here is about 10% faster, but would give wrong @@ -4857,7 +4978,7 @@ window_scroll_pixel_based (window, n, whole, noerror) } else if (auto_window_vscroll_p) { - if (tem = XCAR (XCDR (XCDR (tem))), CONSP (tem)) + if (rtop || rbot) /* partially visible */ { int px; int dy = WINDOW_FRAME_LINE_HEIGHT (w); @@ -4867,19 +4988,52 @@ window_scroll_pixel_based (window, n, whole, noerror) dy); dy *= n; - if (n < 0 && (px = XINT (XCAR (tem))) > 0) + if (n < 0) { - px = max (0, -w->vscroll - min (px, -dy)); - Fset_window_vscroll (window, make_number (px), Qt); - return; + /* Only vscroll backwards if already vscrolled forwards. */ + if (w->vscroll < 0 && rtop > 0) + { + px = max (0, -w->vscroll - min (rtop, -dy)); + Fset_window_vscroll (window, make_number (px), Qt); + return; + } } - if (n > 0 && (px = XINT (XCDR (tem))) > 0) + if (n > 0) { - px = max (0, -w->vscroll + min (px, dy)); - Fset_window_vscroll (window, make_number (px), Qt); - return; + /* Do vscroll if already vscrolled or only display line. */ + if (rbot > 0 && (w->vscroll < 0 || vpos == 0)) + { + px = max (0, -w->vscroll + min (rbot, dy)); + Fset_window_vscroll (window, make_number (px), Qt); + return; + } + + /* Maybe modify window start instead of scrolling. */ + if (rbot > 0 || w->vscroll < 0) + { + int spos; + + Fset_window_vscroll (window, make_number (0), Qt); + /* If there are other text lines above the current row, + move window start to current row. Else to next row. */ + if (rbot > 0) + spos = XINT (Fline_beginning_position (Qnil)); + else + spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); + set_marker_restricted (w->start, make_number (spos), + w->buffer); + w->start_at_line_beg = Qt; + w->update_mode_line = Qt; + XSETFASTINT (w->last_modified, 0); + XSETFASTINT (w->last_overlay_modified, 0); + /* Set force_start so that redisplay_window will run the + window-scroll-functions. */ + w->force_start = Qt; + return; + } } } + /* Cancel previous vscroll. */ Fset_window_vscroll (window, make_number (0), Qt); } @@ -4920,7 +5074,7 @@ window_scroll_pixel_based (window, n, whole, noerror) if (dy <= 0) { move_it_vertically_backward (&it, -dy); - /* Ensure we actually does move, e.g. in case we are currently + /* Ensure we actually do move, e.g. in case we are currently looking at an image that is taller that the window height. */ while (start_pos == IT_CHARPOS (it) && start_pos > BEGV) @@ -4930,7 +5084,7 @@ window_scroll_pixel_based (window, n, whole, noerror) { move_it_to (&it, ZV, -1, it.current_y + dy, -1, MOVE_TO_POS | MOVE_TO_Y); - /* Ensure we actually does move, e.g. in case we are currently + /* Ensure we actually do move, e.g. in case we are currently looking at an image that is taller that the window height. */ while (start_pos == IT_CHARPOS (it) && start_pos < ZV) @@ -6658,7 +6812,7 @@ display marginal areas and the text area. */) CHECK_NATNUM (left_width); if (!NILP (right_width)) CHECK_NATNUM (right_width); - + /* Do nothing on a tty. */ if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) && (!EQ (w->left_fringe_width, left_width) @@ -7292,16 +7446,18 @@ See also `same-window-buffer-names'. */); next_screen_context_lines = 2; DEFVAR_INT ("split-height-threshold", &split_height_threshold, - doc: /* *A window must be at least this tall to be eligible for splitting by `display-buffer'. + doc: /* *A window must be at least this tall to be eligible for splitting +by `display-buffer'. The value is in line units. If there is only one window, it is split regardless of this value. */); split_height_threshold = 500; DEFVAR_INT ("window-min-height", &window_min_height, - doc: /* *Delete any window less than this tall (including its mode line). */); + doc: /* *Delete any window less than this tall (including its mode line). +The value is in line units. */); window_min_height = 4; DEFVAR_INT ("window-min-width", &window_min_width, - doc: /* *Delete any window less than this wide. */); + doc: /* *Delete any window less than this wide (measured in characters). */); window_min_width = 10; DEFVAR_LISP ("scroll-preserve-screen-position", @@ -7327,6 +7483,7 @@ The selected frame is the one whose configuration has changed. */); defsubr (&Swindowp); defsubr (&Swindow_live_p); defsubr (&Spos_visible_in_window_p); + defsubr (&Swindow_line_height); defsubr (&Swindow_buffer); defsubr (&Swindow_height); defsubr (&Swindow_width); diff --git a/src/xdisp.c b/src/xdisp.c index 7e65b91fd13..fe22c55dc35 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -256,9 +256,9 @@ Lisp_Object list_of_error; Lisp_Object Vfontification_functions; Lisp_Object Qfontification_functions; -/* Non-zero means automatically select any window when the mouse +/* Non-nil means automatically select any window when the mouse cursor moves into it. */ -int mouse_autoselect_window; +Lisp_Object Vmouse_autoselect_window; /* Non-zero means draw tool bar buttons raised when the mouse moves over them. */ @@ -606,6 +606,11 @@ int message_buf_print; Lisp_Object Qinhibit_menubar_update; int inhibit_menubar_update; +/* When evaluating expressions from menu bar items (enable conditions, + for instance), this is the frame they are being processed for. */ + +Lisp_Object Vmenu_updating_frame; + /* Maximum height for resizing mini-windows. Either a float specifying a fraction of the available height, or an integer specifying a number of lines. */ @@ -1257,15 +1262,15 @@ line_bottom_y (it) /* Return 1 if position CHARPOS is visible in window W. + CHARPOS < 0 means return info about WINDOW_END position. If visible, set *X and *Y to pixel coordinates of top left corner. Set *RTOP and *RBOT to pixel height of an invisible area of glyph at POS. - EXACT_MODE_LINE_HEIGHTS_P non-zero means compute exact mode-line - and header-lines heights. */ + Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ int -pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) +pos_visible_p (w, charpos, x, y, rtop, rbot, rowh, vpos) struct window *w; - int charpos, *x, *y, *rtop, *rbot, exact_mode_line_heights_p; + int charpos, *x, *y, *rtop, *rbot, *rowh, *vpos; { struct it it; struct text_pos top; @@ -1283,26 +1288,23 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) SET_TEXT_POS_FROM_MARKER (top, w->start); - /* Compute exact mode line heights, if requested. */ - if (exact_mode_line_heights_p) - { - if (WINDOW_WANTS_MODELINE_P (w)) - current_mode_line_height - = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), - current_buffer->mode_line_format); + /* Compute exact mode line heights. */ + if (WINDOW_WANTS_MODELINE_P (w)) + current_mode_line_height + = display_mode_line (w, CURRENT_MODE_LINE_FACE_ID (w), + current_buffer->mode_line_format); - if (WINDOW_WANTS_HEADER_LINE_P (w)) - current_header_line_height - = display_mode_line (w, HEADER_LINE_FACE_ID, + if (WINDOW_WANTS_HEADER_LINE_P (w)) + current_header_line_height + = display_mode_line (w, HEADER_LINE_FACE_ID, current_buffer->header_line_format); - } start_display (&it, w, top); - move_it_to (&it, charpos, -1, it.last_visible_y, -1, - MOVE_TO_POS | MOVE_TO_Y); + move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, + (charpos >= 0 ? MOVE_TO_POS : 0) | MOVE_TO_Y); /* Note that we may overshoot because of invisible text. */ - if (IT_CHARPOS (it) >= charpos) + if (charpos >= 0 && IT_CHARPOS (it) >= charpos) { int top_x = it.current_x; int top_y = it.current_y; @@ -1319,6 +1321,9 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) *y = max (top_y + max (0, it.max_ascent - it.ascent), window_top_y); *rtop = max (0, window_top_y - top_y); *rbot = max (0, bottom_y - it.last_visible_y); + *rowh = max (0, (min (bottom_y, it.last_visible_y) + - max (top_y, window_top_y))); + *vpos = it.vpos; } } else @@ -1328,7 +1333,8 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) it2 = it; if (IT_CHARPOS (it) < ZV && FETCH_BYTE (IT_BYTEPOS (it)) != '\n') move_it_by_lines (&it, 1, 0); - if (charpos < IT_CHARPOS (it)) + if (charpos < IT_CHARPOS (it) + || (it.what == IT_EOB && charpos == IT_CHARPOS (it))) { visible_p = 1; move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); @@ -1337,6 +1343,11 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) *rtop = max (0, -it2.current_y); *rbot = max (0, ((it2.current_y + it2.max_ascent + it2.max_descent) - it.last_visible_y)); + *rowh = max (0, (min (it2.current_y + it2.max_ascent + it2.max_descent, + it.last_visible_y) + - max (it2.current_y, + WINDOW_HEADER_LINE_HEIGHT (w)))); + *vpos = it2.vpos; } } @@ -1348,6 +1359,15 @@ pos_visible_p (w, charpos, x, y, rtop, rbot, exact_mode_line_heights_p) if (visible_p && XFASTINT (w->hscroll) > 0) *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w); +#if 0 + /* Debugging code. */ + if (visible_p) + fprintf (stderr, "+pv pt=%d vs=%d --> x=%d y=%d rt=%d rb=%d rh=%d vp=%d\n", + charpos, w->vscroll, *x, *y, *rtop, *rbot, *rowh, *vpos); + else + fprintf (stderr, "-pv pt=%d vs=%d\n", charpos, w->vscroll); +#endif + return visible_p; } @@ -3214,7 +3234,9 @@ handle_fontified_prop (it) && !NILP (Vrun_hooks) && (pos = make_number (IT_CHARPOS (*it)), prop = Fget_char_property (pos, Qfontified, Qnil), - NILP (prop))) + /* Ignore the special cased nil value always present at EOB since + no amount of fontifying will be able to change it. */ + NILP (prop) && IT_CHARPOS (*it) < Z)) { int count = SPECPDL_INDEX (); Lisp_Object val; @@ -9132,7 +9154,7 @@ update_menu_bar (f, save_match_data, hooks_run) happen when, for instance, an activate-menubar-hook causes a redisplay. */ if (inhibit_menubar_update) - return; + return hooks_run; window = FRAME_SELECTED_WINDOW (f); w = XWINDOW (window); @@ -9203,6 +9225,7 @@ update_menu_bar (f, save_match_data, hooks_run) hooks_run = 1; } + XSETFRAME (Vmenu_updating_frame, f); FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); /* Redisplay the menu bar in case we changed it. */ @@ -10786,13 +10809,13 @@ redisplay_internal (preserve_echo_area) int preserve_echo_area; { struct window *w = XWINDOW (selected_window); - struct frame *f = XFRAME (w->frame); + struct frame *f; int pause; int must_finish = 0; struct text_pos tlbufpos, tlendpos; int number_of_visible_frames; int count; - struct frame *sf = SELECTED_FRAME (); + struct frame *sf; int polling_stopped_here = 0; /* Non-zero means redisplay has to consider all windows on all @@ -10805,8 +10828,16 @@ redisplay_internal (preserve_echo_area) initialized, or redisplay is explicitly turned off by setting Vinhibit_redisplay. */ if (noninteractive - || !NILP (Vinhibit_redisplay) - || !f->glyphs_initialized_p) + || !NILP (Vinhibit_redisplay)) + return; + + /* Don't examine these until after testing Vinhibit_redisplay. + When Emacs is shutting down, perhaps because its connection to + X has dropped, we should not look at them at all. */ + f = XFRAME (w->frame); + sf = SELECTED_FRAME (); + + if (!f->glyphs_initialized_p) return; /* The flag redisplay_performed_directly_p is set by @@ -12030,7 +12061,8 @@ cursor_row_fully_visible_p (w, force_p, current_matrix_p) window_height = window_box_height (w); if (row->height >= window_height) { - if (!force_p || MINI_WINDOW_P (w) || w->vscroll) + if (!force_p || MINI_WINDOW_P (w) + || w->vscroll || w->cursor.vpos == 0) return 1; } return 0; @@ -13519,7 +13551,8 @@ try_window (window, pos, check_margins) this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); - if ((w->cursor.y < this_scroll_margin + if ((w->cursor.y >= 0 /* not vscrolled */ + && w->cursor.y < this_scroll_margin && CHARPOS (pos) > BEGV && IT_CHARPOS (it) < ZV) /* rms: considering make_cursor_line_fully_visible_p here @@ -17659,12 +17692,20 @@ decode_mode_spec (w, c, field_width, precision, multibyte) break; case 'c': - { - int col = (int) current_column (); /* iftc */ - w->column_number_displayed = make_number (col); - pint2str (decode_mode_spec_buf, field_width, col); - return decode_mode_spec_buf; - } + /* %c and %l are ignored in `frame-title-format'. + (In redisplay_internal, the frame title is drawn _before_ the + windows are updated, so the stuff which depends on actual + window contents (such as %l) may fail to render properly, or + even crash emacs.) */ + if (mode_line_target == MODE_LINE_TITLE) + return ""; + else + { + int col = (int) current_column (); /* iftc */ + w->column_number_displayed = make_number (col); + pint2str (decode_mode_spec_buf, field_width, col); + return decode_mode_spec_buf; + } case 'e': #ifndef SYSTEM_MALLOC @@ -17706,11 +17747,16 @@ decode_mode_spec (w, c, field_width, precision, multibyte) case 'l': { - int startpos = XMARKER (w->start)->charpos; - int startpos_byte = marker_byte_position (w->start); - int line, linepos, linepos_byte, topline; - int nlines, junk; - int height = WINDOW_TOTAL_LINES (w); + int startpos, startpos_byte, line, linepos, linepos_byte; + int topline, nlines, junk, height; + + /* %c and %l are ignored in `frame-title-format'. */ + if (mode_line_target == MODE_LINE_TITLE) + return ""; + + startpos = XMARKER (w->start)->charpos; + startpos_byte = marker_byte_position (w->start); + height = WINDOW_TOTAL_LINES (w); /* If we decided that this buffer isn't suitable for line numbers, don't forget that too fast. */ @@ -19772,7 +19818,7 @@ produce_image_glyph (it) { struct image *img; struct face *face; - int glyph_ascent; + int glyph_ascent, crop; struct glyph_slice slice; xassert (it->what == IT_IMAGE); @@ -19880,6 +19926,15 @@ produce_image_glyph (it) take_vertical_position_into_account (it); + /* Automatically crop wide image glyphs at right edge so we can + draw the cursor on same display row. */ + if ((crop = it->pixel_width - (it->last_visible_x - it->current_x), crop > 0) + && (it->hpos == 0 || it->pixel_width > it->last_visible_x / 4)) + { + it->pixel_width -= crop; + slice.width -= crop; + } + if (it->glyph_row) { struct glyph *glyph; @@ -21228,10 +21283,35 @@ get_window_cursor_type (w, glyph, width, active_cursor) /* Use normal cursor if not blinked off. */ if (!w->cursor_off_p) { - if (glyph != NULL && glyph->type == IMAGE_GLYPH) { - if (cursor_type == FILLED_BOX_CURSOR) - cursor_type = HOLLOW_BOX_CURSOR; +#ifdef HAVE_WINDOW_SYSTEM + if (glyph != NULL && glyph->type == IMAGE_GLYPH) + { + if (cursor_type == FILLED_BOX_CURSOR) + { + /* Using a block cursor on large images can be very annoying. + So use a hollow cursor for "large" images. + If image is not transparent (no mask), also use hollow cursor. */ + struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); + if (img != NULL && IMAGEP (img->spec)) + { + /* Arbitrarily, interpret "Large" as >32x32 and >NxN + where N = size of default frame font size. + This should cover most of the "tiny" icons people may use. */ + if (!img->mask + || img->width > max (32, WINDOW_FRAME_COLUMN_WIDTH (w)) + || img->height > max (32, WINDOW_FRAME_LINE_HEIGHT (w))) + cursor_type = HOLLOW_BOX_CURSOR; + } + } + else if (cursor_type != NO_CURSOR) + { + /* Display current only supports BOX and HOLLOW cursors for images. + So for now, unconditionally use a HOLLOW cursor when cursor is + not a solid box cursor. */ + cursor_type = HOLLOW_BOX_CURSOR; + } } +#endif return cursor_type; } @@ -23935,9 +24015,10 @@ This variable is not guaranteed to be accurate except while processing DEFVAR_LISP ("frame-title-format", &Vframe_title_format, doc: /* Template for displaying the title bar of visible frames. \(Assuming the window manager supports this feature.) -This variable has the same structure as `mode-line-format' (which see), -and is used only on frames for which no explicit name has been set -\(see `modify-frame-parameters'). */); + +This variable has the same structure as `mode-line-format', except that +the %c and %l constructs are ignored. It is used only on frames for +which no explicit name has been set \(see `modify-frame-parameters'). */); DEFVAR_LISP ("icon-title-format", &Vicon_title_format, doc: /* Template for displaying the title bar of an iconified frame. @@ -23983,9 +24064,22 @@ Each function is called with two arguments, the window and the end trigger value See `set-window-redisplay-end-trigger'. */); Vredisplay_end_trigger_functions = Qnil; - DEFVAR_BOOL ("mouse-autoselect-window", &mouse_autoselect_window, - doc: /* *Non-nil means autoselect window with mouse pointer. */); - mouse_autoselect_window = 0; + DEFVAR_LISP ("mouse-autoselect-window", &Vmouse_autoselect_window, + doc: /* *Non-nil means autoselect window with mouse pointer. +If nil, do not autoselect windows. +A positive number means delay autoselection by that many seconds: a +window is autoselected only after the mouse has remained in that +window for the duration of the delay. +A negative number has a similar effect, but causes windows to be +autoselected only after the mouse has stopped moving. \(Because of +the way Emacs compares mouse events, you will occasionally wait twice +that time before the window gets selected.\) +Any other value means to autoselect window instantaneously when the +mouse pointer enters it. + +Autoselection selects the minibuffer only if it is active, and never +unselects the minibuffer if it is active. */); + Vmouse_autoselect_window = Qnil; DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p, doc: /* *Non-nil means automatically resize tool-bars. @@ -24105,6 +24199,11 @@ This is used to update submenus such as Buffers, whose contents depend on various data. */); Vmenu_bar_update_hook = Qnil; + DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, + doc: /* Frame for which we are updating a menu. +The enable predicate for a menu binding should check this variable. */); + Vmenu_updating_frame = Qnil; + DEFVAR_BOOL ("inhibit-menubar-update", &inhibit_menubar_update, doc: /* Non-nil means don't update menu bars. Internal use only. */); inhibit_menubar_update = 0; diff --git a/src/xfns.c b/src/xfns.c index d5b8a01cf20..066996628e2 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -153,12 +153,16 @@ int display_hourglass_p; /* Non-zero means prompt with the old GTK file selection dialog. */ -int x_use_old_gtk_file_dialog; +int x_gtk_use_old_file_dialog; /* If non-zero, by default show hidden files in the GTK file chooser. */ int x_gtk_show_hidden_files; +/* If non-zero, don't show additional help text in the GTK file chooser. */ + +int x_gtk_file_dialog_help_text; + /* If non-zero, don't collapse to tool bar when it is detached. */ int x_gtk_whole_detached_tool_bar; @@ -5338,6 +5342,8 @@ or directory must exist. ONLY-DIR-P is ignored." */) int count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; + check_x (); + GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); if (popup_activated ()) @@ -5505,6 +5511,8 @@ directories. */) struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char *cdef_file; + check_x (); + GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); if (popup_activated ()) @@ -5803,12 +5811,12 @@ Chinese, Japanese, and Korean. */); Vx_pixel_size_width_font_regexp = Qnil; /* This is not ifdef:ed, so other builds than GTK can customize it. */ - DEFVAR_BOOL ("x-use-old-gtk-file-dialog", &x_use_old_gtk_file_dialog, + DEFVAR_BOOL ("x-gtk-use-old-file-dialog", &x_gtk_use_old_file_dialog, doc: /* *Non-nil means prompt with the old GTK file selection dialog. If nil or if the file selection dialog is not available, the new GTK file chooser is used instead. To turn off all file dialogs set the variable `use-file-dialog'. */); - x_use_old_gtk_file_dialog = 0; + x_gtk_use_old_file_dialog = 0; DEFVAR_BOOL ("x-gtk-show-hidden-files", &x_gtk_show_hidden_files, doc: /* *If non-nil, the GTK file chooser will by default show hidden files. @@ -5816,6 +5824,12 @@ Note that this is just the default, there is a toggle button on the file chooser to show or not show hidden files on a case by case basis. */); x_gtk_show_hidden_files = 0; + DEFVAR_BOOL ("x-gtk-file-dialog-help-text", &x_gtk_file_dialog_help_text, + doc: /* *If non-nil, the GTK file chooser will show additional help text. +If more space for files in the file chooser dialog is wanted, set this to nil +to turn the additional text off. */); + x_gtk_file_dialog_help_text = 1; + DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", &x_gtk_whole_detached_tool_bar, doc: /* *If non-nil, a detached tool bar is shown in full. The default is to just show an arrow and pressing on that arrow shows diff --git a/src/xmenu.c b/src/xmenu.c index 1650222ae84..b615d321cc7 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -97,10 +97,10 @@ Boston, MA 02110-1301, USA. */ #define FALSE 0 #endif /* no TRUE */ -Lisp_Object Vmenu_updating_frame; - Lisp_Object Qdebug_on_next_call; +extern Lisp_Object Vmenu_updating_frame; + extern Lisp_Object Qmenu_bar; extern Lisp_Object QCtoggle, QCradio; @@ -1191,6 +1191,10 @@ x_menu_set_in_use (in_use) { menu_items_inuse = in_use ? Qt : Qnil; popup_activated_flag = in_use; +#ifdef USE_X_TOOLKIT + if (popup_activated_flag) + x_activate_timeout_atimer (); +#endif } /* Wait for an X event to arrive or for a timer to expire. */ @@ -1310,7 +1314,7 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers) } } -DEFUN ("x-menu-bar-open", Fx_menu_bar_open, Sx_menu_bar_open, 0, 1, "i", +DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, Sx_menu_bar_open_internal, 0, 1, "i", doc: /* Start key navigation of the menu bar in FRAME. This initially opens the first menu bar item and you can then navigate with the arrow keys, select a menu entry with the return key or cancel with the @@ -1389,7 +1393,7 @@ If FRAME is nil or not given, use the selected frame. */) #ifdef USE_GTK -DEFUN ("x-menu-bar-open", Fx_menu_bar_open, Sx_menu_bar_open, 0, 1, "i", +DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, Sx_menu_bar_open_internal, 0, 1, "i", doc: /* Start key navigation of the menu bar in FRAME. This initially opens the first menu bar item and you can then navigate with the arrow keys, select a menu entry with the return key or cancel with the @@ -1510,6 +1514,9 @@ popup_activate_callback (widget, id, client_data) XtPointer client_data; { popup_activated_flag = 1; +#ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); +#endif } #endif @@ -2828,6 +2835,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) /* Display the menu. */ lw_popup_menu (menu, (XEvent *) &dummy); popup_activated_flag = 1; + x_activate_timeout_atimer (); { int fact = 4 * sizeof (LWLIB_ID); @@ -3214,6 +3222,7 @@ create_and_show_dialog (f, first_wv) /* Display the dialog box. */ lw_pop_up_all_widgets (dialog_id); popup_activated_flag = 1; + x_activate_timeout_atimer (); /* Process events that apply to the dialog box. Also handle timers. */ @@ -3803,11 +3812,6 @@ syms_of_xmenu () Qdebug_on_next_call = intern ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); - DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, - doc: /* Frame for which we are updating a menu. -The enable predicate for a menu command should check this variable. */); - Vmenu_updating_frame = Qnil; - #ifdef USE_X_TOOLKIT widget_id_tick = (1<<16); next_menubar_widget_id = 1; @@ -3816,10 +3820,9 @@ The enable predicate for a menu command should check this variable. */); defsubr (&Sx_popup_menu); #if defined (USE_GTK) || defined (USE_X_TOOLKIT) - defsubr (&Sx_menu_bar_open); - Fdefalias (intern ("accelerate-menu"), - intern (Sx_menu_bar_open.symbol_name), - Qnil); + defsubr (&Sx_menu_bar_open_internal); + Ffset (intern ("accelerate-menu"), + intern (Sx_menu_bar_open_internal.symbol_name)); #endif #ifdef HAVE_MENUS diff --git a/src/xterm.c b/src/xterm.c index 466037c75a2..95b2a87fd4b 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2701,9 +2701,8 @@ x_draw_glyph_string (s) if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h)) h = 1; - if (x_underline_at_descent_line) - y = s->y + s->height - h; - else + y = s->y + s->height - h; + if (!x_underline_at_descent_line) { /* Get the underline position. This is the recommended vertical offset in pixels from the baseline to the top of @@ -4105,6 +4104,9 @@ x_send_scroll_bar_event (window, part, portion, whole) /* Make Xt timeouts work while the scroll bar is active. */ toolkit_scroll_bar_interaction = 1; +#ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); +#endif /* Setting the event mask to zero means that the message will be sent to the client that created the window, and if that @@ -6597,7 +6599,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; @@ -7517,7 +7519,7 @@ struct x_error_message_stack { static struct x_error_message_stack *x_error_message; /* An X error handler which stores the error message in - x_error_message_string. This is called from x_error_handler if + *x_error_message. This is called from x_error_handler if x_catch_errors is in effect. */ static void @@ -7536,7 +7538,7 @@ x_error_catcher (display, error) After calling this function, X protocol errors no longer cause Emacs to exit; instead, they are recorded in the string - stored in x_error_message_string. + stored in *x_error_message. Calling x_check_errors signals an Emacs error if an X error has occurred since the last call to x_catch_errors or x_check_errors. @@ -7819,7 +7821,7 @@ x_connection_closed (dpy, error_message) /* We specifically use it before defining it, so that gcc doesn't inline it, otherwise gdb doesn't know how to properly put a breakpoint on it. */ -static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN; +static void x_error_quitter P_ ((Display *, XErrorEvent *)); /* This is the first-level handler for X protocol errors. It calls x_error_quitter or x_error_catcher. */ @@ -7864,6 +7866,12 @@ x_error_quitter (display, error) { char buf[256], buf1[356]; + /* Ignore BadName errors. They can happen because of fonts + or colors that are not defined. */ + + if (error->error_code == BadName) + return; + /* Note that there is no real way portable across R3/R4 to get the original error handler. */ @@ -8372,7 +8380,7 @@ x_check_expected_move (f, expected_left, expected_top) int expected_left; int expected_top; { - int count = 0, current_left = 0, current_top = 0; + int current_left = 0, current_top = 0; /* x_real_positions returns the left and top offsets of the outermost window manager window around the frame. */ @@ -10169,6 +10177,11 @@ static XrmOptionDescRec emacs_options[] = { {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} }; + +/* Whether atimer for Xt timeouts is activated or not. */ + +static int x_timeout_atimer_activated_flag; + #endif /* USE_X_TOOLKIT */ static int x_initialized; @@ -10882,13 +10895,39 @@ static void x_process_timeouts (timer) struct atimer *timer; { + BLOCK_INPUT; + x_timeout_atimer_activated_flag = 0; if (toolkit_scroll_bar_interaction || popup_activated ()) { - BLOCK_INPUT; while (XtAppPending (Xt_app_con) & XtIMTimer) XtAppProcessEvent (Xt_app_con, XtIMTimer); - UNBLOCK_INPUT; + /* Reactivate the atimer for next time. */ + x_activate_timeout_atimer (); } + UNBLOCK_INPUT; +} + +/* Install an asynchronous timer that processes Xt timeout events + every 0.1s as long as either `toolkit_scroll_bar_interaction' or + `popup_activated_flag' (in xmenu.c) is set. Make sure to call this + function whenever these variables are set. This is necessary + because some widget sets use timeouts internally, for example the + LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't + processed, these widgets don't behave normally. */ + +void +x_activate_timeout_atimer () +{ + BLOCK_INPUT; + if (!x_timeout_atimer_activated_flag) + { + EMACS_TIME interval; + + EMACS_SET_SECS_USECS (interval, 0, 100000); + start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); + x_timeout_atimer_activated_flag = 1; + } + UNBLOCK_INPUT; } #endif /* USE_X_TOOLKIT */ @@ -10957,15 +10996,15 @@ x_delete_terminal (struct terminal *terminal) x_destroy_all_bitmaps (dpyinfo); XSetCloseDownMode (dpyinfo->display, DestroyAll); -#ifdef USE_X_TOOLKIT - XtCloseDisplay (dpyinfo->display); -#else #ifdef USE_GTK xg_display_close (dpyinfo->display); #else +#ifdef USE_X_TOOLKIT + XtCloseDisplay (dpyinfo->display); +#else XCloseDisplay (dpyinfo->display); #endif -#endif +#endif /* ! USE_GTK */ x_delete_display (dpyinfo); UNBLOCK_INPUT; @@ -11052,17 +11091,6 @@ x_initialize () XtCacheByDisplay, cvt_pixel_dtor); XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); - - /* Install an asynchronous timer that processes Xt timeout events - every 0.1s. This is necessary because some widget sets use - timeouts internally, for example the LessTif menu bar, or the - Xaw3d scroll bar. When Xt timouts aren't processed, these - widgets don't behave normally. */ - { - EMACS_TIME interval; - EMACS_SET_SECS_USECS (interval, 0, 100000); - start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); - } #endif #ifdef USE_TOOLKIT_SCROLL_BARS diff --git a/src/xterm.h b/src/xterm.h index 8f7055d95d5..3c4bdab33c9 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1003,6 +1003,7 @@ extern XtAppContext Xt_app_con; extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, unsigned long *, double, int)); +extern void x_activate_timeout_atimer P_ ((void)); #endif extern void x_query_colors P_ ((struct frame *f, XColor *, int)); extern void x_query_color P_ ((struct frame *f, XColor *)); |