]> git.eshelyaron.com Git - emacs.git/commitdiff
* nsfns.m (ns_set_doc_edited): Do all logic (check frames) here
authorJan Djärv <jan.h.d@swipnet.se>
Thu, 30 Oct 2014 19:15:38 +0000 (20:15 +0100)
committerJan Djärv <jan.h.d@swipnet.se>
Thu, 30 Oct 2014 19:15:38 +0000 (20:15 +0100)
instead of in xdisp.c, function now takes void.

* nsterm.h (ns_set_doc_edited): Declare taking no args.

* xdisp.c (prepare_menu_bars): Remove HAVE_NS code.
(redisplay_internal): Call ns_set_doc_edited if HAVE_NS (Bug#18884).

src/ChangeLog
src/nsfns.m
src/nsterm.h
src/xdisp.c

index a66026fa09117655fdb39a798c57d493d6ed9242..584207802b40ac91a481b3aa7dc3ddc99493ce99 100644 (file)
@@ -1,5 +1,13 @@
 2014-10-30  Jan Djärv  <jan.h.d@swipnet.se>
 
+       * nsterm.h (ns_set_doc_edited): Declare taking no args.
+
+       * nsfns.m (ns_set_doc_edited): Do all logic (check frames) here
+       instead of in xdisp.c, function now takes void. (Bug#18884).
+
+       * xdisp.c (prepare_menu_bars): Remove HAVE_NS code.
+       (redisplay_internal): Call ns_set_doc_edited if HAVE_NS (Bug#18884).
+
        * nsterm.h (EmacsScroller): Replace Lisp_Object win with
        struct window* (Bug#18889).
        Remove getMouseMotionPart.
index 9d9f5416c8620d8dcf1c119d91f577d36ad87663..4fa62f5685172e6a4e427177be4cdfccf5a2bc8c 100644 (file)
@@ -631,18 +631,26 @@ ns_set_name_as_filename (struct frame *f)
 
 
 void
-ns_set_doc_edited (struct frame *f, Lisp_Object arg)
+ns_set_doc_edited (void)
 {
-  NSView *view = FRAME_NS_VIEW (f);
   NSAutoreleasePool *pool;
-  if (!MINI_WINDOW_P (XWINDOW (f->selected_window)))
+  Lisp_Object tail, frame;
+  block_input ();
+  pool = [[NSAutoreleasePool alloc] init];
+  FOR_EACH_FRAME (tail, frame)
     {
-      block_input ();
-      pool = [[NSAutoreleasePool alloc] init];
-      [[view window] setDocumentEdited: !NILP (arg)];
-      [pool release];
-      unblock_input ();
+      BOOL edited = NO;
+      struct frame *f = XFRAME (frame);
+      struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
+      NSView *view = FRAME_NS_VIEW (f);
+      if (!MINI_WINDOW_P (w))
+        edited = ! NILP (Fbuffer_modified_p (w->contents)) &&
+          ! NILP (Fbuffer_file_name (w->contents));
+      [[view window] setDocumentEdited: edited];
     }
+
+  [pool release];
+  unblock_input ();
 }
 
 
index a6081e8da5720b5fc3f7a304e7c35de78af70033..eb2165a89d38920f13f7f0b1ad95ce24503640da 100644 (file)
@@ -818,7 +818,7 @@ extern void nxatoms_of_nsselect (void);
 extern int ns_lisp_to_cursor_type (Lisp_Object arg);
 extern Lisp_Object ns_cursor_type_to_lisp (int arg);
 extern void ns_set_name_as_filename (struct frame *f);
-extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg);
+extern void ns_set_doc_edited (void);
 
 extern bool
 ns_defined_color (struct frame *f,
index f0726ecce70d831f7a27a624a43cf961ee64ead8..c12ef753a45a023316f831b252c2711d07eb26a0 100644 (file)
@@ -11778,12 +11778,6 @@ prepare_menu_bars (void)
          menu_bar_hooks_run = update_menu_bar (f, 0, menu_bar_hooks_run);
 #ifdef HAVE_WINDOW_SYSTEM
          update_tool_bar (f, 0);
-#endif
-#ifdef HAVE_NS
-          if (windows_or_buffers_changed
-             && FRAME_NS_P (f))
-            ns_set_doc_edited
-             (f, Fbuffer_modified_p (XWINDOW (f->selected_window)->contents));
 #endif
          UNGCPRO;
        }
@@ -14149,6 +14143,9 @@ redisplay_internal (void)
 #endif /* HAVE_WINDOW_SYSTEM */
 
  end_of_redisplay:
+#ifdef HAVE_NS
+  ns_set_doc_edited ();
+#endif
   if (interrupt_input && interrupts_deferred)
     request_sigio ();