Advertisement
Guest User

Untitled

a guest
Mar 14th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. ;; Copyright (C) 2015
  2.  
  3.  
  4. ;; This file is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation; either version 3 of the License, or
  7. ;; (at your option) any later version.
  8.  
  9. ;; This file is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13.  
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  16.  
  17. ;;; Jump to a random line
  18. ; sburke@cpan.org
  19. (defun goto-random-line ()
  20. "Go to a random line in this buffer."
  21. ; good for electrobibliomancy.
  22. (interactive)
  23. (goto-line (1+ (random (buffer-line-count)))))
  24.  
  25. (defun buffer-line-count ()
  26. "Return the number of lines in this buffer."
  27. (count-lines (point-min) (point-max)))
  28.  
  29. (defun emms-random-album-enqueue ()
  30. (interactive)
  31. (emms-browse-by-album)
  32. (goto-random-line)
  33. (emms-browser-add-tracks))
  34.  
  35.  
  36. (defun emms-random-albums-enqueue (desired-number)
  37. "Enqueue a desired number of random albums"
  38. (interactive "How many albums you want enqueued: ")
  39. (message "Number of albums added: %d" desired-number)
  40. (setq count 0)
  41. (emms-browse-by-album)
  42. (while (< count desired-number)
  43. (goto-random-line)
  44. (emms-browser-add-tracks)
  45. (setq count (+ 1 count)))
  46. )
  47. (defun emms-random-albums-play (desired-number)
  48. "Play a desired number of random albums"
  49. (interactive "nHow many albums you want played: ")
  50. (message "Number of albums added: %d" desired-number)
  51. (emms-browse-by-album)
  52. (goto-random-line)
  53. (emms-browser-add-tracks-and-play)
  54. (setq count 1)
  55. (while (< count desired-number)
  56. (goto-random-line)
  57. (emms-browser-add-tracks)
  58. (setq count (+ 1 count)))
  59. )
  60.  
  61. (provide 'emms-random-album)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement