[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [emms-help] emms-browser-add-tracks weirdness
From: |
Yoni Rabkin |
Subject: |
Re: [emms-help] emms-browser-add-tracks weirdness |
Date: |
Wed, 21 Nov 2018 17:29:05 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
"Fran Burstall (Gmail)" <address@hidden> writes:
> 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
Does this only happen when the browser buffer is a new one where a
mark/region has never been established? I would assume that once a mark
had been established in the buffer the problem wouldn't show up.
> 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/
>
>
>
> _______________________________________________
> Emms-help mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/emms-help
>
--
"Cut your own wood and it will warm you twice"