diff --git a/ChangeLog b/ChangeLog index 845fce543b6cdeea4d7b187fce34f04960a725ce..1a25ba8e33d675a1084f22d6456646ca624a1cf5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,8 @@ * src/Makefile.in (LIB_PTHREAD_SIGMASK): New macro. (LIBES): Use it. + * lib/getopt.c, lib/unistd.in.h, m4/getopt.m4: Merge from gnulib. + 2011-07-07 Andreas Schwab * configure.in (maintainer-mode): Reflect default in help string. diff --git a/autogen/configure b/autogen/configure index 7e45acbdb83401ae2efa40cf2d7d3ebadaa83c81..10bdf24c3a9ea0dd92bd12a70c6aee36ae2c4f89 100755 --- a/autogen/configure +++ b/autogen/configure @@ -1932,8 +1932,8 @@ Optional Features: --disable-ns-self-contained disable self contained build under NeXTstep --enable-asserts compile code with asserts enabled - --enable-maintainer-mode - enable make rules and dependencies not useful (and + --disable-maintainer-mode + disable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-locallisppath=PATH directories Emacs should search for lisp files @@ -14918,7 +14918,7 @@ int *p = &optreset; return optreset; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_link "$LINENO"; then : gl_optind_min=1 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -14939,7 +14939,8 @@ else fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext gl_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -DOPTIND_MIN=$gl_optind_min" @@ -14962,22 +14963,20 @@ int main () { { - int argc = 0; - char *argv[10]; + static char program[] = "program"; + static char a[] = "-a"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, a, foo, bar, NULL }; int c; - argv[argc++] = "program"; - argv[argc++] = "-a"; - argv[argc++] = "foo"; - argv[argc++] = "bar"; - argv[argc] = NULL; optind = OPTIND_MIN; opterr = 0; - c = getopt (argc, argv, "ab"); + c = getopt (4, argv, "ab"); if (!(c == 'a')) return 1; - c = getopt (argc, argv, "ab"); + c = getopt (4, argv, "ab"); if (!(c == -1)) return 2; if (!(optind == 2)) @@ -14985,22 +14984,20 @@ main () } /* Some internal state exists at this point. */ { - int argc = 0; - char *argv[10]; + static char program[] = "program"; + static char donald[] = "donald"; + static char p[] = "-p"; + static char billy[] = "billy"; + static char duck[] = "duck"; + static char a[] = "-a"; + static char bar[] = "bar"; + char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; int c; - argv[argc++] = "program"; - argv[argc++] = "donald"; - argv[argc++] = "-p"; - argv[argc++] = "billy"; - argv[argc++] = "duck"; - argv[argc++] = "-a"; - argv[argc++] = "bar"; - argv[argc] = NULL; optind = OPTIND_MIN; opterr = 0; - c = getopt (argc, argv, "+abp:q:"); + c = getopt (7, argv, "+abp:q:"); if (!(c == -1)) return 4; if (!(strcmp (argv[0], "program") == 0)) @@ -15022,7 +15019,9 @@ main () } /* Detect MacOS 10.5, AIX 7.1 bug. */ { - char *argv[3] = { "program", "-ab", NULL }; + static char program[] = "program"; + static char ab[] = "-ab"; + char *argv[3] = { program, ab, NULL }; optind = OPTIND_MIN; opterr = 0; if (getopt (2, argv, "ab:") != 'a') @@ -15101,19 +15100,22 @@ main () and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { - char *myargv[3]; - myargv[0] = "conftest"; - myargv[1] = "-+"; - myargv[2] = 0; + static char conftest[] = "conftest"; + static char plus[] = "-+"; + char *argv[3] = { conftest, plus, NULL }; opterr = 0; - if (getopt (2, myargv, "+a") != '?') + if (getopt (2, argv, "+a") != '?') result |= 1; } /* This code succeeds on glibc 2.8, mingw, and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { - char *argv[] = { "program", "-p", "foo", "bar", NULL }; + static char program[] = "program"; + static char p[] = "-p"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, p, foo, bar, NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') @@ -15127,7 +15129,10 @@ main () } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { - char *argv[] = { "program", "foo", "-p", NULL }; + static char program[] = "program"; + static char foo[] = "foo"; + static char p[] = "-p"; + char *argv[] = { program, foo, p, NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) result |= 16; @@ -15136,13 +15141,26 @@ main () } /* This code fails on glibc 2.11. */ { - char *argv[] = { "program", "-b", "-a", NULL }; + static char program[] = "program"; + static char b[] = "-b"; + static char a[] = "-a"; + char *argv[] = { program, b, a, NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') result |= 64; else if (getopt (3, argv, "+:a:b") != ':') result |= 64; } + /* This code dumps core on glibc 2.14. */ + { + static char program[] = "program"; + static char w[] = "-W"; + static char dummy[] = "dummy"; + char *argv[] = { program, w, dummy, NULL }; + optind = opterr = 1; + if (getopt (3, argv, "W;") != 'W') + result |= 128; + } return result; ; diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 35337de3fa434269b6d0c17e09561ca0388d1bad..729013ba54ce52feca93882fbd2f2a20029752df 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2011-07-08 Andreas Schwab + + * mail/sendmail.el (send-mail-function): No longer delay custom + initialization. + * custom.el (custom-initialize-delay): Doc fix. + +2011-07-08 Stefan Monnier + + * abbrev.el (expand-abbrev): Try to preserve point (bug#5805). + +2011-07-08 Michael Albinus + + * net/tramp-sh.el (tramp-sh-handle-start-file-process): Use a + human-friendly prompt. + +2011-07-08 Stefan Monnier + + * vc/vc-bzr.el (vc-bzr-revision-keywords): Remove svn, it's only + provided by a particular plugin. + 2011-07-08 Lars Magne Ingebrigtsen * mail/sendmail.el (sendmail-query-once): If we aren't allowed to @@ -41,7 +61,7 @@ * info.el (Info-mode-map): Remove S-TAB binding, since [backtab] should cover it (bug#1281). - * cus-edit.el (custom-show): Marked as obsolete. + * cus-edit.el (custom-show): Mark as obsolete. * net/network-stream.el (network-stream-open-starttls): If gnutls negotiation fails, then possibly try again with a non-encrypted @@ -62,18 +82,17 @@ * international/characters.el (build-unicode-category-table): Delete it. - (unicode-category-table): Set it by - unicode-prroperty-table-internal. + (unicode-category-table): Set it by unicode-property-table-internal. - * international/mule-cmds.el (char-code-property-alist): Moved to + * international/mule-cmds.el (char-code-property-alist): Move to to src/chartab.c. (get-char-code-property): Call unicode-property-table-internal to load a file. Call get-unicode-property-internal where necessary. (put-char-code-property): Call unicode-property-table-internal to load a file. Call put-unicode-property-internal where necessary. put-unicode-property-internal where necessary. - (char-code-property-description): Call - unicode-property-table-internal to load a file. + (char-code-property-description): + Call unicode-property-table-internal to load a file. * international/charprop.el: * international/uni-bidi.el: @@ -142,8 +161,8 @@ 2011-07-06 Lars Magne Ingebrigtsen * emacs-lisp/lisp-mode.el (eval-defun-1): Update the documentation - of faces when `M-C-x'-ing their definitions (bug#8378). Also - clean up the code slightly. + of faces when `M-C-x'-ing their definitions (bug#8378). + Also clean up the code slightly. * progmodes/grep.el (rgrep): Don't bind `process-connection-type', because that makes the colours go away. @@ -167,39 +186,38 @@ 2011-07-06 Michael R. Mauger * progmodes/sql.el: Version 3.0 - (sql-product-alist): Added product :completion-object, + (sql-product-alist): Add product :completion-object, :completion-column, and :statement attributes. - (sql-mode-menu, sql-interactive-mode-map): Fixed List entries. + (sql-mode-menu, sql-interactive-mode-map): Fix List entries. (sql-mode-syntax-table): Mark all punctuation. - (sql-font-lock-keywords-builder): Temporarily removed fallback on + (sql-font-lock-keywords-builder): Temporarily remove fallback on ansi keywords. (sql-regexp-abbrev, sql-regexp-abbrev-list): New functions. - (sql-mode-oracle-font-lock-keywords): Improved. + (sql-mode-oracle-font-lock-keywords): Improve. (sql-oracle-show-reserved-words): New function for development. (sql-product-font-lock): Simplify for source code buffers. (sql-product-syntax-table, sql-product-font-lock-syntax-alist): New functions. (sql-highlight-product): Set product specific syntax table. - (sql-mode-map): Added statement movement functions. - (sql-ansi-statement-starters, sql-oracle-statement-starters): New - variable. + (sql-mode-map): Add statement movement functions. + (sql-ansi-statement-starters, sql-oracle-statement-starters): + New variable. (sql-statement-regexp, sql-beginning-of-statement) (sql-end-of-statement, sql-signum): New functions. - (sql-buffer-live-p, sql=find-sqli-buffer): Added CONNECTION - parameter. + (sql-buffer-live-p, sql=find-sqli-buffer): Add CONNECTION parameter. (sql-show-sqli-buffer): Bug fix. (sql-interactive-mode): Store connection data as buffer local. - (sql-connect): Added NEW-NAME parameter. Redesigned interaction + (sql-connect): Add NEW-NAME parameter. Redesign interaction with sql-interactive-mode. (sql-save-connection): Save buffer local settings. - (sql-connection-menu-filter): Changed menu entry name. + (sql-connection-menu-filter): Change menu entry name. (sql-product-interactive): Bug fix. (sql-preoutput-hold): New variable. (sql-interactive-remove-continuation-prompt): Bug fixes. (sql-debug-redirect): New variable. (sql-str-literal): New function. (sql-redirect, sql-redirect-one, sql-redirect-value, sql-execute): - Redesigned. + Redesign. (sql-oracle-save-settings, sql-oracle-restore-settings) (sql-oracle-list-all, sql-oracle-list-table): New functions. (sql-completion-object, sql-completion-column) @@ -372,9 +390,8 @@ buffer-saved-size and some allout state to not inhibit auto-saves if there are no longer any plain-text topics pending encryption. - (allout-next-topic-pending-encryption), - (allout-encrypt-decrypted): No longer provide for exemption of the - current topic. + (allout-next-topic-pending-encryption, allout-encrypt-decrypted): + No longer provide for exemption of the current topic. 2011-07-04 Juri Linkov diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 2122f43bbad7e01771fe19a064984975d4a0d307..3795dd46010dc5a821943960c3c035c1b077a644 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -814,19 +814,28 @@ Returns the abbrev symbol, if expansion took place." (destructuring-bind (&optional sym name wordstart wordend) (abbrev--before-point) (when sym - (unless (or ;; executing-kbd-macro - noninteractive - (window-minibuffer-p (selected-window))) - ;; Add an undo boundary, in case we are doing this for - ;; a self-inserting command which has avoided making one so far. - (undo-boundary)) - ;; Now sym is the abbrev symbol. - (setq last-abbrev-text name) - (setq last-abbrev sym) - (setq last-abbrev-location wordstart) - ;; If this abbrev has an expansion, delete the abbrev - ;; and insert the expansion. - (abbrev-insert sym name wordstart wordend))))) + (let ((startpos (copy-marker (point) t)) + (endmark (copy-marker wordend t))) + (unless (or ;; executing-kbd-macro + noninteractive + (window-minibuffer-p (selected-window))) + ;; Add an undo boundary, in case we are doing this for + ;; a self-inserting command which has avoided making one so far. + (undo-boundary)) + ;; Now sym is the abbrev symbol. + (setq last-abbrev-text name) + (setq last-abbrev sym) + (setq last-abbrev-location wordstart) + ;; If this abbrev has an expansion, delete the abbrev + ;; and insert the expansion. + (prog1 + (abbrev-insert sym name wordstart wordend) + ;; Yuck!! If expand-abbrev is called with point slightly + ;; further than the end of the abbrev, move point back to + ;; where it started. + (if (and (> startpos endmark) + (= (point) endmark)) ;Obey skeletons that move point. + (goto-char startpos)))))))) (defun unexpand-abbrev () "Undo the expansion of the last abbrev that expanded. diff --git a/lisp/custom.el b/lisp/custom.el index a5c0065036aabf09b1d2ccca2240ad63a522ee72..4f69c7414684cd0dcebf0bd7002a8e5904486f92 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -120,8 +120,10 @@ the :set function. For variables in preloaded files, you can simply use this function for the :initialize property. For autoloaded variables, you will also need to add an autoload stanza calling this -function, and another one setting the standard-value property. -See `send-mail-function' in sendmail.el for an example." +function, and another one setting the standard-value property." + ;; No longer true: + ;; "See `send-mail-function' in sendmail.el for an example." + ;; Until the var is actually initialized, it is kept unbound. ;; This seemed to be at least as good as setting it to an arbitrary ;; value like nil (evaluating `value' is not an option because it diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index b14c7e501373237961994853f0f3fd749f487ac0..5ffc834f5331c6bc974f7ab349ae88cbcad4cdc1 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -138,14 +138,6 @@ Otherwise, let mailer send back a message to report errors." :group 'sendmail :version "23.1") -;; Prevent problems with `window-system' not having the correct value -;; when loaddefs.el is loaded. `custom-reevaluate-setting' needs the -;; standard value. -;;;###autoload -(put 'send-mail-function 'standard-value - ;; MS-Windows can access the clipboard even under -nw. - '('sendmail-query-once)) - ;; Useful to set in site-init.el ;;;###autoload (defcustom send-mail-function 'sendmail-query-once @@ -161,7 +153,6 @@ This is used by the default mail-sending commands. See also (function-item feedmail-send-it :tag "Use Feedmail package") (function-item mailclient-send-it :tag "Use Mailclient package") function) - :initialize 'custom-initialize-delay :version "24.1" :group 'sendmail) @@ -212,8 +203,6 @@ function to use, and then save that choice." (setq sendmail-query-once-function function)))) (funcall sendmail-query-once-function)) -;;;###autoload(custom-initialize-delay 'send-mail-function nil) - ;;;###autoload (defcustom mail-header-separator (purecopy "--text follows this line--") "Line used to separate headers from text in messages being composed." diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index f342b005c4c70ad5f67851a67411506d89b6588a..1c6f0844be0164e9c7a5b38efddfe1a41961127f 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2690,8 +2690,13 @@ the result will be a local, non-Tramp, filename." ;; When PROGRAM is nil, we just provide a tty. (let ((command (when (stringp program) - (format "cd %s; exec %s" + (format "cd %s; exec env PS1=%s %s" (tramp-shell-quote-argument localname) + ;; Use a human-friendly prompt, for example for `shell'. + (tramp-shell-quote-argument + (format "%s %s" + (file-remote-p default-directory) + tramp-initial-end-of-output)) (mapconcat 'tramp-shell-quote-argument (cons program args) " ")))) (tramp-process-connection-type diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 0fdb2230af8f345e448e5217e9c6f9ccce3ea5ce..4eff3244cdcb392bc2a161f1eabd935c7caa6c75 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -1174,7 +1174,7 @@ stream. Standard error output is discarded." (defconst vc-bzr-revision-keywords ;; bzr help revisionspec | sed -ne 's/^\([a-z]*\):$/"\1"/p' | sort -u '("ancestor" "annotate" "before" "branch" "date" "last" "mainline" "revid" - "revno" "submit" "svn" "tag"))) + "revno" "submit" "tag"))) (defun vc-bzr-revision-completion-table (files) (lexical-let ((files files)) diff --git a/src/ChangeLog b/src/ChangeLog index ccafc9c5963b15dcb69d6c2005b54f60ede81d5b..bd250886ad0e128c4b630b52b725ff1ce89bf50f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -9,6 +9,55 @@ 2011-07-08 Jan Djärv + * gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget. + (xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was + wrong (Bug#8591). + +2011-07-08 Jan Djärv + + * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment. + Put text in x->ttip_lbl instead of gtk_tooltip_set_text (Bug#8591). + (xg_hide_tooltip): Fix comment. + + * nsterm.m (initFrameFromEmacs): Don't use ns_return_types + in registerServicesMenuSendTypes. + (validRequestorForSendType): Don't check ns_return_types. + + * nsfns.m (Fx_open_connection): Put NSStringPboardType into + ns_return_type. + +2011-07-08 Jason Rumney + + * w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using + frame struct members of non-existent frames (Bug#6284). + +2011-07-08 Jan Djärv + + * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and + variable firstTime not needed on OSX >= 10.6. + (setPosition): setFloatValue:knobProportion: is deprecated on OSX + >= 10.5. Use setKnobProportion, setDoubleValue. + + * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4) + (MAC_OS_X_VERSION_10_5): Define if not defined. + (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6. + (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6. + (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6. + + * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods + cString and lossyCString on OSX >= 10.4 + + * nsmenu.m (fillWithWidgetValue): Don't use depercated method + sizeToFit on OSX >= 10.2. + + * nsimage.m (allocInitFromFile): Don't use deprecated method + bestRepresentationForDevice on OSX >= 10.6. + + * nsfns.m (check_ns_display_info): Cast to long and use %ld in error + to avoid warning. + + * emacs.c: Declare unexec_init_emacs_zone. + * nsgui.h: Fix compiler warning about gnulib redefining verify. * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842). diff --git a/src/emacs.c b/src/emacs.c index e4b3a68a6c161557f51a6a8fc7c15a06695f2b5f..c1d517900ca936b7a8c02ecbbc274ac738aff73b 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -129,6 +129,10 @@ Lisp_Object empty_unibyte_string, empty_multibyte_string; on subsequent starts. */ int initialized; +#ifdef DARWIN_OS +extern void unexec_init_emacs_zone (void); +#endif + #ifdef DOUG_LEA_MALLOC /* Preserves a pointer to the memory allocated that copies that static data inside glibc's malloc. */ diff --git a/src/gtkutil.c b/src/gtkutil.c index 343fcfa083a9ee55dd14ae1bbff88ed965543bf3..dfc5b63f375e2964d6ff707fdbcdaa9c65b13d1d 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -633,6 +633,9 @@ qttip_cb (GtkWidget *widget, struct x_output *x = f->output_data.x; if (x->ttip_widget == NULL) { + GtkWidget *p; + GList *list, *iter; + g_object_set (G_OBJECT (widget), "has-tooltip", FALSE, NULL); x->ttip_widget = tooltip; g_object_ref (G_OBJECT (tooltip)); @@ -640,6 +643,19 @@ qttip_cb (GtkWidget *widget, g_object_ref (G_OBJECT (x->ttip_lbl)); gtk_tooltip_set_custom (tooltip, x->ttip_lbl); x->ttip_window = GTK_WINDOW (gtk_widget_get_toplevel (x->ttip_lbl)); + + /* Change stupid Gtk+ default line wrapping. */ + p = gtk_widget_get_parent (x->ttip_lbl); + list = gtk_container_get_children (GTK_CONTAINER (p)); + iter; + for (iter = list; iter; iter = g_list_next (iter)) + { + GtkWidget *w = GTK_WIDGET (iter->data); + if (GTK_IS_LABEL (w)) + gtk_label_set_line_wrap (GTK_LABEL (w), FALSE); + } + g_list_free (list); + /* ATK needs an empty title for some reason. */ gtk_window_set_title (x->ttip_window, ""); /* Realize so we can safely get screen later on. */ @@ -659,8 +675,8 @@ qttip_cb (GtkWidget *widget, int xg_prepare_tooltip (FRAME_PTR f, - Lisp_Object string, - int *width, + Lisp_Object string, + int *width, int *height) { #ifndef USE_GTK_TOOLTIP @@ -697,10 +713,9 @@ xg_prepare_tooltip (FRAME_PTR f, (gtk_widget_get_display (GTK_WIDGET (x->ttip_window))), "gdk-display-current-tooltip", NULL); - /* Put out dummy widget in so we can get callbacks for unrealize and + /* Put our dummy widget in so we can get callbacks for unrealize and hierarchy-changed. */ gtk_tooltip_set_custom (x->ttip_widget, widget); - gtk_tooltip_set_text (x->ttip_widget, SSDATA (encoded_string)); gtk_widget_get_preferred_size (GTK_WIDGET (x->ttip_window), NULL, &req); if (width) *width = req.width; @@ -731,7 +746,7 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) } /* Hide tooltip if shown. Do nothing if not shown. - Return non-zero if tip was hidden, non-ero if not (i.e. not using + Return non-zero if tip was hidden, non-zero if not (i.e. not using system tooltips). */ int diff --git a/src/nsfns.m b/src/nsfns.m index d124f61a4f27923dee08b6d41e10aef5ed9bd73a..0452086201ef4ad7a39f4e2d3eb48034398874ba 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -162,7 +162,7 @@ Updated by Christian Limpach (chris@nice.ch) struct terminal *t = get_terminal (frame, 1); if (t->type != output_ns) - error ("Terminal %d is not a Nextstep display", XINT (frame)); + error ("Terminal %ld is not a Nextstep display", (long) XINT (frame)); return t->display_info.ns; } @@ -1729,7 +1729,8 @@ and GNUstep implementations ("distributor-specific release /* Register our external input/output types, used for determining applicable services and also drag/drop eligibility. */ ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain]; - ns_return_types = [[NSArray arrayWithObjects: nil] retain]; + ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] + retain]; ns_drag_types = [[NSArray arrayWithObjects: NSStringPboardType, NSTabularTextPboardType, diff --git a/src/nsimage.m b/src/nsimage.m index c38cefdc5d54a24556bd4bef1c048e90826d9ea8..2cb0c3bff76fa0213cd301c4d5141e4d8395d60f 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -189,7 +189,11 @@ @implementation EmacsImage image = [[EmacsImage alloc] initByReferencingFile: [NSString stringWithUTF8String: SDATA (found)]]; +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]]; +#else imgRep = [image bestRepresentationForDevice: nil]; +#endif if (imgRep == nil) { [image release]; diff --git a/src/nsmenu.m b/src/nsmenu.m index 0d25b82d5b53f48640722c4e19be5d7ae2e298ff..6a9ee7dd4f5826fce382e3948e37b463fc280dd6 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -695,9 +695,11 @@ - (void)fillWithWidgetValue: (void *)wvptr if ([[self window] isVisible]) [self sizeToFit]; #else +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_2 if ([self supermenu] == nil) [self sizeToFit]; #endif +#endif } diff --git a/src/nsselect.m b/src/nsselect.m index aeb2a3e3a9957d8b2af259dcaa4f75184db658e7..867cf3252e5eed5a5a0af2d46e0eab55182cb6e7 100644 --- a/src/nsselect.m +++ b/src/nsselect.m @@ -352,16 +352,22 @@ Updated by Christian Limpach (chris@nice.ch) utfStr = [mstr UTF8String]; length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding]; +#if ! defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 if (!utfStr) { utfStr = [mstr cString]; length = strlen (utfStr); } +#endif } NS_HANDLER { message1 ("ns_string_from_pasteboard: UTF8String failed\n"); +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 + utfStr = "Conversion failed"; +#else utfStr = [str lossyCString]; +#endif length = strlen (utfStr); } NS_ENDHANDLER diff --git a/src/nsterm.h b/src/nsterm.h index b442973f0d9adbbb435dae84195dbe7478054fe7..f419391a11e70e75631e69609e0c98566b03107f 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -26,10 +26,19 @@ along with GNU Emacs. If not, see . */ #ifdef HAVE_NS #ifdef NS_IMPL_COCOA +#ifndef MAC_OS_X_VERSION_10_3 +#define MAC_OS_X_VERSION_10_3 1030 +#endif +#ifndef MAC_OS_X_VERSION_10_4 +#define MAC_OS_X_VERSION_10_4 1040 +#endif +#ifndef MAC_OS_X_VERSION_10_5 +#define MAC_OS_X_VERSION_10_5 1050 +#endif #ifndef MAC_OS_X_VERSION_10_6 #define MAC_OS_X_VERSION_10_6 1060 #endif -#endif +#endif /* NS_IMPL_COCOA */ #ifdef __OBJC__ @@ -61,7 +70,11 @@ along with GNU Emacs. If not, see . */ @class EmacsToolbar; -@interface EmacsView : NSView /* 10.6+: NSWindowDelegate */ +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface EmacsView : NSView +#else +@interface EmacsView : NSView +#endif { char *old_title; BOOL windowClosing; @@ -112,7 +125,11 @@ along with GNU Emacs. If not, see . */ ========================================================================== */ -@interface EmacsMenu : NSMenu /* 10.6+: */ +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface EmacsMenu : NSMenu +#else +@interface EmacsMenu : NSMenu +#endif { struct frame *frame; unsigned long keyEquivModMask; @@ -139,7 +156,11 @@ along with GNU Emacs. If not, see . */ @class EmacsImage; -@interface EmacsToolbar : NSToolbar /* 10.6+: */ +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface EmacsToolbar : NSToolbar +#else +@interface EmacsToolbar : NSToolbar +#endif { EmacsView *emacsView; NSMutableDictionary *identifierToItem; @@ -182,7 +203,11 @@ along with GNU Emacs. If not, see . */ - (Lisp_Object)runDialogAt: (NSPoint)p; @end -@interface EmacsTooltip : NSObject /* 10.6+: */ +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +@interface EmacsTooltip : NSObject +#else +@interface EmacsTooltip : NSObject +#endif { NSWindow *win; NSTextField *textField; diff --git a/src/nsterm.m b/src/nsterm.m index ac95409ee7e41dff4dd7ceba37b113dd00cb9161..546247ab74ac817dc39d35cbcc6c7a3f3d700f03 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4515,7 +4515,9 @@ - (void)keyDown: (NSEvent *)theEvent unsigned fnKeysym = 0; int flags; static NSMutableArray *nsEvArray; +#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 static BOOL firstTime = YES; +#endif int left_is_none; NSTRACE (keyDown); @@ -4703,13 +4705,15 @@ most recently updated (I guess), which is not the correct one. */ } } + +#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 /* if we get here we should send the key for input manager processing */ if (firstTime && [[NSInputManager currentInputManager] wantsToDelayTextChangeNotifications] == NO) fprintf (stderr, "Emacs: WARNING: TextInput mgr wants marked text to be permanent!\n"); firstTime = NO; - +#endif if (NS_KEYLOG && !processingCompose) fprintf (stderr, "keyDown: Begin compose sequence.\n"); @@ -5366,7 +5370,7 @@ - (BOOL)isOpaque [self allocateGState]; [NSApp registerServicesMenuSendTypes: ns_send_types - returnTypes: ns_return_types]; + returnTypes: nil]; ns_window_num++; return self; @@ -5744,8 +5748,7 @@ - (id) validRequestorForSendType: (NSString *)typeSent { NSTRACE (validRequestorForSendType); if (typeSent != nil && [ns_send_types indexOfObject: typeSent] != NSNotFound - && (typeReturned == nil - || [ns_return_types indexOfObject: typeSent] != NSNotFound)) + && typeReturned == nil) { if (! NILP (ns_get_local_selection (QPRIMARY, QUTF8_STRING))) return self; @@ -6066,14 +6069,26 @@ - (int) checkSamePosition: (int) position portion: (int) portion em_whole = whole; if (portion >= whole) - [self setFloatValue: 0.0 knobProportion: 1.0]; + { +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 + [self setKnobProportion: 1.0]; + [self setDoubleValue: 1.0]; +#else + [self setFloatValue: 0.0 knobProportion: 1.0]; +#endif + } else { float pos, por; portion = max ((float)whole*min_portion/pixel_height, portion); pos = (float)position / (whole - portion); por = (float)portion/whole; +#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5 + [self setKnobProportion: por]; + [self setDoubleValue: pos]; +#else [self setFloatValue: pos knobProportion: por]; +#endif } return self; } diff --git a/src/w32fns.c b/src/w32fns.c index cba0b91e68566605c76de07d3b165c3075e14e12..f48e5764b4cabaea7abcbcb1c7f89f1ab7fb93c6 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3273,7 +3273,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { /* Free memory used by owner-drawn and help-echo strings. */ w32_free_menu_strings (hwnd); - f->output_data.w32->menubar_active = 0; + if (f) + f->output_data.w32->menubar_active = 0; menubar_in_use = 0; } } @@ -3623,10 +3624,10 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (LOWORD (lParam) == HTCLIENT) { f = x_window_to_frame (dpyinfo, hwnd); - if (f->output_data.w32->hourglass_p && !menubar_in_use - && !current_popup_menu) + if (f && f->output_data.w32->hourglass_p + && !menubar_in_use && !current_popup_menu) SetCursor (f->output_data.w32->hourglass_cursor); - else + else if (f) SetCursor (f->output_data.w32->current_cursor); return 0; }