Skip to content

Commit

Permalink
Merge pull request #197 from jianingy/side-window
Browse files Browse the repository at this point in the history
create the neotree window by `display-buffer-in-side-window`.
  • Loading branch information
aborn authored Oct 12, 2016
2 parents ed8de7f + dc74897 commit ba1f4ba
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions neotree.el
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,6 @@ window."
:type 'boolean
:group 'neotree)

(defcustom neo-dont-be-alone nil
"*If non-nil, you cannot left neotree window alone."
:type 'boolean
:group 'neotree)

(defcustom neo-persist-show t
"*If non-nil, NeoTree window will not be turned off while press C\-x 1."
:type 'boolean
Expand Down Expand Up @@ -646,9 +641,7 @@ The side is decided according to `neo-window-position'.
The root window is the root window of the selected frame.
_ALIST is ignored."
(let ((window-pos (if (eq neo-window-position 'left) 'left 'right)))
(split-window
(frame-root-window (window-frame (selected-window)))
nil window-pos)))
(display-buffer-in-side-window buffer `((side . ,window-pos)))))

(defun neo-global--create-window ()
"Create global neotree window."
Expand Down Expand Up @@ -781,30 +774,6 @@ The description of ARG is in `neotree-enter'."
;; Advices
;;

(defadvice delete-other-windows
(around neotree-delete-other-windows activate)
"Delete all windows except neotree."
(interactive)
(if (neo-global--with-buffer
neo-buffer--persist-show)
(mapc
(lambda (window)
(unless (string-equal (buffer-name (window-buffer window))
neo-buffer-name)
(delete-window window)))
(cdr (window-list)))
ad-do-it))

(defadvice delete-window
(around neotree-delete-window activate)
"Stop to delete window which it is the last window except NeoTree."
(if (and neo-dont-be-alone
(not (eq window
neo-global--window))
(neo-global--alone-p))
(message "only one window other than neotree left. won't close")
ad-do-it))

(defadvice mouse-drag-vertical-line
(around neotree-drag-vertical-line (start-event) activate)
"Drag and drop is not affected by the lock."
Expand Down

0 comments on commit ba1f4ba

Please sign in to comment.