Skip to content
Newer
Older
100644 81 lines (67 sloc) 3.04 KB
20b6bee @thierryvolpiatto * helm-elscreen.el: New
thierryvolpiatto authored Mar 22, 2012
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
22cb4d5 @thierryvolpiatto * helm-config.el: Move more code in helm-elisp.el, helm-elscreen.el, …
thierryvolpiatto authored Mar 22, 2012
22 (declare-function elscreen-find-screen-by-buffer "ext:elscreen.el" (buffer &optional create))
23 (declare-function elscreen-find-file "ext:elscreen.el" (filename))
24 (declare-function elscreen-goto "ext:elscreen.el" (screen))
25
20b6bee @thierryvolpiatto * helm-elscreen.el: New
thierryvolpiatto authored Mar 22, 2012
26 (defun helm-find-buffer-on-elscreen (candidate)
27 "Open buffer in new screen, if marked buffers open all in elscreens."
28 (helm-require-or-error 'elscreen 'helm-find-buffer-on-elscreen)
29 (helm-aif (helm-marked-candidates)
30 (dolist (i it)
31 (let ((target-screen (elscreen-find-screen-by-buffer
32 (get-buffer i) 'create)))
33 (elscreen-goto target-screen)))
34 (let ((target-screen (elscreen-find-screen-by-buffer
35 (get-buffer candidate) 'create)))
36 (elscreen-goto target-screen))))
37
38 (defun helm-elscreen-find-file (file)
39 (helm-require-or-error 'elscreen 'helm-elscreen-find-file)
40 (elscreen-find-file file))
41
42 (defvar helm-c-source-elscreen
43 '((name . "Elscreen")
44 (candidates
45 . (lambda ()
46 (if (cdr (elscreen-get-screen-to-name-alist))
47 (sort
48 (loop for sname in (elscreen-get-screen-to-name-alist)
49 append (list (format "[%d] %s" (car sname) (cdr sname))))
50 #'(lambda (a b) (compare-strings a nil nil b nil nil))))))
51 (action
52 . (("Change Screen" .
53 (lambda (candidate)
54 (elscreen-goto (- (aref candidate 1) (aref "0" 0)))))
55 ("Kill Screen(s)" .
56 (lambda (candidate)
57 (dolist (i (helm-marked-candidates))
58 (elscreen-goto (- (aref i 1) (aref "0" 0)))
59 (elscreen-kill))))
60 ("Only Screen" .
61 (lambda (candidate)
62 (elscreen-goto (- (aref candidate 1) (aref "0" 0)))
63 (elscreen-kill-others)))))))
64
65 ;;;###autoload
66 (defun helm-elscreen ()
67 "Preconfigured helm to list elscreen."
68 (interactive)
69 (helm-other-buffer 'helm-c-source-elscreen "*Helm Elscreen*"))
70
71 (provide 'helm-elscreen)
72
37b4201 @thierryvolpiatto Fix dependencies and autoloads. Reorder.
thierryvolpiatto authored Mar 28, 2012
73 ;; Local Variables:
a7ee65b @thierryvolpiatto Disable compile warnings and add new keyword to helm.
thierryvolpiatto authored Jul 30, 2012
74 ;; byte-compile-warnings: (not cl-functions obsolete)
37b4201 @thierryvolpiatto Fix dependencies and autoloads. Reorder.
thierryvolpiatto authored Mar 28, 2012
75 ;; coding: utf-8
76 ;; indent-tabs-mode: nil
77 ;; byte-compile-dynamic: t
78 ;; End:
79
20b6bee @thierryvolpiatto * helm-elscreen.el: New
thierryvolpiatto authored Mar 22, 2012
80 ;;; helm-elscreen.el ends here
Something went wrong with that request. Please try again.