emms-patches
[Top][All Lists]
Advanced

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

[Emms-patches] darcs patch: emms-streams: Implement kill and yank.


From: Michael Olson
Subject: [Emms-patches] darcs patch: emms-streams: Implement kill and yank.
Date: Tue, 30 May 2006 00:02:18 -0400

Tue May 30 00:01:14 EDT 2006  Michael Olson <address@hidden>
  * emms-streams: Implement kill and yank.
New patches:

[emms-streams: Implement kill and yank.
Michael Olson <address@hidden>**20060530040114] {
hunk ./emms-streams.el 55
-(defface emms-stream-url-face '((t (:foreground "LightSteelBlue")))
+(defface emms-stream-url-face
+  '((((class color) (background dark))
+     (:foreground "LightSteelBlue"))
+    (((class color) (background light))
+     (:foreground "Blue")))
hunk ./emms-streams.el 138
-    (define-key map [(control ?a)] 'beginning-of-line)
-    (define-key map [(control ?e)] 'end-of-line)
-    (define-key map [(control ?k)] 'emms-stream-kill-bookmark)
-    (define-key map [(control ?y)] 'emms-stream-yank-bookmark)
-    (define-key map [(control ?n)] 'emms-stream-next-line)
-    (define-key map [(control ?p)] 'emms-stream-previous-line)
-    (define-key map [?Q] 'emms-stream-quit)
-    (define-key map [?a] 'emms-stream-add-bookmark)
-    (define-key map [?d] 'emms-stream-delete-bookmark)
-    (define-key map [?e] 'emms-stream-edit-bookmark)
-    (define-key map [?h] 'describe-mode)
-    (define-key map [?n] 'emms-stream-next-line)
-    (define-key map [?p] 'emms-stream-previous-line)
-    (define-key map [?q] 'emms-stream-quit)
-    (define-key map [?s] 'emms-stream-save-bookmarks-file)
-    (define-key map [?t] 'emms-stream-toggle-default-action)
-;;    (define-key map [?u] 'emms-stream-move-bookmark-up)
-    (define-key map [?i] 'emms-stream-info-bookmark)
+    (define-key map (kbd "C-a") 'beginning-of-line)
+    (define-key map (kbd "C-e") 'end-of-line)
+    (define-key map (kbd "C-k") 'emms-stream-kill-bookmark)
+    (define-key map (kbd "C-y") 'emms-stream-yank-bookmark)
+    (define-key map (kbd "C-n") 'emms-stream-next-line)
+    (define-key map (kbd "C-p") 'emms-stream-previous-line)
+    (define-key map (kbd "M-y") 'emms-stream-yank-pop)
+    (define-key map (kbd "Q") 'emms-stream-quit)
+    (define-key map (kbd "a") 'emms-stream-add-bookmark)
+    (define-key map (kbd "d") 'emms-stream-delete-bookmark)
+    (define-key map (kbd "e") 'emms-stream-edit-bookmark)
+    (define-key map (kbd "h") 'describe-mode)
+    (define-key map (kbd "n") 'emms-stream-next-line)
+    (define-key map (kbd "p") 'emms-stream-previous-line)
+    (define-key map (kbd "q") 'emms-stream-quit)
+    (define-key map (kbd "s") 'emms-stream-save-bookmarks-file)
+    (define-key map (kbd "t") 'emms-stream-toggle-default-action)
+;;    (define-key map (kbd "u") 'emms-stream-move-bookmark-up)
+    (define-key map (kbd "i") 'emms-stream-info-bookmark)
hunk ./emms-streams.el 190
+  (set-buffer-modified-p nil)
hunk ./emms-streams.el 402
+(defun emms-stream-look-behind ()
+  "Return non-nil if the position behind the point is an emms-stream."
+  (and (not (bobp))
+       (get-text-property (1- (point)) 'emms-stream)))
+
+(defun emms-stream-back-to-stream ()
+  "If we are not on a stream, move backwards to the nearest one."
+  (unless (get-text-property (point) 'emms-stream)
+    (unless (emms-stream-look-behind)
+      (goto-char (or (previous-single-property-change (point) 'emms-stream)
+                     (point-min))))
+    (goto-char (or (previous-single-property-change (point) 'emms-stream)
+                   (point-min)))))
+
+;; Killing and yanking
+(defun emms-stream-kill-bookmark ()
+  "Kill the current bookmark."
+  (interactive)
+  (emms-stream-back-to-stream)
+  (let ((inhibit-read-only t))
+    (kill-line 2)))
+
+(defun emms-stream-yank-bookmark ()
+  "Yank bookmark into the streams buffer."
+  (interactive)
+  (emms-stream-back-to-stream)
+  (let ((inhibit-read-only t))
+    (save-restriction
+      (narrow-to-region (point) (point))
+      (yank)
+      (remove-text-properties (point-min) (point-max)
+                              '(emms-stream nil face nil))
+      (goto-char (point-min))
+      (while (and (< (point) (point-max))
+                  (looking-at "^\\(.+\\)\n      \\(.+\\)\n"))
+        (add-text-properties (match-beginning 1) (match-end 1)
+                             '(face emms-stream-name-face))
+        (add-text-properties (match-beginning 1) (match-end 1)
+                             (list 'emms-stream
+                                   (list (match-string 1) (match-string 2))))
+        (goto-char (match-beginning 2))
+        (add-text-properties (point-at-bol) (match-end 2)
+                             '(face emms-stream-url-face))
+        (goto-char (match-end 0))))))
+
+(defun emms-stream-yank-pop ()
+  "Cycle through the kill-ring."
+  (interactive)
+  (let ((inhibit-read-only t))
+    (yank-pop nil)))
+
hunk ./emms-streams.el 465
-  (unless (get-text-property (point) 'emms-stream)
-    (goto-char (or (previous-single-property-change (point) 'emms-stream)
+  (emms-stream-back-to-stream)
+  (goto-char (or (previous-single-property-change (point) 'emms-stream)
hunk ./emms-streams.el 468
-    (goto-char (or (previous-single-property-change (point) 'emms-stream)
-                   (point-min))))
-  (when (get-text-property (point) 'emms-stream)
-    (goto-char (or (previous-single-property-change (point) 'emms-stream)
-                   (point-min))))
}

Context:

[emms-streams: Make hitting RET on a URL do the right thing, improve cursor 
movement, and mark the buffer as unmodified after performing a save.
Michael Olson <address@hidden>**20060529030043] 
[emms-player-mpd: Use more robust method of detecting whether we need to 
force-feed MusicPD our playlist.
Michael Olson <address@hidden>**20060525014253] 
[emms-playlist-mode: Make "d" kill the entire line.  This seems to be a good 
compromise of those who use C-k and those who want more standard object-killing 
behavior.
foo**20060524200008] 
[emms-player-mpd: When showing the currently-playing song, prepend the name of 
the radio station, if it exists.
foo**20060524195911] 
[emms-player-mpd: Make seek work correctly.
Michael Olson <address@hidden>**20060525033120] 
[emms-player-mpd: Fix bug that caused unconditional reloading of the entire 
MusicPD playlist whenever the track was changed manually.
Michael Olson <address@hidden>**20060524061655] 
[emms-player-mpd: Overhaul for streamlist support, and fix a few miscellaneous 
issues.
Michael Olson <address@hidden>**20060524055707] 
[emms-player-mpd: Add a few checks to make sure that the given buffer exists 
before trying to do anything with it.
Michael Olson <address@hidden>**20060517035419] 
[emms-source-playlist: Do not expand names of files in playlists, as this can 
cause problems with emms-player-mpd in some configurations.
Michael Olson <address@hidden>**20060516081257] 
[emms-playlist-mode: Implement the option (disabled by default) of opening a 
new EMMS buffer for a playlist, when hitting RET on one.
Michael Olson <address@hidden>**20060510040730] 
[emms-playlist-mode.el: Don't put a period after the mode map. This hangs 21.4 
on display.
address@hidden 
[TAG 2.0
address@hidden 
Patch bundle hash:
9dd3eac3a8b2b0dd348805f1e9ead62e2c9495b1

reply via email to

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