Now on revision 109186. ------------------------------------------------------------ revno: 109186 committer: Dmitry Antipov branch nick: trunk timestamp: Sun 2012-07-22 09:37:24 +0400 message: Simplify and cleanup markers positioning code. * marker.c (attach_marker): More useful eassert. (live_buffer, set_marker_internal): New function. (Fset_marker, set_marker_restricted): Use set_marker_internal. (set_marker_both, set_marker_restricted_both): Use live_buffer. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-22 03:44:35 +0000 +++ src/ChangeLog 2012-07-22 05:37:24 +0000 @@ -1,3 +1,11 @@ +2012-07-22 Dmitry Antipov + + Simplify and cleanup markers positioning code. + * marker.c (attach_marker): More useful eassert. + (live_buffer, set_marker_internal): New function. + (Fset_marker, set_marker_restricted): Use set_marker_internal. + (set_marker_both, set_marker_restricted_both): Use live_buffer. + 2012-07-22 Paul Eggert * buffer.h (struct buffer.indirections): Now ptrdiff_t, not int, === modified file 'src/marker.c' --- src/marker.c 2012-07-09 03:15:10 +0000 +++ src/marker.c 2012-07-22 05:37:24 +0000 @@ -431,8 +431,12 @@ attach_marker (struct Lisp_Marker *m, struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) { - /* Every character is at least one byte. */ - eassert (charpos <= bytepos); + /* In a single-byte buffer, two positions must be equal. + Otherwise, every character is at least one byte. */ + if (BUF_Z (b) == BUF_Z_BYTE (b)) + eassert (charpos == bytepos); + else + eassert (charpos <= bytepos); m->charpos = charpos; m->bytepos = bytepos; @@ -446,191 +450,136 @@ } } -DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0, - doc: /* Position MARKER before character number POSITION in BUFFER. -BUFFER defaults to the current buffer. -If POSITION is nil, makes marker point nowhere. -Then it no longer slows down editing in any buffer. -Returns MARKER. */) - (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) -{ - register ptrdiff_t charpos; - register ptrdiff_t bytepos; - register struct buffer *b; +/* If BUFFER is nil, return current buffer pointer. Next, check + whether BUFFER is a buffer object and return buffer pointer + corresponding to BUFFER if BUFFER is live, or NULL otherwise. */ + +static inline struct buffer * +live_buffer (Lisp_Object buffer) +{ + struct buffer *b; + + if (NILP (buffer)) + { + b = current_buffer; + eassert (!NILP (BVAR (b, name))); + } + else + { + CHECK_BUFFER (buffer); + b = XBUFFER (buffer); + if (NILP (BVAR (b, name))) + b = NULL; + } + return b; +} + +/* Internal function to set MARKER in BUFFER at POSITION. Non-zero + RESTRICTED means limit the POSITION by the visible part of BUFFER. */ + +static inline Lisp_Object +set_marker_internal (Lisp_Object marker, Lisp_Object position, + Lisp_Object buffer, int restricted) +{ register struct Lisp_Marker *m; + register struct buffer *b = live_buffer (buffer); CHECK_MARKER (marker); m = XMARKER (marker); - /* If position is nil or a marker that points nowhere, - make this marker point nowhere. */ + /* Set MARKER to point nowhere if BUFFER is dead, or + POSITION is nil or a marker points to nowhere. */ if (NILP (position) - || (MARKERP (position) && !XMARKER (position)->buffer)) - { - unchain_marker (m); - return marker; - } - - if (NILP (buffer)) - b = current_buffer; - else - { - CHECK_BUFFER (buffer); - b = XBUFFER (buffer); - /* If buffer is dead, set marker to point nowhere. */ - if (EQ (BVAR (b, name), Qnil)) - { - unchain_marker (m); - return marker; - } - } - - /* Optimize the special case where we are copying the position - of an existing marker, and MARKER is already in the same buffer. */ - if (MARKERP (position) && b == XMARKER (position)->buffer - && b == m->buffer) + || (MARKERP (position) && !XMARKER (position)->buffer) + || !b) + unchain_marker (m); + + /* Optimize the special case where we are copying the position of + an existing marker, and MARKER is already in the same buffer. */ + else if (MARKERP (position) && b == XMARKER (position)->buffer + && b == m->buffer) { m->bytepos = XMARKER (position)->bytepos; m->charpos = XMARKER (position)->charpos; - return marker; - } - - CHECK_NUMBER_COERCE_MARKER (position); - charpos = clip_to_bounds (BUF_BEG (b), XINT (position), BUF_Z (b)); - bytepos = buf_charpos_to_bytepos (b, charpos); - - attach_marker (m, b, charpos, bytepos); + } + + else + { + register ptrdiff_t charpos, bytepos; + + CHECK_NUMBER_COERCE_MARKER (position); + charpos = clip_to_bounds (restricted ? BUF_BEGV (b) : BUF_BEG (b), + XINT (position), + restricted ? BUF_ZV (b) : BUF_Z (b)); + bytepos = buf_charpos_to_bytepos (b, charpos); + attach_marker (m, b, charpos, bytepos); + } return marker; } -/* This version of Fset_marker won't let the position - be outside the visible part. */ +DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0, + doc: /* Position MARKER before character number POSITION in BUFFER, +which defaults to the current buffer. If POSITION is nil, +makes marker point nowhere so it no longer slows down +editing in any buffer. Returns MARKER. */) + (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) +{ + return set_marker_internal (marker, position, buffer, 0); +} + +/* Like the above, but won't let the position be outside the visible part. */ Lisp_Object -set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) +set_marker_restricted (Lisp_Object marker, Lisp_Object position, + Lisp_Object buffer) { - register ptrdiff_t charpos; - register ptrdiff_t bytepos; - register struct buffer *b; - register struct Lisp_Marker *m; - - CHECK_MARKER (marker); - m = XMARKER (marker); - - /* If position is nil or a marker that points nowhere, - make this marker point nowhere. */ - if (NILP (pos) - || (MARKERP (pos) && !XMARKER (pos)->buffer)) - { - unchain_marker (m); - return marker; - } - - if (NILP (buffer)) - b = current_buffer; - else - { - CHECK_BUFFER (buffer); - b = XBUFFER (buffer); - /* If buffer is dead, set marker to point nowhere. */ - if (EQ (BVAR (b, name), Qnil)) - { - unchain_marker (m); - return marker; - } - } - - /* Optimize the special case where we are copying the position - of an existing marker, and MARKER is already in the same buffer. */ - if (MARKERP (pos) && b == XMARKER (pos)->buffer - && b == m->buffer) - { - m->bytepos = XMARKER (pos)->bytepos; - m->charpos = XMARKER (pos)->charpos; - return marker; - } - - CHECK_NUMBER_COERCE_MARKER (pos); - charpos = clip_to_bounds (BUF_BEGV (b), XINT (pos), BUF_ZV (b)); - bytepos = buf_charpos_to_bytepos (b, charpos); - - attach_marker (m, b, charpos, bytepos); - return marker; + return set_marker_internal (marker, position, buffer, 1); } - + /* Set the position of MARKER, specifying both the character position and the corresponding byte position. */ Lisp_Object -set_marker_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t charpos, ptrdiff_t bytepos) +set_marker_both (Lisp_Object marker, Lisp_Object buffer, + ptrdiff_t charpos, ptrdiff_t bytepos) { - register struct buffer *b; register struct Lisp_Marker *m; + register struct buffer *b = live_buffer (buffer); CHECK_MARKER (marker); m = XMARKER (marker); - if (NILP (buffer)) - b = current_buffer; + if (b) + attach_marker (m, b, charpos, bytepos); else - { - CHECK_BUFFER (buffer); - b = XBUFFER (buffer); - /* If buffer is dead, set marker to point nowhere. */ - if (EQ (BVAR (b, name), Qnil)) - { - unchain_marker (m); - return marker; - } - } - - /* In a single-byte buffer, the two positions must be equal. */ - if (BUF_Z (b) == BUF_Z_BYTE (b) - && charpos != bytepos) - abort (); - - attach_marker (m, b, charpos, bytepos); + unchain_marker (m); return marker; } -/* This version of set_marker_both won't let the position - be outside the visible part. */ +/* Like the above, but won't let the position be outside the visible part. */ Lisp_Object -set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t charpos, ptrdiff_t bytepos) +set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, + ptrdiff_t charpos, ptrdiff_t bytepos) { - register struct buffer *b; register struct Lisp_Marker *m; + register struct buffer *b = live_buffer (buffer); CHECK_MARKER (marker); m = XMARKER (marker); - if (NILP (buffer)) - b = current_buffer; - else + if (b) { - CHECK_BUFFER (buffer); - b = XBUFFER (buffer); - /* If buffer is dead, set marker to point nowhere. */ - if (EQ (BVAR (b, name), Qnil)) - { - unchain_marker (m); - return marker; - } + attach_marker + (m, b, + clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b)), + clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b))); } - - charpos = clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b)); - bytepos = clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b)); - - /* In a single-byte buffer, the two positions must be equal. */ - if (BUF_Z (b) == BUF_Z_BYTE (b) - && charpos != bytepos) - abort (); - - attach_marker (m, b, charpos, bytepos); + else + unchain_marker (m); return marker; } - + /* Remove MARKER from the chain of whatever buffer it is in, leaving it points to nowhere. This is called during garbage collection, so we must be careful to ignore and preserve ------------------------------------------------------------ revno: 109185 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-07-21 21:16:53 -0700 message: Merge from gnulib (comment changes only). diff: === modified file 'lib/verify.h' --- lib/verify.h 2012-05-26 23:14:36 +0000 +++ lib/verify.h 2012-07-22 04:16:53 +0000 @@ -125,7 +125,7 @@ extern int (*dummy (void)) [sizeof (struct {...})]; * GCC warns about duplicate declarations of the dummy function if - -Wredundant_decls is used. GCC 4.3 and later have a builtin + -Wredundant-decls is used. GCC 4.3 and later have a builtin __COUNTER__ macro that can let us generate unique identifiers for each dummy function, to suppress this warning. @@ -133,6 +133,10 @@ which do not support _Static_assert, also do not warn about the last declaration mentioned above. + * GCC warns if -Wnested-externs is enabled and verify() is used + within a function body; but inside a function, you can always + arrange to use verify_expr() instead. + * In C++, any struct definition inside sizeof is invalid. Use a template type to work around the problem. */ ------------------------------------------------------------ revno: 109184 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-07-21 21:11:49 -0700 message: Spelling fixes. diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-07-18 14:48:25 +0000 +++ etc/NEWS 2012-07-22 04:11:49 +0000 @@ -354,7 +354,7 @@ *** `dired-do-async-shell-command' executes each file sequentially if the command ends in `;' (when operating on multiple files). -Othwerwise, it executes the command on each file in parallel. +Otherwise, it executes the command on each file in parallel. ** FFAP === modified file 'lisp/ses.el' --- lisp/ses.el 2012-07-20 21:09:04 +0000 +++ lisp/ses.el 2012-07-22 04:11:49 +0000 @@ -3213,7 +3213,7 @@ (col (cdr rowcol)) (cell (ses-get-cell row col))) (put new-name 'ses-cell rowcol) - ;; replace name by new name in formula of cells refering to renamed cell + ;; Replace name by new name in formula of cells referring to renamed cell. (dolist (ref (ses-cell-references cell)) (let* ((x (ses-sym-rowcol ref)) (xcell (ses-get-cell (car x) (cdr x)))) @@ -3228,8 +3228,8 @@ (let* ((x (ses-sym-rowcol ref)) (xrow (car x)) (xcol (cdr x))) - (ses-set-cell xrow xcol 'references - (cons new-name (delq ses--curcell + (ses-set-cell xrow xcol 'references + (cons new-name (delq ses--curcell (ses-cell-references xrow xcol)))))) (push new-name ses--renamed-cell-symb-list) (set new-name (symbol-value ses--curcell)) ------------------------------------------------------------ revno: 109183 committer: Paul Eggert branch nick: trunk timestamp: Sat 2012-07-21 20:44:35 -0700 message: * buffer.h (struct buffer.indirections): Now ptrdiff_t, not int, as it's limited by the amount of memory, not by INT_MAX. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 19:26:25 +0000 +++ src/ChangeLog 2012-07-22 03:44:35 +0000 @@ -1,3 +1,8 @@ +2012-07-22 Paul Eggert + + * buffer.h (struct buffer.indirections): Now ptrdiff_t, not int, + as it's limited by the amount of memory, not by INT_MAX. + 2012-07-21 Eli Zaretskii * keyboard.c (keys_of_keyboard): Bind language-change to 'ignore' === modified file 'src/buffer.h' --- src/buffer.h 2012-07-20 16:05:47 +0000 +++ src/buffer.h 2012-07-22 03:44:35 +0000 @@ -776,9 +776,9 @@ struct buffer *base_buffer; /* In an indirect buffer, this is -1. In an ordinary buffer, - it's the number of indirect buffers which shares our text; + it's the number of indirect buffers that share our text; zero means that we're the only owner of this text. */ - int indirections; + ptrdiff_t indirections; /* A non-zero value in slot IDX means that per-buffer variable with index IDX has a local value in this buffer. The index IDX ------------------------------------------------------------ revno: 109182 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-07-21 22:26:25 +0300 message: Fix previous change in w32menu.c. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 14:11:33 +0000 +++ src/ChangeLog 2012-07-21 19:26:25 +0000 @@ -5,7 +5,7 @@ http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00417.html for the reasons. - * w32menu.c (add_menu_item): Cast to UINT_PTR when assigning + * w32menu.c (add_menu_item): Cast to ULONG_PTR when assigning info.dwItemData. Fixes crashes on 64-bit Windows. Suggested by Fabrice Popineau . === modified file 'src/w32menu.c' --- src/w32menu.c 2012-07-21 13:33:32 +0000 +++ src/w32menu.c 2012-07-21 19:26:25 +0000 @@ -1536,10 +1536,10 @@ { /* As of Jul-2012, w32api headers say that dwItemData has DWORD type, but that's a bug: it should actually - be UINT_PTR, which is correct for 32-bit and 64-bit + be ULONG_PTR, which is correct for 32-bit and 64-bit Windows alike. MSVC headers get it right; hopefully, MinGW headers will, too. */ - info.dwItemData = (UINT_PTR) XLI (wv->help); + info.dwItemData = (ULONG_PTR) XLI (wv->help); } if (wv->button_type == BUTTON_TYPE_RADIO) { ------------------------------------------------------------ revno: 109181 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-07-21 17:48:17 +0300 message: Improve documentation of special events and of the "e" interactive spec. doc/lispref/commands.texi (Special Events): Mention language-change event. (Input Events, Interactive Codes): doc/lispref/keymaps.texi (Key Sequences): Mention events that are non-keyboard but also non-mouse events. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-07-17 07:43:01 +0000 +++ doc/lispref/ChangeLog 2012-07-21 14:48:17 +0000 @@ -1,3 +1,10 @@ +2012-07-21 Eli Zaretskii + + * commands.texi (Special Events): Mention language-change event. + (Input Events, Interactive Codes): + * keymaps.texi (Key Sequences): Mention events that are + non-keyboard but also non-mouse events. + 2012-07-17 Chong Yidong * text.texi (Insertion): Document insert-char changes. === modified file 'doc/lispref/commands.texi' --- doc/lispref/commands.texi 2012-06-23 12:39:23 +0000 +++ doc/lispref/commands.texi 2012-07-21 14:48:17 +0000 @@ -379,9 +379,14 @@ Existing, Completion, Default, Prompt. @item e -The first or next mouse event in the key sequence that invoked the command. -More precisely, @samp{e} gets events that are lists, so you can look at -the data in the lists. @xref{Input Events}. No I/O. +The first or next non-keyboard event in the key sequence that invoked +the command. More precisely, @samp{e} gets events that are lists, so +you can look at the data in the lists. @xref{Input Events}. No I/O. + +You use @samp{e} for mouse events and for special system events +(@pxref{Misc Events}). The event list that the command receives +depends on the event. @xref{Input Events}, which describes the forms +of the list for each event in the corresponding subsections. You can use @samp{e} more than once in a single command's interactive specification. If the key sequence that invoked the command has @@ -972,9 +977,10 @@ @cindex input events The Emacs command loop reads a sequence of @dfn{input events} that -represent keyboard or mouse activity. The events for keyboard activity -are characters or symbols; mouse events are always lists. This section -describes the representation and meaning of input events in detail. +represent keyboard or mouse activity, or system events sent to Emacs. +The events for keyboard activity are characters or symbols; other +events are always lists. This section describes the representation +and meaning of input events in detail. @defun eventp object This function returns non-@code{nil} if @var{object} is an input event @@ -2840,11 +2846,11 @@ definition to find the actual event. The events types @code{iconify-frame}, @code{make-frame-visible}, -@code{delete-frame}, @code{drag-n-drop}, and user signals like -@code{sigusr1} are normally handled in this way. The keymap which -defines how to handle special events---and which events are -special---is in the variable @code{special-event-map} (@pxref{Active -Keymaps}). +@code{delete-frame}, @code{drag-n-drop}, @code{language-change}, and +user signals like @code{sigusr1} are normally handled in this way. +The keymap which defines how to handle special events---and which +events are special---is in the variable @code{special-event-map} +(@pxref{Active Keymaps}). @node Waiting @section Waiting for Elapsed Time or Input === modified file 'doc/lispref/keymaps.texi' --- doc/lispref/keymaps.texi 2012-06-17 05:13:40 +0000 +++ doc/lispref/keymaps.texi 2012-07-21 14:48:17 +0000 @@ -45,7 +45,8 @@ A @dfn{key sequence}, or @dfn{key} for short, is a sequence of one or more input events that form a unit. Input events include -characters, function keys, and mouse actions (@pxref{Input Events}). +characters, function keys, mouse actions, or system events external to +Emacs, such as @code{iconify-frame} (@pxref{Input Events}). The Emacs Lisp representation for a key sequence is a string or vector. Unless otherwise stated, any Emacs Lisp function that accepts a key sequence as an argument can handle both representations. @@ -62,9 +63,10 @@ constituent events; thus, @code{"\C-xl"} represents the key sequence @kbd{C-x l}. - Key sequences containing function keys, mouse button events, or -non-@acronym{ASCII} characters such as @kbd{C-=} or @kbd{H-a} cannot be -represented as strings; they have to be represented as vectors. + Key sequences containing function keys, mouse button events, system +events, or non-@acronym{ASCII} characters such as @kbd{C-=} or +@kbd{H-a} cannot be represented as strings; they have to be +represented as vectors. In the vector representation, each element of the vector represents an input event, in its Lisp form. @xref{Input Events}. For example, ------------------------------------------------------------ revno: 109180 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-07-21 17:11:33 +0300 message: Bind language-change in special-event-map. src/keyboard.c (keys_of_keyboard): Bind language-change to 'ignore' in special-event-map. See the discussion at http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00417.html for the reasons. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 13:33:32 +0000 +++ src/ChangeLog 2012-07-21 14:11:33 +0000 @@ -1,5 +1,10 @@ 2012-07-21 Eli Zaretskii + * keyboard.c (keys_of_keyboard): Bind language-change to 'ignore' + in special-event-map. See the discussion at + http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00417.html + for the reasons. + * w32menu.c (add_menu_item): Cast to UINT_PTR when assigning info.dwItemData. Fixes crashes on 64-bit Windows. Suggested by Fabrice Popineau . === modified file 'src/keyboard.c' --- src/keyboard.c 2012-07-20 05:28:00 +0000 +++ src/keyboard.c 2012-07-21 14:11:33 +0000 @@ -12232,6 +12232,10 @@ initial_define_lispy_key (Vspecial_event_map, "config-changed-event", "ignore"); +#if defined (WINDOWSNT) + initial_define_lispy_key (Vspecial_event_map, "language-change", + "ignore"); +#endif } /* Mark the pointers in the kboard objects. ------------------------------------------------------------ revno: 109179 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2012-07-21 16:33:32 +0300 message: Fix data type casting when setting up menus on Windows. src/w32menu.c (add_menu_item): Cast to UINT_PTR when assigning info.dwItemData. Fixes crashes on 64-bit Windows. Suggested by Fabrice Popineau . diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 12:10:49 +0000 +++ src/ChangeLog 2012-07-21 13:33:32 +0000 @@ -1,3 +1,9 @@ +2012-07-21 Eli Zaretskii + + * w32menu.c (add_menu_item): Cast to UINT_PTR when assigning + info.dwItemData. Fixes crashes on 64-bit Windows. Suggested by + Fabrice Popineau . + 2012-07-21 Jan Djärv * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134). === modified file 'src/w32menu.c' --- src/w32menu.c 2012-07-11 07:19:44 +0000 +++ src/w32menu.c 2012-07-21 13:33:32 +0000 @@ -1533,7 +1533,14 @@ until it is ready to be displayed, since GC can happen while menus are active. */ if (!NILP (wv->help)) - info.dwItemData = (DWORD) XLI (wv->help); + { + /* As of Jul-2012, w32api headers say that dwItemData + has DWORD type, but that's a bug: it should actually + be UINT_PTR, which is correct for 32-bit and 64-bit + Windows alike. MSVC headers get it right; hopefully, + MinGW headers will, too. */ + info.dwItemData = (UINT_PTR) XLI (wv->help); + } if (wv->button_type == BUTTON_TYPE_RADIO) { /* CheckMenuRadioItem allows us to differentiate TOGGLE and ------------------------------------------------------------ revno: 109178 committer: Jan D. branch nick: trunk timestamp: Sat 2012-07-21 14:10:49 +0200 message: * nsterm.m (accessibilityAttributeValue): Surround with NS_IMPL_COCOA. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 11:34:19 +0000 +++ src/ChangeLog 2012-07-21 12:10:49 +0000 @@ -2,6 +2,7 @@ * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134). (conversationIdentifier): Return value is NSInteger. + * nsterm.m (accessibilityAttributeValue): Surround with NS_IMPL_COCOA. 2012-07-21 Chong Yidong === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-21 11:34:19 +0000 +++ src/nsterm.m 2012-07-21 12:10:49 +0000 @@ -6038,6 +6038,7 @@ @implementation EmacsWindow +#ifdef NS_IMPL_COCOA - (id)accessibilityAttributeValue:(NSString *)attribute { Lisp_Object str = Qnil; @@ -6092,6 +6093,7 @@ return [super accessibilityAttributeValue:attribute]; } +#endif /* NS_IMPL_COCOA */ /* If we have multiple monitors, one above the other, we don't want to restrict the height to just one monitor. So we override this. */ ------------------------------------------------------------ revno: 109177 committer: Jan D. branch nick: trunk timestamp: Sat 2012-07-21 13:34:19 +0200 message: * nsterm.m (conversationIdentifier): Return value is NSInteger. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 10:23:21 +0000 +++ src/ChangeLog 2012-07-21 11:34:19 +0000 @@ -1,6 +1,7 @@ 2012-07-21 Jan Djärv * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134). + (conversationIdentifier): Return value is NSInteger. 2012-07-21 Chong Yidong === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-21 10:23:21 +0000 +++ src/nsterm.m 2012-07-21 11:34:19 +0000 @@ -5059,9 +5059,9 @@ } -- (long)conversationIdentifier +- (NSInteger)conversationIdentifier { - return (long)self; + return (NSInteger)self; } ------------------------------------------------------------ revno: 109176 committer: Julien Danjou branch nick: trunk timestamp: Sat 2012-07-21 13:08:32 +0200 message: erc-notifications: new file diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2012-06-15 14:47:31 +0000 +++ lisp/erc/ChangeLog 2012-07-21 11:08:32 +0000 @@ -1,3 +1,7 @@ +2012-07-21 Julien Danjou + + * erc-notifications.el: New file. + 2012-06-15 Julien Danjou * erc.el (erc-open): Use `auth-source' for password retrieval when === added file 'lisp/erc/erc-notifications.el' --- lisp/erc/erc-notifications.el 1970-01-01 00:00:00 +0000 +++ lisp/erc/erc-notifications.el 2012-07-21 11:08:32 +0000 @@ -0,0 +1,90 @@ +;; erc-notifications.el -- Send notification on PRIVMSG or mentions + +;; Copyright (C) 2012 Free Software Foundation, Inc. + +;; Author: Julien Danjou +;; Keywords: comm + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; This implements notifications using `notifications-notify' on +;; PRIVMSG received and on public nickname mentions. + +;;; Code: + +(require 'erc) +(require 'xml) +(require 'notifications) +(require 'erc-match) +(require 'dbus) + +(defgroup erc-notifications nil + "Send notifications on PRIVMSG or mentions." + :group 'erc) + +(defvar erc-notifications-last-notification nil + "Last notification id.") + +(defcustom erc-notifications-icon nil + "Icon to use for notification." + :group 'erc-notifications + :type 'file) + +(defun erc-notifications-notify (nick msg) + "Notify that NICK send some MSG. +This will replace the last notification sent with this function." + (dbus-ignore-errors + (setq erc-notifications-last-notification + (notifications-notify :title (xml-escape-string nick) + :body (xml-escape-string msg) + :replaces-id erc-notifications-last-notification + :app-icon erc-notifications-icon)))) + +(defun erc-notifications-PRIVMSG (proc parsed) + (let ((nick (car (erc-parse-user (erc-response.sender parsed)))) + (target (car (erc-response.command-args parsed))) + (msg (erc-response.contents parsed))) + (when (and (erc-current-nick-p target) + (not (and (boundp 'erc-track-exclude) + (member nick erc-track-exclude))) + (not (erc-is-message-ctcp-and-not-action-p msg))) + (erc-notifications-notify nick msg))) + ;; Return nil to continue processing by ERC + nil) + +(defun erc-notifications-notify-on-match (match-type nickuserhost msg) + (when (eq match-type 'current-nick) + (let ((nick (nth 0 (erc-parse-user nickuserhost)))) + (unless (or (string-match-p "^Server:" nick) + (when (boundp 'erc-track-exclude) + (member nick erc-track-exclude))) + (erc-notifications-notify nick msg))))) + +;;;###autoload(autoload 'erc-notifications-mode "erc-notifications" "" t) +(define-erc-module notifications nil + "Send notifications on private message reception and mentions." + ;; Enable + ((add-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG) + (add-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match)) + ;; Disable + ((remove-hook 'erc-server-PRIVMSG-functions 'erc-notifications-PRIVMSG) + (remove-hook 'erc-text-matched-hook 'erc-notifications-notify-on-match))) + +(provide 'erc-notifications) + +;;; erc-notifications.el ends here ------------------------------------------------------------ revno: 109175 author: Julien Danjou committer: Katsumi Yamaoka branch nick: trunk timestamp: Sat 2012-07-21 11:05:32 +0000 message: lisp/gnus/message.el: Replace deprecated rmail vars diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-07-18 10:38:37 +0000 +++ lisp/gnus/ChangeLog 2012-07-21 11:05:32 +0000 @@ -1,3 +1,9 @@ +2012-07-21 Julien Danjou + + * message.el (message-dont-reply-to-names): Replace deprecated + `rmail-dont-reply-to-names' with `mail-dont-reply-to-names'. + (message-get-reply-headers): Ditto. + 2012-07-18 Julien Danjou * sieve-mode.el (sieve-mode-map): Bind C-c C-c to === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2012-06-26 22:52:31 +0000 +++ lisp/gnus/message.el 2012-07-21 11:05:32 +0000 @@ -1332,11 +1332,11 @@ :type 'symbol) (defcustom message-dont-reply-to-names - (and (boundp 'rmail-dont-reply-to-names) rmail-dont-reply-to-names) + (and (boundp 'mail-dont-reply-to-names) mail-dont-reply-to-names) "*Addresses to prune when doing wide replies. This can be a regexp or a list of regexps. Also, a value of nil means exclude your own user name only." - :version "21.1" + :version "24.2" :group 'message :link '(custom-manual "(message)Wide Reply") :type '(choice (const :tag "Yourself" nil) @@ -1933,7 +1933,7 @@ (autoload 'nndraft-request-associate-buffer "nndraft") (autoload 'nndraft-request-expire-articles "nndraft") (autoload 'nnvirtual-find-group-art "nnvirtual") -(autoload 'rmail-dont-reply-to "mail-utils") +(autoload 'mail-dont-reply-to "mail-utils") (autoload 'rmail-msg-is-pruned "rmail") (autoload 'rmail-output "rmailout") @@ -6802,9 +6802,9 @@ ;; Squeeze whitespace. (while (string-match "[ \t][ \t]+" recipients) (setq recipients (replace-match " " t t recipients))) - ;; Remove addresses that match `rmail-dont-reply-to-names'. - (let ((rmail-dont-reply-to-names (message-dont-reply-to-names))) - (setq recipients (rmail-dont-reply-to recipients))) + ;; Remove addresses that match `mail-dont-reply-to-names'. + (let ((mail-dont-reply-to-names (message-dont-reply-to-names))) + (setq recipients (mail-dont-reply-to recipients))) ;; Perhaps "Mail-Copies-To: never" removed the only address? (if (string-equal recipients "") (setq recipients author)) ------------------------------------------------------------ revno: 109174 fixes bug(s): http://debbugs.gnu.org/11134 committer: Jan D. branch nick: trunk timestamp: Sat 2012-07-21 12:23:21 +0200 message: * nsterm.m (accessibilityAttributeValue): New function.. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 06:17:30 +0000 +++ src/ChangeLog 2012-07-21 10:23:21 +0000 @@ -1,3 +1,7 @@ +2012-07-21 Jan Djärv + + * nsterm.m (accessibilityAttributeValue): New function. (Bug#11134). + 2012-07-21 Chong Yidong * window.c (decode_any_window): Signal an error if the window is === modified file 'src/nsterm.m' --- src/nsterm.m 2012-07-16 11:02:09 +0000 +++ src/nsterm.m 2012-07-21 10:23:21 +0000 @@ -55,7 +55,7 @@ #include "window.h" #include "keyboard.h" - +#include "buffer.h" #include "font.h" /* call tracing */ @@ -6038,6 +6038,61 @@ @implementation EmacsWindow +- (id)accessibilityAttributeValue:(NSString *)attribute +{ + Lisp_Object str = Qnil; + struct frame *f = SELECTED_FRAME (); + struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer); + + if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) + return NSAccessibilityTextFieldRole; + + if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] + && curbuf && ! NILP (BVAR (curbuf, mark_active))) + { + str = ns_get_local_selection (QPRIMARY, QUTF8_STRING); + } + else if (curbuf && [attribute isEqualToString:NSAccessibilityValueAttribute]) + { + if (! NILP (BVAR (curbuf, mark_active))) + str = ns_get_local_selection (QPRIMARY, QUTF8_STRING); + + if (NILP (str)) + { + ptrdiff_t start_byte = BUF_BEGV_BYTE (curbuf); + ptrdiff_t byte_range = BUF_ZV_BYTE (curbuf) - start_byte; + ptrdiff_t range = BUF_ZV (curbuf) - BUF_BEGV (curbuf); + + if (! NILP (BVAR (curbuf, enable_multibyte_characters))) + str = make_uninit_multibyte_string (range, byte_range); + else + str = make_uninit_string (range); + /* To check: This returns emacs-utf-8, which is a superset of utf-8. + Is this a problem? */ + memcpy (SDATA (str), BYTE_POS_ADDR (start_byte), byte_range); + } + } + + + if (! NILP (str)) + { + if (CONSP (str) && SYMBOLP (XCAR (str))) + { + str = XCDR (str); + if (CONSP (str) && NILP (XCDR (str))) + str = XCAR (str); + } + if (STRINGP (str)) + { + const char *utfStr = SSDATA (str); + NSString *nsStr = [NSString stringWithUTF8String: utfStr]; + return nsStr; + } + } + + return [super accessibilityAttributeValue:attribute]; +} + /* If we have multiple monitors, one above the other, we don't want to restrict the height to just one monitor. So we override this. */ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen ------------------------------------------------------------ revno: 109173 fixes bug(s): http://debbugs.gnu.org/11984 committer: Chong Yidong branch nick: trunk timestamp: Sat 2012-07-21 14:17:30 +0800 message: Disallow windows on dead frames in decode_any_window. * window.c (decode_any_window): Signal an error if the window is on a dead frame. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-21 06:13:23 +0000 +++ src/ChangeLog 2012-07-21 06:17:30 +0000 @@ -1,3 +1,8 @@ +2012-07-21 Chong Yidong + + * window.c (decode_any_window): Signal an error if the window is + on a dead frame (Bug#11984). + 2012-07-20 Dmitry Antipov Add indirection counting to speed up Fkill_buffer. === modified file 'src/window.c' --- src/window.c 2012-07-21 06:13:23 +0000 +++ src/window.c 2012-07-21 06:17:30 +0000 @@ -144,11 +144,15 @@ static struct window * decode_any_window (register Lisp_Object window) { + struct window *w; + if (NILP (window)) return XWINDOW (selected_window); CHECK_WINDOW (window); - return XWINDOW (window); + w = XWINDOW (window); + CHECK_LIVE_FRAME (w->frame); + return w; } DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,