Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 72 lines (60 sloc) 2.741 kB
20b6bee @thierryvolpiatto * helm-elscreen.el: New
thierryvolpiatto authored
1 ;;; helm-elscreen.el -- Elscreen support
2
3 ;; Copyright (C) 2012 Thierry Volpiatto <thierry.volpiatto@gmail.com>
4
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, either version 3 of the License, or
8 ;; (at your option) any later version.
9
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
14
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Code:
19 (eval-when-compile (require 'cl))
20 (require 'helm)
21
22 ;;
23 ;;
24 (defun helm-find-buffer-on-elscreen (candidate)
25 "Open buffer in new screen, if marked buffers open all in elscreens."
26 (helm-require-or-error 'elscreen 'helm-find-buffer-on-elscreen)
27 (helm-aif (helm-marked-candidates)
28 (dolist (i it)
29 (let ((target-screen (elscreen-find-screen-by-buffer
30 (get-buffer i) 'create)))
31 (elscreen-goto target-screen)))
32 (let ((target-screen (elscreen-find-screen-by-buffer
33 (get-buffer candidate) 'create)))
34 (elscreen-goto target-screen))))
35
36 (defun helm-elscreen-find-file (file)
37 (helm-require-or-error 'elscreen 'helm-elscreen-find-file)
38 (elscreen-find-file file))
39
40 (defvar helm-c-source-elscreen
41 '((name . "Elscreen")
42 (candidates
43 . (lambda ()
44 (if (cdr (elscreen-get-screen-to-name-alist))
45 (sort
46 (loop for sname in (elscreen-get-screen-to-name-alist)
47 append (list (format "[%d] %s" (car sname) (cdr sname))))
48 #'(lambda (a b) (compare-strings a nil nil b nil nil))))))
49 (action
50 . (("Change Screen" .
51 (lambda (candidate)
52 (elscreen-goto (- (aref candidate 1) (aref "0" 0)))))
53 ("Kill Screen(s)" .
54 (lambda (candidate)
55 (dolist (i (helm-marked-candidates))
56 (elscreen-goto (- (aref i 1) (aref "0" 0)))
57 (elscreen-kill))))
58 ("Only Screen" .
59 (lambda (candidate)
60 (elscreen-goto (- (aref candidate 1) (aref "0" 0)))
61 (elscreen-kill-others)))))))
62
63 ;;;###autoload
64 (defun helm-elscreen ()
65 "Preconfigured helm to list elscreen."
66 (interactive)
67 (helm-other-buffer 'helm-c-source-elscreen "*Helm Elscreen*"))
68
69 (provide 'helm-elscreen)
70
71 ;;; helm-elscreen.el ends here
Something went wrong with that request. Please try again.