diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-04-30 21:08:08 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2014-04-30 21:08:08 -0400 |
commit | 4ec0cf9c4c29758bd46eec39313984434d455656 (patch) | |
tree | a8ca5935f4b20e87080d09dba079d49ce5a7a0cd /lisp/mpc.el | |
parent | 426b5dafdd837328d624a8ec5bfd567f2865c9f5 (diff) | |
download | emacs-4ec0cf9c4c29758bd46eec39313984434d455656.tar.gz emacs-4ec0cf9c4c29758bd46eec39313984434d455656.tar.bz2 emacs-4ec0cf9c4c29758bd46eec39313984434d455656.zip |
* lisp/mpc.el (mpc-volume-mouse-set): Don't burp at the boundaries.
Diffstat (limited to 'lisp/mpc.el')
-rw-r--r-- | lisp/mpc.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/mpc.el b/lisp/mpc.el index d89231e81b9..d569610a615 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -1811,9 +1811,14 @@ A value of t means the main playlist.") (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)) |