emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111797: Display a mode-line frame co


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111797: Display a mode-line frame counter for animated images
Date: Fri, 15 Feb 2013 20:58:20 -0500
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111797
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Fri 2013-02-15 20:58:20 -0500
message:
  Display a mode-line frame counter for animated images
  
  * lisp/image.el (image-current-frame): New variable.
  (image-animate-timeout): Set image-current-frame.
  
  * lisp/image-mode.el (image-mode): For animated images,
  display a frame counter via mode-line-process.
modified:
  lisp/ChangeLog
  lisp/image-mode.el
  lisp/image.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-02-16 01:55:31 +0000
+++ b/lisp/ChangeLog    2013-02-16 01:58:20 +0000
@@ -1,5 +1,10 @@
 2013-02-16  Glenn Morris  <address@hidden>
 
+       * image.el (image-current-frame): New variable.
+       (image-animate-timeout): Set image-current-frame.
+       * image-mode.el (image-mode): For animated images,
+       display a frame counter via mode-line-process.
+
        * font-lock.el (lisp-font-lock-keywords-1): Add defvar-local.
 
 2013-02-15  Stefan Monnier  <address@hidden>

=== modified file 'lisp/image-mode.el'
--- a/lisp/image-mode.el        2013-02-13 08:28:47 +0000
+++ b/lisp/image-mode.el        2013-02-16 01:58:20 +0000
@@ -409,11 +409,18 @@
        (run-mode-hooks 'image-mode-hook)
        (let ((image (image-get-display-property))
              (msg1 (substitute-command-keys
-                    "Type \\[image-toggle-display] to view the image as ")))
+                    "Type \\[image-toggle-display] to view the image as "))
+             animated)
          (cond
           ((null image)
            (message "%s" (concat msg1 "an image.")))
-          ((image-animated-p image)
+          ((setq animated (image-animated-p image))
+           (setq image-current-frame (or (plist-get (cdr image) :index) 0)
+                 mode-line-process
+                 `(:eval (propertize (format " [%s/%s]"
+                                             (1+ image-current-frame)
+                                             ,(car animated))
+                                     'help-echo "Frame number")))
            (message "%s"
                     (concat msg1 "text, or "
                             (substitute-command-keys

=== modified file 'lisp/image.el'
--- a/lisp/image.el     2013-01-02 16:13:04 +0000
+++ b/lisp/image.el     2013-02-16 01:58:20 +0000
@@ -657,6 +657,9 @@
        (setq timer nil)))
     timer))
 
+(defvar-local image-current-frame nil
+  "The frame index of the current animated image.")
+
 ;; FIXME? The delay may not be the same for different sub-images,
 ;; hence we need to call image-animated-p to return it.
 ;; But it also returns count, so why do we bother passing that as an
@@ -672,6 +675,7 @@
  after LIMIT seconds have elapsed.
 The minimum delay between successive frames is 0.01s."
   (plist-put (cdr image) :index n)
+  (setq image-current-frame n)
   (force-window-update)
   (setq n (1+ n))
   (let* ((time (float-time))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]