]> code.delx.au - gnu-emacs/commitdiff
Merge from origin/emacs-24
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Wed, 28 Jan 2015 04:03:46 +0000 (01:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Wed, 28 Jan 2015 04:03:46 +0000 (01:03 -0300)
8ee825c doc/emacs/programs.texi (Custom C Indent): Fix a typo.  (Bug#19647)
88ba49f Fix coding.c subscript error
3ea1b31 Prevent artist-mode from creating runaway timers (Bug#6130).

doc/emacs/ChangeLog
doc/emacs/programs.texi
doc/lispref/ChangeLog
doc/lispref/commands.texi
lisp/ChangeLog
lisp/subr.el
lisp/textmodes/artist.el
src/ChangeLog
src/coding.c

index b7853a7f118c6231193bbc7159c418b13bdc9d21..329da9418f8f2021e7794dddf6532769d19497ff 100644 (file)
@@ -1,3 +1,7 @@
+2015-01-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * programs.texi (Custom C Indent): Fix a typo.  (Bug#19647)
+
 2015-01-27  Ivan Shmakov  <ivan@siamics.net>
 
        * files.texi (File Archives): Document "I" for tar-new-entry.
index 8f6111dfa24f1a2ff160ba700ccf69060720d3c7..609392f6bb78725d69e76ca3bf4066492cb0b603 100644 (file)
@@ -546,7 +546,7 @@ your selected @dfn{style} with the syntactic construct and adds this
 onto the indentation of the @dfn{anchor statement}.
 
 @table @kbd
-@item C-c . @key{RET} @var{style} @key{RET}
+@item C-c . @var{style} @key{RET}
 Select a predefined style @var{style} (@code{c-set-style}).
 @end table
 
index 2bbe28eb16ec3529d13fcfde07dce359b3f6f76a..ef1d79af003380496169602385b1732a1a9e0d03 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-21  Daniel Koning  <dk@danielkoning.com>  (tiny change)
+
+       * commands.texi (Drag Events, Motion Events, Event Examples)
+       (Accessing Mouse): Describe actual range of values that mouse
+       position objects can have.
+
 2015-01-20  Eli Zaretskii  <eliz@gnu.org>
 
        * display.texi (Manipulating Buttons): Explain more about the
index 36c74450ed486bfa54c1990a5e4d54d71c7724c7..6fdc8e2ec797ab8a3083bde8658b3c61cc596552 100644 (file)
@@ -1489,8 +1489,10 @@ prefix @samp{drag-}.  For example, dragging the mouse with button 2
 held down generates a @code{drag-mouse-2} event.  The second and third
 elements of the event give the starting and ending position of the
 drag, as mouse position lists (@pxref{Click Events}).  You can access
-the second element of any mouse event in the same way, with no need to
-distinguish drag events from others.
+the second element of any mouse event in the same way.  However, the
+drag event may end outside the boundaries of the frame that was
+initially selected.  In that case, the third element's position list
+contains that frame in place of a window.
 
 The @samp{drag-} prefix follows the modifier key prefixes such as
 @samp{C-} and @samp{M-}.
@@ -1635,7 +1637,10 @@ represented by lists that look like this:
 
 @noindent
 @var{position} is a mouse position list (@pxref{Click Events}),
-specifying the current position of the mouse cursor.
+specifying the current position of the mouse cursor.  As with the
+end-position of a drag event, this position list may represent a
+location outside the boundaries of the initially selected frame, in
+which case the list contains that frame in place of a window.
 
 The special form @code{track-mouse} enables generation of motion
 events within its body.  Outside of @code{track-mouse} forms, Emacs
@@ -1850,6 +1855,14 @@ into another window.  That produces a pair of events like these:
                    -453816))
 @end smallexample
 
+The frame with input focus might not take up the entire screen, and
+the user might move the mouse outside the scope of the frame. Inside
+the @code{track-mouse} special form, that produces an event like this:
+
+@smallexample
+(mouse-movement (#<frame *ielm* 0x102849a30> nil (563 . 205) 532301936))
+@end smallexample
+
 To handle a SIGUSR1 signal, define an interactive function, and
 bind it to the @code{signal usr1} event sequence:
 
@@ -2014,7 +2027,9 @@ Events}); and @code{nil} otherwise.
 various parts of it:
 
 @defun posn-window position
-Return the window that @var{position} is in.
+Return the window that @var{position} is in.  If @var{position}
+represents a location outside the frame where the event was initiated,
+return that frame instead.
 @end defun
 
 @defun posn-area position
index bf60d38b2a3e58b7e07fb14c96e8c64d4da4beb6..a693cc0bdc67dc97ebbd753c8b96aac5057dc11d 100644 (file)
@@ -1,3 +1,10 @@
+2015-01-21  Daniel Koning  <dk@danielkoning.com>  (tiny change)
+
+       * subr.el (posnp): Correct docstring of `posnp'.
+       (posn-col-row): Make it work with all mouse position objects.
+       * textmodes/artist.el (artist-mouse-draw-continously): Cancel
+       timers if an error occurs during continuous drawing.  (Bug#6130)
+
 2015-01-20  Eli Zaretskii  <eliz@gnu.org>
 
        * button.el (button-activate, push-button): Doc fix.  (Bug#19628)
index 05345853edc73d2625a40970238c5b9740650fa4..68cd230c5e24324d0c2169afe717e78779309552 100644 (file)
@@ -1082,7 +1082,12 @@ The return value is a positive integer."
 ;;;; Extracting fields of the positions in an event.
 
 (defun posnp (obj)
-  "Return non-nil if OBJ appears to be a valid `posn' object."
+  "Return non-nil if OBJ appears to be a valid `posn' object specifying a window.
+If OBJ is a valid `posn' object, but specifies a frame rather
+than a window, return nil."
+  ;; FIXME: Correct the behavior of this function so that all valid
+  ;; `posn' objects are recognized, after updating other code that
+  ;; depends on its present behavior.
   (and (windowp (car-safe obj))
        (atom (car-safe (setq obj (cdr obj))))                ;AREA-OR-POS.
        (integerp (car-safe (car-safe (setq obj (cdr obj))))) ;XOFFSET.
@@ -1142,24 +1147,28 @@ For a scroll-bar event, the result column is 0, and the row
 corresponds to the vertical position of the click in the scroll bar.
 POSITION should be a list of the form returned by the `event-start'
 and `event-end' functions."
-  (let* ((pair   (posn-x-y position))
-        (window (posn-window position))
-        (area   (posn-area position)))
+  (let* ((pair            (posn-x-y position))
+         (frame-or-window (posn-window position))
+         (frame           (if (framep frame-or-window)
+                              frame-or-window
+                            (window-frame frame-or-window)))
+         (window          (when (windowp frame-or-window) frame-or-window))
+         (area            (posn-area position)))
     (cond
-     ((null window)
+     ((null frame-or-window)
       '(0 . 0))
      ((eq area 'vertical-scroll-bar)
       (cons 0 (scroll-bar-scale pair (1- (window-height window)))))
      ((eq area 'horizontal-scroll-bar)
       (cons (scroll-bar-scale pair (window-width window)) 0))
      (t
-      (let* ((frame (if (framep window) window (window-frame window)))
-            ;; FIXME: This should take line-spacing properties on
-            ;; newlines into account.
-            (spacing (when (display-graphic-p frame)
-                       (or (with-current-buffer (window-buffer window)
-                             line-spacing)
-                           (frame-parameter frame 'line-spacing)))))
+      ;; FIXME: This should take line-spacing properties on
+      ;; newlines into account.
+      (let* ((spacing (when (display-graphic-p frame)
+                        (or (with-current-buffer
+                                (window-buffer (frame-selected-window frame))
+                              line-spacing)
+                            (frame-parameter frame 'line-spacing)))))
        (cond ((floatp spacing)
               (setq spacing (truncate (* spacing
                                          (frame-char-height frame)))))
index 8a2383c12ffbcd6e83dc822594d8214209c1b6a9..85d9410868a31272d7cf135b430dce8ddfbffc96 100644 (file)
@@ -4963,52 +4963,55 @@ The event, EV, is the mouse event."
     (artist-funcall init-fn x1 y1)
     (if (not artist-rubber-banding)
        (artist-no-rb-set-point1 x1 y1))
-    (track-mouse
-      (while (or (mouse-movement-p ev)
-                (member 'down (event-modifiers ev)))
-       (setq ev-start-pos (artist-coord-win-to-buf
-                           (posn-col-row (event-start ev))))
-       (setq x1 (car ev-start-pos))
-       (setq y1 (cdr ev-start-pos))
-
-       ;; Cancel previous timer
-       (if timer
-           (cancel-timer timer))
-
-       (if (not (eq initial-win (posn-window (event-start ev))))
-           ;; If we moved outside the window, do nothing
-           nil
-
-         ;; Still in same window:
-         ;;
-         ;; Check if user presses or releases shift key
-         (if (artist-shift-has-changed shift-state ev)
-
-             ;; First check that the draw-how is the same as we
-             ;; already have. Otherwise, ignore the changed shift-state.
-             (if (not (eq draw-how
-                          (artist-go-get-draw-how-from-symbol
-                           (if (not shift-state) shifted unshifted))))
-                 (message "Cannot switch to shifted operation")
-
-               ;; progn is "implicit" since this is the else-part
-               (setq shift-state (not shift-state))
-               (setq op          (if shift-state shifted unshifted))
-               (setq draw-how    (artist-go-get-draw-how-from-symbol op))
-               (setq draw-fn     (artist-go-get-draw-fn-from-symbol op))))
-
-         ;; Draw the new shape
-         (setq shape (artist-funcall draw-fn x1 y1))
-         (artist-move-to-xy x1 y1)
-
-         ;; Start the timer to call `draw-fn' repeatedly every
-         ;; `interval' second
-         (if (and interval draw-fn)
-             (setq timer (run-at-time interval interval draw-fn x1 y1))))
-
-       ;; Read next event
-       (setq ev (read-event))))
-
+    (unwind-protect
+        (track-mouse
+          (while (or (mouse-movement-p ev)
+                     (member 'down (event-modifiers ev)))
+            (setq ev-start-pos (artist-coord-win-to-buf
+                                (posn-col-row (event-start ev))))
+            (setq x1 (car ev-start-pos))
+            (setq y1 (cdr ev-start-pos))
+
+            ;; Cancel previous timer
+            (if timer
+                (cancel-timer timer))
+
+            (if (not (eq initial-win (posn-window (event-start ev))))
+                ;; If we moved outside the window, do nothing
+                nil
+
+              ;; Still in same window:
+              ;;
+              ;; Check if user presses or releases shift key
+              (if (artist-shift-has-changed shift-state ev)
+
+                  ;; First check that the draw-how is the same as we
+                  ;; already have. Otherwise, ignore the changed shift-state.
+                  (if (not (eq draw-how
+                               (artist-go-get-draw-how-from-symbol
+                                (if (not shift-state) shifted unshifted))))
+                      (message "Cannot switch to shifted operation")
+
+                    ;; progn is "implicit" since this is the else-part
+                    (setq shift-state (not shift-state))
+                    (setq op          (if shift-state shifted unshifted))
+                    (setq draw-how    (artist-go-get-draw-how-from-symbol op))
+                    (setq draw-fn     (artist-go-get-draw-fn-from-symbol op))))
+
+              ;; Draw the new shape
+              (setq shape (artist-funcall draw-fn x1 y1))
+              (artist-move-to-xy x1 y1)
+
+              ;; Start the timer to call `draw-fn' repeatedly every
+              ;; `interval' second
+              (if (and interval draw-fn)
+                  (setq timer (run-at-time interval interval draw-fn x1 y1))))
+
+            ;; Read next event
+            (setq ev (read-event))))
+      ;; Cleanup: get rid of any active timer.
+      (if timer
+          (cancel-timer timer)))
     ;; Cancel any timers
     (if timer
        (cancel-timer timer))
index 5ced4734bc9a49a53375db07d665ba3bb6d0b2f6..d46e34c852514918187a0c7689d7b6c4b0b74dbe 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix coding.c subscript error
+       * coding.c (CODING_ISO_INVOKED_CHARSET):
+       Avoid undefined behavior if CODING_ISO_INVOCATION returns negative.
+
 2015-01-17  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (produce_image_glyph): Fix display of images in R2L
index 54811588c6a015e9c34dd1ab4d574810e4050148..a7128ee3e7391bda96ed9db67033656be3119555 100644 (file)
@@ -350,7 +350,8 @@ static Lisp_Object Vbig5_coding_system;
 #define CODING_ISO_BOL(coding) \
   ((coding)->spec.iso_2022.bol)
 #define CODING_ISO_INVOKED_CHARSET(coding, plane)      \
-  CODING_ISO_DESIGNATION ((coding), CODING_ISO_INVOCATION ((coding), (plane)))
+  (CODING_ISO_INVOCATION (coding, plane) < 0 ? -1      \
+   : CODING_ISO_DESIGNATION (coding, CODING_ISO_INVOCATION (coding, plane)))
 #define CODING_ISO_CMP_STATUS(coding)  \
   (&(coding)->spec.iso_2022.cmp_status)
 #define CODING_ISO_EXTSEGMENT_LEN(coding)      \