[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emms-patches] darcs patch: emms-streams: Re-implement yank and kill so
From: |
Michael Olson |
Subject: |
[Emms-patches] darcs patch: emms-streams: Re-implement yank and kill so that they ... |
Date: |
Tue, 30 May 2006 00:56:52 -0400 |
Tue May 30 00:54:29 EDT 2006 Michael Olson <address@hidden>
* emms-streams: Re-implement yank and kill so that they do the right thing
with emms-stream-list.
New patches:
[emms-streams: Re-implement yank and kill so that they do the right thing with
emms-stream-list.
Michael Olson <address@hidden>**20060530045429] {
hunk ./emms-streams.el 24
-;; Commentary:
+;;; Commentary:
hunk ./emms-streams.el 31
-;; Code:
+;;; Code:
hunk ./emms-streams.el 144
- (define-key map (kbd "M-y") 'emms-stream-yank-pop)
hunk ./emms-streams.el 306
+(defun emms-stream-insert-several-at (n new-list list)
+ "Inserts the list NEW-LIST in LIST, *before* position N.
+Positions are counted starting with 0."
+ (let* ((n-1 (- n 1))
+ (before (emms-stream-take n-1 list))
+ (after (last list (- (length list) n-1))))
+ (append before new-list after)))
+
+(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)))))
+
hunk ./emms-streams.el 330
+ (emms-stream-back-to-stream)
hunk ./emms-streams.el 333
-
hunk ./emms-streams.el 336
- (goto-char 1)
+ (goto-char (point-min))
hunk ./emms-streams.el 343
- (interactive "sName of the bookmark:
-sURL:
-nFeed descriptor:
+ (interactive "sName of the bookmark:
+sURL:
+nFeed descriptor (use 1 if unsure):
hunk ./emms-streams.el 359
- (let ((line (emms-line-number-at-pos (point))))
+ (let ((line (emms-line-number-at-pos (point))))
hunk ./emms-streams.el 361
- (remove (emms-stream-get-bookmark-at-point) emms-stream-list))
+ (delete (emms-stream-get-bookmark-at-point) emms-stream-list))
hunk ./emms-streams.el 423
-(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)))))
-
hunk ./emms-streams.el 424
+(defvar emms-stream-killed-streams ()
+ "Bookmarks that have been killed.")
+
hunk ./emms-streams.el 430
- (emms-stream-back-to-stream)
+ (let ((stream (emms-stream-get-bookmark-at-point)))
+ (setq emms-stream-list (delete stream emms-stream-list)
+ emms-stream-killed-streams (cons stream emms-stream-killed-streams)))
hunk ./emms-streams.el 440
- (let ((inhibit-read-only t))
+ (let ((inhibit-read-only t)
+ (streams nil))
+ ;; get all valid streams
hunk ./emms-streams.el 446
- (remove-text-properties (point-min) (point-max)
- '(emms-stream nil face nil))
hunk ./emms-streams.el 448
+ (car emms-stream-killed-streams)
hunk ./emms-streams.el 450
- (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)))
+ (setq streams (cons (car emms-stream-killed-streams) streams)
+ emms-stream-killed-streams (cdr emms-stream-killed-streams))
+ (goto-char (match-end 0)))
+ (delete-region (point-min) (point-max)))
+ ;; insert streams into list
+ (if streams
+ (let* ((line (emms-line-number-at-pos (point)))
+ (index (+ (/ line 2) 1)))
+ (setq emms-stream-list (emms-stream-insert-several-at
+ index streams emms-stream-list))
+ (setq line (+ line (* (length streams) 2)))
+ (emms-stream-redisplay)
+ (goto-line line))
+ (message "Not yanking anything"))))
}
Context:
[emms-streams: Implement kill and yank.
Michael Olson <address@hidden>**20060530040114]
[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:
e3efd672f36a0d6460a833f5d6b4d83bd2a6a02a
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emms-patches] darcs patch: emms-streams: Re-implement yank and kill so that they ...,
Michael Olson <=