emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117039: * lisp/mpc.el (mpc-volume-mouse-set): Do


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-24 r117039: * lisp/mpc.el (mpc-volume-mouse-set): Don't burp at the boundaries.
Date: Thu, 01 May 2014 01:08:14 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117039
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-04-30 21:08:08 -0400
message:
  * lisp/mpc.el (mpc-volume-mouse-set): Don't burp at the boundaries.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/mpc.el                    mpc.el-20091201190351-ubdosyf8lle4bzd3-10
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-04-30 16:59:03 +0000
+++ b/lisp/ChangeLog    2014-05-01 01:08:08 +0000
@@ -1,3 +1,7 @@
+2014-05-01  Stefan Monnier  <address@hidden>
+
+       * mpc.el (mpc-volume-mouse-set): Don't burp at the boundaries.
+
 2014-04-30  Eli Zaretskii  <address@hidden>
 
        * dired.el (dired-initial-position-hook, dired-initial-position):

=== modified file 'lisp/mpc.el'
--- a/lisp/mpc.el       2014-04-06 13:08:00 +0000
+++ b/lisp/mpc.el       2014-05-01 01:08:08 +0000
@@ -1811,9 +1811,14 @@
                         (char-after (posn-point posn))))
                     '(?◁ ?<))
               (- mpc-volume-step) mpc-volume-step))
-         (newvol (+ (string-to-number (cdr (assq 'volume mpc-status))) diff)))
-    (mpc-proc-cmd (list "setvol" newvol) 'mpc-status-refresh)
-    (message "Set MPD volume to %s%%" newvol)))
+         (curvol (string-to-number (cdr (assq 'volume mpc-status))))
+         (newvol (max 0 (min 100 (+ curvol diff)))))
+    (if (= newvol curvol)
+        (progn
+          (message "MPD volume already at %s%%" newvol)
+          (ding))
+      (mpc-proc-cmd (list "setvol" newvol) 'mpc-status-refresh)
+      (message "Set MPD volume to %s%%" newvol))))
 
 (defun mpc-volume-widget (vol &optional size)
   (unless size (setq size 12.5))


reply via email to

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