aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2015-01-28 01:03:46 -0300
committerFabián Ezequiel Gallina2015-01-28 01:03:46 -0300
commit33ab7ee0edcb3608e4a3d5deebc2b72c180dbfe4 (patch)
tree946ccc8bdc1f41a2c4066e6fcef4bfd04a9d693a /lisp/textmodes
parent85ca47671ccbffe87d6ccad17039b49d6b676d61 (diff)
parent8ee825c35b62768e28fe825163dea90d3ab46022 (diff)
downloademacs-33ab7ee0edcb3608e4a3d5deebc2b72c180dbfe4.tar.gz
emacs-33ab7ee0edcb3608e4a3d5deebc2b72c180dbfe4.zip
Merge from origin/emacs-24
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).
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/artist.el95
1 files changed, 49 insertions, 46 deletions
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 8a2383c12ff..85d9410868a 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -4963,52 +4963,55 @@ The event, EV, is the mouse event."
4963 (artist-funcall init-fn x1 y1) 4963 (artist-funcall init-fn x1 y1)
4964 (if (not artist-rubber-banding) 4964 (if (not artist-rubber-banding)
4965 (artist-no-rb-set-point1 x1 y1)) 4965 (artist-no-rb-set-point1 x1 y1))
4966 (track-mouse 4966 (unwind-protect
4967 (while (or (mouse-movement-p ev) 4967 (track-mouse
4968 (member 'down (event-modifiers ev))) 4968 (while (or (mouse-movement-p ev)
4969 (setq ev-start-pos (artist-coord-win-to-buf 4969 (member 'down (event-modifiers ev)))
4970 (posn-col-row (event-start ev)))) 4970 (setq ev-start-pos (artist-coord-win-to-buf
4971 (setq x1 (car ev-start-pos)) 4971 (posn-col-row (event-start ev))))
4972 (setq y1 (cdr ev-start-pos)) 4972 (setq x1 (car ev-start-pos))
4973 4973 (setq y1 (cdr ev-start-pos))
4974 ;; Cancel previous timer 4974
4975 (if timer 4975 ;; Cancel previous timer
4976 (cancel-timer timer)) 4976 (if timer
4977 4977 (cancel-timer timer))
4978 (if (not (eq initial-win (posn-window (event-start ev)))) 4978
4979 ;; If we moved outside the window, do nothing 4979 (if (not (eq initial-win (posn-window (event-start ev))))
4980 nil 4980 ;; If we moved outside the window, do nothing
4981 4981 nil
4982 ;; Still in same window: 4982
4983 ;; 4983 ;; Still in same window:
4984 ;; Check if user presses or releases shift key 4984 ;;
4985 (if (artist-shift-has-changed shift-state ev) 4985 ;; Check if user presses or releases shift key
4986 4986 (if (artist-shift-has-changed shift-state ev)
4987 ;; First check that the draw-how is the same as we 4987
4988 ;; already have. Otherwise, ignore the changed shift-state. 4988 ;; First check that the draw-how is the same as we
4989 (if (not (eq draw-how 4989 ;; already have. Otherwise, ignore the changed shift-state.
4990 (artist-go-get-draw-how-from-symbol 4990 (if (not (eq draw-how
4991 (if (not shift-state) shifted unshifted)))) 4991 (artist-go-get-draw-how-from-symbol
4992 (message "Cannot switch to shifted operation") 4992 (if (not shift-state) shifted unshifted))))
4993 4993 (message "Cannot switch to shifted operation")
4994 ;; progn is "implicit" since this is the else-part 4994
4995 (setq shift-state (not shift-state)) 4995 ;; progn is "implicit" since this is the else-part
4996 (setq op (if shift-state shifted unshifted)) 4996 (setq shift-state (not shift-state))
4997 (setq draw-how (artist-go-get-draw-how-from-symbol op)) 4997 (setq op (if shift-state shifted unshifted))
4998 (setq draw-fn (artist-go-get-draw-fn-from-symbol op)))) 4998 (setq draw-how (artist-go-get-draw-how-from-symbol op))
4999 4999 (setq draw-fn (artist-go-get-draw-fn-from-symbol op))))
5000 ;; Draw the new shape 5000
5001 (setq shape (artist-funcall draw-fn x1 y1)) 5001 ;; Draw the new shape
5002 (artist-move-to-xy x1 y1) 5002 (setq shape (artist-funcall draw-fn x1 y1))
5003 5003 (artist-move-to-xy x1 y1)
5004 ;; Start the timer to call `draw-fn' repeatedly every 5004
5005 ;; `interval' second 5005 ;; Start the timer to call `draw-fn' repeatedly every
5006 (if (and interval draw-fn) 5006 ;; `interval' second
5007 (setq timer (run-at-time interval interval draw-fn x1 y1)))) 5007 (if (and interval draw-fn)
5008 5008 (setq timer (run-at-time interval interval draw-fn x1 y1))))
5009 ;; Read next event 5009
5010 (setq ev (read-event)))) 5010 ;; Read next event
5011 5011 (setq ev (read-event))))
5012 ;; Cleanup: get rid of any active timer.
5013 (if timer
5014 (cancel-timer timer)))
5012 ;; Cancel any timers 5015 ;; Cancel any timers
5013 (if timer 5016 (if timer
5014 (cancel-timer timer)) 5017 (cancel-timer timer))