Now on revision 113977. ------------------------------------------------------------ revno: 113977 committer: martin rudalics branch nick: trunk timestamp: Fri 2013-08-23 08:52:19 +0200 message: In display-buffer-pop-up-frame make BUFFER current (Bug#15133). * window.el (display-buffer-pop-up-frame): Call pop-up-frame-function with BUFFER current so `make-frame' will use it as the new frame's buffer (Bug#15133). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-08-22 01:09:08 +0000 +++ lisp/ChangeLog 2013-08-23 06:52:19 +0000 @@ -1,3 +1,9 @@ +2013-08-23 Martin Rudalics + + * window.el (display-buffer-pop-up-frame): Call + pop-up-frame-function with BUFFER current so `make-frame' will + use it as the new frame's buffer (Bug#15133). + 2013-08-22 Stefan Monnier * calendar/timeclock.el: Minor cleanups. === modified file 'lisp/window.el' --- lisp/window.el 2013-08-16 09:44:32 +0000 +++ lisp/window.el 2013-08-23 06:52:19 +0000 @@ -5642,7 +5642,10 @@ (fun pop-up-frame-function) frame window) (when (and fun - (setq frame (funcall fun)) + ;; Make BUFFER current so `make-frame' will use it as the + ;; new frame's buffer (Bug#15133). + (with-current-buffer buffer + (setq frame (funcall fun))) (setq window (frame-selected-window frame))) (prog1 (window--display-buffer buffer window 'frame alist display-buffer-mark-dedicated) ------------------------------------------------------------ revno: 113976 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-08-23 08:17:04 +0400 message: * window.c (struct save_window_data): Fix typo. diff: === modified file 'src/window.c' --- src/window.c 2013-08-14 05:41:48 +0000 +++ src/window.c 2013-08-23 04:17:04 +0000 @@ -5408,7 +5408,7 @@ Lisp_Object saved_windows; /* All fields above are traced by the GC. - From `fame-cols' down, the fields are ignored by the GC. */ + From `frame-cols' down, the fields are ignored by the GC. */ int frame_cols, frame_lines, frame_menu_bar_lines; int frame_tool_bar_lines; ------------------------------------------------------------ revno: 113975 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-08-23 08:03:25 +0400 message: Minor cleanup for redisplay interface and few related functions. * frame.h (enum text_cursor_kinds): Move from here... * dispextern.h (enum text_cursor_kinds): ...to here. (toplevel): Drop unnecessary declarations. (struct redisplay_interface): Use bool and enum text_cursor_kinds in update_window_end_hook and draw_window_cursor functions. (display_and_set_cursor, x_update_cursor): Adjust prototypes. * nsterm.m (ns_update_window_end, ns_draw_window_cursor): * w32term.c (x_update_window_end,w32_draw_window_cursor): * xterm.c (x_update_window_end, x_draw_window_cursor): * xdisp.c (display_and_set_cursor, update_window_cursor) (update_cursor_in_window_tree, x_update_cursor): Use bool and enum text_cursor_kinds where appropriate. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-23 03:03:37 +0000 +++ src/ChangeLog 2013-08-23 04:03:25 +0000 @@ -1,5 +1,21 @@ 2013-08-23 Dmitry Antipov + Minor cleanup for redisplay interface and few related functions. + * frame.h (enum text_cursor_kinds): Move from here... + * dispextern.h (enum text_cursor_kinds): ...to here. + (toplevel): Drop unnecessary declarations. + (struct redisplay_interface): Use bool and enum text_cursor_kinds + in update_window_end_hook and draw_window_cursor functions. + (display_and_set_cursor, x_update_cursor): Adjust prototypes. + * nsterm.m (ns_update_window_end, ns_draw_window_cursor): + * w32term.c (x_update_window_end,w32_draw_window_cursor): + * xterm.c (x_update_window_end, x_draw_window_cursor): + * xdisp.c (display_and_set_cursor, update_window_cursor) + (update_cursor_in_window_tree, x_update_cursor): Use bool and + enum text_cursor_kinds where appropriate. + +2013-08-23 Dmitry Antipov + Redesign redisplay interface to drop updated_row and updated_area. * dispextern.h (updated_row, updated_area): Remove declaration. (struct redisplay_interface): Pass glyph row and row area parameters === modified file 'src/dispextern.h' --- src/dispextern.h 2013-08-23 03:03:37 +0000 +++ src/dispextern.h 2013-08-23 04:03:25 +0000 @@ -95,18 +95,17 @@ #define NativeRectangle int #endif -/* Structure forward declarations. Some are here because function - prototypes below reference structure types before their definition - in this file. Some are here because not every file including - dispextern.h also includes frame.h and windows.h. */ - -struct glyph; -struct glyph_row; -struct glyph_matrix; -struct glyph_pool; -struct frame; -struct window; - +/* Text cursor types. */ + +enum text_cursor_kinds +{ + DEFAULT_CURSOR = -2, + NO_CURSOR = -1, + FILLED_BOX_CURSOR, + HOLLOW_BOX_CURSOR, + BAR_CURSOR, + HBAR_CURSOR +}; /* Values returned from coordinates_in_window. */ @@ -2739,8 +2738,8 @@ MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W that contained glyphs in mouse-face were overwritten, so we have to update the mouse highlight. */ - void (*update_window_end_hook) (struct window *w, int cursor_on_p, - int mouse_face_overwritten_p); + void (*update_window_end_hook) (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p); /* Move cursor to row/column position VPOS/HPOS, pixel coordinates Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y @@ -2799,10 +2798,10 @@ 0, don't draw cursor. If ACTIVE_P is 1, system caret should track this cursor (when applicable). */ void (*draw_window_cursor) (struct window *w, - struct glyph_row *glyph_row, - int x, int y, - int cursor_type, int cursor_width, - int on_p, int active_p); + struct glyph_row *glyph_row, + int x, int y, + enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p); /* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */ void (*draw_vertical_window_border) (struct window *w, @@ -3195,13 +3194,12 @@ extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, struct glyph *, int *, int *, int *); extern void erase_phys_cursor (struct window *); -extern void display_and_set_cursor (struct window *, - int, int, int, int, int); +extern void display_and_set_cursor (struct window *, bool, int, int, int, int); extern void set_output_cursor (struct cursor_pos *); extern void x_cursor_to (struct window *, int, int, int, int); -extern void x_update_cursor (struct frame *, int); +extern void x_update_cursor (struct frame *, bool); extern void x_clear_cursor (struct window *); extern void x_draw_vertical_border (struct window *w); === modified file 'src/frame.h' --- src/frame.h 2013-08-12 09:34:00 +0000 +++ src/frame.h 2013-08-23 04:03:25 +0000 @@ -56,16 +56,6 @@ vertical_scroll_bar_right }; -enum text_cursor_kinds -{ - DEFAULT_CURSOR = -2, - NO_CURSOR = -1, - FILLED_BOX_CURSOR, - HOLLOW_BOX_CURSOR, - BAR_CURSOR, - HBAR_CURSOR -}; - enum fullscreen_type { FULLSCREEN_NONE, === modified file 'src/nsterm.m' --- src/nsterm.m 2013-08-13 15:45:43 +0000 +++ src/nsterm.m 2013-08-23 04:03:25 +0000 @@ -742,8 +742,8 @@ static void -ns_update_window_end (struct window *w, int cursor_on_p, - int mouse_face_overwritten_p) +ns_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) /* -------------------------------------------------------------------------- Finished a grouped sequence of drawing calls external (RIF) call; for one window called before update_end @@ -2341,8 +2341,8 @@ static void ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, - int x, int y, int cursor_type, int cursor_width, - int on_p, int active_p) + int x, int y, enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p) /* -------------------------------------------------------------------------- External call (RIF): draw cursor. Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. === modified file 'src/w32term.c' --- src/w32term.c 2013-08-14 16:36:16 +0000 +++ src/w32term.c 2013-08-23 04:03:25 +0000 @@ -210,7 +210,6 @@ int w32_message_fd = -1; #endif /* CYGWIN */ -static void x_update_window_end (struct window *, int, int); static void w32_handle_tool_bar_click (struct frame *, struct input_event *); static void w32_define_cursor (Window, Cursor); @@ -676,8 +675,8 @@ here. */ static void -x_update_window_end (struct window *w, int cursor_on_p, - int mouse_face_overwritten_p) +x_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); @@ -5300,8 +5299,8 @@ static void w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, - int x, int y, int cursor_type, int cursor_width, - int on_p, int active_p) + int x, int y, enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p) { if (on_p) { === modified file 'src/xdisp.c' --- src/xdisp.c 2013-08-23 03:03:37 +0000 +++ src/xdisp.c 2013-08-23 04:03:25 +0000 @@ -26465,7 +26465,7 @@ where to put the cursor is specified by HPOS, VPOS, X and Y. */ void -display_and_set_cursor (struct window *w, int on, +display_and_set_cursor (struct window *w, bool on, int hpos, int vpos, int x, int y) { struct frame *f = XFRAME (w->frame); @@ -26549,7 +26549,7 @@ of ON. */ static void -update_window_cursor (struct window *w, int on) +update_window_cursor (struct window *w, bool on) { /* Don't update cursor in windows whose frame is in the process of being deleted. */ @@ -26585,7 +26585,7 @@ in the window tree rooted at W. */ static void -update_cursor_in_window_tree (struct window *w, int on_p) +update_cursor_in_window_tree (struct window *w, bool on_p) { while (w) { @@ -26604,7 +26604,7 @@ Don't change the cursor's position. */ void -x_update_cursor (struct frame *f, int on_p) +x_update_cursor (struct frame *f, bool on_p) { update_cursor_in_window_tree (XWINDOW (f->root_window), on_p); } === modified file 'src/xterm.c' --- src/xterm.c 2013-08-15 05:23:40 +0000 +++ src/xterm.c 2013-08-23 04:03:25 +0000 @@ -292,8 +292,6 @@ static void x_raise_frame (struct frame *); static void x_lower_frame (struct frame *); static const XColor *x_color_cells (Display *, int *); -static void x_update_window_end (struct window *, int, int); - static int x_io_error_quitter (Display *); static struct terminal *x_create_terminal (struct x_display_info *); void x_delete_terminal (struct terminal *); @@ -612,7 +610,8 @@ here. */ static void -x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) +x_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); @@ -7372,7 +7371,9 @@ /* RIF: Draw cursor on window W. */ static void -x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int y, int cursor_type, int cursor_width, int on_p, int active_p) +x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, + int y, enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p) { struct frame *f = XFRAME (WINDOW_FRAME (w)); ------------------------------------------------------------ revno: 113974 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-08-23 07:03:37 +0400 message: Redesign redisplay interface to drop updated_row and updated_area. * dispextern.h (updated_row, updated_area): Remove declaration. (struct redisplay_interface): Pass glyph row and row area parameters to write_glyphs, insert_glyphs and clear_end_of_line functions. (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line): Adjust prototypes. * dispnew.c (updated_row, updated_area): Remove. (redraw_overlapped_rows, update_window_line): Adjust user. (update_marginal_area, update_text_area): Likewise. Pass updated row as a parameter. Prefer enum glyph_row_area to int where appropriate. * xdisp.c (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line): Adjust users. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-22 18:29:51 +0000 +++ src/ChangeLog 2013-08-23 03:03:37 +0000 @@ -1,3 +1,18 @@ +2013-08-23 Dmitry Antipov + + Redesign redisplay interface to drop updated_row and updated_area. + * dispextern.h (updated_row, updated_area): Remove declaration. + (struct redisplay_interface): Pass glyph row and row area parameters + to write_glyphs, insert_glyphs and clear_end_of_line functions. + (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line): + Adjust prototypes. + * dispnew.c (updated_row, updated_area): Remove. + (redraw_overlapped_rows, update_window_line): Adjust user. + (update_marginal_area, update_text_area): Likewise. Pass updated row + as a parameter. Prefer enum glyph_row_area to int where appropriate. + * xdisp.c (x_write_glyphs, x_insert_glyphs, x_clear_end_of_line): + Adjust users. + 2013-08-22 Paul Eggert * process.c (flush_pending_output): Remove stub. === modified file 'src/dispextern.h' --- src/dispextern.h 2013-08-08 14:51:07 +0000 +++ src/dispextern.h 2013-08-23 03:03:37 +0000 @@ -1197,11 +1197,6 @@ extern struct glyph space_glyph; -/* Glyph row and area updated by update_window_line. */ - -extern struct glyph_row *updated_row; -extern int updated_area; - /* Non-zero means last display completed. Zero means it was preempted. */ @@ -2713,12 +2708,17 @@ /* Write or insert LEN glyphs from STRING at the nominal output position. */ - void (*write_glyphs) (struct window *w, struct glyph *string, int len); - void (*insert_glyphs) (struct window *w, struct glyph *start, int len); + void (*write_glyphs) (struct window *w, struct glyph_row *row, + struct glyph *string, enum glyph_row_area area, + int len); + void (*insert_glyphs) (struct window *w, struct glyph_row *row, + struct glyph *start, enum glyph_row_area area, + int len); /* Clear from nominal output position to X. X < 0 means clear to right end of display. */ - void (*clear_end_of_line) (struct window *w, int x); + void (*clear_end_of_line) (struct window *w, struct glyph_row *row, + enum glyph_row_area area, int x); /* Function to call to scroll the display as described by RUN on window W. */ @@ -3178,9 +3178,12 @@ int *, int *); extern void x_produce_glyphs (struct it *); -extern void x_write_glyphs (struct window *, struct glyph *, int); -extern void x_insert_glyphs (struct window *, struct glyph *, int len); -extern void x_clear_end_of_line (struct window *, int); +extern void x_write_glyphs (struct window *, struct glyph_row *, + struct glyph *, enum glyph_row_area, int); +extern void x_insert_glyphs (struct window *, struct glyph_row *, + struct glyph *, enum glyph_row_area, int); +extern void x_clear_end_of_line (struct window *, struct glyph_row *, + enum glyph_row_area, int); extern struct cursor_pos output_cursor; === modified file 'src/dispnew.c' --- src/dispnew.c 2013-08-14 05:41:48 +0000 +++ src/dispnew.c 2013-08-23 03:03:37 +0000 @@ -135,11 +135,6 @@ static bool delayed_size_change; -/* Glyph row updated in update_window_line, and area that is updated. */ - -struct glyph_row *updated_row; -int updated_area; - /* A glyph for a space. */ struct glyph space_glyph; @@ -3230,14 +3225,12 @@ for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) { - updated_row = row; - updated_area = area; FRAME_RIF (f)->cursor_to (w, i, 0, row->y, area == TEXT_AREA ? row->x : 0); if (row->used[area]) - FRAME_RIF (f)->write_glyphs (w, row->glyphs[area], - row->used[area]); - FRAME_RIF (f)->clear_end_of_line (w, -1); + FRAME_RIF (f)->write_glyphs (w, row, row->glyphs[area], + area, row->used[area]); + FRAME_RIF (f)->clear_end_of_line (w, row, area, -1); } row->overlapped_p = 0; @@ -3511,22 +3504,20 @@ AREA can be either LEFT_MARGIN_AREA or RIGHT_MARGIN_AREA. */ static void -update_marginal_area (struct window *w, int area, int vpos) +update_marginal_area (struct window *w, struct glyph_row *updated_row, + enum glyph_row_area area, int vpos) { struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos); struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); - /* Let functions in xterm.c know what area subsequent X positions - will be relative to. */ - updated_area = area; - /* Set cursor to start of glyphs, write them, and clear to the end of the area. I don't think that something more sophisticated is necessary here, since marginal areas will not be the default. */ rif->cursor_to (w, vpos, 0, desired_row->y, 0); if (desired_row->used[area]) - rif->write_glyphs (w, desired_row->glyphs[area], desired_row->used[area]); - rif->clear_end_of_line (w, -1); + rif->write_glyphs (w, updated_row, desired_row->glyphs[area], + area, desired_row->used[area]); + rif->clear_end_of_line (w, updated_row, area, -1); } @@ -3534,17 +3525,13 @@ Value is true if display has changed. */ static bool -update_text_area (struct window *w, int vpos) +update_text_area (struct window *w, struct glyph_row *updated_row, int vpos) { struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos); struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos); struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); bool changed_p = 0; - /* Let functions in xterm.c know what area subsequent X positions - will be relative to. */ - updated_area = TEXT_AREA; - /* If rows are at different X or Y, or rows have different height, or the current row is marked invalid, write the entire line. */ if (!current_row->enabled_p @@ -3567,11 +3554,11 @@ rif->cursor_to (w, vpos, 0, desired_row->y, desired_row->x); if (desired_row->used[TEXT_AREA]) - rif->write_glyphs (w, desired_row->glyphs[TEXT_AREA], - desired_row->used[TEXT_AREA]); + rif->write_glyphs (w, updated_row, desired_row->glyphs[TEXT_AREA], + TEXT_AREA, desired_row->used[TEXT_AREA]); /* Clear to end of window. */ - rif->clear_end_of_line (w, -1); + rif->clear_end_of_line (w, updated_row, TEXT_AREA, -1); changed_p = 1; /* This erases the cursor. We do this here because @@ -3708,7 +3695,8 @@ } rif->cursor_to (w, vpos, start_hpos, desired_row->y, start_x); - rif->write_glyphs (w, start, i - start_hpos); + rif->write_glyphs (w, updated_row, start, + TEXT_AREA, i - start_hpos); changed_p = 1; } } @@ -3717,7 +3705,8 @@ if (i < desired_row->used[TEXT_AREA]) { rif->cursor_to (w, vpos, i, desired_row->y, x); - rif->write_glyphs (w, desired_glyph, desired_row->used[TEXT_AREA] - i); + rif->write_glyphs (w, updated_row, desired_glyph, + TEXT_AREA, desired_row->used[TEXT_AREA] - i); changed_p = 1; } @@ -3739,7 +3728,7 @@ if (i >= desired_row->used[TEXT_AREA]) rif->cursor_to (w, vpos, i, desired_row->y, desired_row->pixel_width); - rif->clear_end_of_line (w, -1); + rif->clear_end_of_line (w, updated_row, TEXT_AREA, -1); changed_p = 1; } else if (desired_row->pixel_width < current_row->pixel_width) @@ -3767,7 +3756,7 @@ } else xlim = current_row->pixel_width; - rif->clear_end_of_line (w, xlim); + rif->clear_end_of_line (w, updated_row, TEXT_AREA, xlim); changed_p = 1; } } @@ -3786,10 +3775,6 @@ struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); bool changed_p = 0; - /* Set the row being updated. This is important to let xterm.c - know what line height values are in effect. */ - updated_row = desired_row; - /* A row can be completely invisible in case a desired matrix was built with a vscroll and then make_cursor_line_fully_visible shifts the matrix. Make sure to make such rows current anyway, since @@ -3803,7 +3788,7 @@ if (!desired_row->full_width_p && w->left_margin_cols > 0) { changed_p = 1; - update_marginal_area (w, LEFT_MARGIN_AREA, vpos); + update_marginal_area (w, desired_row, LEFT_MARGIN_AREA, vpos); /* Setting this flag will ensure the vertical border, if any, between this window and the one on its left will be redrawn. This is necessary because updating the left @@ -3812,7 +3797,7 @@ } /* Update the display of the text area. */ - if (update_text_area (w, vpos)) + if (update_text_area (w, desired_row, vpos)) { changed_p = 1; if (current_row->mouse_face_p) @@ -3823,7 +3808,7 @@ if (!desired_row->full_width_p && w->right_margin_cols > 0) { changed_p = 1; - update_marginal_area (w, RIGHT_MARGIN_AREA, vpos); + update_marginal_area (w, desired_row, RIGHT_MARGIN_AREA, vpos); } /* Draw truncation marks etc. */ @@ -3842,7 +3827,6 @@ /* Update current_row from desired_row. */ make_current (w->desired_matrix, w->current_matrix, vpos); - updated_row = NULL; return changed_p; } === modified file 'src/xdisp.c' --- src/xdisp.c 2013-08-15 16:28:42 +0000 +++ src/xdisp.c 2013-08-23 03:03:37 +0000 @@ -25763,12 +25763,12 @@ /* EXPORT for RIF: Output LEN glyphs starting at START at the nominal cursor position. - Advance the nominal cursor over the text. The global variable - updated_row is the glyph row being updated, and updated_area is the - area of that row being updated. */ + Advance the nominal cursor over the text. UPDATED_ROW is the glyph row + being updated, and UPDATED_AREA is the area of that row being updated. */ void -x_write_glyphs (struct window *w, struct glyph *start, int len) +x_write_glyphs (struct window *w, struct glyph_row *updated_row, + struct glyph *start, enum glyph_row_area updated_area, int len) { int x, hpos, chpos = w->phys_cursor.hpos; @@ -25811,7 +25811,8 @@ Insert LEN glyphs from START at the nominal cursor position. */ void -x_insert_glyphs (struct window *w, struct glyph *start, int len) +x_insert_glyphs (struct window *w, struct glyph_row *updated_row, + struct glyph *start, enum glyph_row_area updated_area, int len) { struct frame *f; int line_height, shift_by_width, shifted_region_width; @@ -25863,11 +25864,12 @@ (inclusive) to pixel column TO_X (exclusive). The idea is that everything from TO_X onward is already erased. - TO_X is a pixel position relative to updated_area of currently + TO_X is a pixel position relative to UPDATED_AREA of currently updated window W. TO_X == -1 means clear to the end of this area. */ void -x_clear_end_of_line (struct window *w, int to_x) +x_clear_end_of_line (struct window *w, struct glyph_row *updated_row, + enum glyph_row_area updated_area, int to_x) { struct frame *f; int max_x, min_y, max_y; ------------------------------------------------------------ revno: 113973 committer: Paul Eggert branch nick: trunk timestamp: Thu 2013-08-22 11:29:51 -0700 message: * process.c (flush_pending_output): Remove stub. All uses removed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-21 21:27:30 +0000 +++ src/ChangeLog 2013-08-22 18:29:51 +0000 @@ -1,3 +1,8 @@ +2013-08-22 Paul Eggert + + * process.c (flush_pending_output): Remove stub. + All uses removed. + 2013-08-21 Paul Eggert * callproc.c: Fix race that killed background processes (Bug#15144). === modified file 'src/lisp.h' --- src/lisp.h 2013-08-15 14:52:53 +0000 +++ src/lisp.h 2013-08-22 18:29:51 +0000 @@ -4100,7 +4100,6 @@ extern void reset_sys_modes (struct tty_display_info *); extern void init_all_sys_modes (void); extern void reset_all_sys_modes (void); -extern void flush_pending_output (int) ATTRIBUTE_CONST; extern void child_setup_tty (int); extern void setup_pty (int); extern int set_window_size (int, int, int); === modified file 'src/process.c' --- src/process.c 2013-08-21 05:39:51 +0000 +++ src/process.c 2013-08-22 18:29:51 +0000 @@ -3846,15 +3846,12 @@ } #endif - inchannel = p->infd; - /* Beware SIGCHLD hereabouts. */ - if (inchannel >= 0) - flush_pending_output (inchannel); for (i = 0; i < PROCESS_OPEN_FDS; i++) close_process_fd (&p->open_fd[i]); + inchannel = p->infd; if (inchannel >= 0) { p->infd = -1; @@ -5785,10 +5782,9 @@ return; } - switch (signo) +#ifdef SIGCONT + if (signo == SIGCONT) { -#ifdef SIGCONT - case SIGCONT: p->raw_status_new = 0; pset_status (p, Qrun); p->tick = ++process_tick; @@ -5797,14 +5793,8 @@ status_notify (NULL); redisplay_preserve_echo_area (13); } - break; -#endif /* ! defined (SIGCONT) */ - case SIGINT: - case SIGQUIT: - case SIGKILL: - flush_pending_output (p->infd); - break; } +#endif /* If we don't have process groups, send the signal to the immediate subprocess. That isn't really right, but it's better than any === modified file 'src/sysdep.c' --- src/sysdep.c 2013-08-09 12:25:34 +0000 +++ src/sysdep.c 2013-08-22 18:29:51 +0000 @@ -337,16 +337,6 @@ return get_child_status (child, status, WNOHANG | options, 0); } -/* - * flush any pending output - * (may flush input as well; it does not matter the way we use it) - */ - -void -flush_pending_output (int channel) -{ - /* FIXME: maybe this function should be removed */ -} /* Set up the terminal at the other end of a pseudo-terminal that we will be controlling an inferior through. ------------------------------------------------------------ revno: 113972 fixes bug: http://debbugs.gnu.org/13274 committer: Paul Eggert branch nick: trunk timestamp: Thu 2013-08-22 10:35:00 -0700 message: * configure.ac (EMACS_CONFIG_OPTIONS): Quote systematically. This improves on the patch already installed, by quoting options that contain spaces and suchlike systematically, so that EMACS_CONFIG_OPTIONS is no longer ambiguous when options contain these characters. diff: === modified file 'ChangeLog' --- ChangeLog 2013-08-21 06:11:50 +0000 +++ ChangeLog 2013-08-22 17:35:00 +0000 @@ -1,3 +1,11 @@ +2013-08-22 Paul Eggert + + * configure.ac (EMACS_CONFIG_OPTIONS): Quote systematically (Bug#13274). + This improves on the patch already installed, by quoting options + that contain spaces and suchlike systematically, so that + EMACS_CONFIG_OPTIONS is no longer ambiguous when options contain + these characters. + 2013-08-21 Paul Eggert Port close-on-exec pty creation to FreeBSD 9.1-RELEASE (Bug#15129). === modified file 'configure.ac' --- configure.ac 2013-08-21 06:11:50 +0000 +++ configure.ac 2013-08-22 17:35:00 +0000 @@ -24,18 +24,43 @@ AC_PREREQ(2.65) AC_INIT(emacs, 24.3.50) +dnl Set emacs_config_options to the options of 'configure', quoted for the shell, +dnl and then quoted again for a C string. Separate options with spaces. +dnl Add some environment variables, if they were passed via the environment +dnl rather than on the command-line. +emacs_config_options= +optsep= dnl This is the documented way to record the args passed to configure, dnl rather than $ac_configure_args. -emacs_config_options="$@" -## Add some environment variables, if they were passed via the environment -## rather than on the command-line. -for var in CFLAGS CPPFLAGS LDFLAGS; do - case "$emacs_config_options" in - *$var=*) continue ;; - esac - eval val="\$${var}" - test x"$val" = x && continue - emacs_config_options="${emacs_config_options}${emacs_config_options:+ }$var=\"$val\"" +for opt in ${1+"$@"} CFLAGS CPPFLAGS LDFLAGS; do + case $opt in + -n | --no-create | --no-recursion) + continue ;; + CFLAGS | CPPFLAGS | LDFLAGS) + eval 'test "${'$opt'+set}" = set' || continue + case " $*" in + *" $opt="*) continue ;; + esac + eval opt=$opt=\$$opt ;; + esac + + emacs_shell_specials=$IFS\''"#$&()*;<>?@<:@\\`{|~' + case $opt in + *[["$emacs_shell_specials"]]*) + case $opt in + *\'*) + emacs_quote_apostrophes="s/'/'\\\\''/g" + opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_apostrophes"` ;; + esac + opt="'$opt'" + case $opt in + *[['"\\']]*) + emacs_quote_for_c='s/[["\\]]/\\&/g; $!s/$/\\n\\/' + opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_for_c"` ;; + esac ;; + esac + AS_VAR_APPEND([emacs_config_options], ["$optsep$opt"]) + optsep=' ' done AC_CONFIG_HEADER(src/config.h:src/config.in) @@ -4440,8 +4465,6 @@ AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", [Define to the canonical Emacs configuration name.]) -dnl Replace any embedded " characters (bug#13274). -emacs_config_options=`echo "$emacs_config_options " | sed -e 's/--no-create //' -e 's/--no-recursion //' -e 's/ *$//' -e "s/\"/'/g" -e 's/\\\\/\\\\\\\\/g'` AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}", [Define to the options passed to configure.]) AH_TEMPLATE(config_opsysfile, [Some platforms that do not use configure ------------------------------------------------------------ revno: 113971 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-08-22 00:06:45 -0400 message: * lisp/erc/erc.el: Use lexical-binding. (erc-user-full-name): Minor CSE simplification. (erc-mode-map): Assume command-remapping is available. (erc-once-with-server-event): Replace `forms' arg with a function arg. (erc-once-with-server-event-global): Remove. (erc-ison-p): Adjust to change in erc-once-with-server-event. (erc-get-buffer-create): Remove arg `proc'. (iswitchb-make-buflist-hook): Declare. (erc-setup-buffer): Use pcase; avoid ((lambda ..) ..). (read-passwd): Assume it exists. (erc-display-line, erc-cmd-IDLE): Avoid add-to-list, adjust to change in erc-once-with-server-event. (erc-cmd-JOIN, erc-set-channel-limit, erc-set-channel-key) (erc-add-query): Minor CSE simplification. (erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Adjust to change in erc-once-with-server-event. (erc-echo-notice-in-user-and-target-buffers): Avoid add-to-list. * lisp/erc/erc-track.el: Use lexical-binding. (erc-make-mode-line-buffer-name): Use closures instead of `(lambda...). (erc-faces-in): Avoid add-to-list. * lisp/erc/erc-notify.el: Use lexical-binding. (erc-notify-timer): Adjust to change in erc-once-with-server-event. (erc-notify-QUIT): Use a closure instead of `(lambda...). * lisp/erc/erc-list.el: Use lexical-binding. (erc-list-install-322-handler, erc-cmd-LIST): Adjust to change in erc-once-with-server-event. * lisp/erc/erc-button.el: Use lexical-binding. (erc-button-next-function): Use a closure instead of `(lambda...). diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2013-06-19 20:10:57 +0000 +++ lisp/erc/ChangeLog 2013-08-22 04:06:45 +0000 @@ -1,3 +1,34 @@ +2013-08-22 Stefan Monnier + + * erc.el: Use lexical-binding. + (erc-user-full-name): Minor CSE simplification. + (erc-mode-map): Assume command-remapping is available. + (erc-once-with-server-event): Replace `forms' arg with a function arg. + (erc-once-with-server-event-global): Remove. + (erc-ison-p): Adjust to change in erc-once-with-server-event. + (erc-get-buffer-create): Remove arg `proc'. + (iswitchb-make-buflist-hook): Declare. + (erc-setup-buffer): Use pcase; avoid ((lambda ..) ..). + (read-passwd): Assume it exists. + (erc-display-line, erc-cmd-IDLE): Avoid add-to-list, adjust to change + in erc-once-with-server-event. + (erc-cmd-JOIN, erc-set-channel-limit, erc-set-channel-key) + (erc-add-query): Minor CSE simplification. + (erc-cmd-BANLIST, erc-cmd-MASSUNBAN): Adjust to change + in erc-once-with-server-event. + (erc-echo-notice-in-user-and-target-buffers): Avoid add-to-list. + * erc-track.el: Use lexical-binding. + (erc-make-mode-line-buffer-name): Use closures instead of `(lambda...). + (erc-faces-in): Avoid add-to-list. + * erc-notify.el: Use lexical-binding. + (erc-notify-timer): Adjust to change in erc-once-with-server-event. + (erc-notify-QUIT): Use a closure instead of `(lambda...). + * erc-list.el: Use lexical-binding. + (erc-list-install-322-handler, erc-cmd-LIST): Adjust to change in + erc-once-with-server-event. + * erc-button.el: Use lexical-binding. + (erc-button-next-function): Use a closure instead of `(lambda...). + 2013-05-30 Glenn Morris * erc-backend.el: Require erc at run-time too. === modified file 'lisp/erc/erc-button.el' --- lisp/erc/erc-button.el 2013-01-01 09:11:05 +0000 +++ lisp/erc/erc-button.el 2013-08-22 04:06:45 +0000 @@ -1,4 +1,4 @@ -;; erc-button.el --- A way of buttonizing certain things in ERC buffers +;; erc-button.el --- A way of buttonizing certain things in ERC buffers -*- lexical-binding:t -*- ;; Copyright (C) 1996-2004, 2006-2013 Free Software Foundation, Inc. @@ -432,19 +432,22 @@ (defun erc-button-next-function () "Pseudo completion function that actually jumps to the next button. For use on `completion-at-point-functions'." - (when (< (point) (erc-beg-of-input-line)) - `(lambda () - (let ((here ,(point))) - (while (and (get-text-property here 'erc-callback) - (not (= here (point-max)))) - (setq here (1+ here))) - (while (and (not (get-text-property here 'erc-callback)) - (not (= here (point-max)))) - (setq here (1+ here))) - (if (< here (point-max)) - (goto-char here) - (error "No next button")) - t)))) + ;; FIXME: This is an abuse of completion-at-point-functions. + (when (< (point) (erc-beg-of-input-line)) + (let ((start (point))) + (lambda () + (let ((here start)) + ;; FIXME: Use next-single-property-change. + (while (and (get-text-property here 'erc-callback) + (not (= here (point-max)))) + (setq here (1+ here))) + (while (not (or (get-text-property here 'erc-callback) + (= here (point-max)))) + (setq here (1+ here))) + (if (< here (point-max)) + (goto-char here) + (error "No next button")) + t))))) (defun erc-button-next () "Go to the next button in this buffer." === modified file 'lisp/erc/erc-list.el' --- lisp/erc/erc-list.el 2013-05-15 23:55:41 +0000 +++ lisp/erc/erc-list.el 2013-08-22 04:06:45 +0000 @@ -1,4 +1,4 @@ -;;; erc-list.el --- /list support for ERC +;;; erc-list.el --- /list support for ERC -*- lexical-binding:t -*- ;; Copyright (C) 2008-2013 Free Software Foundation, Inc. @@ -183,7 +183,7 @@ ;; Arrange for 323 (end of list) to end this. (erc-once-with-server-event 323 - '(progn + (lambda (_proc _parsed) (remove-hook 'erc-server-322-functions 'erc-list-handle-322 t))) ;; Find the list buffer, empty it, and display it. (set (make-local-variable 'erc-list-buffer) @@ -209,11 +209,12 @@ Please note that this function only works with IRC servers which conform to RFC and send the LIST header (#321) at start of list transmission." (erc-with-server-buffer - (set (make-local-variable 'erc-list-last-argument) line) - (erc-once-with-server-event - 321 - (list 'progn - (list 'erc-list-install-322-handler (current-buffer))))) + (set (make-local-variable 'erc-list-last-argument) line) + (erc-once-with-server-event + 321 + (let ((buf (current-buffer))) + (lambda (_proc _parsed) + (erc-list-install-322-handler buf))))) (erc-server-send (concat "LIST :" (or (and line (substring line 1)) "")))) (put 'erc-cmd-LIST 'do-not-parse-args t) === modified file 'lisp/erc/erc-notify.el' --- lisp/erc/erc-notify.el 2013-05-21 07:25:14 +0000 +++ lisp/erc/erc-notify.el 2013-08-22 04:06:45 +0000 @@ -1,4 +1,4 @@ -;;; erc-notify.el --- Online status change notification +;;; erc-notify.el --- Online status change notification -*- lexical-binding:t -*- ;; Copyright (C) 2002-2004, 2006-2013 Free Software Foundation, Inc. @@ -115,27 +115,28 @@ erc-notify-interval)) (erc-once-with-server-event 303 - '(let* ((server (erc-response.sender parsed)) - (ison-list (delete "" (split-string - (erc-response.contents parsed)))) - (new-list ison-list) - (old-list (erc-with-server-buffer erc-last-ison))) - (while new-list - (when (not (erc-member-ignore-case (car new-list) old-list)) - (run-hook-with-args 'erc-notify-signon-hook server (car new-list)) - (erc-display-message - parsed 'notice proc - 'notify_on ?n (car new-list) ?m (erc-network-name))) - (setq new-list (cdr new-list))) - (while old-list - (when (not (erc-member-ignore-case (car old-list) ison-list)) - (run-hook-with-args 'erc-notify-signoff-hook server (car old-list)) - (erc-display-message - parsed 'notice proc - 'notify_off ?n (car old-list) ?m (erc-network-name))) - (setq old-list (cdr old-list))) - (setq erc-last-ison ison-list) - t)) + (lambda (proc parsed) + (let* ((server (erc-response.sender parsed)) + (ison-list (delete "" (split-string + (erc-response.contents parsed)))) + (new-list ison-list) + (old-list (erc-with-server-buffer erc-last-ison))) + (while new-list + (when (not (erc-member-ignore-case (car new-list) old-list)) + (run-hook-with-args 'erc-notify-signon-hook server (car new-list)) + (erc-display-message + parsed 'notice proc + 'notify_on ?n (car new-list) ?m (erc-network-name))) + (setq new-list (cdr new-list))) + (while old-list + (when (not (erc-member-ignore-case (car old-list) ison-list)) + (run-hook-with-args 'erc-notify-signoff-hook server (car old-list)) + (erc-display-message + parsed 'notice proc + 'notify_off ?n (car old-list) ?m (erc-network-name))) + (setq old-list (cdr old-list))) + (setq erc-last-ison ison-list) + t))) (erc-server-send (concat "ISON " (mapconcat 'identity erc-notify-list " "))) (setq erc-last-ison-time now))) @@ -179,10 +180,11 @@ (let ((nick (erc-extract-nick (erc-response.sender parsed)))) (when (and (erc-member-ignore-case nick erc-notify-list) (erc-member-ignore-case nick erc-last-ison)) - (setq erc-last-ison (erc-delete-if `(lambda (el) - (string= ,(erc-downcase nick) - (erc-downcase el))) - erc-last-ison)) + (setq erc-last-ison (erc-delete-if + (let ((nick-down (erc-downcase nick))) + (lambda (el) + (string= nick-down (erc-downcase el)))) + erc-last-ison)) (run-hook-with-args 'erc-notify-signoff-hook (or erc-server-announced-name erc-session-server) nick) === modified file 'lisp/erc/erc-track.el' --- lisp/erc/erc-track.el 2013-01-02 16:13:04 +0000 +++ lisp/erc/erc-track.el 2013-08-22 04:06:45 +0000 @@ -1,4 +1,4 @@ -;;; erc-track.el --- Track modified channel buffers +;;; erc-track.el --- Track modified channel buffers -*- lexical-binding:t -*- ;; Copyright (C) 2002-2013 Free Software Foundation, Inc. @@ -710,7 +710,7 @@ to consider when `erc-track-visibility' is set to only consider active buffers visible.") -(defun erc-user-is-active (&rest ignore) +(defun erc-user-is-active (&rest _ignore) "Set `erc-buffer-activity'." (when erc-server-connected (setq erc-buffer-activity (erc-current-time)) @@ -745,7 +745,7 @@ times. Without it, you cannot debug `erc-modified-channels-display', because the debugger also cases changes to the window-configuration.") -(defun erc-modified-channels-update (&rest args) +(defun erc-modified-channels-update (&rest _args) "This function updates the information in `erc-modified-channels-alist' according to buffer visibility. It calls `erc-modified-channels-display' at the end. This should usually be @@ -791,19 +791,19 @@ (int-to-string count)) (copy-sequence string)))) (define-key map (vector 'mode-line 'mouse-2) - `(lambda (e) - (interactive "e") - (save-selected-window - (select-window - (posn-window (event-start e))) - (switch-to-buffer ,buffer)))) + (lambda (e) + (interactive "e") + (save-selected-window + (select-window + (posn-window (event-start e))) + (switch-to-buffer buffer)))) (define-key map (vector 'mode-line 'mouse-3) - `(lambda (e) - (interactive "e") - (save-selected-window - (select-window - (posn-window (event-start e))) - (switch-to-buffer-other-window ,buffer)))) + (lambda (e) + (interactive "e") + (save-selected-window + (select-window + (posn-window (event-start e))) + (switch-to-buffer-other-window buffer)))) (put-text-property 0 (length name) 'local-map map name) (put-text-property 0 (length name) @@ -976,8 +976,9 @@ cur) (while (and (setq i (next-single-property-change i 'face str m)) (not (= i m))) - (when (setq cur (get-text-property i 'face str)) - (add-to-list 'faces cur))) + (and (setq cur (get-text-property i 'face str)) + (not (member cur faces)) + (push cur faces))) faces)) (cl-assert === modified file 'lisp/erc/erc.el' --- lisp/erc/erc.el 2013-05-21 07:15:59 +0000 +++ lisp/erc/erc.el 2013-08-22 04:06:45 +0000 @@ -1,4 +1,4 @@ -;; erc.el --- An Emacs Internet Relay Chat client +;; erc.el --- An Emacs Internet Relay Chat client -*- lexical-binding:t -*- ;; Copyright (C) 1997-2013 Free Software Foundation, Inc. @@ -125,20 +125,11 @@ ;; compatibility with older ERC releases -(if (fboundp 'defvaralias) - (progn - (defvaralias 'erc-announced-server-name 'erc-server-announced-name) - (erc-make-obsolete-variable 'erc-announced-server-name - 'erc-server-announced-name - "ERC 5.1") - (defvaralias 'erc-process 'erc-server-process) - (erc-make-obsolete-variable 'erc-process 'erc-server-process "ERC 5.1") - (defvaralias 'erc-default-coding-system 'erc-server-coding-system) - (erc-make-obsolete-variable 'erc-default-coding-system - 'erc-server-coding-system - "ERC 5.1")) - (message (concat "ERC: The function `defvaralias' is not bound. See the " - "NEWS file for variable name changes since ERC 5.0.4."))) +(define-obsolete-variable-alias 'erc-announced-server-name + 'erc-server-announced-name "ERC 5.1") +(define-obsolete-variable-alias 'erc-process 'erc-server-process "ERC 5.1") +(define-obsolete-variable-alias 'erc-default-coding-system + 'erc-server-coding-system "ERC 5.1") (define-obsolete-function-alias 'erc-send-command 'erc-server-send "ERC 5.1") @@ -201,9 +192,7 @@ (string :tag "Name") (function :tag "Get from function")) :set (lambda (sym val) - (if (functionp val) - (set sym (funcall val)) - (set sym val)))) + (set sym (if (functionp val) (funcall val) val)))) (defvar erc-password nil "Password to use when authenticating to an IRC server. @@ -388,12 +377,12 @@ (last-message-time nil)) (defsubst erc-get-channel-user (nick) - "Finds the (USER . CHANNEL-DATA) element corresponding to NICK + "Find the (USER . CHANNEL-DATA) element corresponding to NICK in the current buffer's `erc-channel-users' hash table." (gethash (erc-downcase nick) erc-channel-users)) (defsubst erc-get-server-user (nick) - "Finds the USER corresponding to NICK in the current server's + "Find the USER corresponding to NICK in the current server's `erc-server-users' hash table." (erc-with-server-buffer (gethash (erc-downcase nick) erc-server-users))) @@ -480,7 +469,7 @@ (when (and erc-server-connected (erc-server-process-alive) (hash-table-p erc-channel-users)) - (maphash (lambda (nick cdata) + (maphash (lambda (nick _cdata) (erc-remove-channel-user nick)) erc-channel-users) (clrhash erc-channel-users))) @@ -502,25 +491,25 @@ (erc-channel-user-voice (cdr cdata)))))) (defun erc-get-channel-user-list () - "Returns a list of users in the current channel. Each element + "Return a list of users in the current channel. Each element of the list is of the form (USER . CHANNEL-DATA), where USER is -an erc-server-user struct, and CHANNEL-DATA is either `nil' or an +an erc-server-user struct, and CHANNEL-DATA is either nil or an erc-channel-user struct. See also: `erc-sort-channel-users-by-activity'" (let (users) (if (hash-table-p erc-channel-users) - (maphash (lambda (nick cdata) + (maphash (lambda (_nick cdata) (setq users (cons cdata users))) erc-channel-users)) users)) (defun erc-get-server-nickname-list () - "Returns a list of known nicknames on the current server." + "Return a list of known nicknames on the current server." (erc-with-server-buffer (let (nicks) (when (hash-table-p erc-server-users) - (maphash (lambda (n user) + (maphash (lambda (_n user) (setq nicks (cons (erc-server-user-nickname user) nicks))) @@ -528,10 +517,10 @@ nicks)))) (defun erc-get-channel-nickname-list () - "Returns a list of known nicknames on the current channel." + "Return a list of known nicknames on the current channel." (let (nicks) (when (hash-table-p erc-channel-users) - (maphash (lambda (n cdata) + (maphash (lambda (_n cdata) (setq nicks (cons (erc-server-user-nickname (car cdata)) nicks))) @@ -539,11 +528,11 @@ nicks))) (defun erc-get-server-nickname-alist () - "Returns an alist of known nicknames on the current server." + "Return an alist of known nicknames on the current server." (erc-with-server-buffer (let (nicks) (when (hash-table-p erc-server-users) - (maphash (lambda (n user) + (maphash (lambda (_n user) (setq nicks (cons (cons (erc-server-user-nickname user) nil) nicks))) @@ -551,10 +540,10 @@ nicks)))) (defun erc-get-channel-nickname-alist () - "Returns an alist of known nicknames on the current channel." + "Return an alist of known nicknames on the current channel." (let (nicks) (when (hash-table-p erc-channel-users) - (maphash (lambda (n cdata) + (maphash (lambda (_n cdata) (setq nicks (cons (cons (erc-server-user-nickname (car cdata)) nil) nicks))) @@ -562,21 +551,18 @@ nicks))) (defun erc-sort-channel-users-by-activity (list) - "Sorts LIST such that users which have spoken most recently are -listed first. LIST must be of the form (USER . CHANNEL-DATA). + "Sort LIST such that users which have spoken most recently are listed first. +LIST must be of the form (USER . CHANNEL-DATA). See also: `erc-get-channel-user-list'." (sort list (lambda (x y) - (when (and - (cdr x) (cdr y)) + (when (and (cdr x) (cdr y)) (let ((tx (erc-channel-user-last-message-time (cdr x))) (ty (erc-channel-user-last-message-time (cdr y)))) - (if tx - (if ty - (time-less-p ty tx) - t) - nil)))))) + (and tx + (or (not ty) + (time-less-p ty tx)))))))) (defun erc-sort-channel-users-alphabetically (list) "Sort LIST so that users' nicknames are in alphabetical order. @@ -585,15 +571,12 @@ See also: `erc-get-channel-user-list'." (sort list (lambda (x y) - (when (and - (cdr x) (cdr y)) + (when (and (cdr x) (cdr y)) (let ((nickx (downcase (erc-server-user-nickname (car x)))) (nicky (downcase (erc-server-user-nickname (car y))))) - (if nickx - (if nicky - (string-lessp nickx nicky) - t) - nil)))))) + (and nickx + (or (not nicky) + (string-lessp nickx nicky)))))))) (defvar erc-channel-topic nil "A topic string for the channel. Should only be used in channel-buffers.") @@ -678,8 +661,8 @@ (const :tag "don't highlight notices at all" nil))) (defcustom erc-echo-notice-hook nil - "Specifies a list of functions to call to echo a private -notice. Each function is called with four arguments, the string + "List of functions to call to echo a private notice. +Each function is called with four arguments, the string to display, the parsed server message, the target buffer (or nil), and the sender. The functions are called in order, until a function evaluates to non-nil. These hooks are called after @@ -709,8 +692,8 @@ (defcustom erc-echo-notice-always-hook '(erc-echo-notice-in-default-buffer) - "Specifies a list of functions to call to echo a private -notice. Each function is called with four arguments, the string + "List of functions to call to echo a private notice. +Each function is called with four arguments, the string to display, the parsed server message, the target buffer (or nil), and the sender. The functions are called in order, and all functions are called. These hooks are called before those @@ -1062,9 +1045,9 @@ :options '(erc-make-read-only)) (defcustom erc-send-completed-hook - (when (featurep 'emacspeak) + (when (fboundp 'emacspeak-auditory-icon) (list (byte-compile - (lambda (str) + (lambda (_str) (emacspeak-auditory-icon 'select-object))))) "Hook called after a message has been parsed by ERC. @@ -1115,10 +1098,7 @@ ;; Suppress `font-lock-fontify-block' key binding since it ;; destroys face properties. - (if (fboundp 'command-remapping) - (define-key map [remap font-lock-fontify-block] 'undefined) - (substitute-key-definition - 'font-lock-fontify-block 'undefined map global-map)) + (define-key map [remap font-lock-fontify-block] 'undefined) map) "ERC keymap.") @@ -1277,14 +1257,14 @@ (put ',enable 'definition-name ',name) (put ',disable 'definition-name ',name)))) -(defun erc-once-with-server-event (event &rest forms) - "Execute FORMS the next time EVENT occurs in the `current-buffer'. +(defun erc-once-with-server-event (event f) + "Run function F the next time EVENT occurs in the `current-buffer'. You should make sure that `current-buffer' is a server buffer. -This function temporarily adds a function to EVENT's hook to -execute FORMS. After FORMS are run, the function is removed from -EVENT's hook. The last expression of FORMS should be either nil +This function temporarily adds a function to EVENT's hook to call F with +two arguments (`proc' and `parsed'). After F is called, the function is +removed from EVENT's hook. F should return either nil or t, where nil indicates that the other functions on EVENT's hook should be run too, and t indicates that other functions should not be run. @@ -1298,35 +1278,14 @@ "You should only run `erc-once-with-server-event' in a server buffer")) (let ((fun (make-symbol "fun")) (hook (erc-get-hook event))) - (put fun 'erc-original-buffer (current-buffer)) - (fset fun `(lambda (proc parsed) - (with-current-buffer (get ',fun 'erc-original-buffer) - (remove-hook ',hook ',fun t)) - (fmakunbound ',fun) - ,@forms)) - (add-hook hook fun nil t) - fun)) - -(defun erc-once-with-server-event-global (event &rest forms) - "Execute FORMS the next time EVENT occurs in any server buffer. - -This function temporarily prepends a function to EVENT's hook to -execute FORMS. After FORMS are run, the function is removed from -EVENT's hook. The last expression of FORMS should be either nil -or t, where nil indicates that the other functions on EVENT's hook -should be run too, and t indicates that other functions should -not be run. - -When FORMS execute, the current buffer is the server buffer associated with the -connection over which the data was received that triggered EVENT." - (let ((fun (make-symbol "fun")) - (hook (erc-get-hook event))) - (fset fun `(lambda (proc parsed) - (remove-hook ',hook ',fun) - (fmakunbound ',fun) - ,@forms)) - (add-hook hook fun nil nil) - fun)) + (put fun 'erc-original-buffer (current-buffer)) + (fset fun (lambda (proc parsed) + (with-current-buffer (get fun 'erc-original-buffer) + (remove-hook hook fun t)) + (fmakunbound fun) + (funcall f proc parsed))) + (add-hook hook fun nil t) + fun)) (defsubst erc-log (string) "Logs STRING if logging is on (see `erc-log-p')." @@ -1353,7 +1312,7 @@ (and (eq major-mode 'erc-mode) (null (erc-default-target))))) -(defun erc-open-server-buffer-p (&optional buffer) +(defun erc-open-server-buffer-p (&optional buffer) ;FIXME: `buffer' is ignored! "Return non-nil if argument BUFFER is an ERC server buffer that has an open IRC process. @@ -1377,9 +1336,10 @@ (let ((erc-online-p 'unknown)) (erc-once-with-server-event 303 - `(let ((ison (split-string (aref parsed 3)))) - (setq erc-online-p (car (erc-member-ignore-case ,nick ison))) - t)) + (lambda (_proc parsed) + (let ((ison (split-string (aref parsed 3)))) + (setq erc-online-p (car (erc-member-ignore-case nick ison))) + t))) (erc-server-send (format "ISON %s" nick)) (while (eq erc-online-p 'unknown) (accept-process-output)) (if (called-interactively-p 'interactive) @@ -1551,7 +1511,7 @@ "Check whether ports A and B are equal." (= (erc-normalize-port a) (erc-normalize-port b))) -(defun erc-generate-new-buffer-name (server port target &optional proc) +(defun erc-generate-new-buffer-name (server port target) "Create a new buffer name based on the arguments." (when (numberp port) (setq port (number-to-string port))) (let ((buf-name (or target @@ -1582,9 +1542,9 @@ ;; fallback to the old uniquification method: (or buffer-name (generate-new-buffer-name buf-name)) )) -(defun erc-get-buffer-create (server port target &optional proc) +(defun erc-get-buffer-create (server port target) "Create a new buffer based on the arguments." - (get-buffer-create (erc-generate-new-buffer-name server port target proc))) + (get-buffer-create (erc-generate-new-buffer-name server port target))) (defun erc-member-ignore-case (string list) @@ -1700,6 +1660,7 @@ (defvar iswitchb-temp-buflist) (declare-function iswitchb-read-buffer "iswitchb" (prompt &optional default require-match start matches-set)) +(defvar iswitchb-make-buflist-hook) (defun erc-iswitchb (&optional arg) "Use `iswitchb-read-buffer' to prompt for a ERC buffer to switch to. @@ -1906,29 +1867,29 @@ (defun erc-setup-buffer (buffer) "Consults `erc-join-buffer' to find out how to display `BUFFER'." - (cond ((eq erc-join-buffer 'window) - (if (active-minibuffer-window) - (display-buffer buffer) - (switch-to-buffer-other-window buffer))) - ((eq erc-join-buffer 'window-noselect) - (display-buffer buffer)) - ((eq erc-join-buffer 'bury) - nil) - ((eq erc-join-buffer 'frame) - (when (or (not erc-reuse-frames) - (not (get-buffer-window buffer t))) - ((lambda (frame) - (raise-frame frame) - (select-frame frame)) - (make-frame (or erc-frame-alist - default-frame-alist))) - (switch-to-buffer buffer) - (when erc-frame-dedicated-flag - (set-window-dedicated-p (selected-window) t)))) - (t - (if (active-minibuffer-window) - (display-buffer buffer) - (switch-to-buffer buffer))))) + (pcase erc-join-buffer + (`window + (if (active-minibuffer-window) + (display-buffer buffer) + (switch-to-buffer-other-window buffer))) + (`window-noselect + (display-buffer buffer)) + (`bury + nil) + (`frame + (when (or (not erc-reuse-frames) + (not (get-buffer-window buffer t))) + (let ((frame (make-frame (or erc-frame-alist + default-frame-alist)))) + (raise-frame frame) + (select-frame frame)) + (switch-to-buffer buffer) + (when erc-frame-dedicated-flag + (set-window-dedicated-p (selected-window) t)))) + (_ + (if (active-minibuffer-window) + (display-buffer buffer) + (switch-to-buffer buffer))))) (defun erc-open (&optional server port nick full-name connect passwd tgt-list channel process) @@ -2006,19 +1967,20 @@ ;; The local copy of `erc-nick' - the list of nicks to choose (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick))) ;; password stuff - (setq erc-session-password (or passwd - (let ((secret - (plist-get - (nth 0 - (auth-source-search :host server - :max 1 - :user nick - :port port - :require '(:secret))) - :secret))) - (if (functionp secret) - (funcall secret) - secret)))) + (setq erc-session-password + (or passwd + (let ((secret + (plist-get + (nth 0 + (auth-source-search :host server + :max 1 + :user nick + :port port + :require '(:secret))) + :secret))) + (if (functionp secret) + (funcall secret) + secret)))) ;; debug output buffer (setq erc-dbuf (when erc-log-p @@ -2080,11 +2042,6 @@ (erc-port-equal erc-session-port port) (erc-current-nick-p nick))))) -(if (not (fboundp 'read-passwd)) - (defun read-passwd (prompt) - "Substitute for `read-passwd' in early emacsen." - (read-from-minibuffer prompt))) - (defcustom erc-before-connect nil "Hook called before connecting to a server. This hook gets executed before `erc' actually invokes `erc-mode' @@ -2433,11 +2390,11 @@ (t (list (current-buffer))))) (when (buffer-live-p buf) (erc-display-line-1 string buf) - (add-to-list 'new-bufs buf))) + (push buf new-bufs))) (when (null new-bufs) - (if (erc-server-buffer-live-p) - (erc-display-line-1 string (process-buffer erc-server-process)) - (erc-display-line-1 string (current-buffer)))))) + (erc-display-line-1 string (if (erc-server-buffer-live-p) + (process-buffer erc-server-process) + (current-buffer)))))) (defun erc-display-message-highlight (type string) "Highlight STRING according to TYPE, where erc-TYPE-face is an ERC face. @@ -2544,7 +2501,7 @@ "Internal counter variable for use with `erc-lurker-cleanup-interval'.") (defvar erc-lurker-cleanup-interval 100 - "Specifies frequency of cleaning up stale erc-lurker state. + "Frequency of cleaning up stale erc-lurker state. `erc-lurker-update-status' calls `erc-lurker-cleanup' once for every `erc-lurker-cleanup-interval' updates to @@ -2552,7 +2509,7 @@ consumption of lurker state during long Emacs sessions and/or ERC sessions with large numbers of incoming PRIVMSGs.") -(defun erc-lurker-update-status (message) +(defun erc-lurker-update-status (_message) "Update `erc-lurker-state' if necessary. This function is called from `erc-insert-pre-hook'. If the @@ -2614,7 +2571,7 @@ :type 'alist) (defun erc-canonicalize-server-name (server) - "Returns the canonical network name for SERVER if any, + "Return the canonical network name for SERVER if any, otherwise `erc-server-announced-name'. SERVER is matched against `erc-common-server-suffixes'." (when server @@ -2877,7 +2834,7 @@ (interactive) (let ((ops nil)) (if erc-channel-users - (maphash (lambda (nick user-data) + (maphash (lambda (_nick user-data) (let ((cuser (cdr user-data))) (if (and cuser (erc-channel-user-op cuser)) @@ -3007,9 +2964,9 @@ (switch-to-buffer (car (erc-member-ignore-case chnl joined-channels))) (erc-log (format "cmd: JOIN: %s" chnl)) - (if (and chnl key) - (erc-server-send (format "JOIN %s %s" chnl key)) - (erc-server-send (format "JOIN %s" chnl))))))) + (erc-server-send (if (and chnl key) + (format "JOIN %s %s" chnl key) + (format "JOIN %s" chnl))))))) t) (defalias 'erc-cmd-CHANNEL 'erc-cmd-JOIN) @@ -3120,68 +3077,76 @@ (let ((origbuf (current-buffer)) symlist) (erc-with-server-buffer - (add-to-list 'symlist - (cons (erc-once-with-server-event - 311 `(string= ,nick - (nth 1 - (erc-response.command-args parsed)))) - 'erc-server-311-functions)) - (add-to-list 'symlist - (cons (erc-once-with-server-event - 312 `(string= ,nick - (nth 1 - (erc-response.command-args parsed)))) - 'erc-server-312-functions)) - (add-to-list 'symlist - (cons (erc-once-with-server-event - 318 `(string= ,nick - (nth 1 - (erc-response.command-args parsed)))) - 'erc-server-318-functions)) - (add-to-list 'symlist - (cons (erc-once-with-server-event - 319 `(string= ,nick - (nth 1 - (erc-response.command-args parsed)))) - 'erc-server-319-functions)) - (add-to-list 'symlist - (cons (erc-once-with-server-event - 320 `(string= ,nick - (nth 1 - (erc-response.command-args parsed)))) - 'erc-server-320-functions)) - (add-to-list 'symlist - (cons (erc-once-with-server-event - 330 `(string= ,nick - (nth 1 - (erc-response.command-args parsed)))) - 'erc-server-330-functions)) - (add-to-list 'symlist - (cons (erc-once-with-server-event - 317 - `(let ((idleseconds - (string-to-number - (third - (erc-response.command-args parsed))))) - (erc-display-line - (erc-make-notice - (format "%s has been idle for %s." - (erc-string-no-properties ,nick) - (erc-seconds-to-string idleseconds))) - ,origbuf)) - t) - 'erc-server-317-functions)) - - ;; Send the WHOIS command. - (erc-cmd-WHOIS nick) - - ;; Remove the uninterned symbols from the server hooks that did not run. - (run-at-time 20 nil `(lambda () - (with-current-buffer ,(current-buffer) - (dolist (sym ',symlist) - (let ((hooksym (cdr sym)) - (funcsym (car sym))) - (remove-hook hooksym funcsym t)))))))) + (push (cons (erc-once-with-server-event + 311 (lambda (_proc parsed) + (string= nick + (nth 1 (erc-response.command-args + parsed))))) + 'erc-server-311-functions) + symlist) + (push (cons (erc-once-with-server-event + 312 (lambda (_proc parsed) + (string= nick + (nth 1 (erc-response.command-args + parsed))))) + 'erc-server-312-functions) + symlist) + (push (cons (erc-once-with-server-event + 318 (lambda (_proc parsed) + (string= nick + (nth 1 (erc-response.command-args + parsed))))) + 'erc-server-318-functions) + symlist) + (push (cons (erc-once-with-server-event + 319 (lambda (_proc parsed) + (string= nick + (nth 1 (erc-response.command-args + parsed))))) + 'erc-server-319-functions) + symlist) + (push (cons (erc-once-with-server-event + 320 (lambda (_proc parsed) + (string= nick + (nth 1 (erc-response.command-args + parsed))))) + 'erc-server-320-functions) + symlist) + (push (cons (erc-once-with-server-event + 330 (lambda (_proc parsed) + (string= nick + (nth 1 (erc-response.command-args + parsed))))) + 'erc-server-330-functions) + symlist) + (push (cons (erc-once-with-server-event + 317 + (lambda (_proc parsed) + (let ((idleseconds + (string-to-number + (cl-third + (erc-response.command-args parsed))))) + (erc-display-line + (erc-make-notice + (format "%s has been idle for %s." + (erc-string-no-properties nick) + (erc-seconds-to-string idleseconds))) + origbuf) + t))) + 'erc-server-317-functions) + symlist) + + ;; Send the WHOIS command. + (erc-cmd-WHOIS nick) + + ;; Remove the uninterned symbols from the server hooks that did not run. + (run-at-time 20 nil (lambda (buf symlist) + (with-current-buffer buf + (dolist (sym symlist) + (let ((hooksym (cdr sym)) + (funcsym (car sym))) + (remove-hook hooksym funcsym t))))) + (current-buffer) symlist))) t) (defun erc-cmd-DESCRIBE (line) @@ -3690,11 +3655,12 @@ (erc-with-server-buffer (erc-once-with-server-event 368 - `(with-current-buffer ,chnl-name + (lambda (_proc _parsed) + (with-current-buffer chnl-name (put 'erc-channel-banlist 'received-from-server t) - (setq erc-server-367-functions ',old-367-hook) + (setq erc-server-367-functions old-367-hook) (erc-cmd-BANLIST) - t)) + t))) (erc-server-send (format "MODE %s b" chnl))))) ((null erc-channel-banlist) @@ -3756,28 +3722,29 @@ ((not (get 'erc-channel-banlist 'received-from-server)) (let ((old-367-hook erc-server-367-functions)) (setq erc-server-367-functions 'erc-banlist-store) - ;; fetch the ban list then callback - (erc-with-server-buffer - (erc-once-with-server-event - 368 - `(with-current-buffer ,chnl - (put 'erc-channel-banlist 'received-from-server t) - (setq erc-server-367-functions ,old-367-hook) - (erc-cmd-MASSUNBAN) - t)) - (erc-server-send (format "MODE %s b" chnl))))) + ;; fetch the ban list then callback + (erc-with-server-buffer + (erc-once-with-server-event + 368 + (lambda (_proc _parsed) + (with-current-buffer chnl + (put 'erc-channel-banlist 'received-from-server t) + (setq erc-server-367-functions old-367-hook) + (erc-cmd-MASSUNBAN) + t))) + (erc-server-send (format "MODE %s b" chnl))))) (t (let ((bans (mapcar 'cdr erc-channel-banlist))) - (when bans - ;; Glob the bans into groups of three, and carry out the unban. - ;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@* - (mapc - (lambda (x) - (erc-server-send - (format "MODE %s -%s %s" (erc-default-target) - (make-string (length x) ?b) + (when bans + ;; Glob the bans into groups of three, and carry out the unban. + ;; eg. /mode #foo -bbb a*!*@* b*!*@* c*!*@* + (mapc + (lambda (x) + (erc-server-send + (format "MODE %s -%s %s" (erc-default-target) + (make-string (length x) ?b) (mapconcat 'identity x " ")))) - (erc-group-list bans 3)))) + (erc-group-list bans 3)))) t)))) (defalias 'erc-cmd-MUB 'erc-cmd-MASSUNBAN) @@ -3933,9 +3900,9 @@ (format "Limit for %s (RET to remove limit): " (erc-default-target))))) (let ((tgt (erc-default-target))) - (if (and limit (>= (length limit) 1)) - (erc-server-send (format "MODE %s +l %s" tgt limit)) - (erc-server-send (format "MODE %s -l" tgt))))) + (erc-server-send (if (and limit (>= (length limit) 1)) + (format "MODE %s +l %s" tgt limit) + (format "MODE %s -l" tgt))))) (defun erc-set-channel-key (&optional key) "Set a KEY for the current channel. Remove key if nil. @@ -3944,9 +3911,9 @@ (format "Key for %s (RET to remove key): " (erc-default-target))))) (let ((tgt (erc-default-target))) - (if (and key (>= (length key) 1)) - (erc-server-send (format "MODE %s +k %s" tgt key)) - (erc-server-send (format "MODE %s -k" tgt))))) + (erc-server-send (if (and key (>= (length key) 1)) + (format "MODE %s +k %s" tgt key) + (format "MODE %s -k" tgt))))) (defun erc-quit-server (reason) "Disconnect from current server after prompting for REASON. @@ -4023,7 +3990,7 @@ See `erc-debug-missing-hooks'.") ;(make-variable-buffer-local 'erc-server-vectors) -(defun erc-debug-missing-hooks (proc parsed) +(defun erc-debug-missing-hooks (_proc parsed) "Add PARSED server message ERC does not yet handle to `erc-server-vectors'. These vectors can be helpful when adding new server message handlers to ERC. See `erc-default-server-hook'." @@ -4163,7 +4130,7 @@ and as second argument the event parsed as a vector." :group 'erc-hooks) -(defun erc-display-server-message (proc parsed) +(defun erc-display-server-message (_proc parsed) "Display the message sent by the server as a notice." (erc-display-message parsed 'notice 'active (erc-response.contents parsed))) @@ -4219,7 +4186,7 @@ :group 'erc-display :type 'function) -(defun erc-format-nick (&optional user channel-data) +(defun erc-format-nick (&optional user _channel-data) "Return the nickname of USER. See also `erc-format-nick-function'." (when user (erc-server-user-nickname user))) @@ -4247,7 +4214,7 @@ (let ((prefix "> ")) (erc-propertize prefix 'face 'erc-default-face)))) -(defun erc-echo-notice-in-default-buffer (s parsed buffer sender) +(defun erc-echo-notice-in-default-buffer (s parsed buffer _sender) "Echos a private notice in the default buffer, namely the target buffer specified by BUFFER, or there is no target buffer, the server buffer. This function is designed to be added to @@ -4256,7 +4223,7 @@ (erc-display-message parsed nil buffer s) t) -(defun erc-echo-notice-in-target-buffer (s parsed buffer sender) +(defun erc-echo-notice-in-target-buffer (s parsed buffer _sender) "Echos a private notice in BUFFER, if BUFFER is non-nil. This function is designed to be added to either `erc-echo-notice-hook' or `erc-echo-notice-always-hook', and returns non-nil if BUFFER @@ -4265,21 +4232,21 @@ (progn (erc-display-message parsed nil buffer s) t) nil)) -(defun erc-echo-notice-in-minibuffer (s parsed buffer sender) +(defun erc-echo-notice-in-minibuffer (s _parsed _buffer _sender) "Echos a private notice in the minibuffer. This function is designed to be added to either `erc-echo-notice-hook' or `erc-echo-notice-always-hook', and always returns t." (message "%s" (concat "NOTICE: " s)) t) -(defun erc-echo-notice-in-server-buffer (s parsed buffer sender) +(defun erc-echo-notice-in-server-buffer (s parsed _buffer _sender) "Echos a private notice in the server buffer. This function is designed to be added to either `erc-echo-notice-hook' or `erc-echo-notice-always-hook', and always returns t." (erc-display-message parsed nil nil s) t) -(defun erc-echo-notice-in-active-non-server-buffer (s parsed buffer sender) +(defun erc-echo-notice-in-active-non-server-buffer (s parsed _buffer _sender) "Echos a private notice in the active buffer if the active buffer is not the server buffer. This function is designed to be added to either `erc-echo-notice-hook' or @@ -4289,14 +4256,14 @@ (progn (erc-display-message parsed nil 'active s) t) nil)) -(defun erc-echo-notice-in-active-buffer (s parsed buffer sender) +(defun erc-echo-notice-in-active-buffer (s parsed _buffer _sender) "Echos a private notice in the active buffer. This function is designed to be added to either `erc-echo-notice-hook' or `erc-echo-notice-always-hook', and always returns t." (erc-display-message parsed nil 'active s) t) -(defun erc-echo-notice-in-user-buffers (s parsed buffer sender) +(defun erc-echo-notice-in-user-buffers (s parsed _buffer sender) "Echos a private notice in all of the buffers for which SENDER is a member. This function is designed to be added to either `erc-echo-notice-hook' or `erc-echo-notice-always-hook', and @@ -4321,12 +4288,12 @@ See also: `erc-echo-notice-in-user-buffers', `erc-buffer-list-with-nick'." (let ((buffers (erc-buffer-list-with-nick sender erc-server-process))) - (add-to-list 'buffers buffer) - (if buffers + (unless (memq buffer buffers) (push buffer buffers)) + (if buffers ;FIXME: How could it be nil? (progn (erc-display-message parsed nil buffers s) t) nil))) -(defun erc-echo-notice-in-first-user-buffer (s parsed buffer sender) +(defun erc-echo-notice-in-first-user-buffer (s parsed _buffer sender) "Echos a private notice in one of the buffers for which SENDER is a member. This function is designed to be added to either `erc-echo-notice-hook' or `erc-echo-notice-always-hook', and @@ -4504,7 +4471,7 @@ (defvar erc-ctcp-query-CLIENTINFO-hook '(erc-ctcp-query-CLIENTINFO)) -(defun erc-ctcp-query-CLIENTINFO (proc nick login host to msg) +(defun erc-ctcp-query-CLIENTINFO (_proc nick _login _host _to msg) "Respond to a CTCP CLIENTINFO query." (when (string-match "^CLIENTINFO\\(\\s-*\\|\\s-+.*\\)$" msg) (let ((s (erc-client-info (erc-trim-string (match-string 1 msg))))) @@ -4513,7 +4480,7 @@ nil) (defvar erc-ctcp-query-ECHO-hook '(erc-ctcp-query-ECHO)) -(defun erc-ctcp-query-ECHO (proc nick login host to msg) +(defun erc-ctcp-query-ECHO (_proc nick _login _host _to msg) "Respond to a CTCP ECHO query." (when (string-match "^ECHO\\s-+\\(.*\\)\\s-*$" msg) (let ((s (match-string 1 msg))) @@ -4522,7 +4489,7 @@ nil) (defvar erc-ctcp-query-FINGER-hook '(erc-ctcp-query-FINGER)) -(defun erc-ctcp-query-FINGER (proc nick login host to msg) +(defun erc-ctcp-query-FINGER (_proc nick _login _host _to _msg) "Respond to a CTCP FINGER query." (unless erc-disable-ctcp-replies (let ((s (if erc-anonymous-login @@ -4538,7 +4505,7 @@ nil) (defvar erc-ctcp-query-PING-hook '(erc-ctcp-query-PING)) -(defun erc-ctcp-query-PING (proc nick login host to msg) +(defun erc-ctcp-query-PING (_proc nick _login _host _to msg) "Respond to a CTCP PING query." (when (string-match "^PING\\s-+\\(.*\\)" msg) (unless erc-disable-ctcp-replies @@ -4547,21 +4514,21 @@ nil) (defvar erc-ctcp-query-TIME-hook '(erc-ctcp-query-TIME)) -(defun erc-ctcp-query-TIME (proc nick login host to msg) +(defun erc-ctcp-query-TIME (_proc nick _login _host _to _msg) "Respond to a CTCP TIME query." (unless erc-disable-ctcp-replies (erc-send-ctcp-notice nick (format "TIME %s" (current-time-string)))) nil) (defvar erc-ctcp-query-USERINFO-hook '(erc-ctcp-query-USERINFO)) -(defun erc-ctcp-query-USERINFO (proc nick login host to msg) +(defun erc-ctcp-query-USERINFO (_proc nick _login _host _to _msg) "Respond to a CTCP USERINFO query." (unless erc-disable-ctcp-replies (erc-send-ctcp-notice nick (format "USERINFO %s" erc-user-information))) nil) (defvar erc-ctcp-query-VERSION-hook '(erc-ctcp-query-VERSION)) -(defun erc-ctcp-query-VERSION (proc nick login host to msg) +(defun erc-ctcp-query-VERSION (_proc nick _login _host _to _msg) "Respond to a CTCP VERSION query." (unless erc-disable-ctcp-replies (erc-send-ctcp-notice @@ -4584,7 +4551,7 @@ 'CTCP-UNKNOWN ?n nick ?u login ?h host ?m msg)))) (defvar erc-ctcp-reply-ECHO-hook '(erc-ctcp-reply-ECHO)) -(defun erc-ctcp-reply-ECHO (proc nick login host to msg) +(defun erc-ctcp-reply-ECHO (_proc nick _login _host _to msg) "Handle a CTCP ECHO reply." (when (string-match "^ECHO\\s-+\\(.*\\)\\s-*$" msg) (let ((message (match-string 1 msg))) @@ -4594,7 +4561,7 @@ nil) (defvar erc-ctcp-reply-CLIENTINFO-hook '(erc-ctcp-reply-CLIENTINFO)) -(defun erc-ctcp-reply-CLIENTINFO (proc nick login host to msg) +(defun erc-ctcp-reply-CLIENTINFO (_proc nick _login _host _to msg) "Handle a CTCP CLIENTINFO reply." (when (string-match "^CLIENTINFO\\s-+\\(.*\\)\\s-*$" msg) (let ((message (match-string 1 msg))) @@ -4604,7 +4571,7 @@ nil) (defvar erc-ctcp-reply-FINGER-hook '(erc-ctcp-reply-FINGER)) -(defun erc-ctcp-reply-FINGER (proc nick login host to msg) +(defun erc-ctcp-reply-FINGER (_proc nick _login _host _to msg) "Handle a CTCP FINGER reply." (when (string-match "^FINGER\\s-+\\(.*\\)\\s-*$" msg) (let ((message (match-string 1 msg))) @@ -4614,7 +4581,7 @@ nil) (defvar erc-ctcp-reply-PING-hook '(erc-ctcp-reply-PING)) -(defun erc-ctcp-reply-PING (proc nick login host to msg) +(defun erc-ctcp-reply-PING (_proc nick _login _host _to msg) "Handle a CTCP PING reply." (if (not (string-match "^PING\\s-+\\([0-9.]+\\)" msg)) nil @@ -4632,7 +4599,7 @@ 'bad-ping-response ?n nick ?t time)))))) (defvar erc-ctcp-reply-TIME-hook '(erc-ctcp-reply-TIME)) -(defun erc-ctcp-reply-TIME (proc nick login host to msg) +(defun erc-ctcp-reply-TIME (_proc nick _login _host _to msg) "Handle a CTCP TIME reply." (when (string-match "^TIME\\s-+\\(.*\\)\\s-*$" msg) (let ((message (match-string 1 msg))) @@ -4642,7 +4609,7 @@ nil) (defvar erc-ctcp-reply-VERSION-hook '(erc-ctcp-reply-VERSION)) -(defun erc-ctcp-reply-VERSION (proc nick login host to msg) +(defun erc-ctcp-reply-VERSION (_proc nick _login _host _to msg) "Handle a CTCP VERSION reply." (when (string-match "^VERSION\\s-+\\(.*\\)\\s-*$" msg) (let ((message (match-string 1 msg))) @@ -4705,7 +4672,7 @@ channel buffer. See also `erc-channel-begin-receiving-names'." - (maphash (lambda (nick user) + (maphash (lambda (nick _user) (if (null (gethash nick erc-channel-new-member-names)) (erc-remove-channel-user nick))) erc-channel-users) @@ -4746,8 +4713,7 @@ (setq names (delete "" (split-string names-string))) (let ((erc-channel-members-changed-hook nil)) (dolist (item names) - (let ((updatep t) - ch) + (let ((updatep t)) (if (rassq (elt item 0) prefix) (cond ((= (length item) 1) (setq updatep nil)) @@ -4780,8 +4746,7 @@ (defun erc-update-user-nick (nick &optional new-nick host login full-name info) - "Updates the stored user information for the user with nickname -NICK. + "Update the stored user information for the user with nickname NICK. See also: `erc-update-user'." (erc-update-user (erc-get-server-user nick) new-nick @@ -4831,8 +4796,8 @@ (defun erc-update-current-channel-member (nick new-nick &optional add op voice host login full-name info update-message-time) - "Updates the stored user information for the user with nickname -NICK. `erc-update-user' is called to handle changes to nickname, + "Update the stored user information for the user with nickname NICK. +`erc-update-user' is called to handle changes to nickname, HOST, LOGIN, FULL-NAME, and INFO. If OP or VOICE are non-nil, they must be equal to either `on' or `off', in which case the operator or voice status of the user in the current channel is @@ -4850,7 +4815,7 @@ See also: `erc-update-user' and `erc-update-channel-member'." (let* (changed user-changed (channel-data (erc-get-channel-user nick)) - (cuser (if channel-data (cdr channel-data))) + (cuser (cdr channel-data)) (user (if channel-data (car channel-data) (erc-get-server-user nick)))) (if cuser @@ -4908,7 +4873,7 @@ (defun erc-update-channel-member (channel nick new-nick &optional add op voice host login full-name info update-message-time) - "Updates user and channel information for the user with + "Update user and channel information for the user with nickname NICK in channel CHANNEL. See also: `erc-update-current-channel-member'." @@ -4951,7 +4916,6 @@ "Set the modes for the TGT provided as MODE-STRING." (let* ((modes (erc-parse-modes mode-string)) (add-modes (nth 0 modes)) - (remove-modes (nth 1 modes)) ;; list of triples: (mode-char 'on/'off argument) (arg-modes (nth 2 modes))) (cond ((erc-channel-p tgt); channel modes @@ -5040,6 +5004,7 @@ "Update the mode information for TGT, provided as MODE-STRING. Optional arguments: NICK, HOST and LOGIN - the attributes of the person who changed the modes." + ;; FIXME: neither of nick, host, and login are used! (let* ((modes (erc-parse-modes mode-string)) (add-modes (nth 0 modes)) (remove-modes (nth 1 modes)) @@ -5197,8 +5162,7 @@ If VALUE-LIST is nil, set each property in PROPERTIES to t, else set each property to the corresponding value in VALUE-LIST." (unless value-list - (setq value-list (mapcar (lambda (x) - t) + (setq value-list (mapcar (lambda (_x) t) properties))) (while (and properties value-list) (erc-put-text-property @@ -5290,7 +5254,7 @@ "Regular expression used for matching commands in ERC.") (defun erc-send-input (input) - "Treat INPUT as typed in by the user. It is assumed that the input + "Treat INPUT as typed in by the user. It is assumed that the input and the prompt is already deleted. This returns non-nil only if we actually send anything." ;; Handle different kinds of inputs @@ -5380,8 +5344,8 @@ (when (string-match erc-command-regexp line) (let* ((cmd (erc-command-symbol (match-string 1 line))) ;; note: return is nil, we apply this simply for side effects - (canon-defun (while (and cmd (symbolp (symbol-function cmd))) - (setq cmd (symbol-function cmd)))) + (_canon-defun (while (and cmd (symbolp (symbol-function cmd))) + (setq cmd (symbol-function cmd)))) (cmd-fun (or cmd #'erc-cmd-default)) (arg (if cmd (if (get cmd-fun 'do-not-parse-args) @@ -5449,22 +5413,18 @@ (defun erc-add-default-channel (channel) "Add CHANNEL to the default channel list." - - (let ((d1 (car erc-default-recipients)) - (d2 (cdr erc-default-recipients)) - (chl (downcase channel))) + (let ((chl (downcase channel))) (setq erc-default-recipients (cons chl erc-default-recipients)))) (defun erc-delete-default-channel (channel &optional buffer) "Delete CHANNEL from the default channel list." - (let ((ob (current-buffer))) - (with-current-buffer (if (and buffer - (bufferp buffer)) - buffer - (current-buffer)) - (setq erc-default-recipients (delete (downcase channel) - erc-default-recipients))))) + (with-current-buffer (if (and buffer + (bufferp buffer)) + buffer + (current-buffer)) + (setq erc-default-recipients (delete (downcase channel) + erc-default-recipients)))) (defun erc-add-query (nickname) "Add QUERY'd NICKNAME to the default channel list. @@ -5473,10 +5433,10 @@ (let ((d1 (car erc-default-recipients)) (d2 (cdr erc-default-recipients)) (qt (cons 'QUERY (downcase nickname)))) - (if (and (listp d1) - (eq (car d1) 'QUERY)) - (setq erc-default-recipients (cons qt d2)) - (setq erc-default-recipients (cons qt erc-default-recipients))))) + (setq erc-default-recipients (cons qt (if (and (listp d1) + (eq (car d1) 'QUERY)) + d2 + erc-default-recipients))))) (defun erc-delete-query () "Delete the topmost target if it is a QUERY." @@ -5527,17 +5487,11 @@ (let ((nick (erc-server-user-nickname user)) (host (erc-server-user-host user)) (login (erc-server-user-login user))) - (concat (if nick - nick - "") + (concat (or nick "") "!" - (if login - login - "") + (or login "") "@" - (if host - host - "")))) + (or host "")))) (defun erc-list-match (lst str) "Return non-nil if any regexp in LST matches STR." @@ -5588,7 +5542,7 @@ (interactive "P") (erc-set-active-buffer (current-buffer)) (let ((tgt (erc-default-target)) - (erc-force-send t)) + (erc-force-send t)) ;FIXME: Not used anywhere! (cond ((or (not tgt) (not (erc-channel-p tgt))) (erc-display-message nil 'error (current-buffer) 'no-target)) (arg (erc-load-irc-script-lines (list (concat "/mode " tgt " -i")) @@ -5626,7 +5580,7 @@ (interactive "P") (erc-set-active-buffer (current-buffer)) (let ((tgt (or channel (erc-default-target))) - (erc-force-send t)) + (erc-force-send t)) ;FIXME: Not used anywhere! (cond ((or (null tgt) (null (erc-channel-p tgt))) (erc-display-message nil 'error 'active 'no-target)) ((member mode erc-channel-modes) @@ -5670,12 +5624,11 @@ If FILE is found, return the path to it." (let ((filepath file)) (if (file-readable-p filepath) filepath - (progn - (while (and path - (progn (setq filepath (expand-file-name file (car path))) - (not (file-readable-p filepath)))) - (setq path (cdr path))) - (if path filepath nil))))) + (while (and path + (progn (setq filepath (expand-file-name file (car path))) + (not (file-readable-p filepath)))) + (setq path (cdr path))) + (if path filepath nil)))) (defun erc-select-startup-file () "Select an ERC startup file. @@ -5789,7 +5742,6 @@ sequences, process the lines verbatim. Use this for multiline user input." (let* ((cb (current-buffer)) - (pnt (point)) (s "") (sp (or (erc-command-indicator) (erc-prompt))) (args (and (boundp 'erc-script-args) erc-script-args))) @@ -6030,13 +5982,12 @@ (user (if channel-data (car channel-data) (erc-get-server-user word))) - host login full-name info nick op voice) + host login full-name nick op voice) (when user (setq nick (erc-server-user-nickname user) host (erc-server-user-host user) login (erc-server-user-login user) - full-name (erc-server-user-full-name user) - info (erc-server-user-info user)) + full-name (erc-server-user-full-name user)) (if cuser (setq op (erc-channel-user-op cuser) voice (erc-channel-user-voice cuser))) @@ -6048,7 +5999,7 @@ (format " and is +%s%s on %s" (if op "o" "") (if voice "v" "") - (erc-default-target)) + (erc-default-target)) "")) user)))) @@ -6597,7 +6548,7 @@ (add-hook 'kill-buffer-hook 'erc-kill-buffer-function) (defcustom erc-kill-server-hook '(erc-kill-server) - "Invoked whenever a server-buffer is killed via `kill-buffer'." + "Invoked whenever a server buffer is killed via `kill-buffer'." :group 'erc-hooks :type 'hook) @@ -6702,9 +6653,9 @@ (provide 'erc) -;;; Deprecated. We might eventually stop requiring the goodies automatically. -;;; IMPORTANT: This require must appear _after_ the above (provide 'erc) to -;;; avoid a recursive require error when byte-compiling the entire package. +;; Deprecated. We might eventually stop requiring the goodies automatically. +;; IMPORTANT: This require must appear _after_ the above (provide 'erc) to +;; avoid a recursive require error when byte-compiling the entire package. (require 'erc-goodies) ;;; erc.el ends here