Index: Makefile.in =================================================================== RCS file: /cvsroot/emacs/emacs/Makefile.in,v retrieving revision 1.281.2.12 diff -u -r1.281.2.12 Makefile.in --- Makefile.in 19 Sep 2005 10:20:23 -0000 1.281.2.12 +++ Makefile.in 5 Nov 2005 17:33:30 -0000 @@ -158,6 +158,9 @@ # Location to install Emacs.app on Mac OS X carbon_appdir=@carbon_appdir@ +# Location to install Emacs.app under NeXT/Open/GNUstep / Cocoa +ns_appdir=@ns_appdir@ + # ==================== Emacs-specific directories ==================== # These variables hold the values Emacs will actually use. They are @@ -388,6 +391,14 @@ (cd ${carbon_appdir}/Emacs.app; umask 022; tar -xvf - \ && cat > /dev/null))) || exit 1; \ fi + if test "${ns_appdir}" != ""; then \ + umask 022; mkdir -p ${ns_appdir}/Emacs.app; \ + (cd nextstep/build/Emacs.app; (tar -chf - . | \ + (cd ${ns_appdir}/Emacs.app; umask 022; tar -xvf - \ + && cat > /dev/null))) || exit 1; \ + ( cd site-lisp ; tar chf - . ) | \ + ( cd ${datadir}/$(EMACSFULL)/site-lisp ; tar xf - ) \ + fi ### Install the files that are machine-independent. ### Most of them come straight from the distribution; @@ -486,7 +497,7 @@ chmod a+r ${infodir}/dir); \ fi; \ cd ${srcdir}/info ; \ - for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* emacs-mime* emacs-xtra* eshell* eudc* flymake* forms* gnus* idlwave* info* message* mh-e* newsticker* org* pcl-cvs* pgg* reftex* sc* ses* sieve* speedbar* tramp* vip* widget* woman* smtpmail* url*; do \ + for f in ada-mode* autotype* calc* ccmode* cl* dired-x* ebrowse* ediff* efaq* eintr* elisp* emacs* emacs-mime* emacs-xtra* eshell* eudc* flymake* forms* gnus* idlwave* info* message* mh-e* newsticker* ns-emacs* org* pcl-cvs* pgg* reftex* sc* ses* sieve* speedbar* tramp* vip* widget* woman* smtpmail* url*; do \ (cd $${thisdir}; \ ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \ chmod a+r ${infodir}/$$f); \ @@ -496,7 +507,7 @@ thisdir=`/bin/pwd`; \ if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \ then \ - for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime emacs-xtra eshell eudc flymake forms gnus idlwave info message mh-e newsticker org pcl-cvs pgg reftex sc ses sieve speedbar tramp vip viper widget woman smtpmail url; do \ + for f in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq elisp eintr emacs emacs-mime emacs-xtra eshell eudc flymake forms gnus idlwave info message mh-e newsticker ns-emacs org pcl-cvs pgg reftex sc ses sieve speedbar tramp vip viper widget woman smtpmail url; do \ (cd $${thisdir}; \ ${INSTALL_INFO} --info-dir=${infodir} ${infodir}/$$f); \ done; \ @@ -605,6 +616,7 @@ -(cd lispref && $(MAKE) $(MFLAGS) clean) -(cd lispintro && $(MAKE) $(MFLAGS) clean) (cd leim; $(MAKE) $(MFLAGS) clean) + (cd etc; $(MAKE) $(MFLAGS) clean) ### `distclean' ### Delete all files from the current directory that are created by Index: configure.in =================================================================== RCS file: /cvsroot/emacs/emacs/configure.in,v retrieving revision 1.351.2.24 diff -u -r1.351.2.24 configure.in --- configure.in 7 Oct 2005 07:15:25 -0000 1.351.2.24 +++ configure.in 5 Nov 2005 17:33:47 -0000 @@ -111,6 +111,14 @@ [ --with-png use -lpng for displaying PNG images]) AC_ARG_WITH(gtk, [ --with-gtk use GTK (same as --with-x-toolkit=gtk)]) +AC_ARG_WITH(ns, +[ --with-ns use nextstep (Cocoa or GNUstep) windowing system]) +AC_ARG_WITH(ns, +[ --without-ns don't use nextstep (Cocoa or GNUstep) windowing system]) +AC_ARG_ENABLE(ns-app, +[[ --enable-ns-app[=DIR] [DIR=/Applications] + specify install directory for Emacs.app under NS]], +[ ns_appdir_x=${enableval}]) AC_ARG_WITH(pkg-config-prog, [ --with-pkg-config-prog Path to pkg-config to use for finding GTK]) AC_ARG_WITH(toolkit-scroll-bars, @@ -1682,6 +1690,31 @@ window_system=mac fi +HAVE_NS=no +tmp_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -x objective-c" +if test "${with_ns}" != no; then + AC_CHECK_HEADER(AppKit/AppKit.h, HAVE_NS=yes) +fi +if test "${window_system}" = x11 && test "${HAVE_NS}" = yes; then + if test "${with_ns+set}" != set \ + && test "${ns_appdir_x+set}" != set; then + HAVE_NS=no + fi +fi +if test "${window_system}" = mac && test "${HAVE_NS}" = yes; then + if test "${with_ns+set}" != set \ + && test "${ns_appdir_x+set}" != set; then + HAVE_NS=no + else + HAVE_CARBON=no + fi +fi +if test "${HAVE_NS}" = yes; then + window_system=nextstep +fi +CFLAGS="$tmp_CFLAGS" + case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes @@ -1700,7 +1733,7 @@ * ) USE_X_TOOLKIT=maybe ;; esac ;; - mac | none ) + nextstep | mac | none ) HAVE_X_WINDOWS=no HAVE_X11=no USE_X_TOOLKIT=none @@ -2193,6 +2226,9 @@ elif test "${HAVE_CARBON}" = "yes"; then AC_DEFINE(USE_TOOLKIT_SCROLL_BARS) USE_TOOLKIT_SCROLL_BARS=yes + elif test "${HAVE_NS}" = "yes"; then + AC_DEFINE(USE_TOOLKIT_SCROLL_BARS) + USE_TOOLKIT_SCROLL_BARS=yes fi fi @@ -2372,6 +2408,21 @@ fi CFLAGS="$tmp_CFLAGS" fi +### Use NeXTstep API to implement GUI. +if test "${HAVE_NS}" = "yes"; then + AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on Mac OS X.]) + ## Specify the install directory + ns_appdir= + if test "${ns_appdir_x}" != ""; then + case ${ns_appdir_x} in + y | ye | yes) ns_appdir=/Applications ;; + * ) ns_appdir=${ns_appdir_x} ;; + esac + fi + # We also have mouse menus. + HAVE_MENUS=yes +fi + ### Use session management (-lSM -lICE) if available HAVE_X_SM=no @@ -2760,6 +2811,7 @@ AC_SUBST(opsysfile) AC_SUBST(GETLOADAVG_LIBS) AC_SUBST(carbon_appdir) +AC_SUBST(ns_appdir) AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", [Define to the canonical Emacs configuration name.]) @@ -2848,18 +2900,20 @@ ])dnl AH_BOTTOM([ -/* If we're using any sort of window system, define some consequences. */ +/* If we're using X11, define some consequences. */ #ifdef HAVE_X_WINDOWS #define HAVE_WINDOW_SYSTEM #define MULTI_KBOARD #define HAVE_MOUSE #endif -/* If we're using the Carbon API on Mac OS X, define a few more - variables as well. */ -#ifdef HAVE_CARBON +/* Likewise if we're using the Carbon or NeXTStep APIs on Mac OS X. */ +#if defined(HAVE_CARBON) || defined(HAVE_NS) #define HAVE_WINDOW_SYSTEM #define HAVE_MOUSE +#endif +#ifdef HAVE_NS +#define MULTI_KBOARD #endif /* Define USER_FULL_NAME to return a string Index: lib-src/.cvsignore =================================================================== RCS file: /cvsroot/emacs/emacs/lib-src/.cvsignore,v retrieving revision 1.7.8.2 diff -u -r1.7.8.2 .cvsignore --- lib-src/.cvsignore 25 Sep 2005 22:06:30 -0000 1.7.8.2 +++ lib-src/.cvsignore 5 Nov 2005 17:33:48 -0000 @@ -11,6 +11,7 @@ fakemail getopt.h hexl +mac-fix-env make-docfile movemail obj Index: lib-src/Makefile.in =================================================================== RCS file: /cvsroot/emacs/emacs/lib-src/Makefile.in,v retrieving revision 1.136.4.6 diff -u -r1.136.4.6 Makefile.in --- lib-src/Makefile.in 19 Sep 2005 10:20:04 -0000 1.136.4.6 +++ lib-src/Makefile.in 5 Nov 2005 17:33:48 -0000 @@ -144,6 +144,11 @@ #define NOT_C_CODE #include "../src/config.h" +/* Add mac-fix-env for OS X systems. */ +#if defined(COCOA) || defined(HAVE_CARBON) +INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} b2m${EXEEXT} ebrowse${EXEEXT} mac-fix-env${EXEEXT} +#endif + /* Some machines don\'t find the standard C libraries in the usual place. */ #ifndef ORDINARY_LINK #ifndef LIB_STANDARD_LIBSRC @@ -253,12 +258,22 @@ BASE_CFLAGS = C_SWITCH_SYSTEM C_SWITCH_MACHINE -DHAVE_CONFIG_H \ -I. -I../src -I${srcdir} -I${srcdir}/../src ${CPPFLAGS} ${CFLAGS} +.SUFFIXES: .m + /* This is the default compilation command. But we should never rely on it, because some make version failed to find it for getopt.o. Using an explicit command made it work. */ .c.o: ${CC} -c ${CPP_CFLAGS} $< +#ifdef HAVE_NS +.m.o: +#ifdef GNUSTEP + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString $< +#else + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< +#endif +#endif all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} @@ -487,3 +502,8 @@ $(CC) -o xveterm -DXVIEW -DTTERM ${ALL_CFLAGS} ${srcdir}/emacstool.c \ -lxview -lolgx -lX -I$(OPENWINHOME)/include -L$(OPENWINHOME)/lib \ $(LOADLIBES) + +#if defined(COCOA) || defined(HAVE_CARBON) +mac-fix-env: ${srcdir}/mac-fix-env.m + $(CC) -o mac-fix-env ${srcdir}/mac-fix-env.m -prebind -framework Foundation +#endif Index: lib-src/make-docfile.c =================================================================== RCS file: /cvsroot/emacs/emacs/lib-src/make-docfile.c,v retrieving revision 1.54.6.8 diff -u -r1.54.6.8 make-docfile.c --- lib-src/make-docfile.c 26 Aug 2005 09:51:52 -0000 1.54.6.8 +++ lib-src/make-docfile.c 5 Nov 2005 17:33:49 -0000 @@ -538,7 +538,7 @@ } /* Read through a c file. If a .o file is named, - the corresponding .c file is read instead. + the corresponding .c or .m file is read instead. Looks for DEFUN constructs such as are defined in ../src/lisp.h. Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ @@ -559,6 +559,15 @@ filename[strlen (filename) - 1] = 'c'; infile = fopen (filename, mode); + + if (infile == NULL && extension == 'o') + { + /* try .m */ + filename[strlen (filename) - 1] = 'm'; + infile = fopen (filename, mode); + if (infile == NULL) + filename[strlen (filename) - 1] = 'c'; /* don't confuse people */ + } /* No error if non-ex input file */ if (infile == NULL) Index: lisp/cus-edit.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/cus-edit.el,v retrieving revision 1.185.2.25 diff -u -r1.185.2.25 cus-edit.el --- lisp/cus-edit.el 30 Sep 2005 11:43:40 -0000 1.185.2.25 +++ lisp/cus-edit.el 5 Nov 2005 17:33:52 -0000 @@ -1891,7 +1891,7 @@ ;;; The `custom' Widget. (defface custom-button - '((((type x w32 mac) (class color)) ; Like default modeline + '((((type x w32 mac ns) (class color)) ; Like default modeline (:box (:line-width 2 :style released-button) :background "lightgrey" :foreground "black")) (t @@ -1903,7 +1903,7 @@ (put 'custom-button-face 'face-alias 'custom-button) (defface custom-button-pressed - '((((type x w32 mac) (class color)) + '((((type x w32 mac ns) (class color)) (:box (:line-width 2 :style pressed-button) :background "lightgrey" :foreground "black")) (t @@ -2862,8 +2862,12 @@ w32) (const :format "MAC " :sibling-args (:help-echo "\ -Macintosh OS.") +Macintosh OS (Carbon interface).") mac) + (const :format "NS " + :sibling-args (:help-echo "\ +GNUstep or Macintosh OS Cocoa interface.") + ns) (const :format "DOS " :sibling-args (:help-echo "\ Plain MS-DOS.") Index: lisp/faces.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v retrieving revision 1.279.4.28 diff -u -r1.279.4.28 faces.el --- lisp/faces.el 30 Sep 2005 11:43:42 -0000 1.279.4.28 +++ lisp/faces.el 5 Nov 2005 17:33:54 -0000 @@ -325,7 +325,7 @@ (defun set-face-attributes-from-resources (face frame) "Set attributes of FACE from X resources for FRAME." - (when (memq (framep frame) '(x w32 mac)) + (when (memq (framep frame) '(x w32 mac ns)) (dolist (definition face-x-resources) (let ((attribute (car definition))) (dolist (entry (cdr definition)) @@ -948,7 +948,7 @@ ((:height) 'integerp) (:stipple - (and (memq window-system '(x w32 mac)) + (and (memq window-system '(x w32 mac ns)) (mapcar #'list (apply #'nconc (mapcar (lambda (dir) @@ -1066,7 +1066,7 @@ ;; explicitly in VALID, using color approximation code ;; in tty-colors.el. (when (and (memq attribute '(:foreground :background)) - (not (memq window-system '(x w32 mac))) + (not (memq window-system '(x w32 mac ns))) (not (member new-value '("unspecified" "unspecified-fg" "unspecified-bg")))) @@ -1510,7 +1510,7 @@ The argument FRAME specifies which frame to try. The value may be different for frames on different display types. If FRAME doesn't support colors, the value is nil." - (if (memq (framep (or frame (selected-frame))) '(x w32 mac)) + (if (memq (framep (or frame (selected-frame))) '(x w32 mac ns)) (xw-defined-colors frame) (mapcar 'car (tty-color-alist frame)))) (defalias 'x-defined-colors 'defined-colors) @@ -1522,7 +1522,7 @@ \"unspecified-fg\" or \"unspecified-bg\", the value is nil." (if (member color '(unspecified "unspecified-bg" "unspecified-fg")) nil - (if (member (framep (or frame (selected-frame))) '(x w32 mac)) + (if (member (framep (or frame (selected-frame))) '(x w32 mac ns)) (xw-color-defined-p color frame) (numberp (tty-color-translate color frame))))) (defalias 'x-color-defined-p 'color-defined-p) @@ -1537,7 +1537,7 @@ \"unspecified-fg\" or \"unspecified-bg\", the value is nil." (if (member color '(unspecified "unspecified-fg" "unspecified-bg")) nil - (if (memq (framep (or frame (selected-frame))) '(x w32 mac)) + (if (memq (framep (or frame (selected-frame))) '(x w32 mac ns)) (xw-color-values color frame) (tty-color-values color frame)))) (defalias 'x-color-values 'color-values) @@ -1547,7 +1547,7 @@ The optional argument DISPLAY specifies which display to ask about. DISPLAY should be either a frame or a display name (a string). If omitted or nil, that stands for the selected frame's display." - (if (memq (framep-on-display display) '(x w32 mac)) + (if (memq (framep-on-display display) '(x w32 mac ns)) (xw-display-color-p display) (tty-display-color-p display))) (defalias 'x-display-color-p 'display-color-p) @@ -1556,7 +1556,7 @@ "Return non-nil if frames on DISPLAY can display shades of gray." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) (x-display-grayscale-p display)) (t (> (tty-color-gray-shades display) 2))))) @@ -1753,7 +1753,7 @@ (when (not (equal face 'default)) (face-spec-set face (face-user-default-spec face) frame) (internal-merge-in-global-face face frame) - (when (and (memq window-system '(x w32 mac)) + (when (and (memq window-system '(x w32 mac ns)) (or (not (boundp 'inhibit-default-face-x-resources)) (not (eq face 'default)))) (make-face-x-resource-internal face frame))) @@ -2131,7 +2131,7 @@ '((default :box (:line-width 1 :style released-button) :foreground "black") - (((type x w32 mac) (class color)) + (((type x w32 mac ns) (class color)) :background "grey75") (((type x) (class mono)) :background "grey")) Index: lisp/frame.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/frame.el,v retrieving revision 1.203.2.16 diff -u -r1.203.2.16 frame.el --- lisp/frame.el 26 Aug 2005 09:51:45 -0000 1.203.2.16 +++ lisp/frame.el 5 Nov 2005 17:33:55 -0000 @@ -990,8 +990,8 @@ ((eq system-type 'windows-nt) (with-no-warnings (> w32-num-mouse-buttons 0))) - ((memq frame-type '(x mac)) - t) ;; We assume X and Mac *always* have a pointing device + ((memq frame-type '(x mac ns)) + t) ;; We assume X, Mac, NeXTstep *always* have a pointing device (t (or (and (featurep 'xt-mouse) xterm-mouse-mode) @@ -1006,7 +1006,7 @@ Support for popup menus requires that the mouse be available." (and (let ((frame-type (framep-on-display display))) - (memq frame-type '(x w32 pc mac))) + (memq frame-type '(x w32 pc mac ns))) (display-mouse-p display))) (defun display-graphic-p (&optional display) @@ -1016,7 +1016,7 @@ that use a window system such as X, and false for text-only terminals. DISPLAY can be a display name, a frame, or nil (meaning the selected frame's display)." - (not (null (memq (framep-on-display display) '(x w32 mac))))) + (not (null (memq (framep-on-display display) '(x w32 mac ns))))) (defun display-images-p (&optional display) "Return non-nil if DISPLAY can display images. @@ -1044,7 +1044,7 @@ ;; the Windows' DOS Box. (with-no-warnings (not (null dos-windows-version)))) - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) t) ;; FIXME? (t nil)))) @@ -1053,7 +1053,7 @@ "Return the number of screens associated with DISPLAY." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32)) + ((memq frame-type '(x w32 ns)) (x-display-screens display)) (t ;; FIXME: is this correct for the Mac? 1)))) @@ -1063,7 +1063,7 @@ For character terminals, each character counts as a single pixel." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) (x-display-pixel-height display)) (t (frame-height (if (framep display) display (selected-frame))))))) @@ -1073,7 +1073,7 @@ For character terminals, each character counts as a single pixel." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) (x-display-pixel-width display)) (t (frame-width (if (framep display) display (selected-frame))))))) @@ -1081,13 +1081,13 @@ (defun display-mm-height (&optional display) "Return the height of DISPLAY's screen in millimeters. If the information is unavailable, value is nil." - (and (memq (framep-on-display display) '(x w32 mac)) + (and (memq (framep-on-display display) '(x w32 mac ns)) (x-display-mm-height display))) (defun display-mm-width (&optional display) "Return the width of DISPLAY's screen in millimeters. If the information is unavailable, value is nil." - (and (memq (framep-on-display display) '(x w32 mac)) + (and (memq (framep-on-display display) '(x w32 mac ns)) (x-display-mm-width display))) (defun display-backing-store (&optional display) @@ -1114,7 +1114,7 @@ "Return the number of planes supported by DISPLAY." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) (x-display-planes display)) ((eq frame-type 'pc) 4) @@ -1125,7 +1125,7 @@ "Return the number of color cells supported by DISPLAY." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) (x-display-color-cells display)) ((eq frame-type 'pc) 16) @@ -1138,7 +1138,7 @@ `static-color', `pseudo-color', `true-color', or `direct-color'." (let ((frame-type (framep-on-display display))) (cond - ((memq frame-type '(x w32 mac)) + ((memq frame-type '(x w32 mac ns)) (x-display-visual-class display)) ((and (memq frame-type '(pc t)) (tty-display-color-p display)) Index: lisp/info.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/info.el,v retrieving revision 1.367.2.31 diff -u -r1.367.2.31 info.el --- lisp/info.el 15 Oct 2005 00:26:02 -0000 1.367.2.31 +++ lisp/info.el 5 Nov 2005 17:34:01 -0000 @@ -3718,7 +3718,7 @@ ;; This is a serious problem for trying to handle multiple ;; frame types at once. We want this text to be invisible ;; on frames that can display the font above. - (when (memq (framep (selected-frame)) '(x pc w32 mac)) + (when (memq (framep (selected-frame)) '(x pc w32 mac ns)) (add-text-properties (1- (match-beginning 2)) (match-end 2) '(invisible t front-sticky nil rear-nonsticky t))))) Index: lisp/mwheel.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/mwheel.el,v retrieving revision 1.30.2.4 diff -u -r1.30.2.4 mwheel.el --- lisp/mwheel.el 26 Aug 2005 09:49:04 -0000 1.30.2.4 +++ lisp/mwheel.el 5 Nov 2005 17:34:01 -0000 @@ -59,7 +59,7 @@ 'mouse-wheel-down-event) (defcustom mouse-wheel-down-event ;; In the latest versions of XEmacs, we could just use mouse-%s as well. - (if (memq window-system '(w32 mac)) + (if (memq window-system '(w32 mac ns)) 'wheel-up (intern (format (if (featurep 'xemacs) "button%s" "mouse-%s") mouse-wheel-down-button))) @@ -73,7 +73,7 @@ 'mouse-wheel-up-event) (defcustom mouse-wheel-up-event ;; In the latest versions of XEmacs, we could just use mouse-%s as well. - (if (memq window-system '(w32 mac)) + (if (memq window-system '(w32 mac ns)) 'wheel-down (intern (format (if (featurep 'xemacs) "button%s" "mouse-%s") mouse-wheel-up-button))) Index: lisp/simple.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v retrieving revision 1.616.2.52 diff -u -r1.616.2.52 simple.el --- lisp/simple.el 7 Oct 2005 07:15:02 -0000 1.616.2.52 +++ lisp/simple.el 5 Nov 2005 17:34:04 -0000 @@ -5293,7 +5293,7 @@ (> (prefix-numeric-value arg) 0) (not normal-erase-is-backspace))) - (cond ((or (memq window-system '(x w32 mac pc)) + (cond ((or (memq window-system '(x w32 mac ns pc)) (memq system-type '(ms-dos windows-nt))) (let ((bindings `(([C-delete] [C-backspace]) Index: lisp/startup.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/startup.el,v retrieving revision 1.321.2.29 diff -u -r1.321.2.29 startup.el --- lisp/startup.el 15 Oct 2005 00:26:02 -0000 1.321.2.29 +++ lisp/startup.el 5 Nov 2005 17:34:06 -0000 @@ -159,6 +159,71 @@ and VALUE is the value which is given to that frame parameter \(most options use the argument for this, so VALUE is not present).") +(defconst command-line-ns-option-alist + '(("-NSAutoLaunch" 1 ns-ignore-1-arg) + ("-NXAutoLaunch" 1 ns-ignore-1-arg) + ("-macosx" 0 ns-ignore-0-arg) + ("-NSHost" 1 ns-ignore-1-arg) + ("-_NSMachLaunch" 1 ns-ignore-1-arg) + ("-MachLaunch" 1 ns-ignore-1-arg) + ("-NXOpen" 1 ns-ignore-1-arg) + ("-NSOpen" 1 ns-handle-nxopen) + ("-NXOpenTemp" 1 ns-ignore-1-arg) + ("-NSOpenTemp" 1 ns-handle-nxopentemp) + ;;("-bw" . x-handle-numeric-switch) + ;;("-d" . x-handle-display) + ;;("-display" . x-handle-display) + ("-name" 1 ns-handle-name-switch) + ("-title" 1 ns-handle-switch title) + ("-T" 1 ns-handle-switch title) + ("-r" 0 ns-handle-switch reverse t) + ("-rv" 0 ns-handle-switch reverse t) + ("-reverse" 0 ns-handle-switch reverse t) + ("-fn" 1 ns-handle-switch font) + ("-font" 1 ns-handle-switch font) + ("-ib" 1 ns-handle-numeric-switch internal-border-width) + ;;("-g" . x-handle-geometry) + ;;("-geometry" . x-handle-geometry) + ("-fg" 1 ns-handle-switch foreground-color) + ("-foreground" 1 ns-handle-switch foreground-color) + ("-bg" 1 ns-handle-switch background-color) + ("-background" 1 ns-handle-switch background-color) +; ("-ms" 1 ns-handle-switch mouse-color) + ("-itype" 0 ns-handle-switch icon-type t) + ("-i" 0 ns-handle-switch icon-type t) + ("-iconic" 0 ns-handle-iconic icon-type t) + ;;("-xrm" . x-handle-xrm-switch) + ("-cr" 1 ns-handle-switch cursor-color) + ("-vb" 0 ns-handle-switch vertical-scroll-bars t) + ("-hb" 0 ns-handle-switch horizontal-scroll-bars t) + ("-bd" 1 ns-handle-switch) + ;; ("--border-width" 1 ns-handle-numeric-switch border-width) + ;; ("--display" 1 ns-handle-display) + ("--name" 1 ns-handle-name-switch) + ("--title" 1 ns-handle-switch title) + ("--reverse-video" 0 ns-handle-switch reverse t) + ("--font" 1 ns-handle-switch font) + ("--internal-border" 1 ns-handle-numeric-switch internal-border-width) + ;; ("--geometry" 1 ns-handle-geometry) + ("--foreground-color" 1 ns-handle-switch foreground-color) + ("--background-color" 1 ns-handle-switch background-color) + ("--mouse-color" 1 ns-handle-switch mouse-color) + ("--icon-type" 0 ns-handle-switch icon-type t) + ("--iconic" 0 ns-handle-iconic) + ;; ("--xrm" 1 ns-handle-xrm-switch) + ("--cursor-color" 1 ns-handle-switch cursor-color) + ("--vertical-scroll-bars" 0 ns-handle-switch vertical-scroll-bars t) + ("--border-color" 1 ns-handle-switch border-width)) + "Alist of NS options. +Each element has the form + (NAME NUMARGS HANDLER FRAME-PARAM VALUE) +where NAME is the option name string, NUMARGS is the number of arguments +that the option accepts, HANDLER is a function to call to handle the option. +FRAME-PARAM (optional) is the frame parameter this option specifies, +and VALUE is the value which is given to that frame parameter +\(most options use the argument for this, so VALUE is not present).") + + (defvar before-init-hook nil "Normal hook run after handling urgent options but before loading init files.") @@ -728,7 +793,7 @@ ;; only because all other settings of no-blinking-cursor are here. (unless (or noninteractive emacs-basic-display - (and (memq window-system '(x w32 mac)) + (and (memq window-system '(x w32 mac ns)) (not (member (x-get-resource "cursorBlink" "CursorBlink") '("off" "false"))))) (setq no-blinking-cursor t)) @@ -1581,6 +1646,13 @@ (if (string-match "^--" (car tem)) (push (list (car tem)) longopts))) + ;; Add the long NS options to longopts. + (setq tem command-line-ns-option-alist) + (while tem + (if (string-match "^--" (car (car tem))) + (setq longopts (cons (list (car (car tem))) longopts))) + (setq tem (cdr tem))) + ;; Loop, processing options. (while command-line-args-left (let* ((argi (car command-line-args-left)) @@ -1680,6 +1752,11 @@ ;; Ignore X-windows options and their args if not using X. (setq command-line-args-left (nthcdr (nth 1 tem) command-line-args-left))) + + ((setq tem (assoc argi command-line-ns-option-alist)) + ;; Ignore NS-windows options and their args if not using NS. + (setq command-line-args-left + (nthcdr (nth 1 tem) command-line-args-left))) ((member argi '("-find-file" "-file" "-visit")) ;; An explicit option to specify visiting a file. Index: lisp/version.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/version.el,v retrieving revision 2.32.6.7 diff -u -r2.32.6.7 version.el --- lisp/version.el 26 Aug 2005 09:51:45 -0000 2.32.6.7 +++ lisp/version.el 5 Nov 2005 17:34:06 -0000 @@ -64,6 +64,8 @@ ((featurep 'gtk) (concat ", GTK+ Version " gtk-version-string)) ((featurep 'x-toolkit) ", X toolkit") + ((featurep 'ns-windowing) + (format ", *Step %s" ns-version)) (t "")) (if (and (boundp 'x-toolkit-scroll-bars) (memq x-toolkit-scroll-bars '(xaw xaw3d))) Index: lisp/woman.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/woman.el,v retrieving revision 1.16.4.13 diff -u -r1.16.4.13 woman.el --- lisp/woman.el 25 Sep 2005 22:06:25 -0000 1.16.4.13 +++ lisp/woman.el 5 Nov 2005 17:34:10 -0000 @@ -778,7 +778,7 @@ (defcustom woman-use-own-frame ; window-system (or (and (fboundp 'display-graphic-p) (display-graphic-p)) ; Emacs 21 - (memq window-system '(x w32))) ; Emacs 20 + (memq window-system '(x w32 mac ns))) ; Emacs 20 "*If non-nil then use a dedicated frame for displaying WoMan windows. Only useful when run on a graphic display such as X or MS-Windows." :type 'boolean Index: lisp/international/mule-cmds.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/international/mule-cmds.el,v retrieving revision 1.242.2.27 diff -u -r1.242.2.27 mule-cmds.el --- lisp/international/mule-cmds.el 27 Oct 2005 06:34:56 -0000 1.242.2.27 +++ lisp/international/mule-cmds.el 5 Nov 2005 17:34:13 -0000 @@ -151,7 +151,7 @@ t) (define-key-after set-coding-system-map [set-terminal-coding-system] '(menu-item "For Terminal" set-terminal-coding-system - :enable (null (memq window-system '(x w32 mac))) + :enable (null (memq window-system '(x w32 mac ns))) :help "How to encode terminal output") t) (define-key-after set-coding-system-map [separator-3] Index: lisp/progmodes/cc-align.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-align.el,v retrieving revision 1.20.2.5 diff -u -r1.20.2.5 cc-align.el --- lisp/progmodes/cc-align.el 5 Aug 2005 10:57:28 -0000 1.20.2.5 +++ lisp/progmodes/cc-align.el 5 Nov 2005 17:34:14 -0000 @@ -854,8 +854,51 @@ ) (- target-col open-bracket-col extra)))) +(defun c-lineup-ObjC-method-call-colons (langelem) + "Line up selector args as Project Builder / XCode: colons of first + selector portions on successive lines are aligned. If no decision can + be made return NIL, so that other lineup methods can be tried. This is + typically chained with `c-lineup-ObjC-method-call'. + +Works with: objc-method-call-cont." + (save-excursion + (catch 'no-idea + (let* ((method-arg-len (progn + (back-to-indentation) + (if (search-forward ":" (c-point 'eol) 'move) + (- (point) (c-point 'boi)) + ; no complete argument to indent yet + (throw 'no-idea nil)))) + + (extra (save-excursion + ; indent parameter to argument if needed + (back-to-indentation) + (c-backward-syntactic-ws (cdr langelem)) + (if (eq ?: (char-before)) + (c-get-offset '(objc-method-parameter-offset . nil)) + 0))) + + (open-bracket-col (c-langelem-col langelem)) + + (arg-ralign-colon-ofs (progn + (forward-char) ; skip over '[' + ; skip over object/class name + ; and first argument + (c-forward-sexp 2) + (if (search-forward ":" (c-point 'eol) 'move) + (- (current-column) open-bracket-col + method-arg-len extra) + ; previous arg has no param + (c-get-offset + '(objc-method-arg-unfinished-offset . nil)))))) + + (if (>= arg-ralign-colon-ofs + (c-get-offset '(objc-method-arg-min-delta-to-bracket . nil))) + (+ arg-ralign-colon-ofs extra) + (throw 'no-idea nil)))))) + (defun c-lineup-ObjC-method-args (langelem) - "Line up the colons that separate args. + "Line up the colons that separate args in a method declaration. The colon on the current line is aligned with the one on the first line. @@ -879,7 +922,7 @@ c-basic-offset))))) (defun c-lineup-ObjC-method-args-2 (langelem) - "Line up the colons that separate args. + "Line up the colons that separate args in a method declaration. The colon on the current line is aligned with the one on the previous line. Index: lisp/progmodes/cc-fonts.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-fonts.el,v retrieving revision 1.2.2.9 diff -u -r1.2.2.9 cc-fonts.el --- lisp/progmodes/cc-fonts.el 5 Aug 2005 10:57:29 -0000 1.2.2.9 +++ lisp/progmodes/cc-fonts.el 5 Nov 2005 17:34:17 -0000 @@ -1848,13 +1848,33 @@ '((c-put-char-property (1- (match-end 1)) 'c-type 'c-decl-end))) - c-font-lock-objc-methods) + c-font-lock-objc-methods + + ;; Parts of selector name in messages + ;; PENDING: perhaps should change to only pick up inside brackets + ("\\sw*:" 0 font-lock-function-name-face keep t) + + ;; get argument-less selectors' highlighting right + ;; [[foo _bar_] _baz_] -> bar, baz are highlighted + ("\\(\\sw+\\)[ \t]*[]]" + (1 (let ((non-ws-before-match (char-before + (save-excursion + (goto-char (match-beginning 1)) + ;; expensive! + (c-backward-syntactic-ws (c-point 'bol)) + (point) + )))) + (unless (or (eq ?: non-ws-before-match) + (eq ?\[ non-ws-before-match) + (eq ?> non-ws-before-match)) + font-lock-function-name-face))))) (when (c-lang-const c-opt-access-key) `(,(c-make-font-lock-search-function (c-lang-const c-opt-access-key) '((c-put-char-property (1- (match-end 0)) - 'c-type 'c-decl-end)))))) + 'c-type 'c-decl-end))))) + ) ;; Fontify all declarations and casts. c-font-lock-declarations Index: lisp/progmodes/cc-langs.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-langs.el,v retrieving revision 1.25.2.6 diff -u -r1.25.2.6 cc-langs.el --- lisp/progmodes/cc-langs.el 5 Aug 2005 10:57:29 -0000 1.25.2.6 +++ lisp/progmodes/cc-langs.el 5 Nov 2005 17:34:19 -0000 @@ -1585,7 +1585,7 @@ t nil (c c++) '("NULL" ;; Not a keyword, but practically works as one. "false" "true") ; Defined in C99. - objc '("nil" "Nil") + objc '("nil" "Nil" "YES" "NO" "NS_DURING" "NS_HANDLER" "NS_ENDHANDLER" "ASSIGN" "RELEASE" "AUTORELEASE" "RETAIN" "DESTROY" "CREATE_AUTORELEASE_POOL" "RECREATE_AUTORELEASE_POOL") idl '("TRUE" "FALSE") pike '("UNDEFINED")) ;; Not a keyword, but practically works as one. Index: lisp/progmodes/cc-menus.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-menus.el,v retrieving revision 1.25.2.3 diff -u -r1.25.2.3 cc-menus.el --- lisp/progmodes/cc-menus.el 5 Aug 2005 10:57:28 -0000 1.25.2.3 +++ lisp/progmodes/cc-menus.el 5 Nov 2005 17:34:19 -0000 @@ -330,10 +330,8 @@ 'buffer-substring-no-properties 'buffer-substring))) (goto-char (point-max)) - (imenu-progress-message stupid 0) ;; (while (re-search-backward cc-imenu-objc-generic-expression nil t) - (imenu-progress-message stupid) (setq langnum (if (match-beginning OBJC) OBJC (cond @@ -385,7 +383,6 @@ methodlist) toplist)) methodlist nil)))) ;; - (imenu-progress-message stupid 100) (if (eq (car toplist) nil) (setq toplist (cdr toplist))) Index: lisp/progmodes/cc-vars.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-vars.el,v retrieving revision 1.31.2.5 diff -u -r1.31.2.5 cc-vars.el --- lisp/progmodes/cc-vars.el 5 Aug 2005 10:57:29 -0000 1.31.2.5 +++ lisp/progmodes/cc-vars.el 5 Nov 2005 17:34:21 -0000 @@ -892,6 +892,45 @@ :type 'integer :group 'c) +(defcustom-c-stylevar objc-method-arg-min-delta-to-bracket 2 + "*Minimun number of chars to the opening bracket. + +Consider this ObjC snippet: + + [foo blahBlah: fred + |<-x->|barBaz: barney + +If `x' is less than this number then `c-lineup-ObjC-method-call-colons' +will defer the indentation decision to the next function. By default +this is `c-lineup-ObjC-method-call', which would align it like: + + [foo blahBlahBlah: fred + thisIsTooDamnLong: barney + +This behaviour can be overridden by customizing the indentation of +`objc-method-call-cont' in the \"objc\" style." + :type 'integer + :group 'c) + +(defcustom-c-stylevar objc-method-arg-unfinished-offset 4 + "*Offset relative to bracket if first selector is on a new line. + + [aaaaaaaaa + |<-x->|bbbbbbb: cccccc + ddddd: eeee];" + :type 'integer + :group 'c) + +(defcustom-c-stylevar objc-method-parameter-offset 4 + "*Offset for selector parameter on a new line (relative to first selector. + + [aaaaaaa bbbbbbbbbb: + |<-x->|cccccccc + ddd: eeee + ffff: ggg];" + :type 'integer + :group 'c) + (defcustom c-default-style '((java-mode . "java") (other . "gnu")) "*Style which gets installed by default when a file is visited. @@ -1074,7 +1113,12 @@ ;; Relpos: Boi. (objc-method-args-cont . c-lineup-ObjC-method-args) ;; Relpos: At the method start (always at boi). - (objc-method-call-cont . c-lineup-ObjC-method-call) + (objc-method-call-cont . (c-lineup-ObjC-method-call-colons + c-lineup-ObjC-method-call +)) + ;; Relpos: (used by c-lineup-method-call-colons) + (objc-method-arg-min-delta-to-bracket . *) + (objc-method-arg-unfinished-offset . +) + (objc-method-parameter-offset . +) ;; Relpos: At the open bracket. (extern-lang-open . 0) (namespace-open . 0) Index: man/Makefile.in =================================================================== RCS file: /cvsroot/emacs/emacs/man/Makefile.in,v retrieving revision 1.48.2.10 diff -u -r1.48.2.10 Makefile.in --- man/Makefile.in 19 Sep 2005 10:19:58 -0000 1.48.2.10 +++ man/Makefile.in 5 Nov 2005 17:34:21 -0000 @@ -36,7 +36,7 @@ INFO_TARGETS = ../info/emacs ../info/emacs-xtra ../info/ccmode ../info/cl \ ../info/dired-x ../info/ediff ../info/forms ../info/gnus \ ../info/message ../info/sieve ../info/pgg ../info/emacs-mime \ - ../info/info ../info/mh-e ../info/reftex \ + ../info/info ../info/mh-e ../info/ns-emacs ../info/reftex \ ../info/sc ../info/vip ../info/viper ../info/widget \ ../info/efaq ../info/ada-mode ../info/autotype ../info/calc \ ../info/idlwave ../info/eudc ../info/ebrowse ../info/pcl-cvs \ @@ -45,7 +45,7 @@ ../info/flymake ../info/newsticker DVI_TARGETS = emacs.dvi calc.dvi cc-mode.dvi cl.dvi dired-x.dvi \ ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \ - gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi \ + gnus.dvi message.dvi sieve.dvi pgg.dvi mh-e.dvi ns-emacs.dvi \ reftex.dvi sc.dvi vip.dvi viper.dvi widget.dvi faq.dvi \ ada-mode.dvi autotype.dvi idlwave.dvi eudc.dvi ebrowse.dvi \ pcl-cvs.dvi woman.dvi eshell.dvi org.dvi url.dvi \ @@ -105,7 +105,8 @@ ${srcdir}/gnu.texi \ ${srcdir}/glossary.texi \ ${srcdir}/ack.texi \ - ${srcdir}/kmacro.texi + ${srcdir}/kmacro.texi \ + ${srcdir}/ns-emacs.texi info: $(top_srcdir)/info $(INFO_TARGETS) @@ -220,6 +221,11 @@ cd $(srcdir); $(MAKEINFO) mh-e.texi mh-e.dvi: mh-e.texi $(ENVADD) $(TEXI2DVI) ${srcdir}/mh-e.texi + +../info/ns-emacs: ns-emacs.texi + cd $(srcdir); $(MAKEINFO) ns-emacs.texi +ns-emacs.dvi: ns-emacs.texi + $(ENVADD) $(TEXI2DVI) ${srcdir}/ns-emacs.texi ../info/reftex: reftex.texi cd $(srcdir); $(MAKEINFO) reftex.texi Index: src/Makefile.in =================================================================== RCS file: /cvsroot/emacs/emacs/src/Makefile.in,v retrieving revision 1.279.2.22 diff -u -r1.279.2.22 Makefile.in --- src/Makefile.in 19 Sep 2005 10:20:26 -0000 1.279.2.22 +++ src/Makefile.in 5 Nov 2005 17:34:23 -0000 @@ -282,8 +282,15 @@ /* C_SWITCH_X_SITE must come before C_SWITCH_X_MACHINE and C_SWITCH_X_SYSTEM since it may have -I options that should override those two. */ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcdir} C_SWITCH_MACHINE C_SWITCH_SYSTEM C_SWITCH_SITE C_SWITCH_X_SITE C_SWITCH_X_MACHINE C_SWITCH_X_SYSTEM C_SWITCH_SYSTEM_TEMACS ${CFLAGS} +.SUFFIXES: .m .c.o: $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< +.m.o: +#ifdef GNUSTEP + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString $< +#else + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< +#endif #ifndef LIBX10_MACHINE #define LIBX10_MACHINE @@ -305,13 +312,8 @@ #define LIB_X11_LIB -lX11 #endif -/* xmenu.c should not be compiled on OSX. */ -#ifndef HAVE_CARBON -XMENU_OBJ = xmenu.o -#endif - #ifdef HAVE_X_WINDOWS - +XMENU_OBJ = xmenu.o XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o #ifdef HAVE_MENUS @@ -574,6 +576,20 @@ emacsappsrc = ${srcdir}/../mac/Emacs.app/ #endif +#ifdef HAVE_NS +/* Object files for NeXTstep */ +NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o \ + fontset.o fringe.o image.o +emacsapp = $(PWD)/$(dot)$(dot)/nextstep/build/Emacs.app/ +#ifdef GNUSTEP +emacsappsrc = ${srcdir}/$(dot)$(dot)/nextstep/GNUstep/Emacs.base +emacsbindir = $(emacsapp) +#else +emacsappsrc = ${srcdir}/$(dot)$(dot)/nextstep/Cocoa/Emacs.base +emacsbindir = $(emacsapp)/Contents/MacOS/ +#endif +#endif + /* lastfile must follow all files whose initialized data areas should be dumped as pure by dump-emacs. */ obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \ @@ -589,14 +605,15 @@ process.o callproc.o \ region-cache.o sound.o atimer.o \ doprnt.o strftime.o intervals.o textprop.o composite.o md5.o \ - $(MSDOS_OBJ) $(MAC_OBJ) $(CYGWIN_OBJ) + $(MSDOS_OBJ) $(MAC_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) /* Object files used on some machine or other. These go in the DOC file on all machines in case they are needed there. */ SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ - xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ - mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \ + xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o fontset.o \ + mac.o macterm.o macfns.o macmenu.o macselect.o \ + nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o \ w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o @@ -884,10 +901,42 @@ Note that SunOS needs -lm to come before -lc; otherwise, you get duplicated symbols. If the standard libraries were compiled with GCC, we might need gnulib again after them. */ + +#ifdef GNUSTEP +/* Pull in stuff from GNUstep-make. If you want to rewrite this to actually + _invoke_ gnustep-make, go right ahead! */ +FOUNDATION_LIB = gnu +GUI_LIB = gnu +include $(GNUSTEP_MAKEFILES)/Additional/base.make +include $(GNUSTEP_MAKEFILES)/Additional/gui.make +shared=no + +/* Drop STD_LIB off the link line. */ +LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) \ + LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ + LIBS_DEBUG $(GETLOADAVG_LIBS) $(GNULIB_VAR) LIB_MATH $(GNULIB_VAR) + +/* LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP LIBS_DEBUG \ + -L$(GNUSTEP_SYSTEM_ROOT)/Library/Libraries -lgnustep-gui -lgnustep-base \ + -lobjc $(CONFIG_SYSTEM_LIBS) */ + +/* HACK: for some reason pthread is not specified in base.make for freebad */ +#ifdef __FreeBSD__ +LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) \ + LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ + LIBS_DEBUG $(GETLOADAVG_LIBS) $(GNULIB_VAR) LIB_MATH $(GNULIB_VAR) -lpthread + +/* LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP LIBS_DEBUG \ + -L$(GNUSTEP_SYSTEM_ROOT)/Library/Libraries -lgnustep-gui -lgnustep-base \ + -lobjc $(CONFIG_SYSTEM_LIBS) -lpthread */ +#endif +#else /* !GNUSTEP */ + LIBES = $(LOADLIBES) $(LIBS) $(LIBX) $(LIBSOUND) \ LIBS_SYSTEM LIBS_MACHINE LIBS_TERMCAP \ LIBS_DEBUG $(GETLOADAVG_LIBS) $(GNULIB_VAR) LIB_MATH LIB_STANDARD \ $(GNULIB_VAR) +#endif /* Enable recompilation of certain other files depending on system type. */ @@ -914,7 +963,10 @@ #else LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump #endif /* ! defined (CANNOT_DUMP) */ +/* XXX: not working under NS currently due to path shenanigans.. */ +#ifndef HAVE_NS -./emacs -q -batch -f list-load-path-shadows +#endif /* We run make-docfile twice because the command line may get too long on some systems. */ @@ -949,9 +1001,13 @@ temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst +#ifdef GNUSTEP + $(CC) -rdynamic YMF_PASS_LDFLAGS (${TEMACS_LDFLAGS}) -o temacs ${obj} ${otherobj} OBJECTS_MACHINE ${LIBES} +#else $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ -o temacs ${STARTFILES} ${obj} ${otherobj} \ OBJECTS_MACHINE ${LIBES} +#endif /* We don't use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE often contain options that have to do with using Emacs's crt0, @@ -1107,7 +1163,8 @@ charset.h frame.h keyboard.h $(config_h) getloadavg.o: getloadavg.c $(config_h) image.o: image.c frame.h window.h dispextern.h blockinput.h atimer.h \ - systime.h xterm.h w32term.h w32gui.h macterm.h macgui.h $(config_h) + systime.h xterm.h w32term.h w32gui.h macterm.h macgui.h \ + nsterm.h nsgui.h $(config_h) indent.o: indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h \ termopts.h disptab.h region-cache.h character.h category.h composite.h \ dispextern.h keyboard.h @@ -1116,7 +1173,8 @@ keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \ commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \ systty.h systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \ - atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h) + atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h nsterm.h \ + $(config_h) keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ atimer.h systime.h puresize.h character.h intervals.h $(config_h) lastfile.o: lastfile.c $(config_h) @@ -1170,15 +1228,16 @@ $(srcdir)/../lwlib/lwlib.h $(config_h) window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \ termhooks.h disptab.h keyboard.h dispextern.h msdos.h composite.h \ - keymap.h blockinput.h $(INTERVAL_SRC) xterm.h w32term.h macterm.h $(config_h) + keymap.h blockinput.h $(INTERVAL_SRC) xterm.h w32term.h macterm.h nsterm.h \ + $(config_h) xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \ coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \ charset.h keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h w32term.h \ - macterm.h $(config_h) msdos.h composite.h fontset.h blockinput.h atimer.h \ - systime.h keymap.h + macterm.h nsterm.h $(config_h) msdos.h composite.h fontset.h blockinput.h \ + atimer.h systime.h keymap.h xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \ window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h \ - systime.h keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) \ + systime.h keyboard.h fontset.h w32term.h macterm.h nsterm.h $(INTERVAL_SRC) \ $(config_h) xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \ $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \ @@ -1281,7 +1340,37 @@ /Developer/Tools/Rez -useDF \ -o ${emacsapp}Contents/Resources/Emacs.rsrc \ /System/Library/Frameworks/Carbon.framework/Headers/Carbon.r $< -#endif + +#endif /* HAVE_CARBON */ + +#ifdef HAVE_NS +abbrev.o buffer.o callint.o cmds.o dispnew.o editfns.o fileio.o frame.o \ + fontset.o indent.o insdel.o keyboard.o macros.o minibuf.o msdos.o process.o \ + scroll.o sysdep.o term.o widget.o window.o xdisp.o xfaces.o xfns.o xmenu.o \ + xterm.o xselect.o sound.o: nsgui.h +nsfns.o: nsfns.m charset.h nsterm.h nsgui.h frame.h window.h buffer.h \ + dispextern.h nsgui.h fontset.h $(INTERVAL_SRC) keyboard.h blockinput.h \ + atimer.h systime.h epaths.h termhooks.h coding.h systime.h $(config_h) +nsmenu.o: nsmenu.m termhooks.h frame.h window.h dispextern.h nsgui.h \ + keyboard.h blockinput.h atimer.h systime.h buffer.h nsterm.h $(config_h) +nsterm.o: nsterm.m blockinput.h atimer.h systime.h syssignal.h nsterm.h \ + nsgui.h frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h \ + termopts.h termchar.h gnu.h disptab.h buffer.h window.h keyboard.h \ + $(INTERVAL_SRC) process.h coding.h $(config_h) +nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h $(config_h) +nsimage.o: nsimage.m nsterm.h + +${emacsapp}: ${emacsappsrc} + mkdir -p ${emacsapp} + ( cd ${emacsappsrc} ; tar cfh - . ) | ( cd ${emacsapp} ; tar xf - ) + +${emacsbindir}Emacs: emacs${EXEEXT} + mkdir -p ${emacsbindir} + cp -f emacs${EXEEXT} ${emacsbindir}Emacs + +ns-app: ${emacsapp} ${emacsbindir}Emacs + +#endif /* HAVE_NS */ ${libsrc}emacstool${EXEEXT}: ${libsrc}emacstool.c cd ${libsrc}; ${MAKE} ${MFLAGS} emacstool${EXEEXT} Index: src/alloc.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/alloc.c,v retrieving revision 1.318.2.24 diff -u -r1.318.2.24 alloc.c --- src/alloc.c 7 Oct 2005 07:15:09 -0000 1.318.2.24 +++ src/alloc.c 5 Nov 2005 17:34:26 -0000 @@ -1232,7 +1232,11 @@ BLOCK_INPUT_ALLOC; __malloc_hook = old_malloc_hook; #ifdef DOUG_LEA_MALLOC +#ifndef GNUSTEP + /* The repeated calls to this seem to mess something up in conjunction + with objc's allocation and eventually cause a segfault here. */ mallopt (M_TOP_PAD, malloc_hysteresis * 4096); +#endif #else __malloc_extra_blocks = malloc_hysteresis; #endif Index: src/config.in =================================================================== RCS file: /cvsroot/emacs/emacs/src/config.in,v retrieving revision 1.190.2.15 diff -u -r1.190.2.15 config.in --- src/config.in 11 Sep 2005 22:20:58 -0000 1.190.2.15 +++ src/config.in 5 Nov 2005 17:34:27 -0000 @@ -102,6 +102,9 @@ /* Define to 1 if you are using the Carbon API on Mac OS X. */ #undef HAVE_CARBON +/* Define if you want to use NeXTStep instead of or in addition to X windows. */ +#undef HAVE_NS + /* Define to 1 if you have the `cbrt' function. */ #undef HAVE_CBRT @@ -896,20 +899,30 @@ #undef volatile -/* If we're using any sort of window system, define some consequences. */ +/* If we're using X11, define some consequences. */ +/* ABR: can the redundancy with ../configure.in be removed? */ #ifdef HAVE_X_WINDOWS #define HAVE_WINDOW_SYSTEM #define MULTI_KBOARD #define HAVE_MOUSE #endif -/* If we're using the Carbon API on Mac OS X, define a few more - variables as well. */ +/* Likewise if we're using the Carbon API on Mac OS X. */ #ifdef HAVE_CARBON #define HAVE_WINDOW_SYSTEM #define HAVE_MOUSE #endif +/* If we're using NeXTstep, define some consequences. */ +#ifdef HAVE_NS +#define HAVE_WINDOW_SYSTEM +#define MULTI_KBOARD +#define HAVE_MOUSE +/* PENDING: These are used tor the Carbon port only. */ +#undef MAC_OS +#undef MAC_OSX +#endif + /* Define USER_FULL_NAME to return a string that is the user's full name. It can assume that the variable `pw' @@ -958,6 +971,19 @@ /* Include the os and machine dependent files. */ #include config_opsysfile #include config_machfile + +/* Set up C and LD flags for NeXTstep interface on GNUstep. + (There's probably a better place to do this, but right now the Cocoa + side does this in s/darwin.h, following the Carbon port, and we can't + parallel this exactly since GNUstep is multi-OS. */ +#if defined (HAVE_NS) && defined (GNUSTEP) +/* Note: These come from a run of GNUstep "make messages=yes" on + a Linux system. TODO: make sure this is general enough (or tap into + gnustep-make if not, and also take out any unnecessary ones). */ +#define C_SWITCH_X_SYSTEM -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -D_REENTRANT -fPIC -DGSWARN -DGSDIAGNOSE -fno-strict-aliasing +#define LD_SWITCH_SITE -L$(GNUSTEP_SYSTEM_ROOT)/Library/Libraries -lgnustep-gui -lgnustep-base -lobjc $(CONFIG_SYSTEM_LIBS) -lpthread +#define OTHER_FILES ns-app +#endif /* Load in the conversion definitions if this system needs them and the source file being compiled has not Index: src/dispextern.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/dispextern.h,v retrieving revision 1.153.4.27 diff -u -r1.153.4.27 dispextern.h --- src/dispextern.h 15 Oct 2005 00:25:54 -0000 1.153.4.27 +++ src/dispextern.h 5 Nov 2005 17:34:29 -0000 @@ -70,6 +70,14 @@ typedef XImagePtr XImagePtr_or_DC; #endif +#ifdef HAVE_NS +#include "nsgui.h" +// the following typedef needed to accomodate the MSDOS port, believe it or not +typedef struct ns_display_info Display_Info; +typedef Pixmap XImagePtr; +typedef XImagePtr XImagePtr_or_DC; +#endif + #ifndef NativeRectangle #define NativeRectangle int #endif @@ -461,7 +469,7 @@ #define SET_CHAR_GLYPH_FROM_GLYPH(GLYPH, FROM) \ SET_CHAR_GLYPH ((GLYPH), \ - FAST_GLYPH_CHAR ((FROM)), \ + FAST_GLYPH_CHAR ((FROM)), \ FAST_GLYPH_FACE ((FROM)), \ 0) @@ -2147,7 +2155,7 @@ /* Call produce_glyphs or produce_glyphs_hook, if set. Shortcut to avoid the function call overhead. */ -#define PRODUCE_GLYPHS(IT) \ +#define PRODUCE_GLYPHS(IT) \ do { \ extern int inhibit_free_realized_faces; \ if (rif != NULL) \ Index: src/dispnew.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/dispnew.c,v retrieving revision 1.318.2.19 diff -u -r1.318.2.19 dispnew.c --- src/dispnew.c 15 Oct 2005 00:25:54 -0000 1.318.2.19 +++ src/dispnew.c 5 Nov 2005 17:34:34 -0000 @@ -65,6 +65,10 @@ #include "macterm.h" #endif /* MAC_OS */ +#ifdef HAVE_NS +#include "nsterm.h" +#endif + /* Include systime.h after xterm.h to avoid double inclusion of time.h. */ #include "systime.h" @@ -6687,6 +6691,15 @@ return; } #endif /* MAC_OS */ + +#ifdef HAVE_NS + if (!inhibit_window_system /*&& display_arg == output_ns*/) + { + Vwindow_system = intern("ns"); + Vwindow_system_version = make_number(9); + return; + } +#endif /* If no window system has been specified, try to use the terminal. */ if (! isatty (0)) Index: src/emacs.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/emacs.c,v retrieving revision 1.328.4.27 diff -u -r1.328.4.27 emacs.c --- src/emacs.c 15 Oct 2005 00:25:55 -0000 1.328.4.27 +++ src/emacs.c 5 Nov 2005 17:34:36 -0000 @@ -190,7 +190,7 @@ extern int inherited_pgroup; #endif -#ifdef HAVE_X_WINDOWS +#if defined(HAVE_X_WINDOWS) || defined(HAVE_NS) /* If non-zero, -d was specified, meaning we're using some window system. */ int display_arg; #endif @@ -1428,6 +1428,38 @@ no_loadup = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); +#ifdef HAVE_NS + ns_alloc_autorelease_pool(); + if (!noninteractive) + { + char *tmp; + display_arg = 4; +#ifdef COCOA + if (skip_args < argc) + { + if (!strncmp(argv[skip_args], "-psn", 4)) + { + skip_args += 1; + } + else + { + if (skip_args+1 < argc && !strncmp(argv[skip_args+1], "-psn", 4)) + skip_args += 2; + } + } +#endif + /* This used for remote operation.. not fully implemented yet. */ + if (argmatch (argv, argc, "-_NSMachLaunch", 0, 3, &tmp, &skip_args)) + display_arg = 4; + else if (argmatch (argv, argc, "-MachLaunch", 0, 3, &tmp, &skip_args)) + display_arg = 4; + else if (argmatch (argv, argc, "-macosx", 0, 2, NULL, &skip_args)) + display_arg = 4; + else if (argmatch (argv, argc, "-NSHost", 0, 3, &tmp, &skip_args)) + display_arg = 4; + } +#endif /* HAVE_NS */ + #ifdef HAVE_X_WINDOWS /* Stupid kludge to catch command-line display spec. We can't @@ -1506,6 +1538,13 @@ init_mac_osx_environment (); #endif +#ifdef HAVE_NS +#ifndef CANNOT_DUMP + if (initialized) +#endif + ns_init_paths (); +#endif + /* egetenv is a pretty low-level facility, which may get called in many circumstances; it seems flimsy to put off initializing it until calling init_callproc. */ @@ -1630,12 +1669,10 @@ #endif #endif /* HAVE_X_WINDOWS */ -#ifndef HAVE_NTGUI -#ifndef MAC_OS +#if !defined (HAVE_NTGUI) && !defined (MAC_OS) && !defined (HAVE_NS) /* Called before init_window_once for Mac OS Classic. */ syms_of_xmenu (); #endif -#endif #ifdef HAVE_NTGUI syms_of_w32term (); @@ -1653,6 +1690,14 @@ syms_of_fontset (); #endif /* MAC_OSX && HAVE_CARBON */ +#ifdef HAVE_NS + syms_of_nsterm (); + syms_of_nsfns (); + syms_of_nsmenu (); + syms_of_nsselect (); + syms_of_fontset (); +#endif /* HAVE_NS */ + #ifdef SYMS_SYSTEM SYMS_SYSTEM; #endif @@ -1867,6 +1912,14 @@ { "-hb", "--horizontal-scroll-bars", 5, 0 }, { "-vb", "--vertical-scroll-bars", 5, 0 }, { "-color", "--color", 5, 0}, +#ifdef HAVE_NS + { "-NSAutoLaunch", 0, 5, 1 }, + { "-NXAutoLaunch", 0, 5, 1 }, + { "-_NSMachLaunch", 0, 85, 1 }, + { "-MachLaunch", 0, 85, 1 }, + { "-macosx", 0, 85, 0 }, + { "-NSHost", 0, 85, 1 }, +#endif /* These have the same priority as ordinary file name args, so they are not reordered with respect to those. */ { "-L", "--directory", 0, 1 }, @@ -1882,6 +1935,12 @@ { "-visit", "--visit", 0, 1 }, { "-file", "--file", 0, 1 }, { "-insert", "--insert", 0, 1 }, +#ifdef HAVE_NS + { "-NXOpen", 0, 0, 1 }, + { "-NXOpenTemp", 0, 0, 1 }, + { "-NSOpen", 0, 0, 1 }, + { "-NSOpenTemp", 0, 0, 1 }, +#endif /* This should be processed after ordinary file name args and the like. */ { "-kill", "--kill", -10, 0 }, }; @@ -2172,6 +2231,10 @@ #ifdef MSDOS dos_cleanup (); +#endif + +#ifdef HAVE_NS + ns_term_shutdown (); #endif } Index: src/fns.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/fns.c,v retrieving revision 1.342.2.29 diff -u -r1.342.2.29 fns.c --- src/fns.c 30 Sep 2005 11:43:35 -0000 1.342.2.29 +++ src/fns.c 5 Nov 2005 17:34:39 -0000 @@ -4179,7 +4179,7 @@ /* Remove the entry matching KEY from hash table H, if there is one. */ void -hash_remove (h, key) +emacs_hash_remove (h, key) struct Lisp_Hash_Table *h; Lisp_Object key; { @@ -4839,7 +4839,7 @@ Lisp_Object key, table; { struct Lisp_Hash_Table *h = check_hash_table (table); - hash_remove (h, key); + emacs_hash_remove (h, key); return Qnil; } Index: src/frame.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/frame.c,v retrieving revision 1.300.2.18 diff -u -r1.300.2.18 frame.c --- src/frame.c 15 Oct 2005 00:25:56 -0000 1.300.2.18 +++ src/frame.c 5 Nov 2005 17:34:42 -0000 @@ -33,6 +33,9 @@ #ifdef MAC_OS #include "macterm.h" #endif +#ifdef HAVE_NS +#include "nsterm.h" +#endif #include "buffer.h" /* These help us bind and responding to switch-frame events. */ #include "commands.h" @@ -67,7 +70,7 @@ Lisp_Object Qframep, Qframe_live_p; Lisp_Object Qicon, Qmodeline; Lisp_Object Qonly; -Lisp_Object Qx, Qw32, Qmac, Qpc; +Lisp_Object Qx, Qw32, Qmac, Qpc, Qns; Lisp_Object Qvisible; Lisp_Object Qdisplay_type; Lisp_Object Qbackground_mode; @@ -193,7 +196,8 @@ Value is t for a termcap frame (a character-only terminal), `x' for an Emacs frame that is really an X window, `w32' for an Emacs frame that is a window on MS-Windows display, -`mac' for an Emacs frame on a Macintosh display, +`mac' for an Emacs frame on a Macintosh 8/9 X-Carbon display, +`ns' for an Emacs frame on a GNUstep or Macintosh Cocoa display, `pc' for a direct-write MS-DOS frame. See also `frame-live-p'. */) (object) @@ -213,6 +217,8 @@ return Qpc; case output_mac: return Qmac; + case output_ns: + return Qns; default: abort (); } @@ -2723,8 +2729,9 @@ old_value = get_frame_param (f, prop); fullscreen_is_being_set |= EQ (prop, Qfullscreen); - +#ifndef HAVE_NS //PENDING: ensure font attrs change goes through if (NILP (Fequal (val, old_value))) +#endif { store_frame_param (f, prop, val); @@ -2989,7 +2996,6 @@ : FRAME_ICONIFIED_P (f) ? Qicon : Qnil)); store_in_alist (alistptr, Qdisplay, XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); - if (FRAME_X_OUTPUT (f)->parent_desc == FRAME_X_DISPLAY_INFO (f)->root_window) tem = Qnil; else @@ -3544,6 +3550,9 @@ case RES_TYPE_BOOLEAN: tem = Fdowncase (tem); if (!strcmp (SDATA (tem), "on") +#ifdef HAVE_NS + || !strcmp(SDATA(tem), "yes") +#endif || !strcmp (SDATA (tem), "true")) return Qt; else @@ -3559,9 +3568,15 @@ Lisp_Object lower; lower = Fdowncase (tem); if (!strcmp (SDATA (lower), "on") +#ifdef HAVE_NS + || !strcmp(SDATA(lower), "yes") +#endif || !strcmp (SDATA (lower), "true")) return Qt; else if (!strcmp (SDATA (lower), "off") +#ifdef HAVE_NS + || !strcmp(SDATA(lower), "no") +#endif || !strcmp (SDATA (lower), "false")) return Qnil; else @@ -3959,6 +3974,8 @@ staticpro (&Qpc); Qmac = intern ("mac"); staticpro (&Qmac); + Qns = intern ("ns"); + staticpro (&Qns); Qvisible = intern ("visible"); staticpro (&Qvisible); Qbuffer_predicate = intern ("buffer-predicate"); Index: src/frame.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/frame.h,v retrieving revision 1.103.2.7 diff -u -r1.103.2.7 frame.h --- src/frame.h 11 Sep 2005 22:20:59 -0000 1.103.2.7 +++ src/frame.h 5 Nov 2005 17:34:43 -0000 @@ -48,7 +48,8 @@ output_x_window, output_msdos_raw, output_w32, - output_mac + output_mac, + output_ns }; enum vertical_scroll_bar_type @@ -68,7 +69,8 @@ HBAR_CURSOR }; -#if !defined(MSDOS) && !defined(WINDOWSNT) && !defined(MAC_OS) +#if !defined(MSDOS) && !defined(WINDOWSNT) && !defined(MAC_OS) && \ + !defined(HAVE_NS) #if !defined(HAVE_X_WINDOWS) @@ -91,7 +93,7 @@ /* A structure describing a termcap frame display. */ extern struct x_output tty_display; -#endif /* ! MSDOS && ! WINDOWSNT && ! MAC_OS */ +#endif /* ! MSDOS && ! WINDOWSNT && ! MAC_OS && !HAVE_NS */ struct frame { @@ -296,6 +298,7 @@ struct x_output *x; struct w32_output *w32; struct mac_output *mac; + struct ns_output *ns; EMACS_INT nothing; } output_data; @@ -324,7 +327,7 @@ int menu_bar_lines; #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined (HAVE_NS) || defined (USE_GTK) /* Nonzero means using a menu bar that comes from the X toolkit. */ int external_menu_bar; #endif @@ -493,6 +496,7 @@ #define FRAME_W32_P(f) ((f)->output_method == output_w32) #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw) #define FRAME_MAC_P(f) ((f)->output_method == output_mac) +#define FRAME_NS_P(f) ((f)->output_method == output_ns) /* FRAME_WINDOW_P tests whether the frame is a window, and is defined to be the predicate for the window system being used. */ @@ -506,6 +510,9 @@ #ifdef MAC_OS #define FRAME_WINDOW_P(f) FRAME_MAC_P (f) #endif +#ifdef HAVE_NS +#define FRAME_WINDOW_P(f) FRAME_NS_P(f) +#endif #ifndef FRAME_WINDOW_P #define FRAME_WINDOW_P(f) (0) #endif @@ -563,7 +570,7 @@ /* Nonzero if this frame should display a menu bar in a way that does not use any text lines. */ #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined (HAVE_NS) || defined (USE_GTK) #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar #else #define FRAME_EXTERNAL_MENU_BAR(f) 0 Index: src/fringe.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/fringe.c,v retrieving revision 1.10.2.14 diff -u -r1.10.2.14 fringe.c --- src/fringe.c 26 Aug 2005 09:48:54 -0000 1.10.2.14 +++ src/fringe.c 5 Nov 2005 17:34:43 -0000 @@ -450,7 +450,7 @@ static Lisp_Object *fringe_faces; static int max_fringe_bitmaps; -static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; +int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; /* Lookup bitmap number for symbol BITMAP. Index: src/getloadavg.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/getloadavg.c,v retrieving revision 1.46.2.3 diff -u -r1.46.2.3 getloadavg.c --- src/getloadavg.c 26 Aug 2005 09:48:46 -0000 1.46.2.3 +++ src/getloadavg.c 5 Nov 2005 17:34:45 -0000 @@ -419,7 +419,7 @@ # define host_self mach_host_self # endif -# ifdef NeXT +# if defined(NeXT) || defined(RHAPSODY) || defined(DARWIN) || defined(MAC_OSX) # ifdef HAVE_MACH_MACH_H # include # else @@ -466,7 +466,7 @@ /* Avoid static vars inside a function since in HPUX they dump as pure. */ -# ifdef NeXT +# if defined(NeXT) || defined(RHAPSODY) || defined(DARWIN) || defined(MAC_OSX) static processor_set_t default_set; static int getloadavg_initialized; # endif /* NeXT */ @@ -646,7 +646,8 @@ # endif /* __NetBSD__ */ -# if !defined (LDAV_DONE) && defined (NeXT) +# if !defined (LDAV_DONE) && ( defined (NeXT) || defined(RHAPSODY) \ + || defined(DARWIN) || defined(MAC_OSX) ) # define LDAV_DONE /* The NeXT code was adapted from iscreen 3.2. */ Index: src/image.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/image.c,v retrieving revision 1.6.4.21 diff -u -r1.6.4.21 image.c --- src/image.c 15 Oct 2005 00:25:54 -0000 1.6.4.21 +++ src/image.c 5 Nov 2005 17:34:49 -0000 @@ -126,6 +126,33 @@ #endif /* MAC_OS */ +#ifdef HAVE_NS +#include "nsterm.h" +#include +#include + +#undef COLOR_TABLE_SUPPORT + +#define x_defined_color ns_defined_color +#define FRAME_X_SCREEN(f) 0 +#define DefaultDepthOfScreen(screen) ns_display_list->n_planes + +typedef struct ns_bitmap_record Bitmap_Record; + +///TODO +#define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y) +#define NO_PIXMAP 0 + +#define RGB_PIXEL_COLOR unsigned long +#define ZPixmap 0 + +#define PIX_MASK_RETAIN 0 +#define PIX_MASK_DRAW 1 + +#define FRAME_X_VISUAL FRAME_NS_DISPLAY_INFO(f)->visual +#endif /* HAVE_NS */ + + /* Search path for bitmap files. */ Lisp_Object Vx_bitmap_file_path; @@ -274,6 +301,23 @@ } #endif /* MAC_OS */ +#ifdef HAVE_NS +XImagePtr +XGetImage (Display *display, Pixmap pixmap, int x, int y, + unsigned int width, unsigned int height, + unsigned long plane_mask, int format) +{ + return pixmap; +} + +// stubs.. not sure if this is easy with NSImage.. +unsigned long +XGetPixel (XImagePtr ximage, int x, int y) { return 1; } + +void +XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel) { } +#endif /* HAVE_NS */ + /* Functions to access the contents of a bitmap, given an id. */ @@ -390,6 +434,12 @@ return -1; #endif +#ifdef HAVE_NS + void *bitmap = ns_image_from_XBM(bits, width, height); + if (!bitmap) + return -1; +#endif + id = x_allocate_bitmap_record (f); #ifdef MAC_OS dpyinfo->bitmaps[id - 1].bitmap_data = (char *) xmalloc (height * width); @@ -398,6 +448,11 @@ bcopy (bits, dpyinfo->bitmaps[id - 1].bitmap_data, height * width); #endif /* MAC_OS */ +#ifdef HAVE_NS + dpyinfo->bitmaps[id - 1].img = bitmap; + dpyinfo->bitmaps[id - 1].depth = 1; +#endif + dpyinfo->bitmaps[id - 1].file = NULL; dpyinfo->bitmaps[id - 1].height = height; dpyinfo->bitmaps[id - 1].width = width; @@ -425,6 +480,8 @@ struct frame *f; Lisp_Object file; { + Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + #ifdef MAC_OS return -1; /* MAC_TODO : bitmap support */ #endif /* MAC_OS */ @@ -433,8 +490,26 @@ return -1; /* W32_TODO : bitmap support */ #endif /* HAVE_NTGUI */ +#ifdef HAVE_NS + int id; + void *bitmap = ns_image_from_file(file); + + if (!bitmap) + return -1; + + + id = x_allocate_bitmap_record (f); + dpyinfo->bitmaps[id - 1].img = bitmap; + dpyinfo->bitmaps[id - 1].refcount = 1; + dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1); + dpyinfo->bitmaps[id - 1].depth = 1; + dpyinfo->bitmaps[id - 1].height = ns_image_width(bitmap); + dpyinfo->bitmaps[id - 1].width = ns_image_height(bitmap); + strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file)); + return id; +#endif + #ifdef HAVE_X_WINDOWS - Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); unsigned int width, height; Pixmap bitmap; int xhot, yhot, result, id; @@ -503,6 +578,10 @@ bm->bitmap_data = NULL; #endif /* MAC_OS */ +#ifdef HAVE_NS + ns_release_object(bm->img); +#endif + if (bm->file) { xfree (bm->file); @@ -1206,7 +1285,8 @@ because a typical font is `top-heavy' (due to the presence uppercase letters), so the image placement should err towards being top-heavy too. It also just generally looks better. */ - ascent = (height + face->font->ascent - face->font->descent + 1) / 2; + ascent = (height + FONT_BASE(face->font) - FONT_DESCENT(face->font) + + 1) / 2; #endif /* HAVE_NTGUI */ } else @@ -1264,6 +1344,14 @@ #define Free_Pixmap(display, pixmap) \ DeleteObject (pixmap) +#elif defined (HAVE_NS) + +#define Destroy_Image(ximg, dummy) \ + ns_release_object(ximg) + +#define Free_Pixmap(display, pixmap) \ + ns_release_object(pixmap) + #else #define Destroy_Image(ximg, dummy) \ @@ -1272,7 +1360,7 @@ #define Free_Pixmap(display, pixmap) \ XFreePixmap (display, pixmap) -#endif /* HAVE_NTGUI */ +#endif /* !HAVE_NTGUI && !HAVE_NS */ /* Return the `background' field of IMG. If IMG doesn't have one yet, @@ -1343,7 +1431,7 @@ #ifndef HAVE_NTGUI mask = XGetImage (FRAME_X_DISPLAY (f), img->mask, 0, 0, img->width, img->height, ~0, ZPixmap); -#else +#else /* HAVE_NTGUI */ HDC frame_dc = get_frame_dc (f); mask = CreateCompatibleDC (frame_dc); release_frame_dc (f, frame_dc); @@ -2065,6 +2153,12 @@ return 1; #endif /* MAC_OS */ + +#ifdef HAVE_NS +/* PENDING: editable pixmap support -- use NSBitmapImageRep and + getBitmapDataPlanes: . */ + return 0; +#endif } @@ -2090,6 +2184,9 @@ #ifdef MAC_OS XDestroyImage (ximg); #endif /* MAC_OS */ +#ifdef HAVE_NS + ns_release_object(ximg); +#endif /* HAVE_NS */ } } @@ -2918,6 +3015,10 @@ /* If colors were specified, transfer the bitmap to a color one. */ if (non_default_colors) convert_mono_to_color_image (f, img, fg, bg); + +#elif defined (HAVE_NS) + img->pixmap = ns_image_from_XBM(data, img->width, img->height); + #else img->pixmap = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f), @@ -2926,7 +3027,7 @@ img->width, img->height, fg, bg, DefaultDepthOfScreen (FRAME_X_SCREEN (f))); -#endif /* HAVE_NTGUI */ +#endif /* !HAVE_NTGUI && !HAVE_NS */ } @@ -3302,7 +3403,7 @@ static int xpm_load P_ ((struct frame *f, struct image *img)); static int xpm_valid_color_symbols_p P_ ((Lisp_Object)); -#endif /* HAVE_XPM || MAC_OS */ +#endif /* HAVE_XPM || MAC_OS*/ #ifdef HAVE_XPM #ifdef HAVE_NTGUI @@ -5022,6 +5123,7 @@ GC gc; #ifdef MAC_OS +#ifndef HAVE_NS //PENDING: NS image support #define XCreateGC_pixmap(dpy, pixmap) XCreateGC (dpy, NULL, 0, NULL) #define MaskForeground(f) PIX_MASK_DRAW #else @@ -5047,6 +5149,7 @@ img->width - 1, 0); XFreeGC (dpy, gc); } +#endif /* !HAVE_NS */ #else HDC hdc, bmpdc; HGDIOBJ prev; @@ -5589,7 +5692,7 @@ PNG ***********************************************************************/ -#if defined (HAVE_PNG) || defined (MAC_OS) +#if defined (HAVE_PNG) || defined (MAC_OS) || defined (HAVE_NS) /* Function prototypes. */ @@ -5661,7 +5764,7 @@ return fmt[PNG_FILE].count + fmt[PNG_DATA].count == 1; } -#endif /* HAVE_PNG || MAC_OS */ +#endif /* HAVE_PNG || MAC_OS || HAVE_NS */ #ifdef HAVE_PNG @@ -6245,6 +6348,17 @@ } #endif /* MAC_OS */ +#ifdef HAVE_NS +static int +png_load (struct frame *f, struct image *img) +{ + return ns_load_image(f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); +} +#endif /* HAVE_NS */ + + #endif /* !HAVE_PNG */ @@ -6253,7 +6367,7 @@ JPEG ***********************************************************************/ -#if defined (HAVE_JPEG) || defined (MAC_OS) +#if defined (HAVE_JPEG) || defined (MAC_OS) || defined (HAVE_NS) static int jpeg_image_p P_ ((Lisp_Object object)); static int jpeg_load P_ ((struct frame *f, struct image *img)); @@ -6324,7 +6438,7 @@ return fmt[JPEG_FILE].count + fmt[JPEG_DATA].count == 1; } -#endif /* HAVE_JPEG || MAC_OS */ +#endif /* HAVE_JPEG || MAC_OS || HAVE_NS */ #ifdef HAVE_JPEG @@ -6815,6 +6929,16 @@ } #endif /* MAC_OS */ +#ifdef HAVE_NS +static int +jpeg_load (struct frame *f, struct image *img) +{ + return ns_load_image(f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); +} +#endif /* HAVE_NS */ + #endif /* !HAVE_JPEG */ @@ -6823,7 +6947,7 @@ TIFF ***********************************************************************/ -#if defined (HAVE_TIFF) || defined (MAC_OS) +#if defined (HAVE_TIFF) || defined (MAC_OS) || defined (HAVE_NS) static int tiff_image_p P_ ((Lisp_Object object)); static int tiff_load P_ ((struct frame *f, struct image *img)); @@ -6893,7 +7017,7 @@ return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1; } -#endif /* HAVE_TIFF || MAC_OS */ +#endif /* HAVE_TIFF || MAC_OS || HAVE_NS */ #ifdef HAVE_TIFF @@ -7228,6 +7352,16 @@ } #endif /* MAC_OS */ +#ifdef HAVE_NS +static int +tiff_load (struct frame *f, struct image *img) +{ + return ns_load_image(f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); +} +#endif /* HAVE_NS */ + #endif /* !HAVE_TIFF */ @@ -7236,7 +7370,7 @@ GIF ***********************************************************************/ -#if defined (HAVE_GIF) || defined (MAC_OS) +#if defined (HAVE_GIF) || defined (MAC_OS) || defined (HAVE_NS) static int gif_image_p P_ ((Lisp_Object object)); static int gif_load P_ ((struct frame *f, struct image *img)); @@ -7786,6 +7920,16 @@ } #endif /* MAC_OS */ +#ifdef HAVE_NS +static int +gif_load (struct frame *f, struct image *img) +{ + return ns_load_image(f, img, + image_spec_value (img->spec, QCfile, NULL), + image_spec_value (img->spec, QCdata, NULL)); +} +#endif /* HAVE_NS */ + #endif /* HAVE_GIF */ @@ -8150,27 +8294,27 @@ if (CONSP (tested)) return XCDR (tested); -#if defined (HAVE_XPM) || defined (MAC_OS) +#if defined (HAVE_XPM) || defined (MAC_OS) /* || defined (HAVE_NS) */ if (EQ (type, Qxpm)) return CHECK_LIB_AVAILABLE (&xpm_type, init_xpm_functions, libraries); #endif -#if defined (HAVE_JPEG) || defined (MAC_OS) +#if defined (HAVE_JPEG) || defined (MAC_OS) || defined (HAVE_NS) if (EQ (type, Qjpeg)) return CHECK_LIB_AVAILABLE (&jpeg_type, init_jpeg_functions, libraries); #endif -#if defined (HAVE_TIFF) || defined (MAC_OS) +#if defined (HAVE_TIFF) || defined (MAC_OS) || defined (HAVE_NS) if (EQ (type, Qtiff)) return CHECK_LIB_AVAILABLE (&tiff_type, init_tiff_functions, libraries); #endif -#if defined (HAVE_GIF) || defined (MAC_OS) +#if defined (HAVE_GIF) || defined (MAC_OS) || defined (HAVE_NS) if (EQ (type, Qgif)) return CHECK_LIB_AVAILABLE (&gif_type, init_gif_functions, libraries); #endif -#if defined (HAVE_PNG) || defined (MAC_OS) +#if defined (HAVE_PNG) || defined (MAC_OS) || defined (HAVE_NS) if (EQ (type, Qpng)) return CHECK_LIB_AVAILABLE (&png_type, init_png_functions, libraries); #endif @@ -8275,31 +8419,31 @@ staticpro (&QCpt_height); #endif /* HAVE_GHOSTSCRIPT */ -#if defined (HAVE_XPM) || defined (MAC_OS) +#if defined (HAVE_XPM) || defined (MAC_OS) /* || defined (HAVE_NS)*/ Qxpm = intern ("xpm"); staticpro (&Qxpm); ADD_IMAGE_TYPE(Qxpm); #endif -#if defined (HAVE_JPEG) || defined (MAC_OS) +#if defined (HAVE_JPEG) || defined (MAC_OS) || defined (HAVE_NS) Qjpeg = intern ("jpeg"); staticpro (&Qjpeg); ADD_IMAGE_TYPE(Qjpeg); #endif -#if defined (HAVE_TIFF) || defined (MAC_OS) +#if defined (HAVE_TIFF) || defined (MAC_OS) || defined (HAVE_NS) Qtiff = intern ("tiff"); staticpro (&Qtiff); ADD_IMAGE_TYPE(Qtiff); #endif -#if defined (HAVE_GIF) || defined (MAC_OS) +#if defined (HAVE_GIF) || defined (MAC_OS) || defined (HAVE_NS) Qgif = intern ("gif"); staticpro (&Qgif); ADD_IMAGE_TYPE(Qgif); #endif -#if defined (HAVE_PNG) || defined (MAC_OS) +#if defined (HAVE_PNG) || defined (MAC_OS) || defined (HAVE_NS) Qpng = intern ("png"); staticpro (&Qpng); ADD_IMAGE_TYPE(Qpng); Index: src/keyboard.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/keyboard.c,v retrieving revision 1.753.2.41 diff -u -r1.753.2.41 keyboard.c --- src/keyboard.c 15 Oct 2005 00:25:54 -0000 1.753.2.41 +++ src/keyboard.c 5 Nov 2005 17:34:57 -0000 @@ -83,6 +83,10 @@ #include "macterm.h" #endif +#ifdef HAVE_NS +#include "nsterm.h" +#endif + #ifndef USE_CRT_DLL extern int errno; #endif @@ -3988,7 +3992,8 @@ #endif } -#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) +#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) \ + || defined (HAVE_NS) else if (event->kind == DELETE_WINDOW_EVENT) { /* Make an event (delete-frame (FRAME)). */ @@ -3997,7 +4002,8 @@ kbd_fetch_ptr = event + 1; } #endif -#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) +#if defined (HAVE_X11) || defined (HAVE_NTGUI) || defined (MAC_OS) \ + || defined (HAVE_NS) else if (event->kind == ICONIFY_EVENT) { /* Make an event (iconify-frame (FRAME)). */ @@ -4020,7 +4026,7 @@ kbd_fetch_ptr = event + 1; } #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) else if (event->kind == MENU_BAR_ACTIVATE_EVENT) { kbd_fetch_ptr = event + 1; @@ -4123,7 +4129,7 @@ obj = make_lispy_event (event); #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined(MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) /* If this was a menu selection, then set the flag to inhibit writing to last_nonmenu_event. Don't do this if the event we're returning is (menu-bar), though; that indicates the @@ -5350,7 +5356,38 @@ if (! FRAME_LIVE_P (f)) return Qnil; -#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) +#ifdef HAVE_NS + if (FRAME_NS_P (f) && + FRAME_EXTERNAL_MENU_BAR (f) && XINT (event->y) == -1) + { + Lisp_Object items, item; + int hpos; + int i; + + /* Activate the menu bar on the down event. If the + up event comes in before the menu code can deal with it, + just ignore it. */ + if (! (event->modifiers & down_modifier)) + return Qnil; + + /* The click happened in the menubar. + Look for the menu item selected. */ + item = ns_map_event_to_object (event, f); + + XSETFASTINT (event->y, 1); + + position + = Fcons (event->frame_or_window, + Fcons (Qmenu_bar, + Fcons (Fcons (event->x, event->y), + Fcons (make_number (event->timestamp), + Qnil)))); + + return Fcons (item, Fcons (position, Qnil)); + } +#endif /* HAVE_NS */ + +#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS) /* EVENT->x and EVENT->y are frame-relative pixel coordinates at this place. Under old redisplay, COLUMN and ROW are set to frame relative glyph coordinates @@ -5507,11 +5544,16 @@ release of the button that chose the menu item as a separate event. */ +#ifndef HAVE_NS /* normal under NS */ if (!CONSP (start_pos)) return Qnil; +#endif event->modifiers &= ~up_modifier; -#if 0 /* Formerly we treated an up with no down as a click event. */ +#ifdef HAVE_NS /* Formerly we treated an up with no down as a click event. */ + /* We'll do this on NS, cause we don't get separate up down * + * events, just that the bar moved. */ + if (!CONSP (start_pos)) event->modifiers |= click_modifier; else @@ -5832,7 +5874,7 @@ #endif /* HAVE_MOUSE */ #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) case MENU_BAR_EVENT: if (EQ (event->arg, event->frame_or_window)) /* This is the prefix key. We translate this to Index: src/lisp.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/lisp.h,v retrieving revision 1.465.2.34 diff -u -r1.465.2.34 lisp.h --- src/lisp.h 11 Sep 2005 22:20:58 -0000 1.465.2.34 +++ src/lisp.h 5 Nov 2005 17:35:00 -0000 @@ -337,7 +337,7 @@ #endif /* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8. */ -#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX +#if defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ || defined MAC_OSX || defined(COCOA) /* We also need to be able to specify mult-of-8 alignment on static vars. */ # if defined DECL_ALIGN /* We currently do not support USE_LSB_TAG with a union Lisp_Object. */ @@ -879,6 +879,7 @@ The name "xname" is used to intentionally break code referring to the old field "name" of type pointer to struct Lisp_String. */ + /* (Use XSTRING(xname)->data now instead.) */ Lisp_Object xname; /* Value of the symbol or Qunbound if unbound. If this symbol is a @@ -1329,7 +1330,7 @@ We need one more byte for string terminator `\0'. */ #define KEY_DESCRIPTION_SIZE ((2 * 6) + 1 + (CHARACTERBITS / 3) + 1 + 1) -#ifdef USE_X_TOOLKIT +#if defined(USE_X_TOOLKIT) || defined(HAVE_NS) #ifdef NO_UNION_TYPE /* Use this for turning a (void *) into a Lisp_Object, as when the Lisp_Object is passed into a toolkit callback function. */ @@ -1355,7 +1356,7 @@ #define LISP_TO_VOID(larg) ((larg).v) #define LISP_TO_CVOID(larg) ((larg).cv) #endif /* not NO_UNION_TYPE */ -#endif /* USE_X_TOOLKIT */ +#endif /* USE_X_TOOLKIT || HAVE_NS */ /* The glyph datatype, used to represent characters on the display. */ @@ -2300,7 +2301,7 @@ int hash_lookup P_ ((struct Lisp_Hash_Table *, Lisp_Object, unsigned *)); int hash_put P_ ((struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, unsigned)); -void hash_remove P_ ((struct Lisp_Hash_Table *, Lisp_Object)); +void emacs_hash_remove P_ ((struct Lisp_Hash_Table *, Lisp_Object)); void hash_clear P_ ((struct Lisp_Hash_Table *)); void remove_hash_entry P_ ((struct Lisp_Hash_Table *, int)); extern void init_fns P_ ((void)); Index: src/lread.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/lread.c,v retrieving revision 1.317.2.18 diff -u -r1.317.2.18 lread.c --- src/lread.c 26 Aug 2005 09:51:42 -0000 1.317.2.18 +++ src/lread.c 5 Nov 2005 17:35:02 -0000 @@ -636,8 +636,14 @@ register Lisp_Object val, delayed_switch_frame; #ifdef HAVE_WINDOW_SYSTEM +/* PENDING: Everywhere else hourglass ops are wrapped by HAVE_X_WINDOWS. + However, mac and w32 each have partial hourglass impls and maybe they + are used. In any event, NS manages a mouse spinner icon automatically, + so doesn't need Emacs to keep track (for now). */ +#ifndef HAVE_NS if (display_hourglass_p) cancel_hourglass (); +#endif #endif delayed_switch_frame = Qnil; Index: src/macterm.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/macterm.c,v retrieving revision 1.47.2.40 diff -u -r1.47.2.40 macterm.c --- src/macterm.c 18 Oct 2005 10:32:37 -0000 1.47.2.40 +++ src/macterm.c 5 Nov 2005 17:35:09 -0000 @@ -1765,7 +1765,7 @@ /* Function prototypes of this page. */ static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *)); -static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, +static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, struct charset *, int *)); @@ -3214,7 +3214,7 @@ int depth = one_mac_display_info.n_planes; /* Create a pixmap as large as the glyph string. */ - pixmap = XCreatePixmap (s->display, s->window, + pixmap = XCreatePixmap (s->display, s->window, s->background_width, s->height, depth); @@ -9879,7 +9879,7 @@ || ch != 0 #ifndef USE_TOOLKIT_SCROLL_BARS /* control_part_code becomes kControlNoPart if - a progress indicator is clicked. */ + a progress indicator is clicked. */ && control_part_code != kControlNoPart #else /* USE_TOOLKIT_SCROLL_BARS */ #ifdef MAC_OSX Index: src/process.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/process.c,v retrieving revision 1.408.2.25 diff -u -r1.408.2.25 process.c --- src/process.c 7 Oct 2005 07:15:13 -0000 1.408.2.25 +++ src/process.c 5 Nov 2005 17:35:14 -0000 @@ -4368,7 +4368,13 @@ process_output_skip = 0; } #endif - +#ifdef HAVE_NS + if (!inhibit_window_system) + nfds = ns_select (max (max_process_desc, max_keyboard_desc) + 1, + &Available, (SELECT_TYPE *)0, (SELECT_TYPE *)0, + &timeout); + else +#endif nfds = select (max (max_process_desc, max_keyboard_desc) + 1, &Available, #ifdef NON_BLOCKING_CONNECT Index: src/syntax.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/syntax.c,v retrieving revision 1.166.4.14 diff -u -r1.166.4.14 syntax.c --- src/syntax.c 6 Sep 2005 00:25:02 -0000 1.166.4.14 +++ src/syntax.c 5 Nov 2005 17:35:16 -0000 @@ -1,3 +1,4 @@ +#include /* GNU Emacs routines to deal with syntax tables; also word and list parsing. Copyright (C) 1985, 1987, 1993, 1994, 1995, 1997, 1998, 1999, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. @@ -297,6 +298,18 @@ register int beg = BEGV; register int quoted = 0; int orig = charpos; + +#ifdef HAVE_NS + /* For some reason keep getting called w/both 1, then segfaulting + due to the definitions of DEC_BOTH and DEC_POS in character.h, + which lead to decrementing below initial address and then examining + character there. Need to investigate further.. */ + if (charpos < 2 || bytepos < 2) + { + fprintf(stderr,"Returning because charpos = %d, bytepos = %d\n",charpos, bytepos); + return 0; + } +#endif DEC_BOTH (charpos, bytepos); Index: src/sysdep.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/sysdep.c,v retrieving revision 1.251.2.14 diff -u -r1.251.2.14 sysdep.c --- src/sysdep.c 15 Oct 2005 00:25:55 -0000 1.251.2.14 +++ src/sysdep.c 5 Nov 2005 17:35:19 -0000 @@ -286,6 +286,15 @@ return NULL; strcpy (buf, pwd); } +#ifdef COCOA + else if ((pwd=getenv ("HOME")) != 0) + { + buf = (char *) malloc (strlen (pwd) + 1); + if (!buf) + return NULL; + strcpy (buf, pwd); + } +#endif #ifdef HAVE_GETCWD else { Index: src/sysselect.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/sysselect.h,v retrieving revision 1.2.26.5 diff -u -r1.2.26.5 sysselect.h --- src/sysselect.h 26 Aug 2005 09:48:52 -0000 1.2.26.5 +++ src/sysselect.h 5 Nov 2005 17:35:19 -0000 @@ -19,11 +19,11 @@ Boston, MA 02110-1301, USA. */ #ifdef HAVE_SYS_SELECT_H -#if defined (DARWIN) || defined (MAC_OSX) +#if defined (DARWIN) || defined (MAC_OSX) || defined (COCOA) #undef init_process #endif #include -#if defined (DARWIN) || defined (MAC_OSX) +#if defined (DARWIN) || defined (MAC_OSX) || defined (COCOA) #define init_process emacs_init_process #endif #endif Index: src/terminfo.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/terminfo.c,v retrieving revision 1.16.6.3 diff -u -r1.16.6.3 terminfo.c --- src/terminfo.c 26 Aug 2005 09:51:42 -0000 1.16.6.3 +++ src/terminfo.c 5 Nov 2005 17:35:19 -0000 @@ -26,7 +26,10 @@ so that we do not need to conditionalize the places in Emacs that set them. */ +/* PENDING: causes a conflict on OS X 10.3 .*/ +#ifndef COCOA char *UP, *BC, PC; +#endif /* Interface to curses/terminfo library. Turns out that all of the terminfo-level routines look Index: src/xdisp.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v retrieving revision 1.843.2.78 diff -u -r1.843.2.78 xdisp.c --- src/xdisp.c 15 Oct 2005 00:25:55 -0000 1.843.2.78 +++ src/xdisp.c 5 Nov 2005 17:35:35 -0000 @@ -201,6 +201,9 @@ #ifdef MAC_OS #include "macterm.h" #endif +#ifdef HAVE_NS +#include "nsterm.h" +#endif #ifndef FRAME_X_OUTPUT #define FRAME_X_OUTPUT(f) ((f)->output_data.x) @@ -209,7 +212,7 @@ #define INFINITY 10000000 #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined(HAVE_NS) || defined (USE_GTK) extern void set_frame_menubar P_ ((struct frame *f, int, int)); extern int pending_menu_activation; #endif @@ -1788,7 +1791,15 @@ if (s->row->full_width_p) { /* Draw full-width. X coordinates are relative to S->w->left_col. */ - r.x = WINDOW_LEFT_EDGE_X (s->w); + r.x = WINDOW_LEFT_EDGE_X (s->w) +#ifdef HAVE_NS + /* Extend modeline to edges despite int border width, which + NS renders inside instead of outside fringes. */ + + (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(s->w) ? 1 : -1) + * FRAME_INTERNAL_BORDER_WIDTH(s->f); + /*-FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (s->w))*/ +#endif + ; r.width = WINDOW_TOTAL_WIDTH (s->w); /* Unless displaying a mode or menu bar line, which are always @@ -8902,7 +8913,32 @@ if (! STRINGP (f->name) || SBYTES (f->name) != len || bcmp (title, SDATA (f->name), len) != 0) - x_implicitly_set_name (f, make_string (title, len), Qnil); + { +#ifdef HAVE_NS + if (FRAME_NS_P (f)) + { + if (!MINI_WINDOW_P(XWINDOW(f->selected_window))) + { + if (EQ (fmt, Qt)) + ns_set_name_as_filename (f); + else + x_implicitly_set_name (f, make_string(title, len), + Qnil); + } + } + else +#endif + x_implicitly_set_name (f, make_string (title, len), Qnil); + } +#ifdef HAVE_NS + if (FRAME_NS_P (f)) + { + /* do this also for frames with explicit names */ + ns_implicitly_set_icon_type(f); + ns_set_doc_edited(f, Fbuffer_modified_p + (XWINDOW (f->selected_window)->buffer), Qnil); + } +#endif } } @@ -9052,7 +9088,7 @@ if (FRAME_WINDOW_P (f) ? #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined (HAVE_NS) || defined (USE_GTK) FRAME_EXTERNAL_MENU_BAR (f) #else FRAME_MENU_BAR_LINES (f) > 0 @@ -9104,9 +9140,9 @@ /* Redisplay the menu bar in case we changed it. */ #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined (HAVE_NS) || defined (USE_GTK) if (FRAME_WINDOW_P (f) -#if defined (MAC_OS) +#if defined (MAC_OS) || defined (HAVE_NS) /* All frames on Mac OS share the same menubar. So only the selected frame should be allowed to set it. */ && f == SELECTED_FRAME () @@ -9117,11 +9153,11 @@ /* On a terminal screen, the menu bar is an ordinary screen line, and this makes it get updated. */ w->update_mode_line = Qt; -#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || MAC_OS || USE_GTK) */ +#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || MAC_OS || HAVE_NS || USE_GTK) */ /* In the non-toolkit version, the menu bar is an ordinary screen line, and this makes it get updated. */ w->update_mode_line = Qt; -#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || MAC_OS || USE_GTK) */ +#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || MAC_OS || HAVE_NS || USE_GTK) */ unbind_to (count, Qnil); set_buffer_internal_1 (prev); @@ -13100,7 +13136,7 @@ if (FRAME_WINDOW_P (f)) { #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ - || defined (USE_GTK) + || defined (HAVE_NS) || defined (USE_GTK) redisplay_menu_p = FRAME_EXTERNAL_MENU_BAR (f); #else redisplay_menu_p = FRAME_MENU_BAR_LINES (f) > 0; @@ -16044,6 +16080,11 @@ if (FRAME_MAC_P (f)) return; #endif + +#ifdef HAVE_NS + if (FRAME_NS_P (f)) + return; +#endif /* HAVE_NS */ #ifdef USE_X_TOOLKIT xassert (!FRAME_WINDOW_P (f)); Index: src/xfaces.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/xfaces.c,v retrieving revision 1.281.2.39 diff -u -r1.281.2.39 xfaces.c --- src/xfaces.c 15 Oct 2005 00:25:55 -0000 1.281.2.39 +++ src/xfaces.c 5 Nov 2005 17:35:41 -0000 @@ -240,6 +240,17 @@ #define check_x check_mac #endif /* MAC_OS */ +#ifdef HAVE_NS +#include "nsterm.h" +#undef FRAME_X_DISPLAY_INFO +#define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO +#define x_display_info ns_display_info +#define FRAME_X_FONT_TABLE FRAME_NS_FONT_TABLE +#define check_x check_ns +#define x_list_fonts ns_list_fonts +#define GCGraphicsExposures 0 +#endif /* HAVE_NS */ + #include "buffer.h" #include "dispextern.h" #include "blockinput.h" @@ -567,6 +578,10 @@ extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); #endif /* WINDOWSNT */ +#ifdef HAVE_NS +extern Lisp_Object ns_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); +#endif /* HAVE_NS */ + #ifdef USE_X_TOOLKIT static void x_update_menu_appearance P_ ((struct frame *)); @@ -810,6 +825,33 @@ #endif /* MAC_OS */ + +#ifdef HAVE_NS +/* NS emulation of GCs */ + +static INLINE GC +x_create_gc (f, mask, xgcv) + struct frame *f; + unsigned long mask; + XGCValues *xgcv; +{ + GC gc = xmalloc (sizeof (*gc)); + if (gc) + bcopy(xgcv, gc, sizeof(XGCValues)); + return gc; +} + +static INLINE void +x_free_gc (f, gc) + struct frame *f; + GC gc; +{ + if (gc) + xfree (gc); +} +#endif /* HAVE_NS */ + + /* Like stricmp. Used to compare parts of font names which are in ISO8859-1. */ @@ -915,8 +957,14 @@ #ifdef MAC_OS if (!FRAME_MAC_P (f) || FRAME_MAC_WINDOW (f)) #endif +#ifdef HAVE_NS + if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f)) +#endif if (!realize_basic_faces (f)) - abort (); + { + fprintf(stderr, "Aborting because of failed realize_basic_faces.\n"); + abort (); + } } @@ -1084,6 +1132,9 @@ #ifdef MAC_OS mac_unload_font (dpyinfo, font_info->font); #endif +#ifdef HAVE_NS + ns_unload_font (dpyinfo, font_info->font); +#endif UNBLOCK_INPUT; /* Mark font table slot free. */ @@ -1436,6 +1487,10 @@ else if (FRAME_MAC_P (f)) return mac_defined_color (f, color_name, color_def, alloc); #endif +#ifdef HAVE_NS + else if (FRAME_NS_P (f)) + return ns_defined_color (f, color_name, color_def, alloc); +#endif else abort (); } @@ -1719,16 +1774,20 @@ UNBLOCK_INPUT; } #endif +#ifdef HAVE_NS + if (pixel > 0) + ns_release_object((void *)pixel); +#endif } /* Free colors allocated for FACE. */ - static void free_face_colors (f, face) struct frame *f; struct face *face; { +//NS_TODO: need to do something here? #ifdef HAVE_X_WINDOWS if (face->colors_copied_bitwise_p) return; @@ -2378,8 +2437,11 @@ if (*font->name == '-') { +#ifdef HAVE_NS + char *p = font->name + 1; +#else char *p = xstrlwr (font->name) + 1; - +#endif while (i < XLFD_LAST) { font->fields[i] = p; @@ -2548,6 +2610,8 @@ BLOCK_INPUT; lfonts = w32_list_fonts (f, lpattern, 0, nfonts); UNBLOCK_INPUT; +#elif defined HAVE_NS + lfonts = ns_list_fonts (f, lpattern, 0, nfonts); #else lfonts = x_list_fonts (f, lpattern, -1, nfonts); #endif @@ -2701,6 +2765,8 @@ BLOCK_INPUT; fonts = w32_list_fonts (f, pattern, 0, 1); UNBLOCK_INPUT; +#elif defined HAVE_NS + fonts = ns_list_fonts (f, pattern, 0, 1); #else fonts = x_list_fonts (f, pattern, -1, 1); #endif @@ -3425,7 +3491,7 @@ If FONTNAME is not available on frame F, return 0 if MAY_FAIL_P is non-zero, otherwise abort. If the fullname is not in a valid XLFD format, - return 0 if MAY_FAIL_P is non-zero, otherwise set normal values + return 0 if MAY_FAIL_P is non-zero, otherwise set normal values in LFACE and return 1. Otherwise, return 1. */ @@ -3846,6 +3912,7 @@ } else if (EQ (keyword, QCstipple)) { +///PENDING: do for NS too? #ifdef HAVE_X_WINDOWS Lisp_Object pixmap_p = Fbitmap_spec_p (value); if (!NILP (pixmap_p)) @@ -4328,6 +4395,7 @@ } else if (EQ (attr, QCstipple)) { +///PENDING: do for NS too? #ifdef HAVE_X_WINDOWS if (!UNSPECIFIEDP (value) && !NILP (value) @@ -5358,11 +5426,7 @@ { #ifdef HAVE_X_WINDOWS xgcv.font = face->font->fid; -#endif -#ifdef WINDOWSNT - xgcv.font = face->font; -#endif -#ifdef MAC_OS +#elif defined (WINDOWSNT) || defined (MAC_OS) || defined (HAVE_NS) xgcv.font = face->font; #endif mask |= GCFont; @@ -7181,7 +7245,6 @@ /* This function is called so early that colors are not yet set in the frame parameter list. */ Lisp_Object color = Fassq (Qforeground_color, f->param_alist); - if (CONSP (color) && STRINGP (XCDR (color))) LFACE_FOREGROUND (lface) = XCDR (color); else if (FRAME_WINDOW_P (f)) Index: src/m/powermac.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/m/powermac.h,v retrieving revision 1.3.6.3 diff -u -r1.3.6.3 powermac.h --- src/m/powermac.h 26 Aug 2005 09:51:49 -0000 1.3.6.3 +++ src/m/powermac.h 5 Nov 2005 17:35:41 -0000 @@ -18,6 +18,7 @@ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +/* PENDING: relation between this file and "powerpcle.h"? */ /* The following line tells the configuration script what sort of operating system this machine is likely to run. Index: src/s/darwin.h =================================================================== RCS file: /cvsroot/emacs/emacs/src/s/darwin.h,v retrieving revision 1.11.6.7 diff -u -r1.11.6.7 darwin.h --- src/s/darwin.h 26 Aug 2005 09:51:46 -0000 1.11.6.7 +++ src/s/darwin.h 5 Nov 2005 17:35:41 -0000 @@ -19,6 +19,7 @@ Boston, MA 02110-1301, USA. */ + /* * Define symbols to identify the version of Unix this is. * Define all the symbols that apply correctly. @@ -263,20 +264,26 @@ /* Indicate that we are compiling for Mac OS X and where to find Mac specific headers. */ +#ifndef HAVE_NS #define C_SWITCH_SYSTEM -fpascal-strings -fno-common -DMAC_OSX -I../mac/src +#endif -/* Link in the Carbon lib. */ +/* Link in the Carbon or AppKit lib. */ +#ifdef HAVE_NS +#define LIBS_MACGUI -framework AppKit +#else #ifdef HAVE_CARBON -#define LIBS_CARBON -framework Carbon -framework QuickTime +#define LIBS_MACGUI -framework Carbon -framework QuickTime #else -#define LIBS_CARBON -framework Carbon -#endif +#define LIBS_MACGUI -framework Carbon +#endif /* !HAVE_CARBON */ +#endif /* !HAVE_NS */ /* The -headerpad option tells ld (see man page) to leave room at the end of the header for adding load commands. Needed for dumping. 0x690 is the total size of 30 segment load commands (at 56 each). */ -#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_CARBON -Xlinker -headerpad -Xlinker 690 +#define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_MACGUI -Xlinker -headerpad -Xlinker 690 #define C_SWITCH_SYSTEM_TEMACS -Dtemacs @@ -305,6 +312,11 @@ #define OTHER_FILES macosx-app #endif +/* PENDING: can this target be specified in a clearer way? */ +#ifdef HAVE_NS +#define OTHER_FILES ns-app +#endif + /* Define the following so emacs symbols will not conflict with those in the System framework. Otherwise -prebind will not work. */ @@ -319,8 +331,10 @@ /* This prevents a compilation error in xfaces.c: struct kboard * is used in a function protocol the first time this type appears in the file, since MULTI_KBOARD is undefined for the Mac OS X build. */ +#ifndef HAVE_NS #ifndef NOT_C_CODE struct kboard; +#endif #endif /* The following solves the problem that Emacs hangs when evaluating