Skip to content

Commit

Permalink
+Allow user to set the way opened buffers should be displayed.
Browse files Browse the repository at this point in the history
  • Loading branch information
escherdragon committed Dec 17, 2017
1 parent 855ed75 commit cf8305a
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions sunrise-commander.el
Expand Up @@ -7,7 +7,7 @@
;; Maintainer: José Alfredo Romero L. <escherdragon@gmail.com>
;; Created: 24 Sep 2007
;; Version: 6
;; RCS Version: $Rev: 463 $
;; RCS Version: $Rev: 464 $
;; Keywords: files, dired, midnight commander, norton, orthodox
;; URL: http://www.emacswiki.org/emacs/sunrise-commander.el
;; Compatibility: GNU Emacs 22+
Expand Down Expand Up @@ -246,6 +246,24 @@ You can also customize what files are considered hidden by setting
:group 'sunrise
:type 'boolean)

(defcustom sr-visit-buffer-function 'sr-visit-buffer-in-current-frame
"Determines how newly opened buffers are to be displayed.
The following options are supported:
* Visit in current frame - Quit Sunrise and display the new
buffer in the current frame.
* Visit in dedicated frame - Create a separate dedicated frame
and display the buffer in it. The frame will be automatically
destroyed when the buffer is killed.
* Other - Provide your own function to display the given buffer."
:group 'sunrise
:type '(choice
(function-item :tag "Visit in current frame" sr-visit-buffer-in-current-frame)
(function-item :tag "Visit in dedicated frame" special-display-popup-frame)
(function :tag "Other")))

(defcustom sr-terminal-kill-buffer-on-exit t
"Whether to kill terminal buffers after their shell process ends."
:group 'sunrise
Expand Down Expand Up @@ -1775,16 +1793,20 @@ AVFS."
(sr-backup-buffer))

(defun sr-find-regular-file (filename &optional wildcards)
"Deactivate Sunrise and visit FILENAME as a regular file with WILDCARDS.
"Visit FILENAME as a regular file with WILDCARDS.
\(See `find-file' for more details on wildcard expansion.)"
(condition-case description
(let ((buff (find-file-noselect filename nil nil wildcards)))
(sr-save-panes-width)
(sr-quit)
(set-window-configuration sr-prior-window-configuration)
(switch-to-buffer buff))
(let ((buffer (find-file-noselect filename nil nil wildcards)))
(funcall sr-visit-buffer-function buffer))
(error (message "%s" (cadr description)))))

(defun sr-visit-buffer-in-current-frame (buffer)
"Deactivate Sunrise and display the given buffer in the current frame."
(sr-save-panes-width)
(sr-quit)
(set-window-configuration sr-prior-window-configuration)
(switch-to-buffer buffer))

(defun sr-avfs-dir (filename)
"Return the virtual path for accessing FILENAME through AVFS.
Returns nil if AVFS cannot manage this kind of file."
Expand Down

0 comments on commit cf8305a

Please sign in to comment.