From 8bc369d4a23a3a8040d77e3ce89a7f63b1ecff97 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 22 Mar 2013 00:18:44 +0900 Subject: [PATCH 01/58] Fix a bug introduced by 2013-03-15T16:06:12Z!handa@gnu.org. --- src/ChangeLog | 6 ++++++ src/coding.c | 2 +- src/insdel.c | 15 +++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2779e5a6ea8..2498bc8c974 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-03-21 Kenichi Handa + + * coding.c (syms_of_coding): Cancel previous change. + + * insdel.c (insert_from_gap): Fix previous change. + 2013-03-20 Kenichi Handa * coding.c (syms_of_coding): Initialize disable_ascii_optimization diff --git a/src/coding.c b/src/coding.c index cb81375a043..8a09cd67859 100644 --- a/src/coding.c +++ b/src/coding.c @@ -10877,7 +10877,7 @@ decode text as usual. */); DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization, doc: /* If non-nil, Emacs does not optimize code decoder for ASCII files. Internal use only. Removed after the experimental optimizer gets stable. */); - disable_ascii_optimization = 1; + disable_ascii_optimization = 0; DEFVAR_LISP ("translation-table-for-input", Vtranslation_table_for_input, doc: /* Char table for translating self-inserting characters. diff --git a/src/insdel.c b/src/insdel.c index a60fed0c32e..3dd81ffeb62 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -983,6 +983,9 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, void insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) { + int ins_charpos = GPT; + int ins_bytepos = GPT_BYTE; + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) nchars = nbytes; @@ -1003,18 +1006,18 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool text_at_gap_tail) eassert (GPT <= GPT_BYTE); - adjust_overlays_for_insert (GPT - nchars, nchars); - adjust_markers_for_insert (GPT - nchars, GPT_BYTE - nbytes, - GPT, GPT_BYTE, 0); + adjust_overlays_for_insert (ins_charpos, nchars); + adjust_markers_for_insert (ins_charpos, ins_bytepos, + ins_charpos + nchars, ins_bytepos + nbytes, 0); if (buffer_intervals (current_buffer)) { - offset_intervals (current_buffer, GPT - nchars, nchars); - graft_intervals_into_buffer (NULL, GPT - nchars, nchars, + offset_intervals (current_buffer, ins_charpos, nchars); + graft_intervals_into_buffer (NULL, ins_charpos, nchars, current_buffer, 0); } - if (! text_at_gap_tail && GPT - nchars < PT) + if (ins_charpos < PT) adjust_point (nchars, nbytes); check_markers (); From 632556e4feb1121faff0c6fd31ee84f7e13591ec Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 5 Apr 2013 10:00:08 -0400 Subject: [PATCH 02/58] * lisp/ido.el (ido-completions): Use extra elements of ido-decorations. (ido-decorations): Update docstring. Fixes: debbugs:14143 --- etc/NEWS | 2 ++ lisp/ChangeLog | 6 ++++++ lisp/ido.el | 16 ++++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 1d416dd3737..d893f496ef0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -87,6 +87,8 @@ Eg View mode, etc. * Changes in Specialized Modes and Packages in Emacs 24.4 +** `ido-decorations' has been slightly extended to give a bit more control. + ** More packages look for ~/.emacs.d/ additionally to ~/.. Affected files: ~/.emacs.d/timelog replaces ~/.timelog diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b77bfb3ab4e..eac9a7b0006 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-04-05 Stefan Monnier + + * ido.el (ido-completions): Use extra elements of ido-decorations + (bug#14143). + (ido-decorations): Update docstring. + 2013-04-05 Michael Albinus * autorevert.el (auto-revert-mode, auto-revert-tail-mode) diff --git a/lisp/ido.el b/lisp/ido.el index 7ace1811daa..bedf00e638d 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -765,7 +765,7 @@ Obsolete. Set 3rd element of `ido-decorations' instead." (defcustom ido-decorations '( "{" "}" " | " " | ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]") "List of strings used by ido to display the alternatives in the minibuffer. -There are 11 elements in this list: +There are between 11 and 13 elements in this list: 1st and 2nd elements are used as brackets around the prospect list, 3rd element is the separator between prospects (ignored if `ido-separator' is set), 4th element is the string inserted at the end of a truncated list of prospects, @@ -775,7 +775,9 @@ can be completed using TAB, 8th element is displayed if there is a single match (and faces are not used), 9th element is displayed when the current directory is non-readable, 10th element is displayed when directory exceeds `ido-max-directory-size', -11th element is displayed to confirm creating new file or buffer." +11th element is displayed to confirm creating new file or buffer. +12th and 13th elements (if present) are used as brackets around the sole +remaining completion. If absent, elements 5 and 6 are used instead." :type '(repeat string) :group 'ido) @@ -4581,10 +4583,12 @@ For details of keybindings, see `ido-find-file'." (string-equal (match-string 0 (ido-name (car comps))) (ido-name (car comps)))) "" - ;; when there is one match, show the matching file name in full - (concat (nth 4 ido-decorations) ;; [ ... ] - (ido-name (car comps)) - (nth 5 ido-decorations))) + ;; When there is only one match, show the matching file + ;; name in full, wrapped in [ ... ]. + (concat + (or (nth 11 ido-decorations) (nth 4 ido-decorations)) + (ido-name (car comps)) + (or (nth 12 ido-decorations) (nth 5 ido-decorations)))) (if (not ido-use-faces) (nth 7 ido-decorations)))) ;; [Matched] (t ;multiple matches (let* ((items (if (> ido-max-prospects 0) (1+ ido-max-prospects) 999)) From 73931ad14ad7a51d91f10b19ae9ca8cadb256916 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 5 Apr 2013 18:07:02 +0400 Subject: [PATCH 03/58] Consistently use platform-specific function to detect window system. * lisp.h (check_window_system): New prototype. This function is going to replace check_x, check_w32 and check_ns. (have_menus_p): Mention msdos.c in comment. * fontset.c (check_window_system_func): Remove. Adjust all users. * fontset.h (check_window_system_func): Remove prototype. * nsterm.h (check_ns): * xterm.h (check_x): * w32term.h (check_w32): Likewise. * menu.c (Fx_popup_menu): Use check_window_system. * msdos.c (check_window_system): Define for MS-DOS. * nsfns.m (check_window_system): Define for NS. Adjust all users. * w32fns.c (check_window_system): Likewise for MS-Windows. * xfns.c (check_window_system): Likewise for X. * font.c, frame.c, nsmenu.m, nsselect.m, nsterm.m, w32menu.c: * xfaces.c, xmenu.c: Use check_window_system where appropriate. --- src/ChangeLog | 19 +++++++++++++++ src/font.c | 2 +- src/fontset.c | 8 ++----- src/fontset.h | 3 --- src/frame.c | 4 +--- src/lisp.h | 7 +++++- src/menu.c | 3 ++- src/msdos.c | 2 +- src/nsfns.m | 65 ++++++++++++++++++++++++-------------------------- src/nsmenu.m | 2 +- src/nsselect.m | 14 +++++------ src/nsterm.h | 1 - src/nsterm.m | 12 +++++----- src/w32fns.c | 6 ++--- src/w32menu.c | 2 +- src/w32term.h | 1 - src/xfaces.c | 4 +--- src/xfns.c | 13 ++++------ src/xmenu.c | 2 +- src/xterm.h | 4 ---- 20 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ea4e660ed8d..a11100e9aa8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2013-04-05 Dmitry Antipov + + Consistently use platform-specific function to detect window system. + * lisp.h (check_window_system): New prototype. This function is + going to replace check_x, check_w32 and check_ns. + (have_menus_p): Mention msdos.c in comment. + * fontset.c (check_window_system_func): Remove. Adjust all users. + * fontset.h (check_window_system_func): Remove prototype. + * nsterm.h (check_ns): + * xterm.h (check_x): + * w32term.h (check_w32): Likewise. + * menu.c (Fx_popup_menu): Use check_window_system. + * msdos.c (check_window_system): Define for MS-DOS. + * nsfns.m (check_window_system): Define for NS. Adjust all users. + * w32fns.c (check_window_system): Likewise for MS-Windows. + * xfns.c (check_window_system): Likewise for X. + * font.c, frame.c, nsmenu.m, nsselect.m, nsterm.m, w32menu.c: + * xfaces.c, xmenu.c: Use check_window_system where appropriate. + 2013-04-02 Paul Eggert Prefer < to > in range checks such as 0 <= i && i < N. diff --git a/src/font.c b/src/font.c index 0b0144f3197..17573cdc264 100644 --- a/src/font.c +++ b/src/font.c @@ -4844,7 +4844,7 @@ If the named font is not yet loaded, return nil. */) Lisp_Object info; Lisp_Object font_object; - (*check_window_system_func) (); + check_window_system (); if (! FONTP (name)) CHECK_STRING (name); diff --git a/src/fontset.c b/src/fontset.c index 3578bc9403d..7aec26bbb5b 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -179,10 +179,6 @@ static int next_fontset_id; font for each character. */ static Lisp_Object Vdefault_fontset; -/* Check if any window system is used now. */ -void (*check_window_system_func) (void); - - /* Prototype declarations for static functions. */ static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); @@ -1213,7 +1209,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */) Lisp_Object fontset; int id; - (*check_window_system_func) (); + check_window_system (); CHECK_STRING (pattern); @@ -1919,7 +1915,7 @@ format is the same as above. */) Lisp_Object val, elt; int c, i, j, k; - (*check_window_system_func) (); + check_window_system (); fontset = check_fontset_name (fontset, &frame); diff --git a/src/fontset.h b/src/fontset.h index 07ee5d65c25..926520c8001 100644 --- a/src/fontset.h +++ b/src/fontset.h @@ -26,9 +26,6 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_FONTSET_H #define EMACS_FONTSET_H -/* Check if any window system is used now. */ -extern void (*check_window_system_func) (void); - struct face; extern void free_face_fontset (FRAME_PTR, struct face *); diff --git a/src/frame.c b/src/frame.c index 0aeaf4cf417..5d5876ed097 100644 --- a/src/frame.c +++ b/src/frame.c @@ -3493,9 +3493,7 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) { -#ifdef HAVE_X_WINDOWS - check_x (); -#endif + check_window_system (); return xrdb_get_resource (check_x_display_info (Qnil)->xrdb, attribute, class, component, subclass); diff --git a/src/lisp.h b/src/lisp.h index 82cf0cb2678..2e1d20a5109 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3765,6 +3765,11 @@ extern void syms_of_xterm (void); extern char *x_get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ +#if defined(HAVE_WINDOW_SYSTEM) || defined (MSDOS) +/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ +extern void check_window_system (void); +#endif + #ifdef HAVE_LIBXML2 /* Defined in xml.c. */ extern void syms_of_xml (void); @@ -3772,7 +3777,7 @@ extern void xml_cleanup_parser (void); #endif #ifdef HAVE_MENUS -/* Defined in (x|w32)fns.c, nsfns.m... */ +/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ extern int have_menus_p (void); #endif diff --git a/src/menu.c b/src/menu.c index ffb5c3bc936..ec9c681a3a9 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1085,7 +1085,8 @@ no quit occurs and `x-popup-menu' returns nil. */) #ifdef HAVE_MENUS { bool get_current_pos_p = 0; - /* FIXME!! check_w32 (); or check_x (); or check_ns (); */ + + check_window_system (); /* Decode the first argument: find the window and the coordinates. */ if (EQ (position, Qt) diff --git a/src/msdos.c b/src/msdos.c index 695cca60728..dc79b66e0b1 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1920,7 +1920,7 @@ dos_get_saved_screen (char **screen, int *rows, int *cols) /* We are not X, but we can emulate it well enough for our needs... */ void -check_x (void) +check_window_system (void) { if (! FRAME_MSDOS_P (SELECTED_FRAME ())) error ("Not running under a window system"); diff --git a/src/nsfns.m b/src/nsfns.m index 17f27910ca2..f7cf898c7a9 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -109,7 +109,7 @@ Updated by Christian Limpach (chris@nice.ch) void -check_ns (void) +check_window_system (void) { if (NSApp == nil) error ("OpenStep is not in use or not initialized"); @@ -1145,7 +1145,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side Lisp_Object tfont, tfontsize; static int desc_ctr = 1; - check_ns (); + check_window_system (); /* x_get_arg modifies parms. */ parms = Fcopy_alist (parms); @@ -1442,7 +1442,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side id fm; struct frame *f; - check_ns (); + check_window_system (); fm = [NSFontManager sharedFontManager]; if (NILP (frame)) f = SELECTED_FRAME (); @@ -1466,7 +1466,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side { struct frame *f; - check_ns (); + check_window_system (); if (NILP (frame)) f = SELECTED_FRAME (); else @@ -1503,7 +1503,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side NSString *initS = NILP (init) || !STRINGP (init) ? nil : [NSString stringWithUTF8String: SSDATA (init)]; - check_ns (); + check_window_system (); if (fileDelegate == nil) fileDelegate = [EmacsFileDelegate new]; @@ -1594,7 +1594,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side { const char *value; - check_ns (); + check_window_system (); if (NILP (owner)) owner = build_string([ns_app_name UTF8String]); CHECK_STRING (name); @@ -1614,7 +1614,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side If VALUE is nil, the default is removed. */) (Lisp_Object owner, Lisp_Object name, Lisp_Object value) { - check_ns (); + check_window_system (); if (NILP (owner)) owner = build_string ([ns_app_name UTF8String]); CHECK_STRING (name); @@ -1642,7 +1642,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side doc: /* This function is a no-op. It is only present for completeness. */) (Lisp_Object display) { - check_ns (); + check_window_system (); /* This function has no real equivalent under NeXTstep. Return nil to indicate this. */ return Qnil; @@ -1692,7 +1692,7 @@ and GNUstep implementations ("distributor-specific release { int num; - check_ns (); + check_window_system (); num = [[NSScreen screens] count]; return (num != 0) ? make_number (num) : Qnil; @@ -1706,7 +1706,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_ns (); + check_window_system (); return make_number ((int) ([ns_get_screen (display) frame].size.height/(92.0/25.4))); } @@ -1719,7 +1719,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_ns (); + check_window_system (); return make_number ((int) ([ns_get_screen (display) frame].size.width/(92.0/25.4))); } @@ -1733,7 +1733,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_ns (); + check_window_system (); switch ([ns_get_window (display) backingType]) { case NSBackingStoreBuffered: @@ -1759,7 +1759,7 @@ and GNUstep implementations ("distributor-specific release (Lisp_Object display) { NSWindowDepth depth; - check_ns (); + check_window_system (); depth = [ns_get_screen (display) depth]; if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) @@ -1786,7 +1786,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_ns (); + check_window_system (); switch ([ns_get_window (display) backingType]) { case NSBackingStoreBuffered: @@ -1839,7 +1839,7 @@ and GNUstep implementations ("distributor-specific release The argument DISPLAY is currently ignored. */) (Lisp_Object display) { - check_ns (); + check_window_system (); /*ns_delete_terminal (dpyinfo->terminal); */ [NSApp terminate: NSApp]; return Qnil; @@ -1865,7 +1865,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Hides all applications other than Emacs. */) (void) { - check_ns (); + check_window_system (); [NSApp hideOtherApplications: NSApp]; return Qnil; } @@ -1878,7 +1878,7 @@ and GNUstep implementations ("distributor-specific release the active application. */) (Lisp_Object on) { - check_ns (); + check_window_system (); if (EQ (on, intern ("activate"))) { [NSApp unhide: NSApp]; @@ -1897,7 +1897,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Shows the 'Info' or 'About' panel for Emacs. */) (void) { - check_ns (); + check_window_system (); [NSApp orderFrontStandardAboutPanel: nil]; return Qnil; } @@ -1975,7 +1975,7 @@ and GNUstep implementations ("distributor-specific release NSMenu *svcs; id delegate; - check_ns (); + check_window_system (); svcs = [[NSMenu alloc] initWithTitle: @"Services"]; [NSApp setServicesMenu: svcs]; [NSApp registerServicesMenuSendTypes: ns_send_types @@ -2028,7 +2028,7 @@ and GNUstep implementations ("distributor-specific release char *utfStr; CHECK_STRING (service); - check_ns (); + check_window_system (); utfStr = SSDATA (service); svcName = [NSString stringWithUTF8String: utfStr]; @@ -2152,7 +2152,7 @@ and GNUstep implementations ("distributor-specific release NSEvent *nxev; CHECK_STRING (script); - check_ns (); + check_window_system (); block_input (); @@ -2235,7 +2235,7 @@ and GNUstep implementations ("distributor-specific release /* remove appname prefix; TODO: allow for !="Emacs" */ char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0); const char *res; - check_ns (); + check_window_system (); if (inhibit_x_resources) /* --quick was passed, so this is a no-op. */ @@ -2305,7 +2305,7 @@ and GNUstep implementations ("distributor-specific release (Lisp_Object color, Lisp_Object frame) { NSColor * col; - check_ns (); + check_window_system (); return ns_lisp_to_color (color, &col) ? Qnil : Qt; } @@ -2317,7 +2317,7 @@ and GNUstep implementations ("distributor-specific release NSColor * col; CGFloat red, green, blue, alpha; - check_ns (); + check_window_system (); CHECK_STRING (color); if (ns_lisp_to_color (color, &col)) @@ -2336,7 +2336,7 @@ and GNUstep implementations ("distributor-specific release { NSWindowDepth depth; NSString *colorSpace; - check_ns (); + check_window_system (); depth = [ns_get_screen (display) depth]; colorSpace = NSColorSpaceFromDepth (depth); @@ -2356,7 +2356,7 @@ and GNUstep implementations ("distributor-specific release (Lisp_Object display) { NSWindowDepth depth; - check_ns (); + check_window_system (); depth = [ns_get_screen (display) depth]; return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; @@ -2371,7 +2371,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_ns (); + check_window_system (); return make_number ((int) [ns_get_screen (display) frame].size.width); } @@ -2384,7 +2384,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_ns (); + check_window_system (); return make_number ((int) [ns_get_screen (display) frame].size.height); } @@ -2404,7 +2404,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which NSScreen *screen; NSRect vScreen; - check_ns (); + check_window_system (); screen = ns_get_screen (display); if (!screen) return Qnil; @@ -2428,7 +2428,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_ns (); + check_window_system (); return make_number (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth])); } @@ -2443,7 +2443,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which (Lisp_Object display) { struct ns_display_info *dpyinfo; - check_ns (); + check_window_system (); dpyinfo = check_ns_display_info (display); /* We force 24+ bit depths to 24-bit to prevent an overflow. */ @@ -2787,9 +2787,6 @@ - (NSString *)panel: (id)sender userEnteredFilename: (NSString *)filename defsubr (&Sx_show_tip); defsubr (&Sx_hide_tip); - /* used only in fontset.c */ - check_window_system_func = check_ns; - as_status = 0; as_script = Qnil; as_result = 0; diff --git a/src/nsmenu.m b/src/nsmenu.m index 15878dc74d7..d364639b0bc 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1409,7 +1409,7 @@ - (NSRect) frame NSTRACE (x-popup-dialog); - check_ns (); + check_window_system (); isQ = NILP (header); diff --git a/src/nsselect.m b/src/nsselect.m index 49380f87945..2f539a16406 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -355,7 +355,7 @@ Updated by Christian Limpach (chris@nice.ch) Lisp_Object target_symbol, data; - check_ns (); + check_window_system (); CHECK_SYMBOL (selection); if (NILP (value)) error ("selection value may not be nil."); @@ -409,7 +409,7 @@ Updated by Christian Limpach (chris@nice.ch) (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) { id pb; - check_ns (); + check_window_system (); CHECK_SYMBOL (selection); if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; @@ -436,7 +436,7 @@ Updated by Christian Limpach (chris@nice.ch) id pb; NSArray *types; - check_ns (); + check_window_system (); CHECK_SYMBOL (selection); if (EQ (selection, Qnil)) selection = QPRIMARY; if (EQ (selection, Qt)) selection = QSECONDARY; @@ -464,7 +464,7 @@ Updated by Christian Limpach (chris@nice.ch) On Nextstep, TERMINAL is unused. */) (Lisp_Object selection, Lisp_Object terminal) { - check_ns (); + check_window_system (); CHECK_SYMBOL (selection); if (EQ (selection, Qnil)) selection = QPRIMARY; if (EQ (selection, Qt)) selection = QSECONDARY; @@ -492,7 +492,7 @@ Updated by Christian Limpach (chris@nice.ch) { Lisp_Object val; - check_ns (); + check_window_system (); CHECK_SYMBOL (selection_name); CHECK_SYMBOL (target_type); val = ns_get_local_selection (selection_name, target_type); @@ -516,7 +516,7 @@ Updated by Christian Limpach (chris@nice.ch) (Lisp_Object selection) { id pb; - check_ns (); + check_window_system (); pb = ns_symbol_to_pb (selection); return pb != nil ? ns_string_from_pasteboard (pb) : Qnil; } @@ -529,7 +529,7 @@ Updated by Christian Limpach (chris@nice.ch) (Lisp_Object selection, Lisp_Object string) { id pb; - check_ns (); + check_window_system (); pb = ns_symbol_to_pb (selection); if (pb != nil) ns_string_to_pasteboard (pb, string); return Qnil; diff --git a/src/nsterm.h b/src/nsterm.h index a43a90428d0..59cac34773a 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -764,7 +764,6 @@ extern void ns_clear_frame (struct frame *f); extern const char *ns_xlfd_to_fontname (const char *xlfd); -extern void check_ns (void); extern Lisp_Object ns_map_event_to_object (void); #ifdef __OBJC__ extern Lisp_Object ns_string_from_pasteboard (id pb); diff --git a/src/nsterm.m b/src/nsterm.m index 9baa95a506b..fb1b0aa327c 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1013,7 +1013,7 @@ Free a pool and temporary objects it refers to (callable from C) -------------------------------------------------------------------------- */ { NSView *view = FRAME_NS_VIEW (f); - check_ns (); + check_window_system (); block_input (); if (FRAME_VISIBLE_P (f)) [[view window] makeKeyAndOrderFront: NSApp]; @@ -1028,7 +1028,7 @@ Free a pool and temporary objects it refers to (callable from C) -------------------------------------------------------------------------- */ { NSView *view = FRAME_NS_VIEW (f); - check_ns (); + check_window_system (); block_input (); [[view window] orderBack: NSApp]; unblock_input (); @@ -1133,7 +1133,7 @@ Free a pool and temporary objects it refers to (callable from C) { NSView * view = FRAME_NS_VIEW (f); NSTRACE (x_make_frame_invisible); - check_ns (); + check_window_system (); [[view window] orderOut: NSApp]; SET_FRAME_VISIBLE (f, 0); SET_FRAME_ICONIFIED (f, 0); @@ -1149,7 +1149,7 @@ Free a pool and temporary objects it refers to (callable from C) NSView * view = FRAME_NS_VIEW (f); struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); NSTRACE (x_iconify_frame); - check_ns (); + check_window_system (); if (dpyinfo->x_highlight_frame == f) dpyinfo->x_highlight_frame = 0; @@ -1178,7 +1178,7 @@ Free a pool and temporary objects it refers to (callable from C) struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); NSTRACE (x_free_frame_resources); - check_ns (); + check_window_system (); [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ @@ -1219,7 +1219,7 @@ Free a pool and temporary objects it refers to (callable from C) -------------------------------------------------------------------------- */ { NSTRACE (x_destroy_window); - check_ns (); + check_window_system (); x_free_frame_resources (f); ns_window_num--; } diff --git a/src/w32fns.c b/src/w32fns.c index bd54e990efc..2bc1042e126 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -242,7 +242,7 @@ static unsigned int sound_type = 0xFFFFFFFF; /* Error if we are not connected to MS-Windows. */ void -check_w32 (void) +check_window_system (void) { if (! w32_in_use) error ("MS-Windows not in use or not initialized"); @@ -5358,7 +5358,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object buffer; struct buffer *old_buffer; - check_w32 (); + check_window_system (); /* Use this general default value to start with until we know if this frame has a specified name. */ @@ -7635,8 +7635,6 @@ only be necessary if the default setting causes problems. */); defsubr (&Sdefault_printer_name); defsubr (&Sset_message_beep); - check_window_system_func = check_w32; - hourglass_hwnd = NULL; defsubr (&Sx_show_tip); diff --git a/src/w32menu.c b/src/w32menu.c index 60ef6d2cfb5..0c8d5ca06c5 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -140,7 +140,7 @@ otherwise it is "Question". */) FRAME_PTR f = NULL; Lisp_Object window; - check_w32 (); + check_window_system (); /* Decode the first argument: find the window or frame to use. */ if (EQ (position, Qt) diff --git a/src/w32term.h b/src/w32term.h index b319f0ca592..e85ee7790d5 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -203,7 +203,6 @@ extern void x_focus_on_frame (struct frame *f); extern struct w32_display_info *w32_term_init (Lisp_Object, char *, char *); -extern void check_w32 (void); extern int w32_defined_color (FRAME_PTR f, const char *color, XColor *color_def, int alloc); extern void x_set_window_size (struct frame *f, int change_grav, diff --git a/src/xfaces.c b/src/xfaces.c index b988295e9b6..9acaf6d6f52 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -231,7 +231,6 @@ along with GNU Emacs. If not, see . */ #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO #define x_display_info w32_display_info -#define check_x check_w32 #define GCGraphicsExposures 0 #endif /* HAVE_NTGUI */ @@ -239,7 +238,6 @@ along with GNU Emacs. If not, see . */ #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO #define x_display_info ns_display_info -#define check_x check_ns #define GCGraphicsExposures 0 #endif /* HAVE_NS */ #endif /* HAVE_WINDOW_SYSTEM */ @@ -1636,7 +1634,7 @@ the WIDTH times as wide as FACE on FRAME. */) struct frame *f; int size, avgwidth IF_LINT (= 0); - check_x (); + check_window_system (); CHECK_STRING (pattern); if (! NILP (maximum)) diff --git a/src/xfns.c b/src/xfns.c index b39b78004a4..8b8d94d4779 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -143,7 +143,7 @@ static struct x_display_info *x_display_info_for_name (Lisp_Object); /* Error if we are not connected to X. */ void -check_x (void) +check_window_system (void) { if (! x_in_use) error ("X windows are not in use or not initialized"); @@ -4525,7 +4525,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object buffer; struct buffer *old_buffer; - check_x (); + check_window_system (); if (!dpyinfo->terminal->name) error ("Terminal is not live, can't create new frames on it"); @@ -5316,7 +5316,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; - check_x (); + check_window_system (); GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); @@ -5486,7 +5486,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char *cdef_file; - check_x (); + check_window_system (); GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); @@ -5548,7 +5548,7 @@ nil, it defaults to the selected frame. */) struct gcpro gcpro1, gcpro2; ptrdiff_t count = SPECPDL_INDEX (); - check_x (); + check_window_system (); if (popup_activated ()) error ("Trying to use a menu from within a menu-entry"); @@ -5919,9 +5919,6 @@ When using Gtk+ tooltips, the tooltip face is not used. */); defsubr (&Sx_focus_frame); defsubr (&Sx_backspace_delete_keys_p); - /* Setting callback functions for fontset handler. */ - check_window_system_func = check_x; - defsubr (&Sx_show_tip); defsubr (&Sx_hide_tip); tip_timer = Qnil; diff --git a/src/xmenu.c b/src/xmenu.c index 2042699f48c..e6291edf7d6 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -223,7 +223,7 @@ for instance using the window manager, then this produces a quit and FRAME_PTR f = NULL; Lisp_Object window; - check_x (); + check_window_system (); /* Decode the first argument: find the window or frame to use. */ if (EQ (position, Qt) diff --git a/src/xterm.h b/src/xterm.h index b241ff23559..6b64135927e 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -366,10 +366,6 @@ struct x_display_info extern int use_xim; #endif -/* This checks to make sure we have a display. */ - -extern void check_x (void); - extern struct frame *x_window_to_frame (struct x_display_info *, int); extern struct frame *x_any_window_to_frame (struct x_display_info *, int); extern struct frame *x_menubar_window_to_frame (struct x_display_info *, From 251e91474c91e16b101502c2ed7c05fc13e4ecea Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Fri, 5 Apr 2013 23:08:56 +0900 Subject: [PATCH 04/58] Optimize the code for reading UTF-8 files. --- src/ChangeLog | 16 +++- src/coding.c | 204 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 177 insertions(+), 43 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0634ec7cc1d..6b3ca9d3ff3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2013-04-03 Kenichi Handa + + The following changes is to optimize the code for reading UTF-8 + files. + + * coding.c (check_ascii): Renamed from detect_ascii. Return value + changed. Check EOL format. Do not call adjust_coding_eol_type + here. + (check_utf_8): New function. + (adjust_coding_eol_type): Do nothing if already adjusted. + (detect_coding): Compare the return value of check_ascii with + coding->src_bytes. Call adjust_coding_eol_type if necessary. + (decode_coding_gap): Optimize for valid UTF-8. + 2013-03-21 Kenichi Handa * coding.c (syms_of_coding): Cancel previous change. @@ -89,7 +103,7 @@ * coding.c (decode_coding_gap): Fix typo caught by static checking. -2013-03-15 handa +2013-03-15 Kenichi Handa * insdel.c (insert_from_gap): New arg text_at_gap_tail. (adjust_after_replace): Make it back to static. Delete the third diff --git a/src/coding.c b/src/coding.c index 8a09cd67859..735af25502d 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6072,17 +6072,18 @@ complement_process_encoding_system (Lisp_Object coding_system) #define EOL_SEEN_CRLF 4 -static Lisp_Object adjust_coding_eol_type (struct coding_system *coding, int eol_seen); +static Lisp_Object adjust_coding_eol_type (struct coding_system *coding, + int eol_seen); -/* Return true iff all the source bytes are ASCII. +/* Return the number of ASCII characters at the head of the source. By side effects, set coding->head_ascii and coding->eol_seen. The value of coding->eol_seen is "logical or" of EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but the value is reliable only when all the source bytes are ASCII. */ -static bool -detect_ascii (struct coding_system *coding) +static int +check_ascii (struct coding_system *coding) { const unsigned char *src, *end; Lisp_Object eol_type = CODING_ID_EOL_TYPE (coding->id); @@ -6096,21 +6097,20 @@ detect_ascii (struct coding_system *coding) src = coding->source; end = src + coding->src_bytes; - if (inhibit_eol_conversion) + if (inhibit_eol_conversion + || eol_seen != EOL_SEEN_NONE) { /* We don't have to check EOL format. */ while (src < end && !( *src & 0x80)) src++; - eol_seen = EOL_SEEN_LF; - adjust_coding_eol_type (coding, eol_seen); - } - else if (eol_seen != EOL_SEEN_NONE) - { - /* We don't have to check EOL format either. */ - while (src < end && !(*src & 0x80)) src++; + if (inhibit_eol_conversion) + { + eol_seen = EOL_SEEN_LF; + adjust_coding_eol_type (coding, eol_seen); + } } else { - end--; /* We look ahead one byte. */ + end--; /* We look ahead one byte for "CR LF". */ while (src < end) { int c = *src; @@ -6118,6 +6118,69 @@ detect_ascii (struct coding_system *coding) if (c & 0x80) break; src++; + if (c == '\r') + { + if (*src == '\n') + { + eol_seen |= EOL_SEEN_CRLF; + src++; + } + else + eol_seen |= EOL_SEEN_CR; + } + else if (c == '\n') + eol_seen |= EOL_SEEN_LF; + } + if (src == end) + { + int c = *src; + + /* All bytes but the last one C are ASCII. */ + if (! (c & 0x80)) + { + if (c == '\r') + eol_seen |= EOL_SEEN_CR; + else if (c == '\n') + eol_seen |= EOL_SEEN_LF; + src++; + } + } + } + coding->head_ascii = src - coding->source; + coding->eol_seen = eol_seen; + return (coding->head_ascii); +} + + +/* Return the number of charcters at the source if all the bytes are + valid UTF-8 (of Unicode range). Otherwise, return -1. By side + effects, update coding->eol_seen. The value of coding->eol_seen is + "logical or" of EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but + the value is reliable only when all the source bytes are valid + UTF-8. */ + +static int +check_utf_8 (struct coding_system *coding) +{ + const unsigned char *src, *end; + int eol_seen = coding->eol_seen; + int nchars = coding->head_ascii; + + if (coding->head_ascii < 0) + check_ascii (coding); + else + coding_set_source (coding); + src = coding->source + coding->head_ascii; + /* We look ahead one byte for CR LF. */ + end = coding->source + coding->src_bytes - 1; + + while (src < end) + { + int c = *src; + + if (UTF_8_1_OCTET_P (*src)) + { + src++; if (c < 0x20) { if (c == '\r') @@ -6126,6 +6189,7 @@ detect_ascii (struct coding_system *coding) { eol_seen |= EOL_SEEN_CRLF; src++; + nchars++; } else eol_seen |= EOL_SEEN_CR; @@ -6134,27 +6198,58 @@ detect_ascii (struct coding_system *coding) eol_seen |= EOL_SEEN_LF; } } - if (src > end) - /* The last two bytes are CR LF, which means that we have - scanned all bytes. */ - end++; - else if (src == end) + else if (UTF_8_2_OCTET_LEADING_P (c)) { - end++; - if (! (*src & 0x80)) - { - if (*src == '\r') - eol_seen |= EOL_SEEN_CR; - else if (*src == '\n') - eol_seen |= EOL_SEEN_LF; - src++; - } + if (c < 0xC2 /* overlong sequence */ + || src + 1 >= end + || ! UTF_8_EXTRA_OCTET_P (src[1])) + return -1; + src += 2; } - adjust_coding_eol_type (coding, eol_seen); + else if (UTF_8_3_OCTET_LEADING_P (c)) + { + if (src + 2 >= end + || ! (UTF_8_EXTRA_OCTET_P (src[1]) + && UTF_8_EXTRA_OCTET_P (src[2]))) + return -1; + c = (((c & 0xF) << 12) + | ((src[1] & 0x3F) << 6) | (src[2] & 0x3F)); + if (c < 0x800 /* overlong sequence */ + || (c >= 0xd800 && c < 0xe000)) /* surrogates (invalid) */ + return -1; + src += 3; + } + else if (UTF_8_4_OCTET_LEADING_P (c)) + { + if (src + 3 >= end + || ! (UTF_8_EXTRA_OCTET_P (src[1]) + && UTF_8_EXTRA_OCTET_P (src[2]) + && UTF_8_EXTRA_OCTET_P (src[3]))) + return -1; + c = (((c & 0x7) << 18) | ((src[1] & 0x3F) << 12) + | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); + if (c < 0x10000 /* overlong sequence */ + || c >= 0x110000) /* non-Unicode character */ + return -1; + src += 4; + } + else + return -1; + nchars++; + } + + if (src == end) + { + if (! UTF_8_1_OCTET_P (*src)) + return -1; + nchars++; + if (*src == '\r') + eol_seen |= EOL_SEEN_CR; + else if (*src == '\n') + eol_seen |= EOL_SEEN_LF; } - coding->head_ascii = src - coding->source; coding->eol_seen = eol_seen; - return (src == end); + return nchars; } @@ -6269,6 +6364,9 @@ adjust_coding_eol_type (struct coding_system *coding, int eol_seen) Lisp_Object eol_type; eol_type = CODING_ID_EOL_TYPE (coding->id); + if (! VECTORP (eol_type)) + /* Already adjusted. */ + return eol_type; if (eol_seen & EOL_SEEN_LF) { coding->id = CODING_SYSTEM_ID (AREF (eol_type, 0)); @@ -6360,7 +6458,8 @@ detect_coding (struct coding_system *coding) { coding->eol_seen |= EOL_SEEN_CRLF; src++; - coding->head_ascii++; + if (! eight_bit_found) + coding->head_ascii++; } else coding->eol_seen |= EOL_SEEN_CR; @@ -6461,9 +6560,14 @@ detect_coding (struct coding_system *coding) coding_systems = AREF (CODING_ID_ATTRS (coding->id), coding_attr_utf_bom); detect_info.found = detect_info.rejected = 0; - if (detect_ascii (coding)) + if (check_ascii (coding) == coding->src_bytes) { + int head_ascii = coding->head_ascii; + + if (coding->eol_seen != EOL_SEEN_NONE) + adjust_coding_eol_type (coding, coding->eol_seen); setup_coding_system (XCDR (coding_systems), coding); + coding->head_ascii = head_ascii; } else { @@ -7620,15 +7724,27 @@ decode_coding_gap (struct coding_system *coding, if (CODING_REQUIRE_DETECTION (coding)) detect_coding (coding); attrs = CODING_ID_ATTRS (coding->id); - if (! disable_ascii_optimization) + if (! disable_ascii_optimization + && ! coding->src_multibyte + && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) + && NILP (CODING_ATTR_POST_READ (attrs)) + && NILP (get_translation_table (attrs, 0, NULL))) { - if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) - && NILP (CODING_ATTR_POST_READ (attrs)) - && NILP (get_translation_table (attrs, 0, NULL)) - && (coding->head_ascii >= 0 /* We've already called detect_coding */ - ? coding->head_ascii == bytes - : detect_ascii (coding))) + chars = coding->head_ascii; + if (chars < 0) + chars = check_ascii (coding); + if (chars != bytes) { + if (EQ (CODING_ATTR_TYPE (attrs), Qutf_8)) + chars = check_utf_8 (coding); + else + chars = -1; + } + if (chars >= 0) + { + if (coding->eol_seen != EOL_SEEN_NONE) + adjust_coding_eol_type (coding, coding->eol_seen); + if (coding->eol_seen == EOL_SEEN_CR) { unsigned char *src_end = GAP_END_ADDR; @@ -7645,6 +7761,7 @@ decode_coding_gap (struct coding_system *coding, unsigned char *src = GAP_END_ADDR; unsigned char *src_beg = src - coding->src_bytes; unsigned char *dst = src; + ptrdiff_t diff; while (src_beg < src) { @@ -7652,10 +7769,13 @@ decode_coding_gap (struct coding_system *coding, if (*src == '\n') src--; } - bytes -= dst - src; + diff = dst - src; + bytes -= diff; + chars -= diff; } - coding->produced_char = coding->produced = bytes; - insert_from_gap (bytes, bytes, 1); + coding->produced = bytes; + coding->produced_char = chars; + insert_from_gap (chars, bytes, 1); return; } } From 7e268e9006c32eb1b1330aada4220e1a33859ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Mart=C3=ADn?= Date: Fri, 5 Apr 2013 17:43:07 +0200 Subject: [PATCH 05/58] ispell.el (ispell-set-spellchecker-params): Really set `ispell-args' for all equivs. Was not actually modifying ispell-args for dicts where it was nil before. Thanks Jacek Chrzaszcz. --- lisp/ChangeLog | 5 +++++ lisp/textmodes/ispell.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index eac9a7b0006..701973648c3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-05 Jacek Chrząszcz (tiny change) + + * ispell.el (ispell-set-spellchecker-params): + Really set `ispell-args' for all equivs. + 2013-04-05 Stefan Monnier * ido.el (ido-completions): Use extra elements of ido-decorations diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el index 467ac004420..a56554f5b66 100644 --- a/lisp/textmodes/ispell.el +++ b/lisp/textmodes/ispell.el @@ -1383,7 +1383,8 @@ aspell is used along with Emacs).") ;; Unless default dict, re-add "-d" option with the mapped value (if dict-name (if dict-equiv - (nconc ispell-args (list "-d" dict-equiv)) + (setq ispell-args + (nconc ispell-args (list "-d" dict-equiv))) (message "ispell-set-spellchecker-params: Missing hunspell equiv for \"%s\". Skipping." dict-name) From 134abf1faef6596a62d3c04769e212b99f621d49 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 5 Apr 2013 14:46:59 -0400 Subject: [PATCH 06/58] * lisp/emacs-lisp/package.el (package-compute-transaction): Fix last fix. Suggested by Donald Curtis . Fixes: debbugs:14082 --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 8 ++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 701973648c3..b3073dd9499 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-05 Stefan Monnier + + * emacs-lisp/package.el (package-compute-transaction): Fix last fix. + Suggested by Donald Curtis (bug#14082). + 2013-04-05 Jacek Chrząszcz (tiny change) * ispell.el (ispell-set-spellchecker-params): diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index d005c200d0c..605d1cf375c 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -809,12 +809,8 @@ but version %s required" "Need package `%s-%s', but only %s is available" (symbol-name next-pkg) (package-version-join next-version) (package-version-join (package-desc-vers (cdr pkg-desc))))) - ;; Only add to the transaction if we don't already have it. - (unless (memq next-pkg package-list) - (setq package-list - ;; Move to front, so it gets installed early enough - ;; (bug#14082). - (cons next-pkg (delq next-pkg package-list)))) + ;; Move to front, so it gets installed early enough (bug#14082). + (setq package-list (cons next-pkg (delq next-pkg package-list))) (setq package-list (package-compute-transaction package-list (package-desc-reqs From d695cb94fb71c8c8d4822fbf9d702dbda3252aac Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 6 Apr 2013 02:22:12 +0400 Subject: [PATCH 07/58] * lisp/whitespace.el (whitespace-color-on, whitespace-color-off): Only call `font-lock-fontify-buffer' when `font-lock-mode' is on. --- lisp/ChangeLog | 5 +++++ lisp/whitespace.el | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b3073dd9499..1af9905c7e3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,11 @@ * emacs-lisp/package.el (package-compute-transaction): Fix last fix. Suggested by Donald Curtis (bug#14082). +2013-04-05 Dmitry Gutov + + * whitespace.el (whitespace-color-on, whitespace-color-off): Only + call `font-lock-fontify-buffer' when `font-lock-mode' is on. + 2013-04-05 Jacek Chrząszcz (tiny change) * ispell.el (ispell-set-spellchecker-params): diff --git a/lisp/whitespace.el b/lisp/whitespace.el index c32155f5430..68625e06acb 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2243,7 +2243,8 @@ resultant list will be returned." (whitespace-space-after-tab-regexp 'space))) 1 whitespace-space-after-tab t))))) (font-lock-add-keywords nil whitespace-font-lock-keywords t) - (font-lock-fontify-buffer))) + (when font-lock-mode + (font-lock-fontify-buffer)))) (defun whitespace-color-off () @@ -2253,7 +2254,8 @@ resultant list will be returned." (remove-hook 'post-command-hook #'whitespace-post-command-hook t) (remove-hook 'before-change-functions #'whitespace-buffer-changed t) (font-lock-remove-keywords nil whitespace-font-lock-keywords) - (font-lock-fontify-buffer))) + (when font-lock-mode + (font-lock-fontify-buffer)))) (defun whitespace-trailing-regexp (limit) From 8ead390103b65c93977dd4dee419f66316a79b96 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 6 Apr 2013 00:33:18 -0700 Subject: [PATCH 08/58] Spelling fix. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coding.c b/src/coding.c index 735af25502d..f9799035b3c 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6152,7 +6152,7 @@ check_ascii (struct coding_system *coding) } -/* Return the number of charcters at the source if all the bytes are +/* Return the number of characters at the source if all the bytes are valid UTF-8 (of Unicode range). Otherwise, return -1. By side effects, update coding->eol_seen. The value of coding->eol_seen is "logical or" of EOL_SEEN_LF, EOL_SEEN_CR, and EOL_SEEN_CRLF, but From cd542620197df6fefe2c2bebca1967ec84e8fa7c Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 6 Apr 2013 15:39:48 +0800 Subject: [PATCH 09/58] Improve Lisp manual documentation on setting faces. * display.texi (Faces): Minor clarifications. (Defining Faces): Clarify default vs custom face specs. Document face-spec-set. * display.texi (Overlay Properties): * text.texi (Special Properties): Use the "anonymous face" terminology. Describe foreground-color and background-color forms as compatibility-only. --- doc/lispref/ChangeLog | 11 ++ doc/lispref/display.texi | 287 ++++++++++++++++++++++----------------- doc/lispref/text.texi | 28 ++-- 3 files changed, 187 insertions(+), 139 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index dc6ebb4f35c..0bc2b0880b0 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,14 @@ +2013-04-06 Chong Yidong + + * display.texi (Faces): Minor clarifications. + (Defining Faces): Clarify default vs custom face specs. Document + face-spec-set. + + * display.texi (Overlay Properties): + * text.texi (Special Properties): Use the "anonymous face" + terminology. Describe foreground-color and background-color forms + as compatibility-only. + 2013-03-24 Eli Zaretskii * compile.texi (Byte-Code Objects): Add index entry. diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index eae6af9969d..4adcfdf8f4f 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -1510,31 +1510,31 @@ of the symbol serve as defaults for the properties of the overlay. @item face @kindex face @r{(overlay property)} -This property controls the way text is displayed---for example, which -font and which colors. @xref{Faces}, for more information. - -In the simplest case, the value is a face name. It can also be a list; -then each element can be any of these possibilities: +This property controls the appearance of the text (@pxref{Faces}). +The value of the property can be the following: @itemize @bullet @item A face name (a symbol or string). @item -A property list of face attributes. This has the form (@var{keyword} -@var{value} @dots{}), where each @var{keyword} is a face attribute -name and @var{value} is a meaningful value for that attribute. With -this feature, you do not need to create a face each time you want to -specify a particular attribute for certain text. @xref{Face -Attributes}. +An anonymous face: a property list of the form @code{(@var{keyword} +@var{value} @dots{})}, where each @var{keyword} is a face attribute +name and @var{value} is a value for that attribute. @item -A cons cell, of the form @code{(foreground-color . @var{color-name})} -or @code{(background-color . @var{color-name})}. These elements -specify just the foreground color or just the background color. +A list of faces. Each list element should be either a face name or an +anonymous face. This specifies a face which is an aggregate of the +attributes of each of the listed faces. Faces occurring earlier in +the list have higher priority. -@code{(foreground-color . @var{color-name})} has the same effect as -@code{(:foreground @var{color-name})}; likewise for the background. +@item +A cons cell of the form @code{(foreground-color . @var{color-name})} +or @code{(background-color . @var{color-name})}. This specifies the +foreground or background color, similar to @code{(:foreground +@var{color-name})} or @code{(:background @var{color-name})}. This +form is supported for backward compatibility only, and should be +avoided. @end itemize @item mouse-face @@ -1901,44 +1901,39 @@ height. @section Faces @cindex faces - A @dfn{face} is a collection of graphical @dfn{attributes} for -displaying text: font, foreground color, background color, optional -underlining, etc. Faces control how Emacs displays text in buffers, -as well as other parts of the frame such as the mode line. + A @dfn{face} is a collection of graphical attributes for displaying +text: font, foreground color, background color, optional underlining, +etc. Faces control how Emacs displays text in buffers, as well as +other parts of the frame such as the mode line. @cindex anonymous face One way to represent a face is as a property list of attributes, -like @code{(:foreground "red" :weight bold)}. For example, you can -assign such an @dfn{anonymous face} as the value of the @code{face} -text property; this causes Emacs to display the underlying text with -the specified attributes. @xref{Special Properties}. +like @code{(:foreground "red" :weight bold)}. Such a list is called +an @dfn{anonymous face}. For example, you can assign an anonymous +face as the value of the @code{face} text property, and Emacs will +display the underlying text with the specified attributes. +@xref{Special Properties}. @cindex face name More commonly, a face is referred to via a @dfn{face name}: a Lisp -symbol which is associated with a set of face attributes. Named faces -are defined using the @code{defface} macro (@pxref{Defining Faces}). -Emacs defines several standard named faces; @xref{Standard Faces,,, -emacs, The GNU Emacs Manual}. +symbol associated with a set of face attributes@footnote{For backward +compatibility, you can also use a string to specify a face name; that +is equivalent to a Lisp symbol with the same name.}. Named faces are +defined using the @code{defface} macro (@pxref{Defining Faces}). +Emacs comes with several standard named faces (@pxref{Basic Faces}). - Many parts of Emacs require named faces, and do not accept anonymous -faces. These include the functions documented in @ref{Attribute -Functions}, and the variable @code{font-lock-keywords} + Many parts of Emacs required named faces, and do not accept +anonymous faces. These include the functions documented in +@ref{Attribute Functions}, and the variable @code{font-lock-keywords} (@pxref{Search-based Fontification}). Unless otherwise stated, we will use the term @dfn{face} to refer only to named faces. - For backward compatibility, you can also use a string to specify a -face name; that is equivalent to a Lisp symbol with the same name. - @defun facep object This function returns a non-@code{nil} value if @var{object} is a named face: a Lisp symbol or string which serves as a face name. Otherwise, it returns @code{nil}. @end defun - By default, each face name corresponds to the same set of attributes -in all frames. But you can also assign a face name a special set of -attributes in one frame (@pxref{Attribute Functions}). - @menu * Face Attributes:: What is in a face? * Defining Faces:: How to define a face. @@ -2178,32 +2173,47 @@ suitable for use with @code{:stipple} (see above). It returns @node Defining Faces @subsection Defining Faces +@cindex face spec The usual way to define a face is through the @code{defface} macro. -This macro defines a face name, and associates that name with a set of -face attributes. It also sets up the face so that the user can -customize it via the Customize interface (@pxref{Customization}). +This macro associates a face name (a symbol) with a default @dfn{face +spec}. A face spec is a construct which specifies what attributes a +face should have on any given terminal; for example, a face spec might +specify one foreground color on high-color terminals, and a different +foreground color on low-color terminals. + + People are sometimes tempted to create a variable whose value is a +face name. In the vast majority of cases, this is not necessary; the +usual procedure is to define a face with @code{defface}, and then use +its name directly. @defmac defface face spec doc [keyword value]@dots{} -This macro declares @var{face} as a customizable face whose default -attributes are given by @var{spec}. You should not quote the symbol -@var{face}, and it should not end in @samp{-face} (that would be -redundant). The argument @var{doc} is a documentation string for the -face. The additional @var{keyword} arguments have the same meanings -as in @code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). +This macro declares @var{face} as a named face whose default face spec +is given by @var{spec}. You should not quote the symbol @var{face}, +and it should not end in @samp{-face} (that would be redundant). The +argument @var{doc} is a documentation string for the face. The +additional @var{keyword} arguments have the same meanings as in +@code{defgroup} and @code{defcustom} (@pxref{Common Keywords}). -When @code{defface} executes, it defines the face according to -@var{spec}, then uses any customizations that were read from the -init file (@pxref{Init File}) to override that specification. +If @var{face} already has a default face spec, this macro does +nothing. -When you evaluate a @code{defface} form with @kbd{C-M-x} in Emacs -Lisp mode (@code{eval-defun}), a special feature of @code{eval-defun} -overrides any customizations of the face. This way, the face reflects -exactly what the @code{defface} says. +The default face spec determines @var{face}'s appearance when no +customizations are in effect (@pxref{Customization}). If @var{face} +has already been customized (via Custom themes or via customizations +read from the init file), its appearance is determined by the custom +face spec(s), which override the default face spec @var{spec}. +However, if the customizations are subsequently removed, the +appearance of @var{face} will again be determined by its default face +spec. -@cindex face specification -The @var{spec} argument is a @dfn{face specification}, which states -how the face should appear on different kinds of terminals. It should -be an alist whose elements each have the form +As an exception, if you evaluate a @code{defface} form with +@kbd{C-M-x} in Emacs Lisp mode (@code{eval-defun}), a special feature +of @code{eval-defun} overrides any custom face specs on the face, +causing the face to reflect exactly what the @code{defface} says. + +The @var{spec} argument is a @dfn{face spec}, which states how the +face should appear on different kinds of terminals. It should be an +alist whose elements each have the form @example (@var{display} . @var{plist}) @@ -2275,7 +2285,8 @@ terminal must match one of the @var{value}s specified for it in @end table @end defmac - Here's how the standard face @code{highlight} is defined: + For example, here's the definition of the standard face +@code{highlight}: @example (defface highlight @@ -2294,65 +2305,56 @@ terminal must match one of the @var{value}s specified for it in :group 'basic-faces) @end example - Internally, Emacs stores the face's default specification in its + Internally, Emacs stores each face's default spec in its @code{face-defface-spec} symbol property (@pxref{Symbol Properties}). -The @code{saved-face} property stores the face specification saved by -the user, using the customization buffer; the @code{customized-face} -property stores the face specification customized for the current -session, but not saved; and the @code{theme-face} property stores an -alist associating the active customization settings and Custom themes -with their specifications for that face. The face's documentation -string is stored in the @code{face-documentation} property. But -normally you should not try to set any of these properties directly. -@xref{Applying Customizations}, for the @code{custom-set-faces} -function, which is used to apply customized face settings. +The @code{saved-face} property stores any face spec saved by the user +using the customization buffer; the @code{customized-face} property +stores the face spec customized for the current session, but not +saved; and the @code{theme-face} property stores an alist associating +the active customization settings and Custom themes with the face +specs for that face. The face's documentation string is stored in the +@code{face-documentation} property. - People are sometimes tempted to create variables whose values -specify a face to use. In the vast majority of cases, this is not -necessary; it is preferable to simply use faces directly. + Normally, a face is declared just once, using @code{defface}, and +any further changes to its appearance are applied using the Customize +framework (e.g., via the Customize user interface or via the +@code{custom-set-faces} function; @pxref{Applying Customizations}), or +by face remapping (@pxref{Face Remapping}). In the rare event that +you need to change a face spec directly from Lisp, you can use the +@code{face-spec-set} function. + +@defun face-spec-set face spec &optional spec-type +This function applies @var{spec} as a face spec for @code{face}. +@var{spec} should be a face spec, as described in the above +documentation for @code{defface}. + +@cindex override spec @r{(for a face)} +The argument @var{spec-type} determines which spec to set. If it is +@code{nil} or @code{face-override-spec}, this function sets the +@dfn{override spec}, which overrides over all other face specs on +@var{face}. If it is @code{face-defface-spec}, this function sets the +default face spec (the same one set by @code{defface}). If it is +@code{reset}, this function clears out all customization specs and +override specs from @var{face} (in this case, the value of @var{spec} +is ignored). Any other value of @var{spec-type} is reserved for +internal use. +@end defun @node Attribute Functions @subsection Face Attribute Functions - This section describes the functions for accessing and modifying the -attributes of an existing named face. - -@defun set-face-attribute face frame &rest arguments -This function sets one or more attributes of @var{face} for -@var{frame}. The attributes you specify this way override whatever -the @code{defface} says. - -The extra arguments @var{arguments} specify the attributes to set, and -the values for them. They should consist of alternating attribute -names (such as @code{:family} or @code{:underline}) and values. Thus, - -@example -(set-face-attribute 'foo nil - :width 'extended - :weight 'bold) -@end example - -@noindent -sets the attribute @code{:width} to @code{extended} and the attribute -@code{:weight} to @code{bold}. - -If @var{frame} is @code{t}, this function sets the default attributes -for new frames. Default attribute values specified this way override -the @code{defface} for newly created frames. - -If @var{frame} is @code{nil}, this function sets the attributes for -all existing frames, and the default for new frames. -@end defun + This section describes functions for directly accessing and +modifying the attributes of a named face. @defun face-attribute face attribute &optional frame inherit -This returns the value of the @var{attribute} attribute of @var{face} -on @var{frame}. If @var{frame} is @code{nil}, that means the selected -frame (@pxref{Input Focus}). +This function returns the value of the @var{attribute} attribute for +@var{face} on @var{frame}. -If @var{frame} is @code{t}, this returns whatever new-frames default -value you previously specified with @code{set-face-attribute} for the -@var{attribute} attribute of @var{face}. If you have not specified -one, it returns @code{nil}. +If @var{frame} is @code{nil}, that means the selected frame +(@pxref{Input Focus}). If @var{frame} is @code{t}, this function +returns the value of the specified attribute for newly-created frames +(this is normally @code{unspecified}, unless you have specified some +value using @code{set-face-attribute}; see below). If @var{inherit} is @code{nil}, only attributes directly defined by @var{face} are considered, so the return value may be @@ -2409,6 +2411,36 @@ If @var{value1} is a relative value for the face attribute @var{attribute}, returns it merged with the underlying value @var{value2}; otherwise, if @var{value1} is an absolute value for the face attribute @var{attribute}, returns @var{value1} unchanged. +@end defun + + Normally, Emacs uses the face specs of each face to automatically +calculate its attributes on each frame (@pxref{Defining Faces}). The +function @code{set-face-attribute} can override this calculation by +directly assigning attributes to a face, either on a specific frame or +for all frames. This function is mostly intended for internal usage. + +@defun set-face-attribute face frame &rest arguments +This function sets one or more attributes of @var{face} for +@var{frame}. The attributes specifies in this way override the face +spec(s) belonging to @var{face}. + +The extra arguments @var{arguments} specify the attributes to set, and +the values for them. They should consist of alternating attribute +names (such as @code{:family} or @code{:underline}) and values. Thus, + +@example +(set-face-attribute 'foo nil :weight 'bold :slant 'italic) +@end example + +@noindent +sets the attribute @code{:weight} to @code{bold} and the attribute +@code{:slant} to @code{italic}. + + +If @var{frame} is @code{t}, this function sets the default attributes +for newly created frames. If @var{frame} is @code{nil}, this function +sets the attributes for all existing frames, as well as for newly +created frames. @end defun The following commands and functions mostly provide compatibility @@ -2457,16 +2489,17 @@ This sets the @code{:inverse-video} attribute of @var{face} to This swaps the foreground and background colors of face @var{face}. @end deffn - The following functions examine the attributes of a face. If you -don't specify @var{frame}, they refer to the selected frame; @code{t} -refers to the default data for new frames. They return the symbol -@code{unspecified} if the face doesn't define any value for that -attribute. If @var{inherit} is @code{nil}, only an attribute directly -defined by the face is returned. If @var{inherit} is non-@code{nil}, -any faces specified by its @code{:inherit} attribute are considered as -well, and if @var{inherit} is a face or a list of faces, then they are -also considered, until a specified attribute is found. To ensure that -the return value is always specified, use a value of @code{default} for + The following functions examine the attributes of a face. They +mostly provide compatibility with old versions of Emacs. If you don't +specify @var{frame}, they refer to the selected frame; @code{t} refers +to the default data for new frames. They return @code{unspecified} if +the face doesn't define any value for that attribute. If +@var{inherit} is @code{nil}, only an attribute directly defined by the +face is returned. If @var{inherit} is non-@code{nil}, any faces +specified by its @code{:inherit} attribute are considered as well, and +if @var{inherit} is a face or a list of faces, then they are also +considered, until a specified attribute is found. To ensure that the +return value is always specified, use a value of @code{default} for @var{inherit}. @defun face-font face &optional frame @@ -2576,13 +2609,13 @@ The value of this variable is an alist whose elements have the form any text having the face @var{face} with @var{remapping}, rather than the ordinary definition of @var{face}. -@var{remapping} may be any face specification suitable for a -@code{face} text property: either a face (i.e., a face name or a -property list of attribute/value pairs), or a list of faces. For -details, see the description of the @code{face} text property in -@ref{Special Properties}. @var{remapping} serves as the complete -specification for the remapped face---it replaces the normal -definition of @var{face}, instead of modifying it. +@var{remapping} may be any face spec suitable for a @code{face} text +property: either a face (i.e., a face name or a property list of +attribute/value pairs), or a list of faces. For details, see the +description of the @code{face} text property in @ref{Special +Properties}. @var{remapping} serves as the complete specification for +the remapped face---it replaces the normal definition of @var{face}, +instead of modifying it. If @code{face-remapping-alist} is buffer-local, its local value takes effect only within that buffer. @@ -2629,7 +2662,7 @@ and @code{face-remap-reset-base} functions; it is intended for major modes to remap faces in the buffers they control. @defun face-remap-add-relative face &rest specs -This functions adds the face specifications in @var{specs} as relative +This functions adds the face spec in @var{specs} as relative remappings for face @var{face} in the current buffer. The remaining arguments, @var{specs}, should form either a list of face names, or a property list of attribute/value pairs. diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index c6cbfa5b3f8..6d5a39d887a 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -3008,27 +3008,31 @@ character. @item face @cindex face codes of text @kindex face @r{(text property)} -The @code{face} property controls the appearance of the character, -such as its font and color. @xref{Faces}. The value of the property -can be the following: +The @code{face} property controls the appearance of the character +(@pxref{Faces}). The value of the property can be the following: @itemize @bullet @item A face name (a symbol or string). @item -A property list of face attributes. This has the form (@var{keyword} -@var{value} @dots{}), where each @var{keyword} is a face attribute -name and @var{value} is a meaningful value for that attribute. With -this feature, you do not need to create a face each time you want to -specify a particular attribute for certain text. +An anonymous face: a property list of the form @code{(@var{keyword} +@var{value} @dots{})}, where each @var{keyword} is a face attribute +name and @var{value} is a value for that attribute. @item -A list of faces. This specifies a face which is an aggregate of the +A list of faces. Each list element should be either a face name or an +anonymous face. This specifies a face which is an aggregate of the attributes of each of the listed faces. Faces occurring earlier in -the list have higher priority. Each list element must have one of the -two above forms (i.e., either a face name or a property list of face -attributes). +the list have higher priority. + +@item +A cons cell of the form @code{(foreground-color . @var{color-name})} +or @code{(background-color . @var{color-name})}. This specifies the +foreground or background color, similar to @code{(:foreground +@var{color-name})} or @code{(:background @var{color-name})}. This +form is supported for backward compatibility only, and should be +avoided. @end itemize Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by From 33bb237a73a4ba97f21e673dac36b1f8c1299289 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 6 Apr 2013 10:41:09 +0300 Subject: [PATCH 10/58] Fix the non-creation of backup files in temporary-file directory on Windows. lisp/files.el (normal-backup-enable-predicate): On MS-Windows and MS-DOS compare truenames of temporary-file-directory and of the file, so that 8+3 aliases (usually found in $TEMP on Windows) don't fail comparison by compare-strings. Also, compare file names case-insensitively on MS-Windows and MS-DOS. --- lisp/ChangeLog | 8 ++++++++ lisp/files.el | 42 +++++++++++++++++++++++++----------------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1af9905c7e3..8b249977e4e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2013-04-06 Eli Zaretskii + + * files.el (normal-backup-enable-predicate): On MS-Windows and + MS-DOS compare truenames of temporary-file-directory and of the + file, so that 8+3 aliases (usually found in $TEMP on Windows) + don't fail comparison by compare-strings. Also, compare file + names case-insensitively on MS-Windows and MS-DOS. + 2013-04-05 Stefan Monnier * emacs-lisp/package.el (package-compute-transaction): Fix last fix. diff --git a/lisp/files.el b/lisp/files.el index 06958622d14..d098f0fcec7 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4180,23 +4180,31 @@ ignored." "Default `backup-enable-predicate' function. Checks for files in `temporary-file-directory', `small-temporary-file-directory', and /tmp." - (not (or (let ((comp (compare-strings temporary-file-directory 0 nil - name 0 nil))) - ;; Directory is under temporary-file-directory. - (and (not (eq comp t)) - (< comp (- (length temporary-file-directory))))) - (let ((comp (compare-strings "/tmp" 0 nil - name 0 nil))) - ;; Directory is under /tmp. - (and (not (eq comp t)) - (< comp (- (length "/tmp"))))) - (if small-temporary-file-directory - (let ((comp (compare-strings small-temporary-file-directory - 0 nil - name 0 nil))) - ;; Directory is under small-temporary-file-directory. - (and (not (eq comp t)) - (< comp (- (length small-temporary-file-directory))))))))) + (let ((temporary-file-directory temporary-file-directory) + caseless) + ;; On MS-Windows, file-truename will convert short 8+3 alises to + ;; their long file-name equivalents, so compare-strings does TRT. + (if (memq system-type '(ms-dos windows-nt)) + (setq temporary-file-directory (file-truename temporary-file-directory) + name (file-truename name) + caseless t)) + (not (or (let ((comp (compare-strings temporary-file-directory 0 nil + name 0 nil caseless))) + ;; Directory is under temporary-file-directory. + (and (not (eq comp t)) + (< comp (- (length temporary-file-directory))))) + (let ((comp (compare-strings "/tmp" 0 nil + name 0 nil))) + ;; Directory is under /tmp. + (and (not (eq comp t)) + (< comp (- (length "/tmp"))))) + (if small-temporary-file-directory + (let ((comp (compare-strings small-temporary-file-directory + 0 nil + name 0 nil caseless))) + ;; Directory is under small-temporary-file-directory. + (and (not (eq comp t)) + (< comp (- (length small-temporary-file-directory)))))))))) (defun make-backup-file-name (file) "Create the non-numeric backup file name for FILE. From ebb19708e7c76af8eee5534e25de5fa0949c14b4 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sat, 6 Apr 2013 18:06:39 +0400 Subject: [PATCH 11/58] Do not set x-display-name until X connection is established. This is needed to prevent from weird situation described at . * frame.el (make-frame): Set x-display-name after call to window system initialization function, not before. * term/x-win.el (x-initialize-window-system): Add optional display argument and use it. * term/w32-win.el (w32-initialize-window-system): * term/ns-win.el (ns-initialize-window-system): * term/pc-win.el (msdos-initialize-window-system): Add compatible optional display argument. --- lisp/ChangeLog | 14 ++++++++++++++ lisp/frame.el | 5 ++--- lisp/term/ns-win.el | 2 +- lisp/term/pc-win.el | 2 +- lisp/term/w32-win.el | 2 +- lisp/term/x-win.el | 4 ++-- 6 files changed, 21 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8b249977e4e..bfbdf089bfa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2013-04-06 Dmitry Antipov + + Do not set x-display-name until X connection is established. + This is needed to prevent from weird situation described at + . + * frame.el (make-frame): Set x-display-name after call to + window system initialization function, not before. + * term/x-win.el (x-initialize-window-system): Add optional + display argument and use it. + * term/w32-win.el (w32-initialize-window-system): + * term/ns-win.el (ns-initialize-window-system): + * term/pc-win.el (msdos-initialize-window-system): + Add compatible optional display argument. + 2013-04-06 Eli Zaretskii * files.el (normal-backup-enable-predicate): On MS-Windows and diff --git a/lisp/frame.el b/lisp/frame.el index 4bf885b27b2..454b229d59e 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -655,9 +655,8 @@ the new frame according to its own rules." (error "Don't know how to create a frame on window system %s" w)) (unless (get w 'window-system-initialized) - (unless x-display-name - (setq x-display-name display)) - (funcall (cdr (assq w window-system-initialization-alist))) + (funcall (cdr (assq w window-system-initialization-alist)) display) + (setq x-display-name display) (put w 'window-system-initialized t)) ;; Add parameters from `window-system-default-frame-alist'. diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index b8baaa077ce..5617c31beff 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -895,7 +895,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") ;; Do the actual Nextstep Windows setup here; the above code just ;; defines functions and variables that we use now. -(defun ns-initialize-window-system () +(defun ns-initialize-window-system (&optional display) "Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing." (cl-assert (not ns-initialized)) diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index cf67aca8343..ab776ea6257 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -403,7 +403,7 @@ Errors out because it is not supposed to be called, ever." (error "terminal-init-internal called for window-system `%s'" (window-system))) -(defun msdos-initialize-window-system () +(defun msdos-initialize-window-system (&optional display) "Initialization function for the `pc' \"window system\"." (or (eq (window-system) 'pc) (error diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index cbd08e68a39..b0f65812eab 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -246,7 +246,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") (declare-function x-parse-geometry "frame.c" (string)) (defvar x-command-line-resources) -(defun w32-initialize-window-system () +(defun w32-initialize-window-system (&optional display) "Initialize Emacs for W32 GUI frames." (cl-assert (not w32-initialized)) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 84d6ddbf46c..822df0e37e5 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -1343,7 +1343,7 @@ Request data types in the order specified by `x-select-request-type'." (defvar x-display-name) (defvar x-command-line-resources) -(defun x-initialize-window-system () +(defun x-initialize-window-system (&optional display) "Initialize Emacs for X frames and open the first connection to an X server." (cl-assert (not x-initialized)) @@ -1357,7 +1357,7 @@ Request data types in the order specified by `x-select-request-type'." (while (setq i (string-match "[.*]" x-resource-name)) (aset x-resource-name i ?-)))) - (x-open-connection (or x-display-name + (x-open-connection (or display (setq x-display-name (or (getenv "DISPLAY" (selected-frame)) (getenv "DISPLAY")))) x-command-line-resources From 6096db2e0067715c06573c924214385a2c0a1baf Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 6 Apr 2013 13:03:38 -0700 Subject: [PATCH 12/58] Fix typo --- admin/notes/bugtracker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker index 61f8027e9a2..9957bc9b567 100644 --- a/admin/notes/bugtracker +++ b/admin/notes/bugtracker @@ -103,7 +103,7 @@ This is annoying. to hopefully stop this happening, but it is still better to use X-Debbugs-CC.) If a new report contains X-Debbugs-CC in the input, this is -converted to a real Cc header in the output. (See Bug#1720). +converted to a real Cc header in the output. (See Bug#1780,5384) It is also merged into the Resent-CC header (see below). ** How does Debbugs send out mails? From 7452b7bd70f01fb96f13269250bda32507ce0cf1 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sun, 7 Apr 2013 08:41:19 +0400 Subject: [PATCH 13/58] Get rid of some platform-specific functions examining window system and its capabilities. This is a partial rework of the 2013-04-05 change. * lisp.h (have_menus_p): Remove prototype. This function is replaced with platform-independent window_system_available. (check_window_system): Move to... * frame.h (decode_window_system_frame, window_system_available): ...here, add new prototypes. * frame.c (window_system_available, decode_window_system_frame): New functions. (check_window_system): Platform-independent now. * xterm.h (x_in_use): Remove declaration. (check_x_frame): * w32term.h (check_x_frame): * nsterm.h (check_x_frame): Remove prototypes. This function is replaced with platform-independent decode_window_system_frame. * msdos.c (have_menus_p): Remove. * nsfns.m (check_window_system, have_menus_p, check_ns_frame): Remove platform-specific functions. Use check_window_system, decode_window_system_frame and check_ns_display_info where appropriate. Minor style and comment tweaks. * w32fns.c (w32_in_use, check_window_system, have_menus_p) (check_x_frame): Likewise. * xfns.c (x_in_use, check_window_system, have_menus_p, check_x_frame): Likewise. * fileio.c, fns.c, font.c, fontset.c, image.c, menu.c, nsmenu.m: * nsselect.m, nsterm.m, w32font.c, w32menu.c, xfaces.c, xgselect.c: * xmenu.c, xselect.c: All related users changed. --- src/ChangeLog | 31 +++++++++++ src/fileio.c | 2 +- src/fns.c | 5 +- src/font.c | 4 +- src/fontset.c | 5 +- src/frame.c | 33 +++++++++++- src/frame.h | 3 ++ src/image.c | 10 ++-- src/lisp.h | 10 ---- src/menu.c | 2 +- src/msdos.c | 5 -- src/nsfns.m | 142 +++++++++++++------------------------------------ src/nsmenu.m | 4 +- src/nsselect.m | 15 +++--- src/nsterm.h | 2 - src/nsterm.m | 38 ++++++++----- src/w32fns.c | 60 ++++----------------- src/w32font.c | 2 +- src/w32menu.c | 4 +- src/w32term.h | 1 - src/xfaces.c | 10 ++-- src/xfns.c | 74 +++++--------------------- src/xgselect.c | 3 +- src/xmenu.c | 9 ++-- src/xselect.c | 8 +-- src/xterm.h | 2 - 26 files changed, 187 insertions(+), 297 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 70e342dfb2f..e39a104e135 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,34 @@ +2013-04-07 Dmitry Antipov + + Get rid of some platform-specific functions examining window + system and its capabilities. This is a partial rework of the + 2013-04-05 change. + * lisp.h (have_menus_p): Remove prototype. This function is + replaced with platform-independent window_system_available. + (check_window_system): Move to... + * frame.h (decode_window_system_frame, window_system_available): + ...here, add new prototypes. + * frame.c (window_system_available, decode_window_system_frame): + New functions. + (check_window_system): Platform-independent now. + * xterm.h (x_in_use): Remove declaration. + (check_x_frame): + * w32term.h (check_x_frame): + * nsterm.h (check_x_frame): Remove prototypes. This function + is replaced with platform-independent decode_window_system_frame. + * msdos.c (have_menus_p): Remove. + * nsfns.m (check_window_system, have_menus_p, check_ns_frame): + Remove platform-specific functions. Use check_window_system, + decode_window_system_frame and check_ns_display_info where + appropriate. Minor style and comment tweaks. + * w32fns.c (w32_in_use, check_window_system, have_menus_p) + (check_x_frame): Likewise. + * xfns.c (x_in_use, check_window_system, have_menus_p, check_x_frame): + Likewise. + * fileio.c, fns.c, font.c, fontset.c, image.c, menu.c, nsmenu.m: + * nsselect.m, nsterm.m, w32font.c, w32menu.c, xfaces.c, xgselect.c: + * xmenu.c, xselect.c: All related users changed. + 2013-04-03 Kenichi Handa The following changes is to optimize the code for reading UTF-8 diff --git a/src/fileio.c b/src/fileio.c index 2047338f03e..bffaff0609d 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5816,7 +5816,7 @@ before any other event (mouse or keypress) is handled. */) if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) && use_dialog_box && use_file_dialog - && have_menus_p ()) + && window_system_available (SELECTED_FRAME ())) return Qt; #endif return Qnil; diff --git a/src/fns.c b/src/fns.c index b3a1dc2317a..86bdc0250dc 100644 --- a/src/fns.c +++ b/src/fns.c @@ -2443,10 +2443,9 @@ is nil, and `use-dialog-box' is non-nil. */) CHECK_STRING (prompt); #ifdef HAVE_MENUS - if (FRAME_WINDOW_P (SELECTED_FRAME ()) - && (NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) + if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) && use_dialog_box - && have_menus_p ()) + && window_system_available (SELECTED_FRAME ())) { Lisp_Object pane, menu, obj; redisplay_preserve_echo_area (4); diff --git a/src/font.c b/src/font.c index 17573cdc264..6247eeca948 100644 --- a/src/font.c +++ b/src/font.c @@ -4844,11 +4844,9 @@ If the named font is not yet loaded, return nil. */) Lisp_Object info; Lisp_Object font_object; - check_window_system (); - if (! FONTP (name)) CHECK_STRING (name); - f = decode_live_frame (frame); + f = decode_window_system_frame (frame); if (STRINGP (name)) { diff --git a/src/fontset.c b/src/fontset.c index 7aec26bbb5b..2f6313c4214 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1209,7 +1209,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */) Lisp_Object fontset; int id; - check_window_system (); + check_window_system (NULL); CHECK_STRING (pattern); @@ -1915,8 +1915,7 @@ format is the same as above. */) Lisp_Object val, elt; int c, i, j, k; - check_window_system (); - + check_window_system (NULL); fontset = check_fontset_name (fontset, &frame); /* Recode fontsets realized on FRAME from the base fontset FONTSET diff --git a/src/frame.c b/src/frame.c index 5d5876ed097..2fe398296ed 100644 --- a/src/frame.c +++ b/src/frame.c @@ -149,6 +149,37 @@ decode_any_frame (register Lisp_Object frame) return XFRAME (frame); } +bool +window_system_available (struct frame *f) +{ + if (f) + return FRAME_WINDOW_P (f) || FRAME_MSDOS_P (f); + else +#ifdef HAVE_WINDOW_SYSTEM + return x_display_list != NULL; +#else + return 0; +#endif +} + +struct frame * +decode_window_system_frame (Lisp_Object frame) +{ + struct frame *f = decode_live_frame (frame); + + if (!window_system_available (f)) + error ("Window system frame should be used"); + return f; +} + +void +check_window_system (struct frame *f) +{ + if (!window_system_available (f)) + error (f ? "Window system frame should be used" + : "Window system is not in use or not initialized"); +} + static void set_menu_bar_lines_1 (Lisp_Object window, int n) { @@ -3493,7 +3524,7 @@ and the class is `Emacs.CLASS.SUBCLASS'. */) (Lisp_Object attribute, Lisp_Object class, Lisp_Object component, Lisp_Object subclass) { - check_window_system (); + check_window_system (NULL); return xrdb_get_resource (check_x_display_info (Qnil)->xrdb, attribute, class, component, subclass); diff --git a/src/frame.h b/src/frame.h index 46e18dd8ddb..b69f19b7ef8 100644 --- a/src/frame.h +++ b/src/frame.h @@ -958,6 +958,7 @@ extern Lisp_Object Qnoelisp; extern struct frame *last_nonminibuf_frame; extern void set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern struct frame *decode_window_system_frame (Lisp_Object); extern struct frame *decode_live_frame (Lisp_Object); extern struct frame *decode_any_frame (Lisp_Object); extern struct frame *make_initial_frame (void); @@ -968,6 +969,8 @@ extern struct frame *make_frame_without_minibuffer (Lisp_Object, struct kboard *, Lisp_Object); #endif /* HAVE_WINDOW_SYSTEM */ +extern bool window_system_available (struct frame *); +extern void check_window_system (struct frame *); extern void frame_make_pointer_invisible (void); extern void frame_make_pointer_visible (void); extern Lisp_Object delete_frame (Lisp_Object, Lisp_Object); diff --git a/src/image.c b/src/image.c index cac23b7fa87..2dae63a294f 100644 --- a/src/image.c +++ b/src/image.c @@ -889,7 +889,7 @@ or omitted means use the selected frame. */) size = Qnil; if (valid_image_p (spec)) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t id = lookup_image (f, spec); struct image *img = IMAGE_FROM_ID (f, id); int width = img->width + 2 * img->hmargin; @@ -919,7 +919,7 @@ or omitted means use the selected frame. */) mask = Qnil; if (valid_image_p (spec)) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t id = lookup_image (f, spec); struct image *img = IMAGE_FROM_ID (f, id); if (img->mask) @@ -942,7 +942,7 @@ or omitted means use the selected frame. */) ext = Qnil; if (valid_image_p (spec)) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t id = lookup_image (f, spec); struct image *img = IMAGE_FROM_ID (f, id); ext = img->lisp_data; @@ -1550,7 +1550,7 @@ which is then usually a filename. */) if (!(EQ (filter, Qnil) || FRAMEP (filter))) clear_image_caches (filter); else - clear_image_cache (check_x_frame (filter), Qt); + clear_image_cache (decode_window_system_frame (filter), Qt); return Qnil; } @@ -1581,7 +1581,7 @@ FRAME t means refresh the image on all frames. */) } } else - uncache_image (check_x_frame (frame), spec); + uncache_image (decode_window_system_frame (frame), spec); return Qnil; } diff --git a/src/lisp.h b/src/lisp.h index 2e1d20a5109..bcb866b4cc4 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3765,22 +3765,12 @@ extern void syms_of_xterm (void); extern char *x_get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ -#if defined(HAVE_WINDOW_SYSTEM) || defined (MSDOS) -/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ -extern void check_window_system (void); -#endif - #ifdef HAVE_LIBXML2 /* Defined in xml.c. */ extern void syms_of_xml (void); extern void xml_cleanup_parser (void); #endif -#ifdef HAVE_MENUS -/* Defined in (x|w32)fns.c, nsfns.m, msdos.c. */ -extern int have_menus_p (void); -#endif - #ifdef HAVE_DBUS /* Defined in dbusbind.c. */ void syms_of_dbusbind (void); diff --git a/src/menu.c b/src/menu.c index ec9c681a3a9..58558d5aedd 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1086,7 +1086,7 @@ no quit occurs and `x-popup-menu' returns nil. */) { bool get_current_pos_p = 0; - check_window_system (); + check_window_system (SELECTED_FRAME ()); /* Decode the first argument: find the window and the coordinates. */ if (EQ (position, Qt) diff --git a/src/msdos.c b/src/msdos.c index dc79b66e0b1..a2bcc06ac17 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2983,11 +2983,6 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help) /* --------------------------- X Menu emulation ---------------------- */ -/* Report availability of menus. */ - -int -have_menus_p (void) { return 1; } - /* Create a brand new menu structure. */ XMenu * diff --git a/src/nsfns.m b/src/nsfns.m index f7cf898c7a9..a483f847dec 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -107,43 +107,6 @@ Updated by Christian Limpach (chris@nice.ch) ========================================================================== */ - -void -check_window_system (void) -{ - if (NSApp == nil) - error ("OpenStep is not in use or not initialized"); -} - - -/* Nonzero if we can use mouse menus. */ -int -have_menus_p (void) -{ - return NSApp != nil; -} - - -/* Extract a frame as a FRAME_PTR, defaulting to the selected frame - and checking validity for NS. */ -static FRAME_PTR -check_ns_frame (Lisp_Object frame) -{ - FRAME_PTR f; - - if (NILP (frame)) - f = SELECTED_FRAME (); - else - { - CHECK_LIVE_FRAME (frame); - f = XFRAME (frame); - } - if (! FRAME_NS_P (f)) - error ("non-Nextstep frame used"); - return f; -} - - /* Let the user specify an Nextstep display with a frame. nil stands for the selected frame--or, if that is not an Nextstep frame, the first Nextstep display on the list. */ @@ -1145,8 +1108,6 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side Lisp_Object tfont, tfontsize; static int desc_ctr = 1; - check_window_system (); - /* x_get_arg modifies parms. */ parms = Fcopy_alist (parms); @@ -1418,7 +1379,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side FRAME nil means use the selected frame. */) (Lisp_Object frame) { - struct frame *f = check_ns_frame (frame); + struct frame *f = decode_window_system_frame (frame); struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); if (dpyinfo->x_focus_frame != f) @@ -1439,18 +1400,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side doc: /* Pop up the font panel. */) (Lisp_Object frame) { - id fm; - struct frame *f; - - check_window_system (); - fm = [NSFontManager sharedFontManager]; - if (NILP (frame)) - f = SELECTED_FRAME (); - else - { - CHECK_FRAME (frame); - f = XFRAME (frame); - } + struct frame *f = decode_window_system_frame (frame); + id fm = [NSFontManager sharedFontManager]; [fm setSelectedFont: ((struct nsfont_info *)f->output_data.ns->font)->nsfont isMultiple: NO]; @@ -1464,17 +1415,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side doc: /* Pop up the color panel. */) (Lisp_Object frame) { - struct frame *f; - - check_window_system (); - if (NILP (frame)) - f = SELECTED_FRAME (); - else - { - CHECK_FRAME (frame); - f = XFRAME (frame); - } - + check_window_system (NULL); [NSApp orderFrontColorPanel: NSApp]; return Qnil; } @@ -1503,7 +1444,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side NSString *initS = NILP (init) || !STRINGP (init) ? nil : [NSString stringWithUTF8String: SSDATA (init)]; - check_window_system (); + check_window_system (NULL); if (fileDelegate == nil) fileDelegate = [EmacsFileDelegate new]; @@ -1594,11 +1535,10 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side { const char *value; - check_window_system (); + check_window_system (NULL); if (NILP (owner)) owner = build_string([ns_app_name UTF8String]); CHECK_STRING (name); -/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SSDATA (name)); */ value = ns_get_defaults_value (SSDATA (name)); @@ -1614,7 +1554,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side If VALUE is nil, the default is removed. */) (Lisp_Object owner, Lisp_Object name, Lisp_Object value) { - check_window_system (); + check_window_system (NULL); if (NILP (owner)) owner = build_string ([ns_app_name UTF8String]); CHECK_STRING (name); @@ -1642,7 +1582,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side doc: /* This function is a no-op. It is only present for completeness. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); /* This function has no real equivalent under NeXTstep. Return nil to indicate this. */ return Qnil; @@ -1692,7 +1632,7 @@ and GNUstep implementations ("distributor-specific release { int num; - check_window_system (); + check_ns_display_info (display); num = [[NSScreen screens] count]; return (num != 0) ? make_number (num) : Qnil; @@ -1706,7 +1646,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) ([ns_get_screen (display) frame].size.height/(92.0/25.4))); } @@ -1719,7 +1659,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) ([ns_get_screen (display) frame].size.width/(92.0/25.4))); } @@ -1733,7 +1673,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); switch ([ns_get_window (display) backingType]) { case NSBackingStoreBuffered: @@ -1759,7 +1699,8 @@ and GNUstep implementations ("distributor-specific release (Lisp_Object display) { NSWindowDepth depth; - check_window_system (); + + check_ns_display_info (display); depth = [ns_get_screen (display) depth]; if ( depth == NSBestDepth (NSCalibratedWhiteColorSpace, 2, 2, YES, NULL)) @@ -1786,7 +1727,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, the selected frame's display is used. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); switch ([ns_get_window (display) backingType]) { case NSBackingStoreBuffered: @@ -1836,11 +1777,10 @@ and GNUstep implementations ("distributor-specific release DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection, 1, 1, 0, doc: /* Close the connection to the current Nextstep display server. -The argument DISPLAY is currently ignored. */) +DISPLAY should be a frame, the display name as a string, or a terminal ID. */) (Lisp_Object display) { - check_window_system (); - /*ns_delete_terminal (dpyinfo->terminal); */ + check_ns_display_info (display); [NSApp terminate: NSApp]; return Qnil; } @@ -1865,7 +1805,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Hides all applications other than Emacs. */) (void) { - check_window_system (); + check_window_system (NULL); [NSApp hideOtherApplications: NSApp]; return Qnil; } @@ -1878,7 +1818,7 @@ and GNUstep implementations ("distributor-specific release the active application. */) (Lisp_Object on) { - check_window_system (); + check_window_system (NULL); if (EQ (on, intern ("activate"))) { [NSApp unhide: NSApp]; @@ -1897,7 +1837,7 @@ and GNUstep implementations ("distributor-specific release doc: /* Shows the 'Info' or 'About' panel for Emacs. */) (void) { - check_window_system (); + check_window_system (NULL); [NSApp orderFrontStandardAboutPanel: nil]; return Qnil; } @@ -1975,7 +1915,7 @@ and GNUstep implementations ("distributor-specific release NSMenu *svcs; id delegate; - check_window_system (); + check_window_system (NULL); svcs = [[NSMenu alloc] initWithTitle: @"Services"]; [NSApp setServicesMenu: svcs]; [NSApp registerServicesMenuSendTypes: ns_send_types @@ -2028,7 +1968,7 @@ and GNUstep implementations ("distributor-specific release char *utfStr; CHECK_STRING (service); - check_window_system (); + check_window_system (NULL); utfStr = SSDATA (service); svcName = [NSString stringWithUTF8String: utfStr]; @@ -2152,7 +2092,7 @@ and GNUstep implementations ("distributor-specific release NSEvent *nxev; CHECK_STRING (script); - check_window_system (); + check_window_system (NULL); block_input (); @@ -2201,15 +2141,6 @@ and GNUstep implementations ("distributor-specific release ========================================================================== */ - -/* called from image.c */ -FRAME_PTR -check_x_frame (Lisp_Object frame) -{ - return check_ns_frame (frame); -} - - /* called from frame.c */ struct ns_display_info * check_x_display_info (Lisp_Object frame) @@ -2235,7 +2166,7 @@ and GNUstep implementations ("distributor-specific release /* remove appname prefix; TODO: allow for !="Emacs" */ char *toCheck = class + (!strncmp (class, "Emacs.", 6) ? 6 : 0); const char *res; - check_window_system (); + check_window_system (NULL); if (inhibit_x_resources) /* --quick was passed, so this is a no-op. */ @@ -2305,7 +2236,7 @@ and GNUstep implementations ("distributor-specific release (Lisp_Object color, Lisp_Object frame) { NSColor * col; - check_window_system (); + check_window_system (NULL); return ns_lisp_to_color (color, &col) ? Qnil : Qt; } @@ -2317,7 +2248,7 @@ and GNUstep implementations ("distributor-specific release NSColor * col; CGFloat red, green, blue, alpha; - check_window_system (); + check_window_system (NULL); CHECK_STRING (color); if (ns_lisp_to_color (color, &col)) @@ -2336,7 +2267,8 @@ and GNUstep implementations ("distributor-specific release { NSWindowDepth depth; NSString *colorSpace; - check_window_system (); + + check_ns_display_info (display); depth = [ns_get_screen (display) depth]; colorSpace = NSColorSpaceFromDepth (depth); @@ -2356,7 +2288,8 @@ and GNUstep implementations ("distributor-specific release (Lisp_Object display) { NSWindowDepth depth; - check_window_system (); + + check_ns_display_info (display); depth = [ns_get_screen (display) depth]; return NSBitsPerPixelFromDepth (depth) > 1 ? Qt : Qnil; @@ -2371,7 +2304,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) [ns_get_screen (display) frame].size.width); } @@ -2384,7 +2317,7 @@ and GNUstep implementations ("distributor-specific release If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number ((int) [ns_get_screen (display) frame].size.height); } @@ -2404,7 +2337,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which NSScreen *screen; NSRect vScreen; - check_window_system (); + check_ns_display_info (display); screen = ns_get_screen (display); if (!screen) return Qnil; @@ -2428,7 +2361,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - check_window_system (); + check_ns_display_info (display); return make_number (NSBitsPerPixelFromDepth ([ns_get_screen (display) depth])); } @@ -2442,10 +2375,7 @@ The return value is a list of integers (LEFT TOP WIDTH HEIGHT), which If omitted or nil, that stands for the selected frame's display. */) (Lisp_Object display) { - struct ns_display_info *dpyinfo; - check_window_system (); - - dpyinfo = check_ns_display_info (display); + struct ns_display_info *dpyinfo = check_ns_display_info (display); /* We force 24+ bit depths to 24-bit to prevent an overflow. */ return make_number (1 << min (dpyinfo->n_planes, 24)); } @@ -2558,7 +2488,7 @@ DY added (default is -10). CHECK_STRING (string); str = SSDATA (string); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else diff --git a/src/nsmenu.m b/src/nsmenu.m index d364639b0bc..648b568d180 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1409,8 +1409,6 @@ - (NSRect) frame NSTRACE (x-popup-dialog); - check_window_system (); - isQ = NILP (header); if (EQ (position, Qt) @@ -1448,6 +1446,8 @@ - (NSRect) frame else CHECK_WINDOW (window); + check_window_system (f); + p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2; p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2; diff --git a/src/nsselect.m b/src/nsselect.m index 2f539a16406..bb9eacd23cd 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -354,8 +354,7 @@ Updated by Christian Limpach (chris@nice.ch) Lisp_Object successful_p = Qnil, rest; Lisp_Object target_symbol, data; - - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (NILP (value)) error ("selection value may not be nil."); @@ -409,7 +408,7 @@ Updated by Christian Limpach (chris@nice.ch) (Lisp_Object selection, Lisp_Object time_object, Lisp_Object terminal) { id pb; - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (NILP (assq_no_quit (selection, Vselection_alist))) return Qnil; @@ -436,7 +435,7 @@ Updated by Christian Limpach (chris@nice.ch) id pb; NSArray *types; - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (EQ (selection, Qnil)) selection = QPRIMARY; if (EQ (selection, Qt)) selection = QSECONDARY; @@ -464,7 +463,7 @@ Updated by Christian Limpach (chris@nice.ch) On Nextstep, TERMINAL is unused. */) (Lisp_Object selection, Lisp_Object terminal) { - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection); if (EQ (selection, Qnil)) selection = QPRIMARY; if (EQ (selection, Qt)) selection = QSECONDARY; @@ -492,7 +491,7 @@ Updated by Christian Limpach (chris@nice.ch) { Lisp_Object val; - check_window_system (); + check_window_system (NULL); CHECK_SYMBOL (selection_name); CHECK_SYMBOL (target_type); val = ns_get_local_selection (selection_name, target_type); @@ -516,7 +515,7 @@ Updated by Christian Limpach (chris@nice.ch) (Lisp_Object selection) { id pb; - check_window_system (); + check_window_system (NULL); pb = ns_symbol_to_pb (selection); return pb != nil ? ns_string_from_pasteboard (pb) : Qnil; } @@ -529,7 +528,7 @@ Updated by Christian Limpach (chris@nice.ch) (Lisp_Object selection, Lisp_Object string) { id pb; - check_window_system (); + check_window_system (NULL); pb = ns_symbol_to_pb (selection); if (pb != nil) ns_string_to_pasteboard (pb, string); return Qnil; diff --git a/src/nsterm.h b/src/nsterm.h index 59cac34773a..07cfc2e022e 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -577,8 +577,6 @@ extern Lisp_Object ns_display_name_list; extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name); struct ns_display_info *check_x_display_info (Lisp_Object frame); -FRAME_PTR check_x_frame (Lisp_Object frame); - struct ns_output { diff --git a/src/nsterm.m b/src/nsterm.m index fb1b0aa327c..bc3150c0a07 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1012,8 +1012,9 @@ Free a pool and temporary objects it refers to (callable from C) Bring window to foreground and make it active -------------------------------------------------------------------------- */ { - NSView *view = FRAME_NS_VIEW (f); - check_window_system (); + NSView *view; + check_window_system (f); + view = FRAME_NS_VIEW (f); block_input (); if (FRAME_VISIBLE_P (f)) [[view window] makeKeyAndOrderFront: NSApp]; @@ -1027,8 +1028,9 @@ Free a pool and temporary objects it refers to (callable from C) Send window to back -------------------------------------------------------------------------- */ { - NSView *view = FRAME_NS_VIEW (f); - check_window_system (); + NSView *view; + check_window_system (f); + view = FRAME_NS_VIEW (f); block_input (); [[view window] orderBack: NSApp]; unblock_input (); @@ -1131,9 +1133,10 @@ Free a pool and temporary objects it refers to (callable from C) External: Hide the window (X11 semantics) -------------------------------------------------------------------------- */ { - NSView * view = FRAME_NS_VIEW (f); + NSView *view; NSTRACE (x_make_frame_invisible); - check_window_system (); + check_window_system (f); + view = FRAME_NS_VIEW (f); [[view window] orderOut: NSApp]; SET_FRAME_VISIBLE (f, 0); SET_FRAME_ICONIFIED (f, 0); @@ -1146,10 +1149,13 @@ Free a pool and temporary objects it refers to (callable from C) External: Iconify window -------------------------------------------------------------------------- */ { - NSView * view = FRAME_NS_VIEW (f); - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); + NSView *view; + struct ns_display_info *dpyinfo; + NSTRACE (x_iconify_frame); - check_window_system (); + check_window_system (f); + view = FRAME_NS_VIEW (f); + dpyinfo = FRAME_NS_DISPLAY_INFO (f); if (dpyinfo->x_highlight_frame == f) dpyinfo->x_highlight_frame = 0; @@ -1174,11 +1180,15 @@ Free a pool and temporary objects it refers to (callable from C) void x_free_frame_resources (struct frame *f) { - NSView *view = FRAME_NS_VIEW (f); - struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f); - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); + NSView *view; + struct ns_display_info *dpyinfo; + Mouse_HLInfo *hlinfo; + NSTRACE (x_free_frame_resources); - check_window_system (); + check_window_system (f); + view = FRAME_NS_VIEW (f); + dpyinfo = FRAME_NS_DISPLAY_INFO (f); + hlinfo = MOUSE_HL_INFO (f); [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ @@ -1219,7 +1229,7 @@ Free a pool and temporary objects it refers to (callable from C) -------------------------------------------------------------------------- */ { NSTRACE (x_destroy_window); - check_window_system (); + check_window_system (f); x_free_frame_resources (f); ns_window_num--; } diff --git a/src/w32fns.c b/src/w32fns.c index 2bc1042e126..5d3a78f8b95 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -95,10 +95,6 @@ static HWND hourglass_hwnd = NULL; #define IDC_HAND MAKEINTRESOURCE(32649) #endif -/* Nonzero if using Windows. */ - -static int w32_in_use; - Lisp_Object Qsuppress_icon; Lisp_Object Qundefined_color; Lisp_Object Qcancel_timer; @@ -239,37 +235,6 @@ HINSTANCE hinst = NULL; static unsigned int sound_type = 0xFFFFFFFF; #define MB_EMACS_SILENT (0xFFFFFFFF - 1) - -/* Error if we are not connected to MS-Windows. */ -void -check_window_system (void) -{ - if (! w32_in_use) - error ("MS-Windows not in use or not initialized"); -} - -/* Nonzero if we can use mouse menus. - You should not call this unless HAVE_MENUS is defined. */ - -int -have_menus_p (void) -{ - return w32_in_use; -} - -/* Extract a frame as a FRAME_PTR, defaulting to the selected frame - and checking validity for W32. */ - -FRAME_PTR -check_x_frame (Lisp_Object frame) -{ - struct frame *f = decode_live_frame (frame); - - if (! FRAME_W32_P (f)) - error ("Non-W32 frame used"); - return f; -} - /* Let the user specify a display with a frame. nil stands for the selected frame--or, if that is not a w32 frame, the first display on the list. */ @@ -4567,7 +4532,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, doc: /* Give FRAME input focus, raising to foreground if necessary. */) (Lisp_Object frame) { - x_focus_on_frame (check_x_frame (frame)); + x_focus_on_frame (decode_window_system_frame (frame)); return Qnil; } @@ -4578,7 +4543,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -4593,7 +4558,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -4911,7 +4876,6 @@ x_display_info_for_name (Lisp_Object name) if (dpyinfo == 0) error ("Cannot connect to server %s", SDATA (name)); - w32_in_use = 1; XSETFASTINT (Vwindow_system_version, w32_major_version); return dpyinfo; @@ -4941,7 +4905,7 @@ terminate Emacs if we can't open the connection. /* If initialization has already been done, return now to avoid overwriting critical parts of one_w32_display_info. */ - if (w32_in_use) + if (window_system_available (NULL)) return Qnil; if (! NILP (xrm_string)) @@ -5010,8 +4974,6 @@ terminate Emacs if we can't open the connection. error ("Cannot connect to server %s", SDATA (display)); } - w32_in_use = 1; - XSETFASTINT (Vwindow_system_version, w32_major_version); return Qnil; } @@ -5095,7 +5057,7 @@ FRAME. Default is to change on the edit X window. */) (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; CHECK_STRING (prop); @@ -5121,7 +5083,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property, FRAME nil or omitted means use the selected frame. Value is PROP. */) (Lisp_Object prop, Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; CHECK_STRING (prop); @@ -5157,7 +5119,7 @@ no value of TYPE (always string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; int rc; Lisp_Object prop_value = Qnil; @@ -5358,8 +5320,6 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, Lisp_Object buffer; struct buffer *old_buffer; - check_window_system (); - /* Use this general default value to start with until we know if this frame has a specified name. */ Vx_resource_name = Vinvocation_name; @@ -5703,7 +5663,7 @@ Text larger than the specified size is clipped. */) GCPRO4 (string, parms, frame, timeout); CHECK_STRING (string); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else @@ -6354,7 +6314,7 @@ screen saver if defined. If optional parameter FRAME is not specified, use selected frame. */) (Lisp_Object command, Lisp_Object frame) { - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_NUMBER (command); @@ -7312,8 +7272,6 @@ void syms_of_w32fns (void) { globals_of_w32fns (); - /* This is zero if not using MS-Windows. */ - w32_in_use = 0; track_mouse_window = NULL; w32_visible_system_caret_hwnd = NULL; diff --git a/src/w32font.c b/src/w32font.c index fb52376b9e1..105daa06365 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -2467,7 +2467,7 @@ If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts in the font selection dialog. */) (Lisp_Object frame, Lisp_Object exclude_proportional) { - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHOOSEFONT cf; LOGFONT lf; TEXTMETRIC tm; diff --git a/src/w32menu.c b/src/w32menu.c index 0c8d5ca06c5..346402b7c6b 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -140,8 +140,6 @@ otherwise it is "Question". */) FRAME_PTR f = NULL; Lisp_Object window; - check_window_system (); - /* Decode the first argument: find the window or frame to use. */ if (EQ (position, Qt) || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) @@ -194,6 +192,8 @@ otherwise it is "Question". */) but I don't want to make one now. */ CHECK_WINDOW (window); + check_window_system (f); + #ifndef HAVE_DIALOGS { diff --git a/src/w32term.h b/src/w32term.h index e85ee7790d5..9bb37b31ef5 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -739,7 +739,6 @@ struct image; struct face; XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *); -struct frame * check_x_frame (Lisp_Object); typedef DWORD (WINAPI * ClipboardSequence_Proc) (void); typedef BOOL (WINAPI * AppendMenuW_Proc) ( diff --git a/src/xfaces.c b/src/xfaces.c index 9acaf6d6f52..b2ace1be14e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -1634,7 +1634,7 @@ the WIDTH times as wide as FACE on FRAME. */) struct frame *f; int size, avgwidth IF_LINT (= 0); - check_window_system (); + check_window_system (NULL); CHECK_STRING (pattern); if (! NILP (maximum)) @@ -1643,8 +1643,8 @@ the WIDTH times as wide as FACE on FRAME. */) if (!NILP (width)) CHECK_NUMBER (width); - /* We can't simply call check_x_frame because this function may be - called before any frame is created. */ + /* We can't simply call decode_window_system_frame because + this function may be called before any frame is created. */ f = decode_live_frame (frame); if (! FRAME_WINDOW_P (f)) { @@ -3923,8 +3923,8 @@ If FRAME is omitted or nil, use the selected frame. */) struct frame *f; Lisp_Object lface1, lface2; - /* Don't use check_x_frame here because this function is called - before X frames exist. At that time, if FRAME is nil, + /* Don't use decode_window_system_frame here because this function + is called before X frames exist. At that time, if FRAME is nil, selected_frame will be used which is the frame dumped with Emacs. That frame is not an X frame. */ f = EQ (frame, Qt) ? NULL : decode_live_frame (frame); diff --git a/src/xfns.c b/src/xfns.c index 8b8d94d4779..f4c24cb09a0 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -123,10 +123,6 @@ extern LWLIB_ID widget_id_tick; #define MAXREQUEST(dpy) (XMaxRequestSize (dpy)) -/* Nonzero if using X. */ - -int x_in_use; - static Lisp_Object Qsuppress_icon; static Lisp_Object Qundefined_color; static Lisp_Object Qcompound_text, Qcancel_timer; @@ -139,38 +135,6 @@ static int dpyinfo_refcount; static struct x_display_info *x_display_info_for_name (Lisp_Object); - -/* Error if we are not connected to X. */ - -void -check_window_system (void) -{ - if (! x_in_use) - error ("X windows are not in use or not initialized"); -} - -/* Nonzero if we can use mouse menus. - You should not call this unless HAVE_MENUS is defined. */ - -int -have_menus_p (void) -{ - return x_in_use; -} - -/* Extract a frame as a FRAME_PTR, defaulting to the selected frame - and checking validity for X. */ - -FRAME_PTR -check_x_frame (Lisp_Object frame) -{ - struct frame *f = decode_live_frame (frame); - - if (! FRAME_X_P (f)) - error ("Non-X frame used"); - return f; -} - /* Let the user specify an X display with a Lisp object. OBJECT may be nil, a frame or a terminal object. nil stands for the selected frame--or, if that is not an X frame, @@ -205,7 +169,7 @@ check_x_display_info (Lisp_Object object) dpyinfo = x_display_info_for_name (object); else { - FRAME_PTR f = check_x_frame (object); + FRAME_PTR f = decode_window_system_frame (object); dpyinfo = FRAME_X_DISPLAY_INFO (f); } @@ -2992,7 +2956,7 @@ If FRAME is omitted or nil, use the selected frame. Signal error if FRAME is not an X frame. */) (Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); block_input (); x_wm_set_size_hint (f, 0, 0); @@ -3483,7 +3447,7 @@ DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0, FRAME nil means use the selected frame. */) (Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); block_input (); @@ -3516,7 +3480,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -3531,7 +3495,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, (Lisp_Object color, Lisp_Object frame) { XColor foo; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); CHECK_STRING (color); @@ -3996,7 +3960,6 @@ x_display_info_for_name (Lisp_Object name) if (dpyinfo == 0) error ("Cannot connect to X server %s", SDATA (name)); - x_in_use = 1; XSETFASTINT (Vwindow_system_version, 11); return dpyinfo; @@ -4050,8 +4013,6 @@ An insecure way to solve the problem may be to use `xhost'.\n", error ("Cannot connect to X server %s", SDATA (display)); } - x_in_use = 1; - XSETFASTINT (Vwindow_system_version, 11); return Qnil; } @@ -4143,7 +4104,7 @@ FRAME. Default is to change on the edit X window. */) (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; Atom target_type = XA_STRING; int element_format = 8; @@ -4221,7 +4182,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property, FRAME nil or omitted means use the selected frame. Value is PROP. */) (Lisp_Object prop, Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; CHECK_STRING (prop); @@ -4257,7 +4218,7 @@ no value of TYPE (always string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Atom prop_atom; int rc; Lisp_Object prop_value = Qnil; @@ -4525,8 +4486,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object buffer; struct buffer *old_buffer; - check_window_system (); - if (!dpyinfo->terminal->name) error ("Terminal is not live, can't create new frames on it"); @@ -4923,7 +4882,7 @@ Text larger than the specified size is clipped. */) if (SCHARS (string) == 0) string = make_unibyte_string (" ", 1); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (NILP (timeout)) timeout = make_number (5); else @@ -5246,7 +5205,7 @@ DEFUN ("x-uses-old-gtk-dialog", Fx_uses_old_gtk_dialog, #ifdef USE_GTK if (use_dialog_box && use_file_dialog - && have_menus_p () + && window_system_available (SELECTED_FRAME ()) && xg_uses_old_file_dialog ()) return Qt; #endif @@ -5316,7 +5275,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; - check_window_system (); + check_window_system (f); GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); @@ -5486,7 +5445,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char *cdef_file; - check_window_system (); + check_window_system (f); GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); @@ -5541,15 +5500,13 @@ FRAME is the frame on which to pop up the font chooser. If omitted or nil, it defaults to the selected frame. */) (Lisp_Object frame, Lisp_Object ignored) { - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); Lisp_Object font; Lisp_Object font_param; char *default_name = NULL; struct gcpro gcpro1, gcpro2; ptrdiff_t count = SPECPDL_INDEX (); - check_window_system (); - if (popup_activated ()) error ("Trying to use a menu from within a menu-entry"); @@ -5609,7 +5566,7 @@ present and mapped to the usual X keysyms. */) return Qlambda; #else XkbDescPtr kb; - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); Lisp_Object have_keys; int major, minor, op, event, error_code; @@ -5737,9 +5694,6 @@ frame_parm_handler x_frame_parm_handlers[] = void syms_of_xfns (void) { - /* This is zero if not using X windows. */ - x_in_use = 0; - /* The section below is built by the lisp expression at the top of the file, just above where these variables are declared. */ /*&&& init symbols here &&&*/ diff --git a/src/xgselect.c b/src/xgselect.c index 2c8e9671abb..0b5ad6ae70d 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -26,6 +26,7 @@ along with GNU Emacs. If not, see . */ #include #include #include "xterm.h" +#include "frame.h" int xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, @@ -43,7 +44,7 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, int i, nfds, tmo_in_millisec; USE_SAFE_ALLOCA; - if (! (x_in_use + if (! (window_system_available (NULL) && g_main_context_pending (context = g_main_context_default ()))) return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask); diff --git a/src/xmenu.c b/src/xmenu.c index e6291edf7d6..9993bd87d5b 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -223,8 +223,6 @@ for instance using the window manager, then this produces a quit and FRAME_PTR f = NULL; Lisp_Object window; - check_window_system (); - /* Decode the first argument: find the window or frame to use. */ if (EQ (position, Qt) || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar) @@ -277,8 +275,7 @@ for instance using the window manager, then this produces a quit and but I don't want to make one now. */ CHECK_WINDOW (window); - if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) - error ("Can not put X dialog on this terminal"); + check_window_system (f); /* Force a redisplay before showing the dialog. If a frame is created just before showing the dialog, its contents may not have been fully @@ -485,7 +482,7 @@ If FRAME is nil or not given, use the selected frame. */) (Lisp_Object frame) { XEvent ev; - FRAME_PTR f = check_x_frame (frame); + FRAME_PTR f = decode_window_system_frame (frame); Widget menubar; block_input (); @@ -569,7 +566,7 @@ If FRAME is nil or not given, use the selected frame. */) block_input (). */ block_input (); - f = check_x_frame (frame); + f = decode_window_system_frame (frame); if (FRAME_EXTERNAL_MENU_BAR (f)) set_frame_menubar (f, 0, 1); diff --git a/src/xselect.c b/src/xselect.c index cca1a47212b..b422a22d68b 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2450,7 +2450,7 @@ Use the display for FRAME or the current frame if FRAME is not given or nil. If the value is 0 or the atom is not known, return the empty string. */) (Lisp_Object value, Lisp_Object frame) { - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); char *name = 0; char empty[] = ""; Lisp_Object ret = Qnil; @@ -2485,7 +2485,7 @@ FRAME is on. If FRAME is nil, the selected frame is used. */) (Lisp_Object atom, Lisp_Object frame) { Atom x_atom; - struct frame *f = check_x_frame (frame); + struct frame *f = decode_window_system_frame (frame); ptrdiff_t i; struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); @@ -2618,7 +2618,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, struct x_display_info *dpyinfo = check_x_display_info (display); Window wdest; XEvent event; - struct frame *f = check_x_frame (from); + struct frame *f = decode_window_system_frame (from); int to_root; CHECK_NUMBER (format); @@ -2635,7 +2635,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, if (FRAMEP (dest) || NILP (dest)) { - struct frame *fdest = check_x_frame (dest); + struct frame *fdest = decode_window_system_frame (dest); wdest = FRAME_OUTER_WINDOW (fdest); } else if (STRINGP (dest)) diff --git a/src/xterm.h b/src/xterm.h index 6b64135927e..16effc5c9ea 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -923,7 +923,6 @@ void x_handle_property_notify (XPropertyEvent *); /* From xfns.c. */ -struct frame *check_x_frame (Lisp_Object); extern void x_free_gcs (struct frame *); /* From xrdb.c. */ @@ -1008,7 +1007,6 @@ extern void x_clipboard_manager_save_all (void); extern struct x_display_info * check_x_display_info (Lisp_Object); extern Lisp_Object x_get_focus_frame (struct frame *); -extern int x_in_use; #ifdef USE_GTK extern int xg_set_icon (struct frame *, Lisp_Object); From 876da980f8de024f01efd8d9d86aba66f7cd3b4a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 6 Apr 2013 23:21:40 -0700 Subject: [PATCH 14/58] Fix --enable-profiling bug introduced by 2013-02-25 change. This bug was introduced by my 2013-02-25 change that simplified data_start configuration. Without this change, on GNU/Linux an Emacs configured with --enable-profiling fails immediately due to a profiler signal. * configure.ac (LD_SWITCH_SYSTEM_TEMACS): Append -pg if profiling and if not on GNU/Linux or FreeBSD. * lib/Makefile.am (AM_CFLAGS): Add $(PROFILING_CFLAGS), so that lib/*.o is profiled too. * src/Makefile.in: Compile with $(PROFILING_CFLAGS), but do not link with these flags. On platforms where special flags are needed when linking temacs, the flags are now in LD_SWITCH_SYSTEM_TEMACS. (ALL_CFLAGS): Remove $(PROFILING_CFLAGS). (.c.o, .m.o): Compile with $(PROFILING_CFLAGS). Fixes: debbugs:13783 --- ChangeLog | 8 ++++++++ configure.ac | 7 +++++++ lib/Makefile.am | 2 +- src/ChangeLog | 13 +++++++++++++ src/Makefile.in | 6 +++--- 5 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d4f0c82592..2dd796962d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2013-04-07 Paul Eggert + + Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). + * configure.ac (LD_SWITCH_SYSTEM_TEMACS): Append -pg if profiling + and if not on GNU/Linux or FreeBSD. + * lib/Makefile.am (AM_CFLAGS): Add $(PROFILING_CFLAGS), so that + lib/*.o is profiled too. + 2013-03-30 Paul Eggert Merge from gnulib, incorporating: diff --git a/configure.ac b/configure.ac index 0cff34b8a16..2d8c4c3473d 100644 --- a/configure.ac +++ b/configure.ac @@ -4185,6 +4185,13 @@ case "$opsys" in *) LD_SWITCH_SYSTEM_TEMACS= ;; esac +if test x$ac_enable_profiling != x ; then + case $opsys in + *freebsd | gnu-linux) ;; + *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;; + esac +fi + AC_SUBST(LD_SWITCH_SYSTEM_TEMACS) ## Common for all window systems diff --git a/lib/Makefile.am b/lib/Makefile.am index a341609e895..d8979a1cf74 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -4,7 +4,7 @@ MOSTLYCLEANDIRS = MOSTLYCLEANFILES = noinst_LIBRARIES = -AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) +AM_CFLAGS = $(PROFILING_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src include gnulib.mk diff --git a/src/ChangeLog b/src/ChangeLog index e39a104e135..75a7388f2c4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2013-04-07 Paul Eggert + + Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). + This bug was introduced by my 2013-02-25 change that simplified + data_start configuration. Without this change, on GNU/Linux + an Emacs configured with --enable-profiling fails immediately + due to a profiler signal. + * Makefile.in: Compile with $(PROFILING_CFLAGS), but do not link + with these flags. On platforms where special flags are needed + when linking temacs, the flags are now in LD_SWITCH_SYSTEM_TEMACS. + (ALL_CFLAGS): Remove $(PROFILING_CFLAGS). + (.c.o, .m.o): Compile with $(PROFILING_CFLAGS). + 2013-04-07 Dmitry Antipov Get rid of some platform-specific functions examining window diff --git a/src/Makefile.in b/src/Makefile.in index 31de9714c65..c6a067a1ade 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -317,7 +317,7 @@ ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ - $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \ + $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ $(LIBGNUTLS_CFLAGS) \ $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS) ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) @@ -325,10 +325,10 @@ ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS) .SUFFIXES: .m .c.o: @$(MKDEPDIR) - $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $< .m.o: @$(MKDEPDIR) - $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $< + $(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $< ## lastfile must follow all files whose initialized data areas should ## be dumped as pure by dump-emacs. From 201bb296b5e4104f1501347181da56350507f5e7 Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Sun, 7 Apr 2013 15:14:00 +0800 Subject: [PATCH 15/58] * pcmpl-x.el: New file. --- lisp/ChangeLog | 4 + lisp/pcmpl-x.el | 249 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 253 insertions(+) create mode 100644 lisp/pcmpl-x.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bfbdf089bfa..ca9c545a37b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-04-07 Leo Liu + + * pcmpl-x.el: New file. + 2013-04-06 Dmitry Antipov Do not set x-display-name until X connection is established. diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el new file mode 100644 index 00000000000..6ef592b969d --- /dev/null +++ b/lisp/pcmpl-x.el @@ -0,0 +1,249 @@ +;;; pcmpl-x.el --- completion for miscellaneous tools -*- lexical-binding: t; -*- + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;; Author: Leo Liu +;; Keywords: processes, tools, convenience +;; Package: pcomplete + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, 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 General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(eval-when-compile (require 'cl-lib)) +(require 'pcomplete) + + +;;;; tlmgr - http://www.tug.org/texlive/tlmgr.html + +(defcustom pcmpl-x-tlmgr-program "tlmgr" + "Name of the tlmgr program." + :type 'file + :group 'pcomplete) + +(defvar pcmpl-x-tlmgr-common-options + '("--repository" + "--gui" + "--gui-lang" + "--machine-readable" + "--package-logfile" + "--pause" + "--persistent-downloads" + "--no-persistent-downloads" + "--no-execute-actions" + "--debug-translation" + "--help" + "--version")) + +(defvar pcmpl-x-tlmgr-actions + '(("help") + ("version") + ("gui") + ("install") + ("update") + ("backup") + ("restore") + ("remove") + ("repository" ("list" "add" "remove" "set")) + ("candidates") + ("option" ("show" + "showall" + "repository" + "formats" + "postcode" + "docfiles" + "srcfiles" + "backupdir" + "autobackup" + "sys_bin" + "sys_man" + "sys_info" + "desktop_integration" + "fileassocs" + "multiuser")) + ("conf" ("texmf" "tlmgr")) + ("paper" + ("a4" "letter" "xdvi" "pdftex" "dvips" "dvipdfmx" "dvipdfm" "context") + (lambda () + (unless (member (pcomplete-arg 1) '("a4" "letter")) + (pcomplete-here* '("paper")) + (pcomplete-here* '("a4" "letter"))))) + ("platform" ("list" "add" "remove")) + ("print-platform" ("collections" "schemes")) + ("arch" ("list" "add" "remove")) + ("print-arch" ("collections" "schemes")) + ("info" ("collections" "schemes")) + ("search") + ("dump-tlpdb") + ("check" ("files" "depends" "executes" "runfiles" "all")) + ("path" ("add" "remove")) + ("postaction" ("install" "remove") ("shortcut" "fileassoc" "script")) + ("uninstall") + ("generate" ("language" + "language.dat" + "language.def" + "language.dat.lua" + "fmtutil")))) + +(defvar pcmpl-x-tlmgr-options-cache (make-hash-table :size 31 :test 'equal)) + +(defun pcmpl-x-tlmgr-action-options (action) + "Get the list of long options for ACTION." + (if (eq (gethash action pcmpl-x-tlmgr-options-cache 'missing) 'missing) + (with-temp-buffer + (when (zerop + (call-process pcmpl-x-tlmgr-program nil t nil action "-h")) + (goto-char (point-min)) + (puthash action + (cons "--help" + (cl-loop while (re-search-forward + "^[ \t]+\\(--[[:alnum:]-]+=?\\)" + nil t) + collect (match-string 1))) + pcmpl-x-tlmgr-options-cache) + (pcmpl-x-tlmgr-action-options action))) + (gethash action pcmpl-x-tlmgr-options-cache))) + +;;;###autoload +(defun pcomplete/tlmgr () + "Completion for the `tlmgr' command." + (while (pcomplete-match "^--" 0) + (pcomplete-here* pcmpl-x-tlmgr-common-options) + (unless (or (pcomplete-match "^--" 0) + (all-completions (pcomplete-arg 0) pcmpl-x-tlmgr-actions)) + (pcomplete-here* (pcomplete-dirs-or-entries)))) + (pcomplete-here* pcmpl-x-tlmgr-actions) + (let ((action (substring-no-properties (pcomplete-arg 1)))) + (while t + (if (pcomplete-match "^--" 0) + (pcomplete-here* (pcmpl-x-tlmgr-action-options action)) + (dolist (completions (cdr (assoc action pcmpl-x-tlmgr-actions))) + (cond ((functionp completions) + (funcall completions)) + ((all-completions (pcomplete-arg 0) completions) + (pcomplete-here* completions)) + (t (pcomplete-here* (pcomplete-dirs-or-entries))))) + (unless (pcomplete-match "^--" 0) + (pcomplete-here* (pcomplete-dirs-or-entries))))))) + + +;;;; ack - http://betterthangrep.com + +;; Usage: +;; - To complete short options type '-' first +;; - To complete long options type '--' first +;; - Color name completion is supported following +;; --color-filename=, --color-match= and --color-lineno= +;; - Type completion is supported following --type= + +(defcustom pcmpl-x-ack-program + (file-name-nondirectory (or (executable-find "ack-grep") + (executable-find "ack") + "ack")) + "Name of the ack program." + :type 'file + :group 'pcomplete) + +(defvar pcmpl-x-ack-color-options + '("clear" + "reset" + "dark" + "bold" + "underline" + "underscore" + "blink" + "reverse" + "concealed" + "black" + "red" + "green" + "yellow" + "blue" + "magenta" + "on_black" + "on_red" + "on_green" + "on_yellow" + "on_blue" + "on_magenta" + "on_cyan" + "on_white") + "Color names for the `ack' command.") + +(defun pcmpl-x-ack-run (buffer &rest args) + "Run ack with ARGS and send the output to BUFFER." + (condition-case nil + (apply 'call-process (or pcmpl-x-ack-program "ack") nil buffer nil args) + (file-error -1))) + +(defun pcmpl-x-ack-short-options () + "Short options for the `ack' command." + (with-temp-buffer + (let (options) + (when (zerop (pcmpl-x-ack-run t "--help")) + (goto-char (point-min)) + (while (re-search-forward "^ -\\([^-]\\)" nil t) + (push (match-string 1) options)) + (mapconcat 'identity (nreverse options) ""))))) + +(defun pcmpl-x-ack-long-options (&optional arg) + "Long options for the `ack' command." + (with-temp-buffer + (let (options) + (when (zerop (pcmpl-x-ack-run t (or arg "--help"))) + (goto-char (point-min)) + (while (re-search-forward + "\\(?: ?\\|, \\)\\(--\\(\\[no\\]\\)?\\([[:alnum:]-]+=?\\)\\)" + nil t) + (if (not (match-string 2)) + (push (match-string 1) options) + (push (concat "--" (match-string 3)) options) + (push (concat "--no" (match-string 3)) options))) + (nreverse options))))) + +(defun pcmpl-x-ack-type-options () + "A list of types for the `ack' command." + (pcmpl-x-ack-long-options "--help-types")) + +;;;###autoload +(defun pcomplete/ack () + "Completion for the `ack' command. +Start an argument with '-' to complete short options and '--' for +long options." + ;; No space after = + (while t + (if (pcomplete-match "^-" 0) + (cond + ((pcomplete-match "^--color-\\w+=\\(\\S-*\\)" 0) + (pcomplete-here* pcmpl-x-ack-color-options + (pcomplete-match-string 1 0) t)) + ((pcomplete-match "^--\\(?:no\\)?ignore-dir=\\(\\S-*\\)" 0) + (pcomplete-here* (pcomplete-dirs) + (pcomplete-match-string 1 0) t)) + ((pcomplete-match "^--type=\\(\\S-*\\)" 0) + (pcomplete-here* (mapcar (lambda (type-option) + (substring type-option 2)) + (pcmpl-x-ack-type-options)) + (pcomplete-match-string 1 0) t)) + ((pcomplete-match "^--" 0) + (pcomplete-here* (append (pcmpl-x-ack-long-options) + (pcmpl-x-ack-type-options)))) + (t (pcomplete-opt (pcmpl-x-ack-short-options)))) + (pcomplete-here* (pcomplete-dirs-or-entries))))) + +;;;###autoload +(defalias 'pcomplete/ack-grep 'pcomplete/ack) + +(provide 'pcmpl-x) +;;; pcmpl-x.el ends here From 2625668449306fc79588a2e5f3f59ff8052197f7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 7 Apr 2013 06:19:05 -0400 Subject: [PATCH 16/58] Auto-commit of generated files. --- autogen/Makefile.in | 2 +- autogen/configure | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/autogen/Makefile.in b/autogen/Makefile.in index 03e54906b75..5f213903e9b 100644 --- a/autogen/Makefile.in +++ b/autogen/Makefile.in @@ -1019,7 +1019,7 @@ MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t dirent.h \ string.h-t sys/select.h sys/select.h-t sys/stat.h sys/stat.h-t \ sys/time.h sys/time.h-t time.h time.h-t unistd.h unistd.h-t noinst_LIBRARIES = libgnu.a -AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) +AM_CFLAGS = $(PROFILING_CFLAGS) $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS) DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src libgnu_a_SOURCES = allocator.c c-ctype.h c-ctype.c c-strcase.h \ c-strcasecmp.c c-strncasecmp.c careadlinkat.c close-stream.c \ diff --git a/autogen/configure b/autogen/configure index 23685c523ac..db574207d75 100755 --- a/autogen/configure +++ b/autogen/configure @@ -26667,6 +26667,13 @@ case "$opsys" in *) LD_SWITCH_SYSTEM_TEMACS= ;; esac +if test x$ac_enable_profiling != x ; then + case $opsys in + *freebsd | gnu-linux) ;; + *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;; + esac +fi + ## Common for all window systems From 95c0e83b2a0995ef774d25163d4f66c23399da36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 7 Apr 2013 12:51:29 +0200 Subject: [PATCH 17/58] * nsterm.m (ns_mouse_position): Use NS_FRAME_P instead of checking f->output_data.ns. --- src/ChangeLog | 5 +++++ src/nsterm.m | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 75a7388f2c4..545df8e050f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-03-31 Jan Djärv + + * nsterm.m (ns_mouse_position): Use NS_FRAME_P instead of checking + f->output_data.ns. + 2013-04-07 Paul Eggert Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). diff --git a/src/nsterm.m b/src/nsterm.m index bc3150c0a07..f5b48ee4b11 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1883,7 +1883,7 @@ Free a pool and temporary objects it refers to (callable from C) f = dpyinfo->x_focus_frame ? dpyinfo->x_focus_frame : SELECTED_FRAME (); - if (f && f->output_data.ns) /* TODO: 2nd check no longer needed? */ + if (f && FRAME_NS_P (f)) { view = FRAME_NS_VIEW (*fp); From df4555fad10dafc50c44a4d7f97515cc9f1678c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 7 Apr 2013 13:01:56 +0200 Subject: [PATCH 18/58] * PROBLEMS: Mention Ubuntu warnings about libdbusmenu. --- etc/ChangeLog | 4 ++++ etc/PROBLEMS | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 5e5f93b4825..85b365695fd 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2013-04-07 Jan Djärv + + * PROBLEMS: Mention Ubuntu warnings about libdbusmenu. + 2013-04-02 Fabrice Niessen * themes/leuven-theme.el: Update theme. diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 8cc70115037..bc86c7cb373 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1405,6 +1405,24 @@ For example, in the Xfce 4.8 desktop environment, the clipboard manager in versions of xfce4-settings-helper before 4.8.2 is buggy; https://bugzilla.xfce.org/show_bug.cgi?id=7588 . +*** Warning messages when running in Ubuntu + +When you start Emacs you may see something like this: + +(emacs:2286): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion +`GTK_IS_MENU_SHELL(menu)' failed + +This happens if the Emacs binary has been renamed. The cause it the Ubuntu +appmenu concept. It tries to track Emacs menus and show them in the top +panel, instead of in each Emacs window. This is not properly implemented, +so it fails for Emacs. The order of menus is wrong, and things like copy/paste +that depends on what state Emacs is in, is usually wrong (i.e. paste disabled +even if you should be able to paste, and similar). + +You can get back menus on each frame by starting emacs like this: +% env UBUNTU_MENUPROXY= emacs + + * Runtime problems on character terminals ** The meta key does not work on xterm. From 5406cfd9cd748a2d83a0c9eb38849ace83a10cb2 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 7 Apr 2013 13:21:39 +0200 Subject: [PATCH 19/58] Ignore additional platform-specific ACL errors (Bug#13702). * fileio.c (ACL_NOT_WELL_SUPPORTED): New macro copied from gnulib. (Fcopy_file, Fset_file_acl) [HAVE_POSIX_ACL]: Use it. --- src/ChangeLog | 6 ++++++ src/fileio.c | 27 ++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 545df8e050f..be654602cc8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-04-07 Romain Francoise + + Ignore additional platform-specific ACL errors (Bug#13702). + * fileio.c (ACL_NOT_WELL_SUPPORTED): New macro copied from gnulib. + (Fcopy_file, Fset_file_acl) [HAVE_POSIX_ACL]: Use it. + 2013-03-31 Jan Djärv * nsterm.m (ns_mouse_position): Use NS_FRAME_P instead of checking diff --git a/src/fileio.c b/src/fileio.c index bffaff0609d..076cdfbc2ff 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -81,6 +81,23 @@ along with GNU Emacs. If not, see . */ #define DRIVE_LETTER(x) c_tolower (x) #endif +#ifdef HAVE_POSIX_ACL +/* FIXME: this macro was copied from gnulib's private acl-internal.h + header file. */ +/* Recognize some common errors such as from an NFS mount that does + not support ACLs, even when local drives do. */ +#if defined __APPLE__ && defined __MACH__ /* Mac OS X */ +#define ACL_NOT_WELL_SUPPORTED(Err) \ + ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == ENOENT) +#elif defined EOPNOTSUPP /* Tru64 NFS */ +#define ACL_NOT_WELL_SUPPORTED(Err) \ + ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP) +#else +#define ACL_NOT_WELL_SUPPORTED(Err) \ + ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY) +#endif +#endif /* HAVE_POSIX_ACL */ + #include "systime.h" #include #include @@ -2011,7 +2028,7 @@ entries (depending on how Emacs was built). */) { #ifdef HAVE_POSIX_ACL acl = acl_get_file (SDATA (encoded_file), ACL_TYPE_ACCESS); - if (acl == NULL && errno != ENOTSUP) + if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Getting ACL", Fcons (file, Qnil)); #endif } @@ -2055,7 +2072,7 @@ entries (depending on how Emacs was built). */) { bool fail = acl_set_file (SDATA (encoded_newname), ACL_TYPE_ACCESS, acl) != 0; - if (fail && errno != ENOTSUP) + if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Setting ACL", Fcons (newname, Qnil)); acl_free (acl); @@ -2087,7 +2104,7 @@ entries (depending on how Emacs was built). */) #ifdef HAVE_POSIX_ACL acl = acl_get_fd (ifd); - if (acl == NULL && errno != ENOTSUP) + if (acl == NULL && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Getting ACL", Fcons (file, Qnil)); #endif } @@ -2176,7 +2193,7 @@ entries (depending on how Emacs was built). */) if (acl != NULL) { bool fail = acl_set_fd (ofd, acl) != 0; - if (fail && errno != ENOTSUP) + if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Setting ACL", Fcons (newname, Qnil)); acl_free (acl); @@ -3174,7 +3191,7 @@ support. */) fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS, acl) != 0); - if (fail && errno != ENOTSUP) + if (fail && !ACL_NOT_WELL_SUPPORTED (errno)) report_file_error ("Setting ACL", Fcons (absname, Qnil)); acl_free (acl); From 7d9f6883aad738362a8321955b1c1f76e8f7aea1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 7 Apr 2013 19:18:41 +0300 Subject: [PATCH 20/58] Provide definition of ACL_NOT_WELL_SUPPORTED for MS-Windows. src/fileio.c (ACL_NOT_WELL_SUPPORTED): Define macro for WINDOWSNT. Fixes: debbugs:13702 --- src/ChangeLog | 4 ++++ src/fileio.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index be654602cc8..cb6930f9acc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-04-07 Eli Zaretskii + + * fileio.c (ACL_NOT_WELL_SUPPORTED): Define macro for WINDOWSNT. + 2013-04-07 Romain Francoise Ignore additional platform-specific ACL errors (Bug#13702). diff --git a/src/fileio.c b/src/fileio.c index 076cdfbc2ff..1049522e5a9 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -92,6 +92,8 @@ along with GNU Emacs. If not, see . */ #elif defined EOPNOTSUPP /* Tru64 NFS */ #define ACL_NOT_WELL_SUPPORTED(Err) \ ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY || (Err) == EOPNOTSUPP) +#elif defined WINDOWSNT +#define ACL_NOT_WELL_SUPPORTED(Err) ((Err) == ENOTSUP) #else #define ACL_NOT_WELL_SUPPORTED(Err) \ ((Err) == ENOTSUP || (Err) == ENOSYS || (Err) == EINVAL || (Err) == EBUSY) From e3e7b504b2b0148e62ea444300a8fb389ef39a09 Mon Sep 17 00:00:00 2001 From: Nic Ferrier Date: Sun, 7 Apr 2013 14:56:28 -0400 Subject: [PATCH 21/58] * lisp/emacs-lisp/ert.el (should, should-not, should-error): Add edebug declaration. --- lisp/ChangeLog | 9 +++++++-- lisp/emacs-lisp/ert.el | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca9c545a37b..a2be1055f46 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-07 Nic Ferrier + + * emacs-lisp/ert.el (should, should-not, should-error): Add edebug + declaration. + 2013-04-07 Leo Liu * pcmpl-x.el: New file. @@ -31,8 +36,8 @@ 2013-04-05 Dmitry Gutov - * whitespace.el (whitespace-color-on, whitespace-color-off): Only - call `font-lock-fontify-buffer' when `font-lock-mode' is on. + * whitespace.el (whitespace-color-on, whitespace-color-off): + Only call `font-lock-fontify-buffer' when `font-lock-mode' is on. 2013-04-05 Jacek Chrząszcz (tiny change) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 7df3acccbc9..a9c06b05028 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -464,6 +464,7 @@ FORM-DESCRIPTION-FORM before it has called INNER-FORM." "Evaluate FORM. If it returns nil, abort the current test as failed. Returns the value of FORM." + (declare (debug t))) (ert--expand-should `(should ,form) form (lambda (inner-form form-description-form _value-var) `(unless ,inner-form @@ -473,6 +474,7 @@ Returns the value of FORM." "Evaluate FORM. If it returns non-nil, abort the current test as failed. Returns nil." + (declare (debug t))) (ert--expand-should `(should-not ,form) form (lambda (inner-form form-description-form _value-var) `(unless (not ,inner-form) @@ -520,6 +522,7 @@ non-nil, the error matches TYPE if it is an element of TYPE. If the error matches, returns (ERROR-SYMBOL . DATA) from the error. If not, or if no error was signaled, abort the test as failed." + (declare (debug t)) (unless type (setq type ''error)) (ert--expand-should `(should-error ,form ,@keys) From 285c8184afc5b3ad20b21947ac4c8fee7668c516 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 7 Apr 2013 16:42:11 -0400 Subject: [PATCH 22/58] * emacs-lisp/ert.el: Fix paren typo. --- lisp/emacs-lisp/ert.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index a9c06b05028..656cb0a6a14 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -464,7 +464,7 @@ FORM-DESCRIPTION-FORM before it has called INNER-FORM." "Evaluate FORM. If it returns nil, abort the current test as failed. Returns the value of FORM." - (declare (debug t))) + (declare (debug t)) (ert--expand-should `(should ,form) form (lambda (inner-form form-description-form _value-var) `(unless ,inner-form @@ -474,7 +474,7 @@ Returns the value of FORM." "Evaluate FORM. If it returns non-nil, abort the current test as failed. Returns nil." - (declare (debug t))) + (declare (debug t)) (ert--expand-should `(should-not ,form) form (lambda (inner-form form-description-form _value-var) `(unless (not ,inner-form) From 8acdeb7104ad8d90f93c7dca6ee0d32149b32fc1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 7 Apr 2013 22:08:45 -0400 Subject: [PATCH 23/58] * lisp/emacs-lisp/timer.el (timer-event-handler): Don't retrigger a canceled timer. Fixes: debbugs:14156 --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/timer.el | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a2be1055f46..f5cf9d078e7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-08 Stefan Monnier + + * emacs-lisp/timer.el (timer-event-handler): Don't retrigger a canceled + timer (bug#14156). + 2013-04-07 Nic Ferrier * emacs-lisp/ert.el (should, should-not, should-error): Add edebug diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 8b019d0a785..8b1dca8cb78 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -314,8 +314,12 @@ This function is called, by name, directly by the C code." (save-current-buffer (apply (timer--function timer) (timer--args timer))) (error (message "Error in timer: %S" err))) - (if retrigger - (setf (timer--triggered timer) nil))) + (when (and retrigger + ;; If the timer's been canceled, don't "retrigger" it + ;; since it might still be in the copy of timer-list kept + ;; by keyboard.c:timer_check (bug#14156). + (memq timer timer-list)) + (setf (timer--triggered timer) nil))) (error "Bogus timer event")))) ;; This function is incompatible with the one in levents.el. From 6fcdab68b3e73354fb17f4c8c4f8199d6f63cf30 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 7 Apr 2013 22:21:59 -0400 Subject: [PATCH 24/58] * lisp/emacs-lisp/edebug.el (edebug-mode): Fix typo. Fixes: debbugs:14144 --- lisp/ChangeLog | 2 ++ lisp/emacs-lisp/edebug.el | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f5cf9d078e7..95aadd40fd6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2013-04-08 Stefan Monnier + * emacs-lisp/edebug.el (edebug-mode): Fix typo (bug#14144). + * emacs-lisp/timer.el (timer-event-handler): Don't retrigger a canceled timer (bug#14156). diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el index 5929ea7a856..867f079ce5f 100644 --- a/lisp/emacs-lisp/edebug.el +++ b/lisp/emacs-lisp/edebug.el @@ -3814,7 +3814,7 @@ Options: (remove-hook 'kill-buffer-hook 'edebug-kill-buffer t)) (pcase-dolist (`(,var . ,val) '((buffer-read-only . t))) (push - (if (local-variable-p var) var (cons var (symbol-value var))) + (if (local-variable-p var) (cons var (symbol-value var)) var) edebug--mode-saved-vars) (set (make-local-variable var) val)) ;; Append `edebug-kill-buffer' to the hook to avoid interfering with From 7ffe7ef6ba59f3ac5728dc7b782de5082e22aad9 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 8 Apr 2013 14:04:58 -0400 Subject: [PATCH 25/58] * src/window.c (select_window): Don't record_buffer while the invariant is temporarily broken. * src/fns.c (Fdelq): Don't assume !NILP => CONSP. Fixes: debbugs:14161 --- src/ChangeLog | 7 +++++++ src/fns.c | 2 +- src/keyboard.c | 10 +++++----- src/window.c | 17 ++++++++++------- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cb6930f9acc..04dcee7b6eb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-04-08 Stefan Monnier + + * window.c (select_window): Don't record_buffer while the invariant is + temporarily broken (bug#14161). + + * fns.c (Fdelq): Don't assume !NILP => CONSP. + 2013-04-07 Eli Zaretskii * fileio.c (ACL_NOT_WELL_SUPPORTED): Define macro for WINDOWSNT. diff --git a/src/fns.c b/src/fns.c index 86bdc0250dc..08c6f055f38 100644 --- a/src/fns.c +++ b/src/fns.c @@ -1551,7 +1551,7 @@ the value of a list `foo'. */) tail = list; prev = Qnil; - while (!NILP (tail)) + while (CONSP (tail)) { CHECK_LIST_CONS (tail, list); tem = XCAR (tail); diff --git a/src/keyboard.c b/src/keyboard.c index beba3025887..b4fafa22e41 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -72,7 +72,7 @@ along with GNU Emacs. If not, see . */ #include TERM_HEADER #endif /* HAVE_WINDOW_SYSTEM */ -/* Variables for blockinput.h: */ +/* Variables for blockinput.h: */ /* Positive if interrupt input is blocked right now. */ volatile int interrupt_input_blocked; @@ -4337,10 +4337,10 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers) } idle_timer_ripe = EMACS_TIME_LE (idle_timer_time, idleness_now); - idle_timer_difference = - (idle_timer_ripe - ? sub_emacs_time (idleness_now, idle_timer_time) - : sub_emacs_time (idle_timer_time, idleness_now)); + idle_timer_difference + = (idle_timer_ripe + ? sub_emacs_time (idleness_now, idle_timer_time) + : sub_emacs_time (idle_timer_time, idleness_now)); } /* Decide which timer is the next timer, diff --git a/src/window.c b/src/window.c index feb5f7b5cc7..2ddf742be99 100644 --- a/src/window.c +++ b/src/window.c @@ -485,12 +485,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) w = XWINDOW (window); w->frozen_window_start_p = 0; - if (NILP (norecord)) - { - w->use_time = ++window_select_count; - record_buffer (w->contents); - } - /* Make the selected window's buffer current. */ Fset_buffer (w->contents); @@ -515,6 +509,15 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) select_window_1 (window, inhibit_point_swap); + /* record_buffer can run QUIT, so make sure it is run only after we have + re-established the invariant between selected_window and selected_frame, + otherwise the temporary broken invariant might "escape" (bug#14161). */ + if (NILP (norecord)) + { + w->use_time = ++window_select_count; + record_buffer (w->contents); + } + bset_last_selected_window (XBUFFER (w->contents), window); windows_or_buffers_changed++; return window; @@ -2929,7 +2932,7 @@ window-start value is reasonable when this function is called. */) replace_window (root, window, 1); - /* This must become SWINDOW anyway ....... */ + /* This must become SWINDOW anyway ....... */ if (BUFFERP (w->contents) && !resize_failed) { /* Try to minimize scrolling, by setting the window start to the From ba3b2d88d847cf1669f3f0c340f8864c77fe59de Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Mon, 8 Apr 2013 22:38:56 -0400 Subject: [PATCH 26/58] Fix icon for the cygw32 build on 64-bit Cygwin. (Bug#12993) * nt/emacs.rc: Use 64-bit manifest for 64-bit Cygwin build. * configure.ac (W32_RES_LINK): Remove unnecessary linker directive `-Wl,-bpe-i386', which is confusing in the 64-bit case. --- ChangeLog | 6 ++++++ configure.ac | 2 +- nt/ChangeLog | 5 +++++ nt/emacs.rc | 2 +- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dd796962d7..a2ebd3e912b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-04-09 Ken Brown + + * configure.ac (W32_RES_LINK): Remove unneeded linker directive + `-Wl,-bpe-i386', which is confusing in the 64-bit case. + (Bug#12993) + 2013-04-07 Paul Eggert Fix --enable-profiling bug introduced by 2013-02-25 change (Bug#13783). diff --git a/configure.ac b/configure.ac index 2d8c4c3473d..71e35ec8ff7 100644 --- a/configure.ac +++ b/configure.ac @@ -1527,7 +1527,7 @@ if test "${with_w32}" != no; then W32_RES="emacs.res" # Tell the linker that emacs.res is an object (which we compile from # the rc file), not a linker script. - W32_RES_LINK="-Wl,-bpe-i386 -Wl,emacs.res" + W32_RES_LINK="-Wl,emacs.res" fi AC_SUBST(W32_OBJ) AC_SUBST(W32_LIBS) diff --git a/nt/ChangeLog b/nt/ChangeLog index 3d2c0e172ff..acc74488424 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,8 @@ +2013-04-09 Ken Brown + + * emacs.rc: Use 64-bit manifest for 64-bit Cygwin build. + (Bug#12993) + 2013-04-01 Eli Zaretskii * README: A better documentation of ddeclient.exe. diff --git a/nt/emacs.rc b/nt/emacs.rc index d2703c45869..81d283f70af 100644 --- a/nt/emacs.rc +++ b/nt/emacs.rc @@ -1,6 +1,6 @@ Emacs ICON icons/emacs.ico 32649 CURSOR icons/hand.cur -#ifdef WIN64 +#if defined (WIN64) || defined (__x86_64__) 1 24 "emacs-x64.manifest" #else 1 24 "emacs-x86.manifest" From b39792eb9ed314c91c68ff55f78a5557d5e56534 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Tue, 9 Apr 2013 11:36:25 +0200 Subject: [PATCH 27/58] * simple.el (choose-completion-string): Fix docstring (bug#14163). --- lisp/ChangeLog | 4 ++++ lisp/simple.el | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 95aadd40fd6..8eafcfacd98 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-04-09 Bastien Guerry + + * simple.el (choose-completion-string): Fix docstring (bug#14163). + 2013-04-08 Stefan Monnier * emacs-lisp/edebug.el (edebug-mode): Fix typo (bug#14144). diff --git a/lisp/simple.el b/lisp/simple.el index 9baa1b7c884..5adb634e195 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -6628,7 +6628,9 @@ the default method of inserting the completion in BUFFER.") (defun choose-completion-string (choice &optional buffer base-position insert-function) "Switch to BUFFER and insert the completion choice CHOICE. -BASE-POSITION, says where to insert the completion." +BASE-POSITION says where to insert the completion. +INSERT-FUNCTION says how to insert the completion and falls +back on `completion-list-insert-choice-function' when nil." ;; If BUFFER is the minibuffer, exit the minibuffer ;; unless it is reading a file name and CHOICE is a directory, From d14b1e48117d071af5186459e288bc53418bd014 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 9 Apr 2013 06:17:36 -0400 Subject: [PATCH 28/58] Auto-commit of generated files. --- autogen/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen/configure b/autogen/configure index db574207d75..d4df3a49174 100755 --- a/autogen/configure +++ b/autogen/configure @@ -9842,7 +9842,7 @@ fi W32_RES="emacs.res" # Tell the linker that emacs.res is an object (which we compile from # the rc file), not a linker script. - W32_RES_LINK="-Wl,-bpe-i386 -Wl,emacs.res" + W32_RES_LINK="-Wl,emacs.res" fi From 7144c62778d5c4700de4c9a12f9165423b12864e Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 10 Apr 2013 02:31:17 +0900 Subject: [PATCH 29/58] * lisp/progmodes/sh-script.el: Implement `sh-mode' own `add-log-current-defun-function'. (sh-current-defun-name): New function. (sh-mode): Use the function. Fixes: debbugs:14112 --- lisp/ChangeLog | 7 +++++++ lisp/progmodes/sh-script.el | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8eafcfacd98..01887620250 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-04-10 Masatake YAMATO + + * progmodes/sh-script.el: Implement `sh-mode' own + `add-log-current-defun-function' (bug#14112). + (sh-current-defun-name): New function. + (sh-mode): Use the function. + 2013-04-09 Bastien Guerry * simple.el (choose-completion-string): Fix docstring (bug#14163). diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8f1954402e5..e197f9cfabe 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -353,6 +353,28 @@ See `sh-feature' and `imenu-generic-expression'." :group 'sh-script :version "20.4") +(defun sh-current-defun-name () + "Find the name of function or variable at point. +For use in `add-log-current-defun-function'." + (save-excursion + (end-of-line) + (when (re-search-backward + (concat "\\(?:" + ;; function FOO + ;; function FOO() + "^\\s-*function\\s-+\\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*\\(?:()\\)?" + "\\)\\|\\(?:" + ;; FOO() + "^\\s-*\\([[:alpha:]_][[:alnum:]_]*\\)\\s-*()" + "\\)\\|\\(?:" + ;; FOO= + "^\\([[:alpha:]_][[:alnum:]_]*\\)=" + "\\)") + nil t) + (or (match-string-no-properties 1) + (match-string-no-properties 2) + (match-string-no-properties 3))))) + (defvar sh-shell-variables nil "Alist of shell variable names that should be included in completion. These are used for completion in addition to all the variables named @@ -1533,6 +1555,7 @@ with your script for an edit-interpret-debug cycle." (setq-local skeleton-newline-indent-rigidly t) (setq-local defun-prompt-regexp (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)")) + (setq-local add-log-current-defun-function #'sh-current-defun-name) ;; Parse or insert magic number for exec, and set all variables depending ;; on the shell thus determined. (sh-set-shell From 694569fc79b2923e054cd3064a16bb7decdc447d Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 10 Apr 2013 02:37:17 +0900 Subject: [PATCH 30/58] * test/automated/add-log-tests.el: New file. Fixes: debbugs:14112 --- test/ChangeLog | 4 ++ test/automated/add-log-tests.el | 84 +++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 test/automated/add-log-tests.el diff --git a/test/ChangeLog b/test/ChangeLog index cd4414cd079..bf68984e9e8 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2013-04-09 Masatake YAMATO + + * automated/add-log-tests.el: New file. (Bug#14112) + 2013-03-30 Fabián Ezequiel Gallina * automated/python-tests.el (python-indent-block-enders): New test. diff --git a/test/automated/add-log-tests.el b/test/automated/add-log-tests.el new file mode 100644 index 00000000000..28029e18b99 --- /dev/null +++ b/test/automated/add-log-tests.el @@ -0,0 +1,84 @@ +;;; add-log-tests.el --- Test suite for add-log. + +;; Copyright (C) 2013 Free Software Foundation, Inc. + +;; Author: Masatake YAMATO +;; Keywords: vc tools + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs 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 General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'add-log) + +(defmacro add-log-current-defun-deftest (name doc major-mode + content marker expected-defun) + "Generate an ert test for mode-own `add-log-current-defun-function'. +Run `add-log-current-defun' at the point where MARKER specifies in a +buffer which content is CONTENT under MAJOR-MODE. Then it compares the +result with EXPECTED-DEFUN." + (let ((xname (intern (concat "add-log-current-defun-test-" + (symbol-name name) + )))) + `(ert-deftest ,xname () + ,doc + (with-temp-buffer + (insert ,content) + (goto-char (point-min)) + (funcall ',major-mode) + (should (equal (when (search-forward ,marker nil t) + (replace-match "" nil t) + (add-log-current-defun)) + ,expected-defun)))))) + +(add-log-current-defun-deftest + sh-func1 + "Test sh-current-defun-name can find function." + sh-mode " +function foo +{ + >< +}" "><" "foo") + +(add-log-current-defun-deftest + sh-func2 + "Test sh-current-defun-name can find function." + sh-mode " +foo() +{ + >< +}" "><" "foo") + +(add-log-current-defun-deftest + sh-func3 + "Test sh-current-defun-name can find function." + sh-mode " +function foo() +{ + >< +}" "><" "foo") + +(add-log-current-defun-deftest + sh-var + "Test sh-current-defun-name can find variabe definition." + sh-mode " +PATH=a:/ab:/usr/abc +DIR=/pr><" "DIR") + +(provide 'add-log-tests) + +;;; add-log-tests.el ends here From ac2f8659026856e720b4385d85ae33ee3a4967de Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 10 Apr 2013 02:54:50 +0900 Subject: [PATCH 31/58] * etc/NEWS: Mention `sh-mode' own `add-log-current-defun-function'. --- etc/ChangeLog | 4 ++++ etc/NEWS | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 85b365695fd..209ce4f8b29 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2013-04-09 Masatake YAMATO + + * NEWS: Mention `sh-mode' own `add-log-current-defun-function'. + 2013-04-07 Jan Djärv * PROBLEMS: Mention Ubuntu warnings about libdbusmenu. diff --git a/etc/NEWS b/etc/NEWS index d893f496ef0..6014ee36219 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -84,6 +84,11 @@ Eg View mode, etc. ** New command `kmacro-to-register' to store keyboard macros in registers. +** Shell Script mode + +*** `sh-mode' now has the mode own `add-log-current-defun-function'. +You can pick the name of the function and the variables with `C-x 4 a'. + * Changes in Specialized Modes and Packages in Emacs 24.4 From 79e04e9e20aa0e1f0652d96cdb6d124aed7f2bf4 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Tue, 9 Apr 2013 21:18:53 +0200 Subject: [PATCH 32/58] * themes/tsdh-dark-theme.el (tsdh-dark): Add some more faces. --- etc/ChangeLog | 4 ++++ etc/themes/tsdh-dark-theme.el | 3 +++ 2 files changed, 7 insertions(+) diff --git a/etc/ChangeLog b/etc/ChangeLog index 209ce4f8b29..493095e9621 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2013-04-09 Tassilo Horn + + * themes/tsdh-dark-theme.el (tsdh-dark): Add some more faces. + 2013-04-09 Masatake YAMATO * NEWS: Mention `sh-mode' own `add-log-current-defun-function'. diff --git a/etc/themes/tsdh-dark-theme.el b/etc/themes/tsdh-dark-theme.el index 011133808a2..879f8f10e8a 100644 --- a/etc/themes/tsdh-dark-theme.el +++ b/etc/themes/tsdh-dark-theme.el @@ -64,7 +64,10 @@ Used and created by Tassilo Horn.") '(highlight ((t (:background "sea green")))) '(hl-line ((t (:background "grey25")))) '(hl-paren-face ((t (:weight bold))) t) + '(icomplete-first-match ((t (:foreground "deep sky blue" :weight bold)))) '(lusty-file-face ((t (:foreground "SpringGreen1"))) t) + '(magit-header ((t (:box 1 :weight bold)))) + '(magit-section-title ((t (:inherit magit-header :background "dark slate blue")))) '(menu ((t (:background "gray30" :foreground "gray70")))) '(minibuffer-prompt ((t (:background "yellow" :foreground "medium blue" :box (:line-width -1 :color "red" :style released-button) :weight bold)))) '(mode-line ((t (:box (:line-width 1 :color "red") :family "DejaVu Sans")))) From a8036e4076f6d43537905e3aaf400992fdef38e4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 9 Apr 2013 16:10:47 -0400 Subject: [PATCH 33/58] * src/minibuf.c (Ftest_completion): Ignore non-string/symbol keys in hash tables. Fixes: debbugs:14054 --- src/ChangeLog | 5 +++++ src/minibuf.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 04dcee7b6eb..402792b5460 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-09 Stefan Monnier + + * minibuf.c (Ftest_completion): Ignore non-string/symbol keys in hash + tables (bug#14054). + 2013-04-08 Stefan Monnier * window.c (select_window): Don't record_buffer while the invariant is diff --git a/src/minibuf.c b/src/minibuf.c index 68c39310f01..4cc1f8d435a 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1800,17 +1800,21 @@ the values STRING, PREDICATE and `lambda'. */) { struct Lisp_Hash_Table *h = XHASH_TABLE (collection); i = hash_lookup (h, string, NULL); + Lisp_Object key = Qnil; if (i >= 0) tem = HASH_KEY (h, i); else for (i = 0; i < HASH_TABLE_SIZE (h); ++i) if (!NILP (HASH_HASH (h, i)) + && (key = HASH_KEY (h, i), + SYMBOLP (key) ? key = Fsymbol_name (key) : key, + STRINGP (key)) && EQ (Fcompare_strings (string, make_number (0), Qnil, - HASH_KEY (h, i), make_number (0) , Qnil, + key, make_number (0) , Qnil, completion_ignore_case ? Qt : Qnil), Qt)) { - tem = HASH_KEY (h, i); + tem = key; break; } if (!STRINGP (tem)) From c03cf6f1e1b5d9b42ea3002cb5d3b1152f1baa1b Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 9 Apr 2013 18:20:51 -0700 Subject: [PATCH 34/58] Fix typos --- etc/PROBLEMS | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index bc86c7cb373..0cfc0ad0c14 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -1412,17 +1412,16 @@ When you start Emacs you may see something like this: (emacs:2286): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion `GTK_IS_MENU_SHELL(menu)' failed -This happens if the Emacs binary has been renamed. The cause it the Ubuntu +This happens if the Emacs binary has been renamed. The cause is the Ubuntu appmenu concept. It tries to track Emacs menus and show them in the top panel, instead of in each Emacs window. This is not properly implemented, so it fails for Emacs. The order of menus is wrong, and things like copy/paste -that depends on what state Emacs is in, is usually wrong (i.e. paste disabled +that depend on what state Emacs is in are usually wrong (i.e. paste disabled even if you should be able to paste, and similar). You can get back menus on each frame by starting emacs like this: % env UBUNTU_MENUPROXY= emacs - * Runtime problems on character terminals ** The meta key does not work on xterm. From b60e25d6bc17deb6b553afb2cebe96e79dfadab5 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Tue, 9 Apr 2013 18:22:15 -0700 Subject: [PATCH 35/58] Standardize license text --- lisp/pcmpl-x.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el index 6ef592b969d..86d8dc652c3 100644 --- a/lisp/pcmpl-x.el +++ b/lisp/pcmpl-x.el @@ -1,23 +1,25 @@ ;;; pcmpl-x.el --- completion for miscellaneous tools -*- lexical-binding: t; -*- -;; Copyright (C) 2013 Free Software Foundation, Inc. +;; Copyright (C) 2013 Free Software Foundation, Inc. ;; Author: Leo Liu ;; Keywords: processes, tools, convenience ;; Package: pcomplete -;; This program is free software; you can redistribute it and/or modify +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. -;; This program is distributed in the hope that it will be useful, +;; GNU Emacs 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 General Public License for more details. ;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . +;; along with GNU Emacs. If not, see . ;;; Code: From 15e54145b44fc4e0e69207d1dc2bfa12f4ed0eb4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 10 Apr 2013 09:17:27 -0400 Subject: [PATCH 36/58] * lisp/mpc.el (mpc-proc): Add `restart' argument. (mpc-proc-cmd): Use it. (mpc--status-timer-run): Also catch signals from `mpc-proc'. (mpc-status-buffer-show, mpc-tagbrowser-dir-toggle): Call `mpc-proc' less often. --- lisp/ChangeLog | 8 ++++++++ lisp/mpc.el | 33 ++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 01887620250..9ca8db15ccd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2013-04-10 Stefan Monnier + + * mpc.el (mpc-proc): Add `restart' argument. + (mpc-proc-cmd): Use it. + (mpc--status-timer-run): Also catch signals from `mpc-proc'. + (mpc-status-buffer-show, mpc-tagbrowser-dir-toggle): Call `mpc-proc' + less often. + 2013-04-10 Masatake YAMATO * progmodes/sh-script.el: Implement `sh-mode' own diff --git a/lisp/mpc.el b/lisp/mpc.el index 9d9da27f6da..ad7381bb4b7 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -320,10 +320,11 @@ defaults to 6600 and HOST defaults to localhost." (if tmp (push (nreverse tmp) alists)) (nreverse alists))) -(defun mpc-proc () +(defun mpc-proc (&optional restart) (unless (and mpc-proc (buffer-live-p (process-buffer mpc-proc)) - (not (memq (process-status mpc-proc) '(closed)))) + (not (and restart + (memq (process-status mpc-proc) '(closed))))) (mpc--proc-connect mpc-host)) mpc-proc) @@ -356,7 +357,7 @@ otherwise return immediately and call CALLBACK with no argument when the command terminates. CMD can be a string which is passed as-is to MPD or a list of strings which will be concatenated with proper quoting before passing them to MPD." - (let ((proc (mpc-proc))) + (let ((proc (mpc-proc 'restart))) (if (and callback (not (process-get proc 'ready))) (let ((old (process-get proc 'callback))) (process-put proc 'callback @@ -491,10 +492,10 @@ to call FUN for any change whatsoever.") (cancel-timer mpc--status-timer) (setq mpc--status-timer nil))) (defun mpc--status-timer-run () - (when (process-get (mpc-proc) 'ready) (condition-case err - (with-local-quit (mpc-status-refresh)) - (error (message "MPC: %s" err))))) + (when (process-get (mpc-proc) 'ready) + (with-local-quit (mpc-status-refresh))) + (error (message "MPC: %s" err)))) (defvar mpc--status-idle-timer nil) (defun mpc--status-idle-timer-start () @@ -1177,14 +1178,15 @@ If PLAYLIST is t or nil or missing, use the main playlist." (defun mpc-status-buffer-show () (interactive) - (let* ((buf (mpc-proc-buffer (mpc-proc) 'status)) - (songs-buf (mpc-proc-buffer (mpc-proc) 'songs)) + (let* ((proc (mpc-proc)) + (buf (mpc-proc-buffer proc 'status)) + (songs-buf (mpc-proc-buffer proc 'songs)) (songs-win (if songs-buf (get-buffer-window songs-buf 0)))) (unless (buffer-live-p buf) (setq buf (get-buffer-create "*MPC-Status*")) (with-current-buffer buf (mpc-status-mode)) - (mpc-proc-buffer (mpc-proc) 'status buf)) + (mpc-proc-buffer proc 'status buf)) (if (null songs-win) (pop-to-buffer buf) (let ((_win (split-window songs-win 20 t))) (set-window-dedicated-p songs-win nil) @@ -1692,13 +1694,14 @@ Return non-nil if a selection was deactivated." (mpc-event-set-point event) (let ((name (buffer-substring (line-beginning-position) (line-end-position))) - (prop (intern mpc-tag))) - (if (not (member name (process-get (mpc-proc) prop))) - (process-put (mpc-proc) prop - (cons name (process-get (mpc-proc) prop))) - (let ((new (delete name (process-get (mpc-proc) prop)))) + (prop (intern mpc-tag)) + (proc (mpc-proc))) + (if (not (member name (process-get proc prop))) + (process-put proc prop + (cons name (process-get proc prop))) + (let ((new (delete name (process-get proc prop)))) (setq name (concat name "/")) - (process-put (mpc-proc) prop + (process-put proc prop (delq nil (mapcar (lambda (x) (if (string-prefix-p name x) From 78ce603d02dd6f2492fb0178bb148d3d76e4312b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 10 Apr 2013 09:31:35 -0400 Subject: [PATCH 37/58] * src/keyboard.c (timer_start_idle): Call internal-timer-start-idle instead of marking the idle timers directly. * lisp/emacs-lisp/timer.el (timer--check): New function. (timer--time, timer-set-function, timer-event-handler): Use it. (timer-set-idle-time): Simplify. (timer--activate): CSE. (timer-event-handler): Give more info in error message. (internal-timer-start-idle): New function, moved from C. --- lisp/ChangeLog | 7 ++ lisp/emacs-lisp/timer.el | 151 +++++++++++++++++++++------------------ src/ChangeLog | 5 ++ src/keyboard.c | 11 +-- 4 files changed, 95 insertions(+), 79 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9ca8db15ccd..a50f3bc8f15 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2013-04-10 Stefan Monnier + * emacs-lisp/timer.el (timer--check): New function. + (timer--time, timer-set-function, timer-event-handler): Use it. + (timer-set-idle-time): Simplify. + (timer--activate): CSE. + (timer-event-handler): Give more info in error message. + (internal-timer-start-idle): New function, moved from C. + * mpc.el (mpc-proc): Add `restart' argument. (mpc-proc-cmd): Use it. (mpc--status-timer-run): Also catch signals from `mpc-proc'. diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el index 8b1dca8cb78..a1bba2ddb6e 100644 --- a/lisp/emacs-lisp/timer.el +++ b/lisp/emacs-lisp/timer.el @@ -27,27 +27,34 @@ ;;; Code: -;; Layout of a timer vector: -;; [triggered-p high-seconds low-seconds usecs repeat-delay -;; function args idle-delay psecs] -;; triggered-p is nil if the timer is active (waiting to be triggered), -;; t if it is inactive ("already triggered", in theory) - (eval-when-compile (require 'cl-lib)) (cl-defstruct (timer - (:constructor nil) - (:copier nil) - (:constructor timer-create ()) - (:type vector) - (:conc-name timer--)) + (:constructor nil) + (:copier nil) + (:constructor timer-create ()) + (:type vector) + (:conc-name timer--)) + ;; nil if the timer is active (waiting to be triggered), + ;; non-nil if it is inactive ("already triggered", in theory). (triggered t) - high-seconds low-seconds usecs repeat-delay function args idle-delay psecs) + ;; Time of next trigger: for normal timers, absolute time, for idle timers, + ;; time relative to idle-start. + high-seconds low-seconds usecs + ;; For normal timers, time between repetitions, or nil. For idle timers, + ;; non-nil iff repeated. + repeat-delay + function args ;What to do when triggered. + idle-delay ;If non-nil, this is an idle-timer. + psecs) (defun timerp (object) "Return t if OBJECT is a timer." (and (vectorp object) (= (length object) 9))) +(defsubst timer--check (timer) + (or (timerp timer) (signal 'wrong-type-argument (list #'timerp timer)))) + ;; Pseudo field `time'. (defun timer--time (timer) (list (timer--high-seconds timer) @@ -57,17 +64,17 @@ (gv-define-simple-setter timer--time (lambda (timer time) - (or (timerp timer) (error "Invalid timer")) + (timer--check timer) (setf (timer--high-seconds timer) (pop time)) (let ((low time) (usecs 0) (psecs 0)) (if (consp time) - (progn - (setq low (pop time)) - (if time - (progn - (setq usecs (pop time)) - (if time - (setq psecs (car time))))))) + (progn + (setq low (pop time)) + (if time + (progn + (setq usecs (pop time)) + (if time + (setq psecs (car time))))))) (setf (timer--low-seconds timer) low) (setf (timer--usecs timer) usecs) (setf (timer--psecs timer) psecs)))) @@ -83,15 +90,13 @@ fire repeatedly that many seconds apart." timer) (defun timer-set-idle-time (timer secs &optional repeat) + ;; FIXME: Merge with timer-set-time. "Set the trigger idle time of TIMER to SECS. SECS may be an integer, floating point number, or the internal time format returned by, e.g., `current-idle-time'. If optional third argument REPEAT is non-nil, make the timer fire each time Emacs is idle for that many seconds." - (if (consp secs) - (setf (timer--time timer) secs) - (setf (timer--time timer) '(0 0 0)) - (timer-inc-time timer secs)) + (setf (timer--time timer) (if (consp secs) secs (seconds-to-time secs))) (setf (timer--repeat-delay timer) repeat) timer) @@ -156,8 +161,7 @@ fire repeatedly that many seconds apart." (defun timer-set-function (timer function &optional args) "Make TIMER call FUNCTION with optional ARGS when triggering." - (or (timerp timer) - (error "Invalid timer")) + (timer--check timer) (setf (timer--function timer) function) (setf (timer--args timer) args) timer) @@ -181,9 +185,10 @@ fire repeatedly that many seconds apart." (setcdr reuse-cell timers)) (setq reuse-cell (cons timer timers))) ;; Insert new timer after last which possibly means in front of queue. - (cond (last (setcdr last reuse-cell)) - (idle (setq timer-idle-list reuse-cell)) - (t (setq timer-list reuse-cell))) + (setf (cond (last (cdr last)) + (idle timer-idle-list) + (t timer-list)) + reuse-cell) (setf (timer--triggered timer) triggered-p) (setf (timer--idle-delay timer) idle) nil) @@ -223,8 +228,7 @@ timer will fire right away." (defun cancel-timer (timer) "Remove TIMER from the list of active timers." - (or (timerp timer) - (error "Invalid timer")) + (timer--check timer) (setq timer-list (delq timer timer-list)) (setq timer-idle-list (delq timer timer-idle-list)) nil) @@ -283,44 +287,47 @@ This function is called, by name, directly by the C code." (setq timer-event-last-1 timer-event-last) (setq timer-event-last timer) (let ((inhibit-quit t)) - (if (timerp timer) - (let (retrigger cell) - ;; Delete from queue. Record the cons cell that was used. - (setq cell (cancel-timer-internal timer)) - ;; Re-schedule if requested. - (if (timer--repeat-delay timer) - (if (timer--idle-delay timer) - (timer-activate-when-idle timer nil cell) - (timer-inc-time timer (timer--repeat-delay timer) 0) - ;; If real time has jumped forward, - ;; perhaps because Emacs was suspended for a long time, - ;; limit how many times things get repeated. - (if (and (numberp timer-max-repeats) - (< 0 (timer-until timer (current-time)))) - (let ((repeats (/ (timer-until timer (current-time)) - (timer--repeat-delay timer)))) - (if (> repeats timer-max-repeats) - (timer-inc-time timer (* (timer--repeat-delay timer) - repeats))))) - (timer-activate timer t cell) - (setq retrigger t))) - ;; Run handler. - ;; We do this after rescheduling so that the handler function - ;; can cancel its own timer successfully with cancel-timer. - (condition-case-unless-debug err - ;; Timer functions should not change the current buffer. - ;; If they do, all kinds of nasty surprises can happen, - ;; and it can be hellish to track down their source. - (save-current-buffer - (apply (timer--function timer) (timer--args timer))) - (error (message "Error in timer: %S" err))) - (when (and retrigger - ;; If the timer's been canceled, don't "retrigger" it - ;; since it might still be in the copy of timer-list kept - ;; by keyboard.c:timer_check (bug#14156). - (memq timer timer-list)) - (setf (timer--triggered timer) nil))) - (error "Bogus timer event")))) + (timer--check timer) + (let ((retrigger nil) + (cell + ;; Delete from queue. Record the cons cell that was used. + (cancel-timer-internal timer))) + ;; Re-schedule if requested. + (if (timer--repeat-delay timer) + (if (timer--idle-delay timer) + (timer-activate-when-idle timer nil cell) + (timer-inc-time timer (timer--repeat-delay timer) 0) + ;; If real time has jumped forward, + ;; perhaps because Emacs was suspended for a long time, + ;; limit how many times things get repeated. + (if (and (numberp timer-max-repeats) + (< 0 (timer-until timer (current-time)))) + (let ((repeats (/ (timer-until timer (current-time)) + (timer--repeat-delay timer)))) + (if (> repeats timer-max-repeats) + (timer-inc-time timer (* (timer--repeat-delay timer) + repeats))))) + ;; Place it back on the timer-list before running + ;; timer--function, so it can cancel-timer itself. + (timer-activate timer t cell) + (setq retrigger t))) + ;; Run handler. + (condition-case-unless-debug err + ;; Timer functions should not change the current buffer. + ;; If they do, all kinds of nasty surprises can happen, + ;; and it can be hellish to track down their source. + (save-current-buffer + (apply (timer--function timer) (timer--args timer))) + (error (message "Error running timer%s: %S" + (if (symbolp (timer--function timer)) + (format " `%s'" (timer--function timer)) "") + err))) + (when (and retrigger + ;; If the timer's been canceled, don't "retrigger" it + ;; since it might still be in the copy of timer-list kept + ;; by keyboard.c:timer_check (bug#14156). + (memq timer timer-list)) + (setf (timer--triggered timer) nil))))) ;; This function is incompatible with the one in levents.el. (defun timeout-event-p (event) @@ -531,6 +538,12 @@ If the user does not answer after SECONDS seconds, return DEFAULT-VALUE." secs (if (string-match-p "\\`[0-9.]+\\'" string) (string-to-number string))))) + +(defun internal-timer-start-idle () + "Mark all idle-time timers as once again candidates for running." + (dolist (timer timer-idle-list) + (if (timerp timer) ;; FIXME: Why test? + (setf (timer--triggered timer) nil)))) (provide 'timer) diff --git a/src/ChangeLog b/src/ChangeLog index 402792b5460..6fdf601fa95 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-10 Stefan Monnier + + * keyboard.c (timer_start_idle): Call internal-timer-start-idle instead + of marking the idle timers directly. + 2013-04-09 Stefan Monnier * minibuf.c (Ftest_completion): Ignore non-string/symbol keys in hash diff --git a/src/keyboard.c b/src/keyboard.c index b4fafa22e41..12407bd536c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4198,16 +4198,7 @@ timer_start_idle (void) timer_last_idleness_start_time = timer_idleness_start_time; /* Mark all idle-time timers as once again candidates for running. */ - for (timers = Vtimer_idle_list; CONSP (timers); timers = XCDR (timers)) - { - Lisp_Object timer; - - timer = XCAR (timers); - - if (!VECTORP (timer) || ASIZE (timer) != 9) - continue; - ASET (timer, 0, Qnil); - } + call0 (intern ("internal-timer-start-idle")); } /* Record that Emacs is no longer idle, so stop running idle-time timers. */ From da3cda2d10f5cbe398ea570e752a9921df7e18d8 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 10 Apr 2013 16:48:44 +0200 Subject: [PATCH 38/58] * textmodes/reftex-cite.el (reftex-parse-bibtex-entry): Don't cut off leading { and trailing } from field values. --- lisp/ChangeLog | 5 +++++ lisp/textmodes/reftex-cite.el | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a50f3bc8f15..c7ac52fac32 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-10 Tassilo Horn + + * textmodes/reftex-cite.el (reftex-parse-bibtex-entry): Don't cut + off leading { and trailing } from field values. + 2013-04-10 Stefan Monnier * emacs-lisp/timer.el (timer--check): New function. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 079101b56ee..ca29709de2e 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -514,12 +514,6 @@ ;; remove extra whitespace (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field) (setq field (replace-match " " nil t field))) - ;; remove leading garbage - (if (string-match (if raw "^[ \t]+" "^[ \t{]+") field) - (setq field (replace-match "" nil t field))) - ;; remove trailing garbage - (if (string-match (if raw "[ \t]+$" "[ \t}]+$") field) - (setq field (replace-match "" nil t field))) (push (cons key field) alist)))) alist)) From f009190abc3a010cc0ad01df81d02585d436ea3d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 10 Apr 2013 18:38:20 +0300 Subject: [PATCH 39/58] Fix bug #13864 with flickering of TTY frames in an emacslient session. src/frame.c (do_switch_frame): Mark the TTY frame we switch to as garbaged only if it is not already the top frame on its TTY. This prevents flickering due to constant redrawing of TTY frames when there are GUI frames open in the same session. --- src/ChangeLog | 7 +++++++ src/frame.c | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6fdf601fa95..ff6b9508d62 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-04-10 Eli Zaretskii + + * frame.c (do_switch_frame): Mark the TTY frame we switch to as + garbaged only if it is not already the top frame on its TTY. This + prevents flickering due to constant redrawing of TTY frames when + there are GUI frames open in the same session. (Bug#13864) + 2013-04-10 Stefan Monnier * keyboard.c (timer_start_idle): Call internal-timer-start-idle instead diff --git a/src/frame.c b/src/frame.c index 2fe398296ed..ccd50122f50 100644 --- a/src/frame.c +++ b/src/frame.c @@ -834,10 +834,18 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor if (FRAME_TERMCAP_P (XFRAME (frame)) || FRAME_MSDOS_P (XFRAME (frame))) { - if (FRAMEP (FRAME_TTY (XFRAME (frame))->top_frame)) - /* Mark previously displayed frame as now obscured. */ - SET_FRAME_VISIBLE (XFRAME (FRAME_TTY (XFRAME (frame))->top_frame), 2); - SET_FRAME_VISIBLE (XFRAME (frame), 1); + Lisp_Object top_frame = FRAME_TTY (XFRAME (frame))->top_frame; + + /* Don't mark the frame garbaged and/or obscured if we are + switching to the frame that is already the top frame of that + TTY. */ + if (!EQ (frame, top_frame)) + { + if (FRAMEP (top_frame)) + /* Mark previously displayed frame as now obscured. */ + SET_FRAME_VISIBLE (XFRAME (top_frame), 2); + SET_FRAME_VISIBLE (XFRAME (frame), 1); + } FRAME_TTY (XFRAME (frame))->top_frame = frame; } From 7d9644924ee1db68bea74ec1fbb1e89af4612076 Mon Sep 17 00:00:00 2001 From: Andrew Cohen Date: Wed, 10 Apr 2013 22:13:37 +0000 Subject: [PATCH 40/58] lisp/gnus/nnir.el: Improve marks handling --- lisp/gnus/ChangeLog | 7 +++++ lisp/gnus/nnir.el | 74 ++++++++++++++++++++++----------------------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index ca78e7c99b4..b5390fe938f 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,10 @@ +2013-04-10 Andrew Cohen + + * nnir.el (number-sequence): No longer used. + (nnir-request-set-mark): New function. + (nnir-request-update-info): Improve marks updating. + (nnir-request-scan): Don't duplicate marks updating. + 2013-04-04 Andrew Cohen * nnir.el (gnus-nnir-group-p): New function. diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index b96f0c1cb78..c6baa301c06 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -173,15 +173,7 @@ ;; For Emacs <22.2 and XEmacs. (eval-and-compile - (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))) - (unless (fboundp 'number-sequence) - (defun number-sequence (from to) - (let (seq (n 0) (next from)) - (while (<= next to) - (setq seq (cons next seq) - n (1+ n) - next (+ from n ))) - (nreverse seq))))) + (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) (require 'nnoo) (require 'gnus-group) @@ -846,11 +838,31 @@ skips all prompting." (artnumber (nnir-article-number article))) (gnus-request-update-mark artgroup artnumber mark))) +(deffoo nnir-request-set-mark (group actions &optional server) + (let (mlist) + (dolist (action actions) + (destructuring-bind (range action marks) action + (let ((articles-by-group (nnir-categorize + (gnus-uncompress-range range) + nnir-article-group nnir-article-number))) + (dolist (artgroup articles-by-group) + (push (list + (car artgroup) + (list (gnus-compress-sequence + (sort (cadr artgroup) '<)) action marks)) mlist))))) + (dolist (request (nnir-categorize mlist car cadr)) + (gnus-request-set-mark (car request) (cadr request))))) + (deffoo nnir-request-update-info (group info &optional server) - (let ((articles-by-group + (nnir-possibly-change-group group) + ;; clear out all existing marks. + (gnus-info-set-marks info nil) + (gnus-info-set-read info nil) + (let ((group (gnus-group-guess-full-name-from-command-method group)) + (articles-by-group (nnir-categorize - (number-sequence 1 (nnir-artlist-length nnir-artlist)) + (gnus-uncompress-range (cons 1 (nnir-artlist-length nnir-artlist))) nnir-article-group nnir-article-ids))) (gnus-set-active group (cons 1 (nnir-artlist-length nnir-artlist))) @@ -864,23 +876,20 @@ skips all prompting." info (gnus-add-to-range (gnus-info-read info) - (remove nil (mapcar (lambda (art) - (let ((num (cdr art))) - (when (gnus-member-of-range num read) - (car art)))) articleids)))) - (mapc (lambda (mark) - (let ((type (car mark)) - (range (cdr mark))) + (delq nil + (mapcar + #'(lambda (art) + (when (gnus-member-of-range (cdr art) read) (car art))) + articleids)))) + (dolist (mark marks) + (destructuring-bind (type . range) mark (gnus-add-marked-articles - group - type - (remove nil + group type + (delq nil (mapcar - (lambda (art) - (let ((num (cdr art))) - (when (gnus-member-of-range num range) - (car art)))) - articleids))))) marks))))) + #'(lambda (art) + (when (gnus-member-of-range (cdr art) range) (car art))) + articleids))))))))) (deffoo nnir-close-group (group &optional server) @@ -1901,22 +1910,11 @@ article came from is also searched." t) (deffoo nnir-request-scan (group method) - (if group - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir"))))) - (gnus-group-set-parameter - pgroup 'nnir-artlist - (setq nnir-artlist - (nnir-run-query - (gnus-group-get-parameter pgroup 'nnir-specs t)))) - (nnir-request-update-info pgroup (gnus-get-info pgroup))) - t)) + t) (deffoo nnir-request-close () t) - (nnoo-define-skeleton nnir) ;; The end. From 1ec75f95d7d05d529fb1f75abe741ff77de6f16b Mon Sep 17 00:00:00 2001 From: Andrew Cohen Date: Wed, 10 Apr 2013 22:14:14 +0000 Subject: [PATCH 41/58] lisp/gnus/nnir.el: Small optimizations. Use 'gnus-group-guess-full-name-from-command-method --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/nnir.el | 31 +++++++++++++------------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index b5390fe938f..58de51672e6 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -4,6 +4,11 @@ (nnir-request-set-mark): New function. (nnir-request-update-info): Improve marks updating. (nnir-request-scan): Don't duplicate marks updating. + (gnus-group-make-nnir-group, nnir-run-imap, nnir-request-create-group): + Use 'assq rather than 'assoc. Quote anonymous function. + (nnir-request-group, nnir-close-group, gnus-summary-create-nnir-group): + Use 'gnus-group-prefixed-p. + (gnus-summary-create-nnir-group): Make sure server for method is open. 2013-04-04 Andrew Cohen diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index c6baa301c06..5744b1cd4b0 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -602,7 +602,7 @@ an alist with `nnir-query-spec' and `nnir-group-spec' keys, and skips all prompting." (interactive "P") (let* ((group-spec - (or (cdr (assoc 'nnir-group-spec specs)) + (or (cdr (assq 'nnir-group-spec specs)) (if (gnus-server-server-name) (list (list (gnus-server-server-name))) (nnir-categorize @@ -612,7 +612,7 @@ skips all prompting." (cdr (assoc (gnus-group-topic-name) gnus-topic-alist)))) gnus-group-server)))) (query-spec - (or (cdr (assoc 'nnir-query-spec specs)) + (or (cdr (assq 'nnir-query-spec specs)) (apply 'append (list (cons 'query @@ -659,9 +659,7 @@ skips all prompting." (deffoo nnir-request-group (group &optional server dont-check info) (nnir-possibly-change-group group server) - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir")))) + (let ((pgroup (gnus-group-guess-full-name-from-command-method group)) length) ;; Check for cached search result or run the query and cache the ;; result. @@ -893,9 +891,7 @@ skips all prompting." (deffoo nnir-close-group (group &optional server) - (let ((pgroup (if (gnus-group-prefixed-p group) - group - (gnus-group-prefixed-name group '(nnir "nnir"))))) + (let ((pgroup (gnus-group-guess-full-name-from-command-method group))) (when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup))) (gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist)) (setq nnir-artlist nil) @@ -972,7 +968,7 @@ details on the language and supported extensions." 'vconcat (catch 'found (mapcar - (lambda (group) + #'(lambda (group) (let (artlist) (condition-case () (when (nnimap-possibly-change-group @@ -1870,12 +1866,11 @@ article came from is also searched." (defun gnus-summary-create-nnir-group () (interactive) + (or (nnir-server-opened "") (nnir-open-server "nnir")) (let ((name (gnus-read-group "Group name: ")) - (method "nnir") - (pgroup (if (gnus-group-prefixed-p gnus-newsgroup-name) - gnus-newsgroup-name - (gnus-group-prefixed-name - gnus-newsgroup-name '(nnir "nnir"))))) + (method '(nnir "")) + (pgroup + (gnus-group-guess-full-name-from-command-method gnus-newsgroup-name))) (with-current-buffer gnus-group-buffer (gnus-group-make-group name method nil @@ -1885,20 +1880,20 @@ article came from is also searched." (deffoo nnir-request-create-group (group &optional server args) (message "Creating nnir group %s" group) (let* ((group (gnus-group-prefixed-name group '(nnir "nnir"))) - (specs (assoc 'nnir-specs args)) + (specs (assq 'nnir-specs args)) (query-spec - (or (cdr (assoc 'nnir-query-spec specs)) + (or (cdr (assq 'nnir-query-spec specs)) (list (cons 'query (read-string "Query: " nil 'nnir-search-history))))) (group-spec - (or (cdr (assoc 'nnir-group-spec specs)) + (or (cdr (assq 'nnir-group-spec specs)) (list (list (read-string "Server: " nil nil))))) (nnir-specs (list (cons 'nnir-query-spec query-spec) (cons 'nnir-group-spec group-spec)))) (gnus-group-set-parameter group 'nnir-specs nnir-specs) (gnus-group-set-parameter group 'nnir-artlist - (or (cdr (assoc 'nnir-artlist args)) + (or (cdr (assq 'nnir-artlist args)) (nnir-run-query nnir-specs))) (nnir-request-update-info group (gnus-get-info group))) t) From f07accae655f61468f3441dc48b61b5f125b601f Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Wed, 10 Apr 2013 22:17:51 +0000 Subject: [PATCH 42/58] lisp/gnus/nnir.el: Fix last change --- lisp/gnus/nnir.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 5744b1cd4b0..5d244a019cb 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el @@ -881,10 +881,10 @@ skips all prompting." articleids)))) (dolist (mark marks) (destructuring-bind (type . range) mark - (gnus-add-marked-articles + (gnus-add-marked-articles group type (delq nil - (mapcar + (mapcar #'(lambda (art) (when (gnus-member-of-range (cdr art) range) (car art))) articleids))))))))) From fcc1fe85416f7dda9a1b83faf88a55c170a41ac9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 11 Apr 2013 19:06:47 +0300 Subject: [PATCH 43/58] Fix bug #14170 with window-end returning a stale value. This bug was introduced in 2012-10-15T09:03:56Z!rudalics@gmx.at while solving bug #12600. src/window.c (Fwindow_end): Test more flags, including the buffer's last_overlay_modified flag, to determine whether the window's display is really up-to-date. Prevents the function from returning a stale value. (Fwindow_line_height): Fix the test for up-to-date-ness of the current matrix. --- src/ChangeLog | 9 +++++++++ src/window.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ff6b9508d62..7f4c59b8eb4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2013-04-11 Eli Zaretskii + + * window.c (Fwindow_end): Test more flags, including the buffer's + last_overlay_modified flag, to determine whether the window's + display is really up-to-date. Prevents the function from + returning a stale value. (Bug#14170) + (Fwindow_line_height): Fix the test for up-to-date-ness of the + current matrix. + 2013-04-10 Eli Zaretskii * frame.c (do_switch_frame): Mark the TTY frame we switch to as diff --git a/src/window.c b/src/window.c index 2ddf742be99..fe5b5ec1e6e 100644 --- a/src/window.c +++ b/src/window.c @@ -1493,7 +1493,12 @@ if it isn't already recorded. */) b = XBUFFER (buf); if (! NILP (update) - && (windows_or_buffers_changed || !w->window_end_valid) + && (windows_or_buffers_changed + || !w->window_end_valid + || b->clip_changed + || b->prevent_redisplay_optimizations_p + || w->last_modified < BUF_MODIFF (b) + || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) && !noninteractive) { struct text_pos startp; @@ -1702,8 +1707,9 @@ Return nil if window display is not up-to-date. In that case, use /* Fail if current matrix is not up-to-date. */ if (!w->window_end_valid - || current_buffer->clip_changed - || current_buffer->prevent_redisplay_optimizations_p + || windows_or_buffers_changed + || b->clip_changed + || b->prevent_redisplay_optimizations_p || w->last_modified < BUF_MODIFF (b) || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b)) return Qnil; From e8bdb06e29f0bec8747e504891a8567358dd4c4b Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Fri, 12 Apr 2013 09:00:57 -0400 Subject: [PATCH 44/58] * configure.ac (canonical): Adapt to 64-bit Cygwin. --- ChangeLog | 5 +++++ configure.ac | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a2ebd3e912b..f8a3a5e0cca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Ken Brown + + * configure.ac (canonical): Adapt to 64-bit Cygwin, for which + `canonical' is `x86_64-unknown-cygwin'. + 2013-04-09 Ken Brown * configure.ac (W32_RES_LINK): Remove unneeded linker directive diff --git a/configure.ac b/configure.ac index 71e35ec8ff7..c95072423b5 100644 --- a/configure.ac +++ b/configure.ac @@ -471,6 +471,11 @@ case "${canonical}" in ## fi ;; + ## Cygwin ports + *-*-cygwin ) + opsys=cygwin + ;; + ## HP 9000 series 700 and 800, running HP/UX hppa*-hp-hpux10.2* ) opsys=hpux10-20 @@ -544,7 +549,6 @@ case "${canonical}" in ## Intel 386 machines where we don't care about the manufacturer. i[3456]86-*-* ) case "${canonical}" in - *-cygwin ) opsys=cygwin ;; *-darwin* ) opsys=darwin ;; *-sysv4.2uw* ) opsys=unixware ;; *-sysv5uw* ) opsys=unixware ;; From f24e0036b1beb5e610e8691ec511f7d87b5aa993 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 12 Apr 2013 15:56:03 +0200 Subject: [PATCH 45/58] * info.el (Info-file-list-for-emacs): Add "tramp" and "dbus". --- lisp/ChangeLog | 4 ++++ lisp/info.el | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c7ac52fac32..6054ed3c213 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-04-12 Michael Albinus + + * info.el (Info-file-list-for-emacs): Add "tramp" and "dbus". + 2013-04-10 Tassilo Horn * textmodes/reftex-cite.el (reftex-parse-bibtex-entry): Don't cut diff --git a/lisp/info.el b/lisp/info.el index 4679b51b999..58ebf0b17da 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -4383,7 +4383,8 @@ This feature will be removed in future.") ("ietf-drums" . "emacs-mime") ("quoted-printable" . "emacs-mime") ("binhex" . "emacs-mime") ("uudecode" . "emacs-mime") ("mailcap" . "emacs-mime") ("mm" . "emacs-mime") - ("mml" . "emacs-mime")) + ("mml" . "emacs-mime") + "tramp" "dbus") "List of Info files that describe Emacs commands. An element can be a file name, or a list of the form (PREFIX . FILE) where PREFIX is a name prefix and FILE is the file to look in. From 320742098b941833731b20d4bd2de7cc4c93ec76 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 12 Apr 2013 15:17:47 +0000 Subject: [PATCH 46/58] gnus-msg.el (gnus-msg-mail): Make it avoid using posting styles corresponding to any existing group (Bug#14166) --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/gnus-msg.el | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 58de51672e6..f15ed7e707c 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Katsumi Yamaoka + + * gnus-msg.el (gnus-msg-mail): Make it avoid using posting styles + corresponding to any existing group (Bug#14166). + 2013-04-10 Andrew Cohen * nnir.el (number-sequence): No longer used. diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 36135556c73..362dd3ea7f0 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -538,7 +538,8 @@ instead." (message-mail to subject other-headers continue nil yank-action send-actions return-action)) (let ((buf (current-buffer)) - (gnus-newsgroup-name (or gnus-newsgroup-name "")) + ;; Don't use posting styles corresponding to any existing group. + (gnus-newsgroup-name "") mail-buf) (gnus-setup-message 'message (message-mail to subject other-headers continue From 562c6ee9450073547ae45e88116cfc213c2254e0 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 12 Apr 2013 13:32:52 -0400 Subject: [PATCH 47/58] * src/window.c (select_window): `record_buffer' even if window is already selected. Fixes: debbugs:14191 --- src/ChangeLog | 29 +++++++++++++++++------------ src/window.c | 10 +++++++--- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 7f4c59b8eb4..08f33eb7d02 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-04-12 Stefan Monnier + + * window.c (select_window): `record_buffer' even if window is + already selected (bug#14191). + 2013-04-11 Eli Zaretskii * window.c (Fwindow_end): Test more flags, including the buffer's @@ -10,8 +15,8 @@ 2013-04-10 Eli Zaretskii * frame.c (do_switch_frame): Mark the TTY frame we switch to as - garbaged only if it is not already the top frame on its TTY. This - prevents flickering due to constant redrawing of TTY frames when + garbaged only if it is not already the top frame on its TTY. + This prevents flickering due to constant redrawing of TTY frames when there are GUI frames open in the same session. (Bug#13864) 2013-04-10 Stefan Monnier @@ -95,7 +100,7 @@ The following changes is to optimize the code for reading UTF-8 files. - * coding.c (check_ascii): Renamed from detect_ascii. Return value + * coding.c (check_ascii): Rename from detect_ascii. Return value changed. Check EOL format. Do not call adjust_coding_eol_type here. (check_utf_8): New function. @@ -287,8 +292,8 @@ * xdisp.c (with_echo_area_buffer_unwind_data): Save window start marker... - (unwind_with_echo_area_buffer): ...to restore it here. This - is needed to ensure that... + (unwind_with_echo_area_buffer): ...to restore it here. + This is needed to ensure that... (redisplay_window): ...both window markers are valid here, which is verified by eassert. * editfns.c (save_excursion_save): Do not assume that @@ -438,10 +443,10 @@ * w32term.c (w32fullscreen_hook): Use FRAME_NORMAL_WIDTH, FRAME_NORMAL_HEIGHT, and FRAME_PREV_FSMODE, instead of static - variables, to save and restore frame dimensions. Use - FRAME_NORMAL_LEFT and FRAME_NORMAL_TOP to restore frame position - after returning from a 'fullscreen' configuration. use - SendMessage instead of PostMessage to send the SC_RESTORE message, + variables, to save and restore frame dimensions. + Use FRAME_NORMAL_LEFT and FRAME_NORMAL_TOP to restore frame position + after returning from a 'fullscreen' configuration. + use SendMessage instead of PostMessage to send the SC_RESTORE message, to avoid races between the main thread and the input thread. * w32term.h (struct w32_output): New members normal_width, @@ -526,10 +531,10 @@ * frame.h (struct frame): Drop resx and resy because the same data is available from window system-specific output context. Adjust users. - (default_pixels_per_inch_x, default_pixels_per_inch_y): New - functions to provide defaults when no window system available. + (default_pixels_per_inch_x, default_pixels_per_inch_y): + New functions to provide defaults when no window system available. (FRAME_RES_X, FRAME_RES_Y): New macros. - (NUMVAL): Moved from xdisp.c. + (NUMVAL): Move from xdisp.c. * font.c (font_pixel_size, font_find_for_lface, font_open_for_lface) (Ffont_face_attributes, Fopen_font): * image.c (gs_load): diff --git a/src/window.c b/src/window.c index fe5b5ec1e6e..7cf35a480f7 100644 --- a/src/window.c +++ b/src/window.c @@ -489,7 +489,10 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) Fset_buffer (w->contents); if (EQ (window, selected_window) && !inhibit_point_swap) - return window; + /* `switch-to-buffer' uses (select-window (selected-window)) as a "clever" + way to call record_buffer from Elisp, so it's important that we call + record_buffer before returning here. */ + goto record_and_return; sf = SELECTED_FRAME (); if (XFRAME (WINDOW_FRAME (w)) != sf) @@ -508,7 +511,10 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) fset_selected_window (sf, window); select_window_1 (window, inhibit_point_swap); + bset_last_selected_window (XBUFFER (w->contents), window); + windows_or_buffers_changed++; + record_and_return: /* record_buffer can run QUIT, so make sure it is run only after we have re-established the invariant between selected_window and selected_frame, otherwise the temporary broken invariant might "escape" (bug#14161). */ @@ -518,8 +524,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) record_buffer (w->contents); } - bset_last_selected_window (XBUFFER (w->contents), window); - windows_or_buffers_changed++; return window; } From 011cddd649d81956ce13b9325b059dac78e61c4d Mon Sep 17 00:00:00 2001 From: Roland Winkler Date: Fri, 12 Apr 2013 20:10:09 -0500 Subject: [PATCH 48/58] faces.el (read-face-name): Do not override value of arg default, call instead face-at-point --- lisp/ChangeLog | 18 +++++ lisp/cus-edit.el | 6 +- lisp/cus-theme.el | 2 +- lisp/face-remap.el | 2 +- lisp/facemenu.el | 2 +- lisp/faces.el | 175 ++++++++++++++++++++------------------------- 6 files changed, 104 insertions(+), 101 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6054ed3c213..37e8028c941 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,21 @@ +2013-04-12 Roland Winkler + + * faces.el (read-face-name): Do not override value of arg default. + Allow single faces and strings as default values. Remove those + elements from return value that are not faces. + (describe-face): Simplify. + (face-at-point): New optional args thing and multiple so that this + function can provide the same functionality previously provided by + read-face-name. + (make-face-bold, make-face-unbold, make-face-italic) + (make-face-unitalic, make-face-bold-italic, invert-face) + (modify-face, read-face-and-attribute): Use face-at-point. + + * cus-edit.el (customize-face, customize-face-other-window) + * cus-theme.el (custom-theme-add-face) + * face-remap.el (buffer-face-set) + * facemenu.el (facemenu-set-face): Use face-at-point. + 2013-04-12 Michael Albinus * info.el (Info-file-list-for-emacs): Add "tramp" and "dbus". diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index d19e2ded00c..ac9408b1081 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -1319,7 +1319,8 @@ If OTHER-WINDOW is non-nil, display in another window. Interactively, when point is on text which has a face specified, suggest to customize that face, if it's customizable." - (interactive (list (read-face-name "Customize face" "all faces" t))) + (interactive (list (read-face-name "Customize face" + (or (face-at-point t t) "all faces") t))) (if (member face '(nil "")) (setq face (face-list))) (if (and (listp face) (null (cdr face))) @@ -1350,7 +1351,8 @@ If FACE is actually a face-alias, customize the face it is aliased to. Interactively, when point is on text which has a face specified, suggest to customize that face, if it's customizable." - (interactive (list (read-face-name "Customize face" "all faces" t))) + (interactive (list (read-face-name "Customize face" + (or (face-at-point t t) "all faces") t))) (customize-face face t)) (defalias 'customize-customized 'customize-unsaved) diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index cc1046eddc5..dbe4fa42d8e 100644 --- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -263,7 +263,7 @@ interactively, this defaults to the current value of VAR." (defun custom-theme-add-face (face &optional spec) "Add a widget for FACE (a symbol) to the *New Custom Theme* buffer. SPEC, if non-nil, should be a face spec to which to set the widget." - (interactive (list (read-face-name "Face name" nil nil) nil)) + (interactive (list (read-face-name "Face name" (face-at-point t)))) (unless (or (facep face) spec) (error "`%s' has no face definition" face)) (let ((entry (assq face custom-theme-faces))) diff --git a/lisp/face-remap.el b/lisp/face-remap.el index f1efc3727f5..b620d01d83e 100644 --- a/lisp/face-remap.el +++ b/lisp/face-remap.el @@ -378,7 +378,7 @@ one face is listed, that specifies an aggregate face, like in a This function makes the variable `buffer-face-mode-face' buffer local, and sets it to FACE." - (interactive (list (read-face-name "Set buffer face"))) + (interactive (list (read-face-name "Set buffer face" (face-at-point t)))) (while (and (consp specs) (null (cdr specs))) (setq specs (car specs))) (if (null specs) diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 9a66edd28fc..eb4554585a8 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -329,7 +329,7 @@ This command can also add FACE to the menu of faces, if `facemenu-listed-faces' says to do that." (interactive (list (progn (barf-if-buffer-read-only) - (read-face-name "Use face")) + (read-face-name "Use face" (face-at-point t))) (if (and mark-active (not current-prefix-arg)) (region-beginning)) (if (and mark-active (not current-prefix-arg)) diff --git a/lisp/faces.el b/lisp/faces.el index 400b475429f..de6d36c7ae8 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -757,7 +757,8 @@ is specified, `:italic' is ignored." FRAME nil or not specified means change face on all frames. Argument NOERROR is ignored and retained for compatibility. Use `set-face-attribute' for finer control of the font weight." - (interactive (list (read-face-name "Make which face bold"))) + (interactive (list (read-face-name "Make which face bold" + (face-at-point t)))) (set-face-attribute face frame :weight 'bold)) @@ -765,7 +766,8 @@ Use `set-face-attribute' for finer control of the font weight." "Make the font of FACE be non-bold, if possible. FRAME nil or not specified means change face on all frames. Argument NOERROR is ignored and retained for compatibility." - (interactive (list (read-face-name "Make which face non-bold"))) + (interactive (list (read-face-name "Make which face non-bold" + (face-at-point t)))) (set-face-attribute face frame :weight 'normal)) @@ -774,7 +776,8 @@ Argument NOERROR is ignored and retained for compatibility." FRAME nil or not specified means change face on all frames. Argument NOERROR is ignored and retained for compatibility. Use `set-face-attribute' for finer control of the font slant." - (interactive (list (read-face-name "Make which face italic"))) + (interactive (list (read-face-name "Make which face italic" + (face-at-point t)))) (set-face-attribute face frame :slant 'italic)) @@ -782,7 +785,8 @@ Use `set-face-attribute' for finer control of the font slant." "Make the font of FACE be non-italic, if possible. FRAME nil or not specified means change face on all frames. Argument NOERROR is ignored and retained for compatibility." - (interactive (list (read-face-name "Make which face non-italic"))) + (interactive (list (read-face-name "Make which face non-italic" + (face-at-point t)))) (set-face-attribute face frame :slant 'normal)) @@ -791,7 +795,8 @@ Argument NOERROR is ignored and retained for compatibility." FRAME nil or not specified means change face on all frames. Argument NOERROR is ignored and retained for compatibility. Use `set-face-attribute' for finer control of font weight and slant." - (interactive (list (read-face-name "Make which face bold-italic"))) + (interactive (list (read-face-name "Make which face bold-italic" + (face-at-point t)))) (set-face-attribute face frame :weight 'bold :slant 'italic)) @@ -911,7 +916,7 @@ If FRAME is omitted or nil, it means change face on all frames. If FACE specifies neither foreground nor background color, set its foreground and background to the background and foreground of the default face. Value is FACE." - (interactive (list (read-face-name "Invert face"))) + (interactive (list (read-face-name "Invert face" (face-at-point t)))) (let ((fg (face-attribute face :foreground frame)) (bg (face-attribute face :background frame))) (if (not (and (eq fg 'unspecified) (eq bg 'unspecified))) @@ -929,85 +934,54 @@ of the default face. Value is FACE." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun read-face-name (prompt &optional default multiple) - "Read one or more face names, defaulting to the face(s) at point. -PROMPT should be a prompt string; it should not end in a space or -a colon. + "Read one or more face names, prompting with PROMPT. +PROMPT should not end in a space or a colon. -The optional argument DEFAULT specifies the default face name(s) -to return if the user just types RET. If its value is non-nil, -it should be a list of face names (symbols or strings); in that case, -the default return value is the `car' of DEFAULT (if the argument -MULTIPLE is non-nil), or DEFAULT (if MULTIPLE is nil). See below -for the meaning of MULTIPLE. - -If DEFAULT is nil, the list of default face names is taken from -the symbol at point and the `read-face-name' property of the text at point, -or, if that is nil, from the `face' property of the text at point. +Return DEFAULT if the user enters the empty string. +If DEFAULT is non-nil, it should be a list of face names (symbols or strings). +In that case, return the `car' of DEFAULT (if MULTIPLE is non-nil), +or DEFAULT (if MULTIPLE is nil). See below for the meaning of MULTIPLE. +DEFAULT can also be a single face. This function uses `completing-read-multiple' with \"[ \\t]*,[ \\t]*\" -as the separator regexp. Thus, the user may enter multiple face -names, separated by commas. The optional argument MULTIPLE -specifies the form of the return value. If MULTIPLE is non-nil, -return a list of face names; if the user entered just one face -name, the return value would be a list of one face name. -Otherwise, return a single face name; if the user entered more -than one face name, return only the first one." - ;; Should we better not generate automagically a value for DEFAULT - ;; when `read-face-name' was called with DEFAULT being nil? - ;; Such magic is somewhat unusual for a function `read-...'. - ;; Also, one cannot skip this magic by means of a suitable - ;; value of DEFAULT. It would be cleaner to use - ;; (read-face-name prompt (face-at-point)). - (unless default - ;; Try to get a default face name from the buffer. - (let ((thing (intern-soft (thing-at-point 'symbol)))) - (if (memq thing (face-list)) - (setq default (list thing)))) - ;; Add the named faces that the `read-face-name' or `face' property uses. - (let ((faceprop (or (get-char-property (point) 'read-face-name) - (get-char-property (point) 'face)))) - (if (and (listp faceprop) - ;; Don't treat an attribute spec as a list of faces. - (not (keywordp (car faceprop))) - (not (memq (car faceprop) '(foreground-color background-color)))) - (dolist (face faceprop) - (if (symbolp face) - (push face default))) - (if (symbolp faceprop) - (push faceprop default))) - (delete-dups default))) +as the separator regexp. Thus, the user may enter multiple face names, +separated by commas. - ;; If we only want one, and the default is more than one, - ;; discard the unwanted ones now. - (if (and default (not multiple)) - (setq default (list (car default)))) +MULTIPLE specifies the form of the return value. If MULTIPLE is non-nil, +return a list of face names; if the user entered just one face name, +return a list of one face name. Otherwise, return a single face name; +if the user entered more than one face name, return only the first one." + (if (and default (not (stringp default))) + (setq default + (cond ((symbolp default) + (symbol-name default)) + (multiple + (mapconcat (lambda (f) (if (symbolp f) (symbol-name f) f)) + default ", ")) + ;; If we only want one, and the default is more than one, + ;; discard the unwanted ones. + (t (symbol-name (car default)))))) - (if default - (setq default (mapconcat (lambda (f) - (if (symbolp f) (symbol-name f) f)) - default ", "))) - - ;; Build up the completion tables. - (let (aliasfaces nonaliasfaces) + (let (aliasfaces nonaliasfaces faces) + ;; Build up the completion tables. (mapatoms (lambda (s) - (if (custom-facep s) + (if (facep s) (if (get s 'face-alias) (push (symbol-name s) aliasfaces) (push (symbol-name s) nonaliasfaces))))) - - (let ((faces - ;; Read the faces. - (mapcar 'intern - (completing-read-multiple - (if default - (format "%s (default `%s'): " prompt default) - (format "%s: " prompt)) - (completion-table-in-turn nonaliasfaces aliasfaces) - nil t nil 'face-name-history default)))) - ;; Return either a list of faces or just one face. - (if multiple - faces - (car faces))))) + (dolist (face (completing-read-multiple + (if default + (format "%s (default `%s'): " prompt default) + (format "%s: " prompt)) + (completion-table-in-turn nonaliasfaces aliasfaces) + nil t nil 'face-name-history default)) + ;; Ignore elements that are not faces + ;; (for example, because DEFAULT was "all faces") + (if (facep face) (push (intern face) faces))) + ;; Return either a list of faces or just one face. + (if multiple + (nreverse faces) + (last faces)))) ;; Not defined without X, but behind window-system test. (defvar x-bitmap-file-path) @@ -1235,7 +1209,7 @@ and the face and its settings are obtained by querying the user." :slant (if italic-p 'italic 'normal) :underline underline :inverse-video inverse-p) - (setq face (read-face-name "Modify face")) + (setq face (read-face-name "Modify face" (face-at-point t))) (apply #'set-face-attribute face frame (read-all-face-attributes face frame)))) @@ -1247,13 +1221,13 @@ Value is a list (FACE NEW-VALUE) where FACE is the face read \(a symbol), and NEW-VALUE is value read." (cond ((eq attribute :font) (let* ((prompt "Set font-related attributes of face") - (face (read-face-name prompt)) + (face (read-face-name prompt (face-at-point t))) (font (read-face-font face frame))) (list face font))) (t (let* ((attribute-name (face-descriptive-attribute-name attribute)) (prompt (format "Set %s of face" attribute-name)) - (face (read-face-name prompt)) + (face (read-face-name prompt (face-at-point t))) (new-value (read-face-attribute face attribute frame))) (list face new-value))))) @@ -1363,8 +1337,7 @@ If the optional argument FRAME is given, report on face FACE in that frame. If FRAME is t, report on the defaults for face FACE (for new frames). If FRAME is omitted or nil, use the selected frame." (interactive (list (read-face-name "Describe face" - (if (eq 'default (face-at-point)) - '(default)) + (or (face-at-point t) 'default) t))) (let* ((attrs '((:family . "Family") (:foundry . "Foundry") @@ -1879,23 +1852,33 @@ resulting color name in the echo area." (when msg (message "Color: `%s'" color)) color)) - -(defun face-at-point () +(defun face-at-point (&optional thing multiple) "Return the face of the character after point. If it has more than one face, return the first one. -Return nil if it has no specified face." - (let* ((faceprop (or (get-char-property (point) 'read-face-name) - (get-char-property (point) 'face) - 'default)) - (face (cond ((symbolp faceprop) faceprop) - ;; List of faces (don't treat an attribute spec). - ;; Just use the first face. - ((and (consp faceprop) (not (keywordp (car faceprop))) - (not (memq (car faceprop) - '(foreground-color background-color)))) - (car faceprop)) - (t nil)))) ; Invalid face value. - (if (facep face) face nil))) +If THING is non-nil try first to get a face name from the buffer. +IF MULTIPLE is non-nil, return a list of all faces. +Return nil if there is no face." + (let (faces) + (if thing + ;; Try to get a face name from the buffer. + (let ((face (intern-soft (thing-at-point 'symbol)))) + (if (facep face) + (push face faces)))) + ;; Add the named faces that the `read-face-name' or `face' property uses. + (let ((faceprop (or (get-char-property (point) 'read-face-name) + (get-char-property (point) 'face)))) + (cond ((facep faceprop) + (push faceprop faces)) + ((and (listp faceprop) + ;; Don't treat an attribute spec as a list of faces. + (not (keywordp (car faceprop))) + (not (memq (car faceprop) + '(foreground-color background-color)))) + (dolist (face faceprop) + (if (facep face) + (push face faces)))))) + (setq faces (delete-dups (nreverse faces))) + (if multiple faces (car faces)))) (defun foreground-color-at-point () "Return the foreground color of the character after point." From 29b79ba19785cf3d5bbb3779779ca3a7714ee2e1 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 13 Apr 2013 11:54:02 +0300 Subject: [PATCH 49/58] Fix vertical cursor motion when there are overlay strings at EOL. src/indent.c (Fvertical_motion): Don't consider display strings on overlay strings as display strings on the buffer position we started from. This prevents vertical cursor motion from jumping more than one line when there's an overlay string with a display property at end of line. Reported by Karl Chen in http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00362.html. --- src/ChangeLog | 10 ++++++++++ src/indent.c | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 08f33eb7d02..af2d38d2e87 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-04-13 Eli Zaretskii + + * indent.c (Fvertical_motion): Don't consider display strings on + overlay strings as display strings on the buffer position we + started from. This prevents vertical cursor motion from jumping + more than one line when there's an overlay string with a display + property at end of line. + Reported by Karl Chen in + http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00362.html. + 2013-04-12 Stefan Monnier * window.c (select_window): `record_buffer' even if window is diff --git a/src/indent.c b/src/indent.c index 67796ab8a8f..47358e17db8 100644 --- a/src/indent.c +++ b/src/indent.c @@ -2006,11 +2006,15 @@ whether or not it is currently displayed in some window. */) const char *s = SSDATA (it.string); const char *e = s + SBYTES (it.string); + disp_string_at_start_p = /* If it.area is anything but TEXT_AREA, we need not bother about the display string, as it doesn't affect cursor positioning. */ - disp_string_at_start_p = - it.string_from_display_prop_p && it.area == TEXT_AREA; + it.area == TEXT_AREA + && it.string_from_display_prop_p + /* A display string on anything but buffer text (e.g., on + an overlay string) doesn't affect cursor positioning. */ + && (it.sp > 0 && it.stack[it.sp - 1].method == GET_FROM_BUFFER); while (s < e) { if (*s++ == '\n') From 8c35e3c3b48cadea093d1a05a4839b9962bcce93 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 13 Apr 2013 06:17:45 -0400 Subject: [PATCH 50/58] Auto-commit of generated files. --- autogen/configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autogen/configure b/autogen/configure index d4df3a49174..cc0e18b7d8f 100755 --- a/autogen/configure +++ b/autogen/configure @@ -4672,6 +4672,11 @@ case "${canonical}" in ## fi ;; + ## Cygwin ports + *-*-cygwin ) + opsys=cygwin + ;; + ## HP 9000 series 700 and 800, running HP/UX hppa*-hp-hpux10.2* ) opsys=hpux10-20 @@ -4745,7 +4750,6 @@ case "${canonical}" in ## Intel 386 machines where we don't care about the manufacturer. i[3456]86-*-* ) case "${canonical}" in - *-cygwin ) opsys=cygwin ;; *-darwin* ) opsys=darwin ;; *-sysv4.2uw* ) opsys=unixware ;; *-sysv5uw* ) opsys=unixware ;; From 0aa3616eed6914d159d1136aaa487ac3b042cf7d Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sat, 13 Apr 2013 16:37:20 +0200 Subject: [PATCH 51/58] Make `split-window' a non-interactive function. * doc/lispref/windows.texi (Splitting Windows): Change category of split-window from a command to a function. * etc/NEWS: Mention fixing `split-window' to be non-interactive. * window.el (split-window): Remove interactive form, since as a command this function is a special case of split-window-below. Correct doc string. --- doc/lispref/ChangeLog | 5 +++++ doc/lispref/windows.texi | 4 ++-- etc/ChangeLog | 4 ++++ etc/NEWS | 5 +++++ lisp/ChangeLog | 6 ++++++ lisp/window.el | 3 +-- 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 0bc2b0880b0..f65c2e85461 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,8 @@ +2013-04-13 Stephen Berman + + * windows.texi (Splitting Windows): Change category of + split-window from a command to a function. + 2013-04-06 Chong Yidong * display.texi (Faces): Minor clarifications. diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 792002add81..f2a4b3849dd 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -717,7 +717,7 @@ window. This section describes functions for creating a new window by @dfn{splitting} an existing one. -@deffn Command split-window &optional window size side +@defun split-window &optional window size side This function creates a new live window next to the window @var{window}. If @var{window} is omitted or @code{nil}, it defaults to the selected window. That window is ``split'', and reduced in @@ -767,7 +767,7 @@ called with the arguments @var{window}, @var{size}, and @var{side}, in lieu of the usual action of @code{split-window}. Otherwise, this function obeys the @code{window-atom} or @code{window-side} window parameter, if any. @xref{Window Parameters}. -@end deffn +@end defun As an example, here is a sequence of @code{split-window} calls that yields the window configuration discussed in @ref{Windows and Frames}. diff --git a/etc/ChangeLog b/etc/ChangeLog index 493095e9621..31d14b96d94 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2013-04-13 Stephen Berman + + * NEWS: Mention fixing `split-window' to be non-interactive. + 2013-04-09 Tassilo Horn * themes/tsdh-dark-theme.el (tsdh-dark): Add some more faces. diff --git a/etc/NEWS b/etc/NEWS index 6014ee36219..1e072afaaf1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -76,6 +76,11 @@ of the buffer is visible). * Editing Changes in Emacs 24.4 +** `split-window' is no longer a command, just a non-interactive function. +As a command it was a special case of `split-window-below', and as such +superfluous. After being reimplemented in Lisp, its interactive form +was mistakenly retained. + ** New commands `toggle-frame-fullscreen' and `toggle-frame-maximized', bound to and M-, respectively. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 37e8028c941..9f31cd8228b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-04-13 Stephen Berman + + * window.el (split-window): Remove interactive form, since as a + command this function is a special case of split-window-below. + Correct doc string. + 2013-04-12 Roland Winkler * faces.el (read-face-name): Do not override value of arg default. diff --git a/lisp/window.el b/lisp/window.el index 627b9a425eb..5b001988ddf 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -3686,7 +3686,7 @@ lines or columns tall. If SIZE is negative, make the new window absolute value can be less than `window-min-height' or `window-min-width'; so this command can make a new window as small as one line or two columns. SIZE defaults to half of -WINDOW's size. Interactively, SIZE is the prefix argument. +WINDOW's size. Optional third argument SIDE nil (or `below') specifies that the new window shall be located below WINDOW. SIDE `above' means the @@ -3718,7 +3718,6 @@ scrollbars are inherited from WINDOW. If WINDOW is an internal window, these properties as well as the buffer displayed in the new window are inherited from the window selected on WINDOW's frame. The selected window is not changed by this function." - (interactive "i") (setq window (window-normalize-window window)) (let* ((side (cond ((not side) 'below) From 23a0e159ee303e0b3cd00483a0e2c3b1649d8642 Mon Sep 17 00:00:00 2001 From: Roland Winkler Date: Sat, 13 Apr 2013 15:38:52 -0500 Subject: [PATCH 52/58] lisp/textmodes/bibtex.el (bibtex-initialize): If the current buffer does not visit a BibTeX file, exclude it from the list of buffers returned by bibtex-initialize --- lisp/ChangeLog | 6 ++++++ lisp/textmodes/bibtex.el | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f31cd8228b..d01e57fa31f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-09-23 Roland Winkler + + * textmodes/bibtex.el (bibtex-initialize): If the current buffer + does not visit a BibTeX file, exclude it from the list of buffers + returned by bibtex-initialize. + 2013-04-13 Stephen Berman * window.el (split-window): Remove interactive form, since as a diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index aa20b739946..669a33bff73 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -3020,11 +3020,14 @@ Parsing initializes `bibtex-reference-keys' and `bibtex-strings'." Visit the BibTeX files defined by `bibtex-files' and return a list of corresponding buffers. Initialize in these buffers `bibtex-reference-keys' if not yet set. -List of BibTeX buffers includes current buffer if CURRENT is non-nil. +List of BibTeX buffers includes current buffer if CURRENT is non-nil +and the current buffer visits a file using `bibtex-mode'. If FORCE is non-nil, (re)initialize `bibtex-reference-keys' even if already set. If SELECT is non-nil interactively select a BibTeX buffer. -When called interactively, FORCE is t, CURRENT is t if current buffer uses -`bibtex-mode', and SELECT is t if current buffer does not use `bibtex-mode'," + +When called interactively, FORCE is t, CURRENT is t if current buffer +visits a file using `bibtex-mode', and SELECT is t if current buffer +does not use `bibtex-mode'," (interactive (list (eq major-mode 'bibtex-mode) t (not (eq major-mode 'bibtex-mode)))) (let ((file-path (split-string (or bibtex-file-path default-directory) ":+")) @@ -3062,10 +3065,12 @@ When called interactively, FORCE is t, CURRENT is t if current buffer uses (if (file-readable-p file) (push (find-file-noselect file) buffer-list))) ;; Include current buffer iff we want it. - ;; Exclude current buffer if it doesn't use `bibtex-mode'. - ;; Thus calling `bibtex-initialize' gives meaningful results for - ;; any current buffer. - (unless (and current (eq major-mode 'bibtex-mode)) (setq current nil)) + ;; Exclude current buffer if it does not visit a file using `bibtex-mode'. + ;; This way we exclude BibTeX buffers such as `bibtex-search-buffer' + ;; that are not visiting a BibTeX file. Also, calling `bibtex-initialize' + ;; gives meaningful results for any current buffer. + (unless (and current (eq major-mode 'bibtex-mode) buffer-file-name) + (setq current nil)) (cond ((and current (not (memq (current-buffer) buffer-list))) (push (current-buffer) buffer-list)) ((and (not current) (memq (current-buffer) buffer-list)) From 6646e848210529fc797adeb8230ce77369824909 Mon Sep 17 00:00:00 2001 From: Roland Winkler Date: Sat, 13 Apr 2013 15:41:52 -0500 Subject: [PATCH 53/58] lisp/textmodes/bibtex.el (bibtex-url): Doc fix --- lisp/ChangeLog | 6 +++++- lisp/textmodes/bibtex.el | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d01e57fa31f..de1ba013d1c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,4 +1,8 @@ -2012-09-23 Roland Winkler +2013-04-13 Roland Winkler + + * textmodes/bibtex.el (bibtex-url): Doc fix. + +2013-04-13 Roland Winkler * textmodes/bibtex.el (bibtex-initialize): If the current buffer does not visit a BibTeX file, exclude it from the list of buffers diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 669a33bff73..1daa0186bdb 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -5168,6 +5168,9 @@ Return the URL or nil if none can be generated." (if (stringp (car scheme)) (setq fmt (pop scheme))) (dolist (step scheme) + ;; In the first STEP, if the field contains multiple + ;; matches, we want the match the closest to point. + ;; (if (eq step (car scheme)) (setq text (cdr (assoc-string (car step) fields-alist t))) (if (string-match (nth 1 step) text) (push (cond ((functionp (nth 2 step)) From 7ae9f0fb9927a99846f164785d81e72ba639f359 Mon Sep 17 00:00:00 2001 From: Roland Winkler Date: Sat, 13 Apr 2013 15:45:03 -0500 Subject: [PATCH 54/58] lisp/textmodes/bibtex.el (bibtex-search-entries): Bug fix --- lisp/ChangeLog | 5 +++++ lisp/textmodes/bibtex.el | 29 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index de1ba013d1c..47af4d55433 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-13 Roland Winkler + + * textmodes/bibtex.el (bibtex-search-entries): Bug fix. Use match + data before it gets modified by bibtex-beginning-of-entry. + 2013-04-13 Roland Winkler * textmodes/bibtex.el (bibtex-url): Doc fix. diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 1daa0186bdb..01a126eb381 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -5241,19 +5241,22 @@ where FILE is the BibTeX file of ENTRY." (if (string= "" field) ;; Unrestricted search. (while (re-search-forward regexp nil t) - (let ((beg (bibtex-beginning-of-entry)) - (end (bibtex-end-of-entry)) - key) - (if (and (<= beg (match-beginning 0)) - (<= (match-end 0) end) - (save-excursion - (goto-char beg) - (and (looking-at bibtex-entry-head) - (setq key (bibtex-key-in-head)))) - (not (assoc key entries))) - (push (list key file - (buffer-substring-no-properties beg end)) - entries)))) + (save-excursion + (let ((mbeg (match-beginning 0)) + (mend (match-end 0)) + (beg (bibtex-beginning-of-entry)) + (end (bibtex-end-of-entry)) + key) + (if (and (<= beg mbeg) + (<= mend end) + (progn + (goto-char beg) + (looking-at bibtex-entry-head)) + (setq key (bibtex-key-in-head)) + (not (assoc key entries))) + (push (list key file + (buffer-substring-no-properties beg end)) + entries))))) ;; The following is slow. But it works reliably even in more ;; complicated cases with BibTeX string constants and crossrefed ;; entries. If you prefer speed over reliability, perform an From a829b0dc898972de4b24b1a9a807f529ddd7b818 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 13 Apr 2013 20:59:48 -0400 Subject: [PATCH 55/58] * lisp/files.el: Allow : in local variables. (hack-local-variable-regexp): New var. (hack-local-variables-prop-line, hack-local-variables): Use it. Fixes: debbugs:14089 --- lisp/ChangeLog | 6 ++++++ lisp/files.el | 38 +++++++++++++++++++------------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 47af4d55433..d111d40dab2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-04-14 Stefan Monnier + + * files.el: Allow : in local variables (bug#14089). + (hack-local-variable-regexp): New var. + (hack-local-variables-prop-line, hack-local-variables): Use it. + 2013-04-13 Roland Winkler * textmodes/bibtex.el (bibtex-search-entries): Bug fix. Use match diff --git a/lisp/files.el b/lisp/files.el index d098f0fcec7..6be3685c875 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3029,6 +3029,9 @@ n -- to ignore the local variables list.") (prog1 (memq char '(?! ?\s ?y)) (quit-window t))))))) +(defconst hack-local-variable-regexp + "[ \t]*\\([^][;\"'?()\\ \t\n]+\\)[ \t]*:[ \t]*") + (defun hack-local-variables-prop-line (&optional mode-only) "Return local variables specified in the -*- line. Returns an alist of elements (VAR . VAL), where VAR is a variable @@ -3055,11 +3058,11 @@ mode, if there is one, otherwise nil." ;; (last ";" is optional). ;; If MODE-ONLY, just check for `mode'. ;; Otherwise, parse the -*- line into the RESULT alist. - (while (and (or (not mode-only) - (not result)) - (< (point) end)) - (unless (looking-at "[ \t]*\\([^ \t\n:]+\\)[ \t]*:[ \t]*") - (message "Malformed mode-line") + (while (not (or (and mode-only result) + (>= (point) end))) + (unless (looking-at hack-local-variable-regexp) + (message "Malformed mode-line: %S" + (buffer-substring-no-properties (point) end)) (throw 'malformed-line nil)) (goto-char (match-end 0)) ;; There used to be a downcase here, @@ -3211,8 +3214,7 @@ local variables, but directory-local variables may still be applied." (prefix (concat "^" (regexp-quote (buffer-substring (line-beginning-position) - (match-beginning 0))))) - beg) + (match-beginning 0)))))) (forward-line 1) (let ((startpos (point)) @@ -3247,18 +3249,16 @@ local variables, but directory-local variables may still be applied." (forward-line 1)) (goto-char (point-min)) - (while (and (not (eobp)) - (or (not mode-only) - (not result))) - ;; Find the variable name; strip whitespace. - (skip-chars-forward " \t") - (setq beg (point)) - (skip-chars-forward "^:\n") - (if (eolp) (error "Missing colon in local variables entry")) - (skip-chars-backward " \t") - (let* ((str (buffer-substring beg (point))) - (var (let ((read-circle nil)) - (read str))) + (while (not (or (eobp) + (and mode-only result))) + ;; Find the variable name; + (unless (looking-at hack-local-variable-regexp) + (error "Malformed local variable line: %S" + (buffer-substring-no-properties + (point) (line-end-position)))) + (goto-char (match-end 1)) + (let* ((str (match-string 1)) + (var (intern str)) val val2) (and (equal (downcase (symbol-name var)) "mode") (setq var 'mode)) From 830aed4d5e06af8644db9514f1dd4f59e1026499 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 13 Apr 2013 21:02:29 -0400 Subject: [PATCH 56/58] * lisp/emacs-lisp/trace.el (trace-values): New function. --- lisp/ChangeLog | 2 ++ lisp/emacs-lisp/trace.el | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d111d40dab2..3d92d79fd0a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2013-04-14 Stefan Monnier + * emacs-lisp/trace.el (trace-values): New function. + * files.el: Allow : in local variables (bug#14089). (hack-local-variable-regexp): New var. (hack-local-variables-prop-line, hack-local-variables): Use it. diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el index 09c4969cf18..fce8643923f 100644 --- a/lisp/emacs-lisp/trace.el +++ b/lisp/emacs-lisp/trace.el @@ -157,6 +157,17 @@ (defvar inhibit-trace nil "If non-nil, all tracing is temporarily inhibited.") +;;;###autoload +(defun trace-values (&rest values) + "Helper function to get internal values. +You can call this function to add internal values in the trace buffer." + (unless inhibit-trace + (with-current-buffer trace-buffer + (goto-char (point-max)) + (insert + (trace-entry-message + 'trace-values trace-level values ""))))) + (defun trace-entry-message (function level args context) "Generate a string that describes that FUNCTION has been entered. LEVEL is the trace level, ARGS is the list of arguments passed to FUNCTION, From 91e8293cc55d1de50796300412084e8774c60e7f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 13 Apr 2013 22:55:21 -0400 Subject: [PATCH 57/58] * lisp/files.el (normal-mode): Only use default major-mode if no other mode was specified. Fixes: debbugs:14089 --- lisp/ChangeLog | 3 +++ lisp/files.el | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d92d79fd0a..b0997a307f5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2013-04-14 Stefan Monnier + * files.el (normal-mode): Only use default major-mode if no other mode + was specified. + * emacs-lisp/trace.el (trace-values): New function. * files.el: Allow : in local variables (bug#14089). diff --git a/lisp/files.el b/lisp/files.el index 6be3685c875..ce032534f04 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1986,8 +1986,7 @@ Do you want to revisit the file normally now? ") (set-buffer-multibyte nil) (setq buffer-file-coding-system 'no-conversion) (set-buffer-major-mode buf) - (make-local-variable 'find-file-literally) - (setq find-file-literally t)) + (setq-local find-file-literally t)) (after-find-file error (not nowarn))) (current-buffer)))) @@ -2175,7 +2174,7 @@ not set local variables (though we do notice a mode specified with -*-.) or from Lisp without specifying the optional argument FIND-FILE; in that case, this function acts as if `enable-local-variables' were t." (interactive) - (funcall (or (default-value 'major-mode) 'fundamental-mode)) + (fundamental-mode) (let ((enable-local-variables (or (not find-file) enable-local-variables))) ;; FIXME this is less efficient than it could be, since both ;; s-a-m and h-l-v may parse the same regions, looking for "mode:". @@ -2759,7 +2758,9 @@ we don't actually set it to the same mode the buffer already has." (if (functionp re) (funcall re) (looking-at re))))))) - (set-auto-mode-0 done keep-mode-if-same))))) + (set-auto-mode-0 done keep-mode-if-same))) + (unless done + (set-buffer-major-mode (current-buffer))))) ;; When `keep-mode-if-same' is set, we are working on behalf of ;; set-visited-file-name. In that case, if the major mode specified is the From ddd6b68524ba1f957e2f8ddd76eb23e641429b58 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 14 Apr 2013 09:51:15 +0300 Subject: [PATCH 58/58] Improve doc strings of left/right-margin/fringe-width. src/buffer.c (syms_of_buffer) : Mention in the doc string that setting these variables takes effect only after a call to set-window-buffer. (Bug#14200) --- src/ChangeLog | 7 +++++++ src/buffer.c | 25 ++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index af2d38d2e87..2d6fda4fec7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-04-14 Eli Zaretskii + + * buffer.c (syms_of_buffer) + : + Mention in the doc string that setting these variables takes + effect only after a call to set-window-buffer. (Bug#14200) + 2013-04-13 Eli Zaretskii * indent.c (Fvertical_motion): Don't consider display strings on diff --git a/src/buffer.c b/src/buffer.c index 8728b418812..3810d3db079 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -5883,29 +5883,44 @@ See also the functions `display-table-slot' and `set-display-table-slot'. */); DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols), Qintegerp, doc: /* Width of left marginal area for display of a buffer. -A value of nil means no marginal area. */); +A value of nil means no marginal area. + +Setting this variable does not take effect until a new buffer is displayed +in a window. To make the change take effect, call `set-window-buffer'. */); DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols), Qintegerp, doc: /* Width of right marginal area for display of a buffer. -A value of nil means no marginal area. */); +A value of nil means no marginal area. + +Setting this variable does not take effect until a new buffer is displayed +in a window. To make the change take effect, call `set-window-buffer'. */); DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width), Qintegerp, doc: /* Width of this buffer's left fringe (in pixels). A value of 0 means no left fringe is shown in this buffer's window. -A value of nil means to use the left fringe width from the window's frame. */); +A value of nil means to use the left fringe width from the window's frame. + +Setting this variable does not take effect until a new buffer is displayed +in a window. To make the change take effect, call `set-window-buffer'. */); DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width), Qintegerp, doc: /* Width of this buffer's right fringe (in pixels). A value of 0 means no right fringe is shown in this buffer's window. -A value of nil means to use the right fringe width from the window's frame. */); +A value of nil means to use the right fringe width from the window's frame. + +Setting this variable does not take effect until a new buffer is displayed +in a window. To make the change take effect, call `set-window-buffer'. */); DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins), Qnil, doc: /* Non-nil means to display fringes outside display margins. -A value of nil means to display fringes between margins and buffer text. */); +A value of nil means to display fringes between margins and buffer text. + +Setting this variable does not take effect until a new buffer is displayed +in a window. To make the change take effect, call `set-window-buffer'. */); DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width), Qintegerp,