emms-help
[Top][All Lists]
Advanced

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

[emms-help] Re: Emms2 patch rollback


From: Michael Olson
Subject: [emms-help] Re: Emms2 patch rollback
Date: Sat, 24 Sep 2005 12:28:56 -0500
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

[Oops, didn't see that there was a thread here already about this;
sorry!]

Yoni Rabkin Katzenell <address@hidden> writes:

> Michael Olson <address@hidden> writes:
>
>> Hi,
>>
>> I noticed that my patch to fix a problem in emms-playlist-mode has
>> been rolled back.  Is there a different way that you'd like me to
>> implement this?  Perhaps by let-binding emms-playlist-buffer-p around
>> the (kill-all-local-variables) line?
>
> Implement it in whichever way you wish as long as you don't break
> any of the existing functionality.

Here's another version.  Please let me know if this breaks anything
that you use.  I'm wrapping kill-all-local-variables to prevent the
value of emms-playlist-buffer-p from getting clobbered.

Unlike the previous attempt, this should keep emms-playlist-buffer-p
set to nil if that was its value before entering the mode.

I've pasted the function definition so that it's easy to do C-M-x on
it and test the results.

(defun emms-playlist-mode ()
  "A major mode for Emms playlists."
  (interactive)
  (let (emms-playlist-buffer-p) ; don't clobber emms-playlist-buffer-p
    (kill-all-local-variables))

  (use-local-map emms-playlist-mode-map)
  (setq major-mode 'emms-playlist-mode
        mode-name "Emms-Playlist")

  (setq emms-playlist-insert-track-function
        'emms-playlist-mode-insert-track)
  (setq emms-playlist-update-track-function
        'emms-playlist-mode-update-track-function)
  ;; Not used yet
  ;; (setq emms-playlist-delete-track-function
  ;;       ...)
  (add-hook 'emms-playlist-selection-changed-hook
            'emms-playlist-mode-overlay-selected)

  (emms-playlist-mode-startup)

  (run-hooks 'emms-playlist-mode-hooks))

> What is `emms-add-all'? I am not familiar with that function in
> Emms2. It is not explicitly defined in the code. Is it the result of
> a macro? Could you point it out for me so that I can understand what
> is going wrong?

It's defined as a result of the `define-emms-combined-source', and
then `define-emms-source', macro.  `emms-add-all' eventually calls
`emms-playlist-new' by means of `with-current-emms-playlist' and
`emms-playlist-current-clear'.

emms-playlist-new sets emms-playlist-buffer-p to t, and this is the
only place that emms-playlist-buffer-p is set.  If
emms-playlist-buffer-p is nil in a valid playlist buffer, weird stuff
happens all over the place.

-- 
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Interests: anime, Debian, XHTML, wiki, Emacs Lisp
  /` |\ | | | IRC: mwolson on freenode.net: #hcoop, #muse, #PurdueLUG
 |_] | \| |_| Jabber: mwolson_at_hcoop.net

Attachment: pgpSjsfNTxqYn.pgp
Description: PGP signature


reply via email to

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