aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-12-25 18:42:51 -0800
committerPaul Eggert2014-12-25 18:43:34 -0800
commitf76956645ddf3bde4105b50e9bd1e3a1cc2da39c (patch)
tree0b413a4c50df3ec1abd1d354ce7a4234acfb36c9 /src
parentb3946c9b9a4a5fcd49e1a5e75d9dc2c369a6bd29 (diff)
downloademacs-f76956645ddf3bde4105b50e9bd1e3a1cc2da39c.tar.gz
emacs-f76956645ddf3bde4105b50e9bd1e3a1cc2da39c.zip
Use bool for boolean in xsmfns.c
* xsmfns.c, xterm.h (x_session_have_connection): * xsmfns.c (doing_interact, smc_interact_CB, Fhandle_save_session): Use bool for boolean. (x_session_initialize, Fhandle_save_session): Prefer NILP (x) to EQ (x, Qnil).
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/xsmfns.c28
-rw-r--r--src/xterm.h2
3 files changed, 23 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b5fb3515006..f3bc9fd2c87 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12014-12-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use bool for boolean in xsmfns.c
4 * xsmfns.c, xterm.h (x_session_have_connection):
5 * xsmfns.c (doing_interact, smc_interact_CB, Fhandle_save_session):
6 Use bool for boolean.
7 (x_session_initialize, Fhandle_save_session):
8 Prefer NILP (x) to EQ (x, Qnil).
9
12014-12-23 Didier Verna <didier@didierverna.net> (tiny change). 102014-12-23 Didier Verna <didier@didierverna.net> (tiny change).
2 11
3 * nsselect.m (Fns_selection_owner_p): Return a Lisp boolean, not a 12 * nsselect.m (Fns_selection_owner_p): Return a Lisp boolean, not a
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 8a835cf95f1..a6c69855390 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -53,7 +53,7 @@ static int ice_fd = -1;
53 53
54/* A flag that says if we are in shutdown interactions or not. */ 54/* A flag that says if we are in shutdown interactions or not. */
55 55
56static int doing_interact; 56static bool doing_interact;
57 57
58/* The session manager object for the session manager connection. */ 58/* The session manager object for the session manager connection. */
59 59
@@ -123,9 +123,9 @@ x_session_check_input (int fd, void *data)
123 kbd_buffer_store_event (&emacs_event); 123 kbd_buffer_store_event (&emacs_event);
124} 124}
125 125
126/* Return non-zero if we have a connection to a session manager. */ 126/* Return true if we have a connection to a session manager. */
127 127
128int 128bool
129x_session_have_connection (void) 129x_session_have_connection (void)
130{ 130{
131 return ice_fd != -1; 131 return ice_fd != -1;
@@ -138,7 +138,7 @@ x_session_have_connection (void)
138static void 138static void
139smc_interact_CB (SmcConn smcConn, SmPointer clientData) 139smc_interact_CB (SmcConn smcConn, SmPointer clientData)
140{ 140{
141 doing_interact = True; 141 doing_interact = true;
142 emacs_event.kind = SAVE_SESSION_EVENT; 142 emacs_event.kind = SAVE_SESSION_EVENT;
143 emacs_event.arg = Qnil; 143 emacs_event.arg = Qnil;
144} 144}
@@ -398,15 +398,15 @@ x_session_initialize (struct x_display_info *dpyinfo)
398 ptrdiff_t name_len = 0; 398 ptrdiff_t name_len = 0;
399 399
400 ice_fd = -1; 400 ice_fd = -1;
401 doing_interact = False; 401 doing_interact = false;
402 402
403 /* Check if we where started by the session manager. If so, we will 403 /* Check if we where started by the session manager. If so, we will
404 have a previous id. */ 404 have a previous id. */
405 if (! EQ (Vx_session_previous_id, Qnil) && STRINGP (Vx_session_previous_id)) 405 if (! NILP (Vx_session_previous_id) && STRINGP (Vx_session_previous_id))
406 previous_id = SSDATA (Vx_session_previous_id); 406 previous_id = SSDATA (Vx_session_previous_id);
407 407
408 /* Construct the path to the Emacs program. */ 408 /* Construct the path to the Emacs program. */
409 if (! EQ (Vinvocation_directory, Qnil)) 409 if (! NILP (Vinvocation_directory))
410 name_len += SBYTES (Vinvocation_directory); 410 name_len += SBYTES (Vinvocation_directory);
411 name_len += SBYTES (Vinvocation_name); 411 name_len += SBYTES (Vinvocation_name);
412 412
@@ -415,7 +415,7 @@ x_session_initialize (struct x_display_info *dpyinfo)
415 emacs_program = xmalloc (name_len + 1); 415 emacs_program = xmalloc (name_len + 1);
416 char *z = emacs_program; 416 char *z = emacs_program;
417 417
418 if (! EQ (Vinvocation_directory, Qnil)) 418 if (! NILP (Vinvocation_directory))
419 z = lispstpcpy (z, Vinvocation_directory); 419 z = lispstpcpy (z, Vinvocation_directory);
420 lispstpcpy (z, Vinvocation_name); 420 lispstpcpy (z, Vinvocation_name);
421 421
@@ -489,21 +489,19 @@ is told to abort the window system shutdown.
489Do not call this function yourself. */) 489Do not call this function yourself. */)
490 (Lisp_Object event) 490 (Lisp_Object event)
491{ 491{
492 int kill_emacs = CONSP (event) && CONSP (XCDR (event)) 492 bool kill_emacs = (CONSP (event) && CONSP (XCDR (event))
493 && EQ (Qt, XCAR (XCDR (event))); 493 && EQ (Qt, XCAR (XCDR (event))));
494 494
495 /* Check doing_interact so that we don't do anything if someone called 495 /* Check doing_interact so that we don't do anything if someone called
496 this at the wrong time. */ 496 this at the wrong time. */
497 if (doing_interact && ! kill_emacs) 497 if (doing_interact && ! kill_emacs)
498 { 498 {
499 Bool cancel_shutdown = False; 499 bool cancel_shutdown = ! NILP (call0 (intern ("emacs-session-save")));
500
501 cancel_shutdown = ! EQ (call0 (intern ("emacs-session-save")), Qnil);
502 500
503 SmcInteractDone (smc_conn, cancel_shutdown); 501 SmcInteractDone (smc_conn, cancel_shutdown);
504 SmcSaveYourselfDone (smc_conn, True); 502 SmcSaveYourselfDone (smc_conn, True);
505 503
506 doing_interact = False; 504 doing_interact = false;
507 } 505 }
508 else if (kill_emacs) 506 else if (kill_emacs)
509 { 507 {
@@ -511,7 +509,7 @@ Do not call this function yourself. */)
511 prevent. Fix this in next version. */ 509 prevent. Fix this in next version. */
512 Fkill_emacs (Qnil); 510 Fkill_emacs (Qnil);
513 511
514#if 0 512#if false
515 /* This will not be reached, but we want kill-emacs-hook to be run. */ 513 /* This will not be reached, but we want kill-emacs-hook to be run. */
516 SmcCloseConnection (smc_conn, 0, 0); 514 SmcCloseConnection (smc_conn, 0, 0);
517 ice_connection_closed (); 515 ice_connection_closed ();
diff --git a/src/xterm.h b/src/xterm.h
index 31c3261e3b9..84bb58c7232 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1107,7 +1107,7 @@ extern void initialize_frame_menubar (struct frame *);
1107/* Defined in xsmfns.c */ 1107/* Defined in xsmfns.c */
1108#ifdef HAVE_X_SM 1108#ifdef HAVE_X_SM
1109extern void x_session_initialize (struct x_display_info *dpyinfo); 1109extern void x_session_initialize (struct x_display_info *dpyinfo);
1110extern int x_session_have_connection (void); 1110extern bool x_session_have_connection (void);
1111extern void x_session_close (void); 1111extern void x_session_close (void);
1112#endif 1112#endif
1113 1113