emms-help
[Top][All Lists]
Advanced

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

Re: [emms-help] emms-browser-add-tracks weirdness


From: Fran Burstall (Gmail)
Subject: Re: [emms-help] emms-browser-add-tracks weirdness
Date: Wed, 21 Nov 2018 09:05:51 +0000

Hi,

I am using emms 5.1 (I am tracking master) and the code you show is the code I see.

The issue arises when (interactive "r") is confronted with nil values for start and end.  I do not understand why this is happening because I can write test functions where this form does not barf on nil arguments but it errors out when used by emms-browser-add-tracks.

---Fran


On Wed, 21 Nov 2018 at 08:52, Pierre Neidhardt <address@hidden> wrote:
I remember I had this issue a while back, but if I'm not mistaken this has been
fixed.
Are you running Emms 5.1?

Here is the code in 5.1:

--8<---------------cut here---------------start------------->8---
(defun emms-browser-add-tracks (&optional start end)
  "Add all tracks at point or in region if active.
When the region is not active, a numeric prefix argument inserts that many
tracks from point.
Return the playlist buffer point-max before adding."
  (interactive "r")
  (let ((count (cond
                ((use-region-p)
                 (1+ (- (line-number-at-pos end) (line-number-at-pos start))))
                ((numberp current-prefix-arg)
                 current-prefix-arg)
                (t 1)))
        (first-new-track (with-current-emms-playlist (point-max))))
    (when (use-region-p) (goto-char start))
    (dotimes (_ count first-new-track)
      (let ((bdata (emms-browser-bdata-at-point)))
        (when bdata
          (emms-browser-playlist-insert-bdata
           bdata (emms-browser-bdata-level bdata))
          (forward-line))))
    (run-hook-with-args 'emms-browser-tracks-added-hook
                        first-new-track)
    (deactivate-mark)
    first-new-track))
--8<---------------cut here---------------end--------------->8---

I don't see a problem there, but I could be wrong.

--
Pierre Neidhardt
https://ambrevar.xyz/

reply via email to

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