bongo-devel
[Top][All Lists]
Advanced

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

[bongo-devel] Re: VLC and audio CD's


From: Daniel Jensen
Subject: [bongo-devel] Re: VLC and audio CD's
Date: Thu, 05 Apr 2007 15:42:58 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

Daniel Brockman <address@hidden> writes:

>> Now we just need `i'.
>
> Well, I implemented it, and then I installed it.

I changed a bunch of stuff. Patch included, but you may not like all
of it.

  *  `bongo-playlist-file-p' was broken.

  *  The test for `bongo-insert-whole-directory-trees' was broken.

  *  `bongo-insert' really should be merged with `bongo-insert-file',
     so I did. This removes the name `bongo-insert'.

  *  The merge fixes wildcard expansion that `bongo-insert' didn't
     handle at all.

diff -Naur bongo-old/bongo.el bongo-new/bongo.el
--- bongo-old/bongo.el  2007-04-05 13:54:52.000000000 +0200
+++ bongo-new/bongo.el  2007-04-05 15:40:52.000000000 +0200
@@ -6696,11 +6696,32 @@
   (bongo-insert-line 'bongo-header t 'bongo-fields
                      (or fields (bongo-line-external-fields))))
 
+(defcustom bongo-insert-whole-directory-trees 'ask
+  "Whether to insert directory trees recursively.
+This controls how the `\\[bongo-insert]' command inserts directories.
+If nil, only insert files immediately contained in the top directory.
+If `ask', prompt the user every time.
+If any other value, insert all files in the whole directory tree."
+  :type '(choice (const :tag "No" nil)
+                 (const :tag "Ask" ask)
+                 (other :tag "Yes" t))
+  :group 'bongo)
+
 (defun bongo-insert-file (file-name)
-  "Insert a new track line corresponding to FILE-NAME.
-If FILE-NAME names a directory, call `bongo-insert-directory-tree'.
+  "Insert FILE-NAME into the current Bongo buffer.
+If FILE-NAME is the name of a local directory, insert its contents;
+  see `bongo-insert-whole-directory-trees' and
+  `bongo-insert-directory-tree'.
+If FILE-NAME is the name of a playlist file, insert its contents.
+If FILE-NAME is the name of a local file, insert a file track.
+Otherwise just treat FILE-NAME as the name of a local file
+
 Interactively, expand wildcards and insert all matching files
 unless `find-file-wildcards' is set to nil."
+  ;; It would be good if this function could insert URIs,
+  ;; but then `read-file-name' cannot be used for completion
+  ;; since it interprets double slash as special syntax for
+  ;; discarding whatever comes before.
   (interactive
    (list (let ((file-string
                 (read-file-name "Insert file or directory tree: "
@@ -6725,7 +6746,13 @@
                (mapc 'bongo-insert-file file-name)
                (bongo-maybe-join-inserted-tracks beginning (point))))))
         ((file-directory-p file-name)
-         (bongo-insert-directory-tree file-name))
+         (if (case bongo-insert-whole-directory-trees
+               (ask (y-or-n-p "Insert whole directory tree? "))
+               (t bongo-insert-whole-directory-trees))
+             (bongo-insert-directory-tree file-name)
+           (bongo-insert-directory file-name)))
+        ((bongo-playlist-file-p file-name)
+         (bongo-insert-playlist-contents file-name))
         (t
          (with-bongo-buffer
            (bongo-insert-line 'bongo-file-name file-name))
@@ -6973,10 +7000,10 @@
   "Return non-nil if FILE-NAME appears to be a playlist file.
 Currently, only PLS and M3U playlists are supported."
   (let ((extension (file-name-extension file-name))
-        (case-fold-search t)) 
+        (case-fold-search t))
     (and extension
-         (string-match extension
-                       (regexp-opt bongo-playlist-file-name-extensions)))))
+         (string-match (regexp-opt bongo-playlist-file-name-extensions)
+                       extension))))
 
 (defun bongo-insert-playlist-contents (file-name)
   "Insert the contents of playlist FILE-NAME.
@@ -6997,40 +7024,6 @@
   (with-bongo-buffer
     (bongo-insert-line 'bongo-action action)))
 
-(defcustom bongo-insert-whole-directory-trees 'ask
-  "Whether to insert directory trees recursively.
-This controls how the `\\[bongo-insert]' command inserts directories.
-If nil, only insert files immediately contained in the top directory.
-If `ask', prompt the user every time.
-If any other value, insert all files in the whole directory tree."
-  :type '(choice (const :tag "No" nil)
-                 (const :tag "Ask" ask)
-                 (other :tag "Yes" t))
-  :group 'bongo)
-
-(defun bongo-insert (file-name)
-  "Insert FILE-NAME into the current Bongo buffer.
-If FILE-NAME is the name of a local directory, insert its contents;
-  see `bongo-insert-whole-directory-trees'.
-If FILE-NAME is the name of a playlist file, insert its contents.
-If FILE-NAME is the name of a local file, insert a file track.
-Otherwise just treat FILE-NAME as the name of a local file."
-  ;; It would be good if this function could insert URIs,
-  ;; but then `read-file-name' cannot be used for completion
-  ;; since it interprets double slash as special syntax for
-  ;; discarding whatever comes before.
-  (interactive "fInsert file or directory: ")
-  (cond ((file-directory-p file-name)
-         (if (or (and (eq bongo-insert-whole-directory-trees 'ask)
-                      (y-or-n-p "Insert whole directory tree? "))
-                 bongo-insert-whole-directory-trees)
-             (bongo-insert-directory-tree file-name)
-           (bongo-insert-directory file-name)))
-        ((bongo-playlist-file-p file-name)
-         (bongo-insert-playlist-contents file-name))
-        (t
-         (bongo-insert-file file-name))))
-
 (defvar bongo-insertion-command-alist
   '(("Action" . bongo-insert-action)
     ("CD tracks" . bongo-insert-cd)
@@ -8438,7 +8431,7 @@
     (define-key map "P" 'bongo-previous)
     (define-key map "N" 'bongo-next)
     (define-key map "s" 'bongo-seek)
-    (define-key map "i" 'bongo-insert)
+    (define-key map "i" 'bongo-insert-file)
     (define-key map "I" 'bongo-insert-special)
     (define-key map "e" 'bongo-append-enqueue)
     (define-key map "E" 'bongo-insert-enqueue)

reply via email to

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