# Please enter the commit message for your changes.
[safanaj_home.git] / .emacs.d / my-frames.el
blobb59b68b8c8ec217dabac8aa1537be1ee1fc1a30f
1 ;;;; Study dframe by Eric.
2 ;; How to manage frames to display buffers.
3 (setq display-buffer-reuse-frames t)
4 ;; (setq pop-up-frames nil) <<--- this setted at true, is deleterio.
5 ;(setq special-display-buffer-names '("RMAIL" "*IBuffer*" "*Proced*"))
6 (setq same-window-regexps nil)
7 (setq special-display-regexps
8 '(("\\*info.*\\*" (name ."*Info*")(width . 80)(height . 36)(unsplittable . t))
9 ("\\*WoMan .*\\*" (name ."*WoMan*")(width . 80)(height . 36)(unsplittable . t))
10 ; ("\\*-jabber-\\*" (name "Jabber")(width . 30)(hight .30)(unspliitable . t))
11 "\\*Group\\*" "\\*Customize "
12 ".*\\.freenode.*"
13 "irc\\..*:.*"))
15 ;; (progn
16 ;; (select-frame
17 ;; (make-frame '((name . "TEST")(minibuffer . nil))))
18 ;; (rmail))
22 ;(string-match "\\*info\\*" (buffer-name (get-buffer "*info*")))
23 ;;;;
24 ;; Which frame is visible by name
25 (defun frame-is-visible (regex-for-name)
27 (let ((s regex-for-name) (ret nil))
28 (mapcar
29 '(lambda (f)
30 (if (string-match s (get-frame-name f)) (setq ret f)))
31 (frame-list))
32 (and ret (frame-visible-p ret))))
35 ;; Manage Frames
36 (eval-after-load 'my-elisp
37 (progn
38 (if (not (featurep 'frame-fns))
39 (load-file (expand-file-name (concat user-elisp-directory "frame-fns.el"))))
40 (if (not (featurep 'frame-cmds))
41 (load-file (expand-file-name (concat user-elisp-directory "frame-cmds.el"))))
42 ;;;
43 ;; Code here.
44 ;; for resizing ... locked at top-left corner.
45 (defvar frame-resizing-mode-map
46 (let ((m (make-sparse-keymap)))
47 (define-key m (kbd "<up>") 'shrink-frame)
48 (define-key m (kbd "<down>") 'enlarge-frame)
49 (define-key m (kbd "<left>") 'shrink-frame-horizontally)
50 (define-key m (kbd "<right>") 'enlarge-frame-horizontally)
51 (define-key m (kbd "C-c C-c") 'frame-resizing-mode)
52 ; (define-key m (kbd "RET") 'frame-resizing-mode)
53 m))
55 ;;;###autoload
56 (define-minor-mode frame-resizing-mode
57 :initial-value nil
58 :ligther " F-Resizing "
59 :keymap 'frame-resizing-mode-map)
61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
63 ;; for positioning ... locked at top-left corner.
64 (defvar frame-positioning-mode-map
65 (let ((m (make-sparse-keymap)))
66 (define-key m (kbd "<up>") 'move-frame-up)
67 (define-key m (kbd "<down>") 'move-frame-down)
68 (define-key m (kbd "<left>") 'move-frame-left)
69 (define-key m (kbd "<right>") 'move-frame-right)
70 (define-key m (kbd "C-c C-c") 'frame-positioning-mode)
71 ; (define-key m (kbd "RET") 'frame-positioning-mode)
72 m))
74 ;;;###autoload
75 (define-minor-mode frame-positioning-mode
76 :initial-value nil
77 :ligther " F-Positioning "
78 :keymap 'frame-positioning-mode-map)
80 (defun maximum-frame-height () ""
81 (- (/ (x-display-pixel-height)(frame-char-height)) 1))
82 (defun maximum-frame-width () ""
83 (- (/ (- (x-display-pixel-width)
84 (frame-parameter (selected-frame) 'left-fringe)
85 (frame-parameter (selected-frame) 'right-fringe)) (frame-char-width)) 2))
87 (defun set-unmaximized-frame-sizes () "" (interactive)
88 (set-frame-parameter (selected-frame) 'unmaximized-width
89 (frame-parameter (selected-frame) 'width))
90 (set-frame-parameter (selected-frame) 'unmaximized-height
91 (frame-parameter (selected-frame) 'height)))
93 (defun un/maximize-frame (&optional frame)""(interactive)
94 (unless (framep frame) (setq frame (selected-frame)))
95 (if (frame-parameter frame 'maximized)
96 (progn
97 (set-frame-size frame
98 (or (frame-parameter frame 'unmaximized-width) 80)
99 (or (frame-parameter frame 'unmaximized-height) 32))
100 (set-frame-parameter frame 'maximized nil))
101 (set-frame-size frame (maximum-frame-width) (maximum-frame-height))
102 (set-frame-parameter frame 'maximized t)))
105 ;;; (defun maximize-frame (&optional frame)""(interactive)
106 ;;; (if (not (framep frame)) (setq frame (selected-frame))))
108 ;;; (defun unmaximize-frame (&optional frame)""(interactive)
109 ;;; (if (not (framep frame)) (setq frame (selected-frame)))
110 ;;; (set-frame-size frame unmaximized-frame-width unmaximized-frame-height)
111 ;;; (set-frame-parameter frame 'maximized nil))
113 ;; Code End here.
114 "My Frames Managment loaded."))
116 (provide 'my-frames)